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-conditional-form.entry.js
145 lines
| 1 | import { r as registerInstance, h, H as Host } from './index-745b6bec.js'; |
| 2 | import { s as state } from './watchers-38693c1f.js'; |
| 3 | import { c as currentCheckout } from './getters-1a55b8a4.js'; |
| 4 | import './index-06061d4e.js'; |
| 5 | import './mutations-066b82f0.js'; |
| 6 | import './utils-e9ee502a.js'; |
| 7 | import './remove-query-args-938c53ea.js'; |
| 8 | import './add-query-args-0e2a8393.js'; |
| 9 | import './index-c5a96d53.js'; |
| 10 | import './google-a86aa761.js'; |
| 11 | import './currency-a0c9bff4.js'; |
| 12 | import './price-d5770168.js'; |
| 13 | import './address-b892540d.js'; |
| 14 | |
| 15 | /** |
| 16 | * Check if any of the rule groups is passed or not. |
| 17 | * |
| 18 | * @param {array} groups Rule groups. |
| 19 | * @param {object} props Data. |
| 20 | * @returns {boolean} |
| 21 | */ |
| 22 | const hasAnyRuleGroupPassed = (groups, props) => { |
| 23 | return (groups || []).some(({ rules }) => hasRulesPassed(rules, props)); |
| 24 | }; |
| 25 | /** |
| 26 | * CHeck if all rules are passed or not. |
| 27 | * |
| 28 | * @param {array} rules Rules. |
| 29 | * @param {object} props Data. |
| 30 | * @returns {boolean} |
| 31 | */ |
| 32 | const hasRulesPassed = (rules, { checkout, processor }) => { |
| 33 | return rules |
| 34 | .map(rule => { |
| 35 | var _a, _b; |
| 36 | const ruleValue = Array.isArray(rule === null || rule === void 0 ? void 0 : rule.value) ? (rule === null || rule === void 0 ? void 0 : rule.value).map(ruleValue => (ruleValue === null || ruleValue === void 0 ? void 0 : ruleValue.value) || ruleValue) : rule === null || rule === void 0 ? void 0 : rule.value; |
| 37 | switch (rule === null || rule === void 0 ? void 0 : rule.condition) { |
| 38 | case 'total': |
| 39 | return compareNumberValues(parseFloat(checkout.total_amount), parseFloat(ruleValue), rule === null || rule === void 0 ? void 0 : rule.operator); |
| 40 | case 'products': |
| 41 | return compareObjectValues(getCartProductIds(checkout), ruleValue, rule === null || rule === void 0 ? void 0 : rule.operator); |
| 42 | case 'coupons': |
| 43 | return compareObjectValues(getCartCouponIds(checkout), ruleValue, rule === null || rule === void 0 ? void 0 : rule.operator); |
| 44 | case 'shipping_country': |
| 45 | return compareObjectValues([(_a = checkout === null || checkout === void 0 ? void 0 : checkout.shipping_address) === null || _a === void 0 ? void 0 : _a.country], ruleValue, rule === null || rule === void 0 ? void 0 : rule.operator); |
| 46 | case 'billing_country': |
| 47 | return compareObjectValues([(_b = checkout === null || checkout === void 0 ? void 0 : checkout.billing_address) === null || _b === void 0 ? void 0 : _b.country], ruleValue, rule === null || rule === void 0 ? void 0 : rule.operator); |
| 48 | case 'processors': |
| 49 | return compareObjectValues([processor], ruleValue, rule === null || rule === void 0 ? void 0 : rule.operator); |
| 50 | default: |
| 51 | return false; |
| 52 | } |
| 53 | }) |
| 54 | .every(rules => rules); |
| 55 | }; |
| 56 | /** |
| 57 | * Get array of products from checkout. |
| 58 | * |
| 59 | * @param {object} checkout CHeckout data. |
| 60 | * @returns {array} |
| 61 | */ |
| 62 | const getCartProductIds = (checkout) => { |
| 63 | var _a; |
| 64 | return (((_a = checkout === null || checkout === void 0 ? void 0 : checkout.line_items) === null || _a === void 0 ? void 0 : _a.data) || []).map(({ price }) => { var _a; return (_a = price === null || price === void 0 ? void 0 : price.product) === null || _a === void 0 ? void 0 : _a.id; }); |
| 65 | }; |
| 66 | /** |
| 67 | * Get array of coupons from checkout. |
| 68 | * |
| 69 | * @param {object} checkout CHeckout data. |
| 70 | * @returns {array} |
| 71 | */ |
| 72 | const getCartCouponIds = (checkout) => { |
| 73 | var _a, _b, _c, _d; |
| 74 | return ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.discount) === null || _a === void 0 ? void 0 : _a.coupon) === null || _b === void 0 ? void 0 : _b.id) ? [(_d = (_c = checkout === null || checkout === void 0 ? void 0 : checkout.discount) === null || _c === void 0 ? void 0 : _c.coupon) === null || _d === void 0 ? void 0 : _d.id] : []; |
| 75 | }; |
| 76 | /** |
| 77 | * Compare object values. |
| 78 | * |
| 79 | * @param {array} cart_values order values. |
| 80 | * @param {array} rule_values rules values. |
| 81 | * @param {string} operator rule operator. |
| 82 | * @returns {boolean} |
| 83 | */ |
| 84 | const compareObjectValues = (cart_values, rule_values, operator) => { |
| 85 | switch (operator) { |
| 86 | case 'all': |
| 87 | return rule_values.filter(n1 => cart_values.some(n2 => n1 == n2)).length === rule_values.length; |
| 88 | case 'any': |
| 89 | return cart_values.filter(n1 => rule_values.some(n2 => n1 == n2)).length >= 1; |
| 90 | case 'none': |
| 91 | return cart_values.filter(n1 => rule_values.some(n2 => n1 == n2)).length === 0; |
| 92 | case 'exist': |
| 93 | return cart_values.length >= 1; |
| 94 | case 'not_exist': |
| 95 | return cart_values.length === 0; |
| 96 | default: |
| 97 | return false; |
| 98 | } |
| 99 | }; |
| 100 | /** |
| 101 | * Compare string values. |
| 102 | * |
| 103 | * @param string number1 The actual number from cart/order. |
| 104 | * @param array number2 Rule values. |
| 105 | * @param string operator Rule operator. |
| 106 | * @returns {boolean} |
| 107 | */ |
| 108 | const compareNumberValues = (number1, number2, operator) => { |
| 109 | switch (operator) { |
| 110 | case '==': |
| 111 | return number1 === number2; |
| 112 | case '!=': |
| 113 | return number1 !== number2; |
| 114 | case '>': |
| 115 | return number1 > number2; |
| 116 | case '<': |
| 117 | return number1 < number2; |
| 118 | case '<=': |
| 119 | return number1 <= number2; |
| 120 | case '>=': |
| 121 | return number1 >= number2; |
| 122 | } |
| 123 | return false; |
| 124 | }; |
| 125 | |
| 126 | const scConditionalFormCss = ":host{display:block}"; |
| 127 | const ScConditionalFormStyle0 = scConditionalFormCss; |
| 128 | |
| 129 | const ScConditionalForm = class { |
| 130 | constructor(hostRef) { |
| 131 | registerInstance(this, hostRef); |
| 132 | this.rule_groups = undefined; |
| 133 | } |
| 134 | render() { |
| 135 | let show = hasAnyRuleGroupPassed(this.rule_groups, { checkout: currentCheckout(), processor: state === null || state === void 0 ? void 0 : state.id }); |
| 136 | if (!show) |
| 137 | return null; |
| 138 | return (h(Host, null, h("slot", null))); |
| 139 | } |
| 140 | }; |
| 141 | ScConditionalForm.style = ScConditionalFormStyle0; |
| 142 | |
| 143 | export { ScConditionalForm as sc_conditional_form }; |
| 144 | |
| 145 | //# sourceMappingURL=sc-conditional-form.entry.js.map |