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-subscription-details_2.entry.js
246 lines
| 1 | import { r as registerInstance, h, F as Fragment } from './index-745b6bec.js'; |
| 2 | import { a as apiFetch } from './fetch-e3c5d1b9.js'; |
| 3 | import { p as productNameWithPrice, i as intervalString } from './price-d5770168.js'; |
| 4 | import { a as addQueryArgs } from './add-query-args-0e2a8393.js'; |
| 5 | import './remove-query-args-938c53ea.js'; |
| 6 | import './currency-a0c9bff4.js'; |
| 7 | |
| 8 | function formatTime( |
| 9 | s, |
| 10 | options = { |
| 11 | timeStyle: 'medium', |
| 12 | dateStyle: 'full', |
| 13 | }, |
| 14 | locale = [] |
| 15 | ) { |
| 16 | const dtFormat = new Intl.DateTimeFormat(locale, options); |
| 17 | return dtFormat.format(new Date(s * 1000)); |
| 18 | } |
| 19 | |
| 20 | const maybeConvertAmount = (amount, currency) => { |
| 21 | return [ |
| 22 | 'BIF', |
| 23 | 'BYR', |
| 24 | 'CLP', |
| 25 | 'DJF', |
| 26 | 'GNF', |
| 27 | 'ISK', |
| 28 | 'JPY', |
| 29 | 'KMF', |
| 30 | 'KRW', |
| 31 | 'PYG', |
| 32 | 'RWF', |
| 33 | 'UGX', |
| 34 | 'VND', |
| 35 | 'VUV', |
| 36 | 'XAF', |
| 37 | 'XAG', |
| 38 | 'XAU', |
| 39 | 'XBA', |
| 40 | 'XBB', |
| 41 | 'XBC', |
| 42 | 'XBD', |
| 43 | 'XDR', |
| 44 | 'XOF', |
| 45 | 'XPD', |
| 46 | 'XPF', |
| 47 | 'XPT', |
| 48 | 'XTS', |
| 49 | ].includes(currency?.toUpperCase()) |
| 50 | ? amount |
| 51 | : amount / 100; |
| 52 | }; |
| 53 | |
| 54 | const formatNumber = (value, currency = '') => |
| 55 | new Intl.NumberFormat([], { |
| 56 | style: 'currency', |
| 57 | currency: currency.toUpperCase(), |
| 58 | currencyDisplay: 'symbol', |
| 59 | }).format(maybeConvertAmount(value, currency.toUpperCase())); |
| 60 | |
| 61 | const scSubscriptionDetailsCss = ":host{display:block}.subscription-details{display:grid;gap:0.25em;color:var(--sc-input-label-color)}.subscription-details__missing-method{display:flex;align-items:center;gap:var(--sc-spacing-x-small)}"; |
| 62 | const ScSubscriptionDetailsStyle0 = scSubscriptionDetailsCss; |
| 63 | |
| 64 | const ScSubscriptionDetails = class { |
| 65 | constructor(hostRef) { |
| 66 | registerInstance(this, hostRef); |
| 67 | this.subscription = undefined; |
| 68 | this.pendingPrice = undefined; |
| 69 | this.hideRenewalText = undefined; |
| 70 | this.activationsModal = undefined; |
| 71 | this.loading = undefined; |
| 72 | this.hasPendingUpdate = undefined; |
| 73 | } |
| 74 | renderName() { |
| 75 | var _a, _b, _c; |
| 76 | if (typeof ((_b = (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.price) === null || _b === void 0 ? void 0 : _b.product) !== 'string') { |
| 77 | return productNameWithPrice((_c = this.subscription) === null || _c === void 0 ? void 0 : _c.price); |
| 78 | } |
| 79 | return wp.i18n.__('Subscription', 'surecart'); |
| 80 | } |
| 81 | async handleSubscriptionChange() { |
| 82 | var _a, _b, _c, _d; |
| 83 | this.hasPendingUpdate = !!((_b = Object.keys(((_a = this === null || this === void 0 ? void 0 : this.subscription) === null || _a === void 0 ? void 0 : _a.pending_update) || {})) === null || _b === void 0 ? void 0 : _b.length); |
| 84 | if (((_d = (_c = this === null || this === void 0 ? void 0 : this.subscription) === null || _c === void 0 ? void 0 : _c.pending_update) === null || _d === void 0 ? void 0 : _d.price) && !(this === null || this === void 0 ? void 0 : this.pendingPrice) && !this.hideRenewalText) { |
| 85 | this.pendingPrice = await this.fetchPrice(this.subscription.pending_update.price); |
| 86 | } |
| 87 | } |
| 88 | componentWillLoad() { |
| 89 | this.handleSubscriptionChange(); |
| 90 | } |
| 91 | async fetchPrice(price_id) { |
| 92 | try { |
| 93 | this.loading = true; |
| 94 | const price = await apiFetch({ |
| 95 | path: addQueryArgs(`surecart/v1/prices/${price_id}`, { |
| 96 | expand: ['product'], |
| 97 | }), |
| 98 | }); |
| 99 | return price; |
| 100 | } |
| 101 | catch (e) { |
| 102 | console.error(e); |
| 103 | } |
| 104 | finally { |
| 105 | this.loading = false; |
| 106 | } |
| 107 | } |
| 108 | renderRenewalText() { |
| 109 | var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z; |
| 110 | const tag = h("sc-subscription-status-badge", { subscription: this === null || this === void 0 ? void 0 : this.subscription }); |
| 111 | if (((_a = this === null || this === void 0 ? void 0 : this.subscription) === null || _a === void 0 ? void 0 : _a.cancel_at_period_end) && ((_b = this === null || this === void 0 ? void 0 : this.subscription) === null || _b === void 0 ? void 0 : _b.current_period_end_at)) { |
| 112 | return (h("span", { "aria-label": wp.i18n.sprintf(wp.i18n.__('Renewal Update - Your plan will be canceled on %s', 'surecart'), formatTime(this.subscription.current_period_end_at)) }, tag, " ", wp.i18n.sprintf(wp.i18n.__('Your plan will be canceled on', 'surecart')), ' ', h("sc-format-date", { date: this.subscription.current_period_end_at * 1000, month: "long", day: "numeric", year: "numeric" }))); |
| 113 | } |
| 114 | if (this.hasPendingUpdate) { |
| 115 | if (!this.pendingPrice && !((_d = (_c = this.subscription) === null || _c === void 0 ? void 0 : _c.pending_update) === null || _d === void 0 ? void 0 : _d.ad_hoc_amount)) { |
| 116 | return h("sc-skeleton", null); |
| 117 | } |
| 118 | if ((_f = (_e = this.subscription) === null || _e === void 0 ? void 0 : _e.pending_update) === null || _f === void 0 ? void 0 : _f.ad_hoc_amount) { |
| 119 | return (h("span", { "aria-label": wp.i18n.sprintf(wp.i18n.__('Renewal Update - Your plan switches to %1s on %2s', 'surecart'), formatNumber((_h = (_g = this.subscription) === null || _g === void 0 ? void 0 : _g.pending_update) === null || _h === void 0 ? void 0 : _h.ad_hoc_amount, ((_j = this.pendingPrice) === null || _j === void 0 ? void 0 : _j.currency) || ((_l = (_k = this.subscription) === null || _k === void 0 ? void 0 : _k.price) === null || _l === void 0 ? void 0 : _l.currency)), formatTime(this.subscription.current_period_end_at)) }, wp.i18n.__('Your plan switches to', 'surecart'), ' ', h("strong", null, h("sc-format-number", { type: "currency", currency: ((_m = this.pendingPrice) === null || _m === void 0 ? void 0 : _m.currency) || ((_p = (_o = this.subscription) === null || _o === void 0 ? void 0 : _o.price) === null || _p === void 0 ? void 0 : _p.currency), value: (_r = (_q = this.subscription) === null || _q === void 0 ? void 0 : _q.pending_update) === null || _r === void 0 ? void 0 : _r.ad_hoc_amount }), ' ', intervalString(this.pendingPrice || ((_s = this.subscription) === null || _s === void 0 ? void 0 : _s.price))), ' ', wp.i18n.__('on', 'surecart'), ' ', h("sc-format-date", { date: this.subscription.current_period_end_at, type: "timestamp", month: "long", day: "numeric", year: "numeric" }))); |
| 120 | } |
| 121 | return (h("span", { "aria-label": wp.i18n.sprintf(wp.i18n.__('Renewal Update - Your plan switches to %1s on %2s', 'surecart'), this.pendingPrice.product.name, formatTime(this.subscription.current_period_end_at)) }, wp.i18n.__('Your plan switches to', 'surecart'), " ", h("strong", null, this.pendingPrice.product.name), " ", wp.i18n.__('on', 'surecart'), ' ', h("sc-format-date", { date: this.subscription.current_period_end_at, type: "timestamp", month: "long", day: "numeric", year: "numeric" }))); |
| 122 | } |
| 123 | if (((_t = this === null || this === void 0 ? void 0 : this.subscription) === null || _t === void 0 ? void 0 : _t.status) === 'trialing' && ((_u = this === null || this === void 0 ? void 0 : this.subscription) === null || _u === void 0 ? void 0 : _u.trial_end_at)) { |
| 124 | return (h("span", { "aria-label": wp.i18n.sprintf(wp.i18n.__('Renewal Update - Your plan begins on %s.', 'surecart'), formatTime(this.subscription.trial_end_at)) }, tag, " ", wp.i18n.sprintf(wp.i18n.__('Your plan begins on', 'surecart')), ' ', h("sc-format-date", { date: (_v = this === null || this === void 0 ? void 0 : this.subscription) === null || _v === void 0 ? void 0 : _v.trial_end_at, type: "timestamp", month: "long", day: "numeric", year: "numeric" }))); |
| 125 | } |
| 126 | if (((_w = this.subscription) === null || _w === void 0 ? void 0 : _w.status) === 'active' && ((_x = this.subscription) === null || _x === void 0 ? void 0 : _x.current_period_end_at)) { |
| 127 | return (h("span", { "aria-label": wp.i18n.sprintf(wp.i18n.__('Renewal Update - Your next payment is on %s', 'surecart'), formatTime(this.subscription.current_period_end_at)) }, tag, " ", ((_y = this.subscription) === null || _y === void 0 ? void 0 : _y.remaining_period_count) === null ? wp.i18n.__('Your plan renews on', 'surecart') : wp.i18n.__('Your next payment is on', 'surecart'), ' ', h("sc-format-date", { date: (_z = this === null || this === void 0 ? void 0 : this.subscription) === null || _z === void 0 ? void 0 : _z.current_period_end_at, type: "timestamp", month: "long", day: "numeric", year: "numeric" }))); |
| 128 | } |
| 129 | return tag; |
| 130 | } |
| 131 | getActivations() { |
| 132 | var _a, _b, _c, _d; |
| 133 | return (((_d = (_c = (_b = (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.purchase) === null || _b === void 0 ? void 0 : _b.license) === null || _c === void 0 ? void 0 : _c.activations) === null || _d === void 0 ? void 0 : _d.data) || []).filter(activation => { |
| 134 | return activation === null || activation === void 0 ? void 0 : activation.counted; |
| 135 | }); |
| 136 | } |
| 137 | renderActivations() { |
| 138 | var _a; |
| 139 | const activations = this.getActivations(); |
| 140 | if (!(activations === null || activations === void 0 ? void 0 : activations.length)) |
| 141 | return null; |
| 142 | return (h("sc-flex", { justifyContent: "flex-start", alignItems: "center" }, h("sc-tag", { size: "small" }, (_a = activations === null || activations === void 0 ? void 0 : activations[0]) === null || _a === void 0 ? void 0 : _a.name), (activations === null || activations === void 0 ? void 0 : activations.length) > 1 && (h("sc-text", { style: { '--font-size': 'var(--sc-font-size-small)', 'cursor': 'pointer' }, onClick: e => { |
| 143 | e.preventDefault(); |
| 144 | e.stopImmediatePropagation(); |
| 145 | this.activationsModal = true; |
| 146 | } }, "+ ", (activations === null || activations === void 0 ? void 0 : activations.length) - 1, " More")))); |
| 147 | } |
| 148 | showWarning() { |
| 149 | var _a, _b, _c, _d, _e, _f, _g; |
| 150 | // no payment method. |
| 151 | if (((_a = this.subscription) === null || _a === void 0 ? void 0 : _a.payment_method) || this.subscription.manual_payment) { |
| 152 | return false; |
| 153 | } |
| 154 | // don't show if not looking for payment. |
| 155 | if (!['active', 'past_due', 'unpaid', 'incomplete'].includes((_b = this.subscription) === null || _b === void 0 ? void 0 : _b.status)) { |
| 156 | return false; |
| 157 | } |
| 158 | // handle ad_hoc. |
| 159 | if ((_d = (_c = this.subscription) === null || _c === void 0 ? void 0 : _c.price) === null || _d === void 0 ? void 0 : _d.ad_hoc) { |
| 160 | return ((_e = this.subscription) === null || _e === void 0 ? void 0 : _e.ad_hoc_amount) !== 0; |
| 161 | } |
| 162 | // show the warning if the subscription is not free. |
| 163 | return ((_g = (_f = this.subscription) === null || _f === void 0 ? void 0 : _f.price) === null || _g === void 0 ? void 0 : _g.amount) !== 0; |
| 164 | } |
| 165 | render() { |
| 166 | return (h("div", { key: '4d4ed9bf1541784e4f5ee746d34f766b9b9ac301', class: "subscription-details" }, this.hasPendingUpdate && (h("div", { key: '9fa5b392a37790a44c4bcc47726df2e2e79d2aaa' }, h("sc-tag", { key: '63086d4a4b546118310dd053b9af9c5fbc7bfa31', size: "small", type: "warning" }, wp.i18n.__('Update Scheduled', 'surecart')))), h("sc-flex", { key: '36861a2bee8180fe9b2b064e7048c5e3e1241d48', alignItems: "center", justifyContent: "flex-start" }, h("sc-text", { key: 'c7794a9af51f6074eeb2a6513c2a8c860c9aa3bf', "aria-label": wp.i18n.sprintf(wp.i18n.__('Plan name - %s', 'surecart'), this.renderName()), style: { '--font-weight': 'var(--sc-font-weight-bold)' } }, this.renderName()), this.renderActivations()), !this.hideRenewalText && h("div", { key: 'cd04f79a6c1b9a279dcb1b517d6d204b1c1b4de1' }, this.renderRenewalText(), " "), h("slot", { key: '9038e7ac0a0d8556cabecc3154b02f9893c75961' }), h("sc-dialog", { key: 'b3ff1da2b2e8040e611f2e57ea8c4d19ac06acc7', label: wp.i18n.__('Activations', 'surecart'), onScRequestClose: () => (this.activationsModal = false), open: !!this.activationsModal }, h("sc-card", { key: '37a1c5869468bc8b7cc9c7c89ab24037ad428d73', "no-padding": true, style: { '--overflow': 'hidden' } }, h("sc-stacked-list", { key: 'be8e5015f3f5f611528b941c1c1b866b5bdb521a' }, (this.getActivations() || []).map(activation => { |
| 167 | return (h("sc-stacked-list-row", { style: { '--columns': '2' }, mobileSize: 0 }, h("sc-text", { style: { '--line-height': 'var(--sc-line-height-dense)' } }, h("strong", null, activation === null || activation === void 0 ? void 0 : activation.name), h("div", null, h("sc-text", { style: { '--color': 'var(--sc-color-gray-500)' } }, activation === null || activation === void 0 ? void 0 : activation.fingerprint))), h("sc-text", { style: { '--color': 'var(--sc-color-gray-500)' } }, h("sc-format-date", { type: "timestamp", month: "short", day: "numeric", year: "numeric", date: activation === null || activation === void 0 ? void 0 : activation.created_at })))); |
| 168 | })))), this.showWarning() && (h("div", { key: '8a0cf0724480a4f1f2b9a124ae88b192aba29789' }, h("sc-tag", { key: 'e616535fc8b1838285254a2098c655eef87bdc3b', type: "warning" }, h("div", { key: 'd3dfd9be61b4fe9d03bda7fdf1dddb4101664395', class: "subscription-details__missing-method" }, h("sc-icon", { key: '94ebae9b705047c9f503125cc61ed44010ab41d0', name: "alert-triangle" }), wp.i18n.__('Payment Method Missing', 'surecart'))))))); |
| 169 | } |
| 170 | static get watchers() { return { |
| 171 | "subscription": ["handleSubscriptionChange"] |
| 172 | }; } |
| 173 | }; |
| 174 | ScSubscriptionDetails.style = ScSubscriptionDetailsStyle0; |
| 175 | |
| 176 | const scSubscriptionStatusBadgeCss = ":host{display:inline-block}"; |
| 177 | const ScSubscriptionStatusBadgeStyle0 = scSubscriptionStatusBadgeCss; |
| 178 | |
| 179 | const ScSubscriptionStatusBadge = class { |
| 180 | constructor(hostRef) { |
| 181 | registerInstance(this, hostRef); |
| 182 | this.status = undefined; |
| 183 | this.subscription = undefined; |
| 184 | this.size = 'medium'; |
| 185 | this.pill = false; |
| 186 | this.clearable = false; |
| 187 | } |
| 188 | getType() { |
| 189 | var _a, _b, _c; |
| 190 | if ((_a = this.subscription) === null || _a === void 0 ? void 0 : _a.cancel_at_period_end) { |
| 191 | return 'info'; |
| 192 | } |
| 193 | switch (this.status || ((_b = this.subscription) === null || _b === void 0 ? void 0 : _b.status)) { |
| 194 | case 'incomplete': |
| 195 | return 'warning'; |
| 196 | case 'trialing': |
| 197 | return 'info'; |
| 198 | case 'active': |
| 199 | return 'success'; |
| 200 | case 'completed': |
| 201 | return 'success'; |
| 202 | case 'past_due': |
| 203 | return 'warning'; |
| 204 | case 'canceled': |
| 205 | if ((_c = this.subscription) === null || _c === void 0 ? void 0 : _c.restore_at) { |
| 206 | return 'info'; |
| 207 | } |
| 208 | return 'danger'; |
| 209 | case 'unpaid': |
| 210 | return 'warning'; |
| 211 | } |
| 212 | } |
| 213 | getText() { |
| 214 | var _a, _b, _c, _d, _e; |
| 215 | if (((_a = this.subscription) === null || _a === void 0 ? void 0 : _a.cancel_at_period_end) && this.subscription.current_period_end_at && ((_b = this.subscription) === null || _b === void 0 ? void 0 : _b.status) !== 'canceled') { |
| 216 | return (h(Fragment, null, !!((_c = this.subscription) === null || _c === void 0 ? void 0 : _c.restore_at) ? wp.i18n.__('Pauses', 'surecart') : wp.i18n.__('Cancels', 'surecart'), ' ', h("sc-format-date", { type: "timestamp", date: this.subscription.current_period_end_at, month: "short", day: "numeric" }))); |
| 217 | } |
| 218 | switch (this.status || ((_d = this.subscription) === null || _d === void 0 ? void 0 : _d.status)) { |
| 219 | case 'incomplete': |
| 220 | return wp.i18n.__('Incomplete', 'surecart'); |
| 221 | case 'trialing': |
| 222 | return wp.i18n.__('Trialing', 'surecart'); |
| 223 | case 'active': |
| 224 | return wp.i18n.__('Active', 'surecart'); |
| 225 | case 'past_due': |
| 226 | return wp.i18n.__('Past Due', 'surecart'); |
| 227 | case 'canceled': |
| 228 | if ((_e = this.subscription) === null || _e === void 0 ? void 0 : _e.restore_at) { |
| 229 | return 'Paused'; |
| 230 | } |
| 231 | return wp.i18n.__('Canceled', 'surecart'); |
| 232 | case 'completed': |
| 233 | return wp.i18n.__('Completed', 'surecart'); |
| 234 | case 'unpaid': |
| 235 | return wp.i18n.__('Unpaid', 'surecart'); |
| 236 | } |
| 237 | } |
| 238 | render() { |
| 239 | return (h("sc-tag", { key: 'ac726257f4a187f21321d97fdb60173a3b7ea03c', "aria-label": wp.i18n.sprintf(wp.i18n.__('Plan Status - %s', 'surecart'), this.getText()), type: this.getType() }, this.getText())); |
| 240 | } |
| 241 | }; |
| 242 | ScSubscriptionStatusBadge.style = ScSubscriptionStatusBadgeStyle0; |
| 243 | |
| 244 | export { ScSubscriptionDetails as sc_subscription_details, ScSubscriptionStatusBadge as sc_subscription_status_badge }; |
| 245 | |
| 246 | //# sourceMappingURL=sc-subscription-details_2.entry.js.map |