@foxy.io/elements 1.27.0-beta.5 → 1.27.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.js +1 -0
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +2 -2
- package/dist/cdn/foxy-customer.js +3 -3
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +2 -2
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -0
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +2 -2
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-query-builder.js +64 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-59a5edee.js → shared-018d5724.js} +9 -9
- package/dist/cdn/{shared-92cdd504.js → shared-03673673.js} +1 -1
- package/dist/cdn/{shared-20c4310b.js → shared-07e7d118.js} +1 -1
- package/dist/cdn/{shared-46454866.js → shared-0a8161e5.js} +4 -4
- package/dist/cdn/{shared-48b76c74.js → shared-0a9d860d.js} +1 -1
- package/dist/cdn/{shared-f03dacf5.js → shared-0f59fd6a.js} +1 -1
- package/dist/cdn/{shared-a73e7be4.js → shared-122cccac.js} +1 -1
- package/dist/cdn/{shared-03ccfd62.js → shared-186e41cf.js} +1 -1
- package/dist/cdn/shared-18918efe.js +1 -0
- package/dist/cdn/shared-18bfe97c.js +1 -0
- package/dist/cdn/{shared-e4e0dc11.js → shared-1e7639e6.js} +1 -1
- package/dist/cdn/shared-2314add3.js +12 -0
- package/dist/cdn/{shared-931db653.js → shared-25198d9a.js} +1 -1
- package/dist/cdn/{shared-6a998243.js → shared-285f8cee.js} +21 -27
- package/dist/cdn/shared-28be347b.js +10 -0
- package/dist/cdn/{shared-6af480b8.js → shared-2b5a3c80.js} +1 -1
- package/dist/cdn/{shared-4fd17baf.js → shared-3cabd589.js} +1 -1
- package/dist/cdn/{shared-7ff496f6.js → shared-412c19c2.js} +1 -1
- package/dist/cdn/shared-467e5b06.js +1 -0
- package/dist/cdn/shared-482b2b86.js +1 -0
- package/dist/cdn/{shared-e52280d9.js → shared-4affec66.js} +1 -1
- package/dist/cdn/{shared-4877ed05.js → shared-4c611015.js} +2 -2
- package/dist/cdn/{shared-f2a8fb36.js → shared-4c7a8fcc.js} +1 -1
- package/dist/cdn/shared-540063aa.js +88 -0
- package/dist/cdn/{shared-18d109f5.js → shared-55630cac.js} +1 -1
- package/dist/cdn/{shared-b81aa01c.js → shared-584df8a8.js} +1 -1
- package/dist/cdn/shared-5875cb66.js +1 -0
- package/dist/cdn/{shared-9db9528b.js → shared-58951f74.js} +15 -15
- package/dist/cdn/{shared-fcaf15e5.js → shared-5debeb1b.js} +1 -1
- package/dist/cdn/{shared-6e977271.js → shared-612ea9ed.js} +1 -1
- package/dist/cdn/{shared-d4322854.js → shared-62e9c883.js} +1 -1
- package/dist/cdn/shared-6586ffd5.js +1 -0
- package/dist/cdn/{shared-205721a3.js → shared-684cd55a.js} +1 -1
- package/dist/cdn/{shared-7e201abd.js → shared-6b68b3b6.js} +1 -1
- package/dist/cdn/{shared-6be0a096.js → shared-6cd4e618.js} +1 -1
- package/dist/cdn/{shared-4329ffa1.js → shared-739f24fe.js} +1 -1
- package/dist/cdn/{shared-bf132324.js → shared-75d13e1b.js} +1 -1
- package/dist/cdn/{shared-89b42eef.js → shared-77258081.js} +1 -1
- package/dist/cdn/{shared-250e652f.js → shared-79d35787.js} +1 -1
- package/dist/cdn/{shared-724e9a20.js → shared-7b2bd917.js} +1 -1
- package/dist/cdn/{shared-97793410.js → shared-7f60c1c1.js} +1 -1
- package/dist/cdn/{shared-56addb06.js → shared-7ff78b4a.js} +1 -1
- package/dist/cdn/{shared-dccfe5e7.js → shared-8258443c.js} +1 -1
- package/dist/cdn/{shared-8a04bea3.js → shared-851a7db5.js} +1 -1
- package/dist/cdn/shared-8874ec69.js +1 -0
- package/dist/cdn/shared-8a247f48.js +1 -0
- package/dist/cdn/{shared-8778d784.js → shared-8b521111.js} +1 -1
- package/dist/cdn/shared-90877857.js +1 -0
- package/dist/cdn/shared-90cbed56.js +32 -0
- package/dist/cdn/{shared-039de1fd.js → shared-91c88f14.js} +1 -1
- package/dist/cdn/{shared-0e5ea9cf.js → shared-99e354b1.js} +1 -1
- package/dist/cdn/{shared-51ac503d.js → shared-9cfef94a.js} +1 -1
- package/dist/cdn/{shared-845f8bf1.js → shared-a24b2aa7.js} +1 -1
- package/dist/cdn/{shared-a0cbfb2f.js → shared-ad11b006.js} +1 -1
- package/dist/cdn/{shared-f7a5b12a.js → shared-b2fd98e6.js} +1 -1
- package/dist/cdn/{shared-11014aad.js → shared-b3db7611.js} +1 -1
- package/dist/cdn/{shared-872151f5.js → shared-b900e1b5.js} +1 -1
- package/dist/cdn/{shared-3cbcd9cb.js → shared-b9ea6d85.js} +1 -1
- package/dist/cdn/{shared-1122a125.js → shared-bb1d162b.js} +1 -1
- package/dist/cdn/{shared-6ef4ce19.js → shared-bd919e3b.js} +1 -1
- package/dist/cdn/{shared-d15c3e2d.js → shared-be0fca15.js} +1 -1
- package/dist/cdn/{shared-8dd03329.js → shared-cdf873d4.js} +1 -1
- package/dist/cdn/{shared-82435697.js → shared-d10d6cba.js} +1 -1
- package/dist/cdn/shared-d222bd1e.js +6 -0
- package/dist/cdn/{shared-1b0992cc.js → shared-d56a3799.js} +5 -5
- package/dist/cdn/{shared-8cd0f36d.js → shared-d72e87ee.js} +1 -1
- package/dist/cdn/{shared-1d257548.js → shared-da2e66a4.js} +1 -1
- package/dist/cdn/{shared-bc95d87e.js → shared-ea5fa631.js} +1 -1
- package/dist/cdn/{shared-abf72e2f.js → shared-ee13d85c.js} +3 -3
- package/dist/cdn/shared-f0fcd613.js +1 -0
- package/dist/cdn/{shared-2c70f0b6.js → shared-f4bb452b.js} +1 -1
- package/dist/cdn/{shared-3277bbf5.js → shared-f7c60ee0.js} +1 -1
- package/dist/cdn/{shared-5c542149.js → shared-fc5ace3b.js} +1 -1
- package/dist/cdn/shared-fe45779e.js +1 -0
- package/dist/cdn/translations/coupon-code-card/en.json +11 -0
- package/dist/cdn/translations/coupon-form/en.json +522 -297
- package/dist/cdn/translations/gift-card-code-card/en.json +10 -0
- package/dist/cdn/translations/gift-card-code-form/en.json +86 -0
- package/dist/cdn/translations/gift-card-form/en.json +638 -397
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +10 -0
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +95 -8
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControlFilterOverlay.d.ts +11 -0
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControlFilterOverlay.js +57 -0
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControlFilterOverlay.js.map +1 -0
- package/dist/elements/internal/InternalAsyncListControl/index.d.ts +1 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js +3 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
- package/dist/elements/internal/InternalAsyncListControl/types.d.ts +8 -0
- package/dist/elements/internal/InternalAsyncListControl/types.js +2 -0
- package/dist/elements/internal/InternalAsyncListControl/types.js.map +1 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.d.ts +23 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js +224 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js.map +1 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/index.d.ts +8 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/index.js +10 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/index.js.map +1 -0
- package/dist/elements/internal/InternalBulkAddActionControl/InternalBulkAddActionControl.d.ts +10 -0
- package/dist/elements/internal/InternalBulkAddActionControl/InternalBulkAddActionControl.js +49 -0
- package/dist/elements/internal/InternalBulkAddActionControl/InternalBulkAddActionControl.js.map +1 -0
- package/dist/elements/internal/InternalBulkAddActionControl/index.d.ts +6 -0
- package/dist/elements/internal/InternalBulkAddActionControl/index.js +8 -0
- package/dist/elements/internal/InternalBulkAddActionControl/index.js.map +1 -0
- package/dist/elements/internal/InternalForm/InternalForm.d.ts +10 -0
- package/dist/elements/internal/InternalForm/InternalForm.js +44 -0
- package/dist/elements/internal/InternalForm/InternalForm.js.map +1 -1
- package/dist/elements/internal/InternalForm/index.d.ts +2 -0
- package/dist/elements/internal/InternalForm/index.js +2 -0
- package/dist/elements/internal/InternalForm/index.js.map +1 -1
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.d.ts +1 -0
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js +3 -0
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js.map +1 -1
- package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.d.ts +10 -0
- package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js +51 -0
- package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js.map +1 -0
- package/dist/elements/internal/InternalQueryBuilderControl/index.d.ts +4 -0
- package/dist/elements/internal/InternalQueryBuilderControl/index.js +6 -0
- package/dist/elements/internal/InternalQueryBuilderControl/index.js.map +1 -0
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.d.ts +16 -0
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js +167 -0
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js.map +1 -0
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControlForm.d.ts +14 -0
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControlForm.js +40 -0
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControlForm.js.map +1 -0
- package/dist/elements/internal/InternalResourcePickerControl/index.d.ts +6 -0
- package/dist/elements/internal/InternalResourcePickerControl/index.js +10 -0
- package/dist/elements/internal/InternalResourcePickerControl/index.js.map +1 -0
- package/dist/elements/public/CartForm/CartForm.js +81 -81
- package/dist/elements/public/CartForm/CartForm.js.map +1 -1
- package/dist/elements/public/CouponCodeCard/CouponCodeCard.d.ts +16 -0
- package/dist/elements/public/CouponCodeCard/CouponCodeCard.js +41 -0
- package/dist/elements/public/CouponCodeCard/CouponCodeCard.js.map +1 -0
- package/dist/elements/public/CouponCodeCard/index.d.ts +4 -0
- package/dist/elements/public/CouponCodeCard/index.js +6 -0
- package/dist/elements/public/CouponCodeCard/index.js.map +1 -0
- package/dist/elements/public/CouponCodeCard/types.d.ts +3 -0
- package/dist/elements/public/CouponCodeCard/types.js +2 -0
- package/dist/elements/public/CouponCodeCard/types.js.map +1 -0
- package/dist/elements/public/CouponForm/CouponForm.d.ts +65 -41
- package/dist/elements/public/CouponForm/CouponForm.js +322 -1035
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CouponForm/index.d.ts +15 -16
- package/dist/elements/public/CouponForm/index.js +15 -16
- package/dist/elements/public/CouponForm/index.js.map +1 -1
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/InternalCouponFormRulesControl.d.ts +7 -0
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/InternalCouponFormRulesControl.js +141 -0
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/InternalCouponFormRulesControl.js.map +1 -0
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/index.d.ts +6 -0
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/index.js +8 -0
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/index.js.map +1 -0
- package/dist/elements/public/CustomerPortalSettingsForm/CustomerPortalSettingsForm.js +7 -9
- package/dist/elements/public/CustomerPortalSettingsForm/CustomerPortalSettingsForm.js.map +1 -1
- package/dist/elements/public/CustomerPortalSettingsForm/toOrigin.d.ts +1 -0
- package/dist/elements/public/CustomerPortalSettingsForm/toOrigin.js +9 -0
- package/dist/elements/public/CustomerPortalSettingsForm/toOrigin.js.map +1 -0
- package/dist/elements/public/DownloadableForm/DownloadableForm.js +9 -9
- package/dist/elements/public/DownloadableForm/DownloadableForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeCard/GiftCardCodeCard.d.ts +21 -0
- package/dist/elements/public/GiftCardCodeCard/GiftCardCodeCard.js +78 -0
- package/dist/elements/public/GiftCardCodeCard/GiftCardCodeCard.js.map +1 -0
- package/dist/elements/public/GiftCardCodeCard/index.d.ts +5 -0
- package/dist/elements/public/GiftCardCodeCard/index.js +7 -0
- package/dist/elements/public/GiftCardCodeCard/index.js.map +1 -0
- package/dist/elements/public/GiftCardCodeCard/types.d.ts +3 -0
- package/dist/elements/public/GiftCardCodeCard/types.js +2 -0
- package/dist/elements/public/GiftCardCodeCard/types.js.map +1 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.d.ts +12 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +69 -4
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/index.d.ts +2 -0
- package/dist/elements/public/GiftCardCodeForm/index.js +2 -0
- package/dist/elements/public/GiftCardCodeForm/index.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/types.d.ts +5 -1
- package/dist/elements/public/GiftCardCodeForm/types.js.map +1 -1
- package/dist/elements/public/GiftCardForm/GiftCardForm.d.ts +22 -28
- package/dist/elements/public/GiftCardForm/GiftCardForm.js +183 -633
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
- package/dist/elements/public/GiftCardForm/index.d.ts +13 -12
- package/dist/elements/public/GiftCardForm/index.js +13 -12
- package/dist/elements/public/GiftCardForm/index.js.map +1 -1
- package/dist/elements/public/GiftCardForm/types.d.ts +2 -27
- package/dist/elements/public/GiftCardForm/types.js.map +1 -1
- package/dist/elements/public/I18n/format/discount.js +9 -2
- package/dist/elements/public/I18n/format/discount.js.map +1 -1
- package/dist/elements/public/I18n/format/ordinal.js +6 -2
- package/dist/elements/public/I18n/format/ordinal.js.map +1 -1
- package/dist/elements/public/IntegrationForm/IntegrationForm.js +8 -6
- package/dist/elements/public/IntegrationForm/IntegrationForm.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +27 -27
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
- package/dist/elements/public/QueryBuilder/QueryBuilder.d.ts +4 -0
- package/dist/elements/public/QueryBuilder/QueryBuilder.js +10 -2
- package/dist/elements/public/QueryBuilder/QueryBuilder.js.map +1 -1
- package/dist/elements/public/QueryBuilder/components/Group.d.ts +3 -1
- package/dist/elements/public/QueryBuilder/components/Group.js +8 -1
- package/dist/elements/public/QueryBuilder/components/Group.js.map +1 -1
- package/dist/elements/public/QueryBuilder/components/OperatorToggle.d.ts +2 -1
- package/dist/elements/public/QueryBuilder/components/OperatorToggle.js +5 -4
- package/dist/elements/public/QueryBuilder/components/OperatorToggle.js.map +1 -1
- package/dist/elements/public/QueryBuilder/components/Rule.d.ts +3 -1
- package/dist/elements/public/QueryBuilder/components/Rule.js +2 -1
- package/dist/elements/public/QueryBuilder/components/Rule.js.map +1 -1
- package/dist/elements/public/StoreForm/StoreForm.js +7 -8
- package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
- package/dist/elements/public/TemplateSetForm/TemplateSetForm.js +28 -28
- package/dist/elements/public/TemplateSetForm/TemplateSetForm.js.map +1 -1
- package/dist/elements/public/index.d.ts +2 -0
- package/dist/elements/public/index.defined.d.ts +2 -0
- package/dist/elements/public/index.defined.js +2 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +2 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/inferrable.js +8 -3
- package/dist/mixins/inferrable.js.map +1 -1
- package/package.json +2 -2
- package/dist/cdn/shared-0f49d9c3.js +0 -1
- package/dist/cdn/shared-20f65e73.js +0 -1
- package/dist/cdn/shared-27c7514d.js +0 -1
- package/dist/cdn/shared-4fb9d21f.js +0 -1
- package/dist/cdn/shared-6350f7d9.js +0 -1
- package/dist/cdn/shared-669decee.js +0 -1
- package/dist/cdn/shared-afefe2ac.js +0 -113
- package/dist/cdn/shared-b33fd700.js +0 -1
- package/dist/cdn/shared-b51b9df7.js +0 -64
- package/dist/cdn/shared-b914895b.js +0 -1
- package/dist/cdn/shared-bfeff3bb.js +0 -1
- package/dist/cdn/shared-cce18690.js +0 -1
- package/dist/cdn/shared-d04dd602.js +0 -20
- package/dist/cdn/shared-df58b901.js +0 -1
- package/dist/cdn/shared-e07b24ca.js +0 -1
- package/dist/elements/private/EditableList/EditableList.d.ts +0 -23
- package/dist/elements/private/EditableList/EditableList.js +0 -127
- package/dist/elements/private/EditableList/EditableList.js.map +0 -1
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.d.ts +0 -20
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js +0 -99
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js.map +0 -1
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.d.ts +0 -18
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js +0 -50
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js.map +0 -1
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.d.ts +0 -18
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js +0 -53
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js.map +0 -1
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.d.ts +0 -20
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js +0 -99
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js.map +0 -1
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.d.ts +0 -18
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js +0 -50
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js.map +0 -1
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.d.ts +0 -18
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js +0 -53
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js.map +0 -1
|
@@ -1,56 +1,79 @@
|
|
|
1
|
-
import { Type } from "../QueryBuilder/types.js";
|
|
2
|
-
import { html } from 'lit-element';
|
|
3
|
-
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
4
|
-
import { CategoryRestrictionsPage } from "./private/CategoryRestrictionsPage.js";
|
|
5
|
-
import { Checkbox } from "../../private/Checkbox/Checkbox.js";
|
|
6
|
-
import { CheckboxChangeEvent } from "../../private/Checkbox/CheckboxChangeEvent.js";
|
|
7
|
-
import { ConfigurableMixin } from "../../../mixins/configurable.js";
|
|
8
|
-
import { EditableList } from "../../private/EditableList/EditableList.js";
|
|
9
|
-
import { Group } from "../../private/Group/Group.js";
|
|
10
|
-
import { NucleonElement } from "../NucleonElement/NucleonElement.js";
|
|
11
|
-
import { Metadata } from "../../private/Metadata/Metadata.js";
|
|
12
|
-
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
13
|
-
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
14
1
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
15
|
-
import {
|
|
2
|
+
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
3
|
+
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
4
|
+
import { Operator, Type } from "../QueryBuilder/types.js";
|
|
5
|
+
import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
|
|
16
6
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
17
|
-
import {
|
|
18
|
-
import { serializeDate } from "../../../utils/serialize-date.js";
|
|
7
|
+
import { html } from 'lit-html';
|
|
19
8
|
const NS = 'coupon-form';
|
|
20
|
-
const Base =
|
|
9
|
+
const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
|
|
21
10
|
/**
|
|
22
11
|
* Form element for creating or editing coupons (`fx:coupon`).
|
|
23
12
|
*
|
|
13
|
+
* @slot import:before
|
|
14
|
+
* @slot import:after
|
|
15
|
+
*
|
|
16
|
+
* @slot generate:before
|
|
17
|
+
* @slot generate:after
|
|
18
|
+
*
|
|
24
19
|
* @slot name:before
|
|
25
20
|
* @slot name:after
|
|
26
21
|
*
|
|
27
22
|
* @slot rules:before
|
|
28
23
|
* @slot rules:after
|
|
29
24
|
*
|
|
30
|
-
* @slot codes:before
|
|
31
|
-
* @slot codes:after
|
|
25
|
+
* @slot coupon-codes:before
|
|
26
|
+
* @slot coupon-codes:after
|
|
32
27
|
*
|
|
33
|
-
* @slot
|
|
34
|
-
* @slot
|
|
28
|
+
* @slot item-option-restrictions:before
|
|
29
|
+
* @slot item-option-restrictions:after
|
|
35
30
|
*
|
|
36
|
-
* @slot product-restrictions:before
|
|
37
|
-
* @slot product-restrictions:after
|
|
31
|
+
* @slot product-code-restrictions:before
|
|
32
|
+
* @slot product-code-restrictions:after
|
|
38
33
|
*
|
|
39
34
|
* @slot category-restrictions:before
|
|
40
35
|
* @slot category-restrictions:after
|
|
41
36
|
*
|
|
37
|
+
* @slot number-of-uses-allowed:before
|
|
38
|
+
* @slot number-of-uses-allowed:after
|
|
39
|
+
*
|
|
40
|
+
* @slot number-of-uses-allowed-per-customer:before
|
|
41
|
+
* @slot number-of-uses-allowed-per-customer:after
|
|
42
|
+
*
|
|
43
|
+
* @slot number-of-uses-allowed-per-code:before
|
|
44
|
+
* @slot number-of-uses-allowed-per-code:after
|
|
45
|
+
*
|
|
46
|
+
* @slot start-date:before
|
|
47
|
+
* @slot start-date:after
|
|
48
|
+
*
|
|
49
|
+
* @slot end-date:before
|
|
50
|
+
* @slot end-date:after
|
|
51
|
+
*
|
|
52
|
+
* @slot inclusive-tax-rate:before
|
|
53
|
+
* @slot inclusive-tax-rate:after
|
|
54
|
+
*
|
|
42
55
|
* @slot options:before
|
|
43
56
|
* @slot options:after
|
|
44
57
|
*
|
|
45
|
-
* @slot
|
|
46
|
-
* @slot
|
|
58
|
+
* @slot customer-subscription-restrictions:before
|
|
59
|
+
* @slot customer-subscription-restrictions:after
|
|
47
60
|
*
|
|
48
|
-
* @slot
|
|
49
|
-
* @slot
|
|
61
|
+
* @slot customer-attribute-restrictions:before
|
|
62
|
+
* @slot customer-attribute-restrictions:after
|
|
63
|
+
*
|
|
64
|
+
* @slot attributes:before
|
|
65
|
+
* @slot attributes:after
|
|
50
66
|
*
|
|
51
67
|
* @slot create:before
|
|
52
68
|
* @slot create:after
|
|
53
69
|
*
|
|
70
|
+
* @slot delete:before
|
|
71
|
+
* @slot delete:after
|
|
72
|
+
*
|
|
73
|
+
* @slot timestamps:before
|
|
74
|
+
* @slot timestamps:after
|
|
75
|
+
*
|
|
76
|
+
*
|
|
54
77
|
* @element foxy-coupon-form
|
|
55
78
|
* @since 1.15.0
|
|
56
79
|
*/
|
|
@@ -58,70 +81,6 @@ export class CouponForm extends Base {
|
|
|
58
81
|
constructor() {
|
|
59
82
|
super(...arguments);
|
|
60
83
|
this.getTransactionPageHref = null;
|
|
61
|
-
this.__codesTableColumns = [
|
|
62
|
-
{
|
|
63
|
-
header: ctx => html `<foxy-i18n lang=${ctx.lang} key="code" ns=${ctx.ns}></foxy-i18n>`,
|
|
64
|
-
cell: ctx => {
|
|
65
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches('codes', true);
|
|
66
|
-
return html `
|
|
67
|
-
<div class="flex items-center gap-xs">
|
|
68
|
-
<vaadin-button
|
|
69
|
-
theme="tertiary-inline contrast"
|
|
70
|
-
class="p-0"
|
|
71
|
-
?disabled=${isDisabled}
|
|
72
|
-
@click=${(evt) => {
|
|
73
|
-
const dialog = this.renderRoot.querySelector('#code-dialog');
|
|
74
|
-
const button = evt.currentTarget;
|
|
75
|
-
dialog.href = ctx.data._links.self.href;
|
|
76
|
-
dialog.show(button);
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<span class="font-tnum">${ctx.data.code}</span>
|
|
80
|
-
</vaadin-button>
|
|
81
|
-
|
|
82
|
-
<foxy-copy-to-clipboard
|
|
83
|
-
?disabled=${isDisabled}
|
|
84
|
-
text=${ctx.data.code}
|
|
85
|
-
lang=${ctx.lang}
|
|
86
|
-
ns="${ctx.ns} copy-to-clipboard"
|
|
87
|
-
>
|
|
88
|
-
</foxy-copy-to-clipboard>
|
|
89
|
-
</div>
|
|
90
|
-
`;
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
header: ctx => html `<foxy-i18n lang=${ctx.lang} key="date_created" ns=${ctx.ns}></foxy-i18n>`,
|
|
95
|
-
cell: ctx => html `
|
|
96
|
-
<foxy-i18n
|
|
97
|
-
options=${JSON.stringify({ value: ctx.data.date_created })}
|
|
98
|
-
class="text-tertiary"
|
|
99
|
-
lang=${ctx.lang}
|
|
100
|
-
key="date"
|
|
101
|
-
ns=${ctx.ns}
|
|
102
|
-
>
|
|
103
|
-
</foxy-i18n>
|
|
104
|
-
`,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
hideBelow: 'sm',
|
|
108
|
-
header: c => html `<foxy-i18n lang=${c.lang} key="date_modified" ns=${c.ns}></foxy-i18n>`,
|
|
109
|
-
cell: ctx => html `
|
|
110
|
-
<foxy-i18n
|
|
111
|
-
options=${JSON.stringify({ value: ctx.data.date_modified })}
|
|
112
|
-
class="text-tertiary"
|
|
113
|
-
lang=${ctx.lang}
|
|
114
|
-
key="date"
|
|
115
|
-
ns=${ctx.ns}
|
|
116
|
-
>
|
|
117
|
-
</foxy-i18n>
|
|
118
|
-
`,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
header: c => html `<foxy-i18n lang=${c.lang} key="used_codes" ns=${c.ns}></foxy-i18n>`,
|
|
122
|
-
cell: ctx => html `${ctx.data.number_of_uses_to_date}`,
|
|
123
|
-
},
|
|
124
|
-
];
|
|
125
84
|
this.__customerSubscriptionRestrictionsGetValue = () => {
|
|
126
85
|
var _a;
|
|
127
86
|
const items = (_a = this.form.customer_subscription_restrictions) === null || _a === void 0 ? void 0 : _a.split(',').map(value => value.trim()).filter((value, index, values) => !!value && values.indexOf(value) === index).map(value => ({ value }));
|
|
@@ -139,985 +98,313 @@ export class CouponForm extends Base {
|
|
|
139
98
|
!!this.form.customer_attribute_restrictions,
|
|
140
99
|
});
|
|
141
100
|
};
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
101
|
+
this.__productCodeRestrictionsGetValue = () => {
|
|
102
|
+
var _a;
|
|
103
|
+
return (_a = this.form.product_code_restrictions) === null || _a === void 0 ? void 0 : _a.split(',').filter(v => !!v.trim()).map(value => ({
|
|
104
|
+
value,
|
|
105
|
+
label: value.startsWith('-')
|
|
106
|
+
? this.t(`product-code-restrictions.label_block`, { value: value.substring(1) })
|
|
107
|
+
: this.t(`product-code-restrictions.label_allow`, { value }),
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
this.__productCodeRestrictionsSetValue = (newValue) => {
|
|
111
|
+
this.edit({
|
|
112
|
+
product_code_restrictions: newValue
|
|
113
|
+
.map(({ value, unit }) => (unit === 'block' ? `-${value}` : value))
|
|
114
|
+
.filter((v, i, a) => !!v && a.indexOf(v) === i)
|
|
115
|
+
.join(','),
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
this.__itemOptionRestrictionsOperators = [Operator.In];
|
|
119
|
+
this.__itemOptionRestrictionsGetValue = () => {
|
|
120
|
+
var _a;
|
|
121
|
+
const query = new URLSearchParams();
|
|
122
|
+
const rules = (_a = this.form.item_option_restrictions) !== null && _a !== void 0 ? _a : {};
|
|
123
|
+
for (const key in rules) {
|
|
124
|
+
query.set(`${key}:in`, rules[key].join(','));
|
|
125
|
+
}
|
|
126
|
+
return query.toString();
|
|
127
|
+
};
|
|
128
|
+
this.__itemOptionRestrictionsSetValue = (newValue) => {
|
|
129
|
+
const rules = Object.fromEntries(Array.from(new URLSearchParams(newValue).entries()).map(([key, value]) => {
|
|
130
|
+
return [key.replace(':in', ''), value.split(',').filter(v => !!v.trim())];
|
|
131
|
+
}));
|
|
132
|
+
this.edit({ item_option_restrictions: rules });
|
|
133
|
+
};
|
|
134
|
+
this.__optionsGetValue = () => {
|
|
135
|
+
const value = [];
|
|
136
|
+
if (this.form.multiple_codes_allowed)
|
|
137
|
+
value.push('multiple_codes_allowed');
|
|
138
|
+
if (this.form.combinable)
|
|
139
|
+
value.push('combinable');
|
|
140
|
+
if (this.form.exclude_category_discounts)
|
|
141
|
+
value.push('exclude_category_discounts');
|
|
142
|
+
if (this.form.exclude_line_item_discounts)
|
|
143
|
+
value.push('exclude_line_item_discounts');
|
|
144
|
+
if (this.form.is_taxable)
|
|
145
|
+
value.push('is_taxable');
|
|
146
|
+
if (this.form.shared_codes_allowed)
|
|
147
|
+
value.push('shared_codes_allowed');
|
|
148
|
+
if (this.form.customer_auto_apply)
|
|
149
|
+
value.push('customer_auto_apply');
|
|
150
|
+
return value;
|
|
169
151
|
};
|
|
152
|
+
this.__optionsSetValue = (newValue) => {
|
|
153
|
+
this.edit({
|
|
154
|
+
multiple_codes_allowed: newValue.includes('multiple_codes_allowed'),
|
|
155
|
+
combinable: newValue.includes('combinable'),
|
|
156
|
+
exclude_category_discounts: newValue.includes('exclude_category_discounts'),
|
|
157
|
+
exclude_line_item_discounts: newValue.includes('exclude_line_item_discounts'),
|
|
158
|
+
is_taxable: newValue.includes('is_taxable'),
|
|
159
|
+
shared_codes_allowed: newValue.includes('shared_codes_allowed'),
|
|
160
|
+
customer_auto_apply: newValue.includes('customer_auto_apply'),
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
this.__optionsOptions = [
|
|
164
|
+
{ value: 'multiple_codes_allowed', label: 'option_multiple_codes_allowed' },
|
|
165
|
+
{ value: 'combinable', label: 'option_combinable' },
|
|
166
|
+
{ value: 'exclude_category_discounts', label: 'option_exclude_category_discounts' },
|
|
167
|
+
{ value: 'exclude_line_item_discounts', label: 'option_exclude_line_item_discounts' },
|
|
168
|
+
{ value: 'is_taxable', label: 'option_is_taxable' },
|
|
169
|
+
{ value: 'shared_codes_allowed', label: 'option_shared_codes_allowed' },
|
|
170
|
+
{ value: 'customer_auto_apply', label: 'option_customer_auto_apply' },
|
|
171
|
+
];
|
|
172
|
+
this.__storeLoaderId = 'storeLoader';
|
|
173
|
+
this.__codesFilters = [
|
|
174
|
+
{ label: 'code', path: 'code', type: Type.String },
|
|
175
|
+
{ label: 'used_codes', path: 'number_of_uses_to_date', type: Type.Number },
|
|
176
|
+
{ label: 'date_created', path: 'date_created', type: Type.Date },
|
|
177
|
+
{ label: 'date_modified', path: 'date_modified', type: Type.Date },
|
|
178
|
+
];
|
|
179
|
+
this.__couponCodesActions = [
|
|
180
|
+
{
|
|
181
|
+
theme: 'contrast',
|
|
182
|
+
state: 'idle',
|
|
183
|
+
text: 'copy_button_text',
|
|
184
|
+
onClick: async (data) => {
|
|
185
|
+
this.__couponCodesActions[0].state = 'busy';
|
|
186
|
+
this.__couponCodesActions = [...this.__couponCodesActions];
|
|
187
|
+
try {
|
|
188
|
+
await navigator.clipboard.writeText(data.code);
|
|
189
|
+
this.__couponCodesActions[0].state = 'end';
|
|
190
|
+
}
|
|
191
|
+
catch (_a) {
|
|
192
|
+
this.__couponCodesActions[0].state = 'error';
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
this.__couponCodesActions = [...this.__couponCodesActions];
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
this.__couponCodesActions[0].state = 'idle';
|
|
198
|
+
this.__couponCodesActions = [...this.__couponCodesActions];
|
|
199
|
+
}, 1000);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
];
|
|
170
204
|
}
|
|
171
205
|
static get properties() {
|
|
172
206
|
return {
|
|
173
207
|
...super.properties,
|
|
174
208
|
getTransactionPageHref: { attribute: false },
|
|
175
|
-
|
|
176
|
-
__itemCategories: { attribute: false },
|
|
209
|
+
__couponCodesActions: { type: Array },
|
|
177
210
|
};
|
|
178
211
|
}
|
|
179
212
|
static get v8n() {
|
|
180
213
|
return [
|
|
181
|
-
({ name: v }) => !!v || '
|
|
182
|
-
({ name: v }) => !v || v.length <= 50 || '
|
|
214
|
+
({ name: v }) => !!v || 'name:v8n_required',
|
|
215
|
+
({ name: v }) => !v || v.length <= 50 || 'name:v8n_too_long',
|
|
216
|
+
({ inclusive_tax_rate: v }) => !v || v >= 0 || 'inclusive-tax-rate:v8n_too_small',
|
|
217
|
+
({ inclusive_tax_rate: v }) => !v || v <= 1 || 'inclusive-tax-rate:v8n_too_big',
|
|
218
|
+
({ number_of_uses_allowed: v }) => !v || v >= 0 || 'number-of-uses-allowed:v8n_too_small',
|
|
219
|
+
({ coupon_discount_details: v }) => !!v || 'rules:v8n_required',
|
|
220
|
+
({ coupon_discount_details: v }) => !v || v.length <= 200 || 'rules:v8n_too_long',
|
|
221
|
+
({ item_option_restrictions: v }) => {
|
|
222
|
+
return !v || JSON.stringify(v).length <= 6000 || 'item-option-restrictions:v8n_too_long';
|
|
223
|
+
},
|
|
224
|
+
({ product_code_restrictions: v }) => {
|
|
225
|
+
return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';
|
|
226
|
+
},
|
|
227
|
+
({ customer_attribute_restrictions: v }) => {
|
|
228
|
+
return !v || v.length <= 2000 || 'customer-attribute-restrictions:v8n_too_long';
|
|
229
|
+
},
|
|
230
|
+
({ number_of_uses_allowed_per_code: v }) => {
|
|
231
|
+
return !v || v >= 0 || 'number-of-uses-allowed-per-code:v8n_too_small';
|
|
232
|
+
},
|
|
233
|
+
({ customer_subscription_restrictions: v }) => {
|
|
234
|
+
return !v || v.length <= 200 || 'customer-subscription-restrictions:v8n_too_long';
|
|
235
|
+
},
|
|
236
|
+
({ number_of_uses_allowed_per_customer: v }) => {
|
|
237
|
+
return !v || v >= 0 || 'number-of-uses-allowed-per-customer:v8n_too_small';
|
|
238
|
+
},
|
|
183
239
|
];
|
|
184
240
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
${hidden.matches('product-restrictions', true) ? '' : this.__renderProductRestrictions()}
|
|
195
|
-
${hidden.matches('category-restrictions', true) || !this.data
|
|
196
|
-
? ''
|
|
197
|
-
: this.__renderCategoryRestrictions()}
|
|
198
|
-
|
|
199
|
-
<foxy-internal-editable-list-control
|
|
200
|
-
infer="customer-subscription-restrictions"
|
|
201
|
-
.getValue=${this.__customerSubscriptionRestrictionsGetValue}
|
|
202
|
-
.setValue=${this.__customerSubscriptionRestrictionsSetValue}
|
|
203
|
-
>
|
|
204
|
-
</foxy-internal-editable-list-control>
|
|
205
|
-
|
|
206
|
-
${hidden.matches('customer-attribute-restrictions', true)
|
|
207
|
-
? ''
|
|
208
|
-
: this.__renderCustomerAttributeRestrictions()}
|
|
209
|
-
${hidden.matches('options', true) ? '' : this.__renderOptions()}
|
|
210
|
-
${hidden.matches('timestamps', true) ? '' : this.__renderTimestamps()}
|
|
211
|
-
${hidden.matches('create', true) || !!this.data ? '' : this.__renderCreate()}
|
|
212
|
-
${hidden.matches('delete', true) || !this.data ? '' : this.__renderDelete()}
|
|
213
|
-
|
|
214
|
-
<div
|
|
215
|
-
data-testid="spinner"
|
|
216
|
-
class=${classMap({
|
|
217
|
-
'transition duration-500 ease-in-out absolute inset-0 flex': true,
|
|
218
|
-
'opacity-0 pointer-events-none': this.in('idle'),
|
|
219
|
-
})}
|
|
220
|
-
>
|
|
221
|
-
<foxy-spinner
|
|
222
|
-
layout="vertical"
|
|
223
|
-
class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l"
|
|
224
|
-
state=${this.in('fail') ? 'error' : this.in('busy') ? 'busy' : 'empty'}
|
|
225
|
-
lang=${this.lang}
|
|
226
|
-
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-spinner')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
227
|
-
>
|
|
228
|
-
</foxy-spinner>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
`;
|
|
232
|
-
}
|
|
233
|
-
async _sendGet() {
|
|
234
|
-
const coupon = await super._sendGet();
|
|
235
|
-
const store = await super._fetch(coupon._links['fx:store'].href);
|
|
236
|
-
const categoriesURL = new URL(store._links['fx:item_categories'].href);
|
|
237
|
-
categoriesURL.searchParams.set('limit', '5');
|
|
238
|
-
this.__itemCategories = categoriesURL.toString();
|
|
239
|
-
return coupon;
|
|
240
|
-
}
|
|
241
|
-
__getErrorMessage(prefix) {
|
|
242
|
-
const error = this.errors.find(err => err.startsWith(prefix));
|
|
243
|
-
return error ? this.t(error.replace(prefix, 'v8n')).toString() : '';
|
|
244
|
-
}
|
|
245
|
-
__getValidator(prefix) {
|
|
246
|
-
return () => !this.errors.some(err => err.startsWith(prefix));
|
|
247
|
-
}
|
|
248
|
-
__renderName() {
|
|
249
|
-
return html `
|
|
250
|
-
<div>
|
|
251
|
-
${this.renderTemplateOrSlot('name:before')}
|
|
252
|
-
|
|
253
|
-
<vaadin-text-field
|
|
254
|
-
error-message=${this.__getErrorMessage('name')}
|
|
255
|
-
helper-text=${this.t('coupon_name_helper_text')}
|
|
256
|
-
data-testid="name"
|
|
257
|
-
class="w-full"
|
|
258
|
-
label=${this.t('name')}
|
|
259
|
-
.checkValidity=${this.__getValidator('name')}
|
|
260
|
-
.value=${this.form.name}
|
|
261
|
-
?disabled=${!this.in('idle') || this.disabledSelector.matches('name', true)}
|
|
262
|
-
?readonly=${this.readonlySelector.matches('name', true)}
|
|
263
|
-
required
|
|
264
|
-
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
265
|
-
@input=${(evt) => {
|
|
266
|
-
const newName = evt.currentTarget.value;
|
|
267
|
-
this.edit({ name: newName });
|
|
268
|
-
}}
|
|
269
|
-
>
|
|
270
|
-
</vaadin-text-field>
|
|
271
|
-
|
|
272
|
-
${this.renderTemplateOrSlot('name:after')}
|
|
273
|
-
</div>
|
|
274
|
-
`;
|
|
241
|
+
get hiddenSelector() {
|
|
242
|
+
const alwaysMatch = [super.hiddenSelector.toString()];
|
|
243
|
+
if (!this.data) {
|
|
244
|
+
alwaysMatch.push('coupon-codes', 'category-restrictions', 'attributes');
|
|
245
|
+
}
|
|
246
|
+
if (!this.form.customer_auto_apply) {
|
|
247
|
+
alwaysMatch.push('customer-attribute-restrictions', 'customer-subscription-restrictions');
|
|
248
|
+
}
|
|
249
|
+
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
275
250
|
}
|
|
276
|
-
|
|
277
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
278
|
-
const isReadonly = this.readonlySelector.matches('rules', true);
|
|
279
|
-
const details = this.form.coupon_discount_details;
|
|
280
|
-
const type = this.form.coupon_discount_type;
|
|
281
|
-
const presets = [
|
|
282
|
-
{ type: 'quantity_amount', details: 'allunits|2-2' },
|
|
283
|
-
{ type: 'quantity_percentage', details: 'allunits|5-10|10-20' },
|
|
284
|
-
{ type: 'quantity_amount', details: 'incremental|3-5' },
|
|
285
|
-
{ type: 'quantity_percentage', details: 'incremental|11-10|51-15|101-20' },
|
|
286
|
-
{ type: 'quantity_percentage', details: 'repeat|2-100' },
|
|
287
|
-
{ type: 'quantity_percentage', details: 'repeat|4-50' },
|
|
288
|
-
{ type: 'quantity_amount', details: 'single|5-10' },
|
|
289
|
-
{ type: 'price_percentage', details: 'single|99.99-10' },
|
|
290
|
-
];
|
|
291
|
-
const selectedPreset = presets.find(p => p.details === details && p.type === type);
|
|
251
|
+
renderHeaderActions(data) {
|
|
292
252
|
return html `
|
|
293
|
-
<
|
|
294
|
-
data
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
'text-disabled': isDisabled,
|
|
299
|
-
'text-secondary': isReadonly,
|
|
300
|
-
})}
|
|
253
|
+
<foxy-internal-bulk-add-action-control
|
|
254
|
+
parent=${data._links['fx:generate_codes'].href}
|
|
255
|
+
infer="generate"
|
|
256
|
+
form="foxy-generate-codes-form"
|
|
257
|
+
.related=${[data._links['fx:coupon_codes'].href]}
|
|
301
258
|
>
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
<span class="relative font-medium flex items-center">
|
|
305
|
-
<span class="truncate">
|
|
306
|
-
${selectedPreset
|
|
307
|
-
? this.t('discount_summary', { params: { ...selectedPreset, ns: this.ns } })
|
|
308
|
-
: this.t('custom_discount')}
|
|
309
|
-
</span>
|
|
310
|
-
|
|
311
|
-
<iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon>
|
|
312
|
-
|
|
313
|
-
<select
|
|
314
|
-
data-testclass="interactive editable"
|
|
315
|
-
data-testid="rules:preset:select"
|
|
316
|
-
class="opacity-0 absolute inset-0 focus-outline-none"
|
|
317
|
-
?disabled=${isDisabled || isReadonly}
|
|
318
|
-
@change=${(evt) => {
|
|
319
|
-
var _a, _b;
|
|
320
|
-
const select = evt.currentTarget;
|
|
321
|
-
const preset = presets[select.selectedIndex];
|
|
322
|
-
this.edit({
|
|
323
|
-
coupon_discount_details: (_a = preset === null || preset === void 0 ? void 0 : preset.details) !== null && _a !== void 0 ? _a : '',
|
|
324
|
-
coupon_discount_type: (_b = preset === null || preset === void 0 ? void 0 : preset.type) !== null && _b !== void 0 ? _b : 'quantity_amount',
|
|
325
|
-
});
|
|
326
|
-
}}
|
|
327
|
-
>
|
|
328
|
-
${presets.map(option => {
|
|
329
|
-
return html `
|
|
330
|
-
<option value=${option.details} ?selected=${option === selectedPreset}>
|
|
331
|
-
${this.t('discount_summary', { params: { ...option, ns: this.ns } })}
|
|
332
|
-
</option>
|
|
333
|
-
`;
|
|
334
|
-
})}
|
|
335
|
-
|
|
336
|
-
<option value="custom" ?selected=${!selectedPreset}>
|
|
337
|
-
${this.t('custom_discount')}
|
|
338
|
-
</option>
|
|
339
|
-
</select>
|
|
340
|
-
</span>
|
|
341
|
-
</label>
|
|
342
|
-
`;
|
|
343
|
-
}
|
|
344
|
-
__renderRulesUrlParameter() {
|
|
345
|
-
var _a, _b, _c;
|
|
346
|
-
const name = (_a = this.form.name) !== null && _a !== void 0 ? _a : '';
|
|
347
|
-
const type = (_b = this.form.coupon_discount_type) !== null && _b !== void 0 ? _b : 'quantity_amount';
|
|
348
|
-
const details = (_c = this.form.coupon_discount_details) !== null && _c !== void 0 ? _c : '';
|
|
349
|
-
const urlParameter = `discount_${type}=${encodeURIComponent(`${name}{${details}}`)}`;
|
|
350
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
351
|
-
return html `
|
|
352
|
-
<div data-testid="rules:url" class="text-xs flex space-x-xs">
|
|
353
|
-
<span
|
|
354
|
-
class=${classMap({
|
|
355
|
-
'flex-shrink-0 transition-colors': true,
|
|
356
|
-
'text-tertiary': !isDisabled,
|
|
357
|
-
'text-disabled': isDisabled,
|
|
358
|
-
})}
|
|
359
|
-
>
|
|
360
|
-
<foxy-i18n lang=${this.lang} key="url_parameter" ns=${this.ns}></foxy-i18n>:
|
|
361
|
-
</span>
|
|
362
|
-
|
|
363
|
-
<code
|
|
364
|
-
class=${classMap({
|
|
365
|
-
'bg-contrast-5 transition-colors font-lumo truncate rounded-s px-xs': true,
|
|
366
|
-
'text-secondary': !isDisabled,
|
|
367
|
-
'text-disabled': isDisabled,
|
|
368
|
-
})}
|
|
369
|
-
>
|
|
370
|
-
${urlParameter}
|
|
371
|
-
</code>
|
|
372
|
-
|
|
373
|
-
<foxy-copy-to-clipboard
|
|
374
|
-
data-testid="rules:url:copy"
|
|
375
|
-
text=${urlParameter}
|
|
376
|
-
lang=${this.lang}
|
|
377
|
-
ns="${this.ns} copy-to-clipboard"
|
|
378
|
-
?disabled=${isDisabled}
|
|
379
|
-
>
|
|
380
|
-
</foxy-copy-to-clipboard>
|
|
381
|
-
</div>
|
|
382
|
-
`;
|
|
383
|
-
}
|
|
384
|
-
__renderRulesDescription() {
|
|
385
|
-
var _a, _b;
|
|
386
|
-
const type = (_a = this.form.coupon_discount_type) !== null && _a !== void 0 ? _a : 'quantity_amount';
|
|
387
|
-
const details = (_b = this.form.coupon_discount_details) !== null && _b !== void 0 ? _b : '';
|
|
388
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
389
|
-
return html `
|
|
390
|
-
<div data-testid="rules:description" class="text-xs leading-m">
|
|
391
|
-
<span class="transition-colors ${isDisabled ? 'text-disabled' : 'text-tertiary'}">
|
|
392
|
-
<foxy-i18n lang=${this.lang} key="description" ns=${this.ns}></foxy-i18n>:
|
|
393
|
-
</span>
|
|
394
|
-
|
|
395
|
-
<foxy-i18n
|
|
396
|
-
options=${JSON.stringify({ params: { details, type, ns: this.ns } })}
|
|
397
|
-
class="transition-colors ${isDisabled ? 'text-disabled' : 'text-secondary'}"
|
|
398
|
-
lang=${this.lang}
|
|
399
|
-
key="discount_summary"
|
|
400
|
-
ns=${this.ns}
|
|
401
|
-
>
|
|
402
|
-
</foxy-i18n>
|
|
403
|
-
</div>
|
|
404
|
-
`;
|
|
405
|
-
}
|
|
406
|
-
__renderRules() {
|
|
407
|
-
var _a, _b;
|
|
408
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
409
|
-
const isReadonly = this.readonlySelector.matches('rules', true);
|
|
410
|
-
const details = (_a = this.form.coupon_discount_details) !== null && _a !== void 0 ? _a : '';
|
|
411
|
-
const type = (_b = this.form.coupon_discount_type) !== null && _b !== void 0 ? _b : 'quantity_amount';
|
|
412
|
-
return html `
|
|
413
|
-
<div data-testid="rules">
|
|
414
|
-
${this.renderTemplateOrSlot('rules:before')}
|
|
415
|
-
|
|
416
|
-
<div>
|
|
417
|
-
<div class="flex items-center justify-between space-x-m text-s mb-xs">
|
|
418
|
-
<foxy-i18n
|
|
419
|
-
class=${classMap({
|
|
420
|
-
'transition-colors font-medium flex-1': true,
|
|
421
|
-
'text-secondary': !isDisabled,
|
|
422
|
-
'text-disabled': isDisabled,
|
|
423
|
-
})}
|
|
424
|
-
lang=${this.lang}
|
|
425
|
-
key="rule_plural"
|
|
426
|
-
ns=${this.ns}
|
|
427
|
-
>
|
|
428
|
-
</foxy-i18n>
|
|
429
|
-
|
|
430
|
-
<div class="min-w-0">${this.__renderRulesPreset()}</div>
|
|
431
|
-
</div>
|
|
432
|
-
|
|
433
|
-
<foxy-discount-builder
|
|
434
|
-
data-testclass="interactive"
|
|
435
|
-
lang=${this.lang}
|
|
436
|
-
ns=${this.ns}
|
|
437
|
-
?readonly=${isReadonly}
|
|
438
|
-
?disabled=${isDisabled}
|
|
439
|
-
.parsedValue=${{ details, type, name: 'Rules' }}
|
|
440
|
-
@change=${(evt) => {
|
|
441
|
-
const builder = evt.currentTarget;
|
|
442
|
-
const newParsedValue = builder.parsedValue;
|
|
443
|
-
this.edit({
|
|
444
|
-
coupon_discount_details: newParsedValue.details,
|
|
445
|
-
coupon_discount_type: newParsedValue.type,
|
|
446
|
-
});
|
|
447
|
-
}}
|
|
448
|
-
>
|
|
449
|
-
</foxy-discount-builder>
|
|
259
|
+
</foxy-internal-bulk-add-action-control>
|
|
450
260
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
261
|
+
<foxy-internal-bulk-add-action-control
|
|
262
|
+
parent=${data._links['fx:coupon_codes'].href}
|
|
263
|
+
infer="import"
|
|
264
|
+
form="foxy-coupon-codes-form"
|
|
265
|
+
.related=${[data._links['fx:coupon_codes'].href]}
|
|
266
|
+
>
|
|
267
|
+
</foxy-internal-bulk-add-action-control>
|
|
455
268
|
|
|
456
|
-
|
|
457
|
-
</div>
|
|
269
|
+
${super.renderHeaderActions(data)}
|
|
458
270
|
`;
|
|
459
271
|
}
|
|
460
|
-
|
|
461
|
-
var _a, _b, _c, _d, _e;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
272
|
+
renderBody() {
|
|
273
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
274
|
+
let codesUrl;
|
|
275
|
+
try {
|
|
276
|
+
const url = new URL((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:coupon_codes'].href) !== null && _b !== void 0 ? _b : '');
|
|
277
|
+
url.searchParams.set('order', 'date_created desc');
|
|
278
|
+
codesUrl = url.toString();
|
|
279
|
+
}
|
|
280
|
+
catch (_j) {
|
|
281
|
+
codesUrl = undefined;
|
|
282
|
+
}
|
|
470
283
|
return html `
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
<foxy-i18n
|
|
525
|
-
class="text-s font-medium text-secondary leading-none flex-1"
|
|
526
|
-
lang=${lang}
|
|
527
|
-
key="code_plural"
|
|
528
|
-
ns=${ns}
|
|
529
|
-
>
|
|
530
|
-
</foxy-i18n>
|
|
531
|
-
|
|
532
|
-
<vaadin-button
|
|
533
|
-
data-testid="codes:generate-button"
|
|
534
|
-
theme="success tertiary small"
|
|
535
|
-
?disabled=${isDisabled}
|
|
536
|
-
@click=${(evt) => {
|
|
537
|
-
const dialog = this.renderRoot.querySelector('#generate-codes-dialog');
|
|
538
|
-
const button = evt.currentTarget;
|
|
539
|
-
dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
|
|
540
|
-
}}
|
|
541
|
-
>
|
|
542
|
-
<foxy-i18n class="text-s" lang=${lang} key="generate" ns=${ns}></foxy-i18n>
|
|
543
|
-
<iron-icon class="icon-inline text-s" icon="icons:add"></iron-icon>
|
|
544
|
-
</vaadin-button>
|
|
545
|
-
|
|
546
|
-
<vaadin-button
|
|
547
|
-
data-testid="codes:import-button"
|
|
548
|
-
theme="contrast tertiary small"
|
|
549
|
-
?disabled=${isDisabled}
|
|
550
|
-
@click=${(evt) => {
|
|
551
|
-
const dialog = this.renderRoot.querySelector('#import-dialog');
|
|
552
|
-
const button = evt.currentTarget;
|
|
553
|
-
dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
|
|
554
|
-
}}
|
|
555
|
-
>
|
|
556
|
-
<foxy-i18n class="text-s" lang=${lang} key="import" ns=${ns}></foxy-i18n>
|
|
557
|
-
<iron-icon class="icon-inline text-s" icon="icons:open-in-browser"></iron-icon>
|
|
558
|
-
</vaadin-button>
|
|
284
|
+
${this.renderHeader()}
|
|
285
|
+
|
|
286
|
+
<foxy-internal-text-control infer="name"></foxy-internal-text-control>
|
|
287
|
+
|
|
288
|
+
<foxy-internal-coupon-form-rules-control infer="rules">
|
|
289
|
+
</foxy-internal-coupon-form-rules-control>
|
|
290
|
+
|
|
291
|
+
<foxy-internal-async-list-control
|
|
292
|
+
first=${codesUrl}
|
|
293
|
+
limit="5"
|
|
294
|
+
infer="coupon-codes"
|
|
295
|
+
item="foxy-coupon-code-card"
|
|
296
|
+
form="foxy-coupon-code-form"
|
|
297
|
+
alert
|
|
298
|
+
.formProps=${{ '.getTransactionPageHref': this.getTransactionPageHref }}
|
|
299
|
+
.actions=${this.__couponCodesActions}
|
|
300
|
+
.filters=${this.__codesFilters}
|
|
301
|
+
>
|
|
302
|
+
</foxy-internal-async-list-control>
|
|
303
|
+
|
|
304
|
+
<foxy-internal-query-builder-control
|
|
305
|
+
infer="item-option-restrictions"
|
|
306
|
+
disable-or
|
|
307
|
+
.operators=${this.__itemOptionRestrictionsOperators}
|
|
308
|
+
.getValue=${this.__itemOptionRestrictionsGetValue}
|
|
309
|
+
.setValue=${this.__itemOptionRestrictionsSetValue}
|
|
310
|
+
>
|
|
311
|
+
</foxy-internal-query-builder-control>
|
|
312
|
+
|
|
313
|
+
<foxy-internal-editable-list-control
|
|
314
|
+
infer="product-code-restrictions"
|
|
315
|
+
.getValue=${this.__productCodeRestrictionsGetValue}
|
|
316
|
+
.setValue=${this.__productCodeRestrictionsSetValue}
|
|
317
|
+
.units=${[
|
|
318
|
+
{ label: this.t('product-code-restrictions.unit_allow'), value: 'allow' },
|
|
319
|
+
{ label: this.t('product-code-restrictions.unit_block'), value: 'block' },
|
|
320
|
+
]}
|
|
321
|
+
>
|
|
322
|
+
</foxy-internal-editable-list-control>
|
|
323
|
+
|
|
324
|
+
<foxy-internal-async-resource-link-list-control
|
|
325
|
+
foreign-key-for-uri="item_category_uri"
|
|
326
|
+
foreign-key-for-id="item_category_id"
|
|
327
|
+
own-key-for-uri="coupon_uri"
|
|
328
|
+
own-uri=${ifDefined((_c = this.data) === null || _c === void 0 ? void 0 : _c._links.self.href)}
|
|
329
|
+
embed-key="fx:coupon_item_categories"
|
|
330
|
+
options-href=${ifDefined((_e = (_d = this.__storeLoader) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e._links['fx:item_categories'].href)}
|
|
331
|
+
links-href=${ifDefined((_f = this.data) === null || _f === void 0 ? void 0 : _f._links['fx:coupon_item_categories'].href)}
|
|
332
|
+
infer="category-restrictions"
|
|
333
|
+
limit="5"
|
|
334
|
+
item="foxy-item-category-card"
|
|
335
|
+
>
|
|
336
|
+
</foxy-internal-async-resource-link-list-control>
|
|
559
337
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
?disabled=${isDisabled}
|
|
564
|
-
@click=${() => (this.__codesTableQuery = filters === null ? '' : null)}
|
|
565
|
-
>
|
|
566
|
-
<foxy-i18n class="text-s" lang=${lang} key=${filterButtonLabel} ns=${ns}></foxy-i18n>
|
|
567
|
-
<iron-icon class="icon-inline text-s" icon=${filterButtonIcon}></iron-icon>
|
|
568
|
-
</vaadin-button>
|
|
569
|
-
</div>
|
|
338
|
+
<div class="grid gap-l sm-grid-cols-3">
|
|
339
|
+
<foxy-internal-integer-control infer="number-of-uses-allowed" min="0" show-controls>
|
|
340
|
+
</foxy-internal-integer-control>
|
|
570
341
|
|
|
571
|
-
<foxy-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
?disabled=${isDisabled}
|
|
576
|
-
?hidden=${filters === null}
|
|
577
|
-
.options=${CouponForm.__codesQueryOptions}
|
|
578
|
-
.value=${filters}
|
|
579
|
-
@change=${(evt) => {
|
|
580
|
-
const queryBuilder = evt.currentTarget;
|
|
581
|
-
this.__codesTableQuery = queryBuilder.value;
|
|
582
|
-
}}
|
|
342
|
+
<foxy-internal-integer-control
|
|
343
|
+
infer="number-of-uses-allowed-per-customer"
|
|
344
|
+
min="0"
|
|
345
|
+
show-controls
|
|
583
346
|
>
|
|
584
|
-
</foxy-
|
|
347
|
+
</foxy-internal-integer-control>
|
|
585
348
|
|
|
586
|
-
<foxy-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
?disabled=${isDisabled}
|
|
349
|
+
<foxy-internal-integer-control
|
|
350
|
+
infer="number-of-uses-allowed-per-code"
|
|
351
|
+
min="0"
|
|
352
|
+
show-controls
|
|
591
353
|
>
|
|
592
|
-
|
|
593
|
-
class="px-m mb-s border border-contrast-10 rounded"
|
|
594
|
-
group=${group}
|
|
595
|
-
lang=${lang}
|
|
596
|
-
ns=${ns}
|
|
597
|
-
.columns=${this.__codesTableColumns}
|
|
598
|
-
>
|
|
599
|
-
</foxy-table>
|
|
600
|
-
</foxy-pagination>
|
|
601
|
-
|
|
602
|
-
${this.renderTemplateOrSlot('codes:after')}
|
|
603
|
-
</div>
|
|
604
|
-
`;
|
|
605
|
-
}
|
|
606
|
-
__renderUsage() {
|
|
607
|
-
var _a, _b, _c;
|
|
608
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches('usage', true);
|
|
609
|
-
const isReadonly = this.readonlySelector.matches('usage', true);
|
|
610
|
-
const usesPerCoupon = (_a = this.form.number_of_uses_allowed) !== null && _a !== void 0 ? _a : 0;
|
|
611
|
-
const usesPerCustomer = (_b = this.form.number_of_uses_allowed_per_customer) !== null && _b !== void 0 ? _b : 0;
|
|
612
|
-
const usesPerCouponCode = (_c = this.form.number_of_uses_allowed_per_code) !== null && _c !== void 0 ? _c : 0;
|
|
613
|
-
return html `
|
|
614
|
-
<div data-testid="usage">
|
|
615
|
-
${this.renderTemplateOrSlot('usage:before')}
|
|
616
|
-
|
|
617
|
-
<div class="space-y-s">
|
|
618
|
-
<div class="grid gap-m grid-cols-3">
|
|
619
|
-
<vaadin-integer-field
|
|
620
|
-
placeholder=${this.t('unlimited')}
|
|
621
|
-
data-testid="usage:per-coupon"
|
|
622
|
-
label=${this.t('uses_per_coupon')}
|
|
623
|
-
class="w-full"
|
|
624
|
-
min="0"
|
|
625
|
-
prevent-invalid-input
|
|
626
|
-
has-controls
|
|
627
|
-
.value=${usesPerCoupon || ''}
|
|
628
|
-
?disabled=${isDisabled}
|
|
629
|
-
?readonly=${isReadonly}
|
|
630
|
-
@change=${(evt) => {
|
|
631
|
-
const field = evt.currentTarget;
|
|
632
|
-
this.edit({ number_of_uses_allowed: parseInt(field.value) });
|
|
633
|
-
}}
|
|
634
|
-
>
|
|
635
|
-
</vaadin-integer-field>
|
|
636
|
-
|
|
637
|
-
<vaadin-integer-field
|
|
638
|
-
placeholder=${this.t('unlimited')}
|
|
639
|
-
data-testid="usage:per-coupon-code"
|
|
640
|
-
label=${this.t('uses_per_coupon_code')}
|
|
641
|
-
class="w-full"
|
|
642
|
-
min="0"
|
|
643
|
-
prevent-invalid-input
|
|
644
|
-
has-controls
|
|
645
|
-
.value=${usesPerCouponCode || ''}
|
|
646
|
-
?disabled=${isDisabled}
|
|
647
|
-
?readonly=${isReadonly}
|
|
648
|
-
@change=${(evt) => {
|
|
649
|
-
const field = evt.currentTarget;
|
|
650
|
-
this.edit({ number_of_uses_allowed_per_code: parseInt(field.value) });
|
|
651
|
-
}}
|
|
652
|
-
>
|
|
653
|
-
</vaadin-integer-field>
|
|
654
|
-
|
|
655
|
-
<vaadin-integer-field
|
|
656
|
-
placeholder=${this.t('unlimited')}
|
|
657
|
-
data-testid="usage:per-customer"
|
|
658
|
-
label=${this.t('uses_per_customer')}
|
|
659
|
-
class="w-full"
|
|
660
|
-
min="0"
|
|
661
|
-
prevent-invalid-input
|
|
662
|
-
has-controls
|
|
663
|
-
.value=${usesPerCustomer || ''}
|
|
664
|
-
?disabled=${isDisabled}
|
|
665
|
-
?readonly=${isReadonly}
|
|
666
|
-
@change=${(evt) => {
|
|
667
|
-
const field = evt.currentTarget;
|
|
668
|
-
this.edit({ number_of_uses_allowed_per_customer: parseInt(field.value) });
|
|
669
|
-
}}
|
|
670
|
-
>
|
|
671
|
-
</vaadin-integer-field>
|
|
672
|
-
</div>
|
|
673
|
-
|
|
674
|
-
<div
|
|
675
|
-
class=${classMap({
|
|
676
|
-
'transition-colors text-xs leading-s': true,
|
|
677
|
-
'text-secondary': !isDisabled,
|
|
678
|
-
'text-disabled': isDisabled,
|
|
679
|
-
})}
|
|
680
|
-
>
|
|
681
|
-
<foxy-i18n
|
|
682
|
-
options=${JSON.stringify({ count: usesPerCoupon })}
|
|
683
|
-
lang=${this.lang}
|
|
684
|
-
key="uses_per_coupon_summary${usesPerCoupon ? '' : '_0'}"
|
|
685
|
-
ns=${this.ns}
|
|
686
|
-
>
|
|
687
|
-
</foxy-i18n>
|
|
688
|
-
|
|
689
|
-
<foxy-i18n
|
|
690
|
-
options=${JSON.stringify({ count: usesPerCouponCode })}
|
|
691
|
-
lang=${this.lang}
|
|
692
|
-
key="uses_per_coupon_code_summary${usesPerCouponCode ? '' : '_0'}"
|
|
693
|
-
ns=${this.ns}
|
|
694
|
-
>
|
|
695
|
-
</foxy-i18n>
|
|
696
|
-
|
|
697
|
-
<foxy-i18n
|
|
698
|
-
options=${JSON.stringify({ count: usesPerCustomer })}
|
|
699
|
-
lang=${this.lang}
|
|
700
|
-
key="uses_per_customer_summary${usesPerCustomer ? '' : '_0'}"
|
|
701
|
-
ns=${this.ns}
|
|
702
|
-
>
|
|
703
|
-
</foxy-i18n>
|
|
704
|
-
</div>
|
|
705
|
-
</div>
|
|
706
|
-
|
|
707
|
-
${this.renderTemplateOrSlot('usage:after')}
|
|
708
|
-
</div>
|
|
709
|
-
`;
|
|
710
|
-
}
|
|
711
|
-
__renderProductRestrictions() {
|
|
712
|
-
var _a;
|
|
713
|
-
const scope = 'product-restrictions';
|
|
714
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope, true);
|
|
715
|
-
const isReadonly = this.readonlySelector.matches(scope, true);
|
|
716
|
-
const restrictions = (_a = this.form.product_code_restrictions) !== null && _a !== void 0 ? _a : '';
|
|
717
|
-
const groups = [
|
|
718
|
-
{ header: 'allow', items: [] },
|
|
719
|
-
{ header: 'block', items: [] },
|
|
720
|
-
];
|
|
721
|
-
if (restrictions) {
|
|
722
|
-
restrictions.split(',').forEach(value => {
|
|
723
|
-
const trimmedValue = value.trim();
|
|
724
|
-
if (!trimmedValue)
|
|
725
|
-
return;
|
|
726
|
-
const isBlocklistValue = trimmedValue.startsWith('-');
|
|
727
|
-
const target = isBlocklistValue ? 1 : 0;
|
|
728
|
-
const label = isBlocklistValue ? trimmedValue.substring(1) : trimmedValue;
|
|
729
|
-
groups[target].items.push({ label, value: trimmedValue });
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
return html `
|
|
733
|
-
<div data-testid="product-restrictions">
|
|
734
|
-
${this.renderTemplateOrSlot('product-restrictions:before')}
|
|
735
|
-
|
|
736
|
-
<div class="space-y-s">
|
|
737
|
-
<x-group frame>
|
|
738
|
-
<foxy-i18n
|
|
739
|
-
class=${isDisabled ? 'text-disabled' : 'text-secondary'}
|
|
740
|
-
slot="header"
|
|
741
|
-
lang=${this.lang}
|
|
742
|
-
key="product_restrictions"
|
|
743
|
-
ns=${this.ns}
|
|
744
|
-
>
|
|
745
|
-
</foxy-i18n>
|
|
746
|
-
|
|
747
|
-
<div class="grid sm-grid-cols-2 bg-contrast-10" style="gap: 1px">
|
|
748
|
-
${groups.map((group, index) => {
|
|
749
|
-
return html `
|
|
750
|
-
<x-group class="bg-base pt-m">
|
|
751
|
-
<foxy-i18n
|
|
752
|
-
class=${isDisabled ? 'text-disabled' : 'text-tertiary'}
|
|
753
|
-
slot="header"
|
|
754
|
-
lang=${this.lang}
|
|
755
|
-
key=${group.header}
|
|
756
|
-
ns=${this.ns}
|
|
757
|
-
>
|
|
758
|
-
</foxy-i18n>
|
|
759
|
-
|
|
760
|
-
<x-editable-list
|
|
761
|
-
data-testid="product-restrictions:${group.header}"
|
|
762
|
-
lang=${this.lang}
|
|
763
|
-
ns=${this.ns}
|
|
764
|
-
?disabled=${isDisabled}
|
|
765
|
-
?readonly=${isReadonly}
|
|
766
|
-
.items=${group.items}
|
|
767
|
-
@change=${(evt) => {
|
|
768
|
-
const newItemsByGroup = [
|
|
769
|
-
index === 0 ? evt.currentTarget.items : groups[0].items,
|
|
770
|
-
index === 1 ? evt.currentTarget.items : groups[1].items,
|
|
771
|
-
];
|
|
772
|
-
const newSanitizedItemsByGroup = newItemsByGroup
|
|
773
|
-
.map(list => list.map(v => v.value.replace(/^[\s-]*/, '').trimEnd()))
|
|
774
|
-
.map(list => list.filter(v => !!v))
|
|
775
|
-
.map(list => Array.from(new Set(list)));
|
|
776
|
-
const newRestrictions = newSanitizedItemsByGroup[0]
|
|
777
|
-
.concat(newSanitizedItemsByGroup[1].map(v => `-${v}`))
|
|
778
|
-
.join(',');
|
|
779
|
-
this.edit({ product_code_restrictions: newRestrictions });
|
|
780
|
-
}}
|
|
781
|
-
>
|
|
782
|
-
</x-editable-list>
|
|
783
|
-
</x-group>
|
|
784
|
-
`;
|
|
785
|
-
})}
|
|
786
|
-
</div>
|
|
787
|
-
</x-group>
|
|
788
|
-
|
|
789
|
-
<foxy-i18n
|
|
790
|
-
class=${classMap({
|
|
791
|
-
'block text-xs leading-s transition-colors': true,
|
|
792
|
-
'text-secondary': !isDisabled,
|
|
793
|
-
'text-disabled': isDisabled,
|
|
794
|
-
})}
|
|
795
|
-
lang=${this.lang}
|
|
796
|
-
key="product_restrictions_explainer"
|
|
797
|
-
ns=${this.ns}
|
|
798
|
-
>
|
|
799
|
-
</foxy-i18n>
|
|
800
|
-
</div>
|
|
801
|
-
|
|
802
|
-
${this.renderTemplateOrSlot('product-restrictions:after')}
|
|
803
|
-
</div>
|
|
804
|
-
`;
|
|
805
|
-
}
|
|
806
|
-
__renderCategoryRestrictions() {
|
|
807
|
-
var _a, _b, _c;
|
|
808
|
-
const scope = 'category-restrictions';
|
|
809
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope, true);
|
|
810
|
-
const isReadonly = this.readonlySelector.matches(scope, true);
|
|
811
|
-
return html `
|
|
812
|
-
<div data-testid="category-restrictions">
|
|
813
|
-
${this.renderTemplateOrSlot('category-restrictions:before')}
|
|
814
|
-
|
|
815
|
-
<div class="space-y-xs">
|
|
816
|
-
<foxy-pagination
|
|
817
|
-
first=${this.__itemCategories}
|
|
818
|
-
lang=${this.lang}
|
|
819
|
-
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-pagination')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
820
|
-
?disabled=${isDisabled}
|
|
821
|
-
>
|
|
822
|
-
<foxy-i18n
|
|
823
|
-
class="block text-s font-medium text-secondary leading-none mb-s"
|
|
824
|
-
lang=${this.lang}
|
|
825
|
-
key="category_restrictions"
|
|
826
|
-
ns=${this.ns}
|
|
827
|
-
>
|
|
828
|
-
</foxy-i18n>
|
|
829
|
-
|
|
830
|
-
<x-category-restrictions-page
|
|
831
|
-
coupon-item-categories=${ifDefined((_c = this.data) === null || _c === void 0 ? void 0 : _c._links['fx:coupon_item_categories'].href)}
|
|
832
|
-
data-testid="category-restrictions:page"
|
|
833
|
-
coupon=${this.href}
|
|
834
|
-
class="border border-contrast-10 rounded mb-s"
|
|
835
|
-
group=${this.group}
|
|
836
|
-
lang=${this.lang}
|
|
837
|
-
ns=${this.ns}
|
|
838
|
-
?disabled=${isDisabled}
|
|
839
|
-
?readonly=${isReadonly}
|
|
840
|
-
>
|
|
841
|
-
</x-category-restrictions-page>
|
|
842
|
-
</foxy-pagination>
|
|
843
|
-
|
|
844
|
-
<foxy-i18n
|
|
845
|
-
class="block text-xs leading-s text-tertiary"
|
|
846
|
-
lang=${this.lang}
|
|
847
|
-
key="category_restrictions_helper_text"
|
|
848
|
-
ns=${this.ns}
|
|
849
|
-
>
|
|
850
|
-
</foxy-i18n>
|
|
851
|
-
</div>
|
|
852
|
-
|
|
853
|
-
${this.renderTemplateOrSlot('category-restrictions:after')}
|
|
354
|
+
</foxy-internal-integer-control>
|
|
854
355
|
</div>
|
|
855
|
-
`;
|
|
856
|
-
}
|
|
857
|
-
__renderCustomerAttributeRestrictions() {
|
|
858
|
-
var _a;
|
|
859
|
-
const scope = 'customer-attribute-restrictions';
|
|
860
|
-
const isDisabled = this.disabledSelector.matches(scope, true);
|
|
861
|
-
const isReadonly = this.readonlySelector.matches(scope, true);
|
|
862
|
-
return html `
|
|
863
|
-
<div data-testid="customer-attribute-restrictions">
|
|
864
|
-
${this.renderTemplateOrSlot(`${scope}:before`)}
|
|
865
|
-
|
|
866
|
-
<div
|
|
867
|
-
class=${classMap({
|
|
868
|
-
'grid gap-xs leading-xs transition-colors': true,
|
|
869
|
-
'text-secondary hover-text-body': !isDisabled && !isReadonly,
|
|
870
|
-
'text-disabled': isDisabled,
|
|
871
|
-
'text-body': isReadonly,
|
|
872
|
-
})}
|
|
873
|
-
>
|
|
874
|
-
<foxy-i18n class="text-s font-medium" infer=${scope} key="label"></foxy-i18n>
|
|
875
|
-
|
|
876
|
-
<foxy-query-builder
|
|
877
|
-
infer=${scope}
|
|
878
|
-
.value=${(_a = this.form.customer_attribute_restrictions) !== null && _a !== void 0 ? _a : null}
|
|
879
|
-
@change=${(evt) => {
|
|
880
|
-
var _a;
|
|
881
|
-
const queryBuilder = evt.currentTarget;
|
|
882
|
-
this.edit({ customer_attribute_restrictions: (_a = queryBuilder.value) !== null && _a !== void 0 ? _a : '' });
|
|
883
|
-
this.edit({
|
|
884
|
-
customer_auto_apply: !!this.form.customer_subscription_restrictions ||
|
|
885
|
-
!!this.form.customer_attribute_restrictions,
|
|
886
|
-
});
|
|
887
|
-
}}
|
|
888
|
-
>
|
|
889
|
-
</foxy-query-builder>
|
|
890
356
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
357
|
+
<div class="grid gap-l sm-grid-cols-2">
|
|
358
|
+
<foxy-internal-date-control infer="start-date"></foxy-internal-date-control>
|
|
359
|
+
<foxy-internal-date-control infer="end-date"></foxy-internal-date-control>
|
|
895
360
|
</div>
|
|
896
|
-
`;
|
|
897
|
-
}
|
|
898
|
-
__renderOptions() {
|
|
899
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches('options', true);
|
|
900
|
-
const isReadonly = this.readonlySelector.matches('options', true);
|
|
901
|
-
const options = [
|
|
902
|
-
{ param: 'multiple_codes_allowed' },
|
|
903
|
-
{ param: 'combinable' },
|
|
904
|
-
{ param: 'exclude_category_discounts', label: 'combine_with_category_discounts', flip: true },
|
|
905
|
-
{ param: 'exclude_line_item_discounts', label: 'combine_with_line_discounts', flip: true },
|
|
906
|
-
{ param: 'is_taxable', label: 'apply_taxes_before_coupon' },
|
|
907
|
-
];
|
|
908
|
-
return html `
|
|
909
|
-
<div data-testid="options">
|
|
910
|
-
${this.renderTemplateOrSlot('options:before')}
|
|
911
|
-
|
|
912
|
-
<x-group frame>
|
|
913
|
-
<foxy-i18n
|
|
914
|
-
class="transition-colors ${isDisabled ? 'text-disabled' : 'text-secondary'}"
|
|
915
|
-
slot="header"
|
|
916
|
-
lang=${this.lang}
|
|
917
|
-
key="option_plural"
|
|
918
|
-
ns=${this.ns}
|
|
919
|
-
>
|
|
920
|
-
</foxy-i18n>
|
|
921
|
-
|
|
922
|
-
${options.map(option => {
|
|
923
|
-
var _a;
|
|
924
|
-
const value = this.form[option.param];
|
|
925
|
-
const label = (_a = option.label) !== null && _a !== void 0 ? _a : option.param;
|
|
926
|
-
const color = isDisabled ? 'text-disabled' : 'text-secondary';
|
|
927
|
-
return html `
|
|
928
|
-
<x-checkbox
|
|
929
|
-
data-testclass="inputs"
|
|
930
|
-
data-testid="options:${option.param.replace(/_/g, '-')}"
|
|
931
|
-
?disabled=${isDisabled}
|
|
932
|
-
?readonly=${isReadonly}
|
|
933
|
-
?checked=${option.flip ? !value : value}
|
|
934
|
-
class="m-m"
|
|
935
|
-
@change=${(evt) => {
|
|
936
|
-
this.edit({ [option.param]: option.flip ? !evt.detail : evt.detail });
|
|
937
|
-
}}
|
|
938
|
-
>
|
|
939
|
-
<div class="flex flex-col">
|
|
940
|
-
<foxy-i18n lang=${this.lang} key=${label} ns=${this.ns}></foxy-i18n>
|
|
941
|
-
<foxy-i18n
|
|
942
|
-
class="transition-colors text-xs leading-s ${color}"
|
|
943
|
-
lang=${this.lang}
|
|
944
|
-
key="${label}_explainer"
|
|
945
|
-
ns=${this.ns}
|
|
946
|
-
>
|
|
947
|
-
</foxy-i18n>
|
|
948
|
-
</div>
|
|
949
|
-
</x-checkbox>
|
|
950
|
-
|
|
951
|
-
<div style="margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))">
|
|
952
|
-
<div class="border-b border-contrast-10"></div>
|
|
953
|
-
</div>
|
|
954
|
-
`;
|
|
955
|
-
})}
|
|
956
|
-
|
|
957
|
-
<x-checkbox
|
|
958
|
-
data-testclass="inputs"
|
|
959
|
-
data-testid="options:dates"
|
|
960
|
-
?disabled=${isDisabled}
|
|
961
|
-
?readonly=${isReadonly}
|
|
962
|
-
?checked=${this.form.start_date || this.form.end_date}
|
|
963
|
-
class="m-m"
|
|
964
|
-
@change=${(evt) => {
|
|
965
|
-
if (evt instanceof CheckboxChangeEvent) {
|
|
966
|
-
let startDate = null;
|
|
967
|
-
let endDate = null;
|
|
968
|
-
if (evt.detail) {
|
|
969
|
-
const today = Date.now();
|
|
970
|
-
const oneMonthFromToday = new Date(today).setMonth(new Date().getMonth() + 1);
|
|
971
|
-
startDate = serializeDate(new Date(today));
|
|
972
|
-
endDate = serializeDate(new Date(oneMonthFromToday));
|
|
973
|
-
}
|
|
974
|
-
this.edit({ start_date: startDate, end_date: endDate });
|
|
975
|
-
}
|
|
976
|
-
}}
|
|
977
|
-
>
|
|
978
|
-
<div class="flex flex-col">
|
|
979
|
-
<foxy-i18n lang=${this.lang} key="set_time_constraints" ns=${this.ns}></foxy-i18n>
|
|
980
|
-
<foxy-i18n
|
|
981
|
-
class="text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}"
|
|
982
|
-
lang=${this.lang}
|
|
983
|
-
key="set_time_constraints_explainer"
|
|
984
|
-
ns=${this.ns}
|
|
985
|
-
>
|
|
986
|
-
</foxy-i18n>
|
|
987
|
-
</div>
|
|
988
361
|
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
<div
|
|
992
|
-
class="grid grid-cols-2 gap-m mt-m"
|
|
993
|
-
slot="content"
|
|
994
|
-
style="--lumo-border-radius: var(--lumo-border-radius-s)"
|
|
995
|
-
>
|
|
996
|
-
${['start_date', 'end_date'].map(property => {
|
|
997
|
-
const formValue = this.form[property];
|
|
998
|
-
const pickerValue = formValue
|
|
999
|
-
? formValue.length > 10
|
|
1000
|
-
? serializeDate(new Date(formValue))
|
|
1001
|
-
: formValue
|
|
1002
|
-
: '';
|
|
1003
|
-
return html `
|
|
1004
|
-
<vaadin-date-picker
|
|
1005
|
-
data-testclass="inputs"
|
|
1006
|
-
data-testid="options:${property.replace('_', '-')}"
|
|
1007
|
-
placeholder=${this.t('select')}
|
|
1008
|
-
label=${this.t(property)}
|
|
1009
|
-
clear-button-visible
|
|
1010
|
-
?disabled=${isDisabled}
|
|
1011
|
-
?readonly=${isReadonly}
|
|
1012
|
-
.value=${live(pickerValue)}
|
|
1013
|
-
@change=${(evt) => {
|
|
1014
|
-
const field = evt.currentTarget;
|
|
1015
|
-
this.edit({ [property]: field.value });
|
|
1016
|
-
}}
|
|
1017
|
-
>
|
|
1018
|
-
</vaadin-date-picker>
|
|
1019
|
-
`;
|
|
1020
|
-
})}
|
|
1021
|
-
</div>
|
|
1022
|
-
`
|
|
1023
|
-
: ''}
|
|
1024
|
-
</x-checkbox>
|
|
1025
|
-
</x-group>
|
|
362
|
+
<foxy-internal-number-control min="0" max="1" infer="inclusive-tax-rate">
|
|
363
|
+
</foxy-internal-number-control>
|
|
1026
364
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
<x-metadata
|
|
1037
|
-
data-testid="timestamps"
|
|
1038
|
-
.items=${['date_modified', 'date_created'].map(field => {
|
|
1039
|
-
var _a;
|
|
1040
|
-
return ({
|
|
1041
|
-
name: this.t(field),
|
|
1042
|
-
value: ((_a = this.data) === null || _a === void 0 ? void 0 : _a[field]) ? this.t('date', { value: new Date(this.data[field]) })
|
|
1043
|
-
: '',
|
|
1044
|
-
});
|
|
1045
|
-
})}
|
|
1046
|
-
>
|
|
1047
|
-
</x-metadata>
|
|
365
|
+
<foxy-internal-checkbox-group-control
|
|
366
|
+
infer="options"
|
|
367
|
+
theme="vertical"
|
|
368
|
+
.getValue=${this.__optionsGetValue}
|
|
369
|
+
.setValue=${this.__optionsSetValue}
|
|
370
|
+
.options=${this.__optionsOptions}
|
|
371
|
+
>
|
|
372
|
+
</foxy-internal-checkbox-group-control>
|
|
1048
373
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
374
|
+
<foxy-internal-editable-list-control
|
|
375
|
+
infer="customer-subscription-restrictions"
|
|
376
|
+
.getValue=${this.__customerSubscriptionRestrictionsGetValue}
|
|
377
|
+
.setValue=${this.__customerSubscriptionRestrictionsSetValue}
|
|
378
|
+
>
|
|
379
|
+
</foxy-internal-editable-list-control>
|
|
380
|
+
|
|
381
|
+
<foxy-internal-query-builder-control infer="customer-attribute-restrictions">
|
|
382
|
+
</foxy-internal-query-builder-control>
|
|
383
|
+
|
|
384
|
+
<foxy-internal-async-list-control
|
|
385
|
+
first=${ifDefined((_g = this.data) === null || _g === void 0 ? void 0 : _g._links['fx:attributes'].href)}
|
|
386
|
+
limit="5"
|
|
387
|
+
infer="attributes"
|
|
388
|
+
item="foxy-attribute-card"
|
|
389
|
+
form="foxy-attribute-form"
|
|
390
|
+
alert
|
|
391
|
+
>
|
|
392
|
+
</foxy-internal-async-list-control>
|
|
1065
393
|
|
|
1066
|
-
|
|
1067
|
-
data-testid="create"
|
|
1068
|
-
class="w-full"
|
|
1069
|
-
theme="primary success"
|
|
1070
|
-
?disabled=${!isIdle || isInvalid || this.disabledSelector.matches('create', true)}
|
|
1071
|
-
@click=${this.submit}
|
|
1072
|
-
>
|
|
1073
|
-
<foxy-i18n ns=${this.ns} key="create" lang=${this.lang}></foxy-i18n>
|
|
1074
|
-
</vaadin-button>
|
|
394
|
+
${super.renderBody()}
|
|
1075
395
|
|
|
1076
|
-
|
|
1077
|
-
|
|
396
|
+
<foxy-nucleon
|
|
397
|
+
infer=""
|
|
398
|
+
class="hidden"
|
|
399
|
+
href=${ifDefined((_h = this.data) === null || _h === void 0 ? void 0 : _h._links['fx:store'].href)}
|
|
400
|
+
id=${this.__storeLoaderId}
|
|
401
|
+
@update=${() => this.requestUpdate()}
|
|
402
|
+
>
|
|
403
|
+
</foxy-nucleon>
|
|
1078
404
|
`;
|
|
1079
405
|
}
|
|
1080
|
-
|
|
1081
|
-
return
|
|
1082
|
-
<div>
|
|
1083
|
-
<foxy-internal-confirm-dialog
|
|
1084
|
-
data-testid="confirm"
|
|
1085
|
-
message="delete_prompt"
|
|
1086
|
-
confirm="delete"
|
|
1087
|
-
cancel="cancel"
|
|
1088
|
-
header="delete"
|
|
1089
|
-
theme="primary error"
|
|
1090
|
-
lang=${this.lang}
|
|
1091
|
-
ns=${this.ns}
|
|
1092
|
-
id="confirm"
|
|
1093
|
-
@hide=${(evt) => !evt.detail.cancelled && this.delete()}
|
|
1094
|
-
>
|
|
1095
|
-
</foxy-internal-confirm-dialog>
|
|
1096
|
-
|
|
1097
|
-
${this.renderTemplateOrSlot('delete:before')}
|
|
1098
|
-
|
|
1099
|
-
<vaadin-button
|
|
1100
|
-
data-testid="delete"
|
|
1101
|
-
theme="error"
|
|
1102
|
-
class="w-full"
|
|
1103
|
-
?disabled=${!this.in('idle') || this.disabledSelector.matches('delete', true)}
|
|
1104
|
-
@click=${(evt) => {
|
|
1105
|
-
const confirm = this.renderRoot.querySelector('#confirm');
|
|
1106
|
-
confirm.show(evt.currentTarget);
|
|
1107
|
-
}}
|
|
1108
|
-
>
|
|
1109
|
-
<foxy-i18n ns=${this.ns} key="delete" lang=${this.lang}></foxy-i18n>
|
|
1110
|
-
</vaadin-button>
|
|
1111
|
-
|
|
1112
|
-
${this.renderTemplateOrSlot('delete:after')}
|
|
1113
|
-
</div>
|
|
1114
|
-
`;
|
|
406
|
+
get __storeLoader() {
|
|
407
|
+
return this.renderRoot.querySelector(`#${this.__storeLoaderId}`);
|
|
1115
408
|
}
|
|
1116
409
|
}
|
|
1117
|
-
CouponForm.__codesQueryOptions = [
|
|
1118
|
-
{ label: 'code', path: 'code', type: Type.String },
|
|
1119
|
-
{ label: 'used_codes', path: 'number_of_uses_to_date', type: Type.Number },
|
|
1120
|
-
{ label: 'date_created', path: 'date_created', type: Type.Date },
|
|
1121
|
-
{ label: 'date_modified', path: 'date_modified', type: Type.Date },
|
|
1122
|
-
];
|
|
1123
410
|
//# sourceMappingURL=CouponForm.js.map
|