MockProcessor-5c5e066a.js
2 months ago
MockProcessor-5c5e066a.js.map
2 months ago
add-query-args-0e2a8393.js
1 year ago
add-query-args-0e2a8393.js.map
1 year ago
address-b8e2e4c8.js
4 months ago
address-b8e2e4c8.js.map
4 months ago
animation-registry-de37bd7e.js
3 months ago
animation-registry-de37bd7e.js.map
3 months ago
app-globals-0eef0276.js
2 months ago
app-globals-0eef0276.js.map
2 months ago
consumer-f1775a76.js
2 months ago
consumer-f1775a76.js.map
2 months ago
currency-a0c9bff4.js
1 year ago
currency-a0c9bff4.js.map
1 year ago
error-c8bf8e3e.js
6 days ago
error-c8bf8e3e.js.map
6 days ago
fetch-cdff67be.js
1 month ago
fetch-cdff67be.js.map
1 month ago
floating-ui.dom.esm-8dce4ea1.js
6 months ago
floating-ui.dom.esm-8dce4ea1.js.map
6 months ago
form-data-76641f16.js
1 year ago
form-data-76641f16.js.map
1 year ago
functions-4f009ce1.js
3 months ago
functions-4f009ce1.js.map
3 months ago
geo-permission-62aea8ee.js
1 month ago
geo-permission-62aea8ee.js.map
1 month ago
getters-1049a6f8.js
2 months ago
getters-1049a6f8.js.map
2 months ago
getters-1477d792.js
2 months ago
getters-1477d792.js.map
2 months ago
getters-4bb6cc1b.js
2 months ago
getters-4bb6cc1b.js.map
2 months ago
getters-7090a9c1.js
6 days ago
getters-7090a9c1.js.map
6 days ago
getters-9cfeb0de.js
6 days ago
getters-9cfeb0de.js.map
6 days ago
google-52867ad8.js
6 days ago
google-52867ad8.js.map
6 days ago
google-e9085e27.js
6 days ago
google-e9085e27.js.map
6 days ago
google-maps-e8b00ffd.js
3 months ago
google-maps-e8b00ffd.js.map
3 months ago
index-17aac936.js
1 month ago
index-17aac936.js.map
1 month ago
index-18f5a1bc.js
2 months ago
index-18f5a1bc.js.map
2 months ago
index-25e5af33.js
2 months ago
index-25e5af33.js.map
2 months ago
index-824c562b.js
2 months ago
index-824c562b.js.map
2 months ago
index-871d88b8.js
1 year ago
index-871d88b8.js.map
1 year ago
index-a786f689.js
6 days ago
index-a786f689.js.map
6 days ago
index-c5a96d53.js
2 years ago
index-c5a96d53.js.map
2 years ago
index-d602bc13.js
1 month ago
index-d602bc13.js.map
1 month ago
index.js
6 days ago
index.js.map
1 month ago
inline-c012a0f9.js
1 year ago
inline-c012a0f9.js.map
1 year ago
lazy-deb42890.js
1 year ago
lazy-deb42890.js.map
1 year ago
library-1bd957d5.js
2 months ago
library-1bd957d5.js.map
2 months ago
loader.js
2 weeks ago
loader.js.map
1 year ago
media-d21119a3.js
1 year ago
media-d21119a3.js.map
1 year ago
mutations-7458343f.js
2 months ago
mutations-7458343f.js.map
2 months ago
mutations-9ffd30f4.js
6 days ago
mutations-9ffd30f4.js.map
6 days ago
mutations-ae7167ad.js
6 days ago
mutations-ae7167ad.js.map
6 days ago
mutations-b310b068.js
6 days ago
mutations-b310b068.js.map
6 days ago
page-align-0cdacf32.js
1 year ago
page-align-0cdacf32.js.map
1 year ago
price-1ff6aa07.js
4 months ago
price-1ff6aa07.js.map
4 months ago
pure-963214cb.js
1 year ago
pure-963214cb.js.map
1 year ago
quantity-5c986f3d.js
3 months ago
quantity-5c986f3d.js.map
3 months ago
razorpay-4c4a3d31.js
3 months ago
razorpay-4c4a3d31.js.map
3 months ago
remove-query-args-938c53ea.js
1 year ago
remove-query-args-938c53ea.js.map
1 year ago
sc-address_5.entry.js
2 weeks ago
sc-address_5.entry.js.map
2 weeks ago
sc-alert.entry.js
1 month ago
sc-alert.entry.js.map
1 year ago
sc-avatar_2.entry.js
6 days ago
sc-avatar_2.entry.js.map
1 month ago
sc-badge-notice.entry.js
1 month ago
sc-badge-notice.entry.js.map
1 year ago
sc-block-ui.entry.js
1 month ago
sc-block-ui.entry.js.map
4 months ago
sc-breadcrumb.entry.js
1 month ago
sc-breadcrumb.entry.js.map
1 year ago
sc-breadcrumbs.entry.js
1 month ago
sc-breadcrumbs.entry.js.map
1 year ago
sc-button-group.entry.js
1 month ago
sc-button-group.entry.js.map
1 year ago
sc-button_6.entry.js
1 month ago
sc-button_6.entry.js.map
1 month ago
sc-cancel-dialog_3.entry.js
1 month ago
sc-cancel-dialog_3.entry.js.map
1 month ago
sc-cancel-discount_4.entry.js
1 month ago
sc-cancel-discount_4.entry.js.map
2 months ago
sc-card_2.entry.js
1 month ago
sc-card_2.entry.js.map
4 months ago
sc-cart-button.entry.js
6 days ago
sc-cart-button.entry.js.map
1 year ago
sc-cart-form-submit.entry.js
2 months ago
sc-cart-form-submit.entry.js.map
1 year ago
sc-cart-form.entry.js
6 days ago
sc-cart-form.entry.js.map
1 month ago
sc-cart-header.entry.js
6 days ago
sc-cart-header.entry.js.map
1 year ago
sc-cart-icon.entry.js
6 days ago
sc-cart-icon.entry.js.map
1 year ago
sc-cart-loader.entry.js
6 days ago
sc-cart-loader.entry.js.map
1 year ago
sc-cart-session-provider_3.entry.js
6 days ago
sc-cart-session-provider_3.entry.js.map
2 months ago
sc-cart-submit.entry.js
2 months ago
sc-cart-submit.entry.js.map
1 year ago
sc-cart.entry.js
6 days ago
sc-cart.entry.js.map
2 months ago
sc-cc-logo_2.entry.js
1 month ago
sc-cc-logo_2.entry.js.map
1 month ago
sc-charges-list.entry.js
1 month ago
sc-charges-list.entry.js.map
2 months ago
sc-checkout-autofill-provider_11.entry.js
6 days ago
sc-checkout-autofill-provider_11.entry.js.map
1 month ago
sc-checkout-form-errors.entry.js
2 months ago
sc-checkout-form-errors.entry.js.map
1 year ago
sc-checkout-mollie-payment_3.entry.js
6 days ago
sc-checkout-mollie-payment_3.entry.js.map
2 months ago
sc-checkout-product-bundle-component-variants.entry.js
6 days ago
sc-checkout-product-bundle-component-variants.entry.js.map
1 month ago
sc-checkout-product-price-variant-selector.entry.js
6 days ago
sc-checkout-product-price-variant-selector.entry.js.map
3 weeks ago
sc-checkout.entry.js
6 days ago
sc-checkout.entry.js.map
1 month ago
sc-choice-container.entry.js
1 month ago
sc-choice-container.entry.js.map
1 year ago
sc-choice.entry.js
1 month ago
sc-choice.entry.js.map
1 year ago
sc-choices.entry.js
1 month ago
sc-choices.entry.js.map
1 year ago
sc-column_2.entry.js
1 month ago
sc-column_2.entry.js.map
1 month ago
sc-compact-address_18.entry.js
6 days ago
sc-compact-address_18.entry.js.map
1 month ago
sc-conditional-form.entry.js
6 days ago
sc-conditional-form.entry.js.map
2 months ago
sc-consumer.entry.js
2 months ago
sc-consumer.entry.js.map
1 year ago
sc-coupon-form.entry.js
6 days ago
sc-coupon-form.entry.js.map
5 months ago
sc-custom-order-price-input.entry.js
1 month ago
sc-custom-order-price-input.entry.js.map
2 months ago
sc-customer-details.entry.js
1 month ago
sc-customer-details.entry.js.map
7 months ago
sc-customer-edit.entry.js
1 month ago
sc-customer-edit.entry.js.map
2 months ago
sc-customer-email.entry.js
6 days ago
sc-customer-email.entry.js.map
1 month ago
sc-customer-firstname.entry.js
6 days ago
sc-customer-firstname.entry.js.map
2 months ago
sc-customer-lastname.entry.js
6 days ago
sc-customer-lastname.entry.js.map
2 months ago
sc-customer-name.entry.js
6 days ago
sc-customer-name.entry.js.map
2 months ago
sc-dashboard-customer-details.entry.js
1 month ago
sc-dashboard-customer-details.entry.js.map
2 months ago
sc-dashboard-downloads-list.entry.js
1 month ago
sc-dashboard-downloads-list.entry.js.map
2 months ago
sc-dialog.entry.js
1 month ago
sc-dialog.entry.js.map
4 months ago
sc-divider.entry.js
1 month ago
sc-divider.entry.js.map
1 year ago
sc-donation-choices.entry.js
2 months ago
sc-donation-choices.entry.js.map
1 year ago
sc-downloads-list.entry.js
1 month ago
sc-downloads-list.entry.js.map
1 month ago
sc-dropdown_3.entry.js
1 month ago
sc-dropdown_3.entry.js.map
6 months ago
sc-empty_3.entry.js
1 month ago
sc-empty_3.entry.js.map
4 months ago
sc-express-payment.entry.js
6 days ago
sc-express-payment.entry.js.map
3 months ago
sc-feature-demo-banner.entry.js
1 month ago
sc-feature-demo-banner.entry.js.map
1 year ago
sc-flex.entry.js
1 month ago
sc-flex.entry.js.map
1 year ago
sc-form-control_2.entry.js
1 month ago
sc-form-control_2.entry.js.map
2 months ago
sc-form-row.entry.js
1 month ago
sc-form-row.entry.js.map
1 year ago
sc-form.entry.js
1 month ago
sc-form.entry.js.map
1 year ago
sc-format-bytes.entry.js
2 months ago
sc-format-bytes.entry.js.map
1 year ago
sc-format-interval.entry.js
2 months ago
sc-format-interval.entry.js.map
1 year ago
sc-format-number.entry.js
2 months ago
sc-format-number.entry.js.map
1 year ago
sc-fulfillment-shipping-status-badge.entry.js
2 months ago
sc-fulfillment-shipping-status-badge.entry.js.map
4 months ago
sc-fulfillments.entry.js
1 month ago
sc-fulfillments.entry.js.map
2 months ago
sc-heading_2.entry.js
1 month ago
sc-heading_2.entry.js.map
1 year ago
sc-image-slider.entry.js
1 month ago
sc-image-slider.entry.js.map
1 month ago
sc-invoice-status-badge.entry.js
1 month ago
sc-invoice-status-badge.entry.js.map
4 months ago
sc-invoices-list.entry.js
1 month ago
sc-invoices-list.entry.js.map
2 months ago
sc-license.entry.js
1 month ago
sc-license.entry.js.map
2 months ago
sc-licenses-list.entry.js
1 month ago
sc-licenses-list.entry.js.map
1 month ago
sc-line-item-bump.entry.js
6 days ago
sc-line-item-bump.entry.js.map
1 year ago
sc-line-item-total.entry.js
6 days ago
sc-line-item-total.entry.js.map
6 months ago
sc-line-item.entry.js
1 month ago
sc-line-item.entry.js.map
1 year ago
sc-line-items-provider.entry.js
1 month ago
sc-line-items-provider.entry.js.map
1 year ago
sc-line-items.entry.js
6 days ago
sc-line-items.entry.js.map
1 month ago
sc-login-form.entry.js
1 month ago
sc-login-form.entry.js.map
2 months ago
sc-manual-payment-method_3.entry.js
1 month ago
sc-manual-payment-method_3.entry.js.map
3 months ago
sc-menu-divider.entry.js
1 month ago
sc-menu-divider.entry.js.map
1 year ago
sc-menu-label_2.entry.js
1 month ago
sc-menu-label_2.entry.js.map
1 month ago
sc-mollie-add-method.entry.js
1 month ago
sc-mollie-add-method.entry.js.map
2 months ago
sc-order-confirmation-customer.entry.js
2 months ago
sc-order-confirmation-customer.entry.js.map
1 year ago
sc-order-confirmation-details.entry.js
2 months ago
sc-order-confirmation-details.entry.js.map
11 months ago
sc-order-confirmation-line-items_2.entry.js
1 month ago
sc-order-confirmation-line-items_2.entry.js.map
1 month ago
sc-order-confirmation.entry.js
1 month ago
sc-order-confirmation.entry.js.map
2 months ago
sc-order-coupon-form.entry.js
6 days ago
sc-order-coupon-form.entry.js.map
2 months ago
sc-order-detail.entry.js
2 months ago
sc-order-detail.entry.js.map
1 year ago
sc-order-fulfillment-badge.entry.js
1 month ago
sc-order-fulfillment-badge.entry.js.map
4 months ago
sc-order-manual-instructions.entry.js
2 months ago
sc-order-manual-instructions.entry.js.map
1 year ago
sc-order-password.entry.js
2 months ago
sc-order-password.entry.js.map
1 year ago
sc-order-return-badge.entry.js
1 month ago
sc-order-return-badge.entry.js.map
4 months ago
sc-order-shipment-badge.entry.js
2 months ago
sc-order-shipment-badge.entry.js.map
4 months ago
sc-order-status-badge.entry.js
1 month ago
sc-order-status-badge.entry.js.map
4 months ago
sc-order-submit.entry.js
6 days ago
sc-order-submit.entry.js.map
2 months ago
sc-order-summary.entry.js
6 days ago
sc-order-summary.entry.js.map
1 month ago
sc-order.entry.js
1 month ago
sc-order.entry.js.map
1 month ago
sc-orders-list.entry.js
1 month ago
sc-orders-list.entry.js.map
1 month ago
sc-pagination.entry.js
2 months ago
sc-pagination.entry.js.map
1 year ago
sc-password-nag.entry.js
1 month ago
sc-password-nag.entry.js.map
2 months ago
sc-password.entry.js
1 month ago
sc-password.entry.js.map
1 month ago
sc-payment-method-choice_2.entry.js
1 month ago
sc-payment-method-choice_2.entry.js.map
1 year ago
sc-payment-method-details.entry.js
1 month ago
sc-payment-method-details.entry.js.map
1 year ago
sc-payment-methods-list.entry.js
1 month ago
sc-payment-methods-list.entry.js.map
2 months ago
sc-payment.entry.js
6 days ago
sc-payment.entry.js.map
3 months ago
sc-paypal-add-method.entry.js
1 month ago
sc-paypal-add-method.entry.js.map
2 months ago
sc-paypal-buttons_2.entry.js
6 days ago
sc-paypal-buttons_2.entry.js.map
2 months ago
sc-paystack-add-method.entry.js
1 month ago
sc-paystack-add-method.entry.js.map
2 months ago
sc-pill-option.entry.js
1 month ago
sc-pill-option.entry.js.map
1 year ago
sc-popover.entry.js
1 month ago
sc-popover.entry.js.map
6 months ago
sc-premium-tag.entry.js
1 month ago
sc-premium-tag.entry.js.map
1 year ago
sc-price-choice-container.entry.js
1 month ago
sc-price-choice-container.entry.js.map
1 month ago
sc-price-choice.entry.js
1 month ago
sc-price-choice.entry.js.map
2 months ago
sc-price-choices.entry.js
6 days ago
sc-price-choices.entry.js.map
1 year ago
sc-price-input.entry.js
1 month ago
sc-price-input.entry.js.map
1 year ago
sc-price-range_4.entry.js
1 month ago
sc-price-range_4.entry.js.map
1 year ago
sc-price.entry.js
2 months ago
sc-price.entry.js.map
11 months ago
sc-product-buy-button.entry.js
6 days ago
sc-product-buy-button.entry.js.map
2 months ago
sc-product-donation-amount-choice.entry.js
6 days ago
sc-product-donation-amount-choice.entry.js.map
2 months ago
sc-product-donation-choices.entry.js
6 days ago
sc-product-donation-choices.entry.js.map
2 months ago
sc-product-donation-custom-amount.entry.js
6 days ago
sc-product-donation-custom-amount.entry.js.map
2 months ago
sc-product-item-list.entry.js
6 days ago
sc-product-item-list.entry.js.map
2 months ago
sc-product-item.entry.js
1 month ago
sc-product-item.entry.js.map
1 year ago
sc-product-pills-variant-option.entry.js
6 days ago
sc-product-pills-variant-option.entry.js.map
1 year ago
sc-product-price-choices.entry.js
6 days ago
sc-product-price-choices.entry.js.map
1 year ago
sc-product-price-modal.entry.js
6 days ago
sc-product-price-modal.entry.js.map
2 months ago
sc-product-price.entry.js
6 days ago
sc-product-price.entry.js.map
2 months ago
sc-product-quantity.entry.js
6 days ago
sc-product-quantity.entry.js.map
1 year ago
sc-product-selected-price.entry.js
6 days ago
sc-product-selected-price.entry.js.map
2 months ago
sc-product-text.entry.js
6 days ago
sc-product-text.entry.js.map
1 year ago
sc-provider.entry.js
2 months ago
sc-provider.entry.js.map
1 year ago
sc-provisional-banner.entry.js
1 month ago
sc-provisional-banner.entry.js.map
11 months ago
sc-purchase-downloads-list.entry.js
1 month ago
sc-purchase-downloads-list.entry.js.map
1 month ago
sc-razorpay-add-method.entry.js
1 month ago
sc-razorpay-add-method.entry.js.map
2 months ago
sc-recurring-price-choice-container.entry.js
2 months ago
sc-recurring-price-choice-container.entry.js.map
1 year ago
sc-review-stars.entry.js
2 months ago
sc-review-stars.entry.js.map
5 months ago
sc-rich-text.entry.js
1 month ago
sc-rich-text.entry.js.map
1 month ago
sc-skeleton.entry.js
1 month ago
sc-skeleton.entry.js.map
1 year ago
sc-spacing.entry.js
1 month ago
sc-spacing.entry.js.map
1 year ago
sc-stripe-add-method.entry.js
1 month ago
sc-stripe-add-method.entry.js.map
2 months ago
sc-stripe-element.entry.js
6 days ago
sc-stripe-element.entry.js.map
2 months ago
sc-stripe-payment-element.entry.js
6 days ago
sc-stripe-payment-element.entry.js.map
2 months ago
sc-stripe-payment-request.entry.js
6 days ago
sc-stripe-payment-request.entry.js.map
2 months ago
sc-subscription-ad-hoc-confirm.entry.js
1 month ago
sc-subscription-ad-hoc-confirm.entry.js.map
6 months ago
sc-subscription-details_2.entry.js
1 month ago
sc-subscription-details_2.entry.js.map
1 month ago
sc-subscription-payment-method.entry.js
1 month ago
sc-subscription-payment-method.entry.js.map
2 months ago
sc-subscription-payment.entry.js
1 month ago
sc-subscription-payment.entry.js.map
2 months ago
sc-subscription-switch.entry.js
1 month ago
sc-subscription-switch.entry.js.map
2 months ago
sc-subscription-variation-confirm.entry.js
1 month ago
sc-subscription-variation-confirm.entry.js.map
1 year ago
sc-subscription.entry.js
1 month ago
sc-subscription.entry.js.map
1 month ago
sc-subscriptions-list.entry.js
1 month ago
sc-subscriptions-list.entry.js.map
2 months ago
sc-summary.entry.js
1 month ago
sc-summary.entry.js.map
1 year ago
sc-swap.entry.js
6 days ago
sc-swap.entry.js.map
2 months ago
sc-switch.entry.js
1 month ago
sc-switch.entry.js.map
7 months ago
sc-tab-group.entry.js
1 month ago
sc-tab-group.entry.js.map
1 year ago
sc-tab-panel.entry.js
1 month ago
sc-tab-panel.entry.js.map
1 year ago
sc-tab.entry.js
1 month ago
sc-tab.entry.js.map
1 year ago
sc-table-head.entry.js
1 month ago
sc-table-head.entry.js.map
1 year ago
sc-table_3.entry.js
1 month ago
sc-table_3.entry.js.map
10 months ago
sc-tag.entry.js
1 month ago
sc-tag.entry.js.map
4 months ago
sc-test-mode-info.entry.js
1 month ago
sc-test-mode-info.entry.js.map
6 months ago
sc-text.entry.js
1 month ago
sc-text.entry.js.map
1 year ago
sc-toggle.entry.js
1 month ago
sc-toggle.entry.js.map
1 year ago
sc-toggles.entry.js
1 month ago
sc-toggles.entry.js.map
1 year ago
sc-total.entry.js
6 days ago
sc-total.entry.js.map
1 year ago
sc-upcoming-invoice.entry.js
1 month ago
sc-upcoming-invoice.entry.js.map
2 months ago
sc-upgrade-required.entry.js
2 months ago
sc-upgrade-required.entry.js.map
1 year ago
sc-upsell-countdown-timer.entry.js
1 month ago
sc-upsell-countdown-timer.entry.js.map
1 year ago
sc-upsell-no-thanks-button.entry.js
6 days ago
sc-upsell-no-thanks-button.entry.js.map
2 months ago
sc-upsell-submit-button.entry.js
6 days ago
sc-upsell-submit-button.entry.js.map
2 months ago
sc-upsell-totals.entry.js
6 days ago
sc-upsell-totals.entry.js.map
2 months ago
sc-upsell.entry.js
6 days ago
sc-upsell.entry.js.map
2 months ago
sc-verification-code.entry.js
1 month ago
sc-verification-code.entry.js.map
2 months ago
sc-visually-hidden.entry.js
1 month ago
sc-visually-hidden.entry.js.map
1 year ago
sc-wordpress-password-edit.entry.js
1 month ago
sc-wordpress-password-edit.entry.js.map
2 months ago
sc-wordpress-user-edit.entry.js
1 month ago
sc-wordpress-user-edit.entry.js.map
2 months ago
sc-wordpress-user.entry.js
1 month ago
sc-wordpress-user.entry.js.map
1 year ago
store-289e460c.js
2 months ago
store-289e460c.js.map
2 months ago
store-ac90a769.js
1 month ago
store-ac90a769.js.map
1 month ago
store-b1758b00.js
2 months ago
store-b1758b00.js.map
2 months ago
surecart.js
2 weeks ago
surecart.js.map
1 year ago
tax-a03623ca.js
1 year ago
tax-a03623ca.js.map
1 year ago
universe-7bd0ac2b.js
2 months ago
universe-7bd0ac2b.js.map
2 months ago
util-dfbf863e.js
2 months ago
util-dfbf863e.js.map
2 months ago
utils-f84b2118.js
3 months ago
utils-f84b2118.js.map
3 months ago
verification-00df9439.js
1 month ago
verification-00df9439.js.map
1 month ago
watchers-2d9a1422.js
6 days ago
watchers-2d9a1422.js.map
6 days ago
watchers-81f32d01.js
6 days ago
watchers-81f32d01.js.map
6 days ago
watchers-843c3dbe.js
6 days ago
watchers-843c3dbe.js.map
6 days ago
watchers-c7bbc6b2.js
2 months ago
watchers-c7bbc6b2.js.map
2 months ago
watchers-df374a91.js
6 days ago
watchers-df374a91.js.map
6 days ago
sc-compact-address_18.entry.js
1053 lines
| 1 | import { r as registerInstance, c as createEvent, h, a as getElement, H as Host, F as Fragment } from './index-25e5af33.js'; |
| 2 | import { g as getCountryDetails, c as countryChoices } from './address-b8e2e4c8.js'; |
| 3 | import { r as reportChildrenValidity, F as FormSubmitController } from './form-data-76641f16.js'; |
| 4 | import { g as getCurrentUserCountryCode } from './google-maps-e8b00ffd.js'; |
| 5 | import { o as onChange, s as state, u as updateFormState } from './mutations-9ffd30f4.js'; |
| 6 | import { f as formBusy, a as formLoading } from './getters-4bb6cc1b.js'; |
| 7 | import { s as state$1 } from './store-b1758b00.js'; |
| 8 | import { o as openWormhole } from './consumer-f1775a76.js'; |
| 9 | import { l as lockCheckout, b as unLockCheckout, r as removeCheckoutLineItem, a as addCheckoutLineItem, t as trackOrderBump } from './mutations-ae7167ad.js'; |
| 10 | import { c as createOrUpdateCheckout } from './index-a786f689.js'; |
| 11 | import { i as isAddressEmpty } from './index-d602bc13.js'; |
| 12 | import { s as speak } from './index-c5a96d53.js'; |
| 13 | import { i as intervalString, g as getFormattedPrice } from './price-1ff6aa07.js'; |
| 14 | import { f as fullShippingAddressRequired, s as shippingAddressRequired, a as checkoutIsLocked } from './getters-7090a9c1.js'; |
| 15 | import { c as createErrorNotice } from './mutations-7458343f.js'; |
| 16 | import { i as isRtl } from './page-align-0cdacf32.js'; |
| 17 | import './add-query-args-0e2a8393.js'; |
| 18 | import './index-18f5a1bc.js'; |
| 19 | import './utils-f84b2118.js'; |
| 20 | import './remove-query-args-938c53ea.js'; |
| 21 | import './google-e9085e27.js'; |
| 22 | import './currency-a0c9bff4.js'; |
| 23 | import './fetch-cdff67be.js'; |
| 24 | import './index-824c562b.js'; |
| 25 | import './store-ac90a769.js'; |
| 26 | |
| 27 | const scCompactAddressCss = ":host{display:block}.sc-address{display:block;position:relative}.sc-address [hidden]{display:none}.sc-address--loading{min-height:70px}.sc-address--loading sc-skeleton{display:block;margin-bottom:1em}.sc-address__control{display:block}.sc-address__control>*{margin-bottom:-1px}.sc-address__columns{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;justify-content:space-between}.sc-address__columns>*{flex:1;width:50%;margin-left:-1px}.sc-address__columns>*:first-child{margin-left:0}"; |
| 28 | const ScCompactAddressStyle0 = scCompactAddressCss; |
| 29 | |
| 30 | const ScCompactAddress = class { |
| 31 | constructor(hostRef) { |
| 32 | registerInstance(this, hostRef); |
| 33 | this.scChangeAddress = createEvent(this, "scChangeAddress", 7); |
| 34 | this.scInputAddress = createEvent(this, "scInputAddress", 7); |
| 35 | this.address = { |
| 36 | country: null, |
| 37 | city: null, |
| 38 | line_1: null, |
| 39 | line_2: null, |
| 40 | postal_code: null, |
| 41 | state: null, |
| 42 | }; |
| 43 | this.names = { |
| 44 | country: 'shipping_country', |
| 45 | city: 'shipping_city', |
| 46 | line_1: 'shipping_line_1', |
| 47 | line_2: 'shipping_line_2', |
| 48 | postal_code: 'shipping_postal_code', |
| 49 | state: 'shipping_state', |
| 50 | }; |
| 51 | this.placeholders = { |
| 52 | country: '', |
| 53 | postal_code: '', |
| 54 | state: '', |
| 55 | }; |
| 56 | this.label = wp.i18n.__('Country or region', 'surecart'); |
| 57 | this.required = undefined; |
| 58 | this.loading = undefined; |
| 59 | this.countryChoices = undefined; |
| 60 | this.regions = undefined; |
| 61 | this.showState = undefined; |
| 62 | this.showPostal = undefined; |
| 63 | this.postalCodeRegex = undefined; |
| 64 | } |
| 65 | /** When the state changes, we want to update city and postal fields. */ |
| 66 | handleAddressChange() { |
| 67 | var _a; |
| 68 | if (!((_a = this.address) === null || _a === void 0 ? void 0 : _a.country)) |
| 69 | return; |
| 70 | this.setRegions(); |
| 71 | this.showState = ['US', 'CA'].includes(this.address.country); |
| 72 | this.showPostal = ['US'].includes(this.address.country); |
| 73 | this.scChangeAddress.emit(this.address); |
| 74 | this.scInputAddress.emit(this.address); |
| 75 | } |
| 76 | updateAddress(address) { |
| 77 | this.address = { ...this.address, ...address }; |
| 78 | } |
| 79 | handleAddressInput(address) { |
| 80 | this.scInputAddress.emit({ ...this.address, ...address }); |
| 81 | } |
| 82 | clearAddress() { |
| 83 | var _a; |
| 84 | this.address = { |
| 85 | name: (_a = this.address) === null || _a === void 0 ? void 0 : _a.name, |
| 86 | country: null, |
| 87 | line_1: null, |
| 88 | line_2: null, |
| 89 | city: null, |
| 90 | postal_code: null, |
| 91 | state: null, |
| 92 | }; |
| 93 | } |
| 94 | /** Set the regions based on the country. */ |
| 95 | async setRegions() { |
| 96 | var _a, _b; |
| 97 | const countryDetails = await getCountryDetails((_a = this.address) === null || _a === void 0 ? void 0 : _a.country); |
| 98 | this.regions = |
| 99 | ((_b = countryDetails === null || countryDetails === void 0 ? void 0 : countryDetails.states) === null || _b === void 0 ? void 0 : _b.map(state => ({ |
| 100 | value: state === null || state === void 0 ? void 0 : state.code, |
| 101 | label: state === null || state === void 0 ? void 0 : state.name, |
| 102 | }))) || []; |
| 103 | this.placeholders = countryDetails === null || countryDetails === void 0 ? void 0 : countryDetails.address_labels; |
| 104 | this.postalCodeRegex = (countryDetails === null || countryDetails === void 0 ? void 0 : countryDetails.postal_code_regex) || undefined; |
| 105 | } |
| 106 | componentWillLoad() { |
| 107 | var _a, _b; |
| 108 | this.initCountryChoices(); |
| 109 | this.handleAddressChange(); |
| 110 | const country = (_b = (_a = this.countryChoices) === null || _a === void 0 ? void 0 : _a.find(country => country.value === this.address.country)) === null || _b === void 0 ? void 0 : _b.value; |
| 111 | if (country) { |
| 112 | this.updateAddress({ country }); |
| 113 | } |
| 114 | this.fetchUserCountry(); |
| 115 | } |
| 116 | async fetchUserCountry() { |
| 117 | var _a; |
| 118 | if ((_a = this.address) === null || _a === void 0 ? void 0 : _a.country) { |
| 119 | return; |
| 120 | } |
| 121 | const countryCode = await getCurrentUserCountryCode(); |
| 122 | if (countryCode) { |
| 123 | this.updateAddress({ country: countryCode }); |
| 124 | } |
| 125 | } |
| 126 | async initCountryChoices() { |
| 127 | this.countryChoices = await countryChoices(); |
| 128 | } |
| 129 | async reportValidity() { |
| 130 | return reportChildrenValidity(this.el); |
| 131 | } |
| 132 | render() { |
| 133 | var _a, _b, _c, _d, _e, _f, _g; |
| 134 | return (h("div", { key: '788e0d1d63e678b291b9cce256fa812da18c7b45', class: "sc-address", part: "base" }, h("sc-form-control", { key: '579fe0c306a2dc3a1d55227a14dc1507d02cfbc8', exportparts: "label, help-text, form-control", label: this.label, class: "sc-address__control", part: "control", required: this.required }, h("sc-select", { key: '0e1cc5b5ca11fff1ddd11ce2b8854b2797734997', exportparts: "base:select__base, input, form-control, label, help-text, trigger, panel, caret, search__base, search__input, search__form-control, menu__base, spinner__base, empty", value: (_a = this.address) === null || _a === void 0 ? void 0 : _a.country, onScChange: (e) => { |
| 135 | this.clearAddress(); |
| 136 | this.updateAddress({ country: e.target.value || null }); |
| 137 | }, choices: this.countryChoices, autocomplete: 'country-name', placeholder: ((_b = this.placeholders) === null || _b === void 0 ? void 0 : _b.country) || wp.i18n.__('Select Your Country', 'surecart'), name: this.names.country, search: true, unselect: false, "squared-bottom": this.showState || this.showPostal, required: this.required }), h("div", { key: '292dba3c347f24769d02f738b3df35f3c02e5c86', class: "sc-address__columns" }, this.showState && (h("sc-select", { key: '27d303b88ba2b25225950ec1c1bd7568b3dfe512', exportparts: "base:select__base, input, form-control, label, help-text, trigger, panel, caret, search__base, search__input, search__form-control, menu__base, spinner__base, empty", placeholder: (_c = this.placeholders) === null || _c === void 0 ? void 0 : _c.state, name: this.names.state, autocomplete: 'address-level1', value: (_d = this === null || this === void 0 ? void 0 : this.address) === null || _d === void 0 ? void 0 : _d.state, onScChange: (e) => this.updateAddress({ state: e.target.value || null }), choices: this.regions, required: this.required, search: true, "squared-top": true, unselect: false, "squared-right": this.showPostal })), this.showPostal && (h("sc-input", { key: 'ce3e81bb66101040a786e6ad422fe110f9a4f61c', exportparts: "base:input__base, input, form-control, label, help-text", placeholder: ((_e = this.placeholders) === null || _e === void 0 ? void 0 : _e.postal_code) || wp.i18n.__('Postal Code/Zip', 'surecart'), name: this.names.postal_code, onScChange: (e) => this.updateAddress({ postal_code: e.target.value || null }), onScInput: (e) => this.handleAddressInput({ postal_code: e.target.value || null }), autocomplete: 'postal-code', required: this.required, value: (_f = this === null || this === void 0 ? void 0 : this.address) === null || _f === void 0 ? void 0 : _f.postal_code, "squared-top": true, maxlength: ((_g = this.address) === null || _g === void 0 ? void 0 : _g.country) === 'US' ? 5 : undefined, pattern: this.postalCodeRegex, customValidity: this.postalCodeRegex ? wp.i18n.__('Please enter a valid postal code', 'surecart') : undefined, "squared-left": this.showState })))), this.loading && h("sc-block-ui", { key: '677f634586c9c45ea2e58629e13ef8cccfd45ffe', exportparts: "base:block-ui, content:block-ui__content" }))); |
| 138 | } |
| 139 | get el() { return getElement(this); } |
| 140 | static get watchers() { return { |
| 141 | "address": ["handleAddressChange"] |
| 142 | }; } |
| 143 | }; |
| 144 | ScCompactAddress.style = ScCompactAddressStyle0; |
| 145 | |
| 146 | const scCustomerPhoneCss = ":host{display:block}"; |
| 147 | const ScCustomerPhoneStyle0 = scCustomerPhoneCss; |
| 148 | |
| 149 | const ScCustomerPhone = class { |
| 150 | constructor(hostRef) { |
| 151 | registerInstance(this, hostRef); |
| 152 | this.scChange = createEvent(this, "scChange", 7); |
| 153 | this.scClear = createEvent(this, "scClear", 7); |
| 154 | this.scInput = createEvent(this, "scInput", 7); |
| 155 | this.scFocus = createEvent(this, "scFocus", 7); |
| 156 | this.scBlur = createEvent(this, "scBlur", 7); |
| 157 | this.size = 'medium'; |
| 158 | this.value = ''; |
| 159 | this.pill = false; |
| 160 | this.label = undefined; |
| 161 | this.showLabel = true; |
| 162 | this.help = ''; |
| 163 | this.placeholder = undefined; |
| 164 | this.disabled = false; |
| 165 | this.readonly = false; |
| 166 | this.required = false; |
| 167 | this.invalid = false; |
| 168 | this.autofocus = undefined; |
| 169 | this.hasFocus = undefined; |
| 170 | this.error = undefined; |
| 171 | } |
| 172 | async handleChange() { |
| 173 | this.value = this.input.value; |
| 174 | this.scChange.emit(); |
| 175 | } |
| 176 | async reportValidity() { |
| 177 | var _a, _b; |
| 178 | return (_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.reportValidity) === null || _b === void 0 ? void 0 : _b.call(_a); |
| 179 | } |
| 180 | componentWillLoad() { |
| 181 | this.handleCheckoutChange(); |
| 182 | this.removeChangeListener = onChange('checkout', () => this.handleCheckoutChange()); |
| 183 | } |
| 184 | disconnectedCallback() { |
| 185 | this.removeChangeListener(); |
| 186 | } |
| 187 | handleCheckoutChange() { |
| 188 | var _a, _b, _c, _d, _e, _f; |
| 189 | // we only want to do this if we don't have a value. |
| 190 | if (this === null || this === void 0 ? void 0 : this.value) |
| 191 | return; |
| 192 | // if the checkout has a phone, use that. |
| 193 | if ((_a = state.checkout) === null || _a === void 0 ? void 0 : _a.phone) { |
| 194 | this.value = (_b = state.checkout) === null || _b === void 0 ? void 0 : _b.phone; |
| 195 | return; |
| 196 | } |
| 197 | // if the customer has a phone, use that. |
| 198 | if ((_d = (_c = state.checkout) === null || _c === void 0 ? void 0 : _c.customer) === null || _d === void 0 ? void 0 : _d.phone) { |
| 199 | this.value = (_f = (_e = state.checkout) === null || _e === void 0 ? void 0 : _e.customer) === null || _f === void 0 ? void 0 : _f.phone; |
| 200 | return; |
| 201 | } |
| 202 | } |
| 203 | render() { |
| 204 | return (h("sc-phone-input", { key: '89ec8776e62c3ad08e763115f06b5bbe6a87d246', name: "phone", ref: el => (this.input = el), value: this.value, label: this.label, help: this.help, autocomplete: "phone", placeholder: this.placeholder, readonly: this.readonly, required: this.required, invalid: this.invalid, autofocus: this.autofocus, hasFocus: this.hasFocus, onScChange: () => this.handleChange(), onScInput: () => this.scInput.emit(), onScFocus: () => this.scFocus.emit(), onScBlur: () => this.scBlur.emit() })); |
| 205 | } |
| 206 | }; |
| 207 | ScCustomerPhone.style = ScCustomerPhoneStyle0; |
| 208 | |
| 209 | const scInvoiceDetailsCss = ":host{display:block}::slotted(*){margin:4px 0 !important}::slotted(sc-divider){margin:16px 0 !important}"; |
| 210 | const ScInvoiceDetailsStyle0 = scInvoiceDetailsCss; |
| 211 | |
| 212 | const ScInvoiceDetails = class { |
| 213 | constructor(hostRef) { |
| 214 | registerInstance(this, hostRef); |
| 215 | } |
| 216 | render() { |
| 217 | var _a; |
| 218 | return (h(Host, { key: 'b1774fcf95a7780ac4479d44d0814431b07724ef', style: { ...(!((_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.invoice) ? { display: 'none' } : {}) } }, h("div", { key: '081242c9b4e67bef899ede149b49cf2fd119f608', class: "invoice-details" }, h("slot", { key: '8c2fb522cc464a1a8ebca35686e769e21017bdcb' })))); |
| 219 | } |
| 220 | }; |
| 221 | ScInvoiceDetails.style = ScInvoiceDetailsStyle0; |
| 222 | |
| 223 | const scInvoiceMemoCss = ":host{display:block}.invoice-memo{font-size:var(--sc-font-size-small);line-height:var(--sc-line-height-dense);color:var(--sc-input-label-color);display:grid;gap:5px}.invoice-memo__content{text-align:left;color:var(--sc-input-help-text-color)}"; |
| 224 | const ScInvoiceMemoStyle0 = scInvoiceMemoCss; |
| 225 | |
| 226 | const ScLineItemInvoiceMemo = class { |
| 227 | constructor(hostRef) { |
| 228 | registerInstance(this, hostRef); |
| 229 | this.text = undefined; |
| 230 | } |
| 231 | render() { |
| 232 | var _a; |
| 233 | const checkout = state === null || state === void 0 ? void 0 : state.checkout; |
| 234 | const memo = ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.invoice) === null || _a === void 0 ? void 0 : _a.memo) || null; |
| 235 | // Stop if checkout has no invoice number. |
| 236 | if (!memo) { |
| 237 | return null; |
| 238 | } |
| 239 | // loading state |
| 240 | if (formBusy() && !(checkout === null || checkout === void 0 ? void 0 : checkout.invoice)) { |
| 241 | return (h("div", null, h("sc-skeleton", { style: { width: '100px' } }), h("sc-skeleton", { style: { width: '200px' } }))); |
| 242 | } |
| 243 | return (h("div", { class: "invoice-memo" }, h("div", { class: "invoice-memo__title" }, this.text || wp.i18n.__('Memo', 'surecart')), h("div", { class: "invoice-memo__content" }, memo))); |
| 244 | } |
| 245 | }; |
| 246 | ScLineItemInvoiceMemo.style = ScInvoiceMemoStyle0; |
| 247 | |
| 248 | const scLineItemInvoiceDueDateCss = ":host{display:block}sc-line-item{text-align:left;line-height:var(--sc-line-height-dense);color:var(--sc-input-label-color)}"; |
| 249 | const ScLineItemInvoiceDueDateStyle0 = scLineItemInvoiceDueDateCss; |
| 250 | |
| 251 | const ScLineItemInvoiceDueDate = class { |
| 252 | constructor(hostRef) { |
| 253 | registerInstance(this, hostRef); |
| 254 | } |
| 255 | render() { |
| 256 | var _a; |
| 257 | const checkout = state === null || state === void 0 ? void 0 : state.checkout; |
| 258 | const dueDate = ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.invoice) === null || _a === void 0 ? void 0 : _a.due_date_date) || null; |
| 259 | // Stop if checkout has no invoice due date. |
| 260 | if (!dueDate) { |
| 261 | return null; |
| 262 | } |
| 263 | // loading state |
| 264 | if (formBusy() && !(checkout === null || checkout === void 0 ? void 0 : checkout.invoice)) { |
| 265 | return (h("sc-line-item", null, h("sc-skeleton", { slot: "title", style: { width: '120px', display: 'inline-block' } }), h("sc-skeleton", { slot: "price", style: { 'width': '50px', 'display': 'inline-block', '--border-radius': '6px' } }))); |
| 266 | } |
| 267 | return (h("sc-line-item", null, h("span", { slot: "description" }, h("slot", { name: "title" }, wp.i18n.__('Due Date', 'surecart'))), h("span", { slot: "price-description" }, dueDate))); |
| 268 | } |
| 269 | }; |
| 270 | ScLineItemInvoiceDueDate.style = ScLineItemInvoiceDueDateStyle0; |
| 271 | |
| 272 | const scLineItemInvoiceNumberCss = ":host{display:block}sc-line-item{text-align:left;line-height:var(--sc-line-height-dense);color:var(--sc-input-label-color)}"; |
| 273 | const ScLineItemInvoiceNumberStyle0 = scLineItemInvoiceNumberCss; |
| 274 | |
| 275 | const ScLineItemInvoiceNumber = class { |
| 276 | constructor(hostRef) { |
| 277 | registerInstance(this, hostRef); |
| 278 | } |
| 279 | render() { |
| 280 | var _a; |
| 281 | const checkout = state === null || state === void 0 ? void 0 : state.checkout; |
| 282 | const invoiceNumber = ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.invoice) === null || _a === void 0 ? void 0 : _a.order_number) || null; |
| 283 | // Stop if checkout has no invoice number. |
| 284 | if (!invoiceNumber) { |
| 285 | return null; |
| 286 | } |
| 287 | // loading state |
| 288 | if (formBusy() && !(checkout === null || checkout === void 0 ? void 0 : checkout.invoice)) { |
| 289 | return (h("sc-line-item", null, h("sc-skeleton", { slot: "title", style: { width: '120px', display: 'inline-block' } }), h("sc-skeleton", { slot: "price", style: { 'width': '50px', 'display': 'inline-block', '--border-radius': '6px' } }))); |
| 290 | } |
| 291 | return (h("sc-line-item", null, h("span", { slot: "description" }, h("slot", { name: "title" }, wp.i18n.__('Invoice Number', 'surecart'))), h("span", { slot: "price-description" }, "#", invoiceNumber))); |
| 292 | } |
| 293 | }; |
| 294 | ScLineItemInvoiceNumber.style = ScLineItemInvoiceNumberStyle0; |
| 295 | |
| 296 | const scLineItemInvoiceReceiptDownloadCss = ":host{display:block}sc-line-item{text-align:left;line-height:var(--sc-line-height-dense);color:var(--sc-input-label-color)}.sc-invoice-download-link{display:inline-flex;gap:var(--sc-spacing-x-small);text-decoration:none;color:inherit}"; |
| 297 | const ScLineItemInvoiceReceiptDownloadStyle0 = scLineItemInvoiceReceiptDownloadCss; |
| 298 | |
| 299 | const ScLineItemInvoiceReceiptDownload = class { |
| 300 | constructor(hostRef) { |
| 301 | registerInstance(this, hostRef); |
| 302 | this.checkout = undefined; |
| 303 | } |
| 304 | render() { |
| 305 | var _a; |
| 306 | const checkout = state === null || state === void 0 ? void 0 : state.checkout; |
| 307 | const receiptDownloadLink = ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.invoice) === null || _a === void 0 ? void 0 : _a.id) ? checkout === null || checkout === void 0 ? void 0 : checkout.pdf_url : null; |
| 308 | // Stop if checkout has no receipt download link. |
| 309 | if (!receiptDownloadLink) { |
| 310 | return null; |
| 311 | } |
| 312 | // loading state |
| 313 | if (formBusy() && !(checkout === null || checkout === void 0 ? void 0 : checkout.invoice)) { |
| 314 | return (h("sc-line-item", null, h("sc-skeleton", { slot: "title", style: { width: '120px', display: 'inline-block' } }), h("sc-skeleton", { slot: "price", style: { 'width': '50px', 'display': 'inline-block', '--border-radius': '6px' } }))); |
| 315 | } |
| 316 | return (h("sc-line-item", null, h("span", { slot: "description" }, h("slot", { name: "title" }, wp.i18n.__('Receipt / Invoice', 'surecart'))), h("span", { slot: "price-description" }, h("a", { class: "sc-invoice-download-link", href: receiptDownloadLink, target: "_blank", rel: "noopener noreferrer" }, h("sc-icon", { name: "download" }), wp.i18n.__('Download', 'surecart'))))); |
| 317 | } |
| 318 | }; |
| 319 | ScLineItemInvoiceReceiptDownload.style = ScLineItemInvoiceReceiptDownloadStyle0; |
| 320 | |
| 321 | const scLineItemShippingCss = ":host{display:block}"; |
| 322 | const ScLineItemShippingStyle0 = scLineItemShippingCss; |
| 323 | |
| 324 | const ScLineItemShipping = class { |
| 325 | constructor(hostRef) { |
| 326 | registerInstance(this, hostRef); |
| 327 | this.label = undefined; |
| 328 | } |
| 329 | renderShippingFees(checkout) { |
| 330 | var _a, _b, _c, _d; |
| 331 | if (!((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.shipping_fees) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length)) { |
| 332 | return null; |
| 333 | } |
| 334 | return (h(Fragment, null, (_d = (_c = checkout === null || checkout === void 0 ? void 0 : checkout.shipping_fees) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.map(fee => (h("sc-line-item", { key: fee.id }, h("span", { slot: "description" }, fee.description), h("span", { slot: "price" }, fee.display_amount)))))); |
| 335 | } |
| 336 | render() { |
| 337 | const { checkout } = state; |
| 338 | // don't show if no shipping amount if no choice selected |
| 339 | if (!(checkout === null || checkout === void 0 ? void 0 : checkout.selected_shipping_choice)) { |
| 340 | return h(Host, { style: { display: 'none' } }); |
| 341 | } |
| 342 | if (state$1.formState.value === 'loading') { |
| 343 | return (h("sc-line-item", null, h("sc-skeleton", { slot: "title", style: { width: '120px', display: 'inline-block' } }), h("sc-skeleton", { slot: "price", style: { 'width': '70px', 'display': 'inline-block', '--border-radius': '6px' } }))); |
| 344 | } |
| 345 | return (h(Fragment, null, h("sc-line-item", null, h("span", { slot: "description" }, this.label || wp.i18n.__('Shipping', 'surecart')), h("span", { slot: "price" }, checkout === null || checkout === void 0 ? void 0 : checkout.shipping_display_amount)), this.renderShippingFees(checkout))); |
| 346 | } |
| 347 | }; |
| 348 | ScLineItemShipping.style = ScLineItemShippingStyle0; |
| 349 | |
| 350 | const scLineItemTaxCss = ":host{display:block}"; |
| 351 | const ScLineItemTaxStyle0 = scLineItemTaxCss; |
| 352 | |
| 353 | const ScLineItemTax = class { |
| 354 | constructor(hostRef) { |
| 355 | registerInstance(this, hostRef); |
| 356 | this.order = undefined; |
| 357 | this.loading = undefined; |
| 358 | } |
| 359 | renderLabel() { |
| 360 | var _a, _b, _c; |
| 361 | let label = wp.i18n.sprintf(wp.i18n.__('Estimated %s', 'surecart'), ((_a = this === null || this === void 0 ? void 0 : this.order) === null || _a === void 0 ? void 0 : _a.tax_label) || ''); |
| 362 | if (((_b = this === null || this === void 0 ? void 0 : this.order) === null || _b === void 0 ? void 0 : _b.tax_status) === 'calculated') { |
| 363 | label = ((_c = this.order) === null || _c === void 0 ? void 0 : _c.tax_label) || ''; |
| 364 | } |
| 365 | return h(Fragment, null, `${wp.i18n.__('Tax', 'surecart')} ${label}`); |
| 366 | } |
| 367 | render() { |
| 368 | var _a, _b, _c, _d, _e; |
| 369 | // hide if tax is 0 |
| 370 | if (!((_a = this === null || this === void 0 ? void 0 : this.order) === null || _a === void 0 ? void 0 : _a.tax_amount)) { |
| 371 | return null; |
| 372 | } |
| 373 | return (h("sc-line-item", null, h("span", { slot: "description" }, this.renderLabel()), ((_b = this.order) === null || _b === void 0 ? void 0 : _b.tax_exclusive_amount) && h("span", { slot: "price" }, (_c = this.order) === null || _c === void 0 ? void 0 : _c.tax_exclusive_display_amount), ((_d = this.order) === null || _d === void 0 ? void 0 : _d.tax_inclusive_amount) && (h("span", { slot: "price-description" }, '(', (_e = this.order) === null || _e === void 0 ? void 0 : |
| 374 | _e.tax_inclusive_display_amount, " ", wp.i18n.__('included', 'surecart'), ')')))); |
| 375 | } |
| 376 | }; |
| 377 | openWormhole(ScLineItemTax, ['order', 'loading'], false); |
| 378 | ScLineItemTax.style = ScLineItemTaxStyle0; |
| 379 | |
| 380 | const scLineItemTrialCss = ":host{display:block}"; |
| 381 | const ScLineItemTrialStyle0 = scLineItemTrialCss; |
| 382 | |
| 383 | const ScLineItemTrial = class { |
| 384 | constructor(hostRef) { |
| 385 | registerInstance(this, hostRef); |
| 386 | this.label = undefined; |
| 387 | } |
| 388 | render() { |
| 389 | var _a, _b; |
| 390 | if (!((_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.trial_amount)) { |
| 391 | return h(Host, { style: { display: 'none' } }); |
| 392 | } |
| 393 | return (h("sc-line-item", null, h("span", { slot: "description" }, this.label || wp.i18n.__('Trial', 'surecart')), h("span", { slot: "price-description" }, (_b = state === null || state === void 0 ? void 0 : state.checkout) === null || _b === void 0 ? void 0 : _b.trial_display_amount))); |
| 394 | } |
| 395 | }; |
| 396 | ScLineItemTrial.style = ScLineItemTrialStyle0; |
| 397 | |
| 398 | const scOrderBillingAddressCss = ":host{display:block}.order-billing-address__toggle{margin-bottom:var(--sc-form-row-spacing, var(--sc-spacing-medium))}"; |
| 399 | const ScOrderBillingAddressStyle0 = scOrderBillingAddressCss; |
| 400 | |
| 401 | const ScOrderBillingAddress = class { |
| 402 | constructor(hostRef) { |
| 403 | registerInstance(this, hostRef); |
| 404 | this.label = undefined; |
| 405 | this.showName = undefined; |
| 406 | this.namePlaceholder = wp.i18n.__('Name or Company Name', 'surecart'); |
| 407 | this.defaultCountry = undefined; |
| 408 | this.toggleLabel = wp.i18n.__('Billing address is same as shipping', 'surecart'); |
| 409 | this.address = { |
| 410 | country: null, |
| 411 | city: null, |
| 412 | line_1: null, |
| 413 | line_2: null, |
| 414 | postal_code: null, |
| 415 | state: null, |
| 416 | }; |
| 417 | } |
| 418 | async reportValidity() { |
| 419 | var _a, _b; |
| 420 | if (!this.input) |
| 421 | return true; |
| 422 | return (_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.reportValidity) === null || _b === void 0 ? void 0 : _b.call(_a); |
| 423 | } |
| 424 | prefillAddress() { |
| 425 | var _a; |
| 426 | // Autofill is handled by sc-checkout-autofill-provider which patches checkoutState.checkout with any logged-in customer profile data. |
| 427 | if (isAddressEmpty(this.address)) { |
| 428 | this.address = { ...this.address, ...(_a = state.checkout) === null || _a === void 0 ? void 0 : _a.billing_address }; |
| 429 | } |
| 430 | } |
| 431 | componentWillLoad() { |
| 432 | var _a; |
| 433 | if (this.defaultCountry && !((_a = this.address) === null || _a === void 0 ? void 0 : _a.country)) { |
| 434 | this.address.country = this.defaultCountry; |
| 435 | } |
| 436 | this.prefillAddress(); |
| 437 | onChange('checkout', () => this.prefillAddress()); |
| 438 | } |
| 439 | async updateAddressState(address) { |
| 440 | var _a, _b; |
| 441 | if (JSON.stringify(address) === JSON.stringify(this.address)) |
| 442 | return; // no change, don't update. |
| 443 | this.address = address; |
| 444 | try { |
| 445 | lockCheckout('billing-address'); |
| 446 | state.checkout = (await createOrUpdateCheckout({ |
| 447 | id: (_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.id, |
| 448 | data: { |
| 449 | billing_matches_shipping: (_b = state.checkout) === null || _b === void 0 ? void 0 : _b.billing_matches_shipping, |
| 450 | billing_address: this.address, |
| 451 | }, |
| 452 | })); |
| 453 | } |
| 454 | catch (e) { |
| 455 | console.error(e); |
| 456 | } |
| 457 | finally { |
| 458 | unLockCheckout('billing-address'); |
| 459 | } |
| 460 | } |
| 461 | async onToggleBillingMatchesShipping(e) { |
| 462 | state.checkout = { |
| 463 | ...state.checkout, |
| 464 | billing_matches_shipping: e.target.checked, |
| 465 | }; |
| 466 | } |
| 467 | shippingAddressFieldExists() { |
| 468 | return !!document.querySelector('sc-order-shipping-address'); |
| 469 | } |
| 470 | render() { |
| 471 | var _a, _b; |
| 472 | return (h(Fragment, { key: 'fba7f7f30478cf9db8a296cc46e39b77a84efa43' }, this.shippingAddressFieldExists() && (h("sc-checkbox", { key: '41b0408fd0a4d6817f6de847e23552547e515472', class: "order-billing-address__toggle", onScChange: e => this.onToggleBillingMatchesShipping(e), checked: (_a = state.checkout) === null || _a === void 0 ? void 0 : _a.billing_matches_shipping }, this.toggleLabel)), (!this.shippingAddressFieldExists() || !((_b = state.checkout) === null || _b === void 0 ? void 0 : _b.billing_matches_shipping)) && (h("sc-address", { key: '154cd2dd179e6099840a101141a607ef8b76a41d', exportparts: "label, help-text, form-control, input__base, select__base, columns, search__base, menu__base", ref: el => { |
| 473 | this.input = el; |
| 474 | }, label: this.label || wp.i18n.__('Billing Address', 'surecart'), names: { |
| 475 | name: 'billing_name', |
| 476 | country: 'billing_country', |
| 477 | city: 'billing_city', |
| 478 | line_1: 'billing_line_1', |
| 479 | line_2: 'billing_line_2', |
| 480 | postal_code: 'billing_postal_code', |
| 481 | state: 'billing_state', |
| 482 | }, required: true, loading: formLoading(), address: this.address, "show-name": this.showName, onScChangeAddress: e => this.updateAddressState(e.detail) })))); |
| 483 | } |
| 484 | }; |
| 485 | ScOrderBillingAddress.style = ScOrderBillingAddressStyle0; |
| 486 | |
| 487 | const scOrderBumpCss = ":host {\n display: block;\n}\n\n:host([data-design=modern]) sc-choice::part(base) {\n padding: 0;\n overflow: hidden;\n border-radius: var(--sc-order-bump-border-radius, 12px);\n border-color: var(--sc-order-bump-border-color, #e0e0e0) !important;\n box-shadow: none !important;\n outline: none !important;\n cursor: default;\n}\n\n:host([data-design=modern]) sc-choice::part(content) {\n cursor: default;\n}\n\n:host([data-design=modern]) .bump {\n display: flex;\n align-items: center;\n gap: var(--sc-order-bump-gap, 1em);\n padding: var(--sc-order-bump-padding, 0.75em 1em 0.75em 0.75em);\n}\n:host([data-design=modern]) .bump__text {\n display: grid;\n gap: 5px;\n flex: 1;\n min-width: 0;\n}\n:host([data-design=modern]) .bump__title {\n font-size: var(--sc-order-bump-title-size, 15px);\n font-weight: 600;\n line-height: 1.3;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n}\n:host([data-design=modern]) .bump__cta {\n font-size: var(--sc-order-bump-cta-size, 12px);\n font-weight: 600;\n line-height: 1.3;\n display: var(--sc-order-bump-cta-display, -webkit-box);\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n}\n:host([data-design=modern]) .bump__tag {\n display: var(--sc-order-bump-tag-display, inline-block);\n background: var(--sc-color-primary-500);\n color: var(--sc-color-white);\n border-radius: 999px;\n padding: var(--sc-spacing-x-small);\n font-size: var(--sc-font-size-x-small);\n}\n:host([data-design=modern]) .bump__description {\n display: var(--sc-order-bump-description-display, block);\n font-size: var(--sc-order-bump-description-size, 13px);\n color: var(--sc-order-bump-description-color, #6b7280);\n opacity: 0.8;\n line-height: 1.3;\n font-weight: normal;\n}\n:host([data-design=modern]) .bump__description p {\n margin: 0;\n}\n:host([data-design=modern]) .bump__image {\n width: var(--sc-order-bump-image-size, 72px);\n height: var(--sc-order-bump-image-size, 72px);\n flex: 0 0 var(--sc-order-bump-image-size, 72px);\n object-fit: cover;\n border-radius: var(--sc-order-bump-image-radius, 8px);\n border: 1px solid var(--sc-color-gray-200);\n display: var(--sc-order-bump-image-display, block);\n}\n:host([data-design=modern]) .bump__price--has-discount {\n display: flex;\n align-items: baseline;\n gap: 4px;\n}\n:host([data-design=modern]) .bump__price--has-discount .bump__original-price {\n text-decoration: line-through;\n color: var(--sc-color-gray-500);\n font-size: var(--sc-order-bump-price-size, 14px);\n font-weight: normal;\n}\n:host([data-design=modern]) .bump__price .bump__new-price {\n font-size: var(--sc-order-bump-price-size, 14px);\n font-weight: 500;\n color: var(--sc-color-gray-700);\n}\n:host([data-design=modern]) .bump__price .bump__interval {\n color: var(--sc-color-gray-500);\n}\n:host([data-design=modern]) .bump__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--sc-order-bump-button-radius, 74.6%);\n border: 1px solid var(--sc-order-bump-button-border-color, #d1d5db);\n background-color: transparent;\n color: var(--sc-color-gray-500);\n flex-shrink: 0;\n line-height: 1;\n font-size: var(--sc-order-bump-button-size, 18px);\n padding: 0.5em;\n cursor: pointer;\n transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;\n}\n:host([data-design=modern]) .bump__button sc-icon {\n font-size: 1em;\n}\n:host([data-design=modern]) .bump__button--checked {\n background-color: var(--sc-color-primary-500);\n border-color: var(--sc-color-primary-500);\n color: var(--sc-color-white, #fff);\n}\n:host([data-design=modern]) .bump__button--loading {\n border-color: var(--sc-color-primary-500);\n}\n:host([data-design=modern]) .bump__button--loading sc-spinner {\n --spinner-size: 1em;\n --indicator-color: var(--sc-color-gray-500);\n}\n:host([data-design=modern]) .bump__amount {\n display: var(--sc-order-bump-amount-display, flex);\n align-items: center;\n gap: 4px;\n flex-wrap: wrap;\n}\n\n:host([data-design=classic]) .bump {\n display: grid;\n gap: 1em;\n}\n:host([data-design=classic]) .bump__text {\n display: grid;\n gap: 0.25em;\n}\n:host([data-design=classic]) .bump__tag {\n background: var(--sc-color-primary-500);\n color: var(--sc-color-white);\n border-radius: var(--sc-input-border-radius-medium);\n padding: var(--sc-spacing-x-small);\n font-size: var(--sc-font-size-x-small);\n}\n:host([data-design=classic]) .bump__product {\n display: flex;\n align-items: center;\n gap: var(--sc-choice-padding, 1.3em 1.1em);\n line-height: var(--sc-line-height-dense);\n}\n:host([data-design=classic]) .bump__product--wrapper {\n container-type: inline-size;\n}\n@container (max-width: 325px) {\n :host([data-design=classic]) .bump__product {\n flex-direction: column;\n align-items: start;\n }\n}\n:host([data-design=classic]) .bump__title {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n}\n:host([data-design=classic]) .bump__product-title {\n font-weight: var(--sc-font-weight-semibold);\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n}\n:host([data-design=classic]) .bump__product-description {\n color: var(--sc-input-label-color);\n}\n:host([data-design=classic]) .bump__image {\n width: var(--sc-product-line-item-image-size, 4em);\n height: var(--sc-product-line-item-image-size, 4em);\n flex: 0 0 var(--sc-product-line-item-image-size, 4em);\n object-fit: cover;\n border-radius: 4px;\n border: 1px solid var(--sc-color-gray-200);\n display: block;\n box-shadow: var(--sc-input-box-shadow);\n}\n:host([data-design=classic]) .bump__price--has-discount {\n display: flex;\n align-items: baseline;\n gap: var(--sc-spacing-x-small);\n}\n:host([data-design=classic]) .bump__price--has-discount .bump__original-price {\n text-decoration: line-through;\n color: var(--sc-color-gray-500);\n font-size: var(--sc-font-size-small);\n}\n:host([data-design=classic]) .bump__price .bump__new-price {\n font-size: var(--sc-font-size-large);\n color: var(--sc-color-gray-700);\n}\n:host([data-design=classic]) .bump__price .bump__interval {\n color: var(--sc-color-gray-500);\n}\n:host([data-design=classic]) .bump__amount {\n display: flex;\n align-items: center;\n gap: var(--sc-spacing-x-small);\n flex-wrap: wrap;\n margin-top: var(--sc-spacing-xx-small);\n}"; |
| 488 | const ScOrderBumpStyle0 = scOrderBumpCss; |
| 489 | |
| 490 | const ScOrderBump = class { |
| 491 | constructor(hostRef) { |
| 492 | registerInstance(this, hostRef); |
| 493 | /** Cached design mode */ |
| 494 | this.isModern = true; |
| 495 | this.bump = undefined; |
| 496 | this.showControl = undefined; |
| 497 | this.loading = false; |
| 498 | } |
| 499 | /** The bump line item */ |
| 500 | lineItem() { |
| 501 | var _a, _b, _c; |
| 502 | return (_c = (_b = (_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.line_items) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.find(item => { var _a; return (item === null || item === void 0 ? void 0 : item.bump) === ((_a = this.bump) === null || _a === void 0 ? void 0 : _a.id); }); |
| 503 | } |
| 504 | /** Update the line item. */ |
| 505 | async updateLineItem() { |
| 506 | var _a, _b, _c; |
| 507 | if (this.loading) |
| 508 | return; |
| 509 | const price = ((_a = this.bump.price) === null || _a === void 0 ? void 0 : _a.id) || ((_b = this.bump) === null || _b === void 0 ? void 0 : _b.price); |
| 510 | const lineItem = this.lineItem(); |
| 511 | this.loading = true; |
| 512 | try { |
| 513 | if (lineItem) { |
| 514 | await removeCheckoutLineItem(lineItem.id); |
| 515 | speak(wp.i18n.__('Order bump Removed.', 'surecart')); |
| 516 | } |
| 517 | else { |
| 518 | await addCheckoutLineItem({ |
| 519 | bump: (_c = this.bump) === null || _c === void 0 ? void 0 : _c.id, |
| 520 | price, |
| 521 | quantity: 1, |
| 522 | }); |
| 523 | speak(wp.i18n.__('Order bump applied.', 'surecart')); |
| 524 | } |
| 525 | } |
| 526 | catch (e) { |
| 527 | console.error('[sc-order-bump] updateLineItem failed:', e); |
| 528 | speak(wp.i18n.__('Something went wrong. Please try again.', 'surecart')); |
| 529 | } |
| 530 | finally { |
| 531 | this.loading = false; |
| 532 | } |
| 533 | } |
| 534 | componentWillLoad() { |
| 535 | var _a; |
| 536 | this.isModern = !!((_a = window.scData) === null || _a === void 0 ? void 0 : _a.modern_order_bump); |
| 537 | this.el.setAttribute('data-design', this.isModern ? 'modern' : 'classic'); |
| 538 | } |
| 539 | componentDidLoad() { |
| 540 | var _a; |
| 541 | trackOrderBump((_a = this.bump) === null || _a === void 0 ? void 0 : _a.id); |
| 542 | } |
| 543 | renderInterval() { |
| 544 | var _a; |
| 545 | const interval = intervalString((_a = this.bump) === null || _a === void 0 ? void 0 : _a.price, { labels: { interval: '/', period: wp.i18n.__('for', 'surecart') } }); |
| 546 | if (!interval.trim().length) |
| 547 | return null; |
| 548 | return h("span", { class: "bump__interval" }, interval); |
| 549 | } |
| 550 | renderDiscount() { |
| 551 | var _a, _b, _c, _d, _e; |
| 552 | if (!!((_a = this.bump) === null || _a === void 0 ? void 0 : _a.amount_off)) { |
| 553 | return (h("div", { class: "bump__tag", part: "tag", "aria-label": |
| 554 | /** translators: %1$s: amount off, %2$s: currency */ |
| 555 | wp.i18n.sprintf(wp.i18n.__('You save %1$s%2$s.', 'surecart'), (_b = this.bump) === null || _b === void 0 ? void 0 : _b.amount_off, ((_c = this.bump) === null || _c === void 0 ? void 0 : _c.price).currency) }, h("span", { "aria-hidden": "true" }, wp.i18n._x('Save', 'Save money', 'surecart'), " ", (_d = this.bump) === null || _d === void 0 ? void 0 : |
| 556 | _d.amount_off_display_amount))); |
| 557 | } |
| 558 | if (!!((_e = this.bump) === null || _e === void 0 ? void 0 : _e.percent_off)) { |
| 559 | const percent = `${this.bump.percent_off}%`; |
| 560 | return (h("div", { class: "bump__tag", part: "tag", "aria-label": |
| 561 | /** translators: %s is the discount percentage (e.g. "10%"). */ |
| 562 | wp.i18n.sprintf(wp.i18n.__('You save %s.', 'surecart'), percent) }, h("span", { "aria-hidden": "true" }, wp.i18n.sprintf( |
| 563 | /** translators: %s is the discount percentage (e.g. "10%"). */ |
| 564 | wp.i18n._x('Save %s', 'Save money', 'surecart'), percent)))); |
| 565 | } |
| 566 | } |
| 567 | /** Modern price (no slot) */ |
| 568 | renderModernPrice() { |
| 569 | var _a, _b, _c, _d, _e, _f, _g, _h, _j; |
| 570 | return (h("div", { class: { 'bump__price': true, 'bump__price--has-discount': !!((_a = this.bump) === null || _a === void 0 ? void 0 : _a.percent_off) || !!((_b = this.bump) === null || _b === void 0 ? void 0 : _b.amount_off) }, part: "price" }, !!(((_c = this.bump) === null || _c === void 0 ? void 0 : _c.percent_off) || ((_d = this.bump) === null || _d === void 0 ? void 0 : _d.amount_off)) && (h("span", { "aria-label": |
| 571 | /** translators: %s: old price */ |
| 572 | wp.i18n.sprintf(wp.i18n.__('Originally priced at %s.', 'surecart'), (_e = this.bump) === null || _e === void 0 ? void 0 : _e.subtotal_display_amount), class: "bump__original-price" }, (_f = this.bump) === null || _f === void 0 ? void 0 : _f.subtotal_display_amount)), h("span", null, h("span", { "aria-hidden": "true" }, ((_g = this.bump) === null || _g === void 0 ? void 0 : _g.total_amount) === 0 && wp.i18n.__('Free', 'surecart'), ((_h = this.bump) === null || _h === void 0 ? void 0 : _h.total_amount) > 0 && h("span", { class: "bump__new-price" }, (_j = this.bump) === null || _j === void 0 ? void 0 : _j.total_display_amount), this.renderInterval())))); |
| 573 | } |
| 574 | /** Classic price (with slot="description") */ |
| 575 | renderClassicPrice() { |
| 576 | var _a, _b, _c, _d, _e, _f, _g, _h, _j; |
| 577 | return (h("div", { slot: "description", class: { 'bump__price': true, 'bump__price--has-discount': !!((_a = this.bump) === null || _a === void 0 ? void 0 : _a.percent_off) || !!((_b = this.bump) === null || _b === void 0 ? void 0 : _b.amount_off) }, part: "price" }, !!(((_c = this.bump) === null || _c === void 0 ? void 0 : _c.percent_off) || ((_d = this.bump) === null || _d === void 0 ? void 0 : _d.amount_off)) && (h("span", { "aria-label": |
| 578 | /** translators: %s: old price */ |
| 579 | wp.i18n.sprintf(wp.i18n.__('Originally priced at %s.', 'surecart'), (_e = this.bump) === null || _e === void 0 ? void 0 : _e.subtotal_display_amount), class: "bump__original-price" }, (_f = this.bump) === null || _f === void 0 ? void 0 : _f.subtotal_display_amount)), h("span", null, h("span", { "aria-hidden": "true" }, ((_g = this.bump) === null || _g === void 0 ? void 0 : _g.total_amount) === 0 && wp.i18n.__('Free', 'surecart'), ((_h = this.bump) === null || _h === void 0 ? void 0 : _h.total_amount) > 0 && h("span", { class: "bump__new-price" }, (_j = this.bump) === null || _j === void 0 ? void 0 : _j.total_display_amount), this.renderInterval())))); |
| 580 | } |
| 581 | /** Modern design: rounded button, inline image, no checkbox */ |
| 582 | renderModern() { |
| 583 | var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; |
| 584 | const product = (_b = (_a = this.bump) === null || _a === void 0 ? void 0 : _a.price) === null || _b === void 0 ? void 0 : _b.product; |
| 585 | const lineItem = this.lineItem(); |
| 586 | return (h("sc-choice", { value: (_c = this.bump) === null || _c === void 0 ? void 0 : _c.id, type: "checkbox", showControl: false, checked: !!lineItem, exportparts: "base:choice__base, content:choice__content" }, h("div", { part: "base-content", class: "bump", onClick: e => e.stopPropagation(), onKeyDown: e => { |
| 587 | if (e.key === 'Enter' || e.key === ' ') |
| 588 | e.stopPropagation(); |
| 589 | } }, !!((_d = product === null || product === void 0 ? void 0 : product.line_item_image) === null || _d === void 0 ? void 0 : _d.src) && h("img", { ...product === null || product === void 0 ? void 0 : product.line_item_image, class: "bump__image", part: "image" }), h("div", { class: "bump__text", part: "text" }, h("div", { class: "bump__title", part: "title", "aria-label": wp.i18n.sprintf( |
| 590 | /* translators: %s: order bump name */ |
| 591 | wp.i18n.__('Product: %s.', 'surecart'), ((_e = this.bump) === null || _e === void 0 ? void 0 : _e.name) || (product === null || product === void 0 ? void 0 : product.name)) }, h("span", { "aria-hidden": "true" }, ((_f = this.bump) === null || _f === void 0 ? void 0 : _f.name) || (product === null || product === void 0 ? void 0 : product.name))), !!((_h = (_g = this.bump) === null || _g === void 0 ? void 0 : _g.metadata) === null || _h === void 0 ? void 0 : _h.cta) && (h("div", { class: "bump__cta", part: "cta" }, h("span", null, (_k = (_j = this.bump) === null || _j === void 0 ? void 0 : _j.metadata) === null || _k === void 0 ? void 0 : _k.cta))), h("div", { class: "bump__amount", part: "amount" }, this.renderModernPrice(), this.renderDiscount()), !!((_m = (_l = this.bump) === null || _l === void 0 ? void 0 : _l.metadata) === null || _m === void 0 ? void 0 : _m.description) && (h("div", { class: "bump__description", part: "description", "aria-label": wp.i18n.sprintf( |
| 592 | /* translators: %s: Product description */ |
| 593 | wp.i18n.__('Product description: %s.', 'surecart'), (_o = this.bump) === null || _o === void 0 ? void 0 : _o.rendered_description) }, h("span", { "aria-hidden": "true", innerHTML: (_p = this.bump) === null || _p === void 0 ? void 0 : _p.rendered_description })))), h("button", { type: "button", class: { |
| 594 | 'bump__button': true, |
| 595 | 'bump__button--checked': !!lineItem, |
| 596 | 'bump__button--loading': this.loading, |
| 597 | }, part: "button", onClick: () => this.updateLineItem(), "aria-label": lineItem ? wp.i18n.__('Remove from order', 'surecart') : wp.i18n.__('Add to order', 'surecart'), "aria-pressed": !!lineItem, "aria-busy": this.loading }, this.loading ? h("sc-spinner", null) : h("sc-icon", { name: lineItem ? 'check' : 'plus' }))))); |
| 598 | } |
| 599 | /** Classic design: checkbox control, footer with divider + image + description */ |
| 600 | renderClassic() { |
| 601 | var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; |
| 602 | const product = (_b = (_a = this.bump) === null || _a === void 0 ? void 0 : _a.price) === null || _b === void 0 ? void 0 : _b.product; |
| 603 | return (h("sc-choice", { value: (_c = this.bump) === null || _c === void 0 ? void 0 : _c.id, type: "checkbox", showControl: this.showControl, checked: !!this.lineItem(), disabled: this.loading, onClick: e => { |
| 604 | e.preventDefault(); |
| 605 | e.stopImmediatePropagation(); |
| 606 | this.updateLineItem(); |
| 607 | }, onKeyDown: e => { |
| 608 | if (e.key === 'Enter' || e.key === ' ') { |
| 609 | e.preventDefault(); |
| 610 | e.stopImmediatePropagation(); |
| 611 | this.updateLineItem(); |
| 612 | } |
| 613 | }, exportparts: "base, control, checked-icon, title" }, h("div", { part: "base-content", class: "bump" }, h("div", { class: "bump__text" }, h("div", { class: "bump__title", "aria-label": wp.i18n.sprintf( |
| 614 | /* translators: %s: order bump name */ |
| 615 | wp.i18n.__('Product: %s.', 'surecart'), ((_e = (_d = this.bump) === null || _d === void 0 ? void 0 : _d.metadata) === null || _e === void 0 ? void 0 : _e.cta) || ((_f = this.bump) === null || _f === void 0 ? void 0 : _f.name) || (product === null || product === void 0 ? void 0 : product.name)) }, h("span", { "aria-hidden": "true" }, ((_h = (_g = this.bump) === null || _g === void 0 ? void 0 : _g.metadata) === null || _h === void 0 ? void 0 : _h.cta) || ((_j = this.bump) === null || _j === void 0 ? void 0 : _j.name) || (product === null || product === void 0 ? void 0 : product.name))), h("div", { class: "bump__amount" }, this.renderClassicPrice(), this.renderDiscount()))), ((_l = (_k = this.bump) === null || _k === void 0 ? void 0 : _k.metadata) === null || _l === void 0 ? void 0 : _l.description) && (h("div", { slot: "footer", class: "bump__product--wrapper" }, h("sc-divider", { style: { '--spacing': 'var(--sc-spacing-medium)' } }), h("div", { class: "bump__product" }, !!((_m = product === null || product === void 0 ? void 0 : product.line_item_image) === null || _m === void 0 ? void 0 : _m.src) && h("img", { ...product === null || product === void 0 ? void 0 : product.line_item_image, class: "bump__image" }), h("div", { class: "bump__product-text" }, !!((_p = (_o = this.bump) === null || _o === void 0 ? void 0 : _o.metadata) === null || _p === void 0 ? void 0 : _p.cta) && (h("div", { class: "bump__product-title", "aria-hidden": "true" }, this.bump.name || (product === null || product === void 0 ? void 0 : product.name))), !!((_r = (_q = this.bump) === null || _q === void 0 ? void 0 : _q.metadata) === null || _r === void 0 ? void 0 : _r.description) && (h("div", { class: "bump__product-description", "aria-label": wp.i18n.sprintf( |
| 616 | /* translators: %s: Product description */ |
| 617 | wp.i18n.__('Product description: %s.', 'surecart'), (_s = this.bump) === null || _s === void 0 ? void 0 : _s.rendered_description) }, h("span", { "aria-hidden": "true", innerHTML: (_t = this.bump) === null || _t === void 0 ? void 0 : _t.rendered_description }))))))))); |
| 618 | } |
| 619 | render() { |
| 620 | return this.isModern ? this.renderModern() : this.renderClassic(); |
| 621 | } |
| 622 | get el() { return getElement(this); } |
| 623 | }; |
| 624 | ScOrderBump.style = ScOrderBumpStyle0; |
| 625 | |
| 626 | const scOrderBumpsCss = ":host{display:block}.bumps__list{display:grid;gap:10px}"; |
| 627 | const ScOrderBumpsStyle0 = scOrderBumpsCss; |
| 628 | |
| 629 | const ScOrderBumps = class { |
| 630 | constructor(hostRef) { |
| 631 | registerInstance(this, hostRef); |
| 632 | this.label = undefined; |
| 633 | this.help = undefined; |
| 634 | this.showControl = undefined; |
| 635 | this.hideAddedItems = undefined; |
| 636 | } |
| 637 | /** Check if a bump is already added as a line item. */ |
| 638 | isBumpAdded(bumpId) { |
| 639 | var _a, _b; |
| 640 | return (((_b = (_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.line_items) === null || _b === void 0 ? void 0 : _b.data) || []).some(item => (item === null || item === void 0 ? void 0 : item.bump) === bumpId); |
| 641 | } |
| 642 | render() { |
| 643 | var _a, _b; |
| 644 | const bumps = (((_b = (_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.recommended_bumps) === null || _b === void 0 ? void 0 : _b.data) || []).filter(bump => { |
| 645 | var _a, _b, _c, _d; |
| 646 | // exclude variants for now. |
| 647 | if (((_d = (_c = (_b = (_a = bump === null || bump === void 0 ? void 0 : bump.price) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.variants) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.count) !== 0) { |
| 648 | return false; |
| 649 | } |
| 650 | // optionally exclude bumps already added to the checkout. |
| 651 | if (this.hideAddedItems && this.isBumpAdded(bump === null || bump === void 0 ? void 0 : bump.id)) { |
| 652 | return false; |
| 653 | } |
| 654 | return true; |
| 655 | }); |
| 656 | if (!(bumps === null || bumps === void 0 ? void 0 : bumps.length)) { |
| 657 | return null; |
| 658 | } |
| 659 | return (h("sc-form-control", { label: this.label || wp.i18n.__('Recommended', 'surecart'), help: this.help }, h("div", { class: "bumps__list", "aria-label": wp.i18n.__('Order bump summary', 'surecart') }, bumps.map(bump => (h("sc-order-bump", { key: bump === null || bump === void 0 ? void 0 : bump.id, bump: bump, showControl: this.showControl, exportparts: "choice__base, choice__content, base-content, image, text, title, cta, amount, price, tag, description, button, base, control, checked-icon" })))))); |
| 660 | } |
| 661 | }; |
| 662 | ScOrderBumps.style = ScOrderBumpsStyle0; |
| 663 | |
| 664 | const scOrderShippingAddressCss = ":host{display:block}.sc-order-shipping__loading{display:flex;flex-direction:column;gap:0.5em}"; |
| 665 | const ScOrderShippingAddressStyle0 = scOrderShippingAddressCss; |
| 666 | |
| 667 | const ScOrderShippingAddress = class { |
| 668 | constructor(hostRef) { |
| 669 | registerInstance(this, hostRef); |
| 670 | /** Names for the address */ |
| 671 | this.names = { |
| 672 | name: 'shipping_name', |
| 673 | country: 'shipping_country', |
| 674 | city: 'shipping_city', |
| 675 | line_1: 'shipping_line_1', |
| 676 | line_2: 'shipping_line_2', |
| 677 | postal_code: 'shipping_postal_code', |
| 678 | state: 'shipping_state', |
| 679 | }; |
| 680 | this.label = undefined; |
| 681 | this.required = false; |
| 682 | this.full = undefined; |
| 683 | this.showName = undefined; |
| 684 | this.defaultCountry = undefined; |
| 685 | this.showLine2 = undefined; |
| 686 | this.requireName = false; |
| 687 | this.address = { |
| 688 | country: null, |
| 689 | city: null, |
| 690 | line_1: null, |
| 691 | line_2: null, |
| 692 | postal_code: null, |
| 693 | state: null, |
| 694 | }; |
| 695 | } |
| 696 | async updateAddressState(address) { |
| 697 | var _a; |
| 698 | if (JSON.stringify(address) === JSON.stringify(this.address)) |
| 699 | return; // no change, don't update. |
| 700 | this.address = address; |
| 701 | try { |
| 702 | lockCheckout('shipping-address'); |
| 703 | state.checkout = (await createOrUpdateCheckout({ |
| 704 | id: (_a = state.checkout) === null || _a === void 0 ? void 0 : _a.id, |
| 705 | data: { |
| 706 | shipping_address: this.address, |
| 707 | }, |
| 708 | })); |
| 709 | } |
| 710 | catch (e) { |
| 711 | console.error(e); |
| 712 | } |
| 713 | finally { |
| 714 | unLockCheckout('shipping-address'); |
| 715 | } |
| 716 | } |
| 717 | async reportValidity() { |
| 718 | var _a, _b; |
| 719 | if (!this.input) |
| 720 | return true; |
| 721 | return (_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.reportValidity) === null || _b === void 0 ? void 0 : _b.call(_a); |
| 722 | } |
| 723 | prefillAddress() { |
| 724 | var _a; |
| 725 | // Autofill is handled by sc-checkout-autofill-provider which patches checkoutState.checkout with any logged-in customer profile data. |
| 726 | if (isAddressEmpty(this.address)) { |
| 727 | this.address = { ...this.address, ...(_a = state.checkout) === null || _a === void 0 ? void 0 : _a.shipping_address }; |
| 728 | } |
| 729 | } |
| 730 | componentWillLoad() { |
| 731 | var _a; |
| 732 | if (this.defaultCountry && !((_a = this.address) === null || _a === void 0 ? void 0 : _a.country)) { |
| 733 | this.address.country = this.defaultCountry; |
| 734 | } |
| 735 | this.prefillAddress(); |
| 736 | onChange('checkout', () => this.prefillAddress()); |
| 737 | } |
| 738 | render() { |
| 739 | // use full if checkout requires it, it's set, or we're showing/requiring name field. |
| 740 | if (fullShippingAddressRequired() || this.full || this.requireName || this.showName) { |
| 741 | return (h("sc-address", { exportparts: "label, help-text, form-control, input__base, select__base, columns, search__base, menu__base", ref: el => (this.input = el), label: this.label || wp.i18n.__('Shipping Address', 'surecart'), names: this.names, required: this.required || shippingAddressRequired(), loading: formLoading(), address: this.address, "show-name": this.showName, "require-name": this.requireName, "show-line-2": this.showLine2, onScChangeAddress: e => this.updateAddressState(e.detail) })); |
| 742 | } |
| 743 | return (h("sc-compact-address", { ref: el => (this.input = el), required: this.required || shippingAddressRequired(), loading: formLoading(), address: this.address, names: this.names, label: this.label, onScChangeAddress: e => this.updateAddressState(e.detail) })); |
| 744 | } |
| 745 | }; |
| 746 | ScOrderShippingAddress.style = ScOrderShippingAddressStyle0; |
| 747 | |
| 748 | const scOrderTaxIdInputCss = ":host{display:block}"; |
| 749 | const ScOrderTaxIdInputStyle0 = scOrderTaxIdInputCss; |
| 750 | |
| 751 | const ScOrderTaxIdInput = class { |
| 752 | constructor(hostRef) { |
| 753 | registerInstance(this, hostRef); |
| 754 | this.show = false; |
| 755 | this.otherLabel = undefined; |
| 756 | this.caGstLabel = undefined; |
| 757 | this.auAbnLabel = undefined; |
| 758 | this.gbVatLabel = undefined; |
| 759 | this.euVatLabel = undefined; |
| 760 | this.helpText = undefined; |
| 761 | this.taxIdTypes = undefined; |
| 762 | this.required = false; |
| 763 | this.taxIdTypesData = []; |
| 764 | } |
| 765 | handleTaxIdTypesChange() { |
| 766 | this.taxIdTypesData = typeof this.taxIdTypes === 'string' ? JSON.parse(this.taxIdTypes) : this.taxIdTypes; |
| 767 | } |
| 768 | async reportValidity() { |
| 769 | return this.input.reportValidity(); |
| 770 | } |
| 771 | getStatus() { |
| 772 | var _a, _b, _c, _d, _e; |
| 773 | if (((_b = (_a = state.checkout) === null || _a === void 0 ? void 0 : _a.tax_identifier) === null || _b === void 0 ? void 0 : _b.number_type) !== 'eu_vat') { |
| 774 | return 'unknown'; |
| 775 | } |
| 776 | if (((_c = state.taxProtocol) === null || _c === void 0 ? void 0 : _c.eu_vat_unverified_behavior) === 'apply_reverse_charge') { |
| 777 | return 'unknown'; |
| 778 | } |
| 779 | return ((_e = (_d = state.checkout) === null || _d === void 0 ? void 0 : _d.tax_identifier) === null || _e === void 0 ? void 0 : _e.eu_vat_verified) ? 'valid' : 'invalid'; |
| 780 | } |
| 781 | async updateOrder(tax_identifier) { |
| 782 | try { |
| 783 | updateFormState('FETCH'); |
| 784 | state.checkout = (await createOrUpdateCheckout({ |
| 785 | id: state.checkout.id, |
| 786 | data: { tax_identifier }, |
| 787 | })); |
| 788 | updateFormState('RESOLVE'); |
| 789 | } |
| 790 | catch (e) { |
| 791 | console.error(e); |
| 792 | createErrorNotice(e); |
| 793 | updateFormState('REJECT'); |
| 794 | } |
| 795 | } |
| 796 | componentWillLoad() { |
| 797 | this.handleTaxIdTypesChange(); |
| 798 | } |
| 799 | isRequired() { |
| 800 | var _a, _b, _c, _d; |
| 801 | // If the block has explicitly set required, use that value. |
| 802 | if (this.required) { |
| 803 | return true; |
| 804 | } |
| 805 | // Only apply EU VAT requirement if eu_vat is one of the allowed tax types. |
| 806 | // If taxIdTypesData is empty, all types are allowed. |
| 807 | const isEuVatAllowed = !((_a = this.taxIdTypesData) === null || _a === void 0 ? void 0 : _a.length) || this.taxIdTypesData.includes('eu_vat'); |
| 808 | // Fall back to EU VAT protocol requirement only if EU VAT is an allowed type. |
| 809 | return isEuVatAllowed && ((_b = state.taxProtocol) === null || _b === void 0 ? void 0 : _b.eu_vat_required) && ((_d = (_c = state.checkout) === null || _c === void 0 ? void 0 : _c.tax_identifier) === null || _d === void 0 ? void 0 : _d.number_type) === 'eu_vat'; |
| 810 | } |
| 811 | render() { |
| 812 | var _a, _b, _c, _d, _e, _f, _g; |
| 813 | return (h("sc-tax-id-input", { key: 'a1025cc63d419d9d2ea88b5926249a7ba105156a', ref: el => (this.input = el), show: this.show, number: (_b = (_a = state.checkout) === null || _a === void 0 ? void 0 : _a.tax_identifier) === null || _b === void 0 ? void 0 : _b.number, type: ((_d = (_c = state.checkout) === null || _c === void 0 ? void 0 : _c.tax_identifier) === null || _d === void 0 ? void 0 : _d.number_type) || ((_e = this.taxIdTypesData) === null || _e === void 0 ? void 0 : _e[0]) || 'eu_vat', country: (_g = (_f = state.checkout) === null || _f === void 0 ? void 0 : _f.shipping_address) === null || _g === void 0 ? void 0 : _g.country, status: this.getStatus(), loading: formBusy(), onScChange: e => { |
| 814 | e.stopImmediatePropagation(); |
| 815 | this.updateOrder(e.detail); |
| 816 | }, otherLabel: this.otherLabel, caGstLabel: this.caGstLabel, auAbnLabel: this.auAbnLabel, gbVatLabel: this.gbVatLabel, euVatLabel: this.euVatLabel, help: this.helpText, taxIdTypes: this.taxIdTypesData, required: this.isRequired() })); |
| 817 | } |
| 818 | static get watchers() { return { |
| 819 | "taxIdTypes": ["handleTaxIdTypesChange"] |
| 820 | }; } |
| 821 | }; |
| 822 | ScOrderTaxIdInput.style = ScOrderTaxIdInputStyle0; |
| 823 | |
| 824 | const scRadioCss = ":host{display:inline-block}::slotted([slot=description]){display:block;color:var(--sc-radio-description-color, var(--sc-input-help-text-color, var(--sc-color-gray-500)));line-height:var(--sc-line-height-dense);margin:0.5em 0 0;font-size:var(--sc-font-size-small)}.radio{display:inline-flex;align-items:flex-start;font-family:var(--sc-input-font-family);font-size:var(--sc-input-font-size-medium);font-weight:var(--sc-input-font-weight);color:var(--sc-input-color);vertical-align:middle;gap:var(--sc-spacing-xx-small)}.radio:not(.radio--editing){cursor:pointer}.radio__icon{display:inline-flex;width:var(--sc-radio-size);height:var(--sc-radio-size)}.radio__icon svg{width:100%;height:100%}.radio__control{flex:0 0 auto;position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--sc-radio-size);height:var(--sc-radio-size);border:solid var(--sc-input-border-width) var(--sc-input-border-color);border-radius:50%;background-color:var(--sc-input-background-color);color:transparent;transition:var(--sc-input-transition, var(--sc-transition-medium)) border-color, var(--sc-input-transition, var(--sc-transition-medium)) opacity, var(--sc-input-transition, var(--sc-transition-medium)) background-color, var(--sc-input-transition, var(--sc-transition-medium)) color, var(--sc-input-transition, var(--sc-transition-medium)) box-shadow}.radio__control input[type=radio]{position:absolute;opacity:0;padding:0;margin:0;pointer-events:none}.radio:not(.radio--checked):not(.radio--disabled) .radio__control:hover{border-color:var(--sc-input-border-color-hover);background-color:var(--sc-input-background-color-hover)}.radio.radio--focused:not(.radio--checked):not(.radio--disabled) .radio__control{border-color:var(--sc-input-border-color-focus);background-color:var(--sc-input-background-color-focus);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary)}.radio--checked .radio__control{color:var(--var-sc-checked-radio-background-color, var(--sc-input-background-color));border-color:var(--sc-color-primary-500);background-color:var(--sc-color-primary-500)}.radio.radio--checked:not(.radio--disabled) .radio__control:hover{opacity:0.8}.radio.radio--checked:not(.radio--disabled).radio--focused .radio__control{border-color:var(--var-sc-checked-radio-border-color, var(--sc-input-background-color));background-color:var(--sc-color-primary-500);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary)}.radio--disabled{opacity:0.5;cursor:not-allowed}.radio:not(.radio--checked) svg circle{opacity:0}.radio__label{line-height:var(--sc-radio-size);margin-left:0.5em;user-select:none}"; |
| 825 | const ScRadioStyle0 = scRadioCss; |
| 826 | |
| 827 | let id = 0; |
| 828 | const ScRadio = class { |
| 829 | constructor(hostRef) { |
| 830 | registerInstance(this, hostRef); |
| 831 | this.scBlur = createEvent(this, "scBlur", 7); |
| 832 | this.scChange = createEvent(this, "scChange", 7); |
| 833 | this.scFocus = createEvent(this, "scFocus", 7); |
| 834 | this.inputId = `radio-${++id}`; |
| 835 | this.labelId = `radio-label-${id}`; |
| 836 | this.hasFocus = false; |
| 837 | this.name = undefined; |
| 838 | this.value = undefined; |
| 839 | this.disabled = false; |
| 840 | this.checked = false; |
| 841 | this.required = false; |
| 842 | this.invalid = false; |
| 843 | this.edit = undefined; |
| 844 | } |
| 845 | /** Simulates a click on the radio. */ |
| 846 | async ceClick() { |
| 847 | this.input.click(); |
| 848 | } |
| 849 | /** Checks for validity and shows the browser's validation message if the control is invalid. */ |
| 850 | async reportValidity() { |
| 851 | this.invalid = !this.input.checkValidity(); |
| 852 | return this.input.reportValidity(); |
| 853 | } |
| 854 | handleCheckedChange() { |
| 855 | if (!this.input) |
| 856 | return; |
| 857 | if (this.checked) { |
| 858 | this.getSiblingRadios().map(radio => (radio.checked = false)); |
| 859 | } |
| 860 | this.input.checked = this.checked; |
| 861 | this.scChange.emit(); |
| 862 | } |
| 863 | handleClick() { |
| 864 | this.checked = true; |
| 865 | } |
| 866 | handleBlur() { |
| 867 | this.hasFocus = false; |
| 868 | this.scBlur.emit(); |
| 869 | } |
| 870 | handleFocus() { |
| 871 | this.hasFocus = true; |
| 872 | this.scFocus.emit(); |
| 873 | } |
| 874 | /** Sets a custom validation message. If `message` is not empty, the field will be considered invalid. */ |
| 875 | setCustomValidity(message) { |
| 876 | this.input.setCustomValidity(message); |
| 877 | this.invalid = !this.input.checkValidity(); |
| 878 | } |
| 879 | getAllRadios() { |
| 880 | const radioGroup = this.el.closest('sc-radio-group'); |
| 881 | // Radios must be part of a radio group |
| 882 | if (!radioGroup) { |
| 883 | return []; |
| 884 | } |
| 885 | return [...radioGroup.querySelectorAll('sc-radio')]; |
| 886 | } |
| 887 | getSiblingRadios() { |
| 888 | return this.getAllRadios().filter(radio => radio !== this.el); |
| 889 | } |
| 890 | handleKeyDown(event) { |
| 891 | if (this.edit) |
| 892 | return true; |
| 893 | if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) { |
| 894 | const radios = this.getAllRadios().filter(radio => !radio.disabled); |
| 895 | const incr = ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1; |
| 896 | let index = radios.indexOf(this.el) + incr; |
| 897 | if (index < 0) |
| 898 | index = radios.length - 1; |
| 899 | if (index > radios.length - 1) |
| 900 | index = 0; |
| 901 | this.getAllRadios().map(radio => (radio.checked = false)); |
| 902 | radios[index].focus(); |
| 903 | radios[index].checked = true; |
| 904 | event.preventDefault(); |
| 905 | } |
| 906 | } |
| 907 | // Prevent clicks on the label from briefly blurring the input |
| 908 | handleMouseDown(event) { |
| 909 | if (this.edit) |
| 910 | return true; |
| 911 | event.preventDefault(); |
| 912 | this.input.focus(); |
| 913 | } |
| 914 | componentDidLoad() { |
| 915 | this.formController = new FormSubmitController(this.el, { |
| 916 | value: (control) => (control.checked ? control.value : undefined), |
| 917 | }).addFormData(); |
| 918 | } |
| 919 | disconnectedCallback() { |
| 920 | var _a; |
| 921 | (_a = this.formController) === null || _a === void 0 ? void 0 : _a.removeFormData(); |
| 922 | } |
| 923 | render() { |
| 924 | const Tag = this.edit ? 'div' : 'label'; |
| 925 | return (h(Tag, { key: '19d5762b6350887c46422f2f0b1af8c9df70deab', part: "base", class: { |
| 926 | 'radio': true, |
| 927 | 'radio--checked': this.checked, |
| 928 | 'radio--disabled': this.disabled, |
| 929 | 'radio--focused': this.hasFocus, |
| 930 | 'radio--editing': this.edit, |
| 931 | }, htmlFor: this.inputId, onKeyDown: e => this.handleKeyDown(e), onMouseDown: e => this.handleMouseDown(e) }, h("span", { key: '8f085a092c452cff7bbfad644c6701ff7a3e6d6f', part: "control", class: "radio__control" }, h("span", { key: '437c748392090b6b5952eca8fc8b35aa31710cce', part: "checked-icon", class: "radio__icon" }, h("svg", { key: '5bd54bdec3563d55abb2375c3ab9d5123e812761', viewBox: "0 0 16 16" }, h("g", { key: '3dd7070bb8f45f07e11c80c511df432523a959a7', stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" }, h("g", { key: '9b86f8022a20d9e0e7a4c10211c69d50053df9a2', fill: "currentColor" }, h("circle", { key: '8dbbcc8b1266b94dd4fd0b9925c7ce9c59c7cc75', cx: "8", cy: "8", r: "3.42857143" }))))), h("input", { key: 'ebd16e07d9674bf0c59d2bc990e9dec11a4f18b4', id: this.inputId, ref: el => (this.input = el), type: "radio", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-labelledby": this.labelId, onClick: () => this.handleClick(), onBlur: () => this.handleBlur(), onFocus: () => this.handleFocus() })), h("span", { key: 'bd64e86da262e70d1e13ff36c9ab902b5ab0a7a6', part: "label", id: this.labelId, class: "radio__label" }, h("slot", { key: '482c49a3702df3f524846736d3f12da5866bbed5' }), h("slot", { key: '4d16b4c7c545680398a739c28bce1d2ebfd3acfc', name: "description" })))); |
| 932 | } |
| 933 | get el() { return getElement(this); } |
| 934 | static get watchers() { return { |
| 935 | "checked": ["handleCheckedChange"] |
| 936 | }; } |
| 937 | }; |
| 938 | ScRadio.style = ScRadioStyle0; |
| 939 | |
| 940 | const scRadioGroupCss = ":host{display:block}.radio-group{border:none;padding:0;margin:0;min-width:0}.radio-group .radio-group__label{display:inline-block;padding:0;color:var(--sc-input-label-color);font-weight:var(--sc-input-label-font-weight);text-transform:var(--sc-input-label-text-transform, none);letter-spacing:var(--sc-input-label-letter-spacing, 0);margin-bottom:var(--sc-input-label-margin)}.radio-group__hidden-input{position:absolute;opacity:0;padding:0px;margin:0px;pointer-events:none}.radio-group--is-required .radio-group__label:after{content:\" *\";color:var(--sc-color-danger-500)}::slotted(sc-radio:not(:last-of-type)){display:block;margin-bottom:var(--sc-spacing-x-small)}.radio-group--is-rtl.radio-group,.radio-group--is-rtl.radio-group .radio-group__label{text-align:right}"; |
| 941 | const ScRadioGroupStyle0 = scRadioGroupCss; |
| 942 | |
| 943 | const ScRadioGroup = class { |
| 944 | constructor(hostRef) { |
| 945 | registerInstance(this, hostRef); |
| 946 | this.scChange = createEvent(this, "scChange", 7); |
| 947 | this.label = ''; |
| 948 | this.invalid = undefined; |
| 949 | this.value = ''; |
| 950 | this.required = undefined; |
| 951 | } |
| 952 | /** Checks for validity and shows the browser's validation message if the control is invalid. */ |
| 953 | async reportValidity() { |
| 954 | this.invalid = !this.input.checkValidity(); |
| 955 | return this.input.reportValidity(); |
| 956 | } |
| 957 | handleRadioClick(event) { |
| 958 | if (event.target.tagName !== 'SC-RADIO') |
| 959 | return; |
| 960 | event.stopImmediatePropagation(); |
| 961 | const target = event.target; |
| 962 | if (target.disabled) { |
| 963 | return; |
| 964 | } |
| 965 | if (target.checked) { |
| 966 | this.value = target.value; |
| 967 | this.scChange.emit(target.value); |
| 968 | } |
| 969 | } |
| 970 | componentDidLoad() { |
| 971 | const choices = [...this.el.querySelectorAll('sc-radio')]; |
| 972 | choices.forEach(choice => { |
| 973 | if (choice.checked) { |
| 974 | this.value = choice.value; |
| 975 | } |
| 976 | }); |
| 977 | } |
| 978 | render() { |
| 979 | return (h("fieldset", { key: '0d9a4ba13a02ca240257a1ea54439573d4bbd5cc', part: "base", class: { |
| 980 | 'radio-group': true, |
| 981 | 'radio-group--invalid': this.invalid, |
| 982 | 'radio-group--is-required': this.required, |
| 983 | 'radio-group--is-rtl': isRtl(), |
| 984 | }, "aria-invalid": this.invalid, role: "radiogroup" }, h("legend", { key: '3c21b9c1d8ef448d07edf1e108f6085459dace07', part: "label", class: "radio-group__label" }, h("slot", { key: '2c72f2c65b564a707c9dbb25c054f30c816b3ae3', name: "label" }, this.label)), h("input", { key: 'db34f962b73dc1f4c976b841204963fa3068b05c', type: "text", class: "radio-group__hidden-input", ref: el => (this.input = el), required: this.required, value: this.value, tabindex: "-1" }), h("div", { key: 'f6c015bd02e42caf4c1e1a2441f1974ac0b7bf28', part: "items", class: "radio-group__items" }, h("slot", { key: '11abc8a0e5f0cf8979820facdf61749dda257d97' })))); |
| 985 | } |
| 986 | get el() { return getElement(this); } |
| 987 | }; |
| 988 | ScRadioGroup.style = ScRadioGroupStyle0; |
| 989 | |
| 990 | const scShippingChoicesCss = ":host{display:block}.shipping-choice{width:100%;padding:var(--sc-spacing-medium);margin:0;box-sizing:border-box;border-bottom:var(--sc-input-border, 1px solid var(--sc-color-gray-300));background-color:var(--sc-shipping-choice-background-color, var(--sc-input-background-color))}.shipping-choice__empty{background:var(--sc-alert-background-color, var(--sc-color-gray-100));opacity:0.75;padding:var(--sc-spacing-large);border-radius:var(--sc-input-border-radius-medium);line-height:var(--sc-line-height-dense);font-size:var(--sc-font-size-small);border:solid 1px var(--sc-input-border-color, var(--sc-input-border))}.shipping-choice:last-child{border-bottom-width:0}.shipping-choice__text{display:flex;flex-direction:column;gap:var(--sc-spacing-xx-small)}.shipping-choice__price{color:var(--sc-input-label-color);font-weight:var(--sc-price-choice-price-font-weight, var(--sc-font-weight-normal));white-space:nowrap;display:var(--sc-shipping-choice-price-display, inherit)}.shipping-choice__name{display:inline-block;color:var(--sc-price-choice-name-color, var(--sc-input-label-color));font-size:var(--sc-price-choice-name-size, var(--sc-input-label-font-size-medium));font-weight:var(--sc-price-choice-name-font-weight, var(--sc-font-weight-bold));text-transform:var(--sc-price-choice-text-transform, var(--sc-input-label-text-transform, none));line-height:var(--sc-shipping-name-line-height, 1)}.shipping-choice__description{color:var(--sc-input-label-color);font-weight:var(--sc-price-choice-price-font-weight, var(--sc-font-weight-normal));line-height:var(--sc-shipping-description-line-height, 1.2)}sc-radio-group::part(items){border:var(--sc-input-border, 1px solid var(--sc-color-gray-300));border-radius:var(--sc-shipping-choice-border-radius, var(--sc-input-border-radius-medium));box-shadow:var(--sc-shipping-box-shadow, var(--sc-input-box-shadow));overflow:hidden;position:relative}sc-radio::part(base){width:100%}sc-radio::part(label){width:100%;display:flex;justify-content:space-between;gap:var(--sc-spacing-small)}sc-radio-group::slotted(sc-radio:not(:last-of-type)){margin-bottom:0}"; |
| 991 | const ScShippingChoicesStyle0 = scShippingChoicesCss; |
| 992 | |
| 993 | const ScShippingChoices = class { |
| 994 | constructor(hostRef) { |
| 995 | registerInstance(this, hostRef); |
| 996 | this.label = undefined; |
| 997 | this.showDescription = true; |
| 998 | this.shippingChoices = undefined; |
| 999 | } |
| 1000 | /** Maybe update the order. */ |
| 1001 | async updateCheckout(selectedShippingChoiceId) { |
| 1002 | if (!selectedShippingChoiceId) |
| 1003 | return; |
| 1004 | try { |
| 1005 | lockCheckout('selected_shipping_choice'); |
| 1006 | state.checkout = (await createOrUpdateCheckout({ |
| 1007 | id: state.checkout.id, |
| 1008 | data: { |
| 1009 | selected_shipping_choice_id: selectedShippingChoiceId, |
| 1010 | }, |
| 1011 | })); |
| 1012 | speak(wp.i18n.__('Shipping choice updated.', 'surecart'), 'assertive'); |
| 1013 | const { total_amount, currency } = state.checkout; |
| 1014 | /** translators: %1$s: formatted amount */ |
| 1015 | speak(wp.i18n.sprintf(wp.i18n.__('Your order total has changed to: %1$s.', 'surecart'), getFormattedPrice({ amount: total_amount, currency })), 'assertive'); |
| 1016 | } |
| 1017 | catch (e) { |
| 1018 | console.error(e); |
| 1019 | createErrorNotice(e); |
| 1020 | } |
| 1021 | finally { |
| 1022 | unLockCheckout('selected_shipping_choice'); |
| 1023 | } |
| 1024 | } |
| 1025 | render() { |
| 1026 | var _a, _b, _c, _d, _e; |
| 1027 | const choices = this.shippingChoices || ((_b = (_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.shipping_choices) === null || _b === void 0 ? void 0 : _b.data); |
| 1028 | // When not using prop override, apply checkout state guards. |
| 1029 | if (!this.shippingChoices) { |
| 1030 | // shipping choice is not required. |
| 1031 | if (!((_c = state === null || state === void 0 ? void 0 : state.checkout) === null || _c === void 0 ? void 0 : _c.selected_shipping_choice_required)) { |
| 1032 | return h(Host, { style: { display: 'none' } }); |
| 1033 | } |
| 1034 | // no shipping choices but no country either |
| 1035 | if (!(choices === null || choices === void 0 ? void 0 : choices.length) && !((_e = (_d = state === null || state === void 0 ? void 0 : state.checkout) === null || _d === void 0 ? void 0 : _d.shipping_address) === null || _e === void 0 ? void 0 : _e.country)) { |
| 1036 | return (h("sc-form-control", { label: this.label || wp.i18n.__('Shipping', 'surecart') }, h("div", { class: "shipping-choice__empty" }, wp.i18n.__('To check available shipping choices, please provide your shipping country in the address section.', 'surecart')))); |
| 1037 | } |
| 1038 | // no shipping choices yet. |
| 1039 | if (!(choices === null || choices === void 0 ? void 0 : choices.length)) { |
| 1040 | return (h("sc-form-control", { part: "empty", label: this.label || wp.i18n.__('Shipping', 'surecart') }, h("div", { class: "shipping-choice__empty" }, wp.i18n.__('Sorry, we are not able to ship to your address.', 'surecart')))); |
| 1041 | } |
| 1042 | } |
| 1043 | return (h(Host, null, h("sc-radio-group", { part: "base", label: this.label || wp.i18n.__('Shipping', 'surecart'), class: "shipping-choices", onScChange: e => this.updateCheckout(e.detail) }, (choices || []).map(({ id, display_amount, shipping_method }) => { |
| 1044 | var _a; |
| 1045 | return (h("sc-radio", { key: id, checked: ((_a = state === null || state === void 0 ? void 0 : state.checkout) === null || _a === void 0 ? void 0 : _a.selected_shipping_choice) === id, exportparts: "base:radio__base,label:radio__label,control:radio__control,checked-icon:radio__checked-icon", class: "shipping-choice", value: id }, h("div", { class: "shipping-choice__text" }, h("div", { class: "shipping-choice__name" }, (shipping_method === null || shipping_method === void 0 ? void 0 : shipping_method.name) || wp.i18n.__('Standard Shipping', 'surecart')), this.showDescription && !!(shipping_method === null || shipping_method === void 0 ? void 0 : shipping_method.description) && (h("div", { class: "shipping-choice__description" }, shipping_method === null || shipping_method === void 0 ? void 0 : shipping_method.description))), h("div", { class: "shipping-choice__price" }, !!display_amount ? display_amount : wp.i18n.__('Free', 'surecart')))); |
| 1046 | })), checkoutIsLocked('selected_shipping_choice') && h("sc-block-ui", null))); |
| 1047 | } |
| 1048 | }; |
| 1049 | ScShippingChoices.style = ScShippingChoicesStyle0; |
| 1050 | |
| 1051 | export { ScCompactAddress as sc_compact_address, ScCustomerPhone as sc_customer_phone, ScInvoiceDetails as sc_invoice_details, ScLineItemInvoiceMemo as sc_invoice_memo, ScLineItemInvoiceDueDate as sc_line_item_invoice_due_date, ScLineItemInvoiceNumber as sc_line_item_invoice_number, ScLineItemInvoiceReceiptDownload as sc_line_item_invoice_receipt_download, ScLineItemShipping as sc_line_item_shipping, ScLineItemTax as sc_line_item_tax, ScLineItemTrial as sc_line_item_trial, ScOrderBillingAddress as sc_order_billing_address, ScOrderBump as sc_order_bump, ScOrderBumps as sc_order_bumps, ScOrderShippingAddress as sc_order_shipping_address, ScOrderTaxIdInput as sc_order_tax_id_input, ScRadio as sc_radio, ScRadioGroup as sc_radio_group, ScShippingChoices as sc_shipping_choices }; |
| 1052 | |
| 1053 | //# sourceMappingURL=sc-compact-address_18.entry.js.map |