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-paypal-buttons_2.entry.js
205 lines
| 1 | import { r as registerInstance, c as createEvent, h, a as getElement } from './index-745b6bec.js'; |
| 2 | import { l as loadScript, g as getScriptLoadParams } from './functions-2a4a4ba3.js'; |
| 3 | import { a as apiFetch } from './fetch-e3c5d1b9.js'; |
| 4 | import { g as fetchCheckout } from './index-675be13e.js'; |
| 5 | import { c as createErrorNotice } from './mutations-ed6d0770.js'; |
| 6 | import './add-query-args-0e2a8393.js'; |
| 7 | import './remove-query-args-938c53ea.js'; |
| 8 | import './mutations-066b82f0.js'; |
| 9 | import './index-06061d4e.js'; |
| 10 | import './utils-e9ee502a.js'; |
| 11 | import './index-c5a96d53.js'; |
| 12 | import './google-a86aa761.js'; |
| 13 | import './currency-a0c9bff4.js'; |
| 14 | import './price-d5770168.js'; |
| 15 | |
| 16 | const paypalButtonsCss = ":host{display:block}.paypal-buttons{position:relative;line-height:0;text-align:center}.paypal-buttons:not(.paypal-buttons--busy):after{content:\" \";border-bottom:1px solid var(--sc-input-border-color);width:100%;height:0;top:50%;left:0;right:0;position:absolute}"; |
| 17 | const ScPaypalButtonsStyle0 = paypalButtonsCss; |
| 18 | |
| 19 | const ScPaypalButtons = class { |
| 20 | constructor(hostRef) { |
| 21 | registerInstance(this, hostRef); |
| 22 | this.scSetState = createEvent(this, "scSetState", 7); |
| 23 | this.scPaid = createEvent(this, "scPaid", 7); |
| 24 | this.clientId = undefined; |
| 25 | this.busy = false; |
| 26 | this.merchantId = undefined; |
| 27 | this.merchantInitiated = undefined; |
| 28 | this.mode = undefined; |
| 29 | this.order = undefined; |
| 30 | this.buttons = ['paypal', 'card']; |
| 31 | this.label = 'paypal'; |
| 32 | this.color = 'gold'; |
| 33 | this.loaded = undefined; |
| 34 | } |
| 35 | handleOrderChange(val, prev) { |
| 36 | if ((val === null || val === void 0 ? void 0 : val.updated_at) === (prev === null || prev === void 0 ? void 0 : prev.updated_at)) { |
| 37 | return; |
| 38 | } |
| 39 | this.cardContainer.innerHTML = ''; |
| 40 | this.paypalContainer.innerHTML = ''; |
| 41 | this.loadScript(); |
| 42 | } |
| 43 | /** Load the script */ |
| 44 | async loadScript() { |
| 45 | var _a, _b; |
| 46 | if (!this.clientId || !this.merchantId) |
| 47 | return; |
| 48 | try { |
| 49 | const paypal = await loadScript(getScriptLoadParams({ |
| 50 | clientId: this.clientId, |
| 51 | merchantId: this.merchantId, |
| 52 | merchantInitiated: this.merchantInitiated, |
| 53 | reusable: (_a = this.order) === null || _a === void 0 ? void 0 : _a.reusable_payment_method_required, |
| 54 | currency: (_b = this.order) === null || _b === void 0 ? void 0 : _b.currency, |
| 55 | })); |
| 56 | this.renderButtons(paypal); |
| 57 | } |
| 58 | catch (err) { |
| 59 | console.error('failed to load the PayPal JS SDK script', err); |
| 60 | } |
| 61 | } |
| 62 | /** Load the script on component load. */ |
| 63 | componentDidLoad() { |
| 64 | this.loadScript(); |
| 65 | } |
| 66 | /** Render the buttons. */ |
| 67 | renderButtons(paypal) { |
| 68 | const createFunc = this.order.reusable_payment_method_required ? 'createBillingAgreement' : 'createOrder'; |
| 69 | const config = { |
| 70 | /** |
| 71 | * Validate the form, client-side when the button is clicked. |
| 72 | */ |
| 73 | onClick: async (_, actions) => { |
| 74 | const form = this.el.closest('sc-checkout'); |
| 75 | const isValid = await form.validate(); |
| 76 | return isValid ? actions.resolve() : actions.reject(); |
| 77 | }, |
| 78 | onInit: () => { |
| 79 | this.loaded = true; |
| 80 | }, |
| 81 | onCancel: () => { |
| 82 | this.scSetState.emit('REJECT'); |
| 83 | }, |
| 84 | /** |
| 85 | * The transaction has been approved. |
| 86 | * We can capture it. |
| 87 | */ |
| 88 | onApprove: async () => { |
| 89 | var _a, _b, _c, _d; |
| 90 | try { |
| 91 | this.order = (await fetchCheckout({ id: (_a = this.order) === null || _a === void 0 ? void 0 : _a.id })); |
| 92 | } |
| 93 | catch (e) { |
| 94 | console.error(e); |
| 95 | createErrorNotice({ code: 'could_not_capture', message: wp.i18n.__('The payment did not process. Please try again.', 'surecart') }); |
| 96 | this.scSetState.emit('REJECT'); |
| 97 | } |
| 98 | try { |
| 99 | this.scSetState.emit('PAYING'); |
| 100 | const intent = (await apiFetch({ |
| 101 | method: 'PATCH', |
| 102 | path: `surecart/v1/payment_intents/${((_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.payment_intent) === null || _c === void 0 ? void 0 : _c.id) || ((_d = this.order) === null || _d === void 0 ? void 0 : _d.payment_intent)}/capture`, |
| 103 | })); |
| 104 | if (['succeeded', 'processing'].includes(intent === null || intent === void 0 ? void 0 : intent.status)) { |
| 105 | this.scSetState.emit('PAID'); |
| 106 | this.scPaid.emit(); |
| 107 | } |
| 108 | else { |
| 109 | createErrorNotice({ code: 'could_not_capture', message: wp.i18n.__('Payment processing failed. Kindly attempt the transaction once more.', 'surecart') }); |
| 110 | this.scSetState.emit('REJECT'); |
| 111 | } |
| 112 | } |
| 113 | catch (err) { |
| 114 | console.error(err); |
| 115 | createErrorNotice({ code: 'could_not_capture', message: wp.i18n.__('Payment processing failed. Kindly attempt the transaction once more.', 'surecart') }); |
| 116 | this.scSetState.emit('REJECT'); |
| 117 | } |
| 118 | }, |
| 119 | /** |
| 120 | * Transaction errored. |
| 121 | * @param err |
| 122 | */ |
| 123 | onError: err => { |
| 124 | console.error(err); |
| 125 | createErrorNotice(err); |
| 126 | this.scSetState.emit('REJECT'); |
| 127 | }, |
| 128 | }; |
| 129 | config[createFunc] = async () => { |
| 130 | return new Promise(async (resolve, reject) => { |
| 131 | var _a, _b; |
| 132 | // get the checkout component. |
| 133 | const checkout = this.el.closest('sc-checkout'); |
| 134 | // submit and get the finalized order |
| 135 | const order = (await checkout.submit()); |
| 136 | // an error occurred. reject with the error. |
| 137 | if (order instanceof Error) { |
| 138 | return reject(order); |
| 139 | } |
| 140 | // assume there was a validation issue here. |
| 141 | // that is handled by our fetch function. |
| 142 | if ((order === null || order === void 0 ? void 0 : order.status) !== 'finalized') { |
| 143 | return reject(new Error('Something went wrong. Please try again.')); |
| 144 | } |
| 145 | // resolve the payment intent id. |
| 146 | if ((_a = order === null || order === void 0 ? void 0 : order.payment_intent) === null || _a === void 0 ? void 0 : _a.external_intent_id) { |
| 147 | return resolve((_b = order === null || order === void 0 ? void 0 : order.payment_intent) === null || _b === void 0 ? void 0 : _b.external_intent_id); |
| 148 | } |
| 149 | // we don't have the correct payment intent for some reason. |
| 150 | createErrorNotice({ code: 'missing_payment_intent', message: wp.i18n.__('Something went wrong. Please contact us for payment.', 'surecart') }); |
| 151 | return reject(); |
| 152 | }); |
| 153 | }; |
| 154 | if (paypal.FUNDING.PAYPAL) { |
| 155 | const paypalButton = paypal.Buttons({ |
| 156 | fundingSource: paypal.FUNDING.PAYPAL, |
| 157 | style: { |
| 158 | label: this.label, |
| 159 | color: this.color, |
| 160 | }, |
| 161 | ...config, |
| 162 | }); |
| 163 | if (paypalButton.isEligible()) { |
| 164 | paypalButton.render(this.paypalContainer); |
| 165 | } |
| 166 | } |
| 167 | if (paypal.FUNDING.CARD) { |
| 168 | const cardButton = paypal.Buttons({ |
| 169 | fundingSource: paypal.FUNDING.CARD, |
| 170 | style: { |
| 171 | color: 'black', |
| 172 | }, |
| 173 | ...config, |
| 174 | }); |
| 175 | if (cardButton.isEligible()) { |
| 176 | cardButton.render(this.cardContainer); |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | render() { |
| 181 | return (h("div", { key: 'f2c0c76383ff5888fda465ef5583f27dc9043b6d', part: `base ${this.busy || (!this.loaded && 'base--busy')}`, class: { 'paypal-buttons': true, 'paypal-buttons--busy': this.busy || !this.loaded } }, (!this.loaded || this.busy) && h("sc-skeleton", { key: '14b418789ad00b2fddec3c37eb41b7deb27678dc', style: { 'height': '55px', '--border-radius': '4px', 'cursor': 'wait' } }), h("div", { key: '2c6a6055c4e395d20987b74fca008a84c7ba41ac', class: "sc-paypal-button-container", hidden: !this.loaded || this.busy }, h("div", { key: 'ea897634f9b4383b5867d273a54d90e629a62db8', part: "paypal-card-button", hidden: !this.buttons.includes('card'), class: "sc-paypal-card-button", ref: el => (this.cardContainer = el) }), h("div", { key: 'e6bd5497e548d680079027c3339dbe47fb05f346', part: "paypal-button", hidden: !this.buttons.includes('paypal'), class: "sc-paypal-button", ref: el => (this.paypalContainer = el) })))); |
| 182 | } |
| 183 | get el() { return getElement(this); } |
| 184 | static get watchers() { return { |
| 185 | "order": ["handleOrderChange"] |
| 186 | }; } |
| 187 | }; |
| 188 | ScPaypalButtons.style = ScPaypalButtonsStyle0; |
| 189 | |
| 190 | const scSecureNoticeCss = ":host{display:block;--sc-secure-notice-icon-color:var(--sc-color-gray-300);--sc-secure-notice-font-size:var(--sc-font-size-small);--sc-secure-notice-color:var(--sc-color-gray-500)}.notice{color:var(--sc-secure-notice-color);font-size:var(--sc-secure-notice-font-size);display:flex;align-items:center;gap:5px}.notice__text{flex:1;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}.notice__icon{color:var(--sc-secure-notice-icon-color);margin-right:5px}"; |
| 191 | const ScSecureNoticeStyle0 = scSecureNoticeCss; |
| 192 | |
| 193 | const ScSecureNotice = class { |
| 194 | constructor(hostRef) { |
| 195 | registerInstance(this, hostRef); |
| 196 | } |
| 197 | render() { |
| 198 | return (h("div", { key: '04718fbcb38be301610f7942c97e8e4f764fcb1e', class: "notice", part: "base" }, h("svg", { key: '3221f2b94156a8363a1f94de90902e1dd8059065', class: "notice__icon", part: "icon", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 512 512", fill: "currentColor" }, h("path", { key: '1635821d95bae522a51a32a30234ff86351b056b', d: "M368,192H352V112a96,96,0,1,0-192,0v80H144a64.07,64.07,0,0,0-64,64V432a64.07,64.07,0,0,0,64,64H368a64.07,64.07,0,0,0,64-64V256A64.07,64.07,0,0,0,368,192Zm-48,0H192V112a64,64,0,1,1,128,0Z" })), h("span", { key: 'c454ee38fc7dd67a4181d32a460ea031f83e35ca', class: "notice__text", part: "text" }, h("slot", { key: 'a7854fbdd4493df7a045ecbeac94b2108cf9f15c', name: "prefix" }), h("slot", { key: '3025a35b56c6d474a70e727bb8475150c64fe464' }), h("slot", { key: 'ac9dbfd799339607bc4adf7061c4ebd09a75373d', name: "suffix" })))); |
| 199 | } |
| 200 | }; |
| 201 | ScSecureNotice.style = ScSecureNoticeStyle0; |
| 202 | |
| 203 | export { ScPaypalButtons as sc_paypal_buttons, ScSecureNotice as sc_secure_notice }; |
| 204 | |
| 205 | //# sourceMappingURL=sc-paypal-buttons_2.entry.js.map |