MockProcessor-498b60c5.js
1 year ago
MockProcessor-498b60c5.js.map
1 year ago
add-query-args-0e2a8393.js
1 year ago
add-query-args-0e2a8393.js.map
1 year ago
address-b892540d.js
1 year ago
address-b892540d.js.map
1 year ago
animation-registry-12eed2e3.js
1 year ago
animation-registry-12eed2e3.js.map
1 year ago
app-globals-707edcd4.js
1 year ago
app-globals-707edcd4.js.map
1 year ago
consumer-e06b16d3.js
1 year ago
consumer-e06b16d3.js.map
1 year ago
countries-c2f41f03.js
1 year ago
countries-c2f41f03.js.map
1 year ago
currency-a0c9bff4.js
1 year ago
currency-a0c9bff4.js.map
1 year ago
error-12ea55b3.js
1 year ago
error-12ea55b3.js.map
1 year ago
fetch-e3c5d1b9.js
1 year ago
fetch-e3c5d1b9.js.map
1 year ago
form-data-76641f16.js
1 year ago
form-data-76641f16.js.map
1 year ago
functions-2a4a4ba3.js
1 year ago
functions-2a4a4ba3.js.map
1 year ago
getters-09dda855.js
1 year ago
getters-09dda855.js.map
1 year ago
getters-1a55b8a4.js
1 year ago
getters-1a55b8a4.js.map
1 year ago
getters-26526b7c.js
1 year ago
getters-26526b7c.js.map
1 year ago
getters-a7eec27c.js
1 year ago
getters-a7eec27c.js.map
1 year ago
getters-b1d93841.js
1 year ago
getters-b1d93841.js.map
1 year ago
google-a86aa761.js
1 year ago
google-a86aa761.js.map
1 year ago
google-dd89f242.js
1 year ago
google-dd89f242.js.map
1 year ago
index-06061d4e.js
1 year ago
index-06061d4e.js.map
1 year ago
index-675be13e.js
1 year ago
index-675be13e.js.map
1 year ago
index-745b6bec.js
1 year ago
index-745b6bec.js.map
1 year ago
index-822e5799.js
1 year ago
index-822e5799.js.map
1 year ago
index-871d88b8.js
1 year ago
index-871d88b8.js.map
1 year ago
index-c5a96d53.js
2 years ago
index-c5a96d53.js.map
2 years ago
index.js
1 year ago
index.js.map
2 years 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-e110eea6.js
1 year ago
library-e110eea6.js.map
1 year ago
loader.js
1 year ago
loader.js.map
1 year ago
media-d21119a3.js
1 year ago
media-d21119a3.js.map
1 year ago
mutations-066b82f0.js
1 year ago
mutations-066b82f0.js.map
1 year ago
mutations-7ba12644.js
1 year ago
mutations-7ba12644.js.map
1 year ago
mutations-e77bd122.js
1 year ago
mutations-e77bd122.js.map
1 year ago
mutations-ed6d0770.js
1 year ago
mutations-ed6d0770.js.map
1 year ago
mutations-f11a19f9.js
1 year ago
mutations-f11a19f9.js.map
1 year ago
page-align-0cdacf32.js
1 year ago
page-align-0cdacf32.js.map
1 year ago
price-d5770168.js
1 year ago
price-d5770168.js.map
1 year ago
pure-963214cb.js
1 year ago
pure-963214cb.js.map
1 year ago
quantity-1f39f750.js
1 year ago
quantity-1f39f750.js.map
1 year ago
remove-query-args-938c53ea.js
1 year ago
remove-query-args-938c53ea.js.map
1 year ago
sc-address_3.entry.js
1 year ago
sc-address_3.entry.js.map
1 year ago
sc-alert_13.entry.js
1 year ago
sc-alert_13.entry.js.map
1 year ago
sc-avatar.entry.js
1 year ago
sc-avatar.entry.js.map
1 year ago
sc-badge-notice.entry.js
1 year ago
sc-badge-notice.entry.js.map
1 year ago
sc-breadcrumb.entry.js
1 year ago
sc-breadcrumb.entry.js.map
1 year ago
sc-breadcrumbs.entry.js
1 year ago
sc-breadcrumbs.entry.js.map
1 year ago
sc-button-group.entry.js
1 year ago
sc-button-group.entry.js.map
1 year ago
sc-cancel-dialog_2.entry.js
1 year ago
sc-cancel-dialog_2.entry.js.map
1 year ago
sc-cancel-discount_4.entry.js
1 year ago
sc-cancel-discount_4.entry.js.map
1 year ago
sc-card.entry.js
1 year ago
sc-card.entry.js.map
1 year ago
sc-cart-button.entry.js
1 year ago
sc-cart-button.entry.js.map
1 year ago
sc-cart-form-submit.entry.js
1 year ago
sc-cart-form-submit.entry.js.map
1 year ago
sc-cart-form.entry.js
1 year ago
sc-cart-form.entry.js.map
1 year ago
sc-cart-header.entry.js
1 year ago
sc-cart-header.entry.js.map
1 year ago
sc-cart-icon.entry.js
1 year ago
sc-cart-icon.entry.js.map
1 year ago
sc-cart-loader.entry.js
1 year ago
sc-cart-loader.entry.js.map
1 year ago
sc-cart-session-provider_3.entry.js
1 year ago
sc-cart-session-provider_3.entry.js.map
1 year ago
sc-cart-submit.entry.js
1 year ago
sc-cart-submit.entry.js.map
1 year ago
sc-cart.entry.js
1 year ago
sc-cart.entry.js.map
1 year ago
sc-cc-logo_2.entry.js
1 year ago
sc-cc-logo_2.entry.js.map
1 year ago
sc-charges-list.entry.js
1 year ago
sc-charges-list.entry.js.map
1 year ago
sc-checkout-form-errors.entry.js
1 year ago
sc-checkout-form-errors.entry.js.map
1 year ago
sc-checkout-mollie-payment_2.entry.js
1 year ago
sc-checkout-mollie-payment_2.entry.js.map
1 year ago
sc-checkout-product-price-variant-selector.entry.js
1 year ago
sc-checkout-product-price-variant-selector.entry.js.map
1 year ago
sc-checkout-stock-alert_8.entry.js
1 year ago
sc-checkout-stock-alert_8.entry.js.map
1 year ago
sc-checkout.entry.js
1 year ago
sc-checkout.entry.js.map
1 year ago
sc-choice-container.entry.js
1 year ago
sc-choice-container.entry.js.map
1 year ago
sc-choice.entry.js
1 year ago
sc-choice.entry.js.map
1 year ago
sc-choices.entry.js
1 year ago
sc-choices.entry.js.map
1 year ago
sc-column_2.entry.js
1 year ago
sc-column_2.entry.js.map
1 year ago
sc-compact-address_11.entry.js
1 year ago
sc-compact-address_11.entry.js.map
1 year ago
sc-conditional-form.entry.js
1 year ago
sc-conditional-form.entry.js.map
1 year ago
sc-consumer.entry.js
1 year ago
sc-consumer.entry.js.map
1 year ago
sc-coupon-form.entry.js
1 year ago
sc-coupon-form.entry.js.map
1 year ago
sc-custom-order-price-input.entry.js
1 year ago
sc-custom-order-price-input.entry.js.map
1 year ago
sc-customer-details.entry.js
1 year ago
sc-customer-details.entry.js.map
1 year ago
sc-customer-edit.entry.js
1 year ago
sc-customer-edit.entry.js.map
1 year ago
sc-customer-email.entry.js
1 year ago
sc-customer-email.entry.js.map
1 year ago
sc-customer-firstname.entry.js
1 year ago
sc-customer-firstname.entry.js.map
1 year ago
sc-customer-lastname.entry.js
1 year ago
sc-customer-lastname.entry.js.map
1 year ago
sc-customer-name.entry.js
1 year ago
sc-customer-name.entry.js.map
1 year ago
sc-customer-phone.entry.js
1 year ago
sc-customer-phone.entry.js.map
1 year ago
sc-dashboard-customer-details.entry.js
1 year ago
sc-dashboard-customer-details.entry.js.map
1 year ago
sc-dashboard-downloads-list.entry.js
1 year ago
sc-dashboard-downloads-list.entry.js.map
1 year ago
sc-divider.entry.js
1 year ago
sc-divider.entry.js.map
1 year ago
sc-donation-choices.entry.js
1 year ago
sc-donation-choices.entry.js.map
1 year ago
sc-downloads-list.entry.js
1 year ago
sc-downloads-list.entry.js.map
1 year ago
sc-dropdown_3.entry.js
1 year ago
sc-dropdown_3.entry.js.map
1 year ago
sc-empty.entry.js
1 year ago
sc-empty.entry.js.map
1 year ago
sc-express-payment.entry.js
1 year ago
sc-express-payment.entry.js.map
1 year ago
sc-feature-demo-banner.entry.js
1 year ago
sc-feature-demo-banner.entry.js.map
1 year ago
sc-form-control_2.entry.js
1 year ago
sc-form-control_2.entry.js.map
1 year ago
sc-form-row.entry.js
1 year ago
sc-form-row.entry.js.map
1 year ago
sc-form.entry.js
1 year ago
sc-form.entry.js.map
1 year ago
sc-format-bytes.entry.js
1 year ago
sc-format-bytes.entry.js.map
1 year ago
sc-format-interval.entry.js
1 year ago
sc-format-interval.entry.js.map
1 year ago
sc-fulfillment-shipping-status-badge.entry.js
1 year ago
sc-fulfillment-shipping-status-badge.entry.js.map
1 year ago
sc-fulfillments.entry.js
1 year ago
sc-fulfillments.entry.js.map
1 year ago
sc-heading_2.entry.js
1 year ago
sc-heading_2.entry.js.map
1 year ago
sc-image-slider.entry.js
1 year ago
sc-image-slider.entry.js.map
1 year ago
sc-invoices-list.entry.js
1 year ago
sc-invoices-list.entry.js.map
1 year ago
sc-license.entry.js
1 year ago
sc-license.entry.js.map
1 year ago
sc-licenses-list.entry.js
1 year ago
sc-licenses-list.entry.js.map
1 year ago
sc-line-item-bump.entry.js
1 year ago
sc-line-item-bump.entry.js.map
1 year ago
sc-line-item-total.entry.js
1 year ago
sc-line-item-total.entry.js.map
1 year ago
sc-line-item.entry.js
1 year ago
sc-line-item.entry.js.map
1 year ago
sc-line-items-provider.entry.js
1 year ago
sc-line-items-provider.entry.js.map
1 year ago
sc-line-items.entry.js
1 year ago
sc-line-items.entry.js.map
1 year ago
sc-login-form.entry.js
1 year ago
sc-login-form.entry.js.map
1 year ago
sc-manual-payment-method_3.entry.js
1 year ago
sc-manual-payment-method_3.entry.js.map
1 year ago
sc-menu-divider.entry.js
1 year ago
sc-menu-divider.entry.js.map
1 year ago
sc-menu-label_2.entry.js
1 year ago
sc-menu-label_2.entry.js.map
1 year ago
sc-mollie-add-method.entry.js
1 year ago
sc-mollie-add-method.entry.js.map
1 year ago
sc-order-confirmation-customer.entry.js
1 year ago
sc-order-confirmation-customer.entry.js.map
1 year ago
sc-order-confirmation-details.entry.js
1 year ago
sc-order-confirmation-details.entry.js.map
1 year ago
sc-order-confirmation-line-items_2.entry.js
1 year ago
sc-order-confirmation-line-items_2.entry.js.map
1 year ago
sc-order-confirmation.entry.js
1 year ago
sc-order-confirmation.entry.js.map
1 year ago
sc-order-coupon-form.entry.js
1 year ago
sc-order-coupon-form.entry.js.map
1 year ago
sc-order-detail.entry.js
1 year ago
sc-order-detail.entry.js.map
1 year ago
sc-order-fulfillment-badge.entry.js
1 year ago
sc-order-fulfillment-badge.entry.js.map
1 year ago
sc-order-manual-instructions.entry.js
1 year ago
sc-order-manual-instructions.entry.js.map
1 year ago
sc-order-password.entry.js
1 year ago
sc-order-password.entry.js.map
1 year ago
sc-order-return-badge.entry.js
1 year ago
sc-order-return-badge.entry.js.map
1 year ago
sc-order-shipment-badge.entry.js
1 year ago
sc-order-shipment-badge.entry.js.map
1 year ago
sc-order-status-badge.entry.js
1 year ago
sc-order-status-badge.entry.js.map
1 year ago
sc-order-submit.entry.js
1 year ago
sc-order-submit.entry.js.map
1 year ago
sc-order-summary.entry.js
1 year ago
sc-order-summary.entry.js.map
1 year ago
sc-order.entry.js
1 year ago
sc-order.entry.js.map
1 year ago
sc-orders-list.entry.js
1 year ago
sc-orders-list.entry.js.map
1 year ago
sc-pagination.entry.js
1 year ago
sc-pagination.entry.js.map
1 year ago
sc-password-nag.entry.js
1 year ago
sc-password-nag.entry.js.map
1 year ago
sc-password.entry.js
1 year ago
sc-password.entry.js.map
1 year ago
sc-payment-method-choice_2.entry.js
1 year ago
sc-payment-method-choice_2.entry.js.map
1 year ago
sc-payment-method-details.entry.js
1 year ago
sc-payment-method-details.entry.js.map
1 year ago
sc-payment-methods-list.entry.js
1 year ago
sc-payment-methods-list.entry.js.map
1 year ago
sc-payment.entry.js
1 year ago
sc-payment.entry.js.map
1 year ago
sc-paypal-add-method.entry.js
1 year ago
sc-paypal-add-method.entry.js.map
1 year ago
sc-paypal-buttons_2.entry.js
1 year ago
sc-paypal-buttons_2.entry.js.map
1 year ago
sc-paystack-add-method.entry.js
1 year ago
sc-paystack-add-method.entry.js.map
1 year ago
sc-phone-input.entry.js
1 year ago
sc-phone-input.entry.js.map
1 year ago
sc-pill-option.entry.js
1 year ago
sc-pill-option.entry.js.map
1 year ago
sc-premium-tag.entry.js
1 year ago
sc-premium-tag.entry.js.map
1 year ago
sc-price-choice-container.entry.js
1 year ago
sc-price-choice-container.entry.js.map
1 year ago
sc-price-choice.entry.js
1 year ago
sc-price-choice.entry.js.map
1 year ago
sc-price-choices.entry.js
1 year ago
sc-price-choices.entry.js.map
1 year ago
sc-price-input.entry.js
1 year ago
sc-price-input.entry.js.map
1 year ago
sc-price-range.entry.js
1 year ago
sc-price-range.entry.js.map
1 year ago
sc-price.entry.js
1 year ago
sc-price.entry.js.map
1 year ago
sc-product-buy-button.entry.js
1 year ago
sc-product-buy-button.entry.js.map
1 year ago
sc-product-donation-amount-choice.entry.js
1 year ago
sc-product-donation-amount-choice.entry.js.map
1 year ago
sc-product-donation-choices.entry.js
1 year ago
sc-product-donation-choices.entry.js.map
1 year ago
sc-product-donation-custom-amount.entry.js
1 year ago
sc-product-donation-custom-amount.entry.js.map
1 year ago
sc-product-item-image_3.entry.js
1 year ago
sc-product-item-image_3.entry.js.map
1 year ago
sc-product-item-list.entry.js
1 year ago
sc-product-item-list.entry.js.map
1 year ago
sc-product-item.entry.js
1 year ago
sc-product-item.entry.js.map
1 year ago
sc-product-line-item_2.entry.js
1 year ago
sc-product-line-item_2.entry.js.map
1 year ago
sc-product-pills-variant-option.entry.js
1 year ago
sc-product-pills-variant-option.entry.js.map
1 year ago
sc-product-price-choices.entry.js
1 year ago
sc-product-price-choices.entry.js.map
1 year ago
sc-product-price-modal.entry.js
1 year ago
sc-product-price-modal.entry.js.map
1 year ago
sc-product-price.entry.js
1 year ago
sc-product-price.entry.js.map
1 year ago
sc-product-quantity.entry.js
1 year ago
sc-product-quantity.entry.js.map
1 year ago
sc-product-selected-price.entry.js
1 year ago
sc-product-selected-price.entry.js.map
1 year ago
sc-product-text.entry.js
1 year ago
sc-product-text.entry.js.map
1 year ago
sc-provider.entry.js
1 year ago
sc-provider.entry.js.map
1 year ago
sc-provisional-banner.entry.js
1 year ago
sc-provisional-banner.entry.js.map
1 year ago
sc-purchase-downloads-list.entry.js
1 year ago
sc-purchase-downloads-list.entry.js.map
1 year ago
sc-recurring-price-choice-container.entry.js
1 year ago
sc-recurring-price-choice-container.entry.js.map
1 year ago
sc-rich-text.entry.js
1 year ago
sc-rich-text.entry.js.map
1 year ago
sc-spacing.entry.js
1 year ago
sc-spacing.entry.js.map
1 year ago
sc-stacked-list_2.entry.js
1 year ago
sc-stacked-list_2.entry.js.map
1 year ago
sc-stripe-add-method.entry.js
1 year ago
sc-stripe-add-method.entry.js.map
1 year ago
sc-stripe-element.entry.js
1 year ago
sc-stripe-element.entry.js.map
1 year ago
sc-stripe-payment-element.entry.js
1 year ago
sc-stripe-payment-element.entry.js.map
1 year ago
sc-stripe-payment-request.entry.js
1 year ago
sc-stripe-payment-request.entry.js.map
1 year ago
sc-subscription-ad-hoc-confirm.entry.js
1 year ago
sc-subscription-ad-hoc-confirm.entry.js.map
1 year ago
sc-subscription-details_2.entry.js
1 year ago
sc-subscription-details_2.entry.js.map
1 year ago
sc-subscription-payment-method.entry.js
1 year ago
sc-subscription-payment-method.entry.js.map
1 year ago
sc-subscription-payment.entry.js
1 year ago
sc-subscription-payment.entry.js.map
1 year ago
sc-subscription-switch.entry.js
1 year ago
sc-subscription-switch.entry.js.map
1 year ago
sc-subscription-variation-confirm.entry.js
1 year ago
sc-subscription-variation-confirm.entry.js.map
1 year ago
sc-subscription.entry.js
1 year ago
sc-subscription.entry.js.map
1 year ago
sc-subscriptions-list.entry.js
1 year ago
sc-subscriptions-list.entry.js.map
1 year ago
sc-summary.entry.js
1 year ago
sc-summary.entry.js.map
1 year ago
sc-switch.entry.js
1 year ago
sc-switch.entry.js.map
1 year ago
sc-tab-group.entry.js
1 year ago
sc-tab-group.entry.js.map
1 year ago
sc-tab-panel.entry.js
1 year ago
sc-tab-panel.entry.js.map
1 year ago
sc-tab.entry.js
1 year ago
sc-tab.entry.js.map
1 year ago
sc-table-head.entry.js
1 year ago
sc-table-head.entry.js.map
1 year ago
sc-table_3.entry.js
1 year ago
sc-table_3.entry.js.map
1 year ago
sc-tag.entry.js
1 year ago
sc-tag.entry.js.map
1 year ago
sc-toggle.entry.js
1 year ago
sc-toggle.entry.js.map
1 year ago
sc-toggles.entry.js
1 year ago
sc-toggles.entry.js.map
1 year ago
sc-total.entry.js
1 year ago
sc-total.entry.js.map
1 year ago
sc-upcoming-invoice.entry.js
1 year ago
sc-upcoming-invoice.entry.js.map
1 year ago
sc-upgrade-required.entry.js
1 year ago
sc-upgrade-required.entry.js.map
1 year ago
sc-upsell-countdown-timer.entry.js
1 year ago
sc-upsell-countdown-timer.entry.js.map
1 year ago
sc-upsell-no-thanks-button.entry.js
1 year ago
sc-upsell-no-thanks-button.entry.js.map
1 year ago
sc-upsell-submit-button.entry.js
1 year ago
sc-upsell-submit-button.entry.js.map
1 year ago
sc-upsell-totals.entry.js
1 year ago
sc-upsell-totals.entry.js.map
1 year ago
sc-upsell.entry.js
1 year ago
sc-upsell.entry.js.map
1 year ago
sc-visually-hidden.entry.js
1 year ago
sc-visually-hidden.entry.js.map
1 year ago
sc-wordpress-password-edit.entry.js
1 year ago
sc-wordpress-password-edit.entry.js.map
1 year ago
sc-wordpress-user-edit.entry.js
1 year ago
sc-wordpress-user-edit.entry.js.map
1 year ago
sc-wordpress-user.entry.js
1 year ago
sc-wordpress-user.entry.js.map
1 year ago
store-093f0f6a.js
1 year ago
store-093f0f6a.js.map
1 year ago
store-a8bae355.js
1 year ago
store-a8bae355.js.map
1 year ago
store-dcefd119.js
1 year ago
store-dcefd119.js.map
1 year ago
surecart.js
1 year ago
surecart.js.map
1 year ago
tax-d4911dbc.js
1 year ago
tax-d4911dbc.js.map
1 year ago
universe-5a73abb7.js
1 year ago
universe-5a73abb7.js.map
1 year ago
util-50af2a83.js
1 year ago
util-50af2a83.js.map
1 year ago
utils-e9ee502a.js
1 year ago
utils-e9ee502a.js.map
1 year ago
watchers-38693c1f.js
1 year ago
watchers-38693c1f.js.map
1 year ago
watchers-4d2edfb0.js
1 year ago
watchers-4d2edfb0.js.map
1 year ago
watchers-4e5b728a.js
1 year ago
watchers-4e5b728a.js.map
1 year ago
watchers-67501779.js
1 year ago
watchers-67501779.js.map
1 year ago
watchers-a697b0c8.js
1 year ago
watchers-a697b0c8.js.map
1 year ago
sc-cart-session-provider_3.entry.js
344 lines
| 1 | import { r as registerInstance, c as createEvent, h, a as getElement } from './index-745b6bec.js'; |
| 2 | import { s as state } from './mutations-066b82f0.js'; |
| 3 | import { d as updateCheckout } from './index-675be13e.js'; |
| 4 | import { r as removeNotice, c as createErrorNotice, s as state$1 } from './mutations-ed6d0770.js'; |
| 5 | import { u as updateFormState } from './mutations-e77bd122.js'; |
| 6 | import { c as clearCheckout } from './mutations-f11a19f9.js'; |
| 7 | import { s as setDefaultAnimation, g as getAnimation, a as animateTo, b as stopAnimations } from './animation-registry-12eed2e3.js'; |
| 8 | import { g as getAdditionalErrorMessages } from './getters-a7eec27c.js'; |
| 9 | import './index-06061d4e.js'; |
| 10 | import './utils-e9ee502a.js'; |
| 11 | import './remove-query-args-938c53ea.js'; |
| 12 | import './add-query-args-0e2a8393.js'; |
| 13 | import './index-c5a96d53.js'; |
| 14 | import './google-a86aa761.js'; |
| 15 | import './currency-a0c9bff4.js'; |
| 16 | import './price-d5770168.js'; |
| 17 | import './fetch-e3c5d1b9.js'; |
| 18 | import './store-093f0f6a.js'; |
| 19 | |
| 20 | const ScCartSessionProvider = class { |
| 21 | constructor(hostRef) { |
| 22 | registerInstance(this, hostRef); |
| 23 | this.scSetState = createEvent(this, "scSetState", 7); |
| 24 | } |
| 25 | handleUpdateSession(e) { |
| 26 | const { data, options } = e.detail; |
| 27 | if (options === null || options === void 0 ? void 0 : options.silent) { |
| 28 | this.update(data); |
| 29 | } |
| 30 | else { |
| 31 | this.loadUpdate(data); |
| 32 | } |
| 33 | } |
| 34 | /** Handles coupon updates. */ |
| 35 | async handleCouponApply(e) { |
| 36 | const promotion_code = e.detail; |
| 37 | removeNotice(); |
| 38 | this.loadUpdate({ |
| 39 | discount: { |
| 40 | ...(promotion_code ? { promotion_code } : {}), |
| 41 | }, |
| 42 | }); |
| 43 | } |
| 44 | /** Handle the error response. */ |
| 45 | handleErrorResponse(e) { |
| 46 | var _a, _b; |
| 47 | if ((e === null || e === void 0 ? void 0 : e.code) === 'readonly' || ((_b = (_a = e === null || e === void 0 ? void 0 : e.additional_errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code) === 'checkout.customer.account_mismatch') { |
| 48 | clearCheckout(); |
| 49 | } |
| 50 | // expired |
| 51 | if ((e === null || e === void 0 ? void 0 : e.code) === 'rest_cookie_invalid_nonce') { |
| 52 | updateFormState('EXPIRE'); |
| 53 | return; |
| 54 | } |
| 55 | // something went wrong |
| 56 | if (e === null || e === void 0 ? void 0 : e.message) { |
| 57 | createErrorNotice(e); |
| 58 | } |
| 59 | // handle curl timeout errors. |
| 60 | if ((e === null || e === void 0 ? void 0 : e.code) === 'http_request_failed') { |
| 61 | createErrorNotice(wp.i18n.__('Something went wrong. Please reload the page and try again.', 'surecart')); |
| 62 | } |
| 63 | } |
| 64 | /** Fetch a session. */ |
| 65 | async fetch(args = {}) { |
| 66 | this.loadUpdate({ status: 'draft', ...args }); |
| 67 | } |
| 68 | /** Update a the order */ |
| 69 | async update(data = {}, query = {}) { |
| 70 | var _a; |
| 71 | try { |
| 72 | state.checkout = (await updateCheckout({ |
| 73 | id: (_a = state.checkout) === null || _a === void 0 ? void 0 : _a.id, |
| 74 | data: { |
| 75 | ...data, |
| 76 | }, |
| 77 | query: { |
| 78 | ...query, |
| 79 | }, |
| 80 | })); |
| 81 | } |
| 82 | catch (e) { |
| 83 | console.error(e); |
| 84 | throw e; |
| 85 | } |
| 86 | } |
| 87 | /** Updates a session with loading status changes. */ |
| 88 | async loadUpdate(data = {}) { |
| 89 | try { |
| 90 | updateFormState('FETCH'); |
| 91 | await this.update(data); |
| 92 | updateFormState('RESOLVE'); |
| 93 | } |
| 94 | catch (e) { |
| 95 | updateFormState('REJECT'); |
| 96 | this.handleErrorResponse(e); |
| 97 | } |
| 98 | } |
| 99 | render() { |
| 100 | return (h("sc-line-items-provider", { key: '6b28d1bb6ccf498616b5427ee090a6a64fde4ed5', order: state.checkout, onScUpdateLineItems: e => this.loadUpdate({ line_items: e.detail }) }, h("slot", { key: 'bf82aed971f820ab1b9c38d1b85178c5d1291ecd' }))); |
| 101 | } |
| 102 | get el() { return getElement(this); } |
| 103 | }; |
| 104 | |
| 105 | const scDrawerCss = ":host{display:contents}.drawer{top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;font-family:var(--sc-font-sans);font-weight:var(--sc-font-weight-normal)}.drawer--contained{position:absolute;z-index:initial}.drawer--fixed{position:fixed;z-index:var(--sc-z-index-drawer)}.drawer__panel{position:absolute;display:flex;flex-direction:column;z-index:2;max-width:100%;max-height:100%;background-color:var(--sc-panel-background-color);box-shadow:var(--sc-shadow-x-large);transition:var(--sc-transition-medium) transform;overflow:auto;pointer-events:all}.drawer__panel:focus{outline:none}.drawer--top .drawer__panel{top:0;right:auto;bottom:auto;left:0;width:100%;height:var(--sc-drawer-size, 400px)}.drawer--end .drawer__panel{top:0;right:0;bottom:auto;left:auto;width:100%;max-width:var(--sc-drawer-size, 400px);height:100%}.drawer--bottom .drawer__panel{top:auto;right:auto;bottom:0;left:0;width:100%;height:var(--sc-drawer-size, 400px)}.drawer--start .drawer__panel{top:0;right:auto;bottom:auto;left:0;width:var(--sc-drawer-size, 400px);height:100%}.header__sticky{position:sticky;top:0;z-index:10;background:#fff}.drawer__header{display:flex;align-items:center;padding:var(--sc-drawer-header-spacing);border-bottom:var(--sc-drawer-border)}.drawer__title{flex:1 1 auto;font:inherit;font-size:var(--sc-font-size-large);line-height:var(--sc-line-height-dense);margin:0}.drawer__close{flex:0 0 auto;display:flex;align-items:center;font-size:var(--sc-font-size-x-large);color:var(--sc-color-gray-500);cursor:pointer}.drawer__body{flex:1 1 auto}.drawer--has-footer .drawer__footer{border-top:var(--sc-drawer-border);padding:var(--sc-drawer-footer-spacing)}.drawer__overlay{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--sc-overlay-background-color);pointer-events:all}.drawer--contained .drawer__overlay{position:absolute}"; |
| 106 | const ScDrawerStyle0 = scDrawerCss; |
| 107 | |
| 108 | const ScDrawer = class { |
| 109 | constructor(hostRef) { |
| 110 | registerInstance(this, hostRef); |
| 111 | this.scInitialFocus = createEvent(this, "scInitialFocus", 7); |
| 112 | this.scRequestClose = createEvent(this, "scRequestClose", 7); |
| 113 | this.scShow = createEvent(this, "scShow", 7); |
| 114 | this.scHide = createEvent(this, "scHide", 7); |
| 115 | this.scAfterShow = createEvent(this, "scAfterShow", 7); |
| 116 | this.scAfterHide = createEvent(this, "scAfterHide", 7); |
| 117 | this.open = false; |
| 118 | this.label = ''; |
| 119 | this.placement = 'end'; |
| 120 | this.contained = false; |
| 121 | this.noHeader = false; |
| 122 | this.stickyHeader = false; |
| 123 | } |
| 124 | componentDidLoad() { |
| 125 | this.drawer.hidden = !this.open; |
| 126 | if (this.open && !this.contained) { |
| 127 | this.lockBodyScrolling(); |
| 128 | } |
| 129 | this.handleOpenChange(); |
| 130 | } |
| 131 | disconnectedCallback() { |
| 132 | this.unLockBodyScrolling(); |
| 133 | } |
| 134 | lockBodyScrolling() { |
| 135 | document.body.classList.add('sc-scroll-lock'); |
| 136 | } |
| 137 | unLockBodyScrolling() { |
| 138 | document.body.classList.remove('sc-scroll-lock'); |
| 139 | } |
| 140 | /** Shows the drawer. */ |
| 141 | async show() { |
| 142 | if (this.open) { |
| 143 | return undefined; |
| 144 | } |
| 145 | this.open = true; |
| 146 | } |
| 147 | /** Hides the drawer */ |
| 148 | async hide() { |
| 149 | if (!this.open) { |
| 150 | return undefined; |
| 151 | } |
| 152 | this.open = false; |
| 153 | } |
| 154 | async requestClose(source = 'method') { |
| 155 | const slRequestClose = this.scRequestClose.emit(source); |
| 156 | if (slRequestClose.defaultPrevented) { |
| 157 | const animation = getAnimation(this.el, 'drawer.denyClose'); |
| 158 | animateTo(this.panel, animation.keyframes, animation.options); |
| 159 | return; |
| 160 | } |
| 161 | this.hide(); |
| 162 | } |
| 163 | handleKeyDown(event) { |
| 164 | if (event.key === 'Escape') { |
| 165 | event.stopPropagation(); |
| 166 | this.requestClose('keyboard'); |
| 167 | } |
| 168 | } |
| 169 | async handleOpenChange() { |
| 170 | if (this.open) { |
| 171 | this.scShow.emit(); |
| 172 | this.originalTrigger = document.activeElement; |
| 173 | // Lock body scrolling only if the drawer isn't contained |
| 174 | if (!this.contained) { |
| 175 | this.lockBodyScrolling(); |
| 176 | } |
| 177 | // When the drawer is shown, Safari will attempt to set focus on whatever element has autofocus. This causes the |
| 178 | // drawer's animation to jitter, so we'll temporarily remove the attribute, call `focus({ preventScroll: true })` |
| 179 | // ourselves, and add the attribute back afterwards. |
| 180 | // |
| 181 | // Related: https://github.com/shoelace-style/shoelace/issues/693 |
| 182 | // |
| 183 | const autoFocusTarget = this.el.querySelector('[autofocus]'); |
| 184 | if (autoFocusTarget) { |
| 185 | autoFocusTarget.removeAttribute('autofocus'); |
| 186 | } |
| 187 | await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]); |
| 188 | this.drawer.hidden = false; |
| 189 | // Set initial focus |
| 190 | requestAnimationFrame(() => { |
| 191 | const slInitialFocus = this.scInitialFocus.emit(); |
| 192 | if (!slInitialFocus.defaultPrevented) { |
| 193 | // Set focus to the autofocus target and restore the attribute |
| 194 | if (autoFocusTarget) { |
| 195 | autoFocusTarget.focus({ preventScroll: true }); |
| 196 | } |
| 197 | else { |
| 198 | this.panel.focus({ preventScroll: true }); |
| 199 | } |
| 200 | } |
| 201 | // Restore the autofocus attribute |
| 202 | if (autoFocusTarget) { |
| 203 | autoFocusTarget.setAttribute('autofocus', ''); |
| 204 | } |
| 205 | }); |
| 206 | const panelAnimation = getAnimation(this.el, `drawer.show${this.placement.charAt(0).toUpperCase() + this.placement.slice(1)}`); |
| 207 | const overlayAnimation = getAnimation(this.el, 'drawer.overlay.show'); |
| 208 | await Promise.all([animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options), animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)]); |
| 209 | this.scAfterShow.emit(); |
| 210 | } |
| 211 | else { |
| 212 | // Hide |
| 213 | this.scHide.emit(); |
| 214 | this.unLockBodyScrolling(); |
| 215 | await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]); |
| 216 | const panelAnimation = getAnimation(this.el, `drawer.hide${this.placement.charAt(0).toUpperCase() + this.placement.slice(1)}`); |
| 217 | const overlayAnimation = getAnimation(this.el, 'drawer.overlay.hide'); |
| 218 | await Promise.all([animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options), animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)]); |
| 219 | this.drawer.hidden = true; |
| 220 | // Restore focus to the original trigger |
| 221 | const trigger = this.originalTrigger; |
| 222 | if (typeof (trigger === null || trigger === void 0 ? void 0 : trigger.focus) === 'function') { |
| 223 | setTimeout(() => trigger.focus()); |
| 224 | } |
| 225 | this.scAfterHide.emit(); |
| 226 | } |
| 227 | } |
| 228 | render() { |
| 229 | return (h("div", { key: 'b7f23fabf227bee78dcd817459643d74d0155b8a', part: "base", class: { |
| 230 | 'drawer': true, |
| 231 | 'drawer--open': this.open, |
| 232 | 'drawer--top': this.placement === 'top', |
| 233 | 'drawer--end': this.placement === 'end', |
| 234 | 'drawer--bottom': this.placement === 'bottom', |
| 235 | 'drawer--start': this.placement === 'start', |
| 236 | 'drawer--contained': this.contained, |
| 237 | 'drawer--fixed': !this.contained, |
| 238 | 'drawer--has-footer': this.el.querySelector('[slot="footer"]') !== null, |
| 239 | }, ref: el => (this.drawer = el), onKeyDown: (e) => this.handleKeyDown(e) }, h("div", { key: '857b898c773b388132e6506c6937467607d09547', part: "overlay", class: "drawer__overlay", onClick: () => this.requestClose('overlay'), tabindex: "-1", ref: el => (this.overlay = el) }), h("div", { key: '38f1abbb28e9198f39f3c9212eb1488e6e6ce104', part: "panel", class: "drawer__panel", role: "dialog", "aria-modal": "true", "aria-hidden": this.open ? 'false' : 'true', "aria-label": this.noHeader ? this.label : undefined, "aria-labelledby": !this.noHeader ? 'title' : undefined, tabindex: "0", ref: el => (this.panel = el) }, !this.noHeader && (h("header", { key: '7da7a547dc4948cbc656e48a4a4cb32ceaa03aa8', part: "header", class: this.stickyHeader ? 'header__sticky' : '' }, h("slot", { key: 'dc0a464a0d0f6a37d2acfb113af777bc456fad2d', name: "header" }, h("div", { key: '1a1c3cc596117ee36f7883764533ebe20e62f0b6', class: "drawer__header" }, h("h2", { key: 'bfba1d8bf8040750296f95d032c49cf7c8b924b1', part: "title", class: "drawer__title", id: "title" }, h("slot", { key: '4697b287f0470b4d580bfc222bf2980c90ea015d', name: "label" }, this.label.length > 0 ? this.label : ' ', " ")), h("sc-icon", { key: 'f728117540ac786819b423691253a623fc92f975', part: "close-button", exportparts: "base:close-button__base", class: "drawer__close", name: "x", label: |
| 240 | /** translators: Close this modal window. */ |
| 241 | wp.i18n.__('Close', 'surecart'), onClick: () => this.requestClose('close-button') }))))), h("footer", { key: 'd202f04809e4e04441e51d20f57e33c1ff04b300', part: "header-suffix", class: "drawer__header-suffix" }, h("slot", { key: '46ac0d311d39f7f8c208bf50d71c5d34ea8eb213', name: "header-suffix" })), h("div", { key: 'c788424948eab2e705044fb8f999bc1098614464', part: "body", class: "drawer__body" }, h("slot", { key: '31d26ecc0c330699a1e98674e830b4af7e28cfe5' })), h("footer", { key: '13833bc35d6617cca922718710b6c1f1f5b5d315', part: "footer", class: "drawer__footer" }, h("slot", { key: '31cf189900de539d8027be0266a0af7c797c8b53', name: "footer" }))))); |
| 242 | } |
| 243 | get el() { return getElement(this); } |
| 244 | static get watchers() { return { |
| 245 | "open": ["handleOpenChange"] |
| 246 | }; } |
| 247 | }; |
| 248 | // Top |
| 249 | setDefaultAnimation('drawer.showTop', { |
| 250 | keyframes: [ |
| 251 | { opacity: 0, transform: 'translateY(-100%)' }, |
| 252 | { opacity: 1, transform: 'translateY(0)' }, |
| 253 | ], |
| 254 | options: { duration: 250, easing: 'ease' }, |
| 255 | }); |
| 256 | setDefaultAnimation('drawer.hideTop', { |
| 257 | keyframes: [ |
| 258 | { opacity: 1, transform: 'translateY(0)' }, |
| 259 | { opacity: 0, transform: 'translateY(-100%)' }, |
| 260 | ], |
| 261 | options: { duration: 250, easing: 'ease' }, |
| 262 | }); |
| 263 | // End |
| 264 | setDefaultAnimation('drawer.showEnd', { |
| 265 | keyframes: [ |
| 266 | { opacity: 0, transform: 'translateX(100%)' }, |
| 267 | { opacity: 1, transform: 'translateX(0)' }, |
| 268 | ], |
| 269 | options: { duration: 250, easing: 'ease' }, |
| 270 | }); |
| 271 | setDefaultAnimation('drawer.hideEnd', { |
| 272 | keyframes: [ |
| 273 | { opacity: 1, transform: 'translateX(0)' }, |
| 274 | { opacity: 0, transform: 'translateX(100%)' }, |
| 275 | ], |
| 276 | options: { duration: 250, easing: 'ease' }, |
| 277 | }); |
| 278 | // Bottom |
| 279 | setDefaultAnimation('drawer.showBottom', { |
| 280 | keyframes: [ |
| 281 | { opacity: 0, transform: 'translateY(100%)' }, |
| 282 | { opacity: 1, transform: 'translateY(0)' }, |
| 283 | ], |
| 284 | options: { duration: 250, easing: 'ease' }, |
| 285 | }); |
| 286 | setDefaultAnimation('drawer.hideBottom', { |
| 287 | keyframes: [ |
| 288 | { opacity: 1, transform: 'translateY(0)' }, |
| 289 | { opacity: 0, transform: 'translateY(100%)' }, |
| 290 | ], |
| 291 | options: { duration: 250, easing: 'ease' }, |
| 292 | }); |
| 293 | // Start |
| 294 | setDefaultAnimation('drawer.showStart', { |
| 295 | keyframes: [ |
| 296 | { opacity: 0, transform: 'translateX(-100%)' }, |
| 297 | { opacity: 1, transform: 'translateX(0)' }, |
| 298 | ], |
| 299 | options: { duration: 250, easing: 'ease' }, |
| 300 | }); |
| 301 | setDefaultAnimation('drawer.hideStart', { |
| 302 | keyframes: [ |
| 303 | { opacity: 1, transform: 'translateX(0)' }, |
| 304 | { opacity: 0, transform: 'translateX(-100%)' }, |
| 305 | ], |
| 306 | options: { duration: 250, easing: 'ease' }, |
| 307 | }); |
| 308 | // Deny close |
| 309 | setDefaultAnimation('drawer.denyClose', { |
| 310 | keyframes: [{ transform: 'scale(1)' }, { transform: 'scale(1.01)' }, { transform: 'scale(1)' }], |
| 311 | options: { duration: 250 }, |
| 312 | }); |
| 313 | // Overlay |
| 314 | setDefaultAnimation('drawer.overlay.show', { |
| 315 | keyframes: [{ opacity: 0 }, { opacity: 1 }], |
| 316 | options: { duration: 250, easing: 'ease' }, |
| 317 | }); |
| 318 | setDefaultAnimation('drawer.overlay.hide', { |
| 319 | keyframes: [{ opacity: 1 }, { opacity: 0 }], |
| 320 | options: { duration: 250, easing: 'ease' }, |
| 321 | }); |
| 322 | ScDrawer.style = ScDrawerStyle0; |
| 323 | |
| 324 | const ScFormErrorProvider = class { |
| 325 | constructor(hostRef) { |
| 326 | registerInstance(this, hostRef); |
| 327 | this.scUpdateError = createEvent(this, "scUpdateError", 7); |
| 328 | this.error = undefined; |
| 329 | } |
| 330 | /** Trigger the error event when an error happens */ |
| 331 | handleErrorUpdate(val) { |
| 332 | this.scUpdateError.emit(val); |
| 333 | } |
| 334 | render() { |
| 335 | return !!(state$1 === null || state$1 === void 0 ? void 0 : state$1.message) ? (h("sc-alert", { exportparts: "base, icon, text, title, message, close", type: "danger", scrollOnOpen: true, open: !!(state$1 === null || state$1 === void 0 ? void 0 : state$1.message), closable: !!(state$1 === null || state$1 === void 0 ? void 0 : state$1.dismissible) }, (state$1 === null || state$1 === void 0 ? void 0 : state$1.message) && h("span", { slot: "title", innerHTML: state$1.message }), (getAdditionalErrorMessages() || []).map((message, index) => (h("div", { innerHTML: message, key: index }))))) : null; |
| 336 | } |
| 337 | static get watchers() { return { |
| 338 | "error": ["handleErrorUpdate"] |
| 339 | }; } |
| 340 | }; |
| 341 | |
| 342 | export { ScCartSessionProvider as sc_cart_session_provider, ScDrawer as sc_drawer, ScFormErrorProvider as sc_error }; |
| 343 | |
| 344 | //# sourceMappingURL=sc-cart-session-provider_3.entry.js.map |