MockProcessor-5c5e066a.js
2 months ago
MockProcessor-5c5e066a.js.map
2 months ago
add-query-args-0e2a8393.js
1 year ago
add-query-args-0e2a8393.js.map
1 year ago
address-b8e2e4c8.js
4 months ago
address-b8e2e4c8.js.map
4 months ago
animation-registry-de37bd7e.js
3 months ago
animation-registry-de37bd7e.js.map
3 months ago
app-globals-0eef0276.js
2 months ago
app-globals-0eef0276.js.map
2 months ago
consumer-f1775a76.js
2 months ago
consumer-f1775a76.js.map
2 months ago
currency-a0c9bff4.js
1 year ago
currency-a0c9bff4.js.map
1 year ago
error-c8bf8e3e.js
1 week ago
error-c8bf8e3e.js.map
1 week ago
fetch-cdff67be.js
1 month ago
fetch-cdff67be.js.map
1 month ago
floating-ui.dom.esm-8dce4ea1.js
6 months ago
floating-ui.dom.esm-8dce4ea1.js.map
6 months ago
form-data-76641f16.js
1 year ago
form-data-76641f16.js.map
1 year ago
functions-4f009ce1.js
3 months ago
functions-4f009ce1.js.map
3 months ago
geo-permission-62aea8ee.js
1 month ago
geo-permission-62aea8ee.js.map
1 month ago
getters-1049a6f8.js
2 months ago
getters-1049a6f8.js.map
2 months ago
getters-1477d792.js
2 months ago
getters-1477d792.js.map
2 months ago
getters-4bb6cc1b.js
2 months ago
getters-4bb6cc1b.js.map
2 months ago
getters-7090a9c1.js
1 week ago
getters-7090a9c1.js.map
1 week ago
getters-9cfeb0de.js
1 week ago
getters-9cfeb0de.js.map
1 week ago
google-52867ad8.js
1 week ago
google-52867ad8.js.map
1 week ago
google-e9085e27.js
1 week ago
google-e9085e27.js.map
1 week ago
google-maps-e8b00ffd.js
3 months ago
google-maps-e8b00ffd.js.map
3 months ago
index-17aac936.js
1 month ago
index-17aac936.js.map
1 month ago
index-18f5a1bc.js
2 months ago
index-18f5a1bc.js.map
2 months ago
index-25e5af33.js
2 months ago
index-25e5af33.js.map
2 months ago
index-824c562b.js
2 months ago
index-824c562b.js.map
2 months ago
index-871d88b8.js
1 year ago
index-871d88b8.js.map
1 year ago
index-a786f689.js
1 week ago
index-a786f689.js.map
1 week ago
index-c5a96d53.js
2 years ago
index-c5a96d53.js.map
2 years ago
index-d602bc13.js
1 month ago
index-d602bc13.js.map
1 month ago
index.js
1 week ago
index.js.map
1 month 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-1bd957d5.js
2 months ago
library-1bd957d5.js.map
2 months ago
loader.js
2 weeks ago
loader.js.map
1 year ago
media-d21119a3.js
1 year ago
media-d21119a3.js.map
1 year ago
mutations-7458343f.js
2 months ago
mutations-7458343f.js.map
2 months ago
mutations-9ffd30f4.js
1 week ago
mutations-9ffd30f4.js.map
1 week ago
mutations-ae7167ad.js
1 week ago
mutations-ae7167ad.js.map
1 week ago
mutations-b310b068.js
1 week ago
mutations-b310b068.js.map
1 week ago
page-align-0cdacf32.js
1 year ago
page-align-0cdacf32.js.map
1 year ago
price-1ff6aa07.js
4 months ago
price-1ff6aa07.js.map
4 months ago
pure-963214cb.js
1 year ago
pure-963214cb.js.map
1 year ago
quantity-5c986f3d.js
3 months ago
quantity-5c986f3d.js.map
3 months ago
razorpay-4c4a3d31.js
3 months ago
razorpay-4c4a3d31.js.map
3 months ago
remove-query-args-938c53ea.js
1 year ago
remove-query-args-938c53ea.js.map
1 year ago
sc-address_5.entry.js
2 weeks ago
sc-address_5.entry.js.map
2 weeks ago
sc-alert.entry.js
1 month ago
sc-alert.entry.js.map
1 year ago
sc-avatar_2.entry.js
1 week ago
sc-avatar_2.entry.js.map
1 month ago
sc-badge-notice.entry.js
1 month ago
sc-badge-notice.entry.js.map
1 year ago
sc-block-ui.entry.js
1 month ago
sc-block-ui.entry.js.map
5 months ago
sc-breadcrumb.entry.js
1 month ago
sc-breadcrumb.entry.js.map
1 year ago
sc-breadcrumbs.entry.js
1 month ago
sc-breadcrumbs.entry.js.map
1 year ago
sc-button-group.entry.js
1 month ago
sc-button-group.entry.js.map
1 year ago
sc-button_6.entry.js
1 month ago
sc-button_6.entry.js.map
1 month ago
sc-cancel-dialog_3.entry.js
1 month ago
sc-cancel-dialog_3.entry.js.map
1 month ago
sc-cancel-discount_4.entry.js
1 month ago
sc-cancel-discount_4.entry.js.map
2 months ago
sc-card_2.entry.js
1 month ago
sc-card_2.entry.js.map
4 months ago
sc-cart-button.entry.js
1 week ago
sc-cart-button.entry.js.map
1 year ago
sc-cart-form-submit.entry.js
2 months ago
sc-cart-form-submit.entry.js.map
1 year ago
sc-cart-form.entry.js
1 week ago
sc-cart-form.entry.js.map
1 month ago
sc-cart-header.entry.js
1 week ago
sc-cart-header.entry.js.map
1 year ago
sc-cart-icon.entry.js
1 week ago
sc-cart-icon.entry.js.map
1 year ago
sc-cart-loader.entry.js
1 week ago
sc-cart-loader.entry.js.map
1 year ago
sc-cart-session-provider_3.entry.js
1 week ago
sc-cart-session-provider_3.entry.js.map
2 months ago
sc-cart-submit.entry.js
2 months ago
sc-cart-submit.entry.js.map
1 year ago
sc-cart.entry.js
1 week ago
sc-cart.entry.js.map
2 months ago
sc-cc-logo_2.entry.js
1 month ago
sc-cc-logo_2.entry.js.map
1 month ago
sc-charges-list.entry.js
1 month ago
sc-charges-list.entry.js.map
2 months ago
sc-checkout-autofill-provider_11.entry.js
1 week ago
sc-checkout-autofill-provider_11.entry.js.map
1 month ago
sc-checkout-form-errors.entry.js
2 months ago
sc-checkout-form-errors.entry.js.map
1 year ago
sc-checkout-mollie-payment_3.entry.js
1 week ago
sc-checkout-mollie-payment_3.entry.js.map
2 months ago
sc-checkout-product-bundle-component-variants.entry.js
1 week ago
sc-checkout-product-bundle-component-variants.entry.js.map
1 month ago
sc-checkout-product-price-variant-selector.entry.js
1 week ago
sc-checkout-product-price-variant-selector.entry.js.map
4 weeks ago
sc-checkout.entry.js
1 week ago
sc-checkout.entry.js.map
1 month ago
sc-choice-container.entry.js
1 month ago
sc-choice-container.entry.js.map
1 year ago
sc-choice.entry.js
1 month ago
sc-choice.entry.js.map
1 year ago
sc-choices.entry.js
1 month ago
sc-choices.entry.js.map
1 year ago
sc-column_2.entry.js
1 month ago
sc-column_2.entry.js.map
1 month ago
sc-compact-address_18.entry.js
1 week ago
sc-compact-address_18.entry.js.map
1 month ago
sc-conditional-form.entry.js
1 week ago
sc-conditional-form.entry.js.map
2 months ago
sc-consumer.entry.js
2 months ago
sc-consumer.entry.js.map
1 year ago
sc-coupon-form.entry.js
1 week ago
sc-coupon-form.entry.js.map
5 months ago
sc-custom-order-price-input.entry.js
1 month ago
sc-custom-order-price-input.entry.js.map
2 months ago
sc-customer-details.entry.js
1 month ago
sc-customer-details.entry.js.map
7 months ago
sc-customer-edit.entry.js
1 month ago
sc-customer-edit.entry.js.map
2 months ago
sc-customer-email.entry.js
1 week ago
sc-customer-email.entry.js.map
1 month ago
sc-customer-firstname.entry.js
1 week ago
sc-customer-firstname.entry.js.map
2 months ago
sc-customer-lastname.entry.js
1 week ago
sc-customer-lastname.entry.js.map
2 months ago
sc-customer-name.entry.js
1 week ago
sc-customer-name.entry.js.map
2 months ago
sc-dashboard-customer-details.entry.js
1 month ago
sc-dashboard-customer-details.entry.js.map
2 months ago
sc-dashboard-downloads-list.entry.js
1 month ago
sc-dashboard-downloads-list.entry.js.map
2 months ago
sc-dialog.entry.js
1 month ago
sc-dialog.entry.js.map
5 months ago
sc-divider.entry.js
1 month ago
sc-divider.entry.js.map
1 year ago
sc-donation-choices.entry.js
2 months ago
sc-donation-choices.entry.js.map
1 year ago
sc-downloads-list.entry.js
1 month ago
sc-downloads-list.entry.js.map
1 month ago
sc-dropdown_3.entry.js
1 month ago
sc-dropdown_3.entry.js.map
6 months ago
sc-empty_3.entry.js
1 month ago
sc-empty_3.entry.js.map
4 months ago
sc-express-payment.entry.js
1 week ago
sc-express-payment.entry.js.map
3 months ago
sc-feature-demo-banner.entry.js
1 month ago
sc-feature-demo-banner.entry.js.map
1 year ago
sc-flex.entry.js
1 month ago
sc-flex.entry.js.map
1 year ago
sc-form-control_2.entry.js
1 month ago
sc-form-control_2.entry.js.map
2 months ago
sc-form-row.entry.js
1 month ago
sc-form-row.entry.js.map
1 year ago
sc-form.entry.js
1 month ago
sc-form.entry.js.map
1 year ago
sc-format-bytes.entry.js
2 months ago
sc-format-bytes.entry.js.map
1 year ago
sc-format-interval.entry.js
2 months ago
sc-format-interval.entry.js.map
1 year ago
sc-format-number.entry.js
2 months ago
sc-format-number.entry.js.map
1 year ago
sc-fulfillment-shipping-status-badge.entry.js
2 months ago
sc-fulfillment-shipping-status-badge.entry.js.map
4 months ago
sc-fulfillments.entry.js
1 month ago
sc-fulfillments.entry.js.map
2 months ago
sc-heading_2.entry.js
1 month ago
sc-heading_2.entry.js.map
1 year ago
sc-image-slider.entry.js
1 month ago
sc-image-slider.entry.js.map
1 month ago
sc-invoice-status-badge.entry.js
1 month ago
sc-invoice-status-badge.entry.js.map
4 months ago
sc-invoices-list.entry.js
1 month ago
sc-invoices-list.entry.js.map
2 months ago
sc-license.entry.js
1 month ago
sc-license.entry.js.map
2 months ago
sc-licenses-list.entry.js
1 month ago
sc-licenses-list.entry.js.map
1 month ago
sc-line-item-bump.entry.js
1 week ago
sc-line-item-bump.entry.js.map
1 year ago
sc-line-item-total.entry.js
1 week ago
sc-line-item-total.entry.js.map
6 months ago
sc-line-item.entry.js
1 month ago
sc-line-item.entry.js.map
1 year ago
sc-line-items-provider.entry.js
1 month ago
sc-line-items-provider.entry.js.map
1 year ago
sc-line-items.entry.js
1 week ago
sc-line-items.entry.js.map
1 month ago
sc-login-form.entry.js
1 month ago
sc-login-form.entry.js.map
2 months ago
sc-manual-payment-method_3.entry.js
1 month ago
sc-manual-payment-method_3.entry.js.map
3 months ago
sc-menu-divider.entry.js
1 month ago
sc-menu-divider.entry.js.map
1 year ago
sc-menu-label_2.entry.js
1 month ago
sc-menu-label_2.entry.js.map
1 month ago
sc-mollie-add-method.entry.js
1 month ago
sc-mollie-add-method.entry.js.map
2 months ago
sc-order-confirmation-customer.entry.js
2 months ago
sc-order-confirmation-customer.entry.js.map
1 year ago
sc-order-confirmation-details.entry.js
2 months ago
sc-order-confirmation-details.entry.js.map
11 months ago
sc-order-confirmation-line-items_2.entry.js
1 month ago
sc-order-confirmation-line-items_2.entry.js.map
1 month ago
sc-order-confirmation.entry.js
1 month ago
sc-order-confirmation.entry.js.map
2 months ago
sc-order-coupon-form.entry.js
1 week ago
sc-order-coupon-form.entry.js.map
2 months ago
sc-order-detail.entry.js
2 months ago
sc-order-detail.entry.js.map
1 year ago
sc-order-fulfillment-badge.entry.js
1 month ago
sc-order-fulfillment-badge.entry.js.map
4 months ago
sc-order-manual-instructions.entry.js
2 months ago
sc-order-manual-instructions.entry.js.map
1 year ago
sc-order-password.entry.js
2 months ago
sc-order-password.entry.js.map
1 year ago
sc-order-return-badge.entry.js
1 month ago
sc-order-return-badge.entry.js.map
4 months ago
sc-order-shipment-badge.entry.js
2 months ago
sc-order-shipment-badge.entry.js.map
4 months ago
sc-order-status-badge.entry.js
1 month ago
sc-order-status-badge.entry.js.map
4 months ago
sc-order-submit.entry.js
1 week ago
sc-order-submit.entry.js.map
2 months ago
sc-order-summary.entry.js
1 week ago
sc-order-summary.entry.js.map
1 month ago
sc-order.entry.js
1 month ago
sc-order.entry.js.map
1 month ago
sc-orders-list.entry.js
1 month ago
sc-orders-list.entry.js.map
1 month ago
sc-pagination.entry.js
2 months ago
sc-pagination.entry.js.map
1 year ago
sc-password-nag.entry.js
1 month ago
sc-password-nag.entry.js.map
2 months ago
sc-password.entry.js
1 month ago
sc-password.entry.js.map
1 month ago
sc-payment-method-choice_2.entry.js
1 month ago
sc-payment-method-choice_2.entry.js.map
1 year ago
sc-payment-method-details.entry.js
1 month ago
sc-payment-method-details.entry.js.map
1 year ago
sc-payment-methods-list.entry.js
1 month ago
sc-payment-methods-list.entry.js.map
2 months ago
sc-payment.entry.js
1 week ago
sc-payment.entry.js.map
3 months ago
sc-paypal-add-method.entry.js
1 month ago
sc-paypal-add-method.entry.js.map
2 months ago
sc-paypal-buttons_2.entry.js
1 week ago
sc-paypal-buttons_2.entry.js.map
2 months ago
sc-paystack-add-method.entry.js
1 month ago
sc-paystack-add-method.entry.js.map
2 months ago
sc-pill-option.entry.js
1 month ago
sc-pill-option.entry.js.map
1 year ago
sc-popover.entry.js
1 month ago
sc-popover.entry.js.map
6 months ago
sc-premium-tag.entry.js
1 month ago
sc-premium-tag.entry.js.map
1 year ago
sc-price-choice-container.entry.js
1 month ago
sc-price-choice-container.entry.js.map
1 month ago
sc-price-choice.entry.js
1 month ago
sc-price-choice.entry.js.map
2 months ago
sc-price-choices.entry.js
1 week ago
sc-price-choices.entry.js.map
1 year ago
sc-price-input.entry.js
1 month ago
sc-price-input.entry.js.map
1 year ago
sc-price-range_4.entry.js
1 month ago
sc-price-range_4.entry.js.map
1 year ago
sc-price.entry.js
2 months ago
sc-price.entry.js.map
11 months ago
sc-product-buy-button.entry.js
1 week ago
sc-product-buy-button.entry.js.map
2 months ago
sc-product-donation-amount-choice.entry.js
1 week ago
sc-product-donation-amount-choice.entry.js.map
2 months ago
sc-product-donation-choices.entry.js
1 week ago
sc-product-donation-choices.entry.js.map
2 months ago
sc-product-donation-custom-amount.entry.js
1 week ago
sc-product-donation-custom-amount.entry.js.map
2 months ago
sc-product-item-list.entry.js
1 week ago
sc-product-item-list.entry.js.map
2 months ago
sc-product-item.entry.js
1 month ago
sc-product-item.entry.js.map
1 year ago
sc-product-pills-variant-option.entry.js
1 week ago
sc-product-pills-variant-option.entry.js.map
1 year ago
sc-product-price-choices.entry.js
1 week ago
sc-product-price-choices.entry.js.map
1 year ago
sc-product-price-modal.entry.js
1 week ago
sc-product-price-modal.entry.js.map
2 months ago
sc-product-price.entry.js
1 week ago
sc-product-price.entry.js.map
2 months ago
sc-product-quantity.entry.js
1 week ago
sc-product-quantity.entry.js.map
1 year ago
sc-product-selected-price.entry.js
1 week ago
sc-product-selected-price.entry.js.map
2 months ago
sc-product-text.entry.js
1 week ago
sc-product-text.entry.js.map
1 year ago
sc-provider.entry.js
2 months ago
sc-provider.entry.js.map
1 year ago
sc-provisional-banner.entry.js
1 month ago
sc-provisional-banner.entry.js.map
11 months ago
sc-purchase-downloads-list.entry.js
1 month ago
sc-purchase-downloads-list.entry.js.map
1 month ago
sc-razorpay-add-method.entry.js
1 month ago
sc-razorpay-add-method.entry.js.map
2 months ago
sc-recurring-price-choice-container.entry.js
2 months ago
sc-recurring-price-choice-container.entry.js.map
1 year ago
sc-review-stars.entry.js
2 months ago
sc-review-stars.entry.js.map
6 months ago
sc-rich-text.entry.js
1 month ago
sc-rich-text.entry.js.map
1 month ago
sc-skeleton.entry.js
1 month ago
sc-skeleton.entry.js.map
1 year ago
sc-spacing.entry.js
1 month ago
sc-spacing.entry.js.map
1 year ago
sc-stripe-add-method.entry.js
1 month ago
sc-stripe-add-method.entry.js.map
2 months ago
sc-stripe-element.entry.js
1 week ago
sc-stripe-element.entry.js.map
2 months ago
sc-stripe-payment-element.entry.js
1 week ago
sc-stripe-payment-element.entry.js.map
2 months ago
sc-stripe-payment-request.entry.js
1 week ago
sc-stripe-payment-request.entry.js.map
2 months ago
sc-subscription-ad-hoc-confirm.entry.js
1 month ago
sc-subscription-ad-hoc-confirm.entry.js.map
6 months ago
sc-subscription-details_2.entry.js
1 month ago
sc-subscription-details_2.entry.js.map
1 month ago
sc-subscription-payment-method.entry.js
1 month ago
sc-subscription-payment-method.entry.js.map
2 months ago
sc-subscription-payment.entry.js
1 month ago
sc-subscription-payment.entry.js.map
2 months ago
sc-subscription-switch.entry.js
1 month ago
sc-subscription-switch.entry.js.map
2 months ago
sc-subscription-variation-confirm.entry.js
1 month ago
sc-subscription-variation-confirm.entry.js.map
1 year ago
sc-subscription.entry.js
1 month ago
sc-subscription.entry.js.map
1 month ago
sc-subscriptions-list.entry.js
1 month ago
sc-subscriptions-list.entry.js.map
2 months ago
sc-summary.entry.js
1 month ago
sc-summary.entry.js.map
1 year ago
sc-swap.entry.js
1 week ago
sc-swap.entry.js.map
2 months ago
sc-switch.entry.js
1 month ago
sc-switch.entry.js.map
7 months ago
sc-tab-group.entry.js
1 month ago
sc-tab-group.entry.js.map
1 year ago
sc-tab-panel.entry.js
1 month ago
sc-tab-panel.entry.js.map
1 year ago
sc-tab.entry.js
1 month ago
sc-tab.entry.js.map
1 year ago
sc-table-head.entry.js
1 month ago
sc-table-head.entry.js.map
1 year ago
sc-table_3.entry.js
1 month ago
sc-table_3.entry.js.map
10 months ago
sc-tag.entry.js
1 month ago
sc-tag.entry.js.map
4 months ago
sc-test-mode-info.entry.js
1 month ago
sc-test-mode-info.entry.js.map
6 months ago
sc-text.entry.js
1 month ago
sc-text.entry.js.map
1 year ago
sc-toggle.entry.js
1 month ago
sc-toggle.entry.js.map
1 year ago
sc-toggles.entry.js
1 month ago
sc-toggles.entry.js.map
1 year ago
sc-total.entry.js
1 week ago
sc-total.entry.js.map
1 year ago
sc-upcoming-invoice.entry.js
1 month ago
sc-upcoming-invoice.entry.js.map
2 months ago
sc-upgrade-required.entry.js
2 months ago
sc-upgrade-required.entry.js.map
1 year ago
sc-upsell-countdown-timer.entry.js
1 month ago
sc-upsell-countdown-timer.entry.js.map
1 year ago
sc-upsell-no-thanks-button.entry.js
1 week ago
sc-upsell-no-thanks-button.entry.js.map
2 months ago
sc-upsell-submit-button.entry.js
1 week ago
sc-upsell-submit-button.entry.js.map
2 months ago
sc-upsell-totals.entry.js
1 week ago
sc-upsell-totals.entry.js.map
2 months ago
sc-upsell.entry.js
1 week ago
sc-upsell.entry.js.map
2 months ago
sc-verification-code.entry.js
1 month ago
sc-verification-code.entry.js.map
2 months ago
sc-visually-hidden.entry.js
1 month ago
sc-visually-hidden.entry.js.map
1 year ago
sc-wordpress-password-edit.entry.js
1 month ago
sc-wordpress-password-edit.entry.js.map
2 months ago
sc-wordpress-user-edit.entry.js
1 month ago
sc-wordpress-user-edit.entry.js.map
2 months ago
sc-wordpress-user.entry.js
1 month ago
sc-wordpress-user.entry.js.map
1 year ago
store-289e460c.js
2 months ago
store-289e460c.js.map
2 months ago
store-ac90a769.js
1 month ago
store-ac90a769.js.map
1 month ago
store-b1758b00.js
2 months ago
store-b1758b00.js.map
2 months ago
surecart.js
2 weeks ago
surecart.js.map
1 year ago
tax-a03623ca.js
1 year ago
tax-a03623ca.js.map
1 year ago
universe-7bd0ac2b.js
2 months ago
universe-7bd0ac2b.js.map
2 months ago
util-dfbf863e.js
2 months ago
util-dfbf863e.js.map
2 months ago
utils-f84b2118.js
3 months ago
utils-f84b2118.js.map
3 months ago
verification-00df9439.js
1 month ago
verification-00df9439.js.map
1 month ago
watchers-2d9a1422.js
1 week ago
watchers-2d9a1422.js.map
1 week ago
watchers-81f32d01.js
1 week ago
watchers-81f32d01.js.map
1 week ago
watchers-843c3dbe.js
1 week ago
watchers-843c3dbe.js.map
1 week ago
watchers-c7bbc6b2.js
2 months ago
watchers-c7bbc6b2.js.map
2 months ago
watchers-df374a91.js
1 week ago
watchers-df374a91.js.map
1 week ago
sc-cancel-discount_4.entry.js
431 lines
| 1 | import { r as registerInstance, c as createEvent, h, F as Fragment, a as getElement } from './index-25e5af33.js'; |
| 2 | import './fetch-cdff67be.js'; |
| 3 | import { a as getHumanDiscount } from './price-1ff6aa07.js'; |
| 4 | import { a as addQueryArgs } from './add-query-args-0e2a8393.js'; |
| 5 | import { a as apiFetch } from './index-824c562b.js'; |
| 6 | import { F as FormSubmitController } from './form-data-76641f16.js'; |
| 7 | import './remove-query-args-938c53ea.js'; |
| 8 | import './currency-a0c9bff4.js'; |
| 9 | |
| 10 | /** |
| 11 | * Replace the {{ name }} in a string with a new value |
| 12 | */ |
| 13 | const replaceAmount = (string, replace, name = 'amount') => { |
| 14 | return string.replaceAll('{{' + name + '}}', replace).replaceAll('{{ ' + name + ' }}', replace); |
| 15 | }; |
| 16 | /** |
| 17 | * Replace the amount in a string with discount. |
| 18 | */ |
| 19 | const replaceAmountFromString = (amountStr, protocol) => (protocol === null || protocol === void 0 ? void 0 : protocol.preservation_coupon) ? replaceAmount(amountStr, getHumanDiscount(protocol === null || protocol === void 0 ? void 0 : protocol.preservation_coupon)) : amountStr; |
| 20 | /** |
| 21 | * |
| 22 | */ |
| 23 | const getCurrentBehaviourContent = (protocol, hasDiscount) => { |
| 24 | const { preserve_title, preserve_description, preserve_button, cancel_link } = (protocol === null || protocol === void 0 ? void 0 : protocol.preservation_locales) || {}; |
| 25 | if (hasDiscount) { |
| 26 | const discountLocales = { |
| 27 | title: replaceAmountFromString(wp.i18n.__('Your {{ amount }} discount is still active.', 'surecart'), protocol), |
| 28 | description: replaceAmountFromString(wp.i18n.__('You have a {{ amount }} discount active. Cancelling now will forfeit this discount forever. Are you sure you wish to cancel?', 'surecart'), protocol), |
| 29 | button: wp.i18n.__('Keep My Discount', 'surecart'), |
| 30 | cancel_link: wp.i18n.__('Cancel Anyway', 'surecart'), |
| 31 | }; |
| 32 | return discountLocales; |
| 33 | } |
| 34 | const defaultLocales = { |
| 35 | title: replaceAmountFromString(preserve_title, protocol), |
| 36 | description: replaceAmountFromString(preserve_description, protocol), |
| 37 | button: preserve_button, |
| 38 | cancel_link: cancel_link, |
| 39 | }; |
| 40 | return defaultLocales; |
| 41 | }; |
| 42 | |
| 43 | const scCancelDiscountCss = ".cancel-discount__abort-link{color:var(--sc-input-help-text-color)}"; |
| 44 | const ScCancelDiscountStyle0 = scCancelDiscountCss; |
| 45 | |
| 46 | const ScCancelDiscount = class { |
| 47 | constructor(hostRef) { |
| 48 | registerInstance(this, hostRef); |
| 49 | this.scCancel = createEvent(this, "scCancel", 7); |
| 50 | this.scPreserved = createEvent(this, "scPreserved", 7); |
| 51 | this.subscription = undefined; |
| 52 | this.reason = undefined; |
| 53 | this.comment = undefined; |
| 54 | this.protocol = undefined; |
| 55 | this.loading = undefined; |
| 56 | this.error = undefined; |
| 57 | } |
| 58 | async addDiscount() { |
| 59 | var _a, _b; |
| 60 | try { |
| 61 | this.loading = true; |
| 62 | this.subscription = (await apiFetch({ |
| 63 | method: 'PATCH', |
| 64 | path: addQueryArgs(`surecart/v1/subscriptions/${(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.id}/preserve`, { |
| 65 | cancellation_act: { |
| 66 | ...(!!this.comment ? { comment: this.comment } : {}), |
| 67 | cancellation_reason_id: (_b = this.reason) === null || _b === void 0 ? void 0 : _b.id, |
| 68 | }, |
| 69 | }), |
| 70 | })); |
| 71 | this.scPreserved.emit(); |
| 72 | } |
| 73 | catch (e) { |
| 74 | console.error(e); |
| 75 | this.error = e; |
| 76 | } |
| 77 | finally { |
| 78 | this.loading = false; |
| 79 | } |
| 80 | } |
| 81 | hasDiscount() { |
| 82 | var _a, _b; |
| 83 | return !!((_b = (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.discount) === null || _b === void 0 ? void 0 : _b.id); |
| 84 | } |
| 85 | render() { |
| 86 | var _a, _b; |
| 87 | const { title, description, button, cancel_link } = getCurrentBehaviourContent(this.protocol, (_b = (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.discount) === null || _b === void 0 ? void 0 : _b.id); |
| 88 | return (h("div", { key: 'f475776785d88156748e76fa0dbdbbe92c46c18f', class: "cancel-discount" }, h("sc-dashboard-module", { key: 'f5ccc3a5c3c126b944ecfb911a31e76fe5d6c370', heading: title, style: { '--sc-dashboard-module-spacing': '2em' } }, h("span", { key: '6f22f03d47845c33857b0be9f19d0b314aa88d33', slot: "description" }, description), h("sc-flex", { key: '47018fb1dfbb5e22919dec6a8d65ebfd4c435eb0', justifyContent: "flex-start" }, h("sc-button", { key: 'fec7d85439d197373aed86bfc46336ae113539ee', type: "primary", onClick: () => this.addDiscount() }, button), h("sc-button", { key: '5850cee34d4985ec4d9cf03a45794eed0125aec2', class: "cancel-discount__abort-link", type: "text", onClick: () => this.scCancel.emit() }, cancel_link)), !!this.loading && h("sc-block-ui", { key: '265fde6ecb1ef2ecbe5a66754c4c27088360138e', spinner: true })))); |
| 89 | } |
| 90 | }; |
| 91 | ScCancelDiscount.style = ScCancelDiscountStyle0; |
| 92 | |
| 93 | const scCancelSurveyCss = ".cancel-survey__abort-link{color:var(--sc-input-help-text-color)}"; |
| 94 | const ScCancelSurveyStyle0 = scCancelSurveyCss; |
| 95 | |
| 96 | const ScCancelSurvey = class { |
| 97 | constructor(hostRef) { |
| 98 | registerInstance(this, hostRef); |
| 99 | this.scAbandon = createEvent(this, "scAbandon", 7); |
| 100 | this.scSubmitReason = createEvent(this, "scSubmitReason", 7); |
| 101 | this.protocol = undefined; |
| 102 | this.reasons = undefined; |
| 103 | this.loading = undefined; |
| 104 | this.selectedReason = undefined; |
| 105 | this.comment = undefined; |
| 106 | this.error = undefined; |
| 107 | } |
| 108 | componentWillLoad() { |
| 109 | if (!this.reasons) { |
| 110 | this.fetchReasons(); |
| 111 | } |
| 112 | } |
| 113 | handleSelectedReasonChange() { |
| 114 | var _a; |
| 115 | if ((_a = this.selectedReason) === null || _a === void 0 ? void 0 : _a.comment_enabled) { |
| 116 | setTimeout(() => { |
| 117 | this.textArea.triggerFocus(); |
| 118 | }, 50); |
| 119 | } |
| 120 | } |
| 121 | async fetchReasons() { |
| 122 | try { |
| 123 | this.loading = true; |
| 124 | this.reasons = await apiFetch({ |
| 125 | path: 'surecart/v1/cancellation_reasons', |
| 126 | }); |
| 127 | } |
| 128 | catch (e) { |
| 129 | console.error(e); |
| 130 | this.error = e; |
| 131 | } |
| 132 | finally { |
| 133 | this.loading = false; |
| 134 | } |
| 135 | } |
| 136 | async handleSubmit(e) { |
| 137 | e.preventDefault(); |
| 138 | e.stopImmediatePropagation(); |
| 139 | try { |
| 140 | this.scSubmitReason.emit({ reason: this.selectedReason, comment: this.comment }); |
| 141 | } |
| 142 | catch (e) { |
| 143 | console.error(e); |
| 144 | this.error = e; |
| 145 | } |
| 146 | } |
| 147 | renderReasons() { |
| 148 | if (this.loading) { |
| 149 | return (h("sc-choice", null, h("sc-skeleton", null))); |
| 150 | } |
| 151 | return (this.reasons || []).map(reason => (h("sc-choice", { value: reason === null || reason === void 0 ? void 0 : reason.id, name: "reason", onScChange: e => { |
| 152 | if (e.target.checked) { |
| 153 | this.selectedReason = reason; |
| 154 | } |
| 155 | } }, reason === null || reason === void 0 ? void 0 : reason.label))); |
| 156 | } |
| 157 | render() { |
| 158 | var _a, _b, _c; |
| 159 | const { reasons_title, reasons_description, skip_link } = ((_a = this.protocol) === null || _a === void 0 ? void 0 : _a.preservation_locales) || {}; |
| 160 | if (this.loading) { |
| 161 | return h("sc-skeleton", null); |
| 162 | } |
| 163 | return (h("div", { class: "cancel-survey" }, h("sc-dashboard-module", { heading: reasons_title, style: { '--sc-dashboard-module-spacing': '2em' } }, h("span", { slot: "description" }, reasons_description), h("sc-form", { onScSubmit: e => this.handleSubmit(e), style: { '--sc-form-row-spacing': '2em' } }, h("sc-choices", { showLabel: false, label: wp.i18n.__('Choose a reason', 'surecart'), style: { '--columns': '2' }, required: true }, this.renderReasons()), ((_b = this.selectedReason) === null || _b === void 0 ? void 0 : _b.comment_enabled) && (h("sc-textarea", { label: ((_c = this.selectedReason) === null || _c === void 0 ? void 0 : _c.comment_prompt) || wp.i18n.__('Additional Comments', 'surecart'), required: true, ref: el => (this.textArea = el), onScInput: e => (this.comment = e.target.value) })), h("sc-flex", { justifyContent: "flex-start" }, h("sc-button", { type: "primary", submit: true }, wp.i18n.__('Continue', 'surecart'), h("sc-icon", { name: "arrow-right", slot: "suffix" })), !!skip_link && (h("sc-button", { class: "cancel-survey__abort-link", type: "text", onClick: () => this.scAbandon.emit() }, skip_link))))))); |
| 164 | } |
| 165 | static get watchers() { return { |
| 166 | "selectedReason": ["handleSelectedReasonChange"] |
| 167 | }; } |
| 168 | }; |
| 169 | ScCancelSurvey.style = ScCancelSurveyStyle0; |
| 170 | |
| 171 | const scSubscriptionCancelCss = ":host{display:block;position:relative}.subscription-cancel{display:grid;gap:0.5em}.subscription-cancel__terms{color:var(--sc-input-help-text-color);font-size:var(--sc-font-size-small)}"; |
| 172 | const ScSubscriptionCancelStyle0 = scSubscriptionCancelCss; |
| 173 | |
| 174 | const ScSubscriptionCancel = class { |
| 175 | constructor(hostRef) { |
| 176 | registerInstance(this, hostRef); |
| 177 | this.scAbandon = createEvent(this, "scAbandon", 7); |
| 178 | this.scCancelled = createEvent(this, "scCancelled", 7); |
| 179 | this.heading = undefined; |
| 180 | this.backUrl = undefined; |
| 181 | this.successUrl = undefined; |
| 182 | this.subscription = undefined; |
| 183 | this.protocol = undefined; |
| 184 | this.reason = undefined; |
| 185 | this.comment = undefined; |
| 186 | this.loading = undefined; |
| 187 | this.busy = undefined; |
| 188 | this.error = undefined; |
| 189 | } |
| 190 | async cancelSubscription() { |
| 191 | var _a, _b; |
| 192 | try { |
| 193 | this.error = ''; |
| 194 | this.busy = true; |
| 195 | await apiFetch({ |
| 196 | path: addQueryArgs(`/surecart/v1/subscriptions/${(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.id}/cancel`, { |
| 197 | cancellation_act: { |
| 198 | ...(!!this.comment ? { comment: this.comment } : {}), |
| 199 | cancellation_reason_id: (_b = this.reason) === null || _b === void 0 ? void 0 : _b.id, |
| 200 | }, |
| 201 | }), |
| 202 | method: 'PATCH', |
| 203 | }); |
| 204 | this.scCancelled.emit(); |
| 205 | } |
| 206 | catch (e) { |
| 207 | this.error = (e === null || e === void 0 ? void 0 : e.message) || wp.i18n.__('Something went wrong', 'surecart'); |
| 208 | this.busy = false; |
| 209 | } |
| 210 | } |
| 211 | renderContent() { |
| 212 | var _a, _b; |
| 213 | if (this.loading) { |
| 214 | return this.renderLoading(); |
| 215 | } |
| 216 | return (h(Fragment, null, ((_a = this === null || this === void 0 ? void 0 : this.protocol) === null || _a === void 0 ? void 0 : _a.cancel_behavior) === 'pending' ? (h(Fragment, null, wp.i18n.__('Your plan will be canceled, but is still available until the end of your billing period on', 'surecart'), ' ', h("strong", null, (_b = this === null || this === void 0 ? void 0 : this.subscription) === null || _b === void 0 ? void 0 : _b.current_period_end_at_date), ". ", wp.i18n.__('If you change your mind, you can renew your subscription.', 'surecart'))) : (h(Fragment, null, wp.i18n.__('Your plan will be canceled immediately and cannot be modified later.', 'surecart'))))); |
| 217 | } |
| 218 | renderLoading() { |
| 219 | return (h("div", { style: { padding: '0.5em' } }, h("sc-skeleton", { style: { width: '30%', marginBottom: '0.75em' } }), h("sc-skeleton", { style: { width: '20%', marginBottom: '0.75em' } }), h("sc-skeleton", { style: { width: '40%' } }))); |
| 220 | } |
| 221 | render() { |
| 222 | var _a, _b; |
| 223 | let heading = this.heading || wp.i18n.__('Cancel your plan', 'surecart'); |
| 224 | let cancelButtonText = wp.i18n.__('Cancel Plan', 'surecart'); |
| 225 | let keepButtonText = wp.i18n.__('Keep My Plan', 'surecart'); |
| 226 | let content = this.renderContent(); |
| 227 | if ((_b = (_a = window === null || window === void 0 ? void 0 : window.wp) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.applyFilters) { |
| 228 | heading = window.wp.hooks.applyFilters('surecart_dashboard_subscription_cancel_popup_heading', heading, this === null || this === void 0 ? void 0 : this.subscription); |
| 229 | cancelButtonText = window.wp.hooks.applyFilters('surecart_dashboard_subscription_cancel_popup_cancel_button_text', cancelButtonText, this === null || this === void 0 ? void 0 : this.subscription); |
| 230 | keepButtonText = window.wp.hooks.applyFilters('surecart_dashboard_subscription_cancel_popup_keep_button_text', keepButtonText, this === null || this === void 0 ? void 0 : this.subscription); |
| 231 | content = window.wp.hooks.applyFilters('surecart_dashboard_subscription_cancel_popup_content', content, this === null || this === void 0 ? void 0 : this.subscription); |
| 232 | } |
| 233 | return (h("sc-dashboard-module", { key: '2ab232987ba6a6c549a5ede203c66dc64719a022', heading: heading, class: "subscription-cancel", error: this.error, style: { '--sc-dashboard-module-spacing': '1em' } }, h("div", { key: '1650111f3e5d498592b5cf8c8dd6267428b75f4b', slot: "description" }, content, h("slot", { key: 'e17ff0f1a64014b68f5df53141841a4177479540', name: "cancel-popup-content" })), h("sc-flex", { key: 'fbfbdea23a3a41b9edd5f1c514d3645d7cf689ed', justifyContent: "flex-start" }, h("sc-button", { key: '1551fe6e6fb3c871854eff9408d2993ea81783db', type: "primary", loading: this.loading || this.busy, disabled: this.loading || this.busy, onClick: () => this.cancelSubscription() }, cancelButtonText), h("sc-button", { key: '259bec891dcc6e0b09f7101eb2898d7905e3913d', type: "text", onClick: () => this.scAbandon.emit(), loading: this.loading || this.busy, disabled: this.loading || this.busy }, keepButtonText)), this.busy && h("sc-block-ui", { key: '6522bf5c93ca5cc4dc4da58aa39c61848666b8f7' }))); |
| 234 | } |
| 235 | }; |
| 236 | ScSubscriptionCancel.style = ScSubscriptionCancelStyle0; |
| 237 | |
| 238 | const scTextareaCss = ":host{display:block}.textarea{display:flex;align-items:center;position:relative;width:100%;font-family:var(--sc-input-font-family);font-weight:var(--sc-input-font-weight);line-height:var(--sc-line-height-normal);letter-spacing:var(--sc-input-letter-spacing);vertical-align:middle;transition:var(--sc-input-transition, var(--sc-transition-medium)) color, var(--sc-input-transition, var(--sc-transition-medium)) border, var(--sc-input-transition, var(--sc-transition-medium)) box-shadow,\n var(--sc-input-transition, var(--sc-transition-medium)) background-color;cursor:text}.textarea--standard{background-color:var(--sc-input-background-color);border:solid var(--sc-input-border-width) var(--sc-input-border-color)}.textarea--standard:hover:not(.textarea--disabled){background-color:var(--sc-input-background-color-hover);border-color:var(--sc-input-border-color-hover)}.textarea--standard:hover:not(.textarea--disabled) .textarea__control{color:var(--sc-input-color-hover)}.textarea--standard.textarea--focused:not(.textarea--disabled){background-color:var(--sc-input-background-color-focus);border-color:var(--sc-input-border-color-focus);color:var(--sc-input-color-focus);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-input-focus-ring-color)}.textarea--standard.textarea--focused:not(.textarea--disabled) .textarea__control{color:var(--sc-input-color-focus)}.textarea--standard.textarea--disabled{background-color:var(--sc-input-background-color-disabled);border-color:var(--sc-input-border-color-disabled);opacity:0.5;cursor:not-allowed}.textarea--standard.textarea--disabled .textarea__control{color:var(--sc-input-color-disabled)}.textarea--standard.textarea--disabled .textarea__control::placeholder{color:var(--sc-input-placeholder-color-disabled)}.textarea--filled{border:none;background-color:var(--sc-input-filled-background-color);color:var(--sc-input-color)}.textarea--filled:hover:not(.textarea--disabled){background-color:var(--sc-input-filled-background-color-hover)}.textarea--filled.textarea--focused:not(.textarea--disabled){background-color:var(--sc-input-filled-background-color-focus);outline:var(--sc-focus-ring);outline-offset:var(--sc-focus-ring-offset)}.textarea--filled.textarea--disabled{background-color:var(--sc-input-filled-background-color-disabled);opacity:0.5;cursor:not-allowed}.textarea__control{flex:1 1 auto;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:1.4;color:var(--sc-input-color);border:none;background:none;box-shadow:none;cursor:inherit;-webkit-appearance:none}.textarea__control::-webkit-search-decoration,.textarea__control::-webkit-search-cancel-button,.textarea__control::-webkit-search-results-button,.textarea__control::-webkit-search-results-decoration{-webkit-appearance:none}.textarea__control::placeholder{color:var(--sc-input-placeholder-color);user-select:none}.textarea__control:focus{outline:none}.textarea--small{border-radius:var(--sc-input-border-radius-small);font-size:var(--sc-input-font-size-small)}.textarea--small .textarea__control{padding:0.5em var(--sc-input-spacing-small)}.textarea--medium{border-radius:var(--sc-input-border-radius-medium);font-size:var(--sc-input-font-size-medium)}.textarea--medium .textarea__control{padding:0.5em var(--sc-input-spacing-medium)}.textarea--large{border-radius:var(--sc-input-border-radius-large);font-size:var(--sc-input-font-size-large)}.textarea--large .textarea__control{padding:0.5em var(--sc-input-spacing-large)}.textarea--resize-none .textarea__control{resize:none}.textarea--resize-vertical .textarea__control{resize:vertical}.textarea--resize-auto .textarea__control{height:auto;resize:none}.textarea__char-limit-warning{margin-top:var(--sc-input-spacing-small);color:var(--sc-input-help-text-color);font-size:var(--sc-input-help-text-font-size-medium)}"; |
| 239 | const ScTextareaStyle0 = scTextareaCss; |
| 240 | |
| 241 | const CHAR_LIMIT_THRESHOLD = 20; |
| 242 | let id = 0; |
| 243 | const ScTextarea = class { |
| 244 | constructor(hostRef) { |
| 245 | registerInstance(this, hostRef); |
| 246 | this.scChange = createEvent(this, "scChange", 7); |
| 247 | this.scInput = createEvent(this, "scInput", 7); |
| 248 | this.scBlur = createEvent(this, "scBlur", 7); |
| 249 | this.scFocus = createEvent(this, "scFocus", 7); |
| 250 | this.inputId = `textarea-${++id}`; |
| 251 | this.helpId = `textarea-help-text-${id}`; |
| 252 | this.labelId = `textarea-label-${id}`; |
| 253 | this.hasFocus = false; |
| 254 | this.showCharLimit = false; |
| 255 | this.size = 'medium'; |
| 256 | this.name = undefined; |
| 257 | this.value = ''; |
| 258 | this.filled = false; |
| 259 | this.label = ''; |
| 260 | this.showLabel = true; |
| 261 | this.help = ''; |
| 262 | this.placeholder = undefined; |
| 263 | this.rows = 4; |
| 264 | this.resize = 'vertical'; |
| 265 | this.disabled = false; |
| 266 | this.readonly = false; |
| 267 | this.minlength = undefined; |
| 268 | this.maxlength = undefined; |
| 269 | this.required = false; |
| 270 | this.invalid = false; |
| 271 | this.autocapitalize = undefined; |
| 272 | this.autocorrect = undefined; |
| 273 | this.autocomplete = undefined; |
| 274 | this.autofocus = undefined; |
| 275 | this.enterkeyhint = undefined; |
| 276 | this.spellcheck = undefined; |
| 277 | this.inputmode = undefined; |
| 278 | } |
| 279 | handleRowsChange() { |
| 280 | this.setTextareaHeight(); |
| 281 | } |
| 282 | handleValueChange() { |
| 283 | var _a; |
| 284 | this.invalid = !this.input.checkValidity(); |
| 285 | const valueLength = ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0; |
| 286 | const maxLength = this.maxlength || Number.MAX_SAFE_INTEGER; |
| 287 | this.showCharLimit = maxLength - valueLength <= CHAR_LIMIT_THRESHOLD; |
| 288 | } |
| 289 | handleDisabledChange() { |
| 290 | // Disabled form controls are always valid, so we need to recheck validity when the state changes |
| 291 | this.input.disabled = this.disabled; |
| 292 | this.invalid = !this.input.checkValidity(); |
| 293 | } |
| 294 | /** Sets focus on the input. */ |
| 295 | async triggerFocus(options) { |
| 296 | return this.input.focus(options); |
| 297 | } |
| 298 | /** Sets focus on the textarea. */ |
| 299 | focus(options) { |
| 300 | this.input.focus(options); |
| 301 | } |
| 302 | /** Removes focus from the textarea. */ |
| 303 | blur() { |
| 304 | this.input.blur(); |
| 305 | } |
| 306 | /** Selects all the text in the textarea. */ |
| 307 | select() { |
| 308 | this.input.select(); |
| 309 | } |
| 310 | /** Gets or sets the textarea's scroll position. */ |
| 311 | scrollPosition(position) { |
| 312 | if (position) { |
| 313 | if (typeof position.top === 'number') |
| 314 | this.input.scrollTop = position.top; |
| 315 | if (typeof position.left === 'number') |
| 316 | this.input.scrollLeft = position.left; |
| 317 | return; |
| 318 | } |
| 319 | // eslint-disable-next-line consistent-return |
| 320 | return { |
| 321 | top: this.input.scrollTop, |
| 322 | left: this.input.scrollTop, |
| 323 | }; |
| 324 | } |
| 325 | /** Sets the start and end positions of the text selection (0-based). */ |
| 326 | setSelectionRange(selectionStart, selectionEnd, selectionDirection = 'none') { |
| 327 | this.input.setSelectionRange(selectionStart, selectionEnd, selectionDirection); |
| 328 | } |
| 329 | /** Replaces a range of text with a new string. */ |
| 330 | setRangeText(replacement, start, end, selectMode = 'preserve') { |
| 331 | this.input.setRangeText(replacement, start, end, selectMode); |
| 332 | if (this.value !== this.input.value) { |
| 333 | this.value = this.input.value; |
| 334 | this.scInput.emit(); |
| 335 | } |
| 336 | if (this.value !== this.input.value) { |
| 337 | this.value = this.input.value; |
| 338 | this.setTextareaHeight(); |
| 339 | this.scInput.emit(); |
| 340 | this.scChange.emit(); |
| 341 | } |
| 342 | } |
| 343 | /** Checks for validity and shows the browser's validation message if the control is invalid. */ |
| 344 | async reportValidity() { |
| 345 | return this.input.reportValidity(); |
| 346 | } |
| 347 | /** Sets a custom validation message. If `message` is not empty, the field will be considered invalid. */ |
| 348 | setCustomValidity(message) { |
| 349 | this.input.setCustomValidity(message); |
| 350 | this.invalid = !this.input.checkValidity(); |
| 351 | } |
| 352 | handleBlur() { |
| 353 | this.hasFocus = false; |
| 354 | this.scBlur.emit(); |
| 355 | } |
| 356 | handleChange() { |
| 357 | this.value = this.input.value; |
| 358 | this.setTextareaHeight(); |
| 359 | this.scChange.emit(); |
| 360 | } |
| 361 | handleFocus() { |
| 362 | this.hasFocus = true; |
| 363 | this.scFocus.emit(); |
| 364 | } |
| 365 | handleInput() { |
| 366 | this.value = this.input.value; |
| 367 | this.setTextareaHeight(); |
| 368 | this.scInput.emit(); |
| 369 | } |
| 370 | componentWillLoad() { |
| 371 | if (!(window === null || window === void 0 ? void 0 : window.ResizeObserver)) { |
| 372 | return; |
| 373 | } |
| 374 | this.resizeObserver = new window.ResizeObserver(() => this.setTextareaHeight()); |
| 375 | } |
| 376 | componentDidLoad() { |
| 377 | this.formController = new FormSubmitController(this.el).addFormData(); |
| 378 | if (!(window === null || window === void 0 ? void 0 : window.ResizeObserver)) { |
| 379 | return; |
| 380 | } |
| 381 | this.resizeObserver.observe(this.input); |
| 382 | } |
| 383 | disconnectedCallback() { |
| 384 | var _a; |
| 385 | (_a = this.formController) === null || _a === void 0 ? void 0 : _a.removeFormData(); |
| 386 | this.resizeObserver.unobserve(this.input); |
| 387 | } |
| 388 | setTextareaHeight() { |
| 389 | if (this.resize === 'auto') { |
| 390 | this.input.style.height = 'auto'; |
| 391 | this.input.style.height = `${this.input.scrollHeight}px`; |
| 392 | } |
| 393 | else { |
| 394 | this.input.style.height = undefined; |
| 395 | } |
| 396 | } |
| 397 | render() { |
| 398 | var _a; |
| 399 | return (h("div", { key: 'a57ff524400dc6d5f6e6cf995f8fe76c311196ae', part: "form-control", class: { |
| 400 | 'form-control': true, |
| 401 | 'form-control--small': this.size === 'small', |
| 402 | 'form-control--medium': this.size === 'medium', |
| 403 | 'form-control--large': this.size === 'large', |
| 404 | } }, h("sc-form-control", { key: '06a227433e876f84708ed85d6999553c0739c35a', exportparts: "label, help-text, form-control", size: this.size, required: this.required, label: this.label, showLabel: this.showLabel, help: this.help, inputId: this.inputId, helpId: this.helpId, labelId: this.labelId, name: this.name }, h("div", { key: '927832c9f3380a010974f94a1d094ebfc595596b', part: "form-control-input", class: "form-control-input" }, h("div", { key: '787d7364c059f150ca718b3f95f6efc5e5db06ed', part: "base", class: { |
| 405 | 'textarea': true, |
| 406 | 'textarea--small': this.size === 'small', |
| 407 | 'textarea--medium': this.size === 'medium', |
| 408 | 'textarea--large': this.size === 'large', |
| 409 | 'textarea--standard': !this.filled, |
| 410 | 'textarea--filled': this.filled, |
| 411 | 'textarea--disabled': this.disabled, |
| 412 | 'textarea--focused': this.hasFocus, |
| 413 | 'textarea--empty': !this.value, |
| 414 | 'textarea--invalid': this.invalid, |
| 415 | 'textarea--resize-none': this.resize === 'none', |
| 416 | 'textarea--resize-vertical': this.resize === 'vertical', |
| 417 | 'textarea--resize-auto': this.resize === 'auto', |
| 418 | } }, h("textarea", { key: '0e7f9a8dd030bd0bc5b81e321a93c38177c66a4b', part: "textarea", ref: el => (this.input = el), id: "input", class: "textarea__control", name: this.name, value: this.value, disabled: this.disabled, readonly: this.readonly, required: this.required, placeholder: this.placeholder, rows: this.rows, minlength: this.minlength, maxlength: this.maxlength, autocapitalize: this.autocapitalize, autocorrect: this.autocorrect, autofocus: this.autofocus, spellcheck: this.spellcheck, enterkeyhint: this.enterkeyhint, inputmode: this.inputmode, "aria-describedby": "help-text", onChange: () => this.handleChange(), onInput: () => this.handleInput(), onFocus: () => this.handleFocus(), onBlur: () => this.handleBlur(), onKeyDown: (e) => e.stopPropagation() })), this.showCharLimit && (h("div", { key: 'bc48a2eec43d2e28d456d0f8fb896c1022f89767', slot: "help", class: 'textarea__char-limit-warning' }, wp.i18n.sprintf(wp.i18n.__('%d characters remaining', 'surecart'), this.maxlength && ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.maxlength - this.input.value.length : this.maxlength))))))); |
| 419 | } |
| 420 | get el() { return getElement(this); } |
| 421 | static get watchers() { return { |
| 422 | "rows": ["handleRowsChange"], |
| 423 | "value": ["handleValueChange"], |
| 424 | "disabled": ["handleDisabledChange"] |
| 425 | }; } |
| 426 | }; |
| 427 | ScTextarea.style = ScTextareaStyle0; |
| 428 | |
| 429 | export { ScCancelDiscount as sc_cancel_discount, ScCancelSurvey as sc_cancel_survey, ScSubscriptionCancel as sc_subscription_cancel, ScTextarea as sc_textarea }; |
| 430 | |
| 431 | //# sourceMappingURL=sc-cancel-discount_4.entry.js.map |