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-price-choice.entry.js
826 lines
| 1 | import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-745b6bec.js'; |
| 2 | import { o as openWormhole } from './consumer-e06b16d3.js'; |
| 3 | import { i as isPriceInOrder } from './index-822e5799.js'; |
| 4 | import { i as intervalString } from './price-d5770168.js'; |
| 5 | import { a as apiFetch } from './fetch-e3c5d1b9.js'; |
| 6 | import { a as addQueryArgs } from './add-query-args-0e2a8393.js'; |
| 7 | import './currency-a0c9bff4.js'; |
| 8 | import './remove-query-args-938c53ea.js'; |
| 9 | |
| 10 | function _defineProperties(target, props) { |
| 11 | for (var i = 0; i < props.length; i++) { |
| 12 | var descriptor = props[i]; |
| 13 | descriptor.enumerable = descriptor.enumerable || false; |
| 14 | descriptor.configurable = true; |
| 15 | if ("value" in descriptor) descriptor.writable = true; |
| 16 | Object.defineProperty(target, descriptor.key, descriptor); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | function _createClass(Constructor, protoProps, staticProps) { |
| 21 | if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
| 22 | if (staticProps) _defineProperties(Constructor, staticProps); |
| 23 | return Constructor; |
| 24 | } |
| 25 | |
| 26 | function _extends() { |
| 27 | _extends = Object.assign || function (target) { |
| 28 | for (var i = 1; i < arguments.length; i++) { |
| 29 | var source = arguments[i]; |
| 30 | |
| 31 | for (var key in source) { |
| 32 | if (Object.prototype.hasOwnProperty.call(source, key)) { |
| 33 | target[key] = source[key]; |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | return target; |
| 39 | }; |
| 40 | |
| 41 | return _extends.apply(this, arguments); |
| 42 | } |
| 43 | |
| 44 | function _inheritsLoose(subClass, superClass) { |
| 45 | subClass.prototype = Object.create(superClass.prototype); |
| 46 | subClass.prototype.constructor = subClass; |
| 47 | subClass.__proto__ = superClass; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Helpers to enable Immutable compatibility *without* bringing in |
| 52 | * the 'immutable' package as a dependency. |
| 53 | */ |
| 54 | |
| 55 | /** |
| 56 | * Check if an object is immutable by checking if it has a key specific |
| 57 | * to the immutable library. |
| 58 | * |
| 59 | * @param {any} object |
| 60 | * @return {bool} |
| 61 | */ |
| 62 | function isImmutable(object) { |
| 63 | return !!(object && typeof object.hasOwnProperty === 'function' && (object.hasOwnProperty('__ownerID') || // Immutable.Map |
| 64 | object._map && object._map.hasOwnProperty('__ownerID'))); // Immutable.Record |
| 65 | } |
| 66 | /** |
| 67 | * Denormalize an immutable entity. |
| 68 | * |
| 69 | * @param {Schema} schema |
| 70 | * @param {Immutable.Map|Immutable.Record} input |
| 71 | * @param {function} unvisit |
| 72 | * @param {function} getDenormalizedEntity |
| 73 | * @return {Immutable.Map|Immutable.Record} |
| 74 | */ |
| 75 | |
| 76 | function denormalizeImmutable(schema, input, unvisit) { |
| 77 | return Object.keys(schema).reduce(function (object, key) { |
| 78 | // Immutable maps cast keys to strings on write so we need to ensure |
| 79 | // we're accessing them using string keys. |
| 80 | var stringKey = "" + key; |
| 81 | |
| 82 | if (object.has(stringKey)) { |
| 83 | return object.set(stringKey, unvisit(object.get(stringKey), schema[stringKey])); |
| 84 | } else { |
| 85 | return object; |
| 86 | } |
| 87 | }, input); |
| 88 | } |
| 89 | |
| 90 | var getDefaultGetId = function getDefaultGetId(idAttribute) { |
| 91 | return function (input) { |
| 92 | return isImmutable(input) ? input.get(idAttribute) : input[idAttribute]; |
| 93 | }; |
| 94 | }; |
| 95 | |
| 96 | var EntitySchema = /*#__PURE__*/function () { |
| 97 | function EntitySchema(key, definition, options) { |
| 98 | if (definition === void 0) { |
| 99 | definition = {}; |
| 100 | } |
| 101 | |
| 102 | if (options === void 0) { |
| 103 | options = {}; |
| 104 | } |
| 105 | |
| 106 | if (!key || typeof key !== 'string') { |
| 107 | throw new Error("Expected a string key for Entity, but found " + key + "."); |
| 108 | } |
| 109 | |
| 110 | var _options = options, |
| 111 | _options$idAttribute = _options.idAttribute, |
| 112 | idAttribute = _options$idAttribute === void 0 ? 'id' : _options$idAttribute, |
| 113 | _options$mergeStrateg = _options.mergeStrategy, |
| 114 | mergeStrategy = _options$mergeStrateg === void 0 ? function (entityA, entityB) { |
| 115 | return _extends({}, entityA, entityB); |
| 116 | } : _options$mergeStrateg, |
| 117 | _options$processStrat = _options.processStrategy, |
| 118 | processStrategy = _options$processStrat === void 0 ? function (input) { |
| 119 | return _extends({}, input); |
| 120 | } : _options$processStrat, |
| 121 | _options$fallbackStra = _options.fallbackStrategy, |
| 122 | fallbackStrategy = _options$fallbackStra === void 0 ? function (key, schema) { |
| 123 | return undefined; |
| 124 | } : _options$fallbackStra; |
| 125 | this._key = key; |
| 126 | this._getId = typeof idAttribute === 'function' ? idAttribute : getDefaultGetId(idAttribute); |
| 127 | this._idAttribute = idAttribute; |
| 128 | this._mergeStrategy = mergeStrategy; |
| 129 | this._processStrategy = processStrategy; |
| 130 | this._fallbackStrategy = fallbackStrategy; |
| 131 | this.define(definition); |
| 132 | } |
| 133 | |
| 134 | var _proto = EntitySchema.prototype; |
| 135 | |
| 136 | _proto.define = function define(definition) { |
| 137 | this.schema = Object.keys(definition).reduce(function (entitySchema, key) { |
| 138 | var _extends2; |
| 139 | |
| 140 | var schema = definition[key]; |
| 141 | return _extends({}, entitySchema, (_extends2 = {}, _extends2[key] = schema, _extends2)); |
| 142 | }, this.schema || {}); |
| 143 | }; |
| 144 | |
| 145 | _proto.getId = function getId(input, parent, key) { |
| 146 | return this._getId(input, parent, key); |
| 147 | }; |
| 148 | |
| 149 | _proto.merge = function merge(entityA, entityB) { |
| 150 | return this._mergeStrategy(entityA, entityB); |
| 151 | }; |
| 152 | |
| 153 | _proto.fallback = function fallback(id, schema) { |
| 154 | return this._fallbackStrategy(id, schema); |
| 155 | }; |
| 156 | |
| 157 | _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) { |
| 158 | var _this = this; |
| 159 | |
| 160 | var id = this.getId(input, parent, key); |
| 161 | var entityType = this.key; |
| 162 | |
| 163 | if (!(entityType in visitedEntities)) { |
| 164 | visitedEntities[entityType] = {}; |
| 165 | } |
| 166 | |
| 167 | if (!(id in visitedEntities[entityType])) { |
| 168 | visitedEntities[entityType][id] = []; |
| 169 | } |
| 170 | |
| 171 | if (visitedEntities[entityType][id].some(function (entity) { |
| 172 | return entity === input; |
| 173 | })) { |
| 174 | return id; |
| 175 | } |
| 176 | |
| 177 | visitedEntities[entityType][id].push(input); |
| 178 | |
| 179 | var processedEntity = this._processStrategy(input, parent, key); |
| 180 | |
| 181 | Object.keys(this.schema).forEach(function (key) { |
| 182 | if (processedEntity.hasOwnProperty(key) && typeof processedEntity[key] === 'object') { |
| 183 | var schema = _this.schema[key]; |
| 184 | var resolvedSchema = typeof schema === 'function' ? schema(input) : schema; |
| 185 | processedEntity[key] = visit(processedEntity[key], processedEntity, key, resolvedSchema, addEntity, visitedEntities); |
| 186 | } |
| 187 | }); |
| 188 | addEntity(this, processedEntity, input, parent, key); |
| 189 | return id; |
| 190 | }; |
| 191 | |
| 192 | _proto.denormalize = function denormalize(entity, unvisit) { |
| 193 | var _this2 = this; |
| 194 | |
| 195 | if (isImmutable(entity)) { |
| 196 | return denormalizeImmutable(this.schema, entity, unvisit); |
| 197 | } |
| 198 | |
| 199 | Object.keys(this.schema).forEach(function (key) { |
| 200 | if (entity.hasOwnProperty(key)) { |
| 201 | var schema = _this2.schema[key]; |
| 202 | entity[key] = unvisit(entity[key], schema); |
| 203 | } |
| 204 | }); |
| 205 | return entity; |
| 206 | }; |
| 207 | |
| 208 | _createClass(EntitySchema, [{ |
| 209 | key: "key", |
| 210 | get: function get() { |
| 211 | return this._key; |
| 212 | } |
| 213 | }, { |
| 214 | key: "idAttribute", |
| 215 | get: function get() { |
| 216 | return this._idAttribute; |
| 217 | } |
| 218 | }]); |
| 219 | |
| 220 | return EntitySchema; |
| 221 | }(); |
| 222 | |
| 223 | var PolymorphicSchema = /*#__PURE__*/function () { |
| 224 | function PolymorphicSchema(definition, schemaAttribute) { |
| 225 | if (schemaAttribute) { |
| 226 | this._schemaAttribute = typeof schemaAttribute === 'string' ? function (input) { |
| 227 | return input[schemaAttribute]; |
| 228 | } : schemaAttribute; |
| 229 | } |
| 230 | |
| 231 | this.define(definition); |
| 232 | } |
| 233 | |
| 234 | var _proto = PolymorphicSchema.prototype; |
| 235 | |
| 236 | _proto.define = function define(definition) { |
| 237 | this.schema = definition; |
| 238 | }; |
| 239 | |
| 240 | _proto.getSchemaAttribute = function getSchemaAttribute(input, parent, key) { |
| 241 | return !this.isSingleSchema && this._schemaAttribute(input, parent, key); |
| 242 | }; |
| 243 | |
| 244 | _proto.inferSchema = function inferSchema(input, parent, key) { |
| 245 | if (this.isSingleSchema) { |
| 246 | return this.schema; |
| 247 | } |
| 248 | |
| 249 | var attr = this.getSchemaAttribute(input, parent, key); |
| 250 | return this.schema[attr]; |
| 251 | }; |
| 252 | |
| 253 | _proto.normalizeValue = function normalizeValue(value, parent, key, visit, addEntity, visitedEntities) { |
| 254 | var schema = this.inferSchema(value, parent, key); |
| 255 | |
| 256 | if (!schema) { |
| 257 | return value; |
| 258 | } |
| 259 | |
| 260 | var normalizedValue = visit(value, parent, key, schema, addEntity, visitedEntities); |
| 261 | return this.isSingleSchema || normalizedValue === undefined || normalizedValue === null ? normalizedValue : { |
| 262 | id: normalizedValue, |
| 263 | schema: this.getSchemaAttribute(value, parent, key) |
| 264 | }; |
| 265 | }; |
| 266 | |
| 267 | _proto.denormalizeValue = function denormalizeValue(value, unvisit) { |
| 268 | var schemaKey = isImmutable(value) ? value.get('schema') : value.schema; |
| 269 | |
| 270 | if (!this.isSingleSchema && !schemaKey) { |
| 271 | return value; |
| 272 | } |
| 273 | |
| 274 | var id = this.isSingleSchema ? undefined : isImmutable(value) ? value.get('id') : value.id; |
| 275 | var schema = this.isSingleSchema ? this.schema : this.schema[schemaKey]; |
| 276 | return unvisit(id || value, schema); |
| 277 | }; |
| 278 | |
| 279 | _createClass(PolymorphicSchema, [{ |
| 280 | key: "isSingleSchema", |
| 281 | get: function get() { |
| 282 | return !this._schemaAttribute; |
| 283 | } |
| 284 | }]); |
| 285 | |
| 286 | return PolymorphicSchema; |
| 287 | }(); |
| 288 | |
| 289 | var UnionSchema = /*#__PURE__*/function (_PolymorphicSchema) { |
| 290 | _inheritsLoose(UnionSchema, _PolymorphicSchema); |
| 291 | |
| 292 | function UnionSchema(definition, schemaAttribute) { |
| 293 | if (!schemaAttribute) { |
| 294 | throw new Error('Expected option "schemaAttribute" not found on UnionSchema.'); |
| 295 | } |
| 296 | |
| 297 | return _PolymorphicSchema.call(this, definition, schemaAttribute) || this; |
| 298 | } |
| 299 | |
| 300 | var _proto = UnionSchema.prototype; |
| 301 | |
| 302 | _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) { |
| 303 | return this.normalizeValue(input, parent, key, visit, addEntity, visitedEntities); |
| 304 | }; |
| 305 | |
| 306 | _proto.denormalize = function denormalize(input, unvisit) { |
| 307 | return this.denormalizeValue(input, unvisit); |
| 308 | }; |
| 309 | |
| 310 | return UnionSchema; |
| 311 | }(PolymorphicSchema); |
| 312 | |
| 313 | var ValuesSchema = /*#__PURE__*/function (_PolymorphicSchema) { |
| 314 | _inheritsLoose(ValuesSchema, _PolymorphicSchema); |
| 315 | |
| 316 | function ValuesSchema() { |
| 317 | return _PolymorphicSchema.apply(this, arguments) || this; |
| 318 | } |
| 319 | |
| 320 | var _proto = ValuesSchema.prototype; |
| 321 | |
| 322 | _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) { |
| 323 | var _this = this; |
| 324 | |
| 325 | return Object.keys(input).reduce(function (output, key, index) { |
| 326 | var _extends2; |
| 327 | |
| 328 | var value = input[key]; |
| 329 | return value !== undefined && value !== null ? _extends({}, output, (_extends2 = {}, _extends2[key] = _this.normalizeValue(value, input, key, visit, addEntity, visitedEntities), _extends2)) : output; |
| 330 | }, {}); |
| 331 | }; |
| 332 | |
| 333 | _proto.denormalize = function denormalize(input, unvisit) { |
| 334 | var _this2 = this; |
| 335 | |
| 336 | return Object.keys(input).reduce(function (output, key) { |
| 337 | var _extends3; |
| 338 | |
| 339 | var entityOrId = input[key]; |
| 340 | return _extends({}, output, (_extends3 = {}, _extends3[key] = _this2.denormalizeValue(entityOrId, unvisit), _extends3)); |
| 341 | }, {}); |
| 342 | }; |
| 343 | |
| 344 | return ValuesSchema; |
| 345 | }(PolymorphicSchema); |
| 346 | |
| 347 | var validateSchema = function validateSchema(definition) { |
| 348 | var isArray = Array.isArray(definition); |
| 349 | |
| 350 | if (isArray && definition.length > 1) { |
| 351 | throw new Error("Expected schema definition to be a single schema, but found " + definition.length + "."); |
| 352 | } |
| 353 | |
| 354 | return definition[0]; |
| 355 | }; |
| 356 | |
| 357 | var getValues = function getValues(input) { |
| 358 | return Array.isArray(input) ? input : Object.keys(input).map(function (key) { |
| 359 | return input[key]; |
| 360 | }); |
| 361 | }; |
| 362 | |
| 363 | var normalize = function normalize(schema, input, parent, key, visit, addEntity, visitedEntities) { |
| 364 | schema = validateSchema(schema); |
| 365 | var values = getValues(input); // Special case: Arrays pass *their* parent on to their children, since there |
| 366 | // is not any special information that can be gathered from themselves directly |
| 367 | |
| 368 | return values.map(function (value, index) { |
| 369 | return visit(value, parent, key, schema, addEntity, visitedEntities); |
| 370 | }); |
| 371 | }; |
| 372 | |
| 373 | var ArraySchema = /*#__PURE__*/function (_PolymorphicSchema) { |
| 374 | _inheritsLoose(ArraySchema, _PolymorphicSchema); |
| 375 | |
| 376 | function ArraySchema() { |
| 377 | return _PolymorphicSchema.apply(this, arguments) || this; |
| 378 | } |
| 379 | |
| 380 | var _proto = ArraySchema.prototype; |
| 381 | |
| 382 | _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) { |
| 383 | var _this = this; |
| 384 | |
| 385 | var values = getValues(input); |
| 386 | return values.map(function (value, index) { |
| 387 | return _this.normalizeValue(value, parent, key, visit, addEntity, visitedEntities); |
| 388 | }).filter(function (value) { |
| 389 | return value !== undefined && value !== null; |
| 390 | }); |
| 391 | }; |
| 392 | |
| 393 | _proto.denormalize = function denormalize(input, unvisit) { |
| 394 | var _this2 = this; |
| 395 | |
| 396 | return input && input.map ? input.map(function (value) { |
| 397 | return _this2.denormalizeValue(value, unvisit); |
| 398 | }) : input; |
| 399 | }; |
| 400 | |
| 401 | return ArraySchema; |
| 402 | }(PolymorphicSchema); |
| 403 | |
| 404 | var _normalize = function normalize(schema, input, parent, key, visit, addEntity, visitedEntities) { |
| 405 | var object = _extends({}, input); |
| 406 | |
| 407 | Object.keys(schema).forEach(function (key) { |
| 408 | var localSchema = schema[key]; |
| 409 | var resolvedLocalSchema = typeof localSchema === 'function' ? localSchema(input) : localSchema; |
| 410 | var value = visit(input[key], input, key, resolvedLocalSchema, addEntity, visitedEntities); |
| 411 | |
| 412 | if (value === undefined || value === null) { |
| 413 | delete object[key]; |
| 414 | } else { |
| 415 | object[key] = value; |
| 416 | } |
| 417 | }); |
| 418 | return object; |
| 419 | }; |
| 420 | |
| 421 | var _denormalize = function denormalize(schema, input, unvisit) { |
| 422 | if (isImmutable(input)) { |
| 423 | return denormalizeImmutable(schema, input, unvisit); |
| 424 | } |
| 425 | |
| 426 | var object = _extends({}, input); |
| 427 | |
| 428 | Object.keys(schema).forEach(function (key) { |
| 429 | if (object[key] != null) { |
| 430 | object[key] = unvisit(object[key], schema[key]); |
| 431 | } |
| 432 | }); |
| 433 | return object; |
| 434 | }; |
| 435 | |
| 436 | var ObjectSchema = /*#__PURE__*/function () { |
| 437 | function ObjectSchema(definition) { |
| 438 | this.define(definition); |
| 439 | } |
| 440 | |
| 441 | var _proto = ObjectSchema.prototype; |
| 442 | |
| 443 | _proto.define = function define(definition) { |
| 444 | this.schema = Object.keys(definition).reduce(function (entitySchema, key) { |
| 445 | var _extends2; |
| 446 | |
| 447 | var schema = definition[key]; |
| 448 | return _extends({}, entitySchema, (_extends2 = {}, _extends2[key] = schema, _extends2)); |
| 449 | }, this.schema || {}); |
| 450 | }; |
| 451 | |
| 452 | _proto.normalize = function normalize() { |
| 453 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
| 454 | args[_key] = arguments[_key]; |
| 455 | } |
| 456 | |
| 457 | return _normalize.apply(void 0, [this.schema].concat(args)); |
| 458 | }; |
| 459 | |
| 460 | _proto.denormalize = function denormalize() { |
| 461 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { |
| 462 | args[_key2] = arguments[_key2]; |
| 463 | } |
| 464 | |
| 465 | return _denormalize.apply(void 0, [this.schema].concat(args)); |
| 466 | }; |
| 467 | |
| 468 | return ObjectSchema; |
| 469 | }(); |
| 470 | |
| 471 | var visit = function visit(value, parent, key, schema, addEntity, visitedEntities) { |
| 472 | if (typeof value !== 'object' || !value) { |
| 473 | return value; |
| 474 | } |
| 475 | |
| 476 | if (typeof schema === 'object' && (!schema.normalize || typeof schema.normalize !== 'function')) { |
| 477 | var method = Array.isArray(schema) ? normalize : _normalize; |
| 478 | return method(schema, value, parent, key, visit, addEntity, visitedEntities); |
| 479 | } |
| 480 | |
| 481 | return schema.normalize(value, parent, key, visit, addEntity, visitedEntities); |
| 482 | }; |
| 483 | |
| 484 | var addEntities = function addEntities(entities) { |
| 485 | return function (schema, processedEntity, value, parent, key) { |
| 486 | var schemaKey = schema.key; |
| 487 | var id = schema.getId(value, parent, key); |
| 488 | |
| 489 | if (!(schemaKey in entities)) { |
| 490 | entities[schemaKey] = {}; |
| 491 | } |
| 492 | |
| 493 | var existingEntity = entities[schemaKey][id]; |
| 494 | |
| 495 | if (existingEntity) { |
| 496 | entities[schemaKey][id] = schema.merge(existingEntity, processedEntity); |
| 497 | } else { |
| 498 | entities[schemaKey][id] = processedEntity; |
| 499 | } |
| 500 | }; |
| 501 | }; |
| 502 | |
| 503 | var schema = { |
| 504 | Array: ArraySchema, |
| 505 | Entity: EntitySchema, |
| 506 | Object: ObjectSchema, |
| 507 | Union: UnionSchema, |
| 508 | Values: ValuesSchema |
| 509 | }; |
| 510 | var normalize$1 = function normalize(input, schema) { |
| 511 | if (!input || typeof input !== 'object') { |
| 512 | throw new Error("Unexpected input given to normalize. Expected type to be \"object\", found \"" + (input === null ? 'null' : typeof input) + "\"."); |
| 513 | } |
| 514 | |
| 515 | var entities = {}; |
| 516 | var addEntity = addEntities(entities); |
| 517 | var visitedEntities = {}; |
| 518 | var result = visit(input, input, null, schema, addEntity, visitedEntities); |
| 519 | return { |
| 520 | entities: entities, |
| 521 | result: result |
| 522 | }; |
| 523 | }; |
| 524 | |
| 525 | const entities = { |
| 526 | integration: new schema.Entity('integration'), |
| 527 | account: new schema.Entity('account'), |
| 528 | price: new schema.Entity('price'), |
| 529 | product: new schema.Entity('product'), |
| 530 | product_group: new schema.Entity('product_group'), |
| 531 | purchase: new schema.Entity('purchase'), |
| 532 | payment_method: new schema.Entity('payment_method'), |
| 533 | card: new schema.Entity('card'), |
| 534 | invoice: new schema.Entity('invoice'), |
| 535 | current_period: new schema.Entity('current_period'), |
| 536 | refund: new schema.Entity('refund'), |
| 537 | charge: new schema.Entity('charge'), |
| 538 | coupon: new schema.Entity('coupon'), |
| 539 | promotion: new schema.Entity('promotion'), |
| 540 | order: new schema.Entity('order'), |
| 541 | customer: new schema.Entity('customer'), |
| 542 | subscription: new schema.Entity('subscription'), |
| 543 | product_group: new schema.Entity('product_group'), |
| 544 | }; |
| 545 | |
| 546 | const { |
| 547 | price, |
| 548 | product, |
| 549 | purchase, |
| 550 | payment_method, |
| 551 | card, |
| 552 | invoice, |
| 553 | refund, |
| 554 | charge, |
| 555 | coupon, |
| 556 | promotion, |
| 557 | order, |
| 558 | integration, |
| 559 | customer, |
| 560 | product_group, |
| 561 | subscription, |
| 562 | } = entities; |
| 563 | |
| 564 | product.define({ |
| 565 | prices: { |
| 566 | data: [price], |
| 567 | }, |
| 568 | product_group, |
| 569 | }); |
| 570 | |
| 571 | price.define({ |
| 572 | product, |
| 573 | }); |
| 574 | |
| 575 | invoice.define({ |
| 576 | purchases: { |
| 577 | data: [purchase], |
| 578 | }, |
| 579 | charge, |
| 580 | customer, |
| 581 | subscription, |
| 582 | }); |
| 583 | |
| 584 | order.define({ |
| 585 | purchases: { |
| 586 | data: [purchase], |
| 587 | }, |
| 588 | charge, |
| 589 | customer, |
| 590 | subscription, |
| 591 | }); |
| 592 | |
| 593 | charge.define({ |
| 594 | order, |
| 595 | invoice, |
| 596 | }); |
| 597 | |
| 598 | subscription.define({ |
| 599 | current_period: invoice, |
| 600 | purchase, |
| 601 | price, |
| 602 | payment_method, |
| 603 | order, |
| 604 | customer, |
| 605 | }); |
| 606 | |
| 607 | refund.define({ |
| 608 | charge, |
| 609 | customer, |
| 610 | }); |
| 611 | |
| 612 | purchase.define({ |
| 613 | order, |
| 614 | product, |
| 615 | subscription, |
| 616 | }); |
| 617 | |
| 618 | payment_method.define({ |
| 619 | card, |
| 620 | }); |
| 621 | |
| 622 | coupon.define({ |
| 623 | promotions: { |
| 624 | data: [promotion], |
| 625 | }, |
| 626 | }); |
| 627 | |
| 628 | product_group.define({}); |
| 629 | integration.define({}); |
| 630 | |
| 631 | const normalizeEntities = (data) => { |
| 632 | if (entities?.[data?.[0]?.object]) { |
| 633 | return normalize$1(data, [entities[data?.[0]?.object]]); |
| 634 | } |
| 635 | return {}; |
| 636 | }; |
| 637 | |
| 638 | const getPricesAndProducts = async ({ ids, archived = false }) => { |
| 639 | const prices = (await apiFetch({ |
| 640 | path: addQueryArgs('surecart/v1/prices/', { |
| 641 | ids, |
| 642 | archived, |
| 643 | expand: ['product'], |
| 644 | }), |
| 645 | })); |
| 646 | return normalizePrices(prices); |
| 647 | }; |
| 648 | const normalizePrices = (prices) => { |
| 649 | const { entities } = normalizeEntities(prices); |
| 650 | return { |
| 651 | prices: entities === null || entities === void 0 ? void 0 : entities.price, |
| 652 | products: entities === null || entities === void 0 ? void 0 : entities.product, |
| 653 | }; |
| 654 | }; |
| 655 | |
| 656 | const scPriceChoiceCss = ":host {\n display: block;\n min-width: 0;\n width: 100%;\n}\n\nsc-choice-container {\n container-type: inline-size;\n}\n\n.price-choice {\n display: flex;\n align-items: center;\n justify-content: space-between;\n line-height: var(--sc-line-height-dense);\n gap: var(--sc-spacing-small);\n}\n.price-choice__name {\n color: var(--sc-price-choice-name-color, var(--sc-input-label-color));\n font-size: var(--sc-price-choice-name-size, var(--sc-input-label-font-size-medium));\n font-weight: var(--sc-price-choice-name-font-weight, var(--sc-font-weight-bold));\n text-transform: var(--sc-price-choice-text-transform, var(--sc-input-label-text-transform, none));\n display: -webkit-box;\n display: -moz-box;\n -webkit-box-orient: vertical;\n -moz-box-orient: vertical;\n -webkit-line-clamp: 3;\n -moz-box-lines: 3;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.price-choice__description {\n color: var(--sc-input-help-text-color);\n}\n.price-choice > *:not(:first-child):last-child {\n text-align: right;\n}\n.price-choice__details {\n flex: 1 0 50%;\n display: grid;\n gap: var(--sc-spacing-xxx-small);\n}\n.price-choice__trial, .price-choice__setup-fee, .price-choice__price {\n font-size: var(--sc-font-size-small);\n color: var(--sc-input-help-text-color);\n}\n.price-choice__price {\n color: var(--sc-input-label-color);\n font-weight: var(--sc-price-choice-price-font-weight, var(--sc-font-weight-normal));\n}\n\n@container (max-width: 325px) {\n .price-choice {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--sc-spacing-xx-small);\n }\n .price-choice > *:not(:first-child):last-child {\n text-align: initial;\n }\n}"; |
| 657 | const ScPriceChoiceStyle0 = scPriceChoiceCss; |
| 658 | |
| 659 | const ScPriceChoice = class { |
| 660 | constructor(hostRef) { |
| 661 | registerInstance(this, hostRef); |
| 662 | this.scUpdateLineItem = createEvent(this, "scUpdateLineItem", 7); |
| 663 | this.scRemoveLineItem = createEvent(this, "scRemoveLineItem", 7); |
| 664 | this.scAddEntities = createEvent(this, "scAddEntities", 7); |
| 665 | this.priceId = undefined; |
| 666 | this.price = undefined; |
| 667 | this.product = undefined; |
| 668 | this.loading = false; |
| 669 | this.label = undefined; |
| 670 | this.showLabel = true; |
| 671 | this.showPrice = true; |
| 672 | this.showControl = true; |
| 673 | this.description = undefined; |
| 674 | this.prices = {}; |
| 675 | this.products = {}; |
| 676 | this.order = undefined; |
| 677 | this.quantity = 1; |
| 678 | this.type = undefined; |
| 679 | this.checked = false; |
| 680 | this.error = undefined; |
| 681 | this.isAdHoc = undefined; |
| 682 | this.blank = false; |
| 683 | this.errorMessage = undefined; |
| 684 | this.adHocErrorMessage = undefined; |
| 685 | } |
| 686 | /** Refetch if price changes */ |
| 687 | handlePriceIdChage() { |
| 688 | var _a; |
| 689 | if (this.price && ((_a = this.price) === null || _a === void 0 ? void 0 : _a.id) === this.priceId) |
| 690 | return; |
| 691 | this.fetchPriceWithProduct(); |
| 692 | } |
| 693 | /** Keep price up to date. */ |
| 694 | handlePricesChange() { |
| 695 | var _a, _b, _c; |
| 696 | if (!Object.keys(this.prices || {}).length || !Object.keys(this.products || {}).length) |
| 697 | return; |
| 698 | this.price = (_a = this === null || this === void 0 ? void 0 : this.prices) === null || _a === void 0 ? void 0 : _a[this.priceId]; |
| 699 | this.product = (_b = this === null || this === void 0 ? void 0 : this.products) === null || _b === void 0 ? void 0 : _b[(_c = this === null || this === void 0 ? void 0 : this.price) === null || _c === void 0 ? void 0 : _c.product]; |
| 700 | } |
| 701 | handlePriseChange() { |
| 702 | var _a; |
| 703 | this.isAdHoc = (_a = this === null || this === void 0 ? void 0 : this.price) === null || _a === void 0 ? void 0 : _a.ad_hoc; |
| 704 | } |
| 705 | handleErrorsChange() { |
| 706 | var _a; |
| 707 | const error = (((_a = this === null || this === void 0 ? void 0 : this.error) === null || _a === void 0 ? void 0 : _a.additional_errors) || []).find(error => { var _a; return ((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.attribute) === 'line_items.ad_hoc_amount'; }); |
| 708 | this.adHocErrorMessage = (error === null || error === void 0 ? void 0 : error.message) ? error === null || error === void 0 ? void 0 : error.message : ''; |
| 709 | } |
| 710 | handleCheckedChange() { |
| 711 | var _a; |
| 712 | if (((_a = this.price) === null || _a === void 0 ? void 0 : _a.ad_hoc) && this.choice.checked) { |
| 713 | setTimeout(() => { |
| 714 | this.adHocInput.triggerFocus(); |
| 715 | }, 50); |
| 716 | return; |
| 717 | } |
| 718 | } |
| 719 | /** Fetch on load */ |
| 720 | componentWillLoad() { |
| 721 | if (!this.price) { |
| 722 | this.fetchPriceWithProduct(); |
| 723 | } |
| 724 | } |
| 725 | /** Fetch prices and products */ |
| 726 | async fetchPriceWithProduct() { |
| 727 | if (!this.priceId) |
| 728 | return; |
| 729 | try { |
| 730 | this.loading = true; |
| 731 | const { products, prices } = await getPricesAndProducts({ |
| 732 | archived: false, |
| 733 | ids: [this.priceId], |
| 734 | }); |
| 735 | // add to central store. |
| 736 | this.scAddEntities.emit({ prices, products }); |
| 737 | } |
| 738 | catch (err) { |
| 739 | } |
| 740 | finally { |
| 741 | this.loading = false; |
| 742 | } |
| 743 | } |
| 744 | /** Is this price in the checkout session. */ |
| 745 | isInOrder() { |
| 746 | return isPriceInOrder(this.price, this.order); |
| 747 | } |
| 748 | /** Is this checked */ |
| 749 | isChecked() { |
| 750 | return this.isInOrder(); |
| 751 | } |
| 752 | onChangeAdHoc(e) { |
| 753 | this.scUpdateLineItem.emit({ price_id: this.priceId, quantity: this.quantity, ad_hoc_amount: e.target.value }); |
| 754 | } |
| 755 | getLineItem() { |
| 756 | var _a, _b; |
| 757 | return (((_b = (_a = this.order) === null || _a === void 0 ? void 0 : _a.line_items) === null || _b === void 0 ? void 0 : _b.data) || []).find(lineItem => lineItem.price.id === this.priceId); |
| 758 | } |
| 759 | /** Show we show the ad hoc price box */ |
| 760 | showAdHoc() { |
| 761 | var _a, _b; |
| 762 | if (!((_a = this.price) === null || _a === void 0 ? void 0 : _a.ad_hoc)) { |
| 763 | return false; |
| 764 | } |
| 765 | if (this.isInOrder()) { |
| 766 | return true; |
| 767 | } |
| 768 | return (_b = this === null || this === void 0 ? void 0 : this.choice) === null || _b === void 0 ? void 0 : _b.checked; |
| 769 | } |
| 770 | renderEmpty() { |
| 771 | var _a; |
| 772 | if ((_a = window === null || window === void 0 ? void 0 : window.wp) === null || _a === void 0 ? void 0 : _a.blocks) { |
| 773 | return (h("sc-alert", { type: "danger", open: true, style: { margin: '0px' } }, wp.i18n.__('This product has been archived.', 'surecart'))); |
| 774 | } |
| 775 | return h(Host, { style: { display: 'none' } }); |
| 776 | } |
| 777 | renderPrice() { |
| 778 | return (h(Fragment, null, h("sc-format-number", { type: "currency", value: this.price.amount, currency: this.price.currency }), intervalString(this.price, { |
| 779 | showOnce: true, |
| 780 | abbreviate: true, |
| 781 | labels: { |
| 782 | interval: '/', |
| 783 | period: |
| 784 | /** translators: used as in time period: "for 3 months" */ |
| 785 | wp.i18n.__('for', 'surecart'), |
| 786 | }, |
| 787 | }))); |
| 788 | } |
| 789 | render() { |
| 790 | var _a, _b, _c, _d, _e, _f, _g, _h; |
| 791 | if (this.loading) { |
| 792 | return (h("sc-choice-container", { showControl: this.showControl, name: "loading", disabled: true }, h("div", { class: "price-choice" }, h("sc-skeleton", { style: { width: '60px', display: 'inline-block' } }), h("sc-skeleton", { style: { width: '80px', display: 'inline-block' } })))); |
| 793 | } |
| 794 | // we need an active price. |
| 795 | if (!((_a = this === null || this === void 0 ? void 0 : this.price) === null || _a === void 0 ? void 0 : _a.id) || ((_b = this.price) === null || _b === void 0 ? void 0 : _b.archived)) |
| 796 | return this.renderEmpty(); |
| 797 | // product needs to be active |
| 798 | if ((_c = this.product) === null || _c === void 0 ? void 0 : _c.archived) { |
| 799 | return this.renderEmpty(); |
| 800 | } |
| 801 | return (h("sc-choice-container", { ref: el => (this.choice = el), value: this.priceId, type: this.type, showControl: this.showControl, checked: this.isChecked() }, h("div", { class: "price-choice" }, this.showLabel && (h("div", { class: "price-choice__title" }, h("div", { class: "price-choice__name" }, this.label || ((_d = this === null || this === void 0 ? void 0 : this.price) === null || _d === void 0 ? void 0 : _d.name) || ((_e = this === null || this === void 0 ? void 0 : this.product) === null || _e === void 0 ? void 0 : _e.name)), !!this.description && h("div", { class: "price-choice__description" }, this.description))), this.showPrice && (h("div", { class: "price-choice__details" }, h("div", { class: "price-choice__price" }, ((_f = this.price) === null || _f === void 0 ? void 0 : _f.ad_hoc) ? (wp.i18n.__('Custom Amount', 'surecart')) : (h(Fragment, null, h("sc-format-number", { type: "currency", value: this.price.amount, currency: this.price.currency }), intervalString(this.price, { |
| 802 | showOnce: true, |
| 803 | abbreviate: true, |
| 804 | labels: { |
| 805 | interval: '/', |
| 806 | period: |
| 807 | /** translators: used as in time period: "for 3 months" */ |
| 808 | wp.i18n.__('for', 'surecart'), |
| 809 | }, |
| 810 | })))), !!this.price.trial_duration_days && (h("div", { class: "price-choice__trial" }, wp.i18n.sprintf(wp.i18n._n('Starting in %s day', 'Starting in %s days', this.price.trial_duration_days, 'surecart'), this.price.trial_duration_days))), !!this.price.setup_fee_enabled && ((_g = this.price) === null || _g === void 0 ? void 0 : _g.setup_fee_amount) && (h("div", { class: "price-choice__setup-fee" }, h("sc-format-number", { type: "currency", value: Math.abs(this.price.setup_fee_amount), currency: this.price.currency }), ' ', this.price.setup_fee_name || (((_h = this.price) === null || _h === void 0 ? void 0 : _h.setup_fee_amount) < 0 ? wp.i18n.__('Discount', 'surecart') : wp.i18n.__('Setup Fee', 'surecart'))))))))); |
| 811 | } |
| 812 | static get watchers() { return { |
| 813 | "priceId": ["handlePriceIdChage"], |
| 814 | "prices": ["handlePricesChange"], |
| 815 | "products": ["handlePricesChange"], |
| 816 | "price": ["handlePriseChange"], |
| 817 | "error": ["handleErrorsChange"], |
| 818 | "checked": ["handleCheckedChange"] |
| 819 | }; } |
| 820 | }; |
| 821 | openWormhole(ScPriceChoice, ['prices', 'products', 'order', 'error'], false); |
| 822 | ScPriceChoice.style = ScPriceChoiceStyle0; |
| 823 | |
| 824 | export { ScPriceChoice as sc_price_choice }; |
| 825 | |
| 826 | //# sourceMappingURL=sc-price-choice.entry.js.map |