@foxy.io/elements 1.15.0-beta.6 → 1.15.0
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-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 -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-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-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- 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 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.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.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-pagination.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-query-builder.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +3 -3
- 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-5272c758.js → shared-00d6a968.js} +1 -1
- package/dist/cdn/{shared-25e67340.js → shared-023a97c2.js} +8 -8
- package/dist/cdn/{shared-02945b27.js → shared-027c537d.js} +1 -1
- package/dist/cdn/{shared-f0a83bd6.js → shared-073cb8e9.js} +1 -1
- package/dist/cdn/{shared-4dc6d228.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-06e64d75.js → shared-340f7584.js} +3 -3
- package/dist/cdn/{shared-66633ff7.js → shared-3f0a9c2c.js} +1 -1
- package/dist/cdn/{shared-09069d7c.js → shared-3f965dce.js} +1 -1
- package/dist/cdn/{shared-0ced76a0.js → shared-5a54a9bc.js} +1 -1
- package/dist/cdn/{shared-40b5267a.js → shared-5e2fd1c7.js} +1 -1
- package/dist/cdn/{shared-a7095b6a.js → shared-60d43523.js} +1 -1
- package/dist/cdn/{shared-08c63028.js → shared-625c1272.js} +1 -1
- package/dist/cdn/{shared-36629ded.js → shared-65dfd512.js} +3 -3
- package/dist/cdn/shared-84d2d490.js +1 -0
- package/dist/cdn/{shared-df573cea.js → shared-8b20bc23.js} +0 -0
- package/dist/cdn/{shared-3be96355.js → shared-8c8a910c.js} +1 -1
- package/dist/cdn/{shared-b9f18aaa.js → shared-9cd49a3e.js} +4 -4
- package/dist/cdn/{shared-20b9ce70.js → shared-9fc4a896.js} +5 -5
- package/dist/cdn/{shared-bb824ab4.js → shared-a040d79d.js} +2 -2
- package/dist/cdn/{shared-e209cb55.js → shared-ab71552b.js} +1 -1
- package/dist/cdn/{shared-e68b9c83.js → shared-ae8cd227.js} +1 -1
- package/dist/cdn/{shared-07049bfe.js → shared-ba39823e.js} +1 -1
- package/dist/cdn/{shared-ffb27563.js → shared-d58c947c.js} +3 -3
- package/dist/cdn/{shared-a23cf7c8.js → shared-e55088b4.js} +1 -1
- package/dist/cdn/{shared-940a4826.js → shared-ecfd3539.js} +1 -1
- 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/Choice/Choice.js +1 -0
- package/dist/elements/private/Choice/Choice.js.map +1 -1
- package/dist/elements/private/FrequencyInput/FrequencyInput.d.ts +5 -5
- package/dist/elements/private/FrequencyInput/FrequencyInput.js +7 -22
- 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/CouponCard/CouponCard.js +2 -1
- package/dist/elements/public/CouponCard/CouponCard.js.map +1 -1
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js +7 -7
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js.map +1 -1
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js +6 -3
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js +199 -164
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.d.ts +4 -3
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js +5 -4
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js.map +1 -1
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.d.ts +3 -4
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js +3 -4
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js.map +1 -1
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.d.ts +3 -4
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js +3 -2
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js.map +1 -1
- 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 +6 -2
- 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.js +93 -73
- package/dist/elements/public/GenerateCodesForm/GenerateCodesForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +7 -7
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js +8 -3
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js.map +1 -1
- package/dist/elements/public/GiftCardForm/GiftCardForm.js +103 -85
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.d.ts +1 -1
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js +3 -3
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js.map +1 -1
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.d.ts +1 -3
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js +2 -4
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js.map +1 -1
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.d.ts +1 -3
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js +2 -2
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js.map +1 -1
- package/dist/elements/public/I18n/format/discount.js +2 -2
- package/dist/elements/public/I18n/format/discount.js.map +1 -1
- package/dist/elements/public/Pagination/Pagination.js +4 -0
- package/dist/elements/public/Pagination/Pagination.js.map +1 -1
- 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/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/mixins/themeable.js +4 -0
- package/dist/mixins/themeable.js.map +1 -1
- package/dist/mixins/translatable.js +1 -1
- package/dist/mixins/translatable.js.map +1 -1
- package/package.json +3 -3
- package/dist/cdn/shared-11708514.js +0 -1
- package/dist/cdn/shared-805d18a2.js +0 -1
- package/dist/cdn/translations/shared/de.json +0 -271
- package/dist/cdn/translations/shared/en.json +0 -557
- package/dist/cdn/translations/shared/es.json +0 -272
- package/dist/cdn/translations/shared/zh-hk.json +0 -179
|
@@ -9,6 +9,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
9
9
|
this.group = '';
|
|
10
10
|
this.page = 'sign-in';
|
|
11
11
|
this.__renderAccessRecoveryHeader = () => {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
12
13
|
const { lang, ns } = this;
|
|
13
14
|
const formId = '#access-recovery-form';
|
|
14
15
|
const form = this.renderRoot.querySelector(formId);
|
|
@@ -21,7 +22,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
21
22
|
class="text-xxl font-bold ${isBusy ? 'text-disabled' : 'text-body'}"
|
|
22
23
|
lang=${lang}
|
|
23
24
|
key="recover_access"
|
|
24
|
-
ns
|
|
25
|
+
ns="${ns} ${(_b = (_a = customElements.get('foxy-access-recovery-form')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
25
26
|
>
|
|
26
27
|
</foxy-i18n>
|
|
27
28
|
|
|
@@ -29,7 +30,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
29
30
|
class="text-l ${isBusy ? 'text-disabled' : 'text-secondary'}"
|
|
30
31
|
lang=${lang}
|
|
31
32
|
key="recover_access_hint"
|
|
32
|
-
ns
|
|
33
|
+
ns="${ns} ${(_d = (_c = customElements.get('foxy-access-recovery-form')) === null || _c === void 0 ? void 0 : _c.defaultNS) !== null && _d !== void 0 ? _d : ''}"
|
|
33
34
|
>
|
|
34
35
|
</foxy-i18n>
|
|
35
36
|
|
|
@@ -38,6 +39,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
38
39
|
`;
|
|
39
40
|
};
|
|
40
41
|
this.__renderAccessRecoveryBack = () => {
|
|
42
|
+
var _a, _b;
|
|
41
43
|
const formId = '#access-recovery-form';
|
|
42
44
|
const form = this.renderRoot.querySelector(formId);
|
|
43
45
|
const disabledSelector = this.disabledSelector.zoom('access-recovery');
|
|
@@ -52,7 +54,12 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
52
54
|
?disabled=${!!(form === null || form === void 0 ? void 0 : form.in('busy')) || disabledSelector.matches('back', true)}
|
|
53
55
|
@click=${() => (this.page = 'sign-in')}
|
|
54
56
|
>
|
|
55
|
-
<foxy-i18n
|
|
57
|
+
<foxy-i18n
|
|
58
|
+
lang=${this.lang}
|
|
59
|
+
key="back"
|
|
60
|
+
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-access-recovery-form')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
61
|
+
>
|
|
62
|
+
</foxy-i18n>
|
|
56
63
|
</vaadin-button>
|
|
57
64
|
|
|
58
65
|
${this.renderTemplateOrSlot('access-recovery:back:after')}
|
|
@@ -108,6 +115,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
108
115
|
`;
|
|
109
116
|
};
|
|
110
117
|
this.__renderSignInHeader = () => {
|
|
118
|
+
var _a, _b, _c, _d;
|
|
111
119
|
const { lang, ns } = this;
|
|
112
120
|
const formId = '#sign-in-form';
|
|
113
121
|
const form = this.renderRoot.querySelector(formId);
|
|
@@ -120,7 +128,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
120
128
|
class="text-xxl font-bold ${isBusy ? 'text-disabled' : 'text-body'}"
|
|
121
129
|
lang=${lang}
|
|
122
130
|
key="sign_in"
|
|
123
|
-
ns
|
|
131
|
+
ns="${ns} ${(_b = (_a = customElements.get('foxy-sign-in-form')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
124
132
|
>
|
|
125
133
|
</foxy-i18n>
|
|
126
134
|
|
|
@@ -128,7 +136,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
128
136
|
class="text-l ${isBusy ? 'text-disabled' : 'text-secondary'}"
|
|
129
137
|
lang=${lang}
|
|
130
138
|
key="sign_in_hint"
|
|
131
|
-
ns
|
|
139
|
+
ns="${ns} ${(_d = (_c = customElements.get('foxy-sign-in-form')) === null || _c === void 0 ? void 0 : _c.defaultNS) !== null && _d !== void 0 ? _d : ''}"
|
|
132
140
|
>
|
|
133
141
|
</foxy-i18n>
|
|
134
142
|
|
|
@@ -137,6 +145,7 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
137
145
|
`;
|
|
138
146
|
};
|
|
139
147
|
this.__renderSignInRecover = () => {
|
|
148
|
+
var _a, _b;
|
|
140
149
|
const form = this.renderRoot.querySelector('#sign-in-form');
|
|
141
150
|
const disabledSelector = this.disabledSelector.zoom('sign-in');
|
|
142
151
|
return html `
|
|
@@ -150,7 +159,12 @@ export class InternalCustomerPortalLoggedOutView extends Base {
|
|
|
150
159
|
?disabled=${!!(form === null || form === void 0 ? void 0 : form.in('busy')) || disabledSelector.matches('recover', true)}
|
|
151
160
|
@click=${() => (this.page = 'access-recovery')}
|
|
152
161
|
>
|
|
153
|
-
<foxy-i18n
|
|
162
|
+
<foxy-i18n
|
|
163
|
+
lang=${this.lang}
|
|
164
|
+
key="recover_access"
|
|
165
|
+
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-sign-in-form')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
166
|
+
>
|
|
167
|
+
</foxy-i18n>
|
|
154
168
|
</vaadin-button>
|
|
155
169
|
|
|
156
170
|
${this.renderTemplateOrSlot('sign-in:recover:after')}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCustomerPortalLoggedOutView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAoBE,UAAK,GAAG,EAAE,CAAC;QAEX,SAAI,GAAkC,SAAS,CAAC;QAE/B,iCAA4B,GAAG,GAAG,EAAE;YACnD,MAAM,EAAE,IA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AE,CAAC;SAC9B;QAED,OAAO,IAAI,CAAA,EAAE,CAAC;IAChB,CAAC;CACF","sourcesContent":["import {\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\n\nimport { AccessRecoveryForm } from '..';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { SignInForm } from '../SignInForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\n\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(LitElement)));\n\nexport class InternalCustomerPortalLoggedOutView extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n group: { type: String },\n page: { type: String },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .max-w-20rem {\n max-width: 20rem;\n }\n `,\n ];\n }\n\n group = '';\n\n page: 'sign-in' | 'access-recovery' = 'sign-in';\n\n private readonly __renderAccessRecoveryHeader = () => {\n const { lang, ns } = this;\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-m font-lumo\" data-testid=\"access-recovery:header\">\n ${this.renderTemplateOrSlot('access-recovery:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-bold ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"recover_access\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"recover_access_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('access-recovery:header:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryBack = () => {\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const disabledSelector = this.disabledSelector.zoom('access-recovery');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('access-recovery:back:before')}\n\n <vaadin-button\n data-testid=\"access-recovery:back\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('back', true)}\n @click=${() => (this.page = 'sign-in')}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"back\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('access-recovery:back:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryForm = () => {\n const scope = 'access-recovery:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-access-recovery-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"access-recovery:form\"\n parent=\"foxy://customer-api/recover\"\n group=${this.group}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n id=\"access-recovery-form\"\n .templates=${this.getNestedTemplates(scope)}\n @update=${() => this.requestUpdate()}\n >\n </foxy-access-recovery-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderAccessRecovery = () => {\n const scope = 'access-recovery';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"access-recovery\">\n <div class=\"m-auto max-w-20rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-l\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderAccessRecoveryHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderAccessRecoveryForm()}\n ${hiddenSelector.matches('back', true) ? '' : this.__renderAccessRecoveryBack()}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n private readonly __renderSignInHeader = () => {\n const { lang, ns } = this;\n const formId = '#sign-in-form';\n const form = this.renderRoot.querySelector(formId) as SignInForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-m font-lumo\" data-testid=\"sign-in:header\">\n ${this.renderTemplateOrSlot('sign-in:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-bold ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"sign_in\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"sign_in_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('sign-in:header:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInRecover = () => {\n const form = this.renderRoot.querySelector<AccessRecoveryForm>('#sign-in-form');\n const disabledSelector = this.disabledSelector.zoom('sign-in');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-in:recover:before')}\n\n <vaadin-button\n data-testid=\"sign-in:recover\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('recover', true)}\n @click=${() => (this.page = 'access-recovery')}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"recover_access\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-in:recover:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInForm = () => {\n const scope = 'sign-in:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-sign-in-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"sign-in:form\"\n parent=\"foxy://customer-api/session\"\n group=${this.group}\n lang=${this.lang}\n id=\"sign-in-form\"\n ns=\"${this.ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n .templates=${this.getNestedTemplates('sign-in:form')}\n @update=${() => this.requestUpdate()}\n >\n </foxy-sign-in-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSignIn = () => {\n const scope = 'sign-in';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"sign-in\">\n <div class=\"m-auto max-w-20rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-l\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderSignInHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderSignInForm()}\n ${hiddenSelector.matches('recover', true) ? '' : this.__renderSignInRecover()}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { page, hiddenSelector } = this;\n\n if (page === 'access-recovery' && !hiddenSelector.matches('access-recovery', true)) {\n return this.__renderAccessRecovery();\n }\n\n if (page === 'sign-in' && !hiddenSelector.matches('sign-in', true)) {\n return this.__renderSignIn();\n }\n\n return html``;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalCustomerPortalLoggedOutView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,OA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IAjQC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACvB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,KAAK,CAAC,MAAM;YACZ,GAAG;;;OAIF;SACF,CAAC;IACJ,CAAC;IAmOD,MAAM;QACJ,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAEtC,IAAI,IAAI,KAAK,iBAAiB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,EAAE;YAClF,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC;SACtC;QAED,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;YAClE,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;SAC9B;QAED,OAAO,IAAI,CAAA,EAAE,CAAC;IAChB,CAAC;CACF","sourcesContent":["import {\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\n\nimport { AccessRecoveryForm } from '..';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { SignInForm } from '../SignInForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\n\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(LitElement)));\n\nexport class InternalCustomerPortalLoggedOutView extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n group: { type: String },\n page: { type: String },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .max-w-20rem {\n max-width: 20rem;\n }\n `,\n ];\n }\n\n group = '';\n\n page: 'sign-in' | 'access-recovery' = 'sign-in';\n\n private readonly __renderAccessRecoveryHeader = () => {\n const { lang, ns } = this;\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-m font-lumo\" data-testid=\"access-recovery:header\">\n ${this.renderTemplateOrSlot('access-recovery:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-bold ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"recover_access\"\n ns=\"${ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"recover_access_hint\"\n ns=\"${ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('access-recovery:header:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryBack = () => {\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const disabledSelector = this.disabledSelector.zoom('access-recovery');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('access-recovery:back:before')}\n\n <vaadin-button\n data-testid=\"access-recovery:back\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('back', true)}\n @click=${() => (this.page = 'sign-in')}\n >\n <foxy-i18n\n lang=${this.lang}\n key=\"back\"\n ns=\"${this.ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('access-recovery:back:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryForm = () => {\n const scope = 'access-recovery:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-access-recovery-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"access-recovery:form\"\n parent=\"foxy://customer-api/recover\"\n group=${this.group}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n id=\"access-recovery-form\"\n .templates=${this.getNestedTemplates(scope)}\n @update=${() => this.requestUpdate()}\n >\n </foxy-access-recovery-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderAccessRecovery = () => {\n const scope = 'access-recovery';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"access-recovery\">\n <div class=\"m-auto max-w-20rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-l\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderAccessRecoveryHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderAccessRecoveryForm()}\n ${hiddenSelector.matches('back', true) ? '' : this.__renderAccessRecoveryBack()}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n private readonly __renderSignInHeader = () => {\n const { lang, ns } = this;\n const formId = '#sign-in-form';\n const form = this.renderRoot.querySelector(formId) as SignInForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-m font-lumo\" data-testid=\"sign-in:header\">\n ${this.renderTemplateOrSlot('sign-in:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-bold ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"sign_in\"\n ns=\"${ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"sign_in_hint\"\n ns=\"${ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('sign-in:header:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInRecover = () => {\n const form = this.renderRoot.querySelector<AccessRecoveryForm>('#sign-in-form');\n const disabledSelector = this.disabledSelector.zoom('sign-in');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-in:recover:before')}\n\n <vaadin-button\n data-testid=\"sign-in:recover\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('recover', true)}\n @click=${() => (this.page = 'access-recovery')}\n >\n <foxy-i18n\n lang=${this.lang}\n key=\"recover_access\"\n ns=\"${this.ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-in:recover:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInForm = () => {\n const scope = 'sign-in:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-sign-in-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"sign-in:form\"\n parent=\"foxy://customer-api/session\"\n group=${this.group}\n lang=${this.lang}\n id=\"sign-in-form\"\n ns=\"${this.ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n .templates=${this.getNestedTemplates('sign-in:form')}\n @update=${() => this.requestUpdate()}\n >\n </foxy-sign-in-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSignIn = () => {\n const scope = 'sign-in';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"sign-in\">\n <div class=\"m-auto max-w-20rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-l\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderSignInHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderSignInForm()}\n ${hiddenSelector.matches('recover', true) ? '' : this.__renderSignInRecover()}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { page, hiddenSelector } = this;\n\n if (page === 'access-recovery' && !hiddenSelector.matches('access-recovery', true)) {\n return this.__renderAccessRecovery();\n }\n\n if (page === 'sign-in' && !hiddenSelector.matches('sign-in', true)) {\n return this.__renderSignIn();\n }\n\n return html``;\n }\n}\n"]}
|
|
@@ -107,6 +107,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
107
107
|
`;
|
|
108
108
|
};
|
|
109
109
|
this.__renderForm = (ctx) => {
|
|
110
|
+
var _a, _b;
|
|
110
111
|
const templates = { ...ctx.dialog.templates };
|
|
111
112
|
const originalHeaderAfterRenderer = templates['header:after'];
|
|
112
113
|
const originalItemsActionsAfterRenderer = templates['items:actions:after'];
|
|
@@ -137,7 +138,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
137
138
|
group=${ctx.dialog.group}
|
|
138
139
|
lang=${ctx.dialog.lang}
|
|
139
140
|
href=${ctx.dialog.href}
|
|
140
|
-
ns
|
|
141
|
+
ns="${ctx.dialog.ns} ${(_b = (_a = customElements.get('foxy-subscription-form')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
141
142
|
id="form"
|
|
142
143
|
.templates=${templates}
|
|
143
144
|
@update=${ctx.handleUpdate}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalS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AAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,6CAA6C,CAAC,CAAC;YAC5E,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(LitElement)));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n // @ts-expect-error missing typedef in SDK\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${ctx.dialog.hiddenControls.toString()}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=${ctx.dialog.ns}\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-semibold\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAQrF,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;A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kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,6CAA6C,CAAC,CAAC;YAC5E,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(LitElement)));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n // @ts-expect-error missing typedef in SDK\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${ctx.dialog.hiddenControls.toString()}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-semibold\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { NucleonElement } from "../NucleonElement/NucleonElement.js";
|
|
|
4
4
|
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
5
5
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
6
6
|
import { classMap } from "../../../utils/class-map.js";
|
|
7
|
-
const NS = 'generate-codes';
|
|
7
|
+
const NS = 'generate-codes-form';
|
|
8
8
|
const Base = ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS)));
|
|
9
9
|
/**
|
|
10
10
|
* Form element for generating codes for coupons or gift cards (`fx:generate_codes`).
|
|
@@ -80,6 +80,7 @@ export class GenerateCodesForm extends Base {
|
|
|
80
80
|
</div>
|
|
81
81
|
|
|
82
82
|
<div
|
|
83
|
+
data-testid="spinner"
|
|
83
84
|
class=${classMap({
|
|
84
85
|
'absolute inset-0 flex': true,
|
|
85
86
|
[transition]: true,
|
|
@@ -108,121 +109,140 @@ export class GenerateCodesForm extends Base {
|
|
|
108
109
|
__renderLength() {
|
|
109
110
|
const isTemplate = this.in({ idle: 'template' });
|
|
110
111
|
return html `
|
|
111
|
-
|
|
112
|
+
<div>
|
|
113
|
+
${this.renderTemplateOrSlot('length:before')}
|
|
112
114
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
<vaadin-integer-field
|
|
116
|
+
error-message=${this.__getErrorMessage('length')}
|
|
117
|
+
data-testid="length"
|
|
118
|
+
label=${this.t('length')}
|
|
119
|
+
class="w-full"
|
|
120
|
+
min="1"
|
|
121
|
+
?disabled=${!isTemplate || this.disabledSelector.matches('length', true)}
|
|
122
|
+
?readonly=${this.readonlySelector.matches('length', true)}
|
|
123
|
+
prevent-invalid-input
|
|
124
|
+
has-controls
|
|
125
|
+
.checkValidity=${this.__getValidator('length')}
|
|
126
|
+
.value=${isTemplate ? this.form.length : ''}
|
|
127
|
+
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
128
|
+
@change=${(evt) => {
|
|
125
129
|
const field = evt.currentTarget;
|
|
126
130
|
this.edit({ length: parseInt(field.value) });
|
|
127
131
|
}}
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
>
|
|
133
|
+
</vaadin-integer-field>
|
|
130
134
|
|
|
131
|
-
|
|
135
|
+
${this.renderTemplateOrSlot('length:after')}
|
|
136
|
+
</div>
|
|
132
137
|
`;
|
|
133
138
|
}
|
|
134
139
|
__renderNumberOfCodes() {
|
|
135
140
|
const isTemplate = this.in({ idle: 'template' });
|
|
136
141
|
return html `
|
|
137
|
-
|
|
142
|
+
<div>
|
|
143
|
+
${this.renderTemplateOrSlot('number-of-codes:before')}
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
<vaadin-integer-field
|
|
146
|
+
error-message=${this.__getErrorMessage('number_of_codes')}
|
|
147
|
+
data-testid="number-of-codes"
|
|
148
|
+
label=${this.t('number_of_codes')}
|
|
149
|
+
class="w-full"
|
|
150
|
+
min="1"
|
|
151
|
+
?disabled=${!isTemplate || this.disabledSelector.matches('number-of-codes', true)}
|
|
152
|
+
?readonly=${this.readonlySelector.matches('number-of-codes', true)}
|
|
153
|
+
prevent-invalid-input
|
|
154
|
+
has-controls
|
|
155
|
+
.checkValidity=${this.__getValidator('number_of_codes')}
|
|
156
|
+
.value=${isTemplate ? this.form.number_of_codes : ''}
|
|
157
|
+
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
158
|
+
@change=${(evt) => {
|
|
151
159
|
const field = evt.currentTarget;
|
|
152
160
|
this.edit({ number_of_codes: parseInt(field.value) });
|
|
153
161
|
}}
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
>
|
|
163
|
+
</vaadin-integer-field>
|
|
156
164
|
|
|
157
|
-
|
|
165
|
+
${this.renderTemplateOrSlot('number-of-codes:after')}
|
|
166
|
+
</div>
|
|
158
167
|
`;
|
|
159
168
|
}
|
|
160
169
|
__renderCurrentBalance() {
|
|
161
170
|
var _a;
|
|
162
171
|
const isTemplate = this.in({ idle: 'template' });
|
|
163
172
|
return html `
|
|
164
|
-
|
|
173
|
+
<div class="col-span-2">
|
|
174
|
+
${this.renderTemplateOrSlot('current-balance:before')}
|
|
165
175
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
<vaadin-integer-field
|
|
177
|
+
error-message=${this.__getErrorMessage('current_balance')}
|
|
178
|
+
data-testid="current-balance"
|
|
179
|
+
label=${this.t('balance')}
|
|
180
|
+
class="w-full"
|
|
181
|
+
min="0"
|
|
182
|
+
?disabled=${!isTemplate || this.disabledSelector.matches('current-balance', true)}
|
|
183
|
+
?readonly=${this.readonlySelector.matches('current-balance', true)}
|
|
184
|
+
prevent-invalid-input
|
|
185
|
+
has-controls
|
|
186
|
+
.checkValidity=${this.__getValidator('current_balance')}
|
|
187
|
+
.value=${isTemplate ? (_a = this.form.current_balance) !== null && _a !== void 0 ? _a : 0 : ''}
|
|
188
|
+
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
189
|
+
@change=${(evt) => {
|
|
178
190
|
const field = evt.currentTarget;
|
|
179
191
|
this.edit({ current_balance: parseInt(field.value) });
|
|
180
192
|
}}
|
|
181
|
-
|
|
182
|
-
|
|
193
|
+
>
|
|
194
|
+
</vaadin-integer-field>
|
|
183
195
|
|
|
184
|
-
|
|
196
|
+
${this.renderTemplateOrSlot('current-balance:after')}
|
|
197
|
+
</div>
|
|
185
198
|
`;
|
|
186
199
|
}
|
|
187
200
|
__renderPrefix() {
|
|
188
201
|
const isTemplate = this.in({ idle: 'template' });
|
|
189
202
|
return html `
|
|
190
|
-
|
|
203
|
+
<div class="col-span-2">
|
|
204
|
+
${this.renderTemplateOrSlot('prefix:before')}
|
|
191
205
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
206
|
+
<vaadin-text-field
|
|
207
|
+
helper-text=${this.t('leave_empty_for_random_codes')}
|
|
208
|
+
data-testid="prefix"
|
|
209
|
+
label=${this.t('prefix')}
|
|
210
|
+
class="w-full"
|
|
211
|
+
min="1"
|
|
212
|
+
?disabled=${!isTemplate || this.disabledSelector.matches('prefix', true)}
|
|
213
|
+
?readonly=${this.readonlySelector.matches('prefix', true)}
|
|
214
|
+
clear-button-visible
|
|
215
|
+
.value=${isTemplate ? this.form.prefix : ''}
|
|
216
|
+
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
217
|
+
@change=${(evt) => {
|
|
202
218
|
const field = evt.currentTarget;
|
|
203
219
|
this.edit({ prefix: field.value });
|
|
204
220
|
}}
|
|
205
|
-
|
|
206
|
-
|
|
221
|
+
>
|
|
222
|
+
</vaadin-text-field>
|
|
207
223
|
|
|
208
|
-
|
|
224
|
+
${this.renderTemplateOrSlot('prefix:after')}
|
|
225
|
+
</div>
|
|
209
226
|
`;
|
|
210
227
|
}
|
|
211
228
|
__renderGenerate() {
|
|
212
229
|
const isValidTemplate = this.in({ idle: { template: { dirty: 'valid' } } });
|
|
213
230
|
return html `
|
|
214
|
-
|
|
231
|
+
<div class="col-span-2 mt-m">
|
|
232
|
+
${this.renderTemplateOrSlot('generate:before')}
|
|
215
233
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
234
|
+
<vaadin-button
|
|
235
|
+
data-testid="generate"
|
|
236
|
+
class="w-full"
|
|
237
|
+
theme="success primary"
|
|
238
|
+
?disabled=${!isValidTemplate || this.disabledSelector.matches('generate', true)}
|
|
239
|
+
@click=${() => this.submit()}
|
|
240
|
+
>
|
|
241
|
+
<foxy-i18n lang=${this.lang} key="generate" ns=${this.ns}></foxy-i18n>
|
|
242
|
+
</vaadin-button>
|
|
224
243
|
|
|
225
|
-
|
|
244
|
+
${this.renderTemplateOrSlot('generate:after')}
|
|
245
|
+
</div>
|
|
226
246
|
`;
|
|
227
247
|
}
|
|
228
248
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
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A8B,CAAC;gBAC5C,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;;;oBAGZ,CAAC,UAAU,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;oBAC5D,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;;iBAEhD,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;kBACjC,CAAC,GAAgB,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,aAAiC,CAAC;YACpD,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC;;;;QAID,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;KAC5C,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,MAAM,eAAe,GAAG,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE5E,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;;;;;oBAKhC,CAAC,eAAe,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC;iBACtE,IAAI,CAAC,MAAM;;0BAEF,IAAI,CAAC,IAAI,sBAAsB,IAAI,CAAC,EAAE;;;QAGxD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;KAC5C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { IntegerFieldElement } from '@vaadin/vaadin-text-field/vaadin-integer-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'generate-codes';\nconst Base = ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for generating codes for coupons or gift cards (`fx:generate_codes`).\n *\n * @slot length:before\n * @slot length:after\n *\n * @slot number-of-codes:before\n * @slot number-of-codes:after\n *\n * @slot prefix:before\n * @slot prefix:after\n *\n * @slot current-balance:before\n * @slot current-balance:after\n *\n * @slot generate:before\n * @slot generate:after\n *\n * @element foxy-generate-codes-form\n * @since 1.15.0\n */\nexport class GenerateCodesForm extends Base<Data> {\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ number_of_codes: v }) => (v && v > 0) || 'number_of_codes_required',\n ({ current_balance: v }) => !v || v >= 0 || 'current_balance_negative',\n ({ length: v }) => (v && v > 0) || 'length_required',\n ];\n }\n\n templates: Templates = {};\n\n render(): TemplateResult {\n const { hiddenSelector, lang, ns } = this;\n\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n const isSnapshot = this.in({ idle: 'snapshot' });\n const isTemplate = this.in({ idle: 'template' });\n\n const transition = 'transition-opacity duration-500';\n const hidden = 'opacity-0 pointer-events-none';\n\n return html`\n <div aria-busy=${isBusy} aria-live=\"polite\" class=\"relative\">\n <div\n class=${classMap({\n 'grid grid-cols-2 gap-m': true,\n [transition]: true,\n [hidden]: isSnapshot,\n })}\n >\n ${hiddenSelector.matches('length', true) ? '' : this.__renderLength()}\n ${hiddenSelector.matches('number-of-codes', true) ? '' : this.__renderNumberOfCodes()}\n ${hiddenSelector.matches('current-balance', true) ? '' : this.__renderCurrentBalance()}\n ${hiddenSelector.matches('prefix', true) ? '' : this.__renderPrefix()}\n ${hiddenSelector.matches('generate', true) ? '' : this.__renderGenerate()}\n </div>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex flex-col items-center justify-center': true,\n 'text-center text-m text-secondary leading-m': true,\n [transition]: true,\n [hidden]: !isSnapshot,\n })}\n >\n <div class=\"mx-auto flex mb-m w-l h-l rounded-t-l rounded-b-l bg-success\">\n <iron-icon icon=\"icons:done-all\" class=\"m-auto text-success-contrast\"></iron-icon>\n </div>\n\n <foxy-i18n class=\"block\" lang=${lang} key=\"generate_codes_done\" ns=${ns}></foxy-i18n>\n </div>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex': true,\n [transition]: true,\n [hidden]: !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isTemplate ? 'empty' : 'busy'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __getErrorMessage(prefix: string) {\n const error = this.errors.find(err => err.startsWith(prefix));\n return error ? this.t(error.replace(prefix, 'v8n')) : '';\n }\n\n private __getValidator(prefix: string) {\n return () => !this.errors.some(err => err.startsWith(prefix));\n }\n\n private __renderLength() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n ${this.renderTemplateOrSlot('length:before')}\n\n <vaadin-integer-field\n error-message=${this.__getErrorMessage('length')}\n label=${this.t('length')}\n class=\"w-full\"\n min=\"1\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('length', true)}\n ?readonly=${this.readonlySelector.matches('length', true)}\n prevent-invalid-input\n has-controls\n .checkValidity=${this.__getValidator('length')}\n .value=${isTemplate ? this.form.length : ''}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as IntegerFieldElement;\n this.edit({ length: parseInt(field.value) });\n }}\n >\n </vaadin-integer-field>\n\n ${this.renderTemplateOrSlot('length:after')}\n `;\n }\n\n private __renderNumberOfCodes() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n ${this.renderTemplateOrSlot('number-of-codes:before')}\n\n <vaadin-integer-field\n error-message=${this.__getErrorMessage('number_of_codes')}\n label=${this.t('number_of_codes')}\n class=\"w-full\"\n min=\"1\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('number-of-codes', true)}\n ?readonly=${this.readonlySelector.matches('number-of-codes', true)}\n prevent-invalid-input\n has-controls\n .checkValidity=${this.__getValidator('number_of_codes')}\n .value=${isTemplate ? this.form.number_of_codes : ''}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as IntegerFieldElement;\n this.edit({ number_of_codes: parseInt(field.value) });\n }}\n >\n </vaadin-integer-field>\n\n ${this.renderTemplateOrSlot('number-of-codes:after')}\n `;\n }\n\n private __renderCurrentBalance() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n ${this.renderTemplateOrSlot('current-balance:before')}\n\n <vaadin-integer-field\n error-message=${this.__getErrorMessage('current_balance')}\n label=${this.t('balance')}\n class=\"w-full col-span-2\"\n min=\"0\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('current-balance', true)}\n ?readonly=${this.readonlySelector.matches('current-balance', true)}\n prevent-invalid-input\n has-controls\n .checkValidity=${this.__getValidator('current_balance')}\n .value=${isTemplate ? this.form.current_balance ?? 0 : ''}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as IntegerFieldElement;\n this.edit({ current_balance: parseInt(field.value) });\n }}\n >\n </vaadin-integer-field>\n\n ${this.renderTemplateOrSlot('current-balance:after')}\n `;\n }\n\n private __renderPrefix() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n ${this.renderTemplateOrSlot('prefix:before')}\n\n <vaadin-text-field\n helper-text=${this.t('leave_empty_for_random_codes')}\n label=${this.t('prefix')}\n class=\"col-span-2\"\n min=\"1\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('prefix', true)}\n ?readonly=${this.readonlySelector.matches('prefix', true)}\n clear-button-visible\n .value=${isTemplate ? this.form.prefix : ''}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as TextFieldElement;\n this.edit({ prefix: field.value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot('prefix:after')}\n `;\n }\n\n private __renderGenerate() {\n const isValidTemplate = this.in({ idle: { template: { dirty: 'valid' } } });\n\n return html`\n ${this.renderTemplateOrSlot('generate:before')}\n\n <vaadin-button\n class=\"col-span-2\"\n theme=\"success primary\"\n ?disabled=${!isValidTemplate || this.disabledSelector.matches('generate', true)}\n @click=${this.submit}\n >\n <foxy-i18n lang=${this.lang} key=\"generate\" ns=${this.ns}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('create:after')}\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GenerateCodesForm.js","sourceRoot":"","sources":["../../../../src/elements/public/GenerateCodesForm/GenerateCodesForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,iBAAkB,SAAQ,IAAU;IAAjD;;QASE,cAAS,GAAc,EAAE,CAAC;IA6N5B,CAAC;IArOC,MAAM,KAAK,GAAG;QACZ,OAAO;YACL,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,0BAA0B;YACtE,CAAC,EAAE,eA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,aAAiC,CAAC;YACpD,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC;;;;UAID,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,MAAM,eAAe,GAAG,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE5E,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;;;;;;sBAMhC,CAAC,eAAe,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC;mBACtE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE;;4BAEV,IAAI,CAAC,IAAI,sBAAsB,IAAI,CAAC,EAAE;;;UAGxD,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;;KAEhD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { IntegerFieldElement } from '@vaadin/vaadin-text-field/vaadin-integer-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'generate-codes-form';\nconst Base = ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for generating codes for coupons or gift cards (`fx:generate_codes`).\n *\n * @slot length:before\n * @slot length:after\n *\n * @slot number-of-codes:before\n * @slot number-of-codes:after\n *\n * @slot prefix:before\n * @slot prefix:after\n *\n * @slot current-balance:before\n * @slot current-balance:after\n *\n * @slot generate:before\n * @slot generate:after\n *\n * @element foxy-generate-codes-form\n * @since 1.15.0\n */\nexport class GenerateCodesForm extends Base<Data> {\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ number_of_codes: v }) => (v && v > 0) || 'number_of_codes_required',\n ({ current_balance: v }) => !v || v >= 0 || 'current_balance_negative',\n ({ length: v }) => (v && v > 0) || 'length_required',\n ];\n }\n\n templates: Templates = {};\n\n render(): TemplateResult {\n const { hiddenSelector, lang, ns } = this;\n\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n const isSnapshot = this.in({ idle: 'snapshot' });\n const isTemplate = this.in({ idle: 'template' });\n\n const transition = 'transition-opacity duration-500';\n const hidden = 'opacity-0 pointer-events-none';\n\n return html`\n <div aria-busy=${isBusy} aria-live=\"polite\" class=\"relative\">\n <div\n class=${classMap({\n 'grid grid-cols-2 gap-m': true,\n [transition]: true,\n [hidden]: isSnapshot,\n })}\n >\n ${hiddenSelector.matches('length', true) ? '' : this.__renderLength()}\n ${hiddenSelector.matches('number-of-codes', true) ? '' : this.__renderNumberOfCodes()}\n ${hiddenSelector.matches('current-balance', true) ? '' : this.__renderCurrentBalance()}\n ${hiddenSelector.matches('prefix', true) ? '' : this.__renderPrefix()}\n ${hiddenSelector.matches('generate', true) ? '' : this.__renderGenerate()}\n </div>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex flex-col items-center justify-center': true,\n 'text-center text-m text-secondary leading-m': true,\n [transition]: true,\n [hidden]: !isSnapshot,\n })}\n >\n <div class=\"mx-auto flex mb-m w-l h-l rounded-t-l rounded-b-l bg-success\">\n <iron-icon icon=\"icons:done-all\" class=\"m-auto text-success-contrast\"></iron-icon>\n </div>\n\n <foxy-i18n class=\"block\" lang=${lang} key=\"generate_codes_done\" ns=${ns}></foxy-i18n>\n </div>\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'absolute inset-0 flex': true,\n [transition]: true,\n [hidden]: !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isTemplate ? 'empty' : 'busy'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __getErrorMessage(prefix: string) {\n const error = this.errors.find(err => err.startsWith(prefix));\n return error ? this.t(error.replace(prefix, 'v8n')) : '';\n }\n\n private __getValidator(prefix: string) {\n return () => !this.errors.some(err => err.startsWith(prefix));\n }\n\n private __renderLength() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('length:before')}\n\n <vaadin-integer-field\n error-message=${this.__getErrorMessage('length')}\n data-testid=\"length\"\n label=${this.t('length')}\n class=\"w-full\"\n min=\"1\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('length', true)}\n ?readonly=${this.readonlySelector.matches('length', true)}\n prevent-invalid-input\n has-controls\n .checkValidity=${this.__getValidator('length')}\n .value=${isTemplate ? this.form.length : ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as IntegerFieldElement;\n this.edit({ length: parseInt(field.value) });\n }}\n >\n </vaadin-integer-field>\n\n ${this.renderTemplateOrSlot('length:after')}\n </div>\n `;\n }\n\n private __renderNumberOfCodes() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('number-of-codes:before')}\n\n <vaadin-integer-field\n error-message=${this.__getErrorMessage('number_of_codes')}\n data-testid=\"number-of-codes\"\n label=${this.t('number_of_codes')}\n class=\"w-full\"\n min=\"1\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('number-of-codes', true)}\n ?readonly=${this.readonlySelector.matches('number-of-codes', true)}\n prevent-invalid-input\n has-controls\n .checkValidity=${this.__getValidator('number_of_codes')}\n .value=${isTemplate ? this.form.number_of_codes : ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as IntegerFieldElement;\n this.edit({ number_of_codes: parseInt(field.value) });\n }}\n >\n </vaadin-integer-field>\n\n ${this.renderTemplateOrSlot('number-of-codes:after')}\n </div>\n `;\n }\n\n private __renderCurrentBalance() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n <div class=\"col-span-2\">\n ${this.renderTemplateOrSlot('current-balance:before')}\n\n <vaadin-integer-field\n error-message=${this.__getErrorMessage('current_balance')}\n data-testid=\"current-balance\"\n label=${this.t('balance')}\n class=\"w-full\"\n min=\"0\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('current-balance', true)}\n ?readonly=${this.readonlySelector.matches('current-balance', true)}\n prevent-invalid-input\n has-controls\n .checkValidity=${this.__getValidator('current_balance')}\n .value=${isTemplate ? this.form.current_balance ?? 0 : ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as IntegerFieldElement;\n this.edit({ current_balance: parseInt(field.value) });\n }}\n >\n </vaadin-integer-field>\n\n ${this.renderTemplateOrSlot('current-balance:after')}\n </div>\n `;\n }\n\n private __renderPrefix() {\n const isTemplate = this.in({ idle: 'template' });\n\n return html`\n <div class=\"col-span-2\">\n ${this.renderTemplateOrSlot('prefix:before')}\n\n <vaadin-text-field\n helper-text=${this.t('leave_empty_for_random_codes')}\n data-testid=\"prefix\"\n label=${this.t('prefix')}\n class=\"w-full\"\n min=\"1\"\n ?disabled=${!isTemplate || this.disabledSelector.matches('prefix', true)}\n ?readonly=${this.readonlySelector.matches('prefix', true)}\n clear-button-visible\n .value=${isTemplate ? this.form.prefix : ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as TextFieldElement;\n this.edit({ prefix: field.value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot('prefix:after')}\n </div>\n `;\n }\n\n private __renderGenerate() {\n const isValidTemplate = this.in({ idle: { template: { dirty: 'valid' } } });\n\n return html`\n <div class=\"col-span-2 mt-m\">\n ${this.renderTemplateOrSlot('generate:before')}\n\n <vaadin-button\n data-testid=\"generate\"\n class=\"w-full\"\n theme=\"success primary\"\n ?disabled=${!isValidTemplate || this.disabledSelector.matches('generate', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n lang=${this.lang} key=\"generate\" ns=${this.ns}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('generate:after')}\n </div>\n `;\n }\n}\n"]}
|