@foxy.io/elements 1.15.0-beta.1 → 1.15.0-beta.10
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 +2 -2
- package/dist/cdn/foxy-address-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-cancellation-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-coupon-card.js +1 -0
- package/dist/cdn/foxy-coupon-code-form.js +1 -0
- package/dist/cdn/foxy-coupon-codes-form.js +1 -0
- package/dist/cdn/foxy-coupon-form.js +1 -0
- 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.js +1 -972
- package/dist/cdn/foxy-customer-portal.js +13 -13
- package/dist/cdn/foxy-customer.js +2 -2
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.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-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -0
- package/dist/cdn/foxy-gift-card-card.js +1 -0
- package/dist/cdn/foxy-gift-card-code-form.js +1 -0
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -0
- package/dist/cdn/foxy-gift-card-form.js +1 -0
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -0
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -69
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +4 -4
- 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-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/shared-00d6a968.js +1 -0
- package/dist/cdn/shared-023a97c2.js +302 -0
- package/dist/cdn/{shared-91e768be.js → shared-027c537d.js} +1 -1
- package/dist/cdn/{shared-f0a83bd6.js → shared-073cb8e9.js} +1 -1
- package/dist/cdn/{shared-8a7bee0d.js → shared-09c5f9f1.js} +1 -1
- package/dist/cdn/{shared-94b0ae99.js → shared-0f38a631.js} +2 -2
- package/dist/cdn/{shared-200f613b.js → shared-1a67bc75.js} +2 -2
- package/dist/cdn/{shared-34b2c1e2.js → shared-21419f10.js} +1 -1
- package/dist/cdn/{shared-b5147166.js → shared-340f7584.js} +3 -3
- package/dist/cdn/{shared-44cfc617.js → shared-39e3ae67.js} +1 -1
- package/dist/cdn/shared-3f0a9c2c.js +1 -0
- package/dist/cdn/shared-3f965dce.js +1 -0
- package/dist/cdn/{shared-e7f8ffe9.js → shared-448781f9.js} +1 -1
- package/dist/cdn/{shared-1761daef.js → shared-5535f38f.js} +1 -1
- package/dist/cdn/{shared-0ced76a0.js → shared-5a54a9bc.js} +1 -1
- package/dist/cdn/shared-5e2fd1c7.js +1 -0
- package/dist/cdn/{shared-5c8b531d.js → shared-60d43523.js} +1 -1
- package/dist/cdn/shared-625c1272.js +69 -0
- package/dist/cdn/shared-65dfd512.js +131 -0
- package/dist/cdn/{shared-a46edf4b.js → shared-756034e4.js} +1 -1
- package/dist/cdn/{shared-00563cb0.js → shared-7f0a9790.js} +1 -1
- package/dist/cdn/shared-84d2d490.js +1 -0
- package/dist/cdn/{shared-df573cea.js → shared-8b20bc23.js} +0 -0
- package/dist/cdn/shared-8c8a910c.js +1 -0
- package/dist/cdn/{shared-5f54e916.js → shared-9cd49a3e.js} +4 -4
- package/dist/cdn/{shared-7a42073a.js → shared-9fc4a896.js} +1 -1
- package/dist/cdn/{shared-bb824ab4.js → shared-a040d79d.js} +2 -2
- package/dist/cdn/{shared-bc2bfe52.js → shared-ab71552b.js} +1 -1
- package/dist/cdn/shared-ae8cd227.js +1 -0
- package/dist/cdn/{shared-322e60b1.js → shared-ba39823e.js} +1 -1
- package/dist/cdn/shared-d58c947c.js +804 -0
- package/dist/cdn/{shared-593f7e2c.js → shared-df730f90.js} +1 -1
- package/dist/cdn/shared-e55088b4.js +1 -0
- package/dist/cdn/shared-ecfd3539.js +1 -0
- package/dist/cdn/shared-f2a69797.js +1 -0
- package/dist/cdn/{shared-16f72e27.js → shared-f4ad24f4.js} +1 -1
- package/dist/cdn/{shared-ec861f31.js → shared-fab8c705.js} +3 -3
- package/dist/cdn/translations/access-recovery-form/en.json +12 -0
- package/dist/cdn/translations/address-card/en.json +11 -0
- package/dist/cdn/translations/address-form/en.json +27 -0
- package/dist/cdn/translations/applied-tax-card/en.json +9 -0
- package/dist/cdn/translations/attribute-card/en.json +7 -0
- package/dist/cdn/translations/attribute-form/en.json +22 -0
- package/dist/cdn/translations/cancellation-form/en.json +10 -0
- package/dist/cdn/translations/country/pl.json +251 -0
- package/dist/cdn/translations/coupon-card/en.json +36 -0
- package/dist/cdn/translations/coupon-code-form/en.json +17 -0
- package/dist/cdn/translations/coupon-codes-form/en.json +20 -0
- package/dist/cdn/translations/coupon-form/en.json +186 -0
- package/dist/cdn/translations/custom-field-card/en.json +7 -0
- package/dist/cdn/translations/custom-field-form/en.json +19 -0
- package/dist/cdn/translations/customer/en.json +247 -0
- package/dist/cdn/translations/customer-card/en.json +7 -0
- package/dist/cdn/translations/customer-form/en.json +21 -0
- package/dist/cdn/translations/customer-portal/de.json +202 -14
- package/dist/cdn/translations/customer-portal/en.json +202 -14
- package/dist/cdn/translations/customer-portal/es.json +202 -14
- package/dist/cdn/translations/customer-portal/pl.json +223 -0
- package/dist/cdn/translations/customer-portal/zh-hk.json +202 -14
- package/dist/cdn/translations/customers-table/en.json +9 -0
- package/dist/cdn/translations/discount-card/en.json +8 -0
- package/dist/cdn/translations/email-template-form/en.json +25 -0
- package/dist/cdn/translations/error-entry-card/en.json +7 -0
- package/dist/cdn/translations/generate-codes-form/en.json +19 -0
- package/dist/cdn/translations/gift-card-card/en.json +9 -0
- package/dist/cdn/translations/gift-card-code-form/en.json +19 -0
- package/dist/cdn/translations/gift-card-codes-form/en.json +25 -0
- package/dist/cdn/translations/gift-card-form/en.json +314 -0
- package/dist/cdn/translations/pagination/en.json +7 -0
- package/dist/cdn/translations/payment-card/en.json +12 -0
- package/dist/cdn/translations/payment-method-card/en.json +13 -0
- package/dist/cdn/translations/query-builder/en.json +32 -0
- package/dist/cdn/translations/sign-in-form/en.json +21 -0
- package/dist/cdn/translations/spinner/en.json +7 -0
- package/dist/cdn/translations/subscription-card/en.json +26 -0
- package/dist/cdn/translations/subscription-form/en.json +76 -0
- package/dist/cdn/translations/subscriptions-table/en.json +26 -0
- package/dist/cdn/translations/tax-card/en.json +11 -0
- package/dist/cdn/translations/tax-form/en.json +38 -0
- package/dist/cdn/translations/template-config-form/en.json +107 -0
- package/dist/cdn/translations/template-form/en.json +23 -0
- package/dist/cdn/translations/transaction-card/en.json +25 -0
- package/dist/cdn/translations/transactions-table/en.json +22 -0
- package/dist/cdn/translations/user-form/en.json +26 -0
- package/dist/cdn/translations/users-table/en.json +44 -0
- package/dist/elements/private/Checkbox/Checkbox.js +36 -22
- package/dist/elements/private/Checkbox/Checkbox.js.map +1 -1
- package/dist/elements/private/Choice/Choice.js +1 -0
- package/dist/elements/private/Choice/Choice.js.map +1 -1
- package/dist/elements/private/EditableList/EditableList.d.ts +20 -0
- package/dist/elements/private/EditableList/EditableList.js +124 -0
- package/dist/elements/private/EditableList/EditableList.js.map +1 -0
- package/dist/elements/private/FrequencyInput/FrequencyInput.d.ts +7 -6
- package/dist/elements/private/FrequencyInput/FrequencyInput.js +10 -23
- package/dist/elements/private/FrequencyInput/FrequencyInput.js.map +1 -1
- package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js +1 -1
- package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js.map +1 -1
- package/dist/elements/public/AttributeCard/types.d.ts +3 -3
- package/dist/elements/public/AttributeCard/types.js.map +1 -1
- package/dist/elements/public/AttributeForm/AttributeForm.js +2 -1
- package/dist/elements/public/AttributeForm/AttributeForm.js.map +1 -1
- package/dist/elements/public/AttributeForm/types.d.ts +3 -3
- package/dist/elements/public/AttributeForm/types.js.map +1 -1
- package/dist/elements/public/CollectionPage/CollectionPage.js +3 -1
- package/dist/elements/public/CollectionPage/CollectionPage.js.map +1 -1
- package/dist/elements/public/CollectionPage/types.d.ts +2 -0
- package/dist/elements/public/CollectionPage/types.js.map +1 -1
- package/dist/elements/public/CouponCard/CouponCard.d.ts +29 -0
- package/dist/elements/public/CouponCard/CouponCard.js +131 -0
- package/dist/elements/public/CouponCard/CouponCard.js.map +1 -0
- package/dist/elements/public/CouponCard/index.d.ts +5 -0
- package/dist/elements/public/CouponCard/index.js +7 -0
- package/dist/elements/public/CouponCard/index.js.map +1 -0
- package/dist/elements/public/CouponCard/types.d.ts +15 -0
- package/dist/elements/public/CouponCard/types.js +2 -0
- package/dist/elements/public/CouponCard/types.js.map +1 -0
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.d.ts +45 -0
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js +218 -0
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js.map +1 -0
- package/dist/elements/public/CouponCodeForm/index.d.ts +8 -0
- package/dist/elements/public/CouponCodeForm/index.js +10 -0
- package/dist/elements/public/CouponCodeForm/index.js.map +1 -0
- package/dist/elements/public/CouponCodeForm/types.d.ts +15 -0
- package/dist/elements/public/CouponCodeForm/types.js +2 -0
- package/dist/elements/public/CouponCodeForm/types.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.d.ts +31 -0
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js +218 -0
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/index.d.ts +8 -0
- package/dist/elements/public/CouponCodesForm/index.js +12 -0
- package/dist/elements/public/CouponCodesForm/index.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/internal/InternalCouponCodesFormListItem.d.ts +14 -0
- package/dist/elements/public/CouponCodesForm/internal/InternalCouponCodesFormListItem.js +48 -0
- package/dist/elements/public/CouponCodesForm/internal/InternalCouponCodesFormListItem.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/types.d.ts +17 -0
- package/dist/elements/public/CouponCodesForm/types.js +2 -0
- package/dist/elements/public/CouponCodesForm/types.js.map +1 -0
- package/dist/elements/public/CouponForm/CouponForm.d.ts +77 -0
- package/dist/elements/public/CouponForm/CouponForm.js +1301 -0
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -0
- package/dist/elements/public/CouponForm/index.d.ts +19 -0
- package/dist/elements/public/CouponForm/index.js +21 -0
- package/dist/elements/public/CouponForm/index.js.map +1 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.d.ts +20 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js +99 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js.map +1 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.d.ts +18 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js +50 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js.map +1 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.d.ts +18 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js +53 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js.map +1 -0
- package/dist/elements/public/CouponForm/types.d.ts +27 -0
- package/dist/elements/public/CouponForm/types.js +2 -0
- package/dist/elements/public/CouponForm/types.js.map +1 -0
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js +2 -1
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js.map +1 -1
- package/dist/elements/public/Customer/Customer.js +1 -1
- package/dist/elements/public/Customer/Customer.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js +25 -8
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +20 -6
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +2 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
- package/dist/elements/public/GenerateCodesForm/GenerateCodesForm.d.ts +43 -0
- package/dist/elements/public/GenerateCodesForm/GenerateCodesForm.js +249 -0
- package/dist/elements/public/GenerateCodesForm/GenerateCodesForm.js.map +1 -0
- package/dist/elements/public/GenerateCodesForm/index.d.ts +8 -0
- package/dist/elements/public/GenerateCodesForm/index.js +10 -0
- package/dist/elements/public/GenerateCodesForm/index.js.map +1 -0
- package/dist/elements/public/GenerateCodesForm/types.d.ts +24 -0
- package/dist/elements/public/GenerateCodesForm/types.js +2 -0
- package/dist/elements/public/GenerateCodesForm/types.js.map +1 -0
- package/dist/elements/public/GiftCardCard/GiftCardCard.d.ts +26 -0
- package/dist/elements/public/GiftCardCard/GiftCardCard.js +95 -0
- package/dist/elements/public/GiftCardCard/GiftCardCard.js.map +1 -0
- package/dist/elements/public/GiftCardCard/index.d.ts +5 -0
- package/dist/elements/public/GiftCardCard/index.js +7 -0
- package/dist/elements/public/GiftCardCard/index.js.map +1 -0
- package/dist/elements/public/GiftCardCard/types.d.ts +11 -0
- package/dist/elements/public/GiftCardCard/types.js +2 -0
- package/dist/elements/public/GiftCardCard/types.js.map +1 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.d.ts +55 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +292 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -0
- package/dist/elements/public/GiftCardCodeForm/index.d.ts +10 -0
- package/dist/elements/public/GiftCardCodeForm/index.js +12 -0
- package/dist/elements/public/GiftCardCodeForm/index.js.map +1 -0
- package/dist/elements/public/GiftCardCodeForm/types.d.ts +19 -0
- package/dist/elements/public/GiftCardCodeForm/types.js +2 -0
- package/dist/elements/public/GiftCardCodeForm/types.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.d.ts +37 -0
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js +264 -0
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/index.d.ts +9 -0
- package/dist/elements/public/GiftCardCodesForm/index.js +13 -0
- package/dist/elements/public/GiftCardCodesForm/index.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.d.ts +19 -0
- package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js +48 -0
- package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/types.d.ts +17 -0
- package/dist/elements/public/GiftCardCodesForm/types.js +2 -0
- package/dist/elements/public/GiftCardCodesForm/types.js.map +1 -0
- package/dist/elements/public/GiftCardForm/GiftCardForm.d.ts +67 -0
- package/dist/elements/public/GiftCardForm/GiftCardForm.js +684 -0
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -0
- package/dist/elements/public/GiftCardForm/currencies.d.ts +1 -0
- package/dist/elements/public/GiftCardForm/currencies.js +173 -0
- package/dist/elements/public/GiftCardForm/currencies.js.map +1 -0
- package/dist/elements/public/GiftCardForm/index.d.ts +18 -0
- package/dist/elements/public/GiftCardForm/index.js +20 -0
- package/dist/elements/public/GiftCardForm/index.js.map +1 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.d.ts +20 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js +99 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js.map +1 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.d.ts +18 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js +50 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js.map +1 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.d.ts +18 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js +53 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js.map +1 -0
- package/dist/elements/public/GiftCardForm/types.d.ts +28 -0
- package/dist/elements/public/GiftCardForm/types.js +2 -0
- package/dist/elements/public/GiftCardForm/types.js.map +1 -0
- package/dist/elements/public/I18n/I18n.js +1 -1
- package/dist/elements/public/I18n/I18n.js.map +1 -1
- package/dist/elements/public/I18n/format/date.js +7 -6
- package/dist/elements/public/I18n/format/date.js.map +1 -1
- package/dist/elements/public/I18n/format/discount.d.ts +6 -0
- package/dist/elements/public/I18n/format/discount.js +20 -0
- package/dist/elements/public/I18n/format/discount.js.map +1 -0
- package/dist/elements/public/I18n/format/index.js +6 -0
- package/dist/elements/public/I18n/format/index.js.map +1 -1
- package/dist/elements/public/I18n/format/ordinal.d.ts +6 -0
- package/dist/elements/public/I18n/format/ordinal.js +9 -0
- package/dist/elements/public/I18n/format/ordinal.js.map +1 -0
- package/dist/elements/public/I18n/format/relative.d.ts +6 -0
- package/dist/elements/public/I18n/format/relative.js +15 -0
- package/dist/elements/public/I18n/format/relative.js.map +1 -0
- package/dist/elements/public/NucleonElement/NucleonElement.js +4 -4
- package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
- package/dist/elements/public/Pagination/Pagination.d.ts +37 -0
- package/dist/elements/public/Pagination/Pagination.js +158 -0
- package/dist/elements/public/Pagination/Pagination.js.map +1 -0
- package/dist/elements/public/Pagination/index.d.ts +6 -0
- package/dist/elements/public/Pagination/index.js +8 -0
- package/dist/elements/public/Pagination/index.js.map +1 -0
- package/dist/elements/public/SignInForm/SignInForm.js +1 -1
- package/dist/elements/public/SignInForm/SignInForm.js.map +1 -1
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +1 -1
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
- package/dist/elements/public/Table/Table.js +20 -5
- package/dist/elements/public/Table/Table.js.map +1 -1
- package/dist/elements/public/TaxForm/TaxForm.js +16 -14
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.js +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
- package/dist/elements/public/UserForm/UserForm.js +2 -1
- package/dist/elements/public/UserForm/UserForm.js.map +1 -1
- package/dist/elements/public/UsersTable/UsersTable.d.ts +5 -1
- package/dist/elements/public/UsersTable/UsersTable.js +2 -1
- package/dist/elements/public/UsersTable/UsersTable.js.map +1 -1
- package/dist/elements/public/index.d.ts +10 -0
- package/dist/elements/public/index.defined.d.ts +10 -0
- package/dist/elements/public/index.defined.js +10 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +10 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/themeable.js +96 -4
- package/dist/mixins/themeable.js.map +1 -1
- package/dist/mixins/translatable.js +1 -1
- package/dist/mixins/translatable.js.map +1 -1
- package/dist/utils/parse-duration.d.ts +1 -1
- package/dist/utils/parse-duration.js +7 -3
- package/dist/utils/parse-duration.js.map +1 -1
- package/package.json +3 -3
- package/dist/cdn/shared-07abcd7b.js +0 -1
- package/dist/cdn/shared-35dbd2c5.js +0 -1
- package/dist/cdn/shared-6b7602c7.js +0 -1
- package/dist/cdn/shared-87ca7818.js +0 -1
- package/dist/cdn/shared-9a40309d.js +0 -1
- package/dist/cdn/shared-ce1da35d.js +0 -1
- package/dist/cdn/shared-d01d809a.js +0 -1
- package/dist/cdn/shared-d8ffb279.js +0 -264
- package/dist/cdn/shared-e5cbf291.js +0 -1
- package/dist/cdn/shared-f1dc1c6c.js +0 -1
- package/dist/cdn/translations/shared/de.json +0 -271
- package/dist/cdn/translations/shared/en.json +0 -272
- package/dist/cdn/translations/shared/es.json +0 -272
|
@@ -0,0 +1,1301 @@
|
|
|
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 { PropertyTable } from "../../private/PropertyTable/PropertyTable.js";
|
|
12
|
+
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
13
|
+
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
14
|
+
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
15
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
16
|
+
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
17
|
+
import { live } from 'lit-html/directives/live';
|
|
18
|
+
import { operatorGreaterThanOrEqual } from "../QueryBuilder/icons/operatorGreaterThanOrEqual.js";
|
|
19
|
+
import { repeat } from 'lit-html/directives/repeat';
|
|
20
|
+
import { serializeDate } from "../../../utils/serialize-date.js";
|
|
21
|
+
const NS = 'coupon-form';
|
|
22
|
+
const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(ResponsiveMixin(TranslatableMixin(NucleonElement, NS)))));
|
|
23
|
+
/**
|
|
24
|
+
* Form element for creating or editing coupons (`fx:coupon`).
|
|
25
|
+
*
|
|
26
|
+
* @slot name:before
|
|
27
|
+
* @slot name:after
|
|
28
|
+
*
|
|
29
|
+
* @slot rules:before
|
|
30
|
+
* @slot rules:after
|
|
31
|
+
*
|
|
32
|
+
* @slot codes:before
|
|
33
|
+
* @slot codes:after
|
|
34
|
+
*
|
|
35
|
+
* @slot usage:before
|
|
36
|
+
* @slot usage:after
|
|
37
|
+
*
|
|
38
|
+
* @slot product-restrictions:before
|
|
39
|
+
* @slot product-restrictions:after
|
|
40
|
+
*
|
|
41
|
+
* @slot category-restrictions:before
|
|
42
|
+
* @slot category-restrictions:after
|
|
43
|
+
*
|
|
44
|
+
* @slot options:before
|
|
45
|
+
* @slot options:after
|
|
46
|
+
*
|
|
47
|
+
* @slot timestamps:before
|
|
48
|
+
* @slot timestamps:after
|
|
49
|
+
*
|
|
50
|
+
* @slot delete:before
|
|
51
|
+
* @slot delete:after
|
|
52
|
+
*
|
|
53
|
+
* @slot create:before
|
|
54
|
+
* @slot create:after
|
|
55
|
+
*
|
|
56
|
+
* @element foxy-coupon-form
|
|
57
|
+
* @since 1.15.0
|
|
58
|
+
*/
|
|
59
|
+
export class CouponForm extends Base {
|
|
60
|
+
constructor() {
|
|
61
|
+
super(...arguments);
|
|
62
|
+
this.__codesTableColumns = [
|
|
63
|
+
{
|
|
64
|
+
header: ctx => html `<foxy-i18n lang=${ctx.lang} key="code" ns=${ctx.ns}></foxy-i18n>`,
|
|
65
|
+
cell: ctx => html `
|
|
66
|
+
<vaadin-button
|
|
67
|
+
theme="tertiary contrast"
|
|
68
|
+
class="p-0"
|
|
69
|
+
@click=${(evt) => {
|
|
70
|
+
const dialog = this.renderRoot.querySelector('#code-dialog');
|
|
71
|
+
const button = evt.currentTarget;
|
|
72
|
+
dialog.href = ctx.data._links.self.href;
|
|
73
|
+
dialog.show(button);
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<span class="font-tnum">${ctx.data.code}</span>
|
|
77
|
+
</vaadin-button>
|
|
78
|
+
`,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
header: ctx => html `<foxy-i18n lang=${ctx.lang} key="date_created" ns=${ctx.ns}></foxy-i18n>`,
|
|
82
|
+
cell: ctx => html `
|
|
83
|
+
<foxy-i18n
|
|
84
|
+
options=${JSON.stringify({ value: ctx.data.date_created })}
|
|
85
|
+
class="text-tertiary"
|
|
86
|
+
lang=${ctx.lang}
|
|
87
|
+
key="date"
|
|
88
|
+
ns=${ctx.ns}
|
|
89
|
+
>
|
|
90
|
+
</foxy-i18n>
|
|
91
|
+
`,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
hideBelow: 'sm',
|
|
95
|
+
header: c => html `<foxy-i18n lang=${c.lang} key="date_modified" ns=${c.ns}></foxy-i18n>`,
|
|
96
|
+
cell: ctx => html `
|
|
97
|
+
<foxy-i18n
|
|
98
|
+
options=${JSON.stringify({ value: ctx.data.date_modified })}
|
|
99
|
+
class="text-tertiary"
|
|
100
|
+
lang=${ctx.lang}
|
|
101
|
+
key="date"
|
|
102
|
+
ns=${ctx.ns}
|
|
103
|
+
>
|
|
104
|
+
</foxy-i18n>
|
|
105
|
+
`,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
header: c => html `<foxy-i18n lang=${c.lang} key="used_codes" ns=${c.ns}></foxy-i18n>`,
|
|
109
|
+
cell: ctx => html `${ctx.data.number_of_uses_to_date}`,
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
this.__codesTableQuery = null;
|
|
113
|
+
this.__itemCategories = '';
|
|
114
|
+
}
|
|
115
|
+
static get scopedElements() {
|
|
116
|
+
return {
|
|
117
|
+
'vaadin-integer-field': customElements.get('vaadin-integer-field'),
|
|
118
|
+
'vaadin-date-picker': customElements.get('vaadin-date-picker'),
|
|
119
|
+
'vaadin-text-field': customElements.get('vaadin-text-field'),
|
|
120
|
+
'vaadin-button': customElements.get('vaadin-button'),
|
|
121
|
+
'iron-dropdown': customElements.get('iron-dropdown'),
|
|
122
|
+
'iron-icon': customElements.get('iron-icon'),
|
|
123
|
+
'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),
|
|
124
|
+
'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),
|
|
125
|
+
'foxy-query-builder': customElements.get('foxy-query-builder'),
|
|
126
|
+
'foxy-form-dialog': customElements.get('foxy-form-dialog'),
|
|
127
|
+
'foxy-pagination': customElements.get('foxy-pagination'),
|
|
128
|
+
'foxy-spinner': customElements.get('foxy-spinner'),
|
|
129
|
+
'foxy-table': customElements.get('foxy-table'),
|
|
130
|
+
'foxy-i18n': customElements.get('foxy-i18n'),
|
|
131
|
+
'x-category-restrictions-page': CategoryRestrictionsPage,
|
|
132
|
+
'x-property-table': PropertyTable,
|
|
133
|
+
'x-editable-list': EditableList,
|
|
134
|
+
'x-checkbox': Checkbox,
|
|
135
|
+
'x-group': Group,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
static get properties() {
|
|
139
|
+
return {
|
|
140
|
+
...super.properties,
|
|
141
|
+
__codesTableQuery: { attribute: false },
|
|
142
|
+
__itemCategories: { attribute: false },
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
static get v8n() {
|
|
146
|
+
return [
|
|
147
|
+
({ name: v }) => !!v || 'name_required',
|
|
148
|
+
({ name: v }) => !v || v.length <= 50 || 'name_too_long',
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
render() {
|
|
152
|
+
var _a, _b;
|
|
153
|
+
const hidden = this.hiddenSelector;
|
|
154
|
+
return html `
|
|
155
|
+
<div class="relative space-y-l">
|
|
156
|
+
${hidden.matches('name', true) ? '' : this.__renderName()}
|
|
157
|
+
${hidden.matches('rules', true) ? '' : this.__renderRules()}
|
|
158
|
+
${hidden.matches('codes', true) || !this.data ? '' : this.__renderCodes()}
|
|
159
|
+
${hidden.matches('usage', true) ? '' : this.__renderUsage()}
|
|
160
|
+
${hidden.matches('product-restrictions', true) ? '' : this.__renderProductRestrictions()}
|
|
161
|
+
${hidden.matches('category-restrictions', true) || !this.data
|
|
162
|
+
? ''
|
|
163
|
+
: this.__renderCategoryRestrictions()}
|
|
164
|
+
${hidden.matches('options', true) ? '' : this.__renderOptions()}
|
|
165
|
+
${hidden.matches('timestamps', true) ? '' : this.__renderTimestamps()}
|
|
166
|
+
${hidden.matches('create', true) || !!this.data ? '' : this.__renderCreate()}
|
|
167
|
+
${hidden.matches('delete', true) || !this.data ? '' : this.__renderDelete()}
|
|
168
|
+
|
|
169
|
+
<div
|
|
170
|
+
data-testid="spinner"
|
|
171
|
+
class=${classMap({
|
|
172
|
+
'transition duration-500 ease-in-out absolute inset-0 flex': true,
|
|
173
|
+
'opacity-0 pointer-events-none': this.in('idle'),
|
|
174
|
+
})}
|
|
175
|
+
>
|
|
176
|
+
<foxy-spinner
|
|
177
|
+
layout="vertical"
|
|
178
|
+
class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l"
|
|
179
|
+
state=${this.in('fail') ? 'error' : this.in('busy') ? 'busy' : 'empty'}
|
|
180
|
+
lang=${this.lang}
|
|
181
|
+
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-spinner')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
182
|
+
>
|
|
183
|
+
</foxy-spinner>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
async _sendGet() {
|
|
189
|
+
const coupon = await super._sendGet();
|
|
190
|
+
const store = await super._fetch(coupon._links['fx:store'].href);
|
|
191
|
+
const categoriesURL = new URL(store._links['fx:item_categories'].href);
|
|
192
|
+
categoriesURL.searchParams.set('limit', '5');
|
|
193
|
+
this.__itemCategories = categoriesURL.toString();
|
|
194
|
+
return coupon;
|
|
195
|
+
}
|
|
196
|
+
__getErrorMessage(prefix) {
|
|
197
|
+
const error = this.errors.find(err => err.startsWith(prefix));
|
|
198
|
+
return error ? this.t(error.replace(prefix, 'v8n')).toString() : '';
|
|
199
|
+
}
|
|
200
|
+
__getValidator(prefix) {
|
|
201
|
+
return () => !this.errors.some(err => err.startsWith(prefix));
|
|
202
|
+
}
|
|
203
|
+
__renderName() {
|
|
204
|
+
return html `
|
|
205
|
+
<div>
|
|
206
|
+
${this.renderTemplateOrSlot('name:before')}
|
|
207
|
+
|
|
208
|
+
<vaadin-text-field
|
|
209
|
+
error-message=${this.__getErrorMessage('name')}
|
|
210
|
+
helper-text=${this.t('coupon_name_helper_text')}
|
|
211
|
+
data-testid="name"
|
|
212
|
+
class="w-full"
|
|
213
|
+
label=${this.t('name')}
|
|
214
|
+
.checkValidity=${this.__getValidator('name')}
|
|
215
|
+
.value=${this.form.name}
|
|
216
|
+
?disabled=${!this.in('idle') || this.disabledSelector.matches('name', true)}
|
|
217
|
+
?readonly=${this.readonlySelector.matches('name', true)}
|
|
218
|
+
required
|
|
219
|
+
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
220
|
+
@input=${(evt) => {
|
|
221
|
+
const newName = evt.currentTarget.value;
|
|
222
|
+
this.edit({ name: newName });
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
</vaadin-text-field>
|
|
226
|
+
|
|
227
|
+
${this.renderTemplateOrSlot('name:after')}
|
|
228
|
+
</div>
|
|
229
|
+
`;
|
|
230
|
+
}
|
|
231
|
+
__renderRulesPreset() {
|
|
232
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
233
|
+
const isReadonly = this.readonlySelector.matches('rules', true);
|
|
234
|
+
const details = this.form.coupon_discount_details;
|
|
235
|
+
const type = this.form.coupon_discount_type;
|
|
236
|
+
const presets = [
|
|
237
|
+
{ type: 'quantity_amount', details: 'allunits|2-2' },
|
|
238
|
+
{ type: 'quantity_percentage', details: 'allunits|5-10|10-20' },
|
|
239
|
+
{ type: 'quantity_amount', details: 'incremental|3-5' },
|
|
240
|
+
{ type: 'quantity_percentage', details: 'incremental|11-10|51-15|101-20' },
|
|
241
|
+
{ type: 'quantity_percentage', details: 'repeat|2-100' },
|
|
242
|
+
{ type: 'quantity_percentage', details: 'repeat|4-50' },
|
|
243
|
+
{ type: 'quantity_amount', details: 'single|5-10' },
|
|
244
|
+
{ type: 'price_percentage', details: 'single|99.99-10' },
|
|
245
|
+
];
|
|
246
|
+
const selectedPreset = presets.find(p => p.details === details && p.type === type);
|
|
247
|
+
return html `
|
|
248
|
+
<label
|
|
249
|
+
data-testid="rules:preset"
|
|
250
|
+
class=${classMap({
|
|
251
|
+
'whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors': true,
|
|
252
|
+
'text-body hover-text-primary focus-within-ring-2': !isDisabled && !isReadonly,
|
|
253
|
+
'text-disabled': isDisabled,
|
|
254
|
+
'text-secondary': isReadonly,
|
|
255
|
+
})}
|
|
256
|
+
>
|
|
257
|
+
<foxy-i18n class="sr-only" lang=${this.lang} key="preset" ns=${this.ns}></foxy-i18n>
|
|
258
|
+
|
|
259
|
+
<span class="relative font-medium flex items-center">
|
|
260
|
+
<span class="truncate">
|
|
261
|
+
${selectedPreset
|
|
262
|
+
? this.t('discount_summary', { params: { ...selectedPreset, ns: this.ns } })
|
|
263
|
+
: this.t('custom_discount')}
|
|
264
|
+
</span>
|
|
265
|
+
|
|
266
|
+
<iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon>
|
|
267
|
+
|
|
268
|
+
<select
|
|
269
|
+
data-testclass="interactive editable"
|
|
270
|
+
data-testid="rules:preset:select"
|
|
271
|
+
class="opacity-0 absolute inset-0 focus-outline-none"
|
|
272
|
+
?disabled=${isDisabled || isReadonly}
|
|
273
|
+
@change=${(evt) => {
|
|
274
|
+
var _a, _b;
|
|
275
|
+
const select = evt.currentTarget;
|
|
276
|
+
const preset = presets[select.selectedIndex];
|
|
277
|
+
this.edit({
|
|
278
|
+
coupon_discount_details: (_a = preset === null || preset === void 0 ? void 0 : preset.details) !== null && _a !== void 0 ? _a : '',
|
|
279
|
+
coupon_discount_type: (_b = preset === null || preset === void 0 ? void 0 : preset.type) !== null && _b !== void 0 ? _b : 'quantity_amount',
|
|
280
|
+
});
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
${presets.map(option => {
|
|
284
|
+
return html `
|
|
285
|
+
<option value=${option.details} ?selected=${option === selectedPreset}>
|
|
286
|
+
${this.t('discount_summary', { params: { ...option, ns: this.ns } })}
|
|
287
|
+
</option>
|
|
288
|
+
`;
|
|
289
|
+
})}
|
|
290
|
+
|
|
291
|
+
<option value="custom" ?selected=${!selectedPreset}>
|
|
292
|
+
${this.t('custom_discount')}
|
|
293
|
+
</option>
|
|
294
|
+
</select>
|
|
295
|
+
</span>
|
|
296
|
+
</label>
|
|
297
|
+
`;
|
|
298
|
+
}
|
|
299
|
+
__renderRulesTierSelect({ label, value, options, onChange }) {
|
|
300
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
301
|
+
const isReadonly = this.readonlySelector.matches('rules', true);
|
|
302
|
+
const isInteractive = !isDisabled && !isReadonly;
|
|
303
|
+
return html `
|
|
304
|
+
<label
|
|
305
|
+
class=${classMap({
|
|
306
|
+
'h-xs whitespace-nowrap block ring-primary-50 rounded pl-s transition-colors': true,
|
|
307
|
+
'hover-bg-primary hover-text-primary-contrast focus-within-ring-2': isInteractive,
|
|
308
|
+
'bg-primary-10 text-primary': isInteractive,
|
|
309
|
+
'bg-contrast-5 text-disabled': isDisabled,
|
|
310
|
+
'bg-contrast-5 text-secondary': isReadonly && !isDisabled,
|
|
311
|
+
})}
|
|
312
|
+
>
|
|
313
|
+
<foxy-i18n class="sr-only" lang=${this.lang} key=${label} ns=${this.ns}></foxy-i18n>
|
|
314
|
+
|
|
315
|
+
<span class="relative leading-none font-medium flex items-center h-full">
|
|
316
|
+
<span class="truncate">${this.t(options[value])}</span>
|
|
317
|
+
<iron-icon class="icon-inline text-xl ml-xs" icon="icons:expand-more"></iron-icon>
|
|
318
|
+
|
|
319
|
+
<select
|
|
320
|
+
data-testclass="interactive editable"
|
|
321
|
+
class="opacity-0 absolute inset-0 focus-outline-none"
|
|
322
|
+
?disabled=${!isInteractive}
|
|
323
|
+
@change=${(evt) => {
|
|
324
|
+
const select = evt.currentTarget;
|
|
325
|
+
onChange(select.options[select.selectedIndex].value);
|
|
326
|
+
}}
|
|
327
|
+
>
|
|
328
|
+
${Object.entries(options).map(([optionValue, optionKey]) => {
|
|
329
|
+
return html `
|
|
330
|
+
<option value=${optionValue} ?selected=${optionValue === value}>
|
|
331
|
+
${this.t(optionKey)}
|
|
332
|
+
</option>
|
|
333
|
+
`;
|
|
334
|
+
})}
|
|
335
|
+
</select>
|
|
336
|
+
</span>
|
|
337
|
+
</label>
|
|
338
|
+
`;
|
|
339
|
+
}
|
|
340
|
+
__renderRulesTierSwitch({ value, options, onChange }) {
|
|
341
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
342
|
+
const isReadonly = this.readonlySelector.matches('rules', true);
|
|
343
|
+
const isInteractive = !isDisabled && !isReadonly;
|
|
344
|
+
const name = `switch-${Math.floor(Math.random() * Math.pow(10, 10))}`;
|
|
345
|
+
const dotStyle = 'width: 0.4rem; height: 0.4rem';
|
|
346
|
+
return html `
|
|
347
|
+
<div
|
|
348
|
+
class=${classMap({
|
|
349
|
+
'h-xs px-xs space-x-xs flex items-center rounded transition-colors': true,
|
|
350
|
+
'hover-bg-primary hover-text-primary-contrast focus-within-ring-2': isInteractive,
|
|
351
|
+
'ring-primary-50 cursor-pointer bg-primary-10 text-primary': isInteractive,
|
|
352
|
+
'bg-contrast-5 text-disabled': isDisabled,
|
|
353
|
+
'bg-contrast-5 text-secondary': isReadonly && !isDisabled,
|
|
354
|
+
})}
|
|
355
|
+
@click=${(evt) => {
|
|
356
|
+
if (!isInteractive)
|
|
357
|
+
return;
|
|
358
|
+
const target = evt.currentTarget;
|
|
359
|
+
const firstInput = target.querySelector('input');
|
|
360
|
+
firstInput.focus();
|
|
361
|
+
onChange(value === 0 ? 1 : 0);
|
|
362
|
+
}}
|
|
363
|
+
>
|
|
364
|
+
<div class="leading-none font-medium px-xs pointer-events-none">
|
|
365
|
+
${options.map((option, optionIndex) => {
|
|
366
|
+
return html `
|
|
367
|
+
<label>
|
|
368
|
+
<foxy-i18n
|
|
369
|
+
class=${classMap({ 'sr-only': optionIndex !== value })}
|
|
370
|
+
lang=${this.lang}
|
|
371
|
+
key=${option}
|
|
372
|
+
ns=${this.ns}
|
|
373
|
+
>
|
|
374
|
+
</foxy-i18n>
|
|
375
|
+
|
|
376
|
+
<input
|
|
377
|
+
data-testclass="interactive editable"
|
|
378
|
+
class="sr-only"
|
|
379
|
+
value=${option}
|
|
380
|
+
name=${name}
|
|
381
|
+
type="radio"
|
|
382
|
+
?disabled=${!isInteractive}
|
|
383
|
+
?checked=${optionIndex === value}
|
|
384
|
+
@change=${(evt) => {
|
|
385
|
+
const input = evt.currentTarget;
|
|
386
|
+
if (input.checked)
|
|
387
|
+
onChange(optionIndex);
|
|
388
|
+
}}
|
|
389
|
+
/>
|
|
390
|
+
</label>
|
|
391
|
+
`;
|
|
392
|
+
})}
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
<div class="flex justify-evenly h-full ${value ? 'flex-col-reverse' : 'flex-col'}">
|
|
396
|
+
<div style=${dotStyle} class="bg-current rounded-full"></div>
|
|
397
|
+
<div style=${dotStyle} class="border border-current rounded-full"></div>
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
`;
|
|
401
|
+
}
|
|
402
|
+
__renderRulesTierField({ value, label, onChange }) {
|
|
403
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
404
|
+
const isReadonly = this.readonlySelector.matches('rules', true);
|
|
405
|
+
const isInteractive = !isDisabled && !isReadonly;
|
|
406
|
+
return html `
|
|
407
|
+
<label>
|
|
408
|
+
<foxy-i18n class="sr-only" lang=${this.lang} key=${label} ns=${this.ns}></foxy-i18n>
|
|
409
|
+
<input
|
|
410
|
+
data-testclass="interactive editable"
|
|
411
|
+
class=${classMap({
|
|
412
|
+
'transition-colors border p-xs h-xs font-medium text-m rounded w-xl': true,
|
|
413
|
+
'ring-primary-50 text-body bg-contrast-10': isInteractive,
|
|
414
|
+
'hover-bg-contrast-20': isInteractive,
|
|
415
|
+
'focus-outline-none focus-ring-2': isInteractive,
|
|
416
|
+
'text-disabled bg-contrast-5': isDisabled,
|
|
417
|
+
'text-secondary': isReadonly && !isDisabled,
|
|
418
|
+
'border-transparent border-solid': !isReadonly,
|
|
419
|
+
'border-dashed border-contrast-30': isReadonly,
|
|
420
|
+
})}
|
|
421
|
+
type="number"
|
|
422
|
+
min="0"
|
|
423
|
+
?disabled=${!isInteractive}
|
|
424
|
+
.value=${value}
|
|
425
|
+
@input=${(evt) => {
|
|
426
|
+
const input = evt.currentTarget;
|
|
427
|
+
onChange(input.value);
|
|
428
|
+
}}
|
|
429
|
+
/>
|
|
430
|
+
</label>
|
|
431
|
+
`;
|
|
432
|
+
}
|
|
433
|
+
__renderRulesTier(params) {
|
|
434
|
+
var _a;
|
|
435
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
436
|
+
const isReadonly = this.readonlySelector.matches('rules', true);
|
|
437
|
+
const tier = (_a = params.tier) !== null && _a !== void 0 ? _a : '0-0';
|
|
438
|
+
const sign = tier.includes('+') ? '+' : '-';
|
|
439
|
+
const [from, adjustment] = tier.split(/[-+]/).map(v => parseFloat(v));
|
|
440
|
+
return html `
|
|
441
|
+
<div
|
|
442
|
+
data-testclass="rules:tier"
|
|
443
|
+
aria-label=${this.t('tier')}
|
|
444
|
+
class=${classMap({
|
|
445
|
+
'flex items-start justify-between rounded-t-l rounded-b-l': true,
|
|
446
|
+
'border border-contrast-10': true,
|
|
447
|
+
'border-dashed': !params.tier,
|
|
448
|
+
})}
|
|
449
|
+
>
|
|
450
|
+
<div
|
|
451
|
+
class=${classMap({
|
|
452
|
+
'transition-colors flex flex-wrap items-center gap-s p-s': true,
|
|
453
|
+
'text-tertiary': !isDisabled,
|
|
454
|
+
'text-disabled': isDisabled,
|
|
455
|
+
})}
|
|
456
|
+
>
|
|
457
|
+
<foxy-i18n
|
|
458
|
+
class="uppercase text-s font-semibold"
|
|
459
|
+
lang=${this.lang}
|
|
460
|
+
key="tier_if"
|
|
461
|
+
ns=${this.ns}
|
|
462
|
+
>
|
|
463
|
+
</foxy-i18n>
|
|
464
|
+
|
|
465
|
+
${this.__renderRulesTierSwitch({
|
|
466
|
+
options: ['total', 'quantity'],
|
|
467
|
+
value: params.source === 'price' ? 0 : 1,
|
|
468
|
+
onChange: i => params.onChange({ source: i ? 'quantity' : 'price' }),
|
|
469
|
+
})}
|
|
470
|
+
|
|
471
|
+
<div class="h-s w-s">${operatorGreaterThanOrEqual}</div>
|
|
472
|
+
|
|
473
|
+
${this.__renderRulesTierField({
|
|
474
|
+
label: 'from',
|
|
475
|
+
value: String(from),
|
|
476
|
+
onChange: v => params.onChange({ tier: `${v}${sign}${adjustment}` }),
|
|
477
|
+
})}
|
|
478
|
+
|
|
479
|
+
<foxy-i18n
|
|
480
|
+
class="uppercase text-s font-semibold"
|
|
481
|
+
lang=${this.lang}
|
|
482
|
+
key="tier_then"
|
|
483
|
+
ns=${this.ns}
|
|
484
|
+
>
|
|
485
|
+
</foxy-i18n>
|
|
486
|
+
|
|
487
|
+
${this.__renderRulesTierSwitch({
|
|
488
|
+
options: ['reduce', 'increase'],
|
|
489
|
+
value: sign === '-' ? 0 : 1,
|
|
490
|
+
onChange: i => params.onChange({ tier: `${from}${i ? '+' : '-'}${adjustment}` }),
|
|
491
|
+
})}
|
|
492
|
+
|
|
493
|
+
<!---->
|
|
494
|
+
|
|
495
|
+
${this.__renderRulesTierSelect({
|
|
496
|
+
options: {
|
|
497
|
+
incremental: 'tier_incremental',
|
|
498
|
+
allunits: 'tier_allunits',
|
|
499
|
+
repeat: 'tier_repeat',
|
|
500
|
+
single: 'tier_single',
|
|
501
|
+
},
|
|
502
|
+
value: params.method,
|
|
503
|
+
label: 'target',
|
|
504
|
+
onChange: v => params.onChange({ method: v }),
|
|
505
|
+
})}
|
|
506
|
+
|
|
507
|
+
<foxy-i18n
|
|
508
|
+
class="uppercase text-s font-semibold"
|
|
509
|
+
lang=${this.lang}
|
|
510
|
+
key="tier_by"
|
|
511
|
+
ns=${this.ns}
|
|
512
|
+
>
|
|
513
|
+
</foxy-i18n>
|
|
514
|
+
|
|
515
|
+
${this.__renderRulesTierField({
|
|
516
|
+
label: 'adjustment',
|
|
517
|
+
value: String(adjustment),
|
|
518
|
+
onChange: v => params.onChange({ tier: `${from}${sign}${v}` }),
|
|
519
|
+
})}
|
|
520
|
+
|
|
521
|
+
<!---->
|
|
522
|
+
|
|
523
|
+
${this.__renderRulesTierSwitch({
|
|
524
|
+
value: params.units === 'percentage' ? 0 : 1,
|
|
525
|
+
options: ['%', '¤'],
|
|
526
|
+
onChange: i => params.onChange({ units: i ? 'amount' : 'percentage' }),
|
|
527
|
+
})}
|
|
528
|
+
</div>
|
|
529
|
+
|
|
530
|
+
${params.tier
|
|
531
|
+
? html `
|
|
532
|
+
<button
|
|
533
|
+
data-testclass="interactive"
|
|
534
|
+
aria-label=${this.t('delete')}
|
|
535
|
+
class=${classMap({
|
|
536
|
+
'w-s h-s m-s flex-shrink-0 rounded transition-colors ring-primary-50': true,
|
|
537
|
+
'text-tertiary hover-text-secondary focus-outline-none focus-ring-2': !isDisabled,
|
|
538
|
+
'text-disabled cursor-default': isDisabled,
|
|
539
|
+
})}
|
|
540
|
+
?disabled=${isDisabled}
|
|
541
|
+
?hidden=${isReadonly}
|
|
542
|
+
@click=${() => params.onDelete()}
|
|
543
|
+
>
|
|
544
|
+
<iron-icon icon="lumo:cross"></iron-icon>
|
|
545
|
+
</button>
|
|
546
|
+
`
|
|
547
|
+
: ''}
|
|
548
|
+
</div>
|
|
549
|
+
`;
|
|
550
|
+
}
|
|
551
|
+
__renderRulesUrlParameter() {
|
|
552
|
+
var _a, _b, _c;
|
|
553
|
+
const name = (_a = this.form.name) !== null && _a !== void 0 ? _a : '';
|
|
554
|
+
const type = (_b = this.form.coupon_discount_type) !== null && _b !== void 0 ? _b : 'quantity_amount';
|
|
555
|
+
const details = (_c = this.form.coupon_discount_details) !== null && _c !== void 0 ? _c : '';
|
|
556
|
+
const urlParameter = `discount_${type}=${encodeURIComponent(`${name}{${details}}`)}`;
|
|
557
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
558
|
+
return html `
|
|
559
|
+
<div data-testid="rules:url" class="text-xs flex space-x-xs leading-m">
|
|
560
|
+
<span
|
|
561
|
+
class=${classMap({
|
|
562
|
+
'flex-shrink-0 transition-colors': true,
|
|
563
|
+
'text-tertiary': !isDisabled,
|
|
564
|
+
'text-disabled': isDisabled,
|
|
565
|
+
})}
|
|
566
|
+
>
|
|
567
|
+
<foxy-i18n lang=${this.lang} key="url_parameter" ns=${this.ns}></foxy-i18n>:
|
|
568
|
+
</span>
|
|
569
|
+
|
|
570
|
+
<code
|
|
571
|
+
class=${classMap({
|
|
572
|
+
'bg-contrast-5 transition-colors monospace truncate rounded px-xs': true,
|
|
573
|
+
'text-secondary': !isDisabled,
|
|
574
|
+
'text-disabled': isDisabled,
|
|
575
|
+
})}
|
|
576
|
+
>
|
|
577
|
+
${urlParameter}
|
|
578
|
+
</code>
|
|
579
|
+
|
|
580
|
+
<button
|
|
581
|
+
data-testclass="interactive"
|
|
582
|
+
data-testid="rules:url:copy"
|
|
583
|
+
class=${classMap({
|
|
584
|
+
'flex-shrink-0 transition-colors font-medium rounded px-xs': true,
|
|
585
|
+
'ring-primary-50 bg-primary-10 text-primary': !isDisabled,
|
|
586
|
+
'text-disabled bg-contrast-5': isDisabled,
|
|
587
|
+
'focus-outline-none focus-ring-2': !isDisabled,
|
|
588
|
+
'hover-bg-primary hover-text-primary-contrast': !isDisabled,
|
|
589
|
+
})}
|
|
590
|
+
?disabled=${isDisabled}
|
|
591
|
+
@click=${({ currentTarget }) => {
|
|
592
|
+
navigator.clipboard
|
|
593
|
+
.writeText(urlParameter)
|
|
594
|
+
.then(() => (currentTarget.textContent = this.t('copied')))
|
|
595
|
+
.catch(() => (currentTarget.textContent = this.t('error')))
|
|
596
|
+
.then(() => setTimeout(() => (currentTarget.textContent = this.t('copy')), 2000));
|
|
597
|
+
}}
|
|
598
|
+
>
|
|
599
|
+
${this.t('copy')}
|
|
600
|
+
</button>
|
|
601
|
+
</div>
|
|
602
|
+
`;
|
|
603
|
+
}
|
|
604
|
+
__renderRulesDescription() {
|
|
605
|
+
var _a, _b;
|
|
606
|
+
const type = (_a = this.form.coupon_discount_type) !== null && _a !== void 0 ? _a : 'quantity_amount';
|
|
607
|
+
const details = (_b = this.form.coupon_discount_details) !== null && _b !== void 0 ? _b : '';
|
|
608
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
609
|
+
return html `
|
|
610
|
+
<div data-testid="rules:description" class="text-xs leading-m">
|
|
611
|
+
<span class="transition-colors ${isDisabled ? 'text-disabled' : 'text-tertiary'}">
|
|
612
|
+
<foxy-i18n lang=${this.lang} key="description" ns=${this.ns}></foxy-i18n>:
|
|
613
|
+
</span>
|
|
614
|
+
|
|
615
|
+
<foxy-i18n
|
|
616
|
+
options=${JSON.stringify({ params: { details, type, ns: this.ns } })}
|
|
617
|
+
class="transition-colors ${isDisabled ? 'text-disabled' : 'text-secondary'}"
|
|
618
|
+
lang=${this.lang}
|
|
619
|
+
key="discount_summary"
|
|
620
|
+
ns=${this.ns}
|
|
621
|
+
>
|
|
622
|
+
</foxy-i18n>
|
|
623
|
+
</div>
|
|
624
|
+
`;
|
|
625
|
+
}
|
|
626
|
+
__renderRules() {
|
|
627
|
+
var _a, _b, _c;
|
|
628
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('rules', true);
|
|
629
|
+
const details = (_a = this.form.coupon_discount_details) !== null && _a !== void 0 ? _a : '';
|
|
630
|
+
const tiers = details.split('|').filter(v => !!v.trim());
|
|
631
|
+
const method = (_b = (/[-+]/.test(tiers[0]) ? null : tiers.shift())) !== null && _b !== void 0 ? _b : 'single';
|
|
632
|
+
const renderedTiers = method === 'repeat' ? [tiers[0]] : [...tiers, undefined];
|
|
633
|
+
const type = (_c = this.form.coupon_discount_type) !== null && _c !== void 0 ? _c : 'quantity_amount';
|
|
634
|
+
const [source, units] = type.split('_');
|
|
635
|
+
return html `
|
|
636
|
+
<div data-testid="rules">
|
|
637
|
+
${this.renderTemplateOrSlot('rules:before')}
|
|
638
|
+
|
|
639
|
+
<div>
|
|
640
|
+
<div class="flex items-center justify-between space-x-m text-s mb-xs">
|
|
641
|
+
<foxy-i18n
|
|
642
|
+
class=${classMap({
|
|
643
|
+
'transition-colors font-medium flex-1': true,
|
|
644
|
+
'text-secondary': !isDisabled,
|
|
645
|
+
'text-disabled': isDisabled,
|
|
646
|
+
})}
|
|
647
|
+
lang=${this.lang}
|
|
648
|
+
key="rule_plural"
|
|
649
|
+
ns=${this.ns}
|
|
650
|
+
>
|
|
651
|
+
</foxy-i18n>
|
|
652
|
+
|
|
653
|
+
<div class="min-w-0">${this.__renderRulesPreset()}</div>
|
|
654
|
+
</div>
|
|
655
|
+
|
|
656
|
+
<div class="space-y-s">
|
|
657
|
+
${repeat(renderedTiers, (tier, tierIndex) => {
|
|
658
|
+
const onChange = (changedParams) => {
|
|
659
|
+
var _a, _b, _c;
|
|
660
|
+
const newMethod = (_a = changedParams.method) !== null && _a !== void 0 ? _a : method;
|
|
661
|
+
const newSource = (_b = changedParams.source) !== null && _b !== void 0 ? _b : source;
|
|
662
|
+
const newUnits = (_c = changedParams.units) !== null && _c !== void 0 ? _c : units;
|
|
663
|
+
const newTier = changedParams.tier;
|
|
664
|
+
const newTiers = [...tiers];
|
|
665
|
+
if (newTier) {
|
|
666
|
+
const newTierIndex = tier ? tierIndex : newTiers.length;
|
|
667
|
+
const oldTiersCount = tier ? 1 : 0;
|
|
668
|
+
newTiers.splice(newTierIndex, oldTiersCount, newTier);
|
|
669
|
+
}
|
|
670
|
+
this.edit({
|
|
671
|
+
coupon_discount_details: `${newMethod}|${newTiers.join('|')}`,
|
|
672
|
+
coupon_discount_type: `${newSource}_${newUnits}`,
|
|
673
|
+
});
|
|
674
|
+
};
|
|
675
|
+
const onDelete = () => {
|
|
676
|
+
const newTiers = tiers.filter((_, i) => i !== tierIndex);
|
|
677
|
+
this.edit({ coupon_discount_details: `${method}|${newTiers.join('|')}` });
|
|
678
|
+
};
|
|
679
|
+
return this.__renderRulesTier({ source, method, units, tier, onChange, onDelete });
|
|
680
|
+
})}
|
|
681
|
+
</div>
|
|
682
|
+
|
|
683
|
+
<div class="space-y-xs mt-m">
|
|
684
|
+
${this.__renderRulesUrlParameter()} ${this.__renderRulesDescription()}
|
|
685
|
+
</div>
|
|
686
|
+
</div>
|
|
687
|
+
|
|
688
|
+
${this.renderTemplateOrSlot('rules:after')}
|
|
689
|
+
</div>
|
|
690
|
+
`;
|
|
691
|
+
}
|
|
692
|
+
__renderCodes() {
|
|
693
|
+
var _a, _b, _c, _d, _e;
|
|
694
|
+
const { disabledSelector, group, data, lang, ns } = this;
|
|
695
|
+
const isDisabled = !this.in('idle') || disabledSelector.matches('codes', true);
|
|
696
|
+
const filters = this.__codesTableQuery;
|
|
697
|
+
const url = new URL(data._links['fx:coupon_codes'].href);
|
|
698
|
+
new URLSearchParams(filters !== null && filters !== void 0 ? filters : '').forEach((value, name) => url.searchParams.set(name, value));
|
|
699
|
+
url.searchParams.set('limit', '5');
|
|
700
|
+
const filterButtonLabel = filters === null ? 'filter' : 'clear_filters';
|
|
701
|
+
const filterButtonIcon = `icons:${filters === null ? 'filter-list' : 'clear'}`;
|
|
702
|
+
return html `
|
|
703
|
+
<div data-testid="codes">
|
|
704
|
+
<foxy-form-dialog
|
|
705
|
+
disabledcontrols=${disabledSelector.zoom('codes:generate:form').toString()}
|
|
706
|
+
readonlycontrols=${this.readonlySelector.zoom('codes:generate:form').toString()}
|
|
707
|
+
hiddencontrols="save-button current-balance ${this.hiddenSelector
|
|
708
|
+
.zoom('codes:generate:form')
|
|
709
|
+
.toString()}"
|
|
710
|
+
related=${JSON.stringify([url.toString()])}
|
|
711
|
+
header="generate"
|
|
712
|
+
parent=${(_a = data === null || data === void 0 ? void 0 : data._links['fx:generate_codes'].href) !== null && _a !== void 0 ? _a : ''}
|
|
713
|
+
group=${group}
|
|
714
|
+
lang=${lang}
|
|
715
|
+
form="foxy-generate-codes-form"
|
|
716
|
+
ns=${ns}
|
|
717
|
+
id="generate-codes-dialog"
|
|
718
|
+
alert
|
|
719
|
+
.related=${[url.toString()]}
|
|
720
|
+
>
|
|
721
|
+
</foxy-form-dialog>
|
|
722
|
+
|
|
723
|
+
<foxy-form-dialog
|
|
724
|
+
disabledcontrols=${disabledSelector.zoom('codes:form').toString()}
|
|
725
|
+
readonlycontrols=${this.readonlySelector.zoom('codes:form').toString()}
|
|
726
|
+
hiddencontrols=${this.hiddenSelector.zoom('codes:form').toString()}
|
|
727
|
+
header="code"
|
|
728
|
+
parent=${url.toString()}
|
|
729
|
+
group=${group}
|
|
730
|
+
lang=${lang}
|
|
731
|
+
form="foxy-coupon-code-form"
|
|
732
|
+
ns=${ns}
|
|
733
|
+
id="code-dialog"
|
|
734
|
+
>
|
|
735
|
+
</foxy-form-dialog>
|
|
736
|
+
|
|
737
|
+
<foxy-form-dialog
|
|
738
|
+
disabledcontrols=${disabledSelector.zoom('codes:import:form').toString()}
|
|
739
|
+
readonlycontrols=${this.readonlySelector.zoom('codes:import:form').toString()}
|
|
740
|
+
hiddencontrols="save-button ${this.hiddenSelector.zoom('codes:import:form').toString()}"
|
|
741
|
+
header="import"
|
|
742
|
+
parent=${data._links['fx:coupon_codes'].href}
|
|
743
|
+
group=${group}
|
|
744
|
+
lang=${lang}
|
|
745
|
+
form="foxy-coupon-codes-form"
|
|
746
|
+
ns=${ns}
|
|
747
|
+
id="import-dialog"
|
|
748
|
+
>
|
|
749
|
+
</foxy-form-dialog>
|
|
750
|
+
|
|
751
|
+
${this.renderTemplateOrSlot('codes:before')}
|
|
752
|
+
|
|
753
|
+
<div class="flex items-center justify-between mb-xs space-x-s">
|
|
754
|
+
<foxy-i18n
|
|
755
|
+
class="text-s font-medium text-secondary leading-none flex-1"
|
|
756
|
+
lang=${lang}
|
|
757
|
+
key="code_plural"
|
|
758
|
+
ns=${ns}
|
|
759
|
+
>
|
|
760
|
+
</foxy-i18n>
|
|
761
|
+
|
|
762
|
+
<vaadin-button
|
|
763
|
+
data-testid="codes:generate-button"
|
|
764
|
+
theme="success tertiary small"
|
|
765
|
+
?disabled=${isDisabled}
|
|
766
|
+
@click=${(evt) => {
|
|
767
|
+
const dialog = this.renderRoot.querySelector('#generate-codes-dialog');
|
|
768
|
+
const button = evt.currentTarget;
|
|
769
|
+
dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
|
|
770
|
+
}}
|
|
771
|
+
>
|
|
772
|
+
<foxy-i18n class="text-s" lang=${lang} key="generate" ns=${ns}></foxy-i18n>
|
|
773
|
+
<iron-icon class="icon-inline text-s" icon="icons:add"></iron-icon>
|
|
774
|
+
</vaadin-button>
|
|
775
|
+
|
|
776
|
+
<vaadin-button
|
|
777
|
+
data-testid="codes:import-button"
|
|
778
|
+
theme="contrast tertiary small"
|
|
779
|
+
?disabled=${isDisabled}
|
|
780
|
+
@click=${(evt) => {
|
|
781
|
+
const dialog = this.renderRoot.querySelector('#import-dialog');
|
|
782
|
+
const button = evt.currentTarget;
|
|
783
|
+
dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
|
|
784
|
+
}}
|
|
785
|
+
>
|
|
786
|
+
<foxy-i18n class="text-s" lang=${lang} key="import" ns=${ns}></foxy-i18n>
|
|
787
|
+
<iron-icon class="icon-inline text-s" icon="icons:open-in-browser"></iron-icon>
|
|
788
|
+
</vaadin-button>
|
|
789
|
+
|
|
790
|
+
<vaadin-button
|
|
791
|
+
data-testid="codes:filter-button"
|
|
792
|
+
theme="contrast ${filters === null ? 'tertiary' : ''} small"
|
|
793
|
+
?disabled=${isDisabled}
|
|
794
|
+
@click=${() => (this.__codesTableQuery = filters === null ? '' : null)}
|
|
795
|
+
>
|
|
796
|
+
<foxy-i18n class="text-s" lang=${lang} key=${filterButtonLabel} ns=${ns}></foxy-i18n>
|
|
797
|
+
<iron-icon class="icon-inline text-s" icon=${filterButtonIcon}></iron-icon>
|
|
798
|
+
</vaadin-button>
|
|
799
|
+
</div>
|
|
800
|
+
|
|
801
|
+
<foxy-query-builder
|
|
802
|
+
class="bg-contrast-5 rounded-tl-l rounded-tr-s rounded-b-l p-m mb-s"
|
|
803
|
+
lang=${lang}
|
|
804
|
+
ns="${ns} ${(_c = (_b = customElements.get('foxy-query-builder')) === null || _b === void 0 ? void 0 : _b.defaultNS) !== null && _c !== void 0 ? _c : ''}"
|
|
805
|
+
?disabled=${isDisabled}
|
|
806
|
+
?hidden=${filters === null}
|
|
807
|
+
.options=${CouponForm.__codesQueryOptions}
|
|
808
|
+
.value=${filters}
|
|
809
|
+
@change=${(evt) => {
|
|
810
|
+
const queryBuilder = evt.currentTarget;
|
|
811
|
+
this.__codesTableQuery = queryBuilder.value;
|
|
812
|
+
}}
|
|
813
|
+
>
|
|
814
|
+
</foxy-query-builder>
|
|
815
|
+
|
|
816
|
+
<foxy-pagination
|
|
817
|
+
first=${url.toString()}
|
|
818
|
+
lang=${lang}
|
|
819
|
+
ns="${ns} ${(_e = (_d = customElements.get('foxy-pagination')) === null || _d === void 0 ? void 0 : _d.defaultNS) !== null && _e !== void 0 ? _e : ''}"
|
|
820
|
+
?disabled=${isDisabled}
|
|
821
|
+
>
|
|
822
|
+
<foxy-table
|
|
823
|
+
class="px-m mb-s border border-contrast-10 rounded-t-l rounded-b-l"
|
|
824
|
+
group=${group}
|
|
825
|
+
lang=${lang}
|
|
826
|
+
ns=${ns}
|
|
827
|
+
.columns=${this.__codesTableColumns}
|
|
828
|
+
>
|
|
829
|
+
</foxy-table>
|
|
830
|
+
</foxy-pagination>
|
|
831
|
+
|
|
832
|
+
${this.renderTemplateOrSlot('codes:after')}
|
|
833
|
+
</div>
|
|
834
|
+
`;
|
|
835
|
+
}
|
|
836
|
+
__renderUsage() {
|
|
837
|
+
var _a, _b, _c;
|
|
838
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('usage', true);
|
|
839
|
+
const isReadonly = this.readonlySelector.matches('usage', true);
|
|
840
|
+
const usesPerCoupon = (_a = this.form.number_of_uses_allowed) !== null && _a !== void 0 ? _a : 0;
|
|
841
|
+
const usesPerCustomer = (_b = this.form.number_of_uses_allowed_per_customer) !== null && _b !== void 0 ? _b : 0;
|
|
842
|
+
const usesPerCouponCode = (_c = this.form.number_of_uses_allowed_per_code) !== null && _c !== void 0 ? _c : 0;
|
|
843
|
+
return html `
|
|
844
|
+
<div data-testid="usage">
|
|
845
|
+
${this.renderTemplateOrSlot('usage:before')}
|
|
846
|
+
|
|
847
|
+
<div class="space-y-s">
|
|
848
|
+
<div class="grid gap-m grid-cols-3">
|
|
849
|
+
<vaadin-integer-field
|
|
850
|
+
placeholder=${this.t('unlimited')}
|
|
851
|
+
data-testid="usage:per-coupon"
|
|
852
|
+
label=${this.t('uses_per_coupon')}
|
|
853
|
+
class="w-full"
|
|
854
|
+
min="0"
|
|
855
|
+
prevent-invalid-input
|
|
856
|
+
has-controls
|
|
857
|
+
.value=${usesPerCoupon || ''}
|
|
858
|
+
?disabled=${isDisabled}
|
|
859
|
+
?readonly=${isReadonly}
|
|
860
|
+
@change=${(evt) => {
|
|
861
|
+
const field = evt.currentTarget;
|
|
862
|
+
this.edit({ number_of_uses_allowed: parseInt(field.value) });
|
|
863
|
+
}}
|
|
864
|
+
>
|
|
865
|
+
</vaadin-integer-field>
|
|
866
|
+
|
|
867
|
+
<vaadin-integer-field
|
|
868
|
+
placeholder=${this.t('unlimited')}
|
|
869
|
+
data-testid="usage:per-coupon-code"
|
|
870
|
+
label=${this.t('uses_per_coupon_code')}
|
|
871
|
+
class="w-full"
|
|
872
|
+
min="0"
|
|
873
|
+
prevent-invalid-input
|
|
874
|
+
has-controls
|
|
875
|
+
.value=${usesPerCouponCode || ''}
|
|
876
|
+
?disabled=${isDisabled}
|
|
877
|
+
?readonly=${isReadonly}
|
|
878
|
+
@change=${(evt) => {
|
|
879
|
+
const field = evt.currentTarget;
|
|
880
|
+
this.edit({ number_of_uses_allowed_per_code: parseInt(field.value) });
|
|
881
|
+
}}
|
|
882
|
+
>
|
|
883
|
+
</vaadin-integer-field>
|
|
884
|
+
|
|
885
|
+
<vaadin-integer-field
|
|
886
|
+
placeholder=${this.t('unlimited')}
|
|
887
|
+
data-testid="usage:per-customer"
|
|
888
|
+
label=${this.t('uses_per_customer')}
|
|
889
|
+
class="w-full"
|
|
890
|
+
min="0"
|
|
891
|
+
prevent-invalid-input
|
|
892
|
+
has-controls
|
|
893
|
+
.value=${usesPerCustomer || ''}
|
|
894
|
+
?disabled=${isDisabled}
|
|
895
|
+
?readonly=${isReadonly}
|
|
896
|
+
@change=${(evt) => {
|
|
897
|
+
const field = evt.currentTarget;
|
|
898
|
+
this.edit({ number_of_uses_allowed_per_customer: parseInt(field.value) });
|
|
899
|
+
}}
|
|
900
|
+
>
|
|
901
|
+
</vaadin-integer-field>
|
|
902
|
+
</div>
|
|
903
|
+
|
|
904
|
+
<div
|
|
905
|
+
class=${classMap({
|
|
906
|
+
'transition-colors text-xs leading-s': true,
|
|
907
|
+
'text-secondary': !isDisabled,
|
|
908
|
+
'text-disabled': isDisabled,
|
|
909
|
+
})}
|
|
910
|
+
>
|
|
911
|
+
<foxy-i18n
|
|
912
|
+
options=${JSON.stringify({ count: usesPerCoupon })}
|
|
913
|
+
lang=${this.lang}
|
|
914
|
+
key="uses_per_coupon_summary${usesPerCoupon ? '' : '_0'}"
|
|
915
|
+
ns=${this.ns}
|
|
916
|
+
>
|
|
917
|
+
</foxy-i18n>
|
|
918
|
+
|
|
919
|
+
<foxy-i18n
|
|
920
|
+
options=${JSON.stringify({ count: usesPerCouponCode })}
|
|
921
|
+
lang=${this.lang}
|
|
922
|
+
key="uses_per_coupon_code_summary${usesPerCouponCode ? '' : '_0'}"
|
|
923
|
+
ns=${this.ns}
|
|
924
|
+
>
|
|
925
|
+
</foxy-i18n>
|
|
926
|
+
|
|
927
|
+
<foxy-i18n
|
|
928
|
+
options=${JSON.stringify({ count: usesPerCustomer })}
|
|
929
|
+
lang=${this.lang}
|
|
930
|
+
key="uses_per_customer_summary${usesPerCustomer ? '' : '_0'}"
|
|
931
|
+
ns=${this.ns}
|
|
932
|
+
>
|
|
933
|
+
</foxy-i18n>
|
|
934
|
+
</div>
|
|
935
|
+
</div>
|
|
936
|
+
|
|
937
|
+
${this.renderTemplateOrSlot('usage:after')}
|
|
938
|
+
</div>
|
|
939
|
+
`;
|
|
940
|
+
}
|
|
941
|
+
__renderProductRestrictions() {
|
|
942
|
+
var _a;
|
|
943
|
+
const scope = 'product-restrictions';
|
|
944
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope, true);
|
|
945
|
+
const isReadonly = this.readonlySelector.matches(scope, true);
|
|
946
|
+
const restrictions = (_a = this.form.product_code_restrictions) !== null && _a !== void 0 ? _a : '';
|
|
947
|
+
const groups = [
|
|
948
|
+
{ header: 'allow', items: [] },
|
|
949
|
+
{ header: 'block', items: [] },
|
|
950
|
+
];
|
|
951
|
+
if (restrictions) {
|
|
952
|
+
restrictions.split(',').forEach(value => {
|
|
953
|
+
const isBlocklistValue = value.startsWith('-');
|
|
954
|
+
const target = isBlocklistValue ? 1 : 0;
|
|
955
|
+
const label = isBlocklistValue ? value.substring(1) : value;
|
|
956
|
+
groups[target].items.push({ label, value });
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
return html `
|
|
960
|
+
<div data-testid="product-restrictions">
|
|
961
|
+
${this.renderTemplateOrSlot('product-restrictions:before')}
|
|
962
|
+
|
|
963
|
+
<div class="space-y-s">
|
|
964
|
+
<x-group frame>
|
|
965
|
+
<foxy-i18n
|
|
966
|
+
class=${isDisabled ? 'text-disabled' : 'text-secondary'}
|
|
967
|
+
slot="header"
|
|
968
|
+
lang=${this.lang}
|
|
969
|
+
key="product_restrictions"
|
|
970
|
+
ns=${this.ns}
|
|
971
|
+
>
|
|
972
|
+
</foxy-i18n>
|
|
973
|
+
|
|
974
|
+
<div class="grid sm-grid-cols-2 bg-contrast-10" style="gap: 1px">
|
|
975
|
+
${groups.map((group, index) => {
|
|
976
|
+
return html `
|
|
977
|
+
<x-group class="bg-base pt-m">
|
|
978
|
+
<foxy-i18n
|
|
979
|
+
class=${isDisabled ? 'text-disabled' : 'text-tertiary'}
|
|
980
|
+
slot="header"
|
|
981
|
+
lang=${this.lang}
|
|
982
|
+
key=${group.header}
|
|
983
|
+
ns=${this.ns}
|
|
984
|
+
>
|
|
985
|
+
</foxy-i18n>
|
|
986
|
+
|
|
987
|
+
<x-editable-list
|
|
988
|
+
data-testid="product-restrictions:${group.header}"
|
|
989
|
+
lang=${this.lang}
|
|
990
|
+
ns=${this.ns}
|
|
991
|
+
?disabled=${isDisabled}
|
|
992
|
+
?readonly=${isReadonly}
|
|
993
|
+
.items=${group.items}
|
|
994
|
+
@change=${(evt) => {
|
|
995
|
+
const newItemsByGroup = [
|
|
996
|
+
index === 0 ? evt.currentTarget.items : groups[0].items,
|
|
997
|
+
index === 1 ? evt.currentTarget.items : groups[1].items,
|
|
998
|
+
];
|
|
999
|
+
const newSanitizedItemsByGroup = newItemsByGroup
|
|
1000
|
+
.map(list => list.map(v => v.value.replace(/^[\s-]*/, '').trimEnd()))
|
|
1001
|
+
.map(list => list.filter(v => !!v))
|
|
1002
|
+
.map(list => Array.from(new Set(list)));
|
|
1003
|
+
const newRestrictions = newSanitizedItemsByGroup[0]
|
|
1004
|
+
.concat(newSanitizedItemsByGroup[1].map(v => `-${v}`))
|
|
1005
|
+
.join(',');
|
|
1006
|
+
this.edit({ product_code_restrictions: newRestrictions });
|
|
1007
|
+
}}
|
|
1008
|
+
>
|
|
1009
|
+
</x-editable-list>
|
|
1010
|
+
</x-group>
|
|
1011
|
+
`;
|
|
1012
|
+
})}
|
|
1013
|
+
</div>
|
|
1014
|
+
</x-group>
|
|
1015
|
+
|
|
1016
|
+
<foxy-i18n
|
|
1017
|
+
class=${classMap({
|
|
1018
|
+
'block text-xs leading-s transition-colors': true,
|
|
1019
|
+
'text-secondary': !isDisabled,
|
|
1020
|
+
'text-disabled': isDisabled,
|
|
1021
|
+
})}
|
|
1022
|
+
lang=${this.lang}
|
|
1023
|
+
key="product_restrictions_explainer"
|
|
1024
|
+
ns=${this.ns}
|
|
1025
|
+
>
|
|
1026
|
+
</foxy-i18n>
|
|
1027
|
+
</div>
|
|
1028
|
+
|
|
1029
|
+
${this.renderTemplateOrSlot('product-restrictions:after')}
|
|
1030
|
+
</div>
|
|
1031
|
+
`;
|
|
1032
|
+
}
|
|
1033
|
+
__renderCategoryRestrictions() {
|
|
1034
|
+
var _a, _b, _c;
|
|
1035
|
+
const scope = 'category-restrictions';
|
|
1036
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope, true);
|
|
1037
|
+
const isReadonly = this.readonlySelector.matches(scope, true);
|
|
1038
|
+
return html `
|
|
1039
|
+
<div data-testid="category-restrictions">
|
|
1040
|
+
${this.renderTemplateOrSlot('category-restrictions:before')}
|
|
1041
|
+
|
|
1042
|
+
<div class="space-y-xs">
|
|
1043
|
+
<foxy-pagination
|
|
1044
|
+
first=${this.__itemCategories}
|
|
1045
|
+
lang=${this.lang}
|
|
1046
|
+
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-pagination')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
1047
|
+
?disabled=${isDisabled}
|
|
1048
|
+
>
|
|
1049
|
+
<foxy-i18n
|
|
1050
|
+
class="block text-s font-medium text-secondary leading-none mb-s"
|
|
1051
|
+
lang=${this.lang}
|
|
1052
|
+
key="category_restrictions"
|
|
1053
|
+
ns=${this.ns}
|
|
1054
|
+
>
|
|
1055
|
+
</foxy-i18n>
|
|
1056
|
+
|
|
1057
|
+
<x-category-restrictions-page
|
|
1058
|
+
coupon-item-categories=${ifDefined((_c = this.data) === null || _c === void 0 ? void 0 : _c._links['fx:coupon_item_categories'].href)}
|
|
1059
|
+
data-testid="category-restrictions:page"
|
|
1060
|
+
coupon=${this.href}
|
|
1061
|
+
class="border border-contrast-10 rounded-t-l rounded-b-l mb-s"
|
|
1062
|
+
group=${this.group}
|
|
1063
|
+
lang=${this.lang}
|
|
1064
|
+
ns=${this.ns}
|
|
1065
|
+
?disabled=${isDisabled}
|
|
1066
|
+
?readonly=${isReadonly}
|
|
1067
|
+
>
|
|
1068
|
+
</x-category-restrictions-page>
|
|
1069
|
+
</foxy-pagination>
|
|
1070
|
+
|
|
1071
|
+
<foxy-i18n
|
|
1072
|
+
class="block text-xs leading-s text-tertiary"
|
|
1073
|
+
lang=${this.lang}
|
|
1074
|
+
key="category_restrictions_helper_text"
|
|
1075
|
+
ns=${this.ns}
|
|
1076
|
+
>
|
|
1077
|
+
</foxy-i18n>
|
|
1078
|
+
</div>
|
|
1079
|
+
|
|
1080
|
+
${this.renderTemplateOrSlot('category-restrictions:after')}
|
|
1081
|
+
</div>
|
|
1082
|
+
`;
|
|
1083
|
+
}
|
|
1084
|
+
__renderOptions() {
|
|
1085
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('options', true);
|
|
1086
|
+
const isReadonly = this.readonlySelector.matches('options', true);
|
|
1087
|
+
const options = [
|
|
1088
|
+
{ param: 'multiple_codes_allowed' },
|
|
1089
|
+
{ param: 'combinable' },
|
|
1090
|
+
{ param: 'exclude_category_discounts', label: 'combine_with_category_discounts', flip: true },
|
|
1091
|
+
{ param: 'exclude_line_item_discounts', label: 'combine_with_line_discounts', flip: true },
|
|
1092
|
+
{ param: 'is_taxable', label: 'apply_taxes_before_coupon' },
|
|
1093
|
+
];
|
|
1094
|
+
return html `
|
|
1095
|
+
<div data-testid="options">
|
|
1096
|
+
${this.renderTemplateOrSlot('options:before')}
|
|
1097
|
+
|
|
1098
|
+
<x-group frame>
|
|
1099
|
+
<foxy-i18n
|
|
1100
|
+
class="transition-colors ${isDisabled ? 'text-disabled' : 'text-secondary'}"
|
|
1101
|
+
slot="header"
|
|
1102
|
+
lang=${this.lang}
|
|
1103
|
+
key="option_plural"
|
|
1104
|
+
ns=${this.ns}
|
|
1105
|
+
>
|
|
1106
|
+
</foxy-i18n>
|
|
1107
|
+
|
|
1108
|
+
${options.map(option => {
|
|
1109
|
+
var _a;
|
|
1110
|
+
const value = this.form[option.param];
|
|
1111
|
+
const label = (_a = option.label) !== null && _a !== void 0 ? _a : option.param;
|
|
1112
|
+
const color = isDisabled ? 'text-disabled' : 'text-secondary';
|
|
1113
|
+
return html `
|
|
1114
|
+
<x-checkbox
|
|
1115
|
+
data-testclass="inputs"
|
|
1116
|
+
data-testid="options:${option.param.replace(/_/g, '-')}"
|
|
1117
|
+
?disabled=${isDisabled}
|
|
1118
|
+
?readonly=${isReadonly}
|
|
1119
|
+
?checked=${option.flip ? !value : value}
|
|
1120
|
+
class="m-m"
|
|
1121
|
+
@change=${(evt) => {
|
|
1122
|
+
this.edit({ [option.param]: option.flip ? !evt.detail : evt.detail });
|
|
1123
|
+
}}
|
|
1124
|
+
>
|
|
1125
|
+
<div class="flex flex-col">
|
|
1126
|
+
<foxy-i18n lang=${this.lang} key=${label} ns=${this.ns}></foxy-i18n>
|
|
1127
|
+
<foxy-i18n
|
|
1128
|
+
class="transition-colors text-xs leading-s ${color}"
|
|
1129
|
+
lang=${this.lang}
|
|
1130
|
+
key="${label}_explainer"
|
|
1131
|
+
ns=${this.ns}
|
|
1132
|
+
>
|
|
1133
|
+
</foxy-i18n>
|
|
1134
|
+
</div>
|
|
1135
|
+
</x-checkbox>
|
|
1136
|
+
|
|
1137
|
+
<div style="margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))">
|
|
1138
|
+
<div class="border-b border-contrast-10"></div>
|
|
1139
|
+
</div>
|
|
1140
|
+
`;
|
|
1141
|
+
})}
|
|
1142
|
+
|
|
1143
|
+
<x-checkbox
|
|
1144
|
+
data-testclass="inputs"
|
|
1145
|
+
data-testid="options:dates"
|
|
1146
|
+
?disabled=${isDisabled}
|
|
1147
|
+
?readonly=${isReadonly}
|
|
1148
|
+
?checked=${this.form.start_date || this.form.end_date}
|
|
1149
|
+
class="m-m"
|
|
1150
|
+
@change=${(evt) => {
|
|
1151
|
+
if (evt instanceof CheckboxChangeEvent) {
|
|
1152
|
+
let startDate = null;
|
|
1153
|
+
let endDate = null;
|
|
1154
|
+
if (evt.detail) {
|
|
1155
|
+
const today = Date.now();
|
|
1156
|
+
const oneMonthFromToday = new Date(today).setMonth(new Date().getMonth() + 1);
|
|
1157
|
+
startDate = serializeDate(new Date(today));
|
|
1158
|
+
endDate = serializeDate(new Date(oneMonthFromToday));
|
|
1159
|
+
}
|
|
1160
|
+
this.edit({ start_date: startDate, end_date: endDate });
|
|
1161
|
+
}
|
|
1162
|
+
}}
|
|
1163
|
+
>
|
|
1164
|
+
<div class="flex flex-col">
|
|
1165
|
+
<foxy-i18n lang=${this.lang} key="set_time_constraints" ns=${this.ns}></foxy-i18n>
|
|
1166
|
+
<foxy-i18n
|
|
1167
|
+
class="text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}"
|
|
1168
|
+
lang=${this.lang}
|
|
1169
|
+
key="set_time_constraints_explainer"
|
|
1170
|
+
ns=${this.ns}
|
|
1171
|
+
>
|
|
1172
|
+
</foxy-i18n>
|
|
1173
|
+
</div>
|
|
1174
|
+
|
|
1175
|
+
${this.form.start_date || this.form.end_date
|
|
1176
|
+
? html `
|
|
1177
|
+
<div class="grid grid-cols-2 gap-m mt-m" slot="content">
|
|
1178
|
+
${['start_date', 'end_date'].map(property => {
|
|
1179
|
+
const formValue = this.form[property];
|
|
1180
|
+
const pickerValue = formValue ? serializeDate(new Date(formValue)) : '';
|
|
1181
|
+
return html `
|
|
1182
|
+
<vaadin-date-picker
|
|
1183
|
+
data-testclass="inputs"
|
|
1184
|
+
data-testid="options:${property.replace('_', '-')}"
|
|
1185
|
+
placeholder=${this.t('select')}
|
|
1186
|
+
label=${this.t(property)}
|
|
1187
|
+
clear-button-visible
|
|
1188
|
+
?disabled=${isDisabled}
|
|
1189
|
+
?readonly=${isReadonly}
|
|
1190
|
+
.value=${live(pickerValue)}
|
|
1191
|
+
@change=${(evt) => {
|
|
1192
|
+
const field = evt.currentTarget;
|
|
1193
|
+
this.edit({ [property]: field.value });
|
|
1194
|
+
}}
|
|
1195
|
+
>
|
|
1196
|
+
</vaadin-date-picker>
|
|
1197
|
+
`;
|
|
1198
|
+
})}
|
|
1199
|
+
</div>
|
|
1200
|
+
`
|
|
1201
|
+
: ''}
|
|
1202
|
+
</x-checkbox>
|
|
1203
|
+
</x-group>
|
|
1204
|
+
|
|
1205
|
+
${this.renderTemplateOrSlot('options:after')}
|
|
1206
|
+
</div>
|
|
1207
|
+
`;
|
|
1208
|
+
}
|
|
1209
|
+
__renderTimestamps() {
|
|
1210
|
+
return html `
|
|
1211
|
+
<div>
|
|
1212
|
+
${this.renderTemplateOrSlot('timestamps:before')}
|
|
1213
|
+
|
|
1214
|
+
<x-property-table
|
|
1215
|
+
data-testid="timestamps"
|
|
1216
|
+
.items=${['date_modified', 'date_created'].map(field => {
|
|
1217
|
+
var _a;
|
|
1218
|
+
return ({
|
|
1219
|
+
name: this.t(field),
|
|
1220
|
+
value: ((_a = this.data) === null || _a === void 0 ? void 0 : _a[field]) ? this.t('date', { value: new Date(this.data[field]) })
|
|
1221
|
+
: '',
|
|
1222
|
+
});
|
|
1223
|
+
})}
|
|
1224
|
+
>
|
|
1225
|
+
</x-property-table>
|
|
1226
|
+
|
|
1227
|
+
${this.renderTemplateOrSlot('timestamps:after')}
|
|
1228
|
+
</div>
|
|
1229
|
+
`;
|
|
1230
|
+
}
|
|
1231
|
+
__renderCreate() {
|
|
1232
|
+
const isCleanTemplateInvalid = this.in({ idle: { template: { clean: 'invalid' } } });
|
|
1233
|
+
const isDirtyTemplateInvalid = this.in({ idle: { template: { dirty: 'invalid' } } });
|
|
1234
|
+
const isCleanSnapshotInvalid = this.in({ idle: { snapshot: { clean: 'invalid' } } });
|
|
1235
|
+
const isDirtySnapshotInvalid = this.in({ idle: { snapshot: { dirty: 'invalid' } } });
|
|
1236
|
+
const isTemplateInvalid = isCleanTemplateInvalid || isDirtyTemplateInvalid;
|
|
1237
|
+
const isSnaphotInvalid = isCleanSnapshotInvalid || isDirtySnapshotInvalid;
|
|
1238
|
+
const isInvalid = isTemplateInvalid || isSnaphotInvalid;
|
|
1239
|
+
const isIdle = this.in('idle');
|
|
1240
|
+
return html `
|
|
1241
|
+
<div>
|
|
1242
|
+
${this.renderTemplateOrSlot('create:before')}
|
|
1243
|
+
|
|
1244
|
+
<vaadin-button
|
|
1245
|
+
data-testid="create"
|
|
1246
|
+
class="w-full"
|
|
1247
|
+
theme="primary success"
|
|
1248
|
+
?disabled=${!isIdle || isInvalid || this.disabledSelector.matches('create', true)}
|
|
1249
|
+
@click=${this.submit}
|
|
1250
|
+
>
|
|
1251
|
+
<foxy-i18n ns=${this.ns} key="create" lang=${this.lang}></foxy-i18n>
|
|
1252
|
+
</vaadin-button>
|
|
1253
|
+
|
|
1254
|
+
${this.renderTemplateOrSlot('create:after')}
|
|
1255
|
+
</div>
|
|
1256
|
+
`;
|
|
1257
|
+
}
|
|
1258
|
+
__renderDelete() {
|
|
1259
|
+
return html `
|
|
1260
|
+
<div>
|
|
1261
|
+
<foxy-internal-confirm-dialog
|
|
1262
|
+
data-testid="confirm"
|
|
1263
|
+
message="delete_prompt"
|
|
1264
|
+
confirm="delete"
|
|
1265
|
+
cancel="cancel"
|
|
1266
|
+
header="delete"
|
|
1267
|
+
theme="primary error"
|
|
1268
|
+
lang=${this.lang}
|
|
1269
|
+
ns=${this.ns}
|
|
1270
|
+
id="confirm"
|
|
1271
|
+
@hide=${(evt) => !evt.detail.cancelled && this.delete()}
|
|
1272
|
+
>
|
|
1273
|
+
</foxy-internal-confirm-dialog>
|
|
1274
|
+
|
|
1275
|
+
${this.renderTemplateOrSlot('delete:before')}
|
|
1276
|
+
|
|
1277
|
+
<vaadin-button
|
|
1278
|
+
data-testid="delete"
|
|
1279
|
+
theme="primary error"
|
|
1280
|
+
class="w-full"
|
|
1281
|
+
?disabled=${!this.in('idle') || this.disabledSelector.matches('delete', true)}
|
|
1282
|
+
@click=${(evt) => {
|
|
1283
|
+
const confirm = this.renderRoot.querySelector('#confirm');
|
|
1284
|
+
confirm.show(evt.currentTarget);
|
|
1285
|
+
}}
|
|
1286
|
+
>
|
|
1287
|
+
<foxy-i18n ns=${this.ns} key="delete" lang=${this.lang}></foxy-i18n>
|
|
1288
|
+
</vaadin-button>
|
|
1289
|
+
|
|
1290
|
+
${this.renderTemplateOrSlot('delete:after')}
|
|
1291
|
+
</div>
|
|
1292
|
+
`;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
CouponForm.__codesQueryOptions = [
|
|
1296
|
+
{ label: 'code', path: 'code', type: Type.String },
|
|
1297
|
+
{ label: 'used_codes', path: 'number_of_uses_to_date', type: Type.Number },
|
|
1298
|
+
{ label: 'date_created', path: 'date_created', type: Type.Date },
|
|
1299
|
+
{ label: 'date_modified', path: 'date_modified', type: Type.Date },
|
|
1300
|
+
];
|
|
1301
|
+
//# sourceMappingURL=CouponForm.js.map
|