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-stripe-payment-element.entry.js
309 lines
| 1 | import { r as registerInstance, c as createEvent, h, a as getElement } from './index-745b6bec.js'; |
| 2 | import { p as pure } from './pure-963214cb.js'; |
| 3 | import { s as state$2 } from './watchers-38693c1f.js'; |
| 4 | import { o as onChange, s as state$1 } from './mutations-066b82f0.js'; |
| 5 | import { o as onChange$1 } from './store-093f0f6a.js'; |
| 6 | import './watchers-4e5b728a.js'; |
| 7 | import { g as getProcessorByType, s as state } from './getters-26526b7c.js'; |
| 8 | import { c as currentFormState } from './getters-09dda855.js'; |
| 9 | import { c as createErrorNotice } from './mutations-ed6d0770.js'; |
| 10 | import { u as updateFormState } from './mutations-e77bd122.js'; |
| 11 | import { b as getCompleteAddress } from './getters-1a55b8a4.js'; |
| 12 | import { a as addQueryArgs } from './add-query-args-0e2a8393.js'; |
| 13 | import './index-06061d4e.js'; |
| 14 | import './utils-e9ee502a.js'; |
| 15 | import './remove-query-args-938c53ea.js'; |
| 16 | import './index-c5a96d53.js'; |
| 17 | import './google-a86aa761.js'; |
| 18 | import './currency-a0c9bff4.js'; |
| 19 | import './price-d5770168.js'; |
| 20 | import './util-50af2a83.js'; |
| 21 | import './address-b892540d.js'; |
| 22 | |
| 23 | const scStripePaymentElementCss = "sc-stripe-payment-element{display:block}sc-stripe-payment-element [hidden]{display:none}.loader{display:grid;height:128px;gap:2em}.loader__row{display:flex;align-items:flex-start;justify-content:space-between;gap:1em}.loader__details{display:grid;gap:0.5em}"; |
| 24 | const ScStripePaymentElementStyle0 = scStripePaymentElementCss; |
| 25 | |
| 26 | const ScStripePaymentElement = class { |
| 27 | constructor(hostRef) { |
| 28 | registerInstance(this, hostRef); |
| 29 | this.scPaid = createEvent(this, "scPaid", 7); |
| 30 | this.scSetState = createEvent(this, "scSetState", 7); |
| 31 | this.scPaymentInfoAdded = createEvent(this, "scPaymentInfoAdded", 7); |
| 32 | this.error = undefined; |
| 33 | this.confirming = false; |
| 34 | this.loaded = false; |
| 35 | this.styles = undefined; |
| 36 | } |
| 37 | async componentWillLoad() { |
| 38 | this.fetchStyles(); |
| 39 | } |
| 40 | async handleStylesChange() { |
| 41 | this.createOrUpdateElements(); |
| 42 | } |
| 43 | async fetchStyles() { |
| 44 | this.styles = (await this.getComputedStyles()); |
| 45 | } |
| 46 | /** |
| 47 | * We wait for our property value to resolve (styles have been loaded) |
| 48 | * This prevents the element appearance api being set before the styles are loaded. |
| 49 | */ |
| 50 | getComputedStyles() { |
| 51 | return new Promise(resolve => { |
| 52 | let checkInterval = setInterval(() => { |
| 53 | const styles = window.getComputedStyle(document.body); |
| 54 | const color = styles.getPropertyValue('--sc-color-primary-500'); |
| 55 | if (color) { |
| 56 | clearInterval(checkInterval); |
| 57 | resolve(styles); |
| 58 | } |
| 59 | }, 100); |
| 60 | }); |
| 61 | } |
| 62 | /** Maybe load the stripe element on load. */ |
| 63 | async componentDidLoad() { |
| 64 | const { processor_data } = getProcessorByType('stripe') || {}; |
| 65 | try { |
| 66 | state.instances.stripe = await pure.loadStripe(processor_data === null || processor_data === void 0 ? void 0 : processor_data.publishable_key, { stripeAccount: processor_data === null || processor_data === void 0 ? void 0 : processor_data.account_id }); |
| 67 | } |
| 68 | catch (e) { |
| 69 | this.error = (e === null || e === void 0 ? void 0 : e.message) || wp.i18n.__('Stripe could not be loaded', 'surecart'); |
| 70 | // don't continue. |
| 71 | return; |
| 72 | } |
| 73 | // create or update elements. |
| 74 | this.createOrUpdateElements(); |
| 75 | this.handleUpdateElement(); |
| 76 | this.unlistenToCheckout = onChange('checkout', () => { |
| 77 | this.fetchStyles(); |
| 78 | this.createOrUpdateElements(); |
| 79 | this.handleUpdateElement(); |
| 80 | }); |
| 81 | // we need to listen to the form state and pay when the form state enters the paying state. |
| 82 | this.unlistenToFormState = onChange$1('formState', () => { |
| 83 | var _a; |
| 84 | if (!((_a = state$1 === null || state$1 === void 0 ? void 0 : state$1.checkout) === null || _a === void 0 ? void 0 : _a.payment_method_required)) |
| 85 | return; |
| 86 | if ('paying' === currentFormState()) { |
| 87 | this.maybeConfirmOrder(); |
| 88 | } |
| 89 | }); |
| 90 | } |
| 91 | disconnectedCallback() { |
| 92 | this.unlistenToFormState(); |
| 93 | this.unlistenToCheckout(); |
| 94 | } |
| 95 | getElementsConfig() { |
| 96 | var _a, _b, _c, _d; |
| 97 | const styles = getComputedStyle(this.el); |
| 98 | return { |
| 99 | mode: ((_a = state$1.checkout) === null || _a === void 0 ? void 0 : _a.remaining_amount_due) > 0 ? 'payment' : 'setup', |
| 100 | amount: (_b = state$1.checkout) === null || _b === void 0 ? void 0 : _b.amount_due, |
| 101 | currency: (_c = state$1.checkout) === null || _c === void 0 ? void 0 : _c.currency, |
| 102 | setupFutureUsage: ((_d = state$1.checkout) === null || _d === void 0 ? void 0 : _d.reusable_payment_method_required) ? 'off_session' : null, |
| 103 | appearance: { |
| 104 | variables: { |
| 105 | colorPrimary: styles.getPropertyValue('--sc-color-primary-500') || 'black', |
| 106 | colorText: styles.getPropertyValue('--sc-input-label-color') || 'black', |
| 107 | borderRadius: styles.getPropertyValue('--sc-input-border-radius-medium') || '4px', |
| 108 | colorBackground: styles.getPropertyValue('--sc-input-background-color') || 'white', |
| 109 | fontSizeBase: styles.getPropertyValue('--sc-input-font-size-medium') || '16px', |
| 110 | colorLogo: styles.getPropertyValue('--sc-stripe-color-logo') || 'light', |
| 111 | colorLogoTab: styles.getPropertyValue('--sc-stripe-color-logo-tab') || 'light', |
| 112 | colorLogoTabSelected: styles.getPropertyValue('--sc-stripe-color-logo-tab-selected') || 'light', |
| 113 | colorTextPlaceholder: styles.getPropertyValue('--sc-input-placeholder-color') || 'black', |
| 114 | }, |
| 115 | rules: { |
| 116 | '.Input': { |
| 117 | border: styles.getPropertyValue('--sc-input-border'), |
| 118 | }, |
| 119 | }, |
| 120 | }, |
| 121 | }; |
| 122 | } |
| 123 | /** Update the payment element mode, amount and currency when it changes. */ |
| 124 | createOrUpdateElements() { |
| 125 | var _a, _b, _c; |
| 126 | // need an order amount, etc. |
| 127 | if (!((_a = state$1 === null || state$1 === void 0 ? void 0 : state$1.checkout) === null || _a === void 0 ? void 0 : _a.payment_method_required)) |
| 128 | return; |
| 129 | if (!state.instances.stripe) |
| 130 | return; |
| 131 | // create the elements if they have not yet been created. |
| 132 | if (!state.instances.stripeElements) { |
| 133 | // we have what we need, load elements. |
| 134 | state.instances.stripeElements = state.instances.stripe.elements(this.getElementsConfig()); |
| 135 | const address = getCompleteAddress('shipping'); |
| 136 | // create the payment element. |
| 137 | state.instances.stripeElements |
| 138 | .create('payment', { |
| 139 | defaultValues: { |
| 140 | billingDetails: { |
| 141 | name: (_b = state$1.checkout) === null || _b === void 0 ? void 0 : _b.name, |
| 142 | email: (_c = state$1.checkout) === null || _c === void 0 ? void 0 : _c.email, |
| 143 | ...(!!address ? { address } : {}), |
| 144 | }, |
| 145 | }, |
| 146 | fields: { |
| 147 | billingDetails: { |
| 148 | email: 'never', |
| 149 | }, |
| 150 | }, |
| 151 | }) |
| 152 | .mount(this.container); |
| 153 | this.element = state.instances.stripeElements.getElement('payment'); |
| 154 | this.element.on('ready', () => (this.loaded = true)); |
| 155 | this.element.on('change', (event) => { |
| 156 | var _a, _b, _c, _d, _e, _f, _g; |
| 157 | const requiredShippingPaymentTypes = ['cashapp', 'klarna', 'clearpay']; |
| 158 | state$1.paymentMethodRequiresShipping = requiredShippingPaymentTypes.includes((_a = event === null || event === void 0 ? void 0 : event.value) === null || _a === void 0 ? void 0 : _a.type); |
| 159 | if (event.complete) { |
| 160 | this.scPaymentInfoAdded.emit({ |
| 161 | checkout_id: (_b = state$1.checkout) === null || _b === void 0 ? void 0 : _b.id, |
| 162 | currency: (_c = state$1.checkout) === null || _c === void 0 ? void 0 : _c.currency, |
| 163 | processor_type: 'stripe', |
| 164 | total_amount: (_d = state$1.checkout) === null || _d === void 0 ? void 0 : _d.total_amount, |
| 165 | line_items: (_e = state$1.checkout) === null || _e === void 0 ? void 0 : _e.line_items, |
| 166 | payment_method: { |
| 167 | billing_details: { |
| 168 | email: (_f = state$1.checkout) === null || _f === void 0 ? void 0 : _f.email, |
| 169 | name: (_g = state$1.checkout) === null || _g === void 0 ? void 0 : _g.name, |
| 170 | }, |
| 171 | }, |
| 172 | }); |
| 173 | } |
| 174 | }); |
| 175 | return; |
| 176 | } |
| 177 | state.instances.stripeElements.update(this.getElementsConfig()); |
| 178 | } |
| 179 | /** Update the default attributes of the element when they cahnge. */ |
| 180 | handleUpdateElement() { |
| 181 | var _a, _b; |
| 182 | if (!this.element) |
| 183 | return; |
| 184 | if (((_a = state$1.checkout) === null || _a === void 0 ? void 0 : _a.status) !== 'draft') |
| 185 | return; |
| 186 | const { name, email } = state$1.checkout; |
| 187 | const { line_1: line1, line_2: line2, city, state, country, postal_code } = ((_b = state$1.checkout) === null || _b === void 0 ? void 0 : _b.shipping_address) || {}; |
| 188 | this.element.update({ |
| 189 | defaultValues: { |
| 190 | billingDetails: { |
| 191 | name, |
| 192 | email, |
| 193 | address: { |
| 194 | line1, |
| 195 | line2, |
| 196 | city, |
| 197 | state, |
| 198 | country, |
| 199 | postal_code, |
| 200 | }, |
| 201 | }, |
| 202 | }, |
| 203 | fields: { |
| 204 | billingDetails: { |
| 205 | email: 'never', |
| 206 | }, |
| 207 | }, |
| 208 | }); |
| 209 | } |
| 210 | async submit() { |
| 211 | // this processor is not selected. |
| 212 | if ((state$2 === null || state$2 === void 0 ? void 0 : state$2.id) !== 'stripe') |
| 213 | return; |
| 214 | // submit the elements. |
| 215 | const { error } = await state.instances.stripeElements.submit(); |
| 216 | if (error) { |
| 217 | console.error({ error }); |
| 218 | updateFormState('REJECT'); |
| 219 | createErrorNotice(error); |
| 220 | this.error = error.message; |
| 221 | return; |
| 222 | } |
| 223 | } |
| 224 | /** |
| 225 | * Watch order status and maybe confirm the order. |
| 226 | */ |
| 227 | async maybeConfirmOrder() { |
| 228 | var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; |
| 229 | // this processor is not selected. |
| 230 | if ((state$2 === null || state$2 === void 0 ? void 0 : state$2.id) !== 'stripe') |
| 231 | return; |
| 232 | // must be a stripe session |
| 233 | if (((_b = (_a = state$1.checkout) === null || _a === void 0 ? void 0 : _a.payment_intent) === null || _b === void 0 ? void 0 : _b.processor_type) !== 'stripe') |
| 234 | return; |
| 235 | // need an external_type |
| 236 | if (!((_f = (_e = (_d = (_c = state$1.checkout) === null || _c === void 0 ? void 0 : _c.payment_intent) === null || _d === void 0 ? void 0 : _d.processor_data) === null || _e === void 0 ? void 0 : _e.stripe) === null || _f === void 0 ? void 0 : _f.type)) |
| 237 | return; |
| 238 | // we need a client secret. |
| 239 | if (!((_k = (_j = (_h = (_g = state$1.checkout) === null || _g === void 0 ? void 0 : _g.payment_intent) === null || _h === void 0 ? void 0 : _h.processor_data) === null || _j === void 0 ? void 0 : _j.stripe) === null || _k === void 0 ? void 0 : _k.client_secret)) |
| 240 | return; |
| 241 | // confirm the intent. |
| 242 | return await this.confirm((_p = (_o = (_m = (_l = state$1.checkout) === null || _l === void 0 ? void 0 : _l.payment_intent) === null || _m === void 0 ? void 0 : _m.processor_data) === null || _o === void 0 ? void 0 : _o.stripe) === null || _p === void 0 ? void 0 : _p.type); |
| 243 | } |
| 244 | async confirm(type, args = {}) { |
| 245 | var _a, _b, _c, _d; |
| 246 | const confirmArgs = { |
| 247 | elements: state.instances.stripeElements, |
| 248 | clientSecret: (_d = (_c = (_b = (_a = state$1.checkout) === null || _a === void 0 ? void 0 : _a.payment_intent) === null || _b === void 0 ? void 0 : _b.processor_data) === null || _c === void 0 ? void 0 : _c.stripe) === null || _d === void 0 ? void 0 : _d.client_secret, |
| 249 | confirmParams: { |
| 250 | return_url: addQueryArgs(window.location.href, { |
| 251 | ...(state$1.checkout.id ? { checkout_id: state$1.checkout.id } : {}), |
| 252 | }), |
| 253 | payment_method_data: { |
| 254 | billing_details: { |
| 255 | email: state$1.checkout.email, |
| 256 | }, |
| 257 | }, |
| 258 | }, |
| 259 | redirect: 'if_required', |
| 260 | ...args, |
| 261 | }; |
| 262 | // prevent possible double-charges |
| 263 | if (this.confirming) |
| 264 | return; |
| 265 | // stripe must be loaded. |
| 266 | if (!state.instances.stripe) |
| 267 | return; |
| 268 | try { |
| 269 | this.scSetState.emit('PAYING'); |
| 270 | const response = type === 'setup' ? await state.instances.stripe.confirmSetup(confirmArgs) : await state.instances.stripe.confirmPayment(confirmArgs); |
| 271 | if (response === null || response === void 0 ? void 0 : response.error) { |
| 272 | this.error = response.error.message; |
| 273 | throw response.error; |
| 274 | } |
| 275 | else { |
| 276 | this.scSetState.emit('PAID'); |
| 277 | // paid |
| 278 | this.scPaid.emit(); |
| 279 | } |
| 280 | } |
| 281 | catch (e) { |
| 282 | console.error(e); |
| 283 | updateFormState('REJECT'); |
| 284 | createErrorNotice(e); |
| 285 | if (e.message) { |
| 286 | this.error = e.message; |
| 287 | } |
| 288 | } |
| 289 | finally { |
| 290 | this.confirming = false; |
| 291 | } |
| 292 | } |
| 293 | render() { |
| 294 | return (h("div", { key: 'fedb7cc891a945f4ab52f016033471fb01e22439', class: "sc-stripe-payment-element", "data-testid": "stripe-payment-element" }, !!this.error && (h("sc-text", { key: '2a0179d8dbaf316143918c16385435aabdcbb7a4', style: { |
| 295 | 'color': 'var(--sc-color-danger-500)', |
| 296 | '--font-size': 'var(--sc-font-size-small)', |
| 297 | 'marginBottom': '0.5em', |
| 298 | } }, this.error)), h("div", { key: '9c3816cfbf5ac5fcb2da850137832d143c869179', class: "loader", hidden: this.loaded }, h("div", { key: '9bf6ed33ee50fb381bc8091bf68746d34c3a43d2', class: "loader__row" }, h("div", { key: '8f571de9e8e47fdbd4faa3ed20b716f24b6ea586', style: { width: '50%' } }, h("sc-skeleton", { key: '74ae313ed7280764f3d0fde7a17aa137346f0e4a', style: { width: '50%', marginBottom: '0.5em' } }), h("sc-skeleton", { key: 'b035f320bb0d5f1e901e3370580762b0a3c291bf' })), h("div", { key: '066e2771ed68e537c37e51fbc9ff050a7acd99ba', style: { flex: '1' } }, h("sc-skeleton", { key: 'b572a7498bfdc8b3289441060960fbf323f6b7d3', style: { width: '50%', marginBottom: '0.5em' } }), h("sc-skeleton", { key: 'fe9131a16793152cc808a849131a987aaed7677c' })), h("div", { key: 'c823c50265ec840a7d54cdeff1e6c947e7382bf8', style: { flex: '1' } }, h("sc-skeleton", { key: '3696b9b39844d52ab1fbb0f18a225408af482c4d', style: { width: '50%', marginBottom: '0.5em' } }), h("sc-skeleton", { key: 'da84327ef37672ae113e512797612cfde5b7257d' }))), h("div", { key: 'db8f384343f4500c6c4247960a2c7cab8b72e780', class: "loader__details" }, h("sc-skeleton", { key: '7205090d121fb6a1e9b3be0386d9601364a26a06', style: { height: '1rem' } }), h("sc-skeleton", { key: '659ccfbe52d2e9a90d14794ba4f786258e7399a7', style: { height: '1rem', width: '30%' } }))), h("div", { key: '5bfc083484da06c973779248b250ea3e739a11e3', hidden: !this.loaded, class: "sc-payment-element-container", ref: el => (this.container = el) }))); |
| 299 | } |
| 300 | get el() { return getElement(this); } |
| 301 | static get watchers() { return { |
| 302 | "styles": ["handleStylesChange"] |
| 303 | }; } |
| 304 | }; |
| 305 | ScStripePaymentElement.style = ScStripePaymentElementStyle0; |
| 306 | |
| 307 | export { ScStripePaymentElement as sc_stripe_payment_element }; |
| 308 | |
| 309 | //# sourceMappingURL=sc-stripe-payment-element.entry.js.map |