JezK
Edit File: sc-upsell-totals.entry.js.map
{"file":"sc-upsell-totals.entry.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA,MAAM,iBAAiB,GAAG,6LAA6L,CAAC;AACxN,6BAAe,iBAAiB;;;;;;;;0SCY8E,UAAE,wBAAwB,UAAE;;;;;;;;;;;;;;;;;;;;;;;;uNAiCtF,eAAO,CAAC,UAAE;oJAUjD,eAAO,CAAC,UAAE;;;;wjBAea,UAAE;;;yGAUG,UAAE;yPASL,UAAE,+cAQV,UAAE;;;;;;;","names":[],"sources":["src/components/controllers/upsell/sc-upsell-totals/sc-upsell-totals.css?tag=sc-upsell-totals&encapsulation=shadow","src/components/controllers/upsell/sc-upsell-totals/sc-upsell-totals.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\nsc-divider {\n margin: 16px 0 !important;\n}\n.conversion-description {\n color: var(--sc-color-gray-500);\n font-size: var(--sc-font-size-small);\n margin-right: var(--sc-spacing-xx-small);\n}\n","/**\n * External dependencies.\n */\nimport { Component, Fragment, h } from '@stencil/core';\nimport { state } from '@store/upsell';\nimport { __, sprintf } from '@wordpress/i18n';\n@Component({\n tag: 'sc-upsell-totals',\n styleUrl: 'sc-upsell-totals.css',\n shadow: true,\n})\nexport class ScUpsellTotals {\n renderAmountDue() {\n return state.amount_due > 0 ? state?.line_item?.total_display_amount : !!state?.line_item?.trial_amount ? __('Trial', 'surecart') : __('Free', 'surecart');\n }\n\n // Determine if the currency should be displayed to avoid duplication in the amount display.\n getCurrencyToDisplay() {\n return state?.line_item?.total_default_currency_display_amount?.toLowerCase()?.includes(state?.line_item?.currency?.toLowerCase())\n ? ''\n : state?.line_item?.currency?.toUpperCase();\n }\n\n renderConversion() {\n // need to check the checkout for a few things.\n const checkout = state?.checkout;\n\n if (!checkout?.show_converted_total) {\n return null;\n }\n\n // the currency is the same as the current currency.\n if (checkout?.currency === checkout?.current_currency) {\n return null;\n }\n\n // there is no amount due.\n if (!state?.line_item?.total_amount) {\n return null;\n }\n\n return (\n <Fragment>\n <sc-divider></sc-divider>\n <sc-line-item style={{ '--price-size': 'var(--sc-font-size-x-large)' }}>\n <span slot=\"title\">\n <slot name=\"charge-amount-description\">{sprintf(__('Payment Total', 'surecart'), state?.line_item?.currency?.toUpperCase())}</slot>\n </span>\n <span slot=\"price\">\n {this.getCurrencyToDisplay() && <span class=\"currency-label\">{this.getCurrencyToDisplay()}</span>}\n {state?.line_item?.total_default_currency_display_amount}\n </span>\n </sc-line-item>\n <sc-line-item>\n <span slot=\"description\" class=\"conversion-description\">\n {/* translators: %s is the currency code */}\n {sprintf(__('Your payment will be processed in %s.', 'surecart'), state?.line_item?.currency?.toUpperCase())}\n </span>\n </sc-line-item>\n </Fragment>\n );\n }\n\n render() {\n return (\n <sc-summary open-text=\"Total\" closed-text=\"Total\" collapsible={true} collapsed={true}>\n {!!state.line_item?.id && <span slot=\"price\">{this.renderAmountDue()}</span>}\n\n <sc-divider></sc-divider>\n\n <sc-line-item>\n <span slot=\"description\">{__('Subtotal', 'surecart')}</span>\n <span slot=\"price\">{state.line_item?.subtotal_display_amount}</span>\n </sc-line-item>\n\n {(state?.line_item?.fees?.data || [])\n .filter(fee => fee.fee_type === 'upsell') // only upsell fees.\n .map(fee => {\n return (\n <sc-line-item>\n <span slot=\"description\">\n {fee.description} {`(${__('one time', 'surecart')})`}\n </span>\n <span slot=\"price\">{fee?.display_amount}</span>\n </sc-line-item>\n );\n })}\n\n {!!state.line_item?.tax_amount && (\n <sc-line-item>\n <span slot=\"description\">{__('Tax', 'surecart')}</span>\n <span slot=\"price\">{state.line_item?.tax_display_amount}</span>\n </sc-line-item>\n )}\n\n <sc-divider></sc-divider>\n\n <sc-line-item style={{ '--price-size': 'var(--sc-font-size-x-large)' }}>\n <span slot=\"title\">{__('Total', 'surecart')}</span>\n <span slot=\"price\">{state.line_item?.total_display_amount}</span>\n </sc-line-item>\n\n {this.renderConversion()}\n </sc-summary>\n );\n }\n}\n"],"version":3}