JezK
Edit File: sc-upsell-submit-button.cjs.entry.js.map
{"file":"sc-upsell-submit-button.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,uBAAuB,GAAG,qnDAAqnD,CAAC;AACtpD,mCAAe,uBAAuB;;MCiBzB,oBAAoB;;;;IAG/B,kBAAkB;;QAChB,OAAO,CAAA,MAAAA,WAAW,CAAC,OAAO,0CAAE,EAAE,KAAI,EAAE,CAAC;KACtC;IAED,MAAM,qBAAqB,CAAC,CAAC;QAC3B,CAAC,CAAC,cAAc,EAAE,CAAC;QACnBC,gBAAM,EAAE,CAAC;KACV;IAED,MAAM;QACJ,QACEC,QAACC,UAAI,qDACH,KAAK,EAAE;gBACL,SAAS,EAAEC,cAAM,EAAE;gBACnB,aAAa,EAAEJ,WAAW,CAAC,QAAQ;;gBAEnC,aAAa,EAAE,CAACK,4BAAmB,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAACC,iCAAwB,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAAAC,iBAAY,aAAZA,iBAAY,uBAAZA,iBAAY,CAAE,IAAI,MAAK,cAAc;gBAChK,gBAAgB,EAAED,iCAAwB,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAAC,iBAAY,aAAZA,iBAAY,uBAAZA,iBAAY,CAAE,IAAI,MAAK,SAAS;aAC1G,EACD,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAE3CL,oEAAQ,CACH,EACP;KACH;;;;;;;","names":["upsellState","accept","h","Host","isBusy","isProductOutOfStock","isSelectedVariantMissing","noticesState"],"sources":["src/components/controllers/upsell/sc-upsell-submit-button/sc-upsell-submit-button.scss?tag=sc-upsell-submit-button","src/components/controllers/upsell/sc-upsell-submit-button/sc-upsell-submit-button.tsx"],"sourcesContent":["sc-upsell-submit-button {\n position: relative;\n display: block;\n\n .wp-block-button__link {\n position: relative;\n text-decoration: none;\n\n span {\n sc-icon {\n padding-right: var(--sc-spacing-small);\n }\n }\n\n [data-text], sc-spinner {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n }\n\n .sc-block-button--sold-out,\n .sc-block-button--unavailable {\n display: none !important;\n }\n\n &.is-unavailable {\n .sc-block-button__link {\n display: none !important;\n }\n .sc-block-button--unavailable {\n display: initial !important;\n }\n }\n\n &.is-sold-out {\n .sc-block-button__link {\n display: none !important;\n }\n .sc-block-button--sold-out {\n display: initial !important;\n }\n }\n\n sc-spinner::part(base) {\n --indicator-color: currentColor;\n --spinner-size: 12px;\n position: absolute;\n top: calc(50% - var(--spinner-size) + (var(--spinner-size) / 4));\n left: calc(50% - var(--spinner-size) + (var(--spinner-size) / 4));\n }\n\n [data-text],\n [data-loader] {\n transition: opacity var(--sc-transition-fast) ease-in-out, visibility var(--sc-transition-fast) ease-in-out;\n }\n\n [data-loader] {\n opacity: 0;\n visibility: hidden;\n }\n\n &.is-disabled {\n pointer-events: none;\n }\n\n &.is-busy {\n [data-text] {\n opacity: 0;\n visibility: hidden;\n }\n [data-loader] {\n opacity: 1;\n visibility: visible;\n }\n }\n\n &.is-out-of-stock {\n [data-text] {\n opacity: 0.6;\n }\n }\n}\n","/**\n * External dependencies.\n */\nimport { Component, Element, h, Host } from '@stencil/core';\n\n/**\n * Internal dependencies.\n */\nimport { state as upsellState } from '@store/upsell';\nimport { state as noticesState } from '@store/notices';\nimport { isProductOutOfStock, isSelectedVariantMissing } from '@store/product/getters';\nimport { accept } from '@store/upsell/mutations';\nimport { isBusy } from '@store/upsell/getters';\n\n@Component({\n tag: 'sc-upsell-submit-button',\n styleUrl: 'sc-upsell-submit-button.scss',\n})\nexport class ScUpsellSubmitButton {\n @Element() el: HTMLScUpsellSubmitButtonElement;\n\n getUpsellProductId() {\n return upsellState.product?.id || '';\n }\n\n async handleAddToOrderClick(e) {\n e.preventDefault();\n accept();\n }\n\n render() {\n return (\n <Host\n class={{\n 'is-busy': isBusy(),\n 'is-disabled': upsellState.disabled,\n // TODO: change this to out of stock error message.\n 'is-sold-out': (isProductOutOfStock(this.getUpsellProductId()) && !isSelectedVariantMissing(this.getUpsellProductId())) || noticesState?.code === 'out_of_stock',\n 'is-unavailable': isSelectedVariantMissing(this.getUpsellProductId()) || noticesState?.code === 'expired',\n }}\n onClick={e => this.handleAddToOrderClick(e)}\n >\n <slot />\n </Host>\n );\n }\n}\n"],"version":3}