@foxy.io/elements 1.27.0-beta.6 → 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 -1
- 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 +1 -1
- 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 +1 -1
- 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 +3 -3
- 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-da7a0bfb.js → shared-018d5724.js} +1 -1
- package/dist/cdn/{shared-80eb1fee.js → shared-03673673.js} +1 -1
- package/dist/cdn/{shared-065dbdf6.js → shared-07e7d118.js} +1 -1
- package/dist/cdn/{shared-cab2aa63.js → shared-0a8161e5.js} +1 -1
- 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-1d6beb48.js → shared-1e7639e6.js} +1 -1
- package/dist/cdn/{shared-cc723108.js → shared-2314add3.js} +1 -1
- package/dist/cdn/{shared-931db653.js → shared-25198d9a.js} +1 -1
- package/dist/cdn/{shared-9a5da74d.js → shared-285f8cee.js} +1 -1
- package/dist/cdn/{shared-850e2ae1.js → shared-28be347b.js} +1 -1
- package/dist/cdn/{shared-6af480b8.js → shared-2b5a3c80.js} +1 -1
- package/dist/cdn/{shared-8def6325.js → shared-3cabd589.js} +1 -1
- package/dist/cdn/{shared-bfa30d93.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-b30f9b10.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-208e37af.js → shared-540063aa.js} +1 -1
- package/dist/cdn/{shared-93812e51.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-589e5d06.js → shared-58951f74.js} +4 -4
- package/dist/cdn/{shared-fd041b18.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-683145e5.js → shared-6586ffd5.js} +1 -1
- 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-5dbb9630.js → shared-6cd4e618.js} +1 -1
- package/dist/cdn/{shared-4329ffa1.js → shared-739f24fe.js} +1 -1
- package/dist/cdn/{shared-befe135a.js → shared-75d13e1b.js} +1 -1
- package/dist/cdn/{shared-bba8ae80.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-d04c2e0c.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-c5f57aa8.js → shared-8a247f48.js} +1 -1
- package/dist/cdn/{shared-e48fbf50.js → shared-8b521111.js} +1 -1
- package/dist/cdn/shared-90877857.js +1 -0
- package/dist/cdn/{shared-bb08b5ce.js → shared-90cbed56.js} +1 -1
- 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-fe7b3ed2.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-85979316.js → shared-b900e1b5.js} +1 -1
- package/dist/cdn/{shared-5f09205d.js → shared-b9ea6d85.js} +1 -1
- package/dist/cdn/{shared-fb8c09b8.js → shared-bb1d162b.js} +1 -1
- package/dist/cdn/{shared-1a9e80fa.js → shared-bd919e3b.js} +1 -1
- package/dist/cdn/{shared-61f67b16.js → shared-be0fca15.js} +1 -1
- package/dist/cdn/{shared-e966f1ef.js → shared-cdf873d4.js} +1 -1
- package/dist/cdn/{shared-0e8dceb8.js → shared-d10d6cba.js} +1 -1
- package/dist/cdn/shared-d222bd1e.js +6 -0
- package/dist/cdn/{shared-fda63db8.js → shared-d56a3799.js} +4 -4
- 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-e35297c9.js → shared-f0fcd613.js} +1 -1
- package/dist/cdn/{shared-2c70f0b6.js → shared-f4bb452b.js} +1 -1
- package/dist/cdn/{shared-ca15d510.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/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.js +15 -7
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
- package/dist/elements/{public/CouponForm/internal/InternalCouponFormBulkAddControl/InternalCouponFormBulkAddControl.d.ts → internal/InternalBulkAddActionControl/InternalBulkAddActionControl.d.ts} +3 -2
- package/dist/elements/{public/CouponForm/internal/InternalCouponFormBulkAddControl/InternalCouponFormBulkAddControl.js → internal/InternalBulkAddActionControl/InternalBulkAddActionControl.js} +9 -9
- 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/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/CouponForm/CouponForm.js +6 -4
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CouponForm/index.d.ts +1 -1
- package/dist/elements/public/CouponForm/index.js +1 -1
- package/dist/elements/public/CouponForm/index.js.map +1 -1
- package/dist/elements/public/CouponForm/types.d.ts +1 -10
- package/dist/elements/public/CouponForm/types.js.map +1 -1
- package/dist/elements/public/CustomerPortalSettingsForm/CustomerPortalSettingsForm.js +0 -6
- package/dist/elements/public/CustomerPortalSettingsForm/CustomerPortalSettingsForm.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/index.d.ts +1 -0
- package/dist/elements/public/index.defined.d.ts +1 -0
- package/dist/elements/public/index.defined.js +1 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +1 -0
- package/dist/elements/public/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/cdn/shared-07d5e225.js +0 -1
- package/dist/cdn/shared-29f2468c.js +0 -6
- package/dist/cdn/shared-400240f8.js +0 -1
- package/dist/cdn/shared-5e35c5a5.js +0 -1
- package/dist/cdn/shared-6c4affb9.js +0 -1
- package/dist/cdn/shared-77fd8dae.js +0 -1
- package/dist/cdn/shared-bfeff3bb.js +0 -1
- package/dist/cdn/shared-e07b24ca.js +0 -1
- package/dist/cdn/shared-e84be1c2.js +0 -64
- 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/internal/InternalCouponFormBulkAddControl/InternalCouponFormBulkAddControl.js.map +0 -1
- package/dist/elements/public/CouponForm/internal/InternalCouponFormBulkAddControl/index.d.ts +0 -6
- package/dist/elements/public/CouponForm/internal/InternalCouponFormBulkAddControl/index.js +0 -8
- package/dist/elements/public/CouponForm/internal/InternalCouponFormBulkAddControl/index.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,21 +1,13 @@
|
|
|
1
1
|
import { Type } from "../QueryBuilder/types.js";
|
|
2
2
|
import { html } from 'lit-element';
|
|
3
|
-
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
4
|
-
import { CategoryRestrictionsPage } from "./private/CategoryRestrictionsPage.js";
|
|
5
|
-
import { ConfigurableMixin } from "../../../mixins/configurable.js";
|
|
6
|
-
import { EditableList } from "../../private/EditableList/EditableList.js";
|
|
7
|
-
import { FrequencyInput } from "../../private/FrequencyInput/FrequencyInput.js";
|
|
8
|
-
import { Group } from "../../private/Group/Group.js";
|
|
9
|
-
import { NucleonElement } from "../NucleonElement/NucleonElement.js";
|
|
10
|
-
import { Metadata } from "../../private/Metadata/Metadata.js";
|
|
11
|
-
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
12
|
-
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
13
3
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
14
|
-
import {
|
|
4
|
+
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
5
|
+
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
6
|
+
import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
|
|
15
7
|
import { currencies } from "./currencies.js";
|
|
16
8
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
17
9
|
const NS = 'gift-card-form';
|
|
18
|
-
const Base =
|
|
10
|
+
const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
|
|
19
11
|
/**
|
|
20
12
|
* Form element for creating or editing gift cards (`fx:gift_card`).
|
|
21
13
|
*
|
|
@@ -37,6 +29,9 @@ const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(ResponsiveMixi
|
|
|
37
29
|
* @slot category-restrictions:before
|
|
38
30
|
* @slot category-restrictions:after
|
|
39
31
|
*
|
|
32
|
+
* @slot attributes:before - **new in v1.27.0**
|
|
33
|
+
* @slot attributes:after - **new in v1.27.0**
|
|
34
|
+
*
|
|
40
35
|
* @slot timestamps:before
|
|
41
36
|
* @slot timestamps:after
|
|
42
37
|
*
|
|
@@ -52,121 +47,75 @@ const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(ResponsiveMixi
|
|
|
52
47
|
export class GiftCardForm extends Base {
|
|
53
48
|
constructor() {
|
|
54
49
|
super(...arguments);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
cell: ctx => html `
|
|
90
|
-
<foxy-i18n
|
|
91
|
-
options=${JSON.stringify({ value: ctx.data.date_created })}
|
|
92
|
-
class="text-tertiary"
|
|
93
|
-
lang=${ctx.lang}
|
|
94
|
-
key="date"
|
|
95
|
-
ns=${ctx.ns}
|
|
96
|
-
>
|
|
97
|
-
</foxy-i18n>
|
|
98
|
-
`,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
hideBelow: 'sm',
|
|
102
|
-
header: c => html `<foxy-i18n lang=${c.lang} key="end_date" ns=${c.ns}></foxy-i18n>`,
|
|
103
|
-
cell: ctx => html `
|
|
104
|
-
<foxy-i18n
|
|
105
|
-
options=${JSON.stringify({ value: ctx.data.end_date })}
|
|
106
|
-
class="text-tertiary"
|
|
107
|
-
lang=${ctx.lang}
|
|
108
|
-
key="date"
|
|
109
|
-
ns=${ctx.ns}
|
|
110
|
-
>
|
|
111
|
-
</foxy-i18n>
|
|
112
|
-
`,
|
|
113
|
-
},
|
|
50
|
+
/** Returns a `fx:customer` Resource URL for a Customer ID. */
|
|
51
|
+
this.getCustomerHref = id => {
|
|
52
|
+
return `https://api.foxycart.com/customers/${id}`;
|
|
53
|
+
};
|
|
54
|
+
this.__productCodeRestrictionsGetValue = () => {
|
|
55
|
+
var _a;
|
|
56
|
+
return (_a = this.form.product_code_restrictions) === null || _a === void 0 ? void 0 : _a.split(',').filter(v => !!v.trim()).map(value => ({
|
|
57
|
+
value,
|
|
58
|
+
label: value.startsWith('-')
|
|
59
|
+
? this.t(`product-code-restrictions.label_block`, { value: value.substring(1) })
|
|
60
|
+
: this.t(`product-code-restrictions.label_allow`, { value }),
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
this.__productCodeRestrictionsSetValue = (newValue) => {
|
|
64
|
+
this.edit({
|
|
65
|
+
product_code_restrictions: newValue
|
|
66
|
+
.map(({ value, unit }) => (unit === 'block' ? `-${value}` : value))
|
|
67
|
+
.filter((v, i, a) => !!v && a.indexOf(v) === i)
|
|
68
|
+
.join(','),
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
this.__currencyCodeGetValue = () => {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = this.form.currency_code) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
74
|
+
};
|
|
75
|
+
this.__storeLoaderId = 'storeLoader';
|
|
76
|
+
this.__codesFilters = [
|
|
77
|
+
{ label: 'code', path: 'code', type: Type.String },
|
|
78
|
+
{ label: 'current_balance', path: 'current_balance', type: Type.Number },
|
|
79
|
+
{ label: 'end_date', path: 'end_date', type: Type.Date },
|
|
80
|
+
{ label: 'date_created', path: 'date_created', type: Type.Date },
|
|
81
|
+
{ label: 'date_modified', path: 'date_modified', type: Type.Date },
|
|
82
|
+
];
|
|
83
|
+
this.__codesActions = [
|
|
114
84
|
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
85
|
+
theme: 'contrast',
|
|
86
|
+
state: 'idle',
|
|
87
|
+
text: 'copy_button_text',
|
|
88
|
+
onClick: async (data) => {
|
|
89
|
+
this.__codesActions[0].state = 'busy';
|
|
90
|
+
this.__codesActions = [...this.__codesActions];
|
|
91
|
+
try {
|
|
92
|
+
await navigator.clipboard.writeText(data.code);
|
|
93
|
+
this.__codesActions[0].state = 'end';
|
|
94
|
+
}
|
|
95
|
+
catch (_a) {
|
|
96
|
+
this.__codesActions[0].state = 'error';
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
this.__codesActions = [...this.__codesActions];
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
this.__codesActions[0].state = 'idle';
|
|
102
|
+
this.__codesActions = [...this.__codesActions];
|
|
103
|
+
}, 1000);
|
|
104
|
+
}
|
|
130
105
|
},
|
|
131
106
|
},
|
|
132
107
|
];
|
|
133
|
-
this.__codesTableQuery = null;
|
|
134
|
-
this.__currencyDisplay = '';
|
|
135
|
-
this.__itemCategories = '';
|
|
136
|
-
}
|
|
137
|
-
static get scopedElements() {
|
|
138
|
-
return {
|
|
139
|
-
'vaadin-text-field': customElements.get('vaadin-text-field'),
|
|
140
|
-
'vaadin-combo-box': customElements.get('vaadin-combo-box'),
|
|
141
|
-
'vaadin-button': customElements.get('vaadin-button'),
|
|
142
|
-
'iron-icon': customElements.get('iron-icon'),
|
|
143
|
-
'foxy-internal-gift-card-form-provisioning-control': customElements.get('foxy-internal-gift-card-form-provisioning-control'),
|
|
144
|
-
'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),
|
|
145
|
-
'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),
|
|
146
|
-
'foxy-query-builder': customElements.get('foxy-query-builder'),
|
|
147
|
-
'foxy-form-dialog': customElements.get('foxy-form-dialog'),
|
|
148
|
-
'foxy-pagination': customElements.get('foxy-pagination'),
|
|
149
|
-
'foxy-spinner': customElements.get('foxy-spinner'),
|
|
150
|
-
'foxy-table': customElements.get('foxy-table'),
|
|
151
|
-
'foxy-i18n': customElements.get('foxy-i18n'),
|
|
152
|
-
'x-category-restrictions-page': CategoryRestrictionsPage,
|
|
153
|
-
'x-frequency-input': FrequencyInput,
|
|
154
|
-
'x-metadata': Metadata,
|
|
155
|
-
'x-editable-list': EditableList,
|
|
156
|
-
'x-group': Group,
|
|
157
|
-
};
|
|
158
108
|
}
|
|
159
109
|
static get properties() {
|
|
160
110
|
return {
|
|
161
111
|
...super.properties,
|
|
162
|
-
|
|
163
|
-
__itemCategories: { attribute: false },
|
|
112
|
+
getCustomerHref: { attribute: false },
|
|
164
113
|
};
|
|
165
114
|
}
|
|
166
115
|
static get v8n() {
|
|
167
116
|
return [
|
|
168
|
-
({ name: v }) => !!v || '
|
|
169
|
-
({ name: v }) => !v || v.length <= 50 || '
|
|
117
|
+
({ name: v }) => !!v || 'name:v8n_required',
|
|
118
|
+
({ name: v }) => !v || v.length <= 50 || 'name:v8n_too_long',
|
|
170
119
|
form => {
|
|
171
120
|
var _a;
|
|
172
121
|
if ((_a = form.provisioning_config) === null || _a === void 0 ? void 0 : _a.allow_autoprovisioning) {
|
|
@@ -180,543 +129,144 @@ export class GiftCardForm extends Base {
|
|
|
180
129
|
form => {
|
|
181
130
|
var _a;
|
|
182
131
|
const v = (_a = form.provisioning_config) === null || _a === void 0 ? void 0 : _a.initial_balance_min;
|
|
183
|
-
return typeof v === 'number' && v
|
|
132
|
+
return typeof v === 'number' && v < 0 ? 'min-balance:v8n_negative' : true;
|
|
184
133
|
},
|
|
185
134
|
form => {
|
|
186
135
|
var _a;
|
|
187
136
|
const v = (_a = form.provisioning_config) === null || _a === void 0 ? void 0 : _a.initial_balance_max;
|
|
188
|
-
return typeof v === 'number' && v
|
|
137
|
+
return typeof v === 'number' && v < 0 ? 'max-balance:v8n_negative' : true;
|
|
138
|
+
},
|
|
139
|
+
({ product_code_restrictions: v }) => {
|
|
140
|
+
return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';
|
|
189
141
|
},
|
|
190
142
|
];
|
|
191
143
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const isCurrencyHidden = hidden.matches('currency', true);
|
|
197
|
-
const isExpiresHidden = hidden.matches('expires', true);
|
|
198
|
-
return html `
|
|
199
|
-
<div class="relative space-y-l">
|
|
200
|
-
${isNameHidden && isCurrencyHidden && isExpiresHidden
|
|
201
|
-
? ''
|
|
202
|
-
: html `
|
|
203
|
-
<div class="grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m">
|
|
204
|
-
${isNameHidden ? '' : html `<div class="md-col-span-2">${this.__renderName()}</div>`}
|
|
205
|
-
${isCurrencyHidden ? '' : this.__renderCurrency()}
|
|
206
|
-
${isExpiresHidden ? '' : this.__renderExpires()}
|
|
207
|
-
</div>
|
|
208
|
-
`}
|
|
209
|
-
|
|
210
|
-
<foxy-internal-gift-card-form-provisioning-control infer="provisioning">
|
|
211
|
-
</foxy-internal-gift-card-form-provisioning-control>
|
|
212
|
-
|
|
213
|
-
${hidden.matches('codes', true) || !this.data ? '' : this.__renderCodes()}
|
|
214
|
-
${hidden.matches('product-restrictions', true) ? '' : this.__renderProductRestrictions()}
|
|
215
|
-
${hidden.matches('category-restrictions', true) || !this.data
|
|
216
|
-
? ''
|
|
217
|
-
: this.__renderCategoryRestrictions()}
|
|
218
|
-
${hidden.matches('timestamps', true) ? '' : this.__renderTimestamps()}
|
|
219
|
-
${hidden.matches('create', true) || !!this.data ? '' : this.__renderCreate()}
|
|
220
|
-
${hidden.matches('delete', true) || !this.data ? '' : this.__renderDelete()}
|
|
221
|
-
|
|
222
|
-
<div
|
|
223
|
-
data-testid="spinner"
|
|
224
|
-
class=${classMap({
|
|
225
|
-
'transition duration-500 ease-in-out absolute inset-0 flex': true,
|
|
226
|
-
'opacity-0 pointer-events-none': !this.in('busy') && !this.in('fail'),
|
|
227
|
-
})}
|
|
228
|
-
>
|
|
229
|
-
<foxy-spinner
|
|
230
|
-
layout="vertical"
|
|
231
|
-
class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l"
|
|
232
|
-
state=${this.in('fail') ? 'error' : this.in('busy') ? 'busy' : 'empty'}
|
|
233
|
-
lang=${this.lang}
|
|
234
|
-
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-spinner')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
235
|
-
>
|
|
236
|
-
</foxy-spinner>
|
|
237
|
-
</div>
|
|
238
|
-
</div>
|
|
239
|
-
`;
|
|
240
|
-
}
|
|
241
|
-
async _sendGet() {
|
|
242
|
-
const giftCard = await super._sendGet();
|
|
243
|
-
const store = await super._fetch(giftCard._links['fx:store'].href);
|
|
244
|
-
const categoriesURL = new URL(store._links['fx:item_categories'].href);
|
|
245
|
-
categoriesURL.searchParams.set('limit', '5');
|
|
246
|
-
this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';
|
|
247
|
-
this.__itemCategories = categoriesURL.toString();
|
|
248
|
-
return giftCard;
|
|
249
|
-
}
|
|
250
|
-
__getErrorMessage(prefix) {
|
|
251
|
-
const error = this.errors.find(err => err.startsWith(prefix));
|
|
252
|
-
return error ? this.t(error.replace(prefix, 'v8n')).toString() : '';
|
|
253
|
-
}
|
|
254
|
-
__getValidator(prefix) {
|
|
255
|
-
return () => !this.errors.some(err => err.startsWith(prefix));
|
|
256
|
-
}
|
|
257
|
-
__renderName() {
|
|
258
|
-
var _a;
|
|
259
|
-
return html `
|
|
260
|
-
<div>
|
|
261
|
-
${this.renderTemplateOrSlot('name:before')}
|
|
262
|
-
|
|
263
|
-
<vaadin-text-field
|
|
264
|
-
error-message=${this.__getErrorMessage('name')}
|
|
265
|
-
helper-text=${this.t('gift_card_name_helper_text')}
|
|
266
|
-
data-testid="name"
|
|
267
|
-
class="w-full"
|
|
268
|
-
label=${this.t('name')}
|
|
269
|
-
.checkValidity=${this.__getValidator('name')}
|
|
270
|
-
.value=${(_a = this.form.name) !== null && _a !== void 0 ? _a : ''}
|
|
271
|
-
?disabled=${!this.in('idle') || this.disabledSelector.matches('name', true)}
|
|
272
|
-
?readonly=${this.readonlySelector.matches('name', true)}
|
|
273
|
-
required
|
|
274
|
-
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
275
|
-
@input=${(evt) => {
|
|
276
|
-
const newName = evt.currentTarget.value;
|
|
277
|
-
this.edit({ name: newName });
|
|
278
|
-
}}
|
|
279
|
-
>
|
|
280
|
-
</vaadin-text-field>
|
|
281
|
-
|
|
282
|
-
${this.renderTemplateOrSlot('name:after')}
|
|
283
|
-
</div>
|
|
284
|
-
`;
|
|
285
|
-
}
|
|
286
|
-
__renderCurrency() {
|
|
287
|
-
var _a, _b;
|
|
288
|
-
return html `
|
|
289
|
-
<div>
|
|
290
|
-
${this.renderTemplateOrSlot('currency:before')}
|
|
291
|
-
|
|
292
|
-
<vaadin-combo-box
|
|
293
|
-
item-label-path="label"
|
|
294
|
-
item-value-path="value"
|
|
295
|
-
item-id-path="value"
|
|
296
|
-
data-testid="currency"
|
|
297
|
-
class="w-full"
|
|
298
|
-
label=${this.t('currency')}
|
|
299
|
-
?disabled=${!this.in('idle') || this.disabledSelector.matches('currency', true)}
|
|
300
|
-
?readonly=${this.readonlySelector.matches('currency', true)}
|
|
301
|
-
.value=${(_b = (_a = this.form.currency_code) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : ''}
|
|
302
|
-
.items=${currencies.map(code => ({
|
|
303
|
-
label: `${this.t(`currency_${code}`)} (${code.toUpperCase()})`,
|
|
304
|
-
value: code,
|
|
305
|
-
}))}
|
|
306
|
-
@change=${(evt) => {
|
|
307
|
-
const comboBox = evt.currentTarget;
|
|
308
|
-
this.edit({ currency_code: comboBox.value });
|
|
309
|
-
}}
|
|
310
|
-
>
|
|
311
|
-
</vaadin-combo-box>
|
|
312
|
-
|
|
313
|
-
${this.renderTemplateOrSlot('currency:after')}
|
|
314
|
-
</div>
|
|
315
|
-
`;
|
|
316
|
-
}
|
|
317
|
-
__renderExpires() {
|
|
318
|
-
var _a;
|
|
319
|
-
return html `
|
|
320
|
-
<div>
|
|
321
|
-
${this.renderTemplateOrSlot('expires:before')}
|
|
322
|
-
|
|
323
|
-
<x-frequency-input
|
|
324
|
-
placeholder=${this.t('select')}
|
|
325
|
-
data-testid="expires"
|
|
326
|
-
label=${this.t('expires_after')}
|
|
327
|
-
class="w-full"
|
|
328
|
-
lang=${this.lang}
|
|
329
|
-
ns=${this.ns}
|
|
330
|
-
?disabled=${!this.in('idle') || this.disabledSelector.matches('expires', true)}
|
|
331
|
-
?readonly=${this.readonlySelector.matches('expires', true)}
|
|
332
|
-
.value=${(_a = this.form.expires_after) !== null && _a !== void 0 ? _a : ''}
|
|
333
|
-
@change=${(evt) => {
|
|
334
|
-
const input = evt.currentTarget;
|
|
335
|
-
this.edit({ expires_after: input.value });
|
|
336
|
-
}}
|
|
337
|
-
>
|
|
338
|
-
</x-frequency-input>
|
|
339
|
-
|
|
340
|
-
${this.renderTemplateOrSlot('expires:after')}
|
|
341
|
-
</div>
|
|
342
|
-
`;
|
|
343
|
-
}
|
|
344
|
-
__renderCodes() {
|
|
345
|
-
var _a, _b, _c, _d, _e;
|
|
346
|
-
const { disabledSelector, readonlySelector, hiddenSelector, group, data, lang, ns } = this;
|
|
347
|
-
const isDisabled = !this.in('idle') || disabledSelector.matches('codes', true);
|
|
348
|
-
const filters = this.__codesTableQuery;
|
|
349
|
-
const url = new URL(data._links['fx:gift_card_codes'].href);
|
|
350
|
-
new URLSearchParams(filters !== null && filters !== void 0 ? filters : '').forEach((value, name) => url.searchParams.set(name, value));
|
|
351
|
-
url.searchParams.set('limit', '5');
|
|
352
|
-
const filterButtonLabel = filters === null ? 'filter' : 'clear_filters';
|
|
353
|
-
const filterButtonIcon = `icons:${filters === null ? 'filter-list' : 'clear'}`;
|
|
354
|
-
return html `
|
|
355
|
-
<div data-testid="codes">
|
|
356
|
-
<foxy-form-dialog
|
|
357
|
-
disabledcontrols=${disabledSelector.zoom('codes:generate:form').toString()}
|
|
358
|
-
readonlycontrols=${readonlySelector.zoom('codes:generate:form').toString()}
|
|
359
|
-
hiddencontrols="save-button ${hiddenSelector.zoom('codes:generate:form').toString()}"
|
|
360
|
-
header="generate"
|
|
361
|
-
parent=${(_a = data === null || data === void 0 ? void 0 : data._links['fx:generate_codes'].href) !== null && _a !== void 0 ? _a : ''}
|
|
362
|
-
group=${group}
|
|
363
|
-
lang=${lang}
|
|
364
|
-
form="foxy-generate-codes-form"
|
|
365
|
-
ns=${ns}
|
|
366
|
-
id="generate-codes-dialog"
|
|
367
|
-
alert
|
|
368
|
-
.related=${[url.toString()]}
|
|
369
|
-
>
|
|
370
|
-
</foxy-form-dialog>
|
|
371
|
-
|
|
372
|
-
<foxy-form-dialog
|
|
373
|
-
disabledcontrols=${disabledSelector.zoom('codes:form').toString()}
|
|
374
|
-
readonlycontrols=${readonlySelector.zoom('codes:form').toString()}
|
|
375
|
-
hiddencontrols=${hiddenSelector.zoom('codes:form').toString()}
|
|
376
|
-
header="code"
|
|
377
|
-
parent=${url.toString()}
|
|
378
|
-
group=${group}
|
|
379
|
-
lang=${lang}
|
|
380
|
-
form="foxy-gift-card-code-form"
|
|
381
|
-
ns=${ns}
|
|
382
|
-
id="code-dialog"
|
|
383
|
-
>
|
|
384
|
-
</foxy-form-dialog>
|
|
385
|
-
|
|
386
|
-
<foxy-form-dialog
|
|
387
|
-
disabledcontrols=${disabledSelector.zoom('codes:import:form').toString()}
|
|
388
|
-
readonlycontrols=${readonlySelector.zoom('codes:import:form').toString()}
|
|
389
|
-
hiddencontrols="save-button ${hiddenSelector.zoom('codes:import:form').toString()}"
|
|
390
|
-
header="import"
|
|
391
|
-
parent=${data._links['fx:gift_card_codes'].href}
|
|
392
|
-
group=${group}
|
|
393
|
-
lang=${lang}
|
|
394
|
-
form="foxy-gift-card-codes-form"
|
|
395
|
-
ns=${ns}
|
|
396
|
-
id="import-dialog"
|
|
397
|
-
>
|
|
398
|
-
</foxy-form-dialog>
|
|
399
|
-
|
|
400
|
-
${this.renderTemplateOrSlot('codes:before')}
|
|
401
|
-
|
|
402
|
-
<div class="flex items-center justify-between mb-xs space-x-s">
|
|
403
|
-
<foxy-i18n
|
|
404
|
-
class="text-s font-medium text-secondary leading-none flex-1"
|
|
405
|
-
lang=${lang}
|
|
406
|
-
key="code_plural"
|
|
407
|
-
ns=${ns}
|
|
408
|
-
>
|
|
409
|
-
</foxy-i18n>
|
|
410
|
-
|
|
411
|
-
<vaadin-button
|
|
412
|
-
data-testid="codes:generate-button"
|
|
413
|
-
theme="success tertiary small"
|
|
414
|
-
?disabled=${isDisabled}
|
|
415
|
-
@click=${(evt) => {
|
|
416
|
-
const dialog = this.renderRoot.querySelector('#generate-codes-dialog');
|
|
417
|
-
const button = evt.currentTarget;
|
|
418
|
-
dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
|
|
419
|
-
}}
|
|
420
|
-
>
|
|
421
|
-
<foxy-i18n class="text-s" lang=${lang} key="generate" ns=${ns}></foxy-i18n>
|
|
422
|
-
<iron-icon class="icon-inline text-s" icon="icons:add"></iron-icon>
|
|
423
|
-
</vaadin-button>
|
|
424
|
-
|
|
425
|
-
<vaadin-button
|
|
426
|
-
data-testid="codes:import-button"
|
|
427
|
-
theme="contrast tertiary small"
|
|
428
|
-
?disabled=${isDisabled}
|
|
429
|
-
@click=${(evt) => {
|
|
430
|
-
const dialog = this.renderRoot.querySelector('#import-dialog');
|
|
431
|
-
const button = evt.currentTarget;
|
|
432
|
-
dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
|
|
433
|
-
}}
|
|
434
|
-
>
|
|
435
|
-
<foxy-i18n class="text-s" lang=${lang} key="import" ns=${ns}></foxy-i18n>
|
|
436
|
-
<iron-icon class="icon-inline text-s" icon="icons:open-in-browser"></iron-icon>
|
|
437
|
-
</vaadin-button>
|
|
438
|
-
|
|
439
|
-
<vaadin-button
|
|
440
|
-
data-testid="codes:filter-button"
|
|
441
|
-
theme="contrast ${filters === null ? 'tertiary' : ''} small"
|
|
442
|
-
?disabled=${isDisabled}
|
|
443
|
-
@click=${() => (this.__codesTableQuery = filters === null ? '' : null)}
|
|
444
|
-
>
|
|
445
|
-
<foxy-i18n class="text-s" lang=${lang} key=${filterButtonLabel} ns=${ns}></foxy-i18n>
|
|
446
|
-
<iron-icon class="icon-inline text-s" icon=${filterButtonIcon}></iron-icon>
|
|
447
|
-
</vaadin-button>
|
|
448
|
-
</div>
|
|
449
|
-
|
|
450
|
-
<foxy-query-builder
|
|
451
|
-
class="my-s"
|
|
452
|
-
lang=${lang}
|
|
453
|
-
ns="${ns} ${(_c = (_b = customElements.get('foxy-query-builder')) === null || _b === void 0 ? void 0 : _b.defaultNS) !== null && _c !== void 0 ? _c : ''}"
|
|
454
|
-
?disabled=${isDisabled}
|
|
455
|
-
?hidden=${filters === null}
|
|
456
|
-
.options=${GiftCardForm.__codesQueryOptions}
|
|
457
|
-
.value=${filters !== null && filters !== void 0 ? filters : ''}
|
|
458
|
-
@change=${(evt) => {
|
|
459
|
-
const queryBuilder = evt.currentTarget;
|
|
460
|
-
this.__codesTableQuery = queryBuilder.value;
|
|
461
|
-
}}
|
|
462
|
-
>
|
|
463
|
-
</foxy-query-builder>
|
|
464
|
-
|
|
465
|
-
<foxy-pagination
|
|
466
|
-
first=${url.toString()}
|
|
467
|
-
lang=${lang}
|
|
468
|
-
ns="${ns} ${(_e = (_d = customElements.get('foxy-pagination')) === null || _d === void 0 ? void 0 : _d.defaultNS) !== null && _e !== void 0 ? _e : ''}"
|
|
469
|
-
?disabled=${isDisabled}
|
|
470
|
-
>
|
|
471
|
-
<foxy-table
|
|
472
|
-
class="px-m mb-s border border-contrast-10 rounded"
|
|
473
|
-
group=${group}
|
|
474
|
-
lang=${lang}
|
|
475
|
-
ns=${ns}
|
|
476
|
-
.columns=${this.__codesTableColumns}
|
|
477
|
-
>
|
|
478
|
-
</foxy-table>
|
|
479
|
-
</foxy-pagination>
|
|
480
|
-
|
|
481
|
-
${this.renderTemplateOrSlot('codes:after')}
|
|
482
|
-
</div>
|
|
483
|
-
`;
|
|
484
|
-
}
|
|
485
|
-
__renderProductRestrictions() {
|
|
486
|
-
var _a;
|
|
487
|
-
const scope = 'product-restrictions';
|
|
488
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope, true);
|
|
489
|
-
const isReadonly = this.readonlySelector.matches(scope, true);
|
|
490
|
-
const restrictions = (_a = this.form.product_code_restrictions) !== null && _a !== void 0 ? _a : '';
|
|
491
|
-
const groups = [
|
|
492
|
-
{ header: 'allow', items: [] },
|
|
493
|
-
{ header: 'block', items: [] },
|
|
494
|
-
];
|
|
495
|
-
if (restrictions) {
|
|
496
|
-
restrictions.split(',').forEach(value => {
|
|
497
|
-
const isBlocklistValue = value.startsWith('-');
|
|
498
|
-
const target = isBlocklistValue ? 1 : 0;
|
|
499
|
-
const label = isBlocklistValue ? value.substring(1) : value;
|
|
500
|
-
groups[target].items.push({ label, value });
|
|
501
|
-
});
|
|
144
|
+
get hiddenSelector() {
|
|
145
|
+
const alwaysMatch = [super.hiddenSelector.toString()];
|
|
146
|
+
if (!this.data) {
|
|
147
|
+
alwaysMatch.push('codes', 'category-restrictions', 'attributes');
|
|
502
148
|
}
|
|
503
|
-
return
|
|
504
|
-
<div data-testid="product-restrictions">
|
|
505
|
-
${this.renderTemplateOrSlot('product-restrictions:before')}
|
|
506
|
-
|
|
507
|
-
<div class="space-y-s">
|
|
508
|
-
<x-group frame>
|
|
509
|
-
<foxy-i18n
|
|
510
|
-
class=${isDisabled ? 'text-disabled' : 'text-secondary'}
|
|
511
|
-
slot="header"
|
|
512
|
-
lang=${this.lang}
|
|
513
|
-
key="product_restrictions"
|
|
514
|
-
ns=${this.ns}
|
|
515
|
-
>
|
|
516
|
-
</foxy-i18n>
|
|
517
|
-
|
|
518
|
-
<div class="grid sm-grid-cols-2 bg-contrast-10" style="gap: 1px">
|
|
519
|
-
${groups.map((group, index) => {
|
|
520
|
-
return html `
|
|
521
|
-
<x-group class="bg-base pt-m">
|
|
522
|
-
<foxy-i18n
|
|
523
|
-
class=${isDisabled ? 'text-disabled' : 'text-tertiary'}
|
|
524
|
-
slot="header"
|
|
525
|
-
lang=${this.lang}
|
|
526
|
-
key=${group.header}
|
|
527
|
-
ns=${this.ns}
|
|
528
|
-
>
|
|
529
|
-
</foxy-i18n>
|
|
530
|
-
|
|
531
|
-
<x-editable-list
|
|
532
|
-
data-testid="product-restrictions:${group.header}"
|
|
533
|
-
lang=${this.lang}
|
|
534
|
-
ns=${this.ns}
|
|
535
|
-
?disabled=${isDisabled}
|
|
536
|
-
?readonly=${isReadonly}
|
|
537
|
-
.items=${group.items}
|
|
538
|
-
@change=${(evt) => {
|
|
539
|
-
const newItemsByGroup = [
|
|
540
|
-
index === 0 ? evt.currentTarget.items : groups[0].items,
|
|
541
|
-
index === 1 ? evt.currentTarget.items : groups[1].items,
|
|
542
|
-
];
|
|
543
|
-
const newSanitizedItemsByGroup = newItemsByGroup
|
|
544
|
-
.map(list => list.map(v => v.value.replace(/^[\s-]*/, '').trimEnd()))
|
|
545
|
-
.map(list => list.filter(v => !!v))
|
|
546
|
-
.map(list => Array.from(new Set(list)));
|
|
547
|
-
const newRestrictions = newSanitizedItemsByGroup[0]
|
|
548
|
-
.concat(newSanitizedItemsByGroup[1].map(v => `-${v}`))
|
|
549
|
-
.join(',');
|
|
550
|
-
this.edit({ product_code_restrictions: newRestrictions });
|
|
551
|
-
}}
|
|
552
|
-
>
|
|
553
|
-
</x-editable-list>
|
|
554
|
-
</x-group>
|
|
555
|
-
`;
|
|
556
|
-
})}
|
|
557
|
-
</div>
|
|
558
|
-
</x-group>
|
|
559
|
-
|
|
560
|
-
<foxy-i18n
|
|
561
|
-
class=${classMap({
|
|
562
|
-
'block text-xs leading-s transition-colors': true,
|
|
563
|
-
'text-secondary': !isDisabled,
|
|
564
|
-
'text-disabled': isDisabled,
|
|
565
|
-
})}
|
|
566
|
-
lang=${this.lang}
|
|
567
|
-
key="gift_card_product_restrictions_explainer"
|
|
568
|
-
ns=${this.ns}
|
|
569
|
-
>
|
|
570
|
-
</foxy-i18n>
|
|
571
|
-
</div>
|
|
572
|
-
|
|
573
|
-
${this.renderTemplateOrSlot('product-restrictions:after')}
|
|
574
|
-
</div>
|
|
575
|
-
`;
|
|
149
|
+
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
576
150
|
}
|
|
577
|
-
|
|
578
|
-
var _a, _b, _c;
|
|
579
|
-
const scope = 'category-restrictions';
|
|
580
|
-
const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope, true);
|
|
581
|
-
const isReadonly = this.readonlySelector.matches(scope, true);
|
|
582
|
-
const giftCardItemCategories = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:gift_card_item_categories'].href;
|
|
151
|
+
renderHeaderActions(data) {
|
|
583
152
|
return html `
|
|
584
|
-
<
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
<x-category-restrictions-page
|
|
603
|
-
gift-card-item-categories=${ifDefined(giftCardItemCategories)}
|
|
604
|
-
data-testid="category-restrictions:page"
|
|
605
|
-
gift-card=${this.href}
|
|
606
|
-
class="border border-contrast-10 rounded mb-s"
|
|
607
|
-
group=${this.group}
|
|
608
|
-
lang=${this.lang}
|
|
609
|
-
ns=${this.ns}
|
|
610
|
-
?disabled=${isDisabled}
|
|
611
|
-
?readonly=${isReadonly}
|
|
612
|
-
>
|
|
613
|
-
</x-category-restrictions-page>
|
|
614
|
-
</foxy-pagination>
|
|
615
|
-
|
|
616
|
-
<foxy-i18n
|
|
617
|
-
class="block text-xs leading-s text-secondary"
|
|
618
|
-
lang=${this.lang}
|
|
619
|
-
key="gift_card_category_restrictions_helper_text"
|
|
620
|
-
ns=${this.ns}
|
|
621
|
-
>
|
|
622
|
-
</foxy-i18n>
|
|
623
|
-
</div>
|
|
624
|
-
|
|
625
|
-
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
626
|
-
</div>
|
|
153
|
+
<foxy-internal-bulk-add-action-control
|
|
154
|
+
parent=${data._links['fx:generate_codes'].href}
|
|
155
|
+
infer="generate"
|
|
156
|
+
form="foxy-generate-codes-form"
|
|
157
|
+
.related=${[data._links['fx:gift_card_codes'].href]}
|
|
158
|
+
>
|
|
159
|
+
</foxy-internal-bulk-add-action-control>
|
|
160
|
+
|
|
161
|
+
<foxy-internal-bulk-add-action-control
|
|
162
|
+
parent=${data._links['fx:gift_card_codes'].href}
|
|
163
|
+
infer="import"
|
|
164
|
+
form="foxy-gift-card-codes-form"
|
|
165
|
+
.related=${[data._links['fx:gift_card_codes'].href]}
|
|
166
|
+
>
|
|
167
|
+
</foxy-internal-bulk-add-action-control>
|
|
168
|
+
|
|
169
|
+
${super.renderHeaderActions(data)}
|
|
627
170
|
`;
|
|
628
171
|
}
|
|
629
|
-
|
|
172
|
+
renderBody() {
|
|
173
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
174
|
+
let codesUrl;
|
|
175
|
+
try {
|
|
176
|
+
const url = new URL((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:gift_card_codes'].href) !== null && _b !== void 0 ? _b : '');
|
|
177
|
+
url.searchParams.set('order', 'date_created desc');
|
|
178
|
+
codesUrl = url.toString();
|
|
179
|
+
}
|
|
180
|
+
catch (_j) {
|
|
181
|
+
codesUrl = undefined;
|
|
182
|
+
}
|
|
630
183
|
return html `
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
<
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
})
|
|
643
|
-
|
|
184
|
+
${this.renderHeader()}
|
|
185
|
+
|
|
186
|
+
<div class="grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m">
|
|
187
|
+
<foxy-internal-text-control infer="name" class="md-col-span-2">
|
|
188
|
+
</foxy-internal-text-control>
|
|
189
|
+
|
|
190
|
+
<foxy-internal-select-control
|
|
191
|
+
property="currency_code"
|
|
192
|
+
infer="currency"
|
|
193
|
+
.getValue=${this.__currencyCodeGetValue}
|
|
194
|
+
.options=${currencies.map(value => ({
|
|
195
|
+
label: this.t(`currency.code_${value}`),
|
|
196
|
+
value,
|
|
197
|
+
}))}
|
|
644
198
|
>
|
|
645
|
-
</
|
|
199
|
+
</foxy-internal-select-control>
|
|
646
200
|
|
|
647
|
-
|
|
201
|
+
<foxy-internal-frequency-control property="expires_after" infer="expires">
|
|
202
|
+
</foxy-internal-frequency-control>
|
|
648
203
|
</div>
|
|
649
|
-
`;
|
|
650
|
-
}
|
|
651
|
-
__renderCreate() {
|
|
652
|
-
const isCleanTemplateInvalid = this.in({ idle: { template: { clean: 'invalid' } } });
|
|
653
|
-
const isDirtyTemplateInvalid = this.in({ idle: { template: { dirty: 'invalid' } } });
|
|
654
|
-
const isCleanSnapshotInvalid = this.in({ idle: { snapshot: { clean: 'invalid' } } });
|
|
655
|
-
const isDirtySnapshotInvalid = this.in({ idle: { snapshot: { dirty: 'invalid' } } });
|
|
656
|
-
const isTemplateInvalid = isCleanTemplateInvalid || isDirtyTemplateInvalid;
|
|
657
|
-
const isSnaphotInvalid = isCleanSnapshotInvalid || isDirtySnapshotInvalid;
|
|
658
|
-
const isInvalid = isTemplateInvalid || isSnaphotInvalid;
|
|
659
|
-
const isBusy = this.in('busy');
|
|
660
|
-
return html `
|
|
661
|
-
<div>
|
|
662
|
-
${this.renderTemplateOrSlot('create:before')}
|
|
663
204
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
205
|
+
<foxy-internal-gift-card-form-provisioning-control infer="provisioning">
|
|
206
|
+
</foxy-internal-gift-card-form-provisioning-control>
|
|
207
|
+
|
|
208
|
+
<foxy-internal-async-list-control
|
|
209
|
+
first=${codesUrl}
|
|
210
|
+
limit="5"
|
|
211
|
+
infer="codes"
|
|
212
|
+
item="foxy-gift-card-code-card"
|
|
213
|
+
form="foxy-gift-card-code-form"
|
|
214
|
+
alert
|
|
215
|
+
.formProps=${{ '.getCustomerHref': this.getCustomerHref }}
|
|
216
|
+
.actions=${this.__codesActions}
|
|
217
|
+
.filters=${this.__codesFilters}
|
|
218
|
+
>
|
|
219
|
+
</foxy-internal-async-list-control>
|
|
220
|
+
|
|
221
|
+
<foxy-internal-editable-list-control
|
|
222
|
+
infer="product-code-restrictions"
|
|
223
|
+
.getValue=${this.__productCodeRestrictionsGetValue}
|
|
224
|
+
.setValue=${this.__productCodeRestrictionsSetValue}
|
|
225
|
+
.units=${[
|
|
226
|
+
{ label: this.t('product-code-restrictions.unit_allow'), value: 'allow' },
|
|
227
|
+
{ label: this.t('product-code-restrictions.unit_block'), value: 'block' },
|
|
228
|
+
]}
|
|
229
|
+
>
|
|
230
|
+
</foxy-internal-editable-list-control>
|
|
231
|
+
|
|
232
|
+
<foxy-internal-async-resource-link-list-control
|
|
233
|
+
foreign-key-for-uri="item_category_uri"
|
|
234
|
+
foreign-key-for-id="item_category_id"
|
|
235
|
+
own-key-for-uri="gift_card_uri"
|
|
236
|
+
options-href=${ifDefined((_d = (_c = this.__storeLoader) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d._links['fx:item_categories'].href)}
|
|
237
|
+
links-href=${ifDefined((_e = this.data) === null || _e === void 0 ? void 0 : _e._links['fx:gift_card_item_categories'].href)}
|
|
238
|
+
embed-key="fx:gift_card_item_categories"
|
|
239
|
+
own-uri=${ifDefined((_f = this.data) === null || _f === void 0 ? void 0 : _f._links.self.href)}
|
|
240
|
+
infer="category-restrictions"
|
|
241
|
+
limit="5"
|
|
242
|
+
item="foxy-item-category-card"
|
|
243
|
+
>
|
|
244
|
+
</foxy-internal-async-resource-link-list-control>
|
|
245
|
+
|
|
246
|
+
<foxy-internal-async-list-control
|
|
247
|
+
first=${ifDefined((_g = this.data) === null || _g === void 0 ? void 0 : _g._links['fx:attributes'].href)}
|
|
248
|
+
limit="5"
|
|
249
|
+
infer="attributes"
|
|
250
|
+
item="foxy-attribute-card"
|
|
251
|
+
form="foxy-attribute-form"
|
|
252
|
+
alert
|
|
253
|
+
>
|
|
254
|
+
</foxy-internal-async-list-control>
|
|
255
|
+
|
|
256
|
+
${super.renderBody()}
|
|
257
|
+
|
|
258
|
+
<foxy-nucleon
|
|
259
|
+
infer=""
|
|
260
|
+
class="hidden"
|
|
261
|
+
href=${ifDefined((_h = this.data) === null || _h === void 0 ? void 0 : _h._links['fx:store'].href)}
|
|
262
|
+
id=${this.__storeLoaderId}
|
|
263
|
+
@update=${() => this.requestUpdate()}
|
|
264
|
+
>
|
|
265
|
+
</foxy-nucleon>
|
|
676
266
|
`;
|
|
677
267
|
}
|
|
678
|
-
|
|
679
|
-
return
|
|
680
|
-
<div>
|
|
681
|
-
<foxy-internal-confirm-dialog
|
|
682
|
-
data-testid="confirm"
|
|
683
|
-
message="delete_prompt"
|
|
684
|
-
confirm="delete"
|
|
685
|
-
cancel="cancel"
|
|
686
|
-
header="delete"
|
|
687
|
-
theme="primary error"
|
|
688
|
-
lang=${this.lang}
|
|
689
|
-
ns=${this.ns}
|
|
690
|
-
id="confirm"
|
|
691
|
-
@hide=${(evt) => !evt.detail.cancelled && this.delete()}
|
|
692
|
-
>
|
|
693
|
-
</foxy-internal-confirm-dialog>
|
|
694
|
-
|
|
695
|
-
${this.renderTemplateOrSlot('delete:before')}
|
|
696
|
-
|
|
697
|
-
<vaadin-button
|
|
698
|
-
data-testid="delete"
|
|
699
|
-
theme="error"
|
|
700
|
-
class="w-full"
|
|
701
|
-
?disabled=${!this.in('idle') || this.disabledSelector.matches('delete', true)}
|
|
702
|
-
@click=${(evt) => {
|
|
703
|
-
const confirm = this.renderRoot.querySelector('#confirm');
|
|
704
|
-
confirm.show(evt.currentTarget);
|
|
705
|
-
}}
|
|
706
|
-
>
|
|
707
|
-
<foxy-i18n ns=${this.ns} key="delete" lang=${this.lang}></foxy-i18n>
|
|
708
|
-
</vaadin-button>
|
|
709
|
-
|
|
710
|
-
${this.renderTemplateOrSlot('delete:after')}
|
|
711
|
-
</div>
|
|
712
|
-
`;
|
|
268
|
+
get __storeLoader() {
|
|
269
|
+
return this.renderRoot.querySelector(`#${this.__storeLoaderId}`);
|
|
713
270
|
}
|
|
714
271
|
}
|
|
715
|
-
GiftCardForm.__codesQueryOptions = [
|
|
716
|
-
{ label: 'code', path: 'code', type: Type.String },
|
|
717
|
-
{ label: 'current_balance', path: 'current_balance', type: Type.Number },
|
|
718
|
-
{ label: 'end_date', path: 'end_date', type: Type.Date },
|
|
719
|
-
{ label: 'date_created', path: 'date_created', type: Type.Date },
|
|
720
|
-
{ label: 'date_modified', path: 'date_modified', type: Type.Date },
|
|
721
|
-
];
|
|
722
272
|
//# sourceMappingURL=GiftCardForm.js.map
|