@foxy.io/elements 1.30.0-beta.6 → 1.31.0-beta.1
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-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.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.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- 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-settings-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/shared-1d4fdfa8.js +1 -0
- package/dist/cdn/shared-cc8b47c6.js +1 -0
- package/dist/cdn/shared-fcbf196e.js +1 -0
- package/dist/cdn/translations/store-card/en.json +3 -1
- package/dist/cdn/translations/store-shipping-method-form/en.json +157 -127
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.d.ts +2 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js +56 -35
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js.map +1 -1
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/types.d.ts +18 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/types.js +2 -0
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/types.js.map +1 -0
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.d.ts +1 -0
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js +4 -0
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js.map +1 -1
- package/dist/elements/internal/InternalPasswordControl/index.d.ts +1 -0
- package/dist/elements/internal/InternalPasswordControl/index.js +1 -0
- package/dist/elements/internal/InternalPasswordControl/index.js.map +1 -1
- package/dist/elements/internal/InternalPasswordControl/vaadinStyles.d.ts +1 -0
- package/dist/elements/internal/InternalPasswordControl/vaadinStyles.js +73 -0
- package/dist/elements/internal/InternalPasswordControl/vaadinStyles.js.map +1 -0
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +7 -5
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
- package/dist/elements/public/StoreCard/StoreCard.js +13 -1
- package/dist/elements/public/StoreCard/StoreCard.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.d.ts +4 -3
- package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js +79 -63
- package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/index.d.ts +2 -1
- package/dist/elements/public/StoreShippingMethodForm/index.js +2 -1
- package/dist/elements/public/StoreShippingMethodForm/index.js.map +1 -1
- package/package.json +13 -2
- package/dist/cdn/shared-40c6b1f6.js +0 -1
- package/dist/cdn/shared-96a392d9.js +0 -1
- package/dist/cdn/shared-b980ba1d.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-6d11abd7.js";import"./shared-73045804.js";import"./shared-e7bff5de.js";import"./shared-a8233033.js";import{I as r}from"./shared-97514fcb.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import{a as o}from"./shared-226dd830.js";import"./shared-49ecea83.js";import{_ as t,B as e}from"./shared-0f6e4584.js";import{i as a}from"./shared-9803aa7c.js";import{h as s,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-25502f01.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-887e1795.js";import"./shared-2bd96ec7.js";import"./shared-3cf043a7.js";import"./shared-61ade33e.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-9637a2de.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-cb3b9d8b.js";import"./shared-fb1dd186.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-c4124870.js";import"./shared-df42c94f.js";import"./shared-471e77dd.js";import"./shared-c5a0cdd7.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-ea5ff8bc.js";import"./foxy-custom-field-card.js";import"./shared-63192750.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-6ac0d05e.js";import"./foxy-payment-card.js";import"./shared-2bf89a21.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-
|
|
1
|
+
import"./shared-6d11abd7.js";import"./shared-73045804.js";import"./shared-e7bff5de.js";import"./shared-a8233033.js";import{I as r}from"./shared-97514fcb.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import{a as o}from"./shared-226dd830.js";import"./shared-49ecea83.js";import{_ as t,B as e}from"./shared-0f6e4584.js";import{i as a}from"./shared-9803aa7c.js";import{h as s,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-25502f01.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-887e1795.js";import"./shared-2bd96ec7.js";import"./shared-3cf043a7.js";import"./shared-61ade33e.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-9637a2de.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-cb3b9d8b.js";import"./shared-fb1dd186.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-c4124870.js";import"./shared-df42c94f.js";import"./shared-471e77dd.js";import"./shared-c5a0cdd7.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-ea5ff8bc.js";import"./foxy-custom-field-card.js";import"./shared-63192750.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-6ac0d05e.js";import"./foxy-payment-card.js";import"./shared-2bf89a21.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-cc8b47c6.js";import"./shared-4a652d60.js";import"./shared-01f18104.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-item-card.js";import"./shared-90706e10.js";import"./foxy-item-form.js";import"./shared-d5ff9121.js";import"./shared-fcbf196e.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./shared-787e8da4.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends o{constructor(){super(...arguments),this.action=null}static get properties(){return t(t({},super.properties),{},{action:{}})}renderControl(){var r,o;const t=this.nucleon;let e;try{const a=new URL(null!==(o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r._links["fx:sub_token_url"].href)&&void 0!==o?o:"");"cancel"===this.action&&a.searchParams.set("sub_cancel","true"),e=a.toString()}catch(r){e=void 0}return s(d||(d=m` <a target="_blank" class="rounded font-medium text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="caption"> </foxy-i18n> </a> `),a(e))}});let c,f,l=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends o{renderControl(){var r,o;return s(c||(c=l` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),i(f||(f=l`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===o?void 0:o.error_message)}});let p,h,u=r=>r;const j=n(r,"admin-subscription-form");class y extends j{get hiddenSelector(){var r,o;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(o=this.data)||void 0===o?void 0:o.is_active)||t.unshift("view-action","cancel-action"),new e(t.join(" ").trim())}get headerSubtitleOptions(){var r;return{context:(null===(r=this.data)||void 0===r?void 0:r.is_active)?"active":"inactive"}}renderHeaderActions(r){return s(p||(p=u` <foxy-internal-admin-subscription-form-load-in-cart-action infer="view-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> <foxy-internal-admin-subscription-form-load-in-cart-action action="cancel" infer="cancel-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> `))}renderBody(){var r,o,t,e,i;let n;try{const t=new URL(null!==(o=null===(r=this.data)||void 0===r?void 0:r._links["fx:transactions"].href)&&void 0!==o?o:"");t.searchParams.set("zoom","items"),n=t.toString()}catch(r){n=void 0}return s(h||(h=u` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),a(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),this.renderTemplateOrSlot(),a(null===(i=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===i?void 0:i["fx:attributes"].href),a(n),super.renderBody())}}customElements.define("foxy-admin-subscription-form",y);export{y as AdminSubscriptionForm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-d5ff9121.js";import"./shared-6d11abd7.js";import"./shared-
|
|
1
|
+
import"./shared-d5ff9121.js";import"./shared-6d11abd7.js";import"./shared-fcbf196e.js";import"./shared-787e8da4.js";import"./shared-e5098b19.js";import"./shared-01f18104.js";import{I as e}from"./shared-97514fcb.js";import"./foxy-applied-coupon-code-card.js";import"./foxy-applied-coupon-code-form.js";import"./foxy-custom-field-card.js";import"./foxy-custom-field-form.js";import"./foxy-template-set-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-49ecea83.js";import{a as t,I as r}from"./shared-226dd830.js";import{_ as o,B as i}from"./shared-0f6e4584.js";import{c as s}from"./shared-4e709717.js";import{h as n,c as a}from"./shared-dc73b9a5.js";import"./shared-9637a2de.js";import{R as l,a as d}from"./shared-25502f01.js";import{i as c}from"./shared-9803aa7c.js";import"./foxy-update-payment-method-form.js";import{U as u}from"./shared-cd96ff03.js";import{s as m}from"./shared-99940888.js";import"./shared-c4124870.js";import{g as p}from"./shared-bab2ea2c.js";import{T as _}from"./shared-63192750.js";import{T as f}from"./shared-8874ec69.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-24d71d01.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-887e1795.js";import"./shared-3cf043a7.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./shared-a0c6a159.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-ff7b2af6.js";import"./shared-651c44fa.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-df42c94f.js";import"./shared-ea5ff8bc.js";import"./shared-51c4a6dd.js";import"./shared-c5a0cdd7.js";import"./shared-471e77dd.js";import"./shared-90706e10.js";import"./shared-73045804.js";import"./shared-ad76e640.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-e7bff5de.js";import"./shared-a8233033.js";import"./shared-cb3b9d8b.js";import"./shared-fb1dd186.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-payment-card-embed.js";import"./shared-8cb35eb4.js";import"./shared-01b2cad8.js";import"./shared-6d645dc5.js";let h,y,v=e=>e;customElements.define("foxy-internal-cart-form-create-session-action",class extends t{constructor(){super(...arguments),this.__loader=null}static get properties(){return o(o({},super.properties),{},{__loader:{attribute:!1}})}renderControl(){var e,t;const r=null===(e=this.__loader)||void 0===e?void 0:e.state,o=null===(t=this.__loader)||void 0===t?void 0:t.result;return o?n(h||(h=v` <a target="_blank" class="rounded font-medium transition-colors text-body focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="state_idle"></foxy-i18n> </a> `),o):n(y||(y=v` <div class="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </div> `),s({"transition-colors font-medium rounded":!0,"text-tertiary":"fail"!==r,"text-error":"fail"===r}),"fail"===r?"state_fail":"state_busy")}updated(e){var t;super.updated(e);const r=this.nucleon,o=null==r?void 0:r.data,i=null!==(t=null==o?void 0:o._links["fx:create_session"].href)&&void 0!==t?t:null;this.__reloadSessionHref(i)}async __reloadSessionHref(e){var t;if(console.log("RELOAD SESSION HREF",e),(null===(t=this.__loader)||void 0===t?void 0:t.href)===e)return;const r=this.nucleon;if(r)if(e){const t={result:null,state:"busy",href:e},o=new r.constructor.API(this);this.__loader=t;try{const r=await o.fetch(e,{method:"POST"});if(!r.ok)throw new Error;t.result=(await r.json()).cart_link,t.state="idle"}catch(e){t.state="fail"}finally{this.requestUpdate()}}else this.__loader=null}});let g;const x=a(g||(g=(e=>e)`
|
|
2
2
|
#dialog{
|
|
3
3
|
width:100dvw;
|
|
4
4
|
max-height:calc(100dvh - var(--lumo-space-m));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-b980ba1d.js";import"./shared-476827c7.js";import"./shared-fae08dfb.js";import{I as t}from"./shared-226dd830.js";import"./foxy-query-builder.js";import{_ as e,B as o}from"./shared-0f6e4584.js";import{O as r,T as s}from"./shared-8874ec69.js";import{c as i}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import"./shared-40c6b1f6.js";import"./shared-787e8da4.js";import"./shared-e7bff5de.js";import"./shared-01f18104.js";import"./shared-a8233033.js";import{I as a}from"./shared-97514fcb.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./shared-49ecea83.js";import{R as l,a as c}from"./shared-25502f01.js";import{i as d}from"./shared-9803aa7c.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-9637a2de.js";import"./shared-bab2ea2c.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-cb3b9d8b.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-fb1dd186.js";import"./shared-9bf7d9a7.js";import"./shared-e7232c2b.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-43e2c3f6.js";import"./shared-3b975a29.js";import"./shared-6f4fa343.js";import"./shared-c5a0cdd7.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-c4124870.js";import"./shared-6d11abd7.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-471e77dd.js";let u,m,p,f,y,_=t=>t;customElements.define("foxy-internal-query-builder-control",class extends t{constructor(){super(...arguments),this.operators=Object.values(r),this.disableOr=!1,this.layout=null}static get properties(){return e(e({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"},layout:{}})}renderControl(){var t;const{label:e,helperText:o,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly,a=null!==(t=this.layout)&&void 0!==t?t:"standalone",l=n(u||(u=_` <foxy-query-builder infer="query-builder" class="${0}" style="${0}" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> `),i({"mt-xs":"summary-item"===a}),"summary-item"===a?"--lumo-border-radius: var(--lumo-border-radius-s)":"",this.operators,this._value,this.disableOr,(t=>{var e;const o=t.currentTarget;this._value=null!==(e=o.value)&&void 0!==e?e:""}));return n(m||(m=_` <section class="${0}"> ${0} ${0} ${0} ${0} ${0} </section> `),i({"grid gap-xs leading-xs transition-colors text-secondary":!0,"hover-text-body":"standalone"===a&&!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),e?n(p||(p=_` <p class="${0}"> ${0} </p> `),i({"text-s font-medium":"standalone"===a,"text-m text-body":"summary-item"===a,hidden:!e}),e):"","standalone"===a?l:"",o?n(f||(f=_`<p class="text-xs">${0}</p>`),o):"",s?n(y||(y=_`<p class="text-xs text-error">${0}</p>`),r):"","summary-item"===a?l:"")}});let h,x,b,j,v,g=t=>t;customElements.define("foxy-internal-coupon-form-rules-control",class extends t{renderControl(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_details)&&void 0!==t?t:"",s=null!==(e=null==o?void 0:o.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",a=this.helperText,l=this.__renderRulesDescription(),c=this._errorMessage;return n(h||(h=g` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),i({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:r,type:s,name:"Rules"},(t=>{const e=t.currentTarget.parsedValue,o=this.nucleon;null==o||o.edit({coupon_discount_details:e.details,coupon_discount_type:e.type})}),a||l?n(x||(x=g` <p class="${0}"> ${0} </p> `),i({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),l||a):"",!c||this.disabled||this.readonly?"":n(b||(b=g`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",s=null!==(e=null==o?void 0:o.form.coupon_discount_details)&&void 0!==e?e:"";return s?this.t("discount_summary",{params:{details:s,type:r,ns:this.ns}}):null}__renderPreset(){const t=this.nucleon,o=null==t?void 0:t.form.coupon_discount_details,r=null==t?void 0:t.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],a=s.find((t=>t.details===o&&t.type===r));return n(j||(j=g` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),i({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),a?this.t("discount_summary",{params:e(e({},a),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(t=>{var e,o;const r=t.currentTarget,i=s[r.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(e=null==i?void 0:i.details)&&void 0!==e?e:"",coupon_discount_type:null!==(o=null==i?void 0:i.type)&&void 0!==o?o:"quantity_amount"})}),s.map((t=>n(v||(v=g` <option value="${0}" ?selected="${0}"> ${0} </option> `),t.details,t===a,this.t("discount_summary",{params:e(e({},t),{},{ns:this.ns})})))),!a&&!!o&&!!r,this.t("custom_discount"))}});let $,w,k=t=>t;const q=l(c(a,"coupon-form"));class R extends q{constructor(){var t;super(...arguments),t=this,this.getTransactionPageHref=null,this.__customerSubscriptionRestrictionsGetValue=()=>{var t;const e=null===(t=this.form.customer_subscription_restrictions)||void 0===t?void 0:t.split(",").map((t=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).map((t=>({value:t})));return null!=e?e:[]},this.__customerSubscriptionRestrictionsSetValue=t=>{this.edit({customer_subscription_restrictions:t.map((({value:t})=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var t;return null===(t=this.form.product_code_restrictions)||void 0===t?void 0:t.split(",").filter((t=>!!t.trim())).map((t=>({value:t,label:t.startsWith("-")?this.t("product-code-restrictions.label_block",{value:t.substring(1)}):this.t("product-code-restrictions.label_allow",{value:t})})))},this.__productCodeRestrictionsSetValue=t=>{this.edit({product_code_restrictions:t.map((({value:t,unit:e})=>"block"===e?`-${t}`:t)).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join(",")})},this.__itemOptionRestrictionsOperators=[r.In],this.__itemOptionRestrictionsGetValue=()=>{var t;const e=new URLSearchParams,o=null!==(t=this.form.item_option_restrictions)&&void 0!==t?t:{};for(const t in o)e.set(`${t}:in`,o[t].join(","));return e.toString()},this.__itemOptionRestrictionsSetValue=t=>{const e=Object.fromEntries(Array.from(new URLSearchParams(t).entries()).map((([t,e])=>[t.replace(":in",""),e.split(",").filter((t=>!!t.trim()))])));this.edit({item_option_restrictions:e})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:s.String},{label:"used_codes",path:"number_of_uses_to_date",type:s.Number},{label:"date_created",path:"date_created",type:s.Date},{label:"date_modified",path:"date_modified",type:s.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(e){t.__couponCodesActions[0].state="busy",t.__couponCodesActions=[...t.__couponCodesActions];try{await navigator.clipboard.writeText(e.code),t.__couponCodesActions[0].state="end"}catch(e){t.__couponCodesActions[0].state="error"}finally{t.__couponCodesActions=[...t.__couponCodesActions],setTimeout((()=>{t.__couponCodesActions[0].state="idle",t.__couponCodesActions=[...t.__couponCodesActions]}),1e3)}}}]}static get properties(){return e(e({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!t||t.length<=50||"name:v8n_too_long",({inclusive_tax_rate:t})=>!t||t>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:t})=>!t||t<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:t})=>!t||t>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:t})=>!!t||"rules:v8n_required",({coupon_discount_details:t})=>!t||t.length<=200||"rules:v8n_too_long",({item_option_restrictions:t})=>!t||JSON.stringify(t).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:t})=>!t||t.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:t})=>!t||t.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:t})=>!t||t>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:t})=>!t||t.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:t})=>!t||t>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const t=[super.hiddenSelector.toString()];return this.data||t.push("coupon-codes","category-restrictions","attributes"),new o(t.join(" ").trim())}get headerSubtitleOptions(){return e(e({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(t){return n($||($=k` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),t._links["fx:generate_codes"].href,[t._links["fx:coupon_codes"].href],t._links["fx:coupon_codes"].href,[t._links["fx:coupon_codes"].href],super.renderHeaderActions(t))}renderBody(){var t,e,o,r,s,i,a,l;let c;try{const o=new URL(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:coupon_codes"].href)&&void 0!==e?e:"");o.searchParams.set("order","date_created desc"),c=o.toString()}catch(t){c=void 0}return n(w||(w=k` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-query-builder-control infer="item-option-restrictions" disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-summary-control infer="customer-restrictions"> <foxy-internal-query-builder-control layout="summary-item" infer="customer-attribute-restrictions"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control layout="summary-item" infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),c,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],this.__itemOptionRestrictionsOperators,this.__itemOptionRestrictionsGetValue,this.__itemOptionRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,d(null===(o=this.data)||void 0===o?void 0:o._links.self.href),d(null===(s=null===(r=this.__storeLoader)||void 0===r?void 0:r.data)||void 0===s?void 0:s._links["fx:item_categories"].href),d(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),d(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),d(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",R);export{R as CouponForm};
|
|
1
|
+
import"./shared-1d4fdfa8.js";import"./shared-476827c7.js";import"./shared-fae08dfb.js";import{I as t}from"./shared-226dd830.js";import"./foxy-query-builder.js";import{_ as e,B as o}from"./shared-0f6e4584.js";import{O as r,T as s}from"./shared-8874ec69.js";import{c as i}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import"./shared-fcbf196e.js";import"./shared-787e8da4.js";import"./shared-e7bff5de.js";import"./shared-01f18104.js";import"./shared-a8233033.js";import{I as a}from"./shared-97514fcb.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./shared-49ecea83.js";import{R as l,a as c}from"./shared-25502f01.js";import{i as d}from"./shared-9803aa7c.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-9637a2de.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-cb3b9d8b.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-fb1dd186.js";import"./shared-9bf7d9a7.js";import"./shared-e7232c2b.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-43e2c3f6.js";import"./shared-bab2ea2c.js";import"./shared-3b975a29.js";import"./shared-6f4fa343.js";import"./shared-c5a0cdd7.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-c4124870.js";import"./shared-6d11abd7.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-471e77dd.js";let u,m,p,f,y,_=t=>t;customElements.define("foxy-internal-query-builder-control",class extends t{constructor(){super(...arguments),this.operators=Object.values(r),this.disableOr=!1,this.layout=null}static get properties(){return e(e({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"},layout:{}})}renderControl(){var t;const{label:e,helperText:o,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly,a=null!==(t=this.layout)&&void 0!==t?t:"standalone",l=n(u||(u=_` <foxy-query-builder infer="query-builder" class="${0}" style="${0}" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> `),i({"mt-xs":"summary-item"===a}),"summary-item"===a?"--lumo-border-radius: var(--lumo-border-radius-s)":"",this.operators,this._value,this.disableOr,(t=>{var e;const o=t.currentTarget;this._value=null!==(e=o.value)&&void 0!==e?e:""}));return n(m||(m=_` <section class="${0}"> ${0} ${0} ${0} ${0} ${0} </section> `),i({"grid gap-xs leading-xs transition-colors text-secondary":!0,"hover-text-body":"standalone"===a&&!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),e?n(p||(p=_` <p class="${0}"> ${0} </p> `),i({"text-s font-medium":"standalone"===a,"text-m text-body":"summary-item"===a,hidden:!e}),e):"","standalone"===a?l:"",o?n(f||(f=_`<p class="text-xs">${0}</p>`),o):"",s?n(y||(y=_`<p class="text-xs text-error">${0}</p>`),r):"","summary-item"===a?l:"")}});let h,x,b,j,v,g=t=>t;customElements.define("foxy-internal-coupon-form-rules-control",class extends t{renderControl(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_details)&&void 0!==t?t:"",s=null!==(e=null==o?void 0:o.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",a=this.helperText,l=this.__renderRulesDescription(),c=this._errorMessage;return n(h||(h=g` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),i({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:r,type:s,name:"Rules"},(t=>{const e=t.currentTarget.parsedValue,o=this.nucleon;null==o||o.edit({coupon_discount_details:e.details,coupon_discount_type:e.type})}),a||l?n(x||(x=g` <p class="${0}"> ${0} </p> `),i({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),l||a):"",!c||this.disabled||this.readonly?"":n(b||(b=g`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",s=null!==(e=null==o?void 0:o.form.coupon_discount_details)&&void 0!==e?e:"";return s?this.t("discount_summary",{params:{details:s,type:r,ns:this.ns}}):null}__renderPreset(){const t=this.nucleon,o=null==t?void 0:t.form.coupon_discount_details,r=null==t?void 0:t.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],a=s.find((t=>t.details===o&&t.type===r));return n(j||(j=g` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),i({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),a?this.t("discount_summary",{params:e(e({},a),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(t=>{var e,o;const r=t.currentTarget,i=s[r.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(e=null==i?void 0:i.details)&&void 0!==e?e:"",coupon_discount_type:null!==(o=null==i?void 0:i.type)&&void 0!==o?o:"quantity_amount"})}),s.map((t=>n(v||(v=g` <option value="${0}" ?selected="${0}"> ${0} </option> `),t.details,t===a,this.t("discount_summary",{params:e(e({},t),{},{ns:this.ns})})))),!a&&!!o&&!!r,this.t("custom_discount"))}});let $,w,k=t=>t;const q=l(c(a,"coupon-form"));class R extends q{constructor(){var t;super(...arguments),t=this,this.getTransactionPageHref=null,this.__customerSubscriptionRestrictionsGetValue=()=>{var t;const e=null===(t=this.form.customer_subscription_restrictions)||void 0===t?void 0:t.split(",").map((t=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).map((t=>({value:t})));return null!=e?e:[]},this.__customerSubscriptionRestrictionsSetValue=t=>{this.edit({customer_subscription_restrictions:t.map((({value:t})=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var t;return null===(t=this.form.product_code_restrictions)||void 0===t?void 0:t.split(",").filter((t=>!!t.trim())).map((t=>({value:t,label:t.startsWith("-")?this.t("product-code-restrictions.label_block",{value:t.substring(1)}):this.t("product-code-restrictions.label_allow",{value:t})})))},this.__productCodeRestrictionsSetValue=t=>{this.edit({product_code_restrictions:t.map((({value:t,unit:e})=>"block"===e?`-${t}`:t)).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join(",")})},this.__itemOptionRestrictionsOperators=[r.In],this.__itemOptionRestrictionsGetValue=()=>{var t;const e=new URLSearchParams,o=null!==(t=this.form.item_option_restrictions)&&void 0!==t?t:{};for(const t in o)e.set(`${t}:in`,o[t].join(","));return e.toString()},this.__itemOptionRestrictionsSetValue=t=>{const e=Object.fromEntries(Array.from(new URLSearchParams(t).entries()).map((([t,e])=>[t.replace(":in",""),e.split(",").filter((t=>!!t.trim()))])));this.edit({item_option_restrictions:e})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:s.String},{label:"used_codes",path:"number_of_uses_to_date",type:s.Number},{label:"date_created",path:"date_created",type:s.Date},{label:"date_modified",path:"date_modified",type:s.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(e){t.__couponCodesActions[0].state="busy",t.__couponCodesActions=[...t.__couponCodesActions];try{await navigator.clipboard.writeText(e.code),t.__couponCodesActions[0].state="end"}catch(e){t.__couponCodesActions[0].state="error"}finally{t.__couponCodesActions=[...t.__couponCodesActions],setTimeout((()=>{t.__couponCodesActions[0].state="idle",t.__couponCodesActions=[...t.__couponCodesActions]}),1e3)}}}]}static get properties(){return e(e({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!t||t.length<=50||"name:v8n_too_long",({inclusive_tax_rate:t})=>!t||t>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:t})=>!t||t<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:t})=>!t||t>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:t})=>!!t||"rules:v8n_required",({coupon_discount_details:t})=>!t||t.length<=200||"rules:v8n_too_long",({item_option_restrictions:t})=>!t||JSON.stringify(t).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:t})=>!t||t.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:t})=>!t||t.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:t})=>!t||t>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:t})=>!t||t.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:t})=>!t||t>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const t=[super.hiddenSelector.toString()];return this.data||t.push("coupon-codes","category-restrictions","attributes"),new o(t.join(" ").trim())}get headerSubtitleOptions(){return e(e({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(t){return n($||($=k` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),t._links["fx:generate_codes"].href,[t._links["fx:coupon_codes"].href],t._links["fx:coupon_codes"].href,[t._links["fx:coupon_codes"].href],super.renderHeaderActions(t))}renderBody(){var t,e,o,r,s,i,a,l;let c;try{const o=new URL(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:coupon_codes"].href)&&void 0!==e?e:"");o.searchParams.set("order","date_created desc"),c=o.toString()}catch(t){c=void 0}return n(w||(w=k` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-query-builder-control infer="item-option-restrictions" disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-summary-control infer="customer-restrictions"> <foxy-internal-query-builder-control layout="summary-item" infer="customer-attribute-restrictions"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control layout="summary-item" infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),c,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],this.__itemOptionRestrictionsOperators,this.__itemOptionRestrictionsGetValue,this.__itemOptionRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,d(null===(o=this.data)||void 0===o?void 0:o._links.self.href),d(null===(s=null===(r=this.__storeLoader)||void 0===r?void 0:r.data)||void 0===s?void 0:s._links["fx:item_categories"].href),d(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),d(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),d(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",R);export{R as CouponForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-471e77dd.js";import"./shared-96a392d9.js";import"./shared-01f18104.js";import{I as t}from"./shared-97514fcb.js";import{a as e}from"./shared-226dd830.js";import"./shared-49ecea83.js";import{i as s}from"./shared-9803aa7c.js";import{h as o}from"./shared-dc73b9a5.js";import{c as r,_ as a,B as i}from"./shared-0f6e4584.js";import{S as n,a as d}from"./shared-25502f01.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-4a652d60.js";import"./shared-ff7b2af6.js";import"./shared-19f46691.js";import"./shared-0f00d4d8.js";import"./shared-22ba9566.js";import"./shared-9637a2de.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-51c4a6dd.js";!function(){function t(t,e,s){if(null!=s){const o=t.includes("?")?"&":"?";return t+o+e+"="+encodeURIComponent(s)}return t}class e extends Error{constructor(t){super(`[hcaptcha-web-component]: ${t}`),Object.setPrototypeOf(this,e.prototype)}}class s extends HTMLElement{connectedCallback(){(function(e){if(window._hCaptchaOnLoadPromise)return window._hCaptchaOnLoadPromise;if(window.hcaptcha)return console.warn("[vanilla-hcaptcha] hCaptcha JS API detected to be externally loaded. Unless you know what are you doing, this task should be delegated to this web component."),window._hCaptchaOnLoadPromise=Promise.resolve(),window._hCaptchaOnLoadPromise;{let s,o;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,o=e})),window._hCaptchaOnLoad=s;const r=function(e){let s=e.jsapi;return s=t(s,"render","explicit"),s=t(s,"onload","_hCaptchaOnLoad"),s=t(s,"recaptchacompat",!1===e.reCaptchaCompat?"off":null),s=t(s,"host",e.host),s=t(s,"hl",e.hl),s=t(s,"sentry",JSON.stringify(e.sentry)),s=t(s,"endpoint",e.endpoint),s=t(s,"assethost",e.assethost),s=t(s,"imghost",e.imghost),s=t(s,"reportapi",e.reportapi),s}(e),a=document.createElement("script");return a.src=r,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${r}"`;console.error(e,t),o(e)},document.head.appendChild(a),window._hCaptchaOnLoadPromise}})({host:this.getAttribute("host"),hl:this.getAttribute("hl"),sentry:"false"!==this.getAttribute("sentry"),reCaptchaCompat:"false"===this.getAttribute("reCaptchaCompat"),jsapi:this.getAttribute("jsapi")||"https://js.hcaptcha.com/1/api.js",endpoint:this.getAttribute("endpoint"),reportapi:this.getAttribute("reportapi"),assethost:this.getAttribute("assethost"),imghost:this.getAttribute("imghost")}).then(this.onApiLoaded.bind(this)).catch(this.onError.bind(this))}onApiLoaded(){this.$emit("loaded");const t="false"!==this.getAttribute("auto-render"),e={sitekey:this.getAttribute("sitekey")||this.getAttribute("site-key"),theme:this.getAttribute("theme"),size:this.getAttribute("size"),hl:this.getAttribute("hl"),tplinks:"off"===this.getAttribute("tplinks")?"off":"on",tabindex:parseInt(this.getAttribute("tabindex")),custom:"true"===this.getAttribute("custom")},s=this.getAttribute("challenge-container");s&&(e["challenge-container"]=s);const o=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(o))}assertApiLoaded(t){if(!hcaptcha)throw new e(`hCaptcha JS API was not loaded yet. Please wait for \`loaded\` event to safely call "${t}".`)}assertRendered(){if(!this.hcaptchaId)throw new e('hCaptcha was not yet rendered. Please call "render()" first.')}onError(t){console.error(t),this.$emit("error",{error:t})}$emit(t,e){let s;"function"==typeof Event?s=new Event(t):(s=document.createEvent("Event"),s.initEvent(t,!1,!1)),e&&Object.assign(s,e),this.dispatchEvent(s)}render(t){this.assertApiLoaded("render"),this.hcaptchaId?console.warn("hCaptcha was already rendered. You may want to call 'reset()' first."):this.hcaptchaId=hcaptcha.render(this,Object.assign(Object.assign({},t),{callback:()=>{const t=hcaptcha.getResponse(this.hcaptchaId),e=hcaptcha.getRespKey(this.hcaptchaId);this.$emit("verified",{token:t,eKey:e,key:t})},"expired-callback":()=>{this.$emit("expired")},"chalexpired-callback":()=>{this.$emit("challenge-expired")},"error-callback":this.onError.bind(this),"open-callback":()=>{this.$emit("opened")},"close-callback":()=>{this.$emit("closed")}}))}setData(t){this.assertRendered(),hcaptcha.setData(this.hcaptchaId,{rqdata:t})}execute(){this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId)}executeAsync(){return this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId,{async:!0})}reset(){this.assertApiLoaded("reset"),this.assertRendered(),hcaptcha.reset(this.hcaptchaId)}}customElements.define("h-captcha",s)}();let c,p=t=>t;customElements.define("foxy-internal-customer-form-legal-notice-control",class extends e{renderControl(){var t,e;const r=this.nucleon;return o(c||(c=p` <p class="leading-s text-xs text-secondary"> <foxy-i18n infer="" key="text"></foxy-i18n> <a class="font-medium text-body rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" target="_blank" href="${0}" rel="noopener noreferrer"> <foxy-i18n infer="" key="link"></foxy-i18n> </a> </p> `),s(null===(e=null===(t=null==r?void 0:r.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=r((function(t){!function(){const e=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],s=(t,s=e,o="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";s[0].minDiversity=0,s[0].minLength=0;const a=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&a.push({regex:`[${o}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(r))).map((t=>t.message)),i.length=r.length;let n=s.filter((t=>i.contains.length>=t.minDiversity)).filter((t=>i.length>=t.minLength)).sort(((t,e)=>e.id-t.id)).map((t=>({id:t.id,value:t.value})));return Object.assign(i,n[0]),i};t.exports={passwordStrength:s,defaultOptions:e}}()}));let u,f,g=t=>t;const _=n(d(t,"customer-form")),y=m.passwordStrength;class x extends _{constructor(){super(...arguments),this.passwordless=!1,this.settings=null,this.__isAnonymousGetValue=()=>{var t;return!1===(null===(t=this.form)||void 0===t?void 0:t.is_anonymous)?"false":"true"},this.__isAnonymousSetValue=t=>{const e="true"===t;this.edit({is_anonymous:e}),e&&this.form.password&&this.edit({password:""}),e&&this.form.password_old&&this.edit({password_old:""}),e&&this.form.forgot_password&&this.edit({forgot_password:""})},this.__isAnonymousOptions=[{value:"true",label:"option_true"},{value:"false",label:"option_false"}],this.__refreshInterval=null}static get scopedElements(){return{"foxy-internal-customer-form-legal-notice-control":customElements.get("foxy-internal-customer-form-legal-notice-control"),"foxy-internal-radio-group-control":customElements.get("foxy-internal-radio-group-control"),"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-password-control":customElements.get("foxy-internal-password-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"h-captcha":customElements.get("h-captcha"),"vaadin-button":customElements.get("vaadin-button")}}static get properties(){return a(a({},super.properties),{},{passwordless:{type:Boolean},settings:{type:Object}})}static get v8n(){return[({password:t,_links:e,is_anonymous:s=!0},o)=>!!o.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},o)=>{var r;return!s||(void 0===(null===(r=o.settings)||void 0===r?void 0:r.sign_up)||(!(e&&!t)||"password-old:v8n_required"))},({first_name:t})=>!t||t.length<=50||"first-name:v8n_too_long",({last_name:t})=>!t||t.length<=50||"last-name:v8n_too_long",({password:t})=>!t||y(t).id>=2||"password:v8n_too_weak",({password:t})=>!t||t.length<=50||"password:v8n_too_long",({tax_id:t})=>!t||t.length<=50||"tax-id:v8n_too_long",({email:t})=>t&&t.length>0||"email:v8n_required",({email:t})=>!t||t.length<=100||"email:v8n_too_long",({email:t})=>!t||l(t)||"email:v8n_invalid_email"]}get hiddenSelector(){const t=new Set(super.hiddenSelector.toString().split(" "));return this.settings?(t.add("forgot-password"),t.add("is-anonymous"),this.form.password||t.add("password-old"),"none"===this.settings.tos_checkbox_settings.usage&&t.add("legal-notice")):(!1!==this.form.is_anonymous&&(t.add("forgot-password"),t.add("password")),t.add("password-old"),t.add("legal-notice")),this.href&&(t.add("is-anonymous"),t.add("legal-notice")),new i(Array.from(t).join(" ").trim())}get headerTitleOptions(){const t=this.data;return!t||t.first_name.trim()||t.last_name.trim()?super.headerTitleOptions:a(a({},super.headerTitleOptions),{},{context:"no_name"})}get headerSubtitleKey(){var t;return(null===(t=this.data)||void 0===t?void 0:t.is_anonymous)?"subtitle_anonymous":"subtitle_registered"}get headerSubtitleOptions(){return a(a({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}disconnectedCallback(){super.disconnectedCallback();const t=this.__refreshInterval;t&&clearInterval(t)}connectedCallback(){super.connectedCallback();const t=setInterval((()=>this.requestUpdate()),6e4);this.__refreshInterval=t}renderBody(){var t,e,s,r;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return o(u||(u=g` ${0} <div class="${0}"> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> </div> <foxy-internal-text-control helper-text="${0}" infer="email"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="is-anonymous" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-password-control placeholder="${0}" helper-text="${0}" infer="password" show-generator> </foxy-internal-password-control> <foxy-internal-password-control infer="password-old"></foxy-internal-password-control> <foxy-internal-password-control helper-text="${0}" infer="forgot-password" show-generator> </foxy-internal-password-control> <foxy-internal-text-control infer="tax-id"></foxy-internal-text-control> <foxy-internal-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),this.renderHeader(),h({"grid-cols-2":!a&&!i,hidden:a&&i,"gap-m":!0,grid:!a||!i}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__forgotPasswordHelperText,!this.data&&(null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.enabled)&&"hcaptcha"===(null===(r=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===r?void 0:r.verification.type)?o(f||(f=g` <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> `),this.settings.sign_up.verification.site_key,this.lang,(({token:t})=>{this.edit({verification:{type:"hcaptcha",token:t}}),super.submit()})):"",super.renderBody())}submit(){var t,e,s,o,r;"hcaptcha"!==(null===(s=null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.verification)||void 0===s?void 0:s.type)||this.data?super.submit():(null===(o=this.__hcaptcha)||void 0===o||o.reset(),null===(r=this.__hcaptcha)||void 0===r||r.execute())}async _sendPatch(t){const e=await super._sendPatch(t);if(t.password){const t={key:"password_change_success",options:{email:e.email}};this.status=t}return e}async _sendGet(){return this.status=null,await super._sendGet()}async _fetch(...t){try{return await super._fetch(...t)}catch(t){let e;try{e=(await t.json())._embedded["fx:errors"][0].message}catch(e){throw t}throw"Conflict"===e||e.startsWith("This email address is already in use")?["error:email_already_used"]:e.startsWith("Customer registration is disabled")?["error:registration_disabled"]:e.startsWith("Client verification failed")?["error:verification_failed"]:e.startsWith("Provided password is incorrect")?["error:old_password_incorrect"]:t}}get __forgotPasswordHelperText(){var t,e;const s=null===(t=this.data)||void 0===t?void 0:t.forgot_password_timestamp,o="forgot-password.helper_text";if((null===(e=this.data)||void 0===e?void 0:e.forgot_password)&&s){const t=new Date(new Date(s).getTime()+18e5),e=Math.floor((t.getTime()-Date.now())/1e3/60);return e<=0?this.t(`${o}_expired_on`,{expiresOn:t}):this.t(`${o}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(o)}get __passwordPlaceholder(){return this.data?this.t("password.placeholder_new"):this.t("password.placeholder")}get __passwordHelperText(){return this.data?this.t("password.helper_text_new"):this.t("password.helper_text")}get __emailHelperText(){var t;return(null===(t=this.data)||void 0===t?void 0:t.last_login_date)?this.t("email.helper_text_last_login_date",{date:this.data.last_login_date}):this.t("email.helper_text")}get __hcaptcha(){return this.renderRoot.querySelector("h-captcha")}}customElements.define("foxy-customer-form",x);export{x as CustomerForm};
|
|
1
|
+
import"./shared-471e77dd.js";import"./shared-cc8b47c6.js";import"./shared-01f18104.js";import{I as t}from"./shared-97514fcb.js";import{a as e}from"./shared-226dd830.js";import"./shared-49ecea83.js";import{i as s}from"./shared-9803aa7c.js";import{h as o}from"./shared-dc73b9a5.js";import{c as r,_ as a,B as i}from"./shared-0f6e4584.js";import{S as n,a as d}from"./shared-25502f01.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-4a652d60.js";import"./shared-ff7b2af6.js";import"./shared-19f46691.js";import"./shared-0f00d4d8.js";import"./shared-22ba9566.js";import"./shared-9637a2de.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-51c4a6dd.js";!function(){function t(t,e,s){if(null!=s){const o=t.includes("?")?"&":"?";return t+o+e+"="+encodeURIComponent(s)}return t}class e extends Error{constructor(t){super(`[hcaptcha-web-component]: ${t}`),Object.setPrototypeOf(this,e.prototype)}}class s extends HTMLElement{connectedCallback(){(function(e){if(window._hCaptchaOnLoadPromise)return window._hCaptchaOnLoadPromise;if(window.hcaptcha)return console.warn("[vanilla-hcaptcha] hCaptcha JS API detected to be externally loaded. Unless you know what are you doing, this task should be delegated to this web component."),window._hCaptchaOnLoadPromise=Promise.resolve(),window._hCaptchaOnLoadPromise;{let s,o;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,o=e})),window._hCaptchaOnLoad=s;const r=function(e){let s=e.jsapi;return s=t(s,"render","explicit"),s=t(s,"onload","_hCaptchaOnLoad"),s=t(s,"recaptchacompat",!1===e.reCaptchaCompat?"off":null),s=t(s,"host",e.host),s=t(s,"hl",e.hl),s=t(s,"sentry",JSON.stringify(e.sentry)),s=t(s,"endpoint",e.endpoint),s=t(s,"assethost",e.assethost),s=t(s,"imghost",e.imghost),s=t(s,"reportapi",e.reportapi),s}(e),a=document.createElement("script");return a.src=r,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${r}"`;console.error(e,t),o(e)},document.head.appendChild(a),window._hCaptchaOnLoadPromise}})({host:this.getAttribute("host"),hl:this.getAttribute("hl"),sentry:"false"!==this.getAttribute("sentry"),reCaptchaCompat:"false"===this.getAttribute("reCaptchaCompat"),jsapi:this.getAttribute("jsapi")||"https://js.hcaptcha.com/1/api.js",endpoint:this.getAttribute("endpoint"),reportapi:this.getAttribute("reportapi"),assethost:this.getAttribute("assethost"),imghost:this.getAttribute("imghost")}).then(this.onApiLoaded.bind(this)).catch(this.onError.bind(this))}onApiLoaded(){this.$emit("loaded");const t="false"!==this.getAttribute("auto-render"),e={sitekey:this.getAttribute("sitekey")||this.getAttribute("site-key"),theme:this.getAttribute("theme"),size:this.getAttribute("size"),hl:this.getAttribute("hl"),tplinks:"off"===this.getAttribute("tplinks")?"off":"on",tabindex:parseInt(this.getAttribute("tabindex")),custom:"true"===this.getAttribute("custom")},s=this.getAttribute("challenge-container");s&&(e["challenge-container"]=s);const o=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(o))}assertApiLoaded(t){if(!hcaptcha)throw new e(`hCaptcha JS API was not loaded yet. Please wait for \`loaded\` event to safely call "${t}".`)}assertRendered(){if(!this.hcaptchaId)throw new e('hCaptcha was not yet rendered. Please call "render()" first.')}onError(t){console.error(t),this.$emit("error",{error:t})}$emit(t,e){let s;"function"==typeof Event?s=new Event(t):(s=document.createEvent("Event"),s.initEvent(t,!1,!1)),e&&Object.assign(s,e),this.dispatchEvent(s)}render(t){this.assertApiLoaded("render"),this.hcaptchaId?console.warn("hCaptcha was already rendered. You may want to call 'reset()' first."):this.hcaptchaId=hcaptcha.render(this,Object.assign(Object.assign({},t),{callback:()=>{const t=hcaptcha.getResponse(this.hcaptchaId),e=hcaptcha.getRespKey(this.hcaptchaId);this.$emit("verified",{token:t,eKey:e,key:t})},"expired-callback":()=>{this.$emit("expired")},"chalexpired-callback":()=>{this.$emit("challenge-expired")},"error-callback":this.onError.bind(this),"open-callback":()=>{this.$emit("opened")},"close-callback":()=>{this.$emit("closed")}}))}setData(t){this.assertRendered(),hcaptcha.setData(this.hcaptchaId,{rqdata:t})}execute(){this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId)}executeAsync(){return this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId,{async:!0})}reset(){this.assertApiLoaded("reset"),this.assertRendered(),hcaptcha.reset(this.hcaptchaId)}}customElements.define("h-captcha",s)}();let c,p=t=>t;customElements.define("foxy-internal-customer-form-legal-notice-control",class extends e{renderControl(){var t,e;const r=this.nucleon;return o(c||(c=p` <p class="leading-s text-xs text-secondary"> <foxy-i18n infer="" key="text"></foxy-i18n> <a class="font-medium text-body rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" target="_blank" href="${0}" rel="noopener noreferrer"> <foxy-i18n infer="" key="link"></foxy-i18n> </a> </p> `),s(null===(e=null===(t=null==r?void 0:r.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=r((function(t){!function(){const e=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],s=(t,s=e,o="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";s[0].minDiversity=0,s[0].minLength=0;const a=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&a.push({regex:`[${o}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(r))).map((t=>t.message)),i.length=r.length;let n=s.filter((t=>i.contains.length>=t.minDiversity)).filter((t=>i.length>=t.minLength)).sort(((t,e)=>e.id-t.id)).map((t=>({id:t.id,value:t.value})));return Object.assign(i,n[0]),i};t.exports={passwordStrength:s,defaultOptions:e}}()}));let u,f,g=t=>t;const _=n(d(t,"customer-form")),y=m.passwordStrength;class x extends _{constructor(){super(...arguments),this.passwordless=!1,this.settings=null,this.__isAnonymousGetValue=()=>{var t;return!1===(null===(t=this.form)||void 0===t?void 0:t.is_anonymous)?"false":"true"},this.__isAnonymousSetValue=t=>{const e="true"===t;this.edit({is_anonymous:e}),e&&this.form.password&&this.edit({password:""}),e&&this.form.password_old&&this.edit({password_old:""}),e&&this.form.forgot_password&&this.edit({forgot_password:""})},this.__isAnonymousOptions=[{value:"true",label:"option_true"},{value:"false",label:"option_false"}],this.__refreshInterval=null}static get scopedElements(){return{"foxy-internal-customer-form-legal-notice-control":customElements.get("foxy-internal-customer-form-legal-notice-control"),"foxy-internal-radio-group-control":customElements.get("foxy-internal-radio-group-control"),"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-password-control":customElements.get("foxy-internal-password-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"h-captcha":customElements.get("h-captcha"),"vaadin-button":customElements.get("vaadin-button")}}static get properties(){return a(a({},super.properties),{},{passwordless:{type:Boolean},settings:{type:Object}})}static get v8n(){return[({password:t,_links:e,is_anonymous:s=!0},o)=>!!o.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},o)=>{var r;return!s||(void 0===(null===(r=o.settings)||void 0===r?void 0:r.sign_up)||(!(e&&!t)||"password-old:v8n_required"))},({first_name:t})=>!t||t.length<=50||"first-name:v8n_too_long",({last_name:t})=>!t||t.length<=50||"last-name:v8n_too_long",({password:t})=>!t||y(t).id>=2||"password:v8n_too_weak",({password:t})=>!t||t.length<=50||"password:v8n_too_long",({tax_id:t})=>!t||t.length<=50||"tax-id:v8n_too_long",({email:t})=>t&&t.length>0||"email:v8n_required",({email:t})=>!t||t.length<=100||"email:v8n_too_long",({email:t})=>!t||l(t)||"email:v8n_invalid_email"]}get hiddenSelector(){const t=new Set(super.hiddenSelector.toString().split(" "));return this.settings?(t.add("forgot-password"),t.add("is-anonymous"),this.form.password||t.add("password-old"),"none"===this.settings.tos_checkbox_settings.usage&&t.add("legal-notice")):(!1!==this.form.is_anonymous&&(t.add("forgot-password"),t.add("password")),t.add("password-old"),t.add("legal-notice")),this.href&&(t.add("is-anonymous"),t.add("legal-notice")),new i(Array.from(t).join(" ").trim())}get headerTitleOptions(){const t=this.data;return!t||t.first_name.trim()||t.last_name.trim()?super.headerTitleOptions:a(a({},super.headerTitleOptions),{},{context:"no_name"})}get headerSubtitleKey(){var t;return(null===(t=this.data)||void 0===t?void 0:t.is_anonymous)?"subtitle_anonymous":"subtitle_registered"}get headerSubtitleOptions(){return a(a({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}disconnectedCallback(){super.disconnectedCallback();const t=this.__refreshInterval;t&&clearInterval(t)}connectedCallback(){super.connectedCallback();const t=setInterval((()=>this.requestUpdate()),6e4);this.__refreshInterval=t}renderBody(){var t,e,s,r;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return o(u||(u=g` ${0} <div class="${0}"> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> </div> <foxy-internal-text-control helper-text="${0}" infer="email"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="is-anonymous" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-password-control placeholder="${0}" helper-text="${0}" infer="password" show-generator> </foxy-internal-password-control> <foxy-internal-password-control infer="password-old"></foxy-internal-password-control> <foxy-internal-password-control helper-text="${0}" infer="forgot-password" show-generator> </foxy-internal-password-control> <foxy-internal-text-control infer="tax-id"></foxy-internal-text-control> <foxy-internal-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),this.renderHeader(),h({"grid-cols-2":!a&&!i,hidden:a&&i,"gap-m":!0,grid:!a||!i}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__forgotPasswordHelperText,!this.data&&(null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.enabled)&&"hcaptcha"===(null===(r=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===r?void 0:r.verification.type)?o(f||(f=g` <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> `),this.settings.sign_up.verification.site_key,this.lang,(({token:t})=>{this.edit({verification:{type:"hcaptcha",token:t}}),super.submit()})):"",super.renderBody())}submit(){var t,e,s,o,r;"hcaptcha"!==(null===(s=null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.verification)||void 0===s?void 0:s.type)||this.data?super.submit():(null===(o=this.__hcaptcha)||void 0===o||o.reset(),null===(r=this.__hcaptcha)||void 0===r||r.execute())}async _sendPatch(t){const e=await super._sendPatch(t);if(t.password){const t={key:"password_change_success",options:{email:e.email}};this.status=t}return e}async _sendGet(){return this.status=null,await super._sendGet()}async _fetch(...t){try{return await super._fetch(...t)}catch(t){let e;try{e=(await t.json())._embedded["fx:errors"][0].message}catch(e){throw t}throw"Conflict"===e||e.startsWith("This email address is already in use")?["error:email_already_used"]:e.startsWith("Customer registration is disabled")?["error:registration_disabled"]:e.startsWith("Client verification failed")?["error:verification_failed"]:e.startsWith("Provided password is incorrect")?["error:old_password_incorrect"]:t}}get __forgotPasswordHelperText(){var t,e;const s=null===(t=this.data)||void 0===t?void 0:t.forgot_password_timestamp,o="forgot-password.helper_text";if((null===(e=this.data)||void 0===e?void 0:e.forgot_password)&&s){const t=new Date(new Date(s).getTime()+18e5),e=Math.floor((t.getTime()-Date.now())/1e3/60);return e<=0?this.t(`${o}_expired_on`,{expiresOn:t}):this.t(`${o}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(o)}get __passwordPlaceholder(){return this.data?this.t("password.placeholder_new"):this.t("password.placeholder")}get __passwordHelperText(){return this.data?this.t("password.helper_text_new"):this.t("password.helper_text")}get __emailHelperText(){var t;return(null===(t=this.data)||void 0===t?void 0:t.last_login_date)?this.t("email.helper_text_last_login_date",{date:this.data.last_login_date}):this.t("email.helper_text")}get __hcaptcha(){return this.renderRoot.querySelector("h-captcha")}}customElements.define("foxy-customer-form",x);export{x as CustomerForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-ea5ff8bc.js";import"./shared-fae08dfb.js";import"./shared-6d11abd7.js";import"./shared-73045804.js";import"./shared-96a392d9.js";import{I as e}from"./shared-97514fcb.js";import"./shared-c5a0cdd7.js";import{a as t}from"./shared-25502f01.js";import{B as i}from"./shared-0f6e4584.js";import{p as s}from"./shared-90706e10.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-c4124870.js";import{p as n}from"./shared-49ecea83.js";import{I as a}from"./shared-df42c94f.js";import"./shared-471e77dd.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-9637a2de.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-pagination.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-4a652d60.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";let r,l=e=>e;const d=t(e);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-form",class extends d{constructor(){super(...arguments),this.__valuesInputParams={type:"number",step:"1",min:"1",max:"999"},this.__valuesGetValue=()=>{var e;return null===(e=this.form.values)||void 0===e?void 0:e.map((e=>{if(".5m"===e)return{value:e,label:this.t("values.twice_a_week")};const{units:t,count:i}=s(e);return{value:e,label:this.t(`values.${t}`,{count:i})}}))},this.__valuesSetValue=e=>{const t=e.filter((({value:e})=>parseFloat(e)<=999)).map((({unit:e,value:t})=>e?`${t}${e}`:t)).filter(((e,t,i)=>i.indexOf(e)===t));this.edit({values:t})}}static get v8n(){return[({jsonataQuery:e})=>!!e||"jsonata-query:v8n_required",({jsonataQuery:e})=>!e||e.length<=200||"jsonata-query:v8n_too_long",({values:e})=>!!e&&e.length>0||"values:v8n_required",({values:e})=>!e||e.length<=20||"values:v8n_too_long"]}get hiddenSelector(){return new i(`timestamps ${super.hiddenSelector}`.trim())}renderBody(){return o(r||(r=l` <foxy-internal-source-control infer="jsonata-query" property="jsonataQuery"> </foxy-internal-source-control> <foxy-internal-editable-list-control infer="values" .inputParams="${0}" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__valuesInputParams,this.__valuesGetValue,this.__valuesSetValue,[{label:this.t("values.unit_years"),value:"y"},{label:this.t("values.unit_months"),value:"m"},{label:this.t("values.unit_weeks"),value:"w"},{label:this.t("values.unit_days"),value:"d"}],super.renderBody())}});let u,c=e=>e;const f=t(a);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-card",class extends f{renderBody(){var e;const{jsonataQuery:t,values:i}=null!==(e=this.data)&&void 0!==e?e:{},n=null==i?void 0:i.map((e=>{if(".5m"===e)return this.t("twice_a_week");const{units:t,count:i}=s(e);return this.t(t,{count:i})}));return o(u||(u=c` <section class="h-s flex flex-col justify-center leading-xs"> <p class="text-m font-medium min-w-0"> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> <p class="text-s text-secondary min-w-0"> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> </section> `),"*"===t?"title_all":"title_matching",{query:t},(null==i?void 0:i.length)?"subtitle_list":"subtitle_empty",{list:null==n?void 0:n.join(", ")})}});let p,h=e=>e;const m=t(e);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-form",class extends m{constructor(){super(...arguments),this.__minmaxRestrictionsGetValue=()=>{const e=[],t=this.form;return t.min&&e.push("min"),t.max&&e.push("max"),e},this.__minmaxRestrictionsSetValue=e=>{const t=this.form;this.edit({min:e.includes("min")?t.min||"1m":null,max:e.includes("max")?t.max||"1y":null})},this.__minmaxRestrictionsOptions=[{label:"option_min",value:"min"},{label:"option_max",value:"max"}],this.__dayAndDateRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.type;return"day"===t?"days":"month"===t?"dates":"none"},this.__dayAndDateRestrictionsSetValue=e=>{"dates"===e?this.edit({allowedDays:{type:"month",days:[]}}):"days"===e?this.edit({allowedDays:{type:"day",days:[]}}):this.edit({allowedDays:null})},this.__dayAndDateRestrictionsOptions=[{label:"option_none",value:"none"},{label:"option_dates",value:"dates"},{label:"option_days",value:"days"}],this.__daysOfWeekGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.days.map((e=>String(e))))&&void 0!==t?t:[]},this.__daysOfWeekSetValue=e=>{this.edit({allowedDays:{type:"day",days:e.map(Number)}})},this.__daysOfWeekOptions=[{label:"option_1",value:"1"},{label:"option_2",value:"2"},{label:"option_3",value:"3"},{label:"option_4",value:"4"},{label:"option_5",value:"5"},{label:"option_6",value:"6"},{label:"option_7",value:"7"}],this.__datesOfMonthInputParams={type:"number",min:"1",max:"31",step:"1"},this.__datesOfMonthGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.days.map((e=>({value:String(e)}))))&&void 0!==t?t:[]},this.__datesOfMonthSetValue=e=>{this.edit({allowedDays:{type:"month",days:e.map((e=>parseInt(e.value))).filter((e=>Number.isInteger(e)&&e>=1&&e<=31))}})},this.__disallowedDatesInputParams={type:"date"},this.__disallowedDatesGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.disallowedDates)||void 0===e?void 0:e.map((e=>({value:e}))))&&void 0!==t?t:[]},this.__disallowedDatesSetValue=e=>{this.edit({disallowedDates:e.map((e=>e.value))})}}static get v8n(){return[({jsonataQuery:e})=>!!e||"jsonata-query:v8n_required",({jsonataQuery:e})=>!e||e.length<=200||"jsonata-query:v8n_too_long",({disallowedDates:e})=>!e||e.length<=10||"disallowed-dates:v8n_too_long"]}get hiddenSelector(){var e,t;const s=["timestamps",super.hiddenSelector.toString()],o=this.form;return o.min||s.unshift("min"),o.max||s.unshift("max"),"day"!==(null===(e=o.allowedDays)||void 0===e?void 0:e.type)&&s.unshift("days-of-week"),"month"!==(null===(t=o.allowedDays)||void 0===t?void 0:t.type)&&s.unshift("dates-of-month"),new i(s.join(" ").trim())}renderBody(){return o(p||(p=h` <foxy-internal-source-control infer="jsonata-query" property="jsonataQuery"> </foxy-internal-source-control> <foxy-internal-checkbox-group-control infer="minmax-restrictions" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-frequency-control infer="min"></foxy-internal-frequency-control> <foxy-internal-frequency-control infer="max"></foxy-internal-frequency-control> <foxy-internal-radio-group-control infer="day-and-date-restrictions" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="days-of-week" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-editable-list-control infer="dates-of-month" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="disallowed-dates" range="optional" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__minmaxRestrictionsGetValue,this.__minmaxRestrictionsSetValue,this.__minmaxRestrictionsOptions,this.__dayAndDateRestrictionsGetValue,this.__dayAndDateRestrictionsSetValue,this.__dayAndDateRestrictionsOptions,this.__daysOfWeekGetValue,this.__daysOfWeekSetValue,this.__daysOfWeekOptions,this.__datesOfMonthInputParams,this.__datesOfMonthGetValue,this.__datesOfMonthSetValue,this.__disallowedDatesInputParams,this.__disallowedDatesGetValue,this.__disallowedDatesSetValue,super.renderBody())}});let y,_=e=>e;const v=t(a);function x(e){try{return new URL(e).origin===e.toLowerCase()}catch(e){return!1}}customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-card",class extends v{renderBody(){var e;const{min:t,max:i,allowedDays:s,jsonataQuery:a,disallowedDates:r}=null!==(e=this.data)&&void 0!==e?e:{},l=t?n(t):void 0,d=i?n(i):void 0,u="*"===a?"line_1_all":"line_1_matching",c={query:a},f={from:l?this.t(`unit_${l.units}`,{count:l.count}):this.t("any"),to:d?this.t(`unit_${d.units}`,{count:d.count}):this.t("any")},p=`line_3_${s?s.type:"any"}`,h={list:"month"===(null==s?void 0:s.type)?null==s?void 0:s.days.join(", "):null==s?void 0:s.days.map((e=>this.t(`day_${e}`))).join(", ")},m=r?"line_4_some":"line_4_none",v={list:null==r?void 0:r.map((e=>{const[t,i]=e.split("..");return t&&i?this.t("date_range",{from:t,to:i}):this.t("single_date",{value:e})})).join(", ")};return o(y||(y=_` <section class="leading-xs" style="margin:-.25ch 0"> <p class="text-m font-medium truncate"> <foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n> </p> <p class="text-s text-secondary"> <foxy-i18n infer="" class="block truncate" key="line_2" .options="${0}"> </foxy-i18n> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> </section> `),u,c,f,p,h,m,v)}});let g,b=e=>e;const j=t(e,"customer-portal-settings-form");class w extends j{constructor(){super(...arguments),this.__sessionLifespanInMinutesOptions=[{value:"m",label:"option_minute"},{value:"h",label:"option_hour"},{value:"d",label:"option_day"},{value:"w",label:"option_week"}],this.__sessionLifespanInMinutesGetValue=()=>{var e;const t=null!==(e=this.form.sessionLifespanInMinutes)&&void 0!==e?e:0;return t%10080==0?t/10080+"w":t%1440==0?t/1440+"d":t%60==0?t/60+"h":`${t}m`},this.__sessionLifespanInMinutesSetValue=e=>{const t=parseInt(e);e.endsWith("w")?this.edit({sessionLifespanInMinutes:10080*t}):e.endsWith("d")?this.edit({sessionLifespanInMinutes:1440*t}):e.endsWith("h")?this.edit({sessionLifespanInMinutes:60*t}):this.edit({sessionLifespanInMinutes:t})},this.__allowedOriginsGetValue=()=>{var e;return null===(e=this.form.allowedOrigins)||void 0===e?void 0:e.map((e=>({label:x(e)?e:`⚠️ ${e}`,value:e})))},this.__allowedOriginsSetValue=e=>{this.edit({allowedOrigins:e.map((({value:e})=>function(e){try{return new URL(e).origin}catch(t){return e}}(e))).filter(((e,t,i)=>i.indexOf(e)===t))})},this.__featuresOptions=[{value:"sso",label:"option_sso"},{value:"sign-up",label:"option_sign_up"},{value:"frequency-modification",label:"option_frequency_modification"},{value:"next-date-modification",label:"option_next_date_modification"}],this.__featuresGetValue=()=>{var e,t,i;const s=[];return this.form.sso&&s.push("sso"),(null===(e=this.form.signUp)||void 0===e?void 0:e.enabled)&&s.push("sign-up"),(null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowNextDateModification)&&s.push("next-date-modification"),(null===(i=this.form.subscriptions)||void 0===i?void 0:i.allowFrequencyModification.length)&&s.push("frequency-modification"),s},this.__featuresSetValue=e=>{var t,i,s,o,n;const a=null!==(i=null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowFrequencyModification)&&void 0!==i?i:[];this.edit({sso:e.includes("sso"),signUp:{enabled:e.includes("sign-up"),verification:null!==(o=null===(s=this.form.signUp)||void 0===s?void 0:s.verification)&&void 0!==o?o:{type:"hcaptcha",siteKey:"",secretKey:""}},subscriptions:{allowFrequencyModification:e.includes("frequency-modification")?0===a.length?[{jsonataQuery:"*",values:[]}]:a:[],allowNextDateModification:!!e.includes("next-date-modification")&&((null===(n=this.form.subscriptions)||void 0===n?void 0:n.allowNextDateModification)||[])}})},this.__signUpVerificationHcaptchaSiteKeyGetValue=()=>{var e,t,i;return null!==(i=null===(t=null===(e=this.form.signUp)||void 0===e?void 0:e.verification)||void 0===t?void 0:t.siteKey)&&void 0!==i?i:""},this.__signUpVerificationHcaptchaSiteKeySetValue=e=>{var t,i,s,o;this.edit({signUp:{enabled:!!(null===(t=this.form.signUp)||void 0===t?void 0:t.enabled),verification:{secretKey:null!==(o=null===(s=null===(i=this.form.signUp)||void 0===i?void 0:i.verification)||void 0===s?void 0:s.secretKey)&&void 0!==o?o:"",siteKey:e,type:"hcaptcha"}}})},this.__signUpVerificationHcaptchaSecretKeyGetValue=()=>{var e,t,i;return null!==(i=null===(t=null===(e=this.form.signUp)||void 0===e?void 0:e.verification)||void 0===t?void 0:t.secretKey)&&void 0!==i?i:""},this.__signUpVerificationHcaptchaSecretKeySetValue=e=>{var t,i,s,o;this.edit({signUp:{enabled:!!(null===(t=this.form.signUp)||void 0===t?void 0:t.enabled),verification:{secretKey:e,siteKey:null!==(o=null===(s=null===(i=this.form.signUp)||void 0===i?void 0:i.verification)||void 0===s?void 0:s.siteKey)&&void 0!==o?o:"",type:"hcaptcha"}}})},this.__jwtSecretGeneratorOptions={charset:"abcdefghijklmnopqrstuvwxyz0123456789",length:64}}static get v8n(){return[({sessionLifespanInMinutes:e})=>"number"!=typeof e||e<=40320||"session-lifespan-in-minutes:v8n_too_long",({allowedOrigins:e=[]})=>e.length<=10||"allowed-origins:v8n_too_many",({allowedOrigins:e=[]})=>e.every(x)||"allowed-origins:v8n_invalid",({jwtSharedSecret:e})=>!e||/^[a-z0-9-]+$/.test(e)||"jwt-shared-secret:v8n_invalid",({jwtSharedSecret:e})=>!e||e.length>=40||"jwt-shared-secret:v8n_too_short",({jwtSharedSecret:e})=>!e||e.length<=100||"jwt-shared-secret:v8n_too_long",({signUp:e})=>{const t=null==e?void 0:e.verification.siteKey;return!t||t.length<=100||"sign-up-verification-hcaptcha-site-key:v8n_too_long"},({signUp:e})=>{const t=null==e?void 0:e.verification.secretKey;return!t||t.length<=100||"sign-up-verification-hcaptcha-secret-key:v8n_too_long"}]}get hiddenSelector(){var e,t,s;const o=["header:copy-id",super.hiddenSelector.toString()];return(null===(e=this.form.signUp)||void 0===e?void 0:e.enabled)||o.push("sign-up-verification-hcaptcha-site-key","sign-up-verification-hcaptcha-secret-key"),(null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowFrequencyModification.length)||o.push("subscriptions-allow-frequency-modification"),(null===(s=this.form.subscriptions)||void 0===s?void 0:s.allowNextDateModification)||o.push("subscriptions-allow-next-date-modification"),new i(o.join(" ").trim())}renderBody(){return o(g||(g=b` ${0} <foxy-internal-editable-list-control infer="allowed-origins" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="features" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="sign-up-verification-hcaptcha-site-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-password-control infer="sign-up-verification-hcaptcha-secret-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-async-list-control first="foxy://${0}/form/subscriptions/allowFrequencyModification" infer="subscriptions-allow-frequency-modification" limit="20" form="foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-form" item="foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="foxy://${0}/form/subscriptions/allowNextDateModification" infer="subscriptions-allow-next-date-modification" limit="20" form="foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-form" item="foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-card" alert> </foxy-internal-async-list-control> <foxy-internal-frequency-control infer="session-lifespan-in-minutes" max="" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-password-control property="jwtSharedSecret" infer="jwt-shared-secret" show-generator .generatorOptions="${0}"> </foxy-internal-password-control> ${0} `),this.renderHeader(),this.__allowedOriginsGetValue,this.__allowedOriginsSetValue,this.__featuresGetValue,this.__featuresSetValue,this.__featuresOptions,this.__signUpVerificationHcaptchaSiteKeyGetValue,this.__signUpVerificationHcaptchaSiteKeySetValue,this.__signUpVerificationHcaptchaSecretKeyGetValue,this.__signUpVerificationHcaptchaSecretKeySetValue,this.virtualHost,this.virtualHost,this.__sessionLifespanInMinutesGetValue,this.__sessionLifespanInMinutesSetValue,this.__sessionLifespanInMinutesOptions,this.__jwtSecretGeneratorOptions,super.renderBody())}async _sendPost(e){return this.__removeNullProperties(e),super._sendPost(e)}async _sendPatch(e){return this.__removeNullProperties(e),super._sendPatch(e)}__removeNullProperties(e){var t,i;"object"==typeof(null===(t=e.subscriptions)||void 0===t?void 0:t.allowNextDateModification)&&(null===(i=e.subscriptions)||void 0===i||i.allowNextDateModification.forEach((e=>{for(const t in e){const i=t;null===e[i]&&delete e[i]}})))}}customElements.define("foxy-customer-portal-settings-form",w);export{w as CustomerPortalSettingsForm};
|
|
1
|
+
import"./shared-ea5ff8bc.js";import"./shared-fae08dfb.js";import"./shared-6d11abd7.js";import"./shared-73045804.js";import"./shared-cc8b47c6.js";import{I as e}from"./shared-97514fcb.js";import"./shared-c5a0cdd7.js";import{a as t}from"./shared-25502f01.js";import{B as i}from"./shared-0f6e4584.js";import{p as s}from"./shared-90706e10.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-c4124870.js";import{p as n}from"./shared-49ecea83.js";import{I as a}from"./shared-df42c94f.js";import"./shared-471e77dd.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-9637a2de.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-pagination.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-4a652d60.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";let r,l=e=>e;const d=t(e);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-form",class extends d{constructor(){super(...arguments),this.__valuesInputParams={type:"number",step:"1",min:"1",max:"999"},this.__valuesGetValue=()=>{var e;return null===(e=this.form.values)||void 0===e?void 0:e.map((e=>{if(".5m"===e)return{value:e,label:this.t("values.twice_a_week")};const{units:t,count:i}=s(e);return{value:e,label:this.t(`values.${t}`,{count:i})}}))},this.__valuesSetValue=e=>{const t=e.filter((({value:e})=>parseFloat(e)<=999)).map((({unit:e,value:t})=>e?`${t}${e}`:t)).filter(((e,t,i)=>i.indexOf(e)===t));this.edit({values:t})}}static get v8n(){return[({jsonataQuery:e})=>!!e||"jsonata-query:v8n_required",({jsonataQuery:e})=>!e||e.length<=200||"jsonata-query:v8n_too_long",({values:e})=>!!e&&e.length>0||"values:v8n_required",({values:e})=>!e||e.length<=20||"values:v8n_too_long"]}get hiddenSelector(){return new i(`timestamps ${super.hiddenSelector}`.trim())}renderBody(){return o(r||(r=l` <foxy-internal-source-control infer="jsonata-query" property="jsonataQuery"> </foxy-internal-source-control> <foxy-internal-editable-list-control infer="values" .inputParams="${0}" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__valuesInputParams,this.__valuesGetValue,this.__valuesSetValue,[{label:this.t("values.unit_years"),value:"y"},{label:this.t("values.unit_months"),value:"m"},{label:this.t("values.unit_weeks"),value:"w"},{label:this.t("values.unit_days"),value:"d"}],super.renderBody())}});let u,c=e=>e;const f=t(a);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-card",class extends f{renderBody(){var e;const{jsonataQuery:t,values:i}=null!==(e=this.data)&&void 0!==e?e:{},n=null==i?void 0:i.map((e=>{if(".5m"===e)return this.t("twice_a_week");const{units:t,count:i}=s(e);return this.t(t,{count:i})}));return o(u||(u=c` <section class="h-s flex flex-col justify-center leading-xs"> <p class="text-m font-medium min-w-0"> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> <p class="text-s text-secondary min-w-0"> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> </section> `),"*"===t?"title_all":"title_matching",{query:t},(null==i?void 0:i.length)?"subtitle_list":"subtitle_empty",{list:null==n?void 0:n.join(", ")})}});let p,h=e=>e;const m=t(e);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-form",class extends m{constructor(){super(...arguments),this.__minmaxRestrictionsGetValue=()=>{const e=[],t=this.form;return t.min&&e.push("min"),t.max&&e.push("max"),e},this.__minmaxRestrictionsSetValue=e=>{const t=this.form;this.edit({min:e.includes("min")?t.min||"1m":null,max:e.includes("max")?t.max||"1y":null})},this.__minmaxRestrictionsOptions=[{label:"option_min",value:"min"},{label:"option_max",value:"max"}],this.__dayAndDateRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.type;return"day"===t?"days":"month"===t?"dates":"none"},this.__dayAndDateRestrictionsSetValue=e=>{"dates"===e?this.edit({allowedDays:{type:"month",days:[]}}):"days"===e?this.edit({allowedDays:{type:"day",days:[]}}):this.edit({allowedDays:null})},this.__dayAndDateRestrictionsOptions=[{label:"option_none",value:"none"},{label:"option_dates",value:"dates"},{label:"option_days",value:"days"}],this.__daysOfWeekGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.days.map((e=>String(e))))&&void 0!==t?t:[]},this.__daysOfWeekSetValue=e=>{this.edit({allowedDays:{type:"day",days:e.map(Number)}})},this.__daysOfWeekOptions=[{label:"option_1",value:"1"},{label:"option_2",value:"2"},{label:"option_3",value:"3"},{label:"option_4",value:"4"},{label:"option_5",value:"5"},{label:"option_6",value:"6"},{label:"option_7",value:"7"}],this.__datesOfMonthInputParams={type:"number",min:"1",max:"31",step:"1"},this.__datesOfMonthGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.days.map((e=>({value:String(e)}))))&&void 0!==t?t:[]},this.__datesOfMonthSetValue=e=>{this.edit({allowedDays:{type:"month",days:e.map((e=>parseInt(e.value))).filter((e=>Number.isInteger(e)&&e>=1&&e<=31))}})},this.__disallowedDatesInputParams={type:"date"},this.__disallowedDatesGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.disallowedDates)||void 0===e?void 0:e.map((e=>({value:e}))))&&void 0!==t?t:[]},this.__disallowedDatesSetValue=e=>{this.edit({disallowedDates:e.map((e=>e.value))})}}static get v8n(){return[({jsonataQuery:e})=>!!e||"jsonata-query:v8n_required",({jsonataQuery:e})=>!e||e.length<=200||"jsonata-query:v8n_too_long",({disallowedDates:e})=>!e||e.length<=10||"disallowed-dates:v8n_too_long"]}get hiddenSelector(){var e,t;const s=["timestamps",super.hiddenSelector.toString()],o=this.form;return o.min||s.unshift("min"),o.max||s.unshift("max"),"day"!==(null===(e=o.allowedDays)||void 0===e?void 0:e.type)&&s.unshift("days-of-week"),"month"!==(null===(t=o.allowedDays)||void 0===t?void 0:t.type)&&s.unshift("dates-of-month"),new i(s.join(" ").trim())}renderBody(){return o(p||(p=h` <foxy-internal-source-control infer="jsonata-query" property="jsonataQuery"> </foxy-internal-source-control> <foxy-internal-checkbox-group-control infer="minmax-restrictions" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-frequency-control infer="min"></foxy-internal-frequency-control> <foxy-internal-frequency-control infer="max"></foxy-internal-frequency-control> <foxy-internal-radio-group-control infer="day-and-date-restrictions" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="days-of-week" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-editable-list-control infer="dates-of-month" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="disallowed-dates" range="optional" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__minmaxRestrictionsGetValue,this.__minmaxRestrictionsSetValue,this.__minmaxRestrictionsOptions,this.__dayAndDateRestrictionsGetValue,this.__dayAndDateRestrictionsSetValue,this.__dayAndDateRestrictionsOptions,this.__daysOfWeekGetValue,this.__daysOfWeekSetValue,this.__daysOfWeekOptions,this.__datesOfMonthInputParams,this.__datesOfMonthGetValue,this.__datesOfMonthSetValue,this.__disallowedDatesInputParams,this.__disallowedDatesGetValue,this.__disallowedDatesSetValue,super.renderBody())}});let y,_=e=>e;const v=t(a);function x(e){try{return new URL(e).origin===e.toLowerCase()}catch(e){return!1}}customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-card",class extends v{renderBody(){var e;const{min:t,max:i,allowedDays:s,jsonataQuery:a,disallowedDates:r}=null!==(e=this.data)&&void 0!==e?e:{},l=t?n(t):void 0,d=i?n(i):void 0,u="*"===a?"line_1_all":"line_1_matching",c={query:a},f={from:l?this.t(`unit_${l.units}`,{count:l.count}):this.t("any"),to:d?this.t(`unit_${d.units}`,{count:d.count}):this.t("any")},p=`line_3_${s?s.type:"any"}`,h={list:"month"===(null==s?void 0:s.type)?null==s?void 0:s.days.join(", "):null==s?void 0:s.days.map((e=>this.t(`day_${e}`))).join(", ")},m=r?"line_4_some":"line_4_none",v={list:null==r?void 0:r.map((e=>{const[t,i]=e.split("..");return t&&i?this.t("date_range",{from:t,to:i}):this.t("single_date",{value:e})})).join(", ")};return o(y||(y=_` <section class="leading-xs" style="margin:-.25ch 0"> <p class="text-m font-medium truncate"> <foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n> </p> <p class="text-s text-secondary"> <foxy-i18n infer="" class="block truncate" key="line_2" .options="${0}"> </foxy-i18n> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> </section> `),u,c,f,p,h,m,v)}});let g,b=e=>e;const j=t(e,"customer-portal-settings-form");class w extends j{constructor(){super(...arguments),this.__sessionLifespanInMinutesOptions=[{value:"m",label:"option_minute"},{value:"h",label:"option_hour"},{value:"d",label:"option_day"},{value:"w",label:"option_week"}],this.__sessionLifespanInMinutesGetValue=()=>{var e;const t=null!==(e=this.form.sessionLifespanInMinutes)&&void 0!==e?e:0;return t%10080==0?t/10080+"w":t%1440==0?t/1440+"d":t%60==0?t/60+"h":`${t}m`},this.__sessionLifespanInMinutesSetValue=e=>{const t=parseInt(e);e.endsWith("w")?this.edit({sessionLifespanInMinutes:10080*t}):e.endsWith("d")?this.edit({sessionLifespanInMinutes:1440*t}):e.endsWith("h")?this.edit({sessionLifespanInMinutes:60*t}):this.edit({sessionLifespanInMinutes:t})},this.__allowedOriginsGetValue=()=>{var e;return null===(e=this.form.allowedOrigins)||void 0===e?void 0:e.map((e=>({label:x(e)?e:`⚠️ ${e}`,value:e})))},this.__allowedOriginsSetValue=e=>{this.edit({allowedOrigins:e.map((({value:e})=>function(e){try{return new URL(e).origin}catch(t){return e}}(e))).filter(((e,t,i)=>i.indexOf(e)===t))})},this.__featuresOptions=[{value:"sso",label:"option_sso"},{value:"sign-up",label:"option_sign_up"},{value:"frequency-modification",label:"option_frequency_modification"},{value:"next-date-modification",label:"option_next_date_modification"}],this.__featuresGetValue=()=>{var e,t,i;const s=[];return this.form.sso&&s.push("sso"),(null===(e=this.form.signUp)||void 0===e?void 0:e.enabled)&&s.push("sign-up"),(null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowNextDateModification)&&s.push("next-date-modification"),(null===(i=this.form.subscriptions)||void 0===i?void 0:i.allowFrequencyModification.length)&&s.push("frequency-modification"),s},this.__featuresSetValue=e=>{var t,i,s,o,n;const a=null!==(i=null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowFrequencyModification)&&void 0!==i?i:[];this.edit({sso:e.includes("sso"),signUp:{enabled:e.includes("sign-up"),verification:null!==(o=null===(s=this.form.signUp)||void 0===s?void 0:s.verification)&&void 0!==o?o:{type:"hcaptcha",siteKey:"",secretKey:""}},subscriptions:{allowFrequencyModification:e.includes("frequency-modification")?0===a.length?[{jsonataQuery:"*",values:[]}]:a:[],allowNextDateModification:!!e.includes("next-date-modification")&&((null===(n=this.form.subscriptions)||void 0===n?void 0:n.allowNextDateModification)||[])}})},this.__signUpVerificationHcaptchaSiteKeyGetValue=()=>{var e,t,i;return null!==(i=null===(t=null===(e=this.form.signUp)||void 0===e?void 0:e.verification)||void 0===t?void 0:t.siteKey)&&void 0!==i?i:""},this.__signUpVerificationHcaptchaSiteKeySetValue=e=>{var t,i,s,o;this.edit({signUp:{enabled:!!(null===(t=this.form.signUp)||void 0===t?void 0:t.enabled),verification:{secretKey:null!==(o=null===(s=null===(i=this.form.signUp)||void 0===i?void 0:i.verification)||void 0===s?void 0:s.secretKey)&&void 0!==o?o:"",siteKey:e,type:"hcaptcha"}}})},this.__signUpVerificationHcaptchaSecretKeyGetValue=()=>{var e,t,i;return null!==(i=null===(t=null===(e=this.form.signUp)||void 0===e?void 0:e.verification)||void 0===t?void 0:t.secretKey)&&void 0!==i?i:""},this.__signUpVerificationHcaptchaSecretKeySetValue=e=>{var t,i,s,o;this.edit({signUp:{enabled:!!(null===(t=this.form.signUp)||void 0===t?void 0:t.enabled),verification:{secretKey:e,siteKey:null!==(o=null===(s=null===(i=this.form.signUp)||void 0===i?void 0:i.verification)||void 0===s?void 0:s.siteKey)&&void 0!==o?o:"",type:"hcaptcha"}}})},this.__jwtSecretGeneratorOptions={charset:"abcdefghijklmnopqrstuvwxyz0123456789",length:64}}static get v8n(){return[({sessionLifespanInMinutes:e})=>"number"!=typeof e||e<=40320||"session-lifespan-in-minutes:v8n_too_long",({allowedOrigins:e=[]})=>e.length<=10||"allowed-origins:v8n_too_many",({allowedOrigins:e=[]})=>e.every(x)||"allowed-origins:v8n_invalid",({jwtSharedSecret:e})=>!e||/^[a-z0-9-]+$/.test(e)||"jwt-shared-secret:v8n_invalid",({jwtSharedSecret:e})=>!e||e.length>=40||"jwt-shared-secret:v8n_too_short",({jwtSharedSecret:e})=>!e||e.length<=100||"jwt-shared-secret:v8n_too_long",({signUp:e})=>{const t=null==e?void 0:e.verification.siteKey;return!t||t.length<=100||"sign-up-verification-hcaptcha-site-key:v8n_too_long"},({signUp:e})=>{const t=null==e?void 0:e.verification.secretKey;return!t||t.length<=100||"sign-up-verification-hcaptcha-secret-key:v8n_too_long"}]}get hiddenSelector(){var e,t,s;const o=["header:copy-id",super.hiddenSelector.toString()];return(null===(e=this.form.signUp)||void 0===e?void 0:e.enabled)||o.push("sign-up-verification-hcaptcha-site-key","sign-up-verification-hcaptcha-secret-key"),(null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowFrequencyModification.length)||o.push("subscriptions-allow-frequency-modification"),(null===(s=this.form.subscriptions)||void 0===s?void 0:s.allowNextDateModification)||o.push("subscriptions-allow-next-date-modification"),new i(o.join(" ").trim())}renderBody(){return o(g||(g=b` ${0} <foxy-internal-editable-list-control infer="allowed-origins" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="features" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="sign-up-verification-hcaptcha-site-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-password-control infer="sign-up-verification-hcaptcha-secret-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-async-list-control first="foxy://${0}/form/subscriptions/allowFrequencyModification" infer="subscriptions-allow-frequency-modification" limit="20" form="foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-form" item="foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="foxy://${0}/form/subscriptions/allowNextDateModification" infer="subscriptions-allow-next-date-modification" limit="20" form="foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-form" item="foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-card" alert> </foxy-internal-async-list-control> <foxy-internal-frequency-control infer="session-lifespan-in-minutes" max="" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-password-control property="jwtSharedSecret" infer="jwt-shared-secret" show-generator .generatorOptions="${0}"> </foxy-internal-password-control> ${0} `),this.renderHeader(),this.__allowedOriginsGetValue,this.__allowedOriginsSetValue,this.__featuresGetValue,this.__featuresSetValue,this.__featuresOptions,this.__signUpVerificationHcaptchaSiteKeyGetValue,this.__signUpVerificationHcaptchaSiteKeySetValue,this.__signUpVerificationHcaptchaSecretKeyGetValue,this.__signUpVerificationHcaptchaSecretKeySetValue,this.virtualHost,this.virtualHost,this.__sessionLifespanInMinutesGetValue,this.__sessionLifespanInMinutesSetValue,this.__sessionLifespanInMinutesOptions,this.__jwtSecretGeneratorOptions,super.renderBody())}async _sendPost(e){return this.__removeNullProperties(e),super._sendPost(e)}async _sendPatch(e){return this.__removeNullProperties(e),super._sendPatch(e)}__removeNullProperties(e){var t,i;"object"==typeof(null===(t=e.subscriptions)||void 0===t?void 0:t.allowNextDateModification)&&(null===(i=e.subscriptions)||void 0===i||i.allowNextDateModification.forEach((e=>{for(const t in e){const i=t;null===e[i]&&delete e[i]}})))}}customElements.define("foxy-customer-portal-settings-form",w);export{w as CustomerPortalSettingsForm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./foxy-customer.js";import"./shared-9637a2de.js";import"./shared-59b7fcc0.js";import"./shared-887e1795.js";import"./shared-51c4a6dd.js";import{I as e}from"./shared-97514fcb.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import{TransactionsTable as t}from"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-customer-form.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as r,B as s,aH as o}from"./shared-0f6e4584.js";import{h as i,L as n,c as a}from"./shared-dc73b9a5.js";import{A as d}from"./shared-01b2cad8.js";import"./shared-6d645dc5.js";import{C as l}from"./shared-91f5e0b3.js";import{a as c,T as m}from"./shared-25502f01.js";import{i as u}from"./shared-9803aa7c.js";import{c as h}from"./shared-4e709717.js";import{A as p}from"./shared-c286c5ad.js";import{C as f}from"./shared-0b01f721.js";import{I as g}from"./shared-f7a1193f.js";import"./shared-98ddb87c.js";import"./foxy-update-payment-method-form.js";import"./shared-d5ff9121.js";import"./shared-6d11abd7.js";import"./shared-fb1602a2.js";import"./shared-2bd96ec7.js";import"./shared-3cf043a7.js";import"./shared-61ade33e.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-226dd830.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-nucleon-element.js";import"./shared-99940888.js";import"./foxy-template-set-card.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./foxy-payment-card-embed.js";import"./shared-0f00d4d8.js";import"./shared-ff7b2af6.js";import"./shared-2c1dff50.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-6be24929.js";import"./shared-bab2ea2c.js";import"./shared-a0c6a159.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-471e77dd.js";import"./shared-c5a0cdd7.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./shared-ea5ff8bc.js";import"./shared-e5098b19.js";import"./shared-8fbebf38.js";import"./shared-651c44fa.js";import"./shared-19f46691.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-01f18104.js";import"./shared-22ba9566.js";import"./foxy-table.js";import"./shared-d75f83f8.js";import"./shared-4d172731.js";import"./shared-ad76e640.js";import"./shared-6f4fa343.js";import"./shared-deff3eda.js";import"./shared-e47bd38e.js";import"./shared-b38762ef.js";import"./shared-5721fb53.js";import"./shared-fb1dd186.js";import"./shared-0c7f9c0c.js";import"./shared-8f74f5fc.js";import"./shared-90706e10.js";import"./shared-2bf89a21.js";import"./shared-e7bff5de.js";import"./shared-2d75f154.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-c4124870.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-
|
|
1
|
+
import"./foxy-customer.js";import"./shared-9637a2de.js";import"./shared-59b7fcc0.js";import"./shared-887e1795.js";import"./shared-51c4a6dd.js";import{I as e}from"./shared-97514fcb.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import{TransactionsTable as t}from"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-customer-form.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as r,B as s,aH as o}from"./shared-0f6e4584.js";import{h as i,L as n,c as a}from"./shared-dc73b9a5.js";import{A as d}from"./shared-01b2cad8.js";import"./shared-6d645dc5.js";import{C as l}from"./shared-91f5e0b3.js";import{a as c,T as m}from"./shared-25502f01.js";import{i as u}from"./shared-9803aa7c.js";import{c as h}from"./shared-4e709717.js";import{A as p}from"./shared-c286c5ad.js";import{C as f}from"./shared-0b01f721.js";import{I as g}from"./shared-f7a1193f.js";import"./shared-98ddb87c.js";import"./foxy-update-payment-method-form.js";import"./shared-d5ff9121.js";import"./shared-6d11abd7.js";import"./shared-fb1602a2.js";import"./shared-2bd96ec7.js";import"./shared-3cf043a7.js";import"./shared-61ade33e.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-226dd830.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-nucleon-element.js";import"./shared-99940888.js";import"./foxy-template-set-card.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./foxy-payment-card-embed.js";import"./shared-0f00d4d8.js";import"./shared-ff7b2af6.js";import"./shared-2c1dff50.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-6be24929.js";import"./shared-bab2ea2c.js";import"./shared-a0c6a159.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-471e77dd.js";import"./shared-c5a0cdd7.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./shared-ea5ff8bc.js";import"./shared-e5098b19.js";import"./shared-8fbebf38.js";import"./shared-651c44fa.js";import"./shared-19f46691.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-01f18104.js";import"./shared-22ba9566.js";import"./foxy-table.js";import"./shared-d75f83f8.js";import"./shared-4d172731.js";import"./shared-ad76e640.js";import"./shared-6f4fa343.js";import"./shared-deff3eda.js";import"./shared-e47bd38e.js";import"./shared-b38762ef.js";import"./shared-5721fb53.js";import"./shared-fb1dd186.js";import"./shared-0c7f9c0c.js";import"./shared-8f74f5fc.js";import"./shared-90706e10.js";import"./shared-2bf89a21.js";import"./shared-e7bff5de.js";import"./shared-2d75f154.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-c4124870.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-cc8b47c6.js";import"./shared-4a652d60.js";import"./shared-b738ee96.js";import"./shared-6f877b15.js";let $,y,b=e=>e;class v extends(c(m(l),"customer-portal")){constructor(){super(...arguments),this.transactionsTableColumns=[t.priceColumn,t.summaryColumn,t.statusColumn,t.idColumn,t.dateColumn,t.receiptColumn],this.embedUrl=null,this.group=""}static get properties(){return r(r({},super.properties),{},{transactionsTableColumns:{attribute:!1},embedUrl:{attribute:"embed-url"},group:{type:String}})}render(){var e;let t;try{t=new URL("./customer_portal_settings",this.base)}catch(e){t=void 0}return this.api.storage.getItem(d.SESSION)?i($||($=b` <foxy-internal-customer-portal-logged-in-view embed-url="${0}" customer="${0}" class="h-full" infer="" href="${0}" .transactionsTableColumns="${0}"> </foxy-internal-customer-portal-logged-in-view> `),u(null!==(e=this.embedUrl)&&void 0!==e?e:void 0),this.base,u(null==t?void 0:t.toString()),this.transactionsTableColumns):i(y||(y=b` <foxy-internal-customer-portal-logged-out-view class="h-full" infer="" href="${0}"> </foxy-internal-customer-portal-logged-out-view> `),u(null==t?void 0:t.toString()))}}let S,x,_,j,T=e=>e;class O extends(m(n)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return r(r({},super.properties),{},{disabled:{type:Boolean},href:{type:String},icon:{type:String}})}render(){const e=h({"flex-auto font-medium tracking-wide text-s rounded-s transition-colors":!0,"hover-text-primary hover-cursor-pointer":!this.disabled,"focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2":!this.disabled,"text-disabled cursor-default":this.disabled}),t=i(S||(S=T` ${0} <slot></slot> `),this.icon?i(x||(x=T`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?i(_||(_=T`<button class="${0}" disabled="disabled">${0}</button>`),e,t):i(j||(j=T` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,t)}}let k,w,z,R,U,E,N,A,C=e=>e;const H=c(e);let I,F,L,q,P,B,D,G,J,K,M,Q,V,W,X,Y=e=>e;const Z=c(e);const ee=["html"],te=["html"];let re,se,oe,ie,ne,ae,de,le,ce,me,ue,he,pe=e=>e;const fe=c(f(m(g(n))));let ge,$e,ye,be=e=>e;const ve=f(m(c(g(n),"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends H{constructor(){var e;super(...arguments),e=this,this.customer="",this.embedUrl=null,this.loggingOutState="idle",this.transactionsTableColumns=[],this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var t,r,s,o,n;const a="customer:header:actions:sign-out",d=this.loggingOutState,l=this.disabledSelector.matches(a)||!(null===(t=this.__customerElement)||void 0===t?void 0:t.in({idle:"snapshot"}))||"idle"!==d,c={"border-radius":"100%",padding:"var(--lumo-space-xs)",display:"flex",margin:"0",cursor:l?"default":"pointer"};return i(k||(k=C` <div style="display:flex;margin-left:var(--lumo-space-m)"> ${0} <vaadin-button data-testid="sign-out" aria-label="${0}" style="${0}" theme="icon" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t("sign_out").toString(),Object.entries(c).reduce(((e,[t,r])=>`${e}${t}:${r};`),""),l,(async function(){try{e.loggingOutState="busy",await new p(e).fetch("foxy://customer-api/session",{method:"DELETE"}),e.loggingOutState="idle"}catch(t){e.loggingOutState="fail",e.loggingOutStateResetTimeout=setTimeout((()=>{e.loggingOutState="idle",e.loggingOutStateResetTimeout=null}),1e3)}}),"idle"===d?i(w||(w=C`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):i(z||(z=C` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0}"> </foxy-spinner> `),"fail"===d?"error":"busy",this.lang,[this.ns,null!==(s=null===(r=customElements.get("foxy-customer"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"",null!==(n=null===(o=customElements.get("foxy-spinner"))||void 0===o?void 0:o.defaultNS)&&void 0!==n?n:""].join(" ")),this.renderTemplateOrSlot(`${a}:after`))},this.__renderSubscriptions=(e,t)=>{const r="customer:subscriptions";return e(R||(R=C`
|
|
2
2
|
${0}
|
|
3
3
|
|
|
4
4
|
<foxy-internal-customer-portal-subscriptions
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import{h as t}from"./shared-98ddb87c.js";import"./shared-9637a2de.js";import"./shared-51c4a6dd.js";import"./foxy-payment-method-card.js";import"./foxy-update-payment-method-form.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-form.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-49ecea83.js";import{aH as e,_ as s}from"./shared-0f6e4584.js";import{L as r,h as a,c as o}from"./shared-dc73b9a5.js";import{C as i}from"./shared-0b01f721.js";import"./shared-fb1602a2.js";import"./shared-6be24929.js";import{y as h,S as d,T as n,a as l}from"./shared-25502f01.js";import{c as m}from"./shared-4e709717.js";import"./shared-4d172731.js";import"./shared-c11df800.js";import{S as c}from"./shared-b38762ef.js";import{G as v}from"./shared-0c7f9c0c.js";import"./shared-0f00d4d8.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-ff7b2af6.js";import{N as p}from"./shared-24d71d01.js";import{S as f}from"./shared-8f74f5fc.js";import{i as g}from"./shared-9803aa7c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-09fc6fa0.js";import"./shared-2bf89a21.js";import"./foxy-nucleon-element.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-f7a1193f.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-d5ff9121.js";import"./shared-6d11abd7.js";import"./shared-3cf043a7.js";import"./shared-9bf7d9a7.js";import"./shared-e7232c2b.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-226dd830.js";import"./shared-97514fcb.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-bab2ea2c.js";import"./shared-99940888.js";import"./foxy-template-set-card.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./foxy-payment-card-embed.js";import"./shared-01b2cad8.js";import"./shared-6d645dc5.js";import"./shared-a0c6a159.js";import"./shared-8fbebf38.js";import"./shared-651c44fa.js";import"./shared-19f46691.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-e7bff5de.js";import"./shared-ad76e640.js";import"./shared-2d75f154.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-c4124870.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-90706e10.js";import"./shared-d75f83f8.js";import"./shared-471e77dd.js";import"./shared-c5a0cdd7.js";import"./shared-
|
|
1
|
+
import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import{h as t}from"./shared-98ddb87c.js";import"./shared-9637a2de.js";import"./shared-51c4a6dd.js";import"./foxy-payment-method-card.js";import"./foxy-update-payment-method-form.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-form.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-49ecea83.js";import{aH as e,_ as s}from"./shared-0f6e4584.js";import{L as r,h as a,c as o}from"./shared-dc73b9a5.js";import{C as i}from"./shared-0b01f721.js";import"./shared-fb1602a2.js";import"./shared-6be24929.js";import{y as h,S as d,T as n,a as l}from"./shared-25502f01.js";import{c as m}from"./shared-4e709717.js";import"./shared-4d172731.js";import"./shared-c11df800.js";import{S as c}from"./shared-b38762ef.js";import{G as v}from"./shared-0c7f9c0c.js";import"./shared-0f00d4d8.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-ff7b2af6.js";import{N as p}from"./shared-24d71d01.js";import{S as f}from"./shared-8f74f5fc.js";import{i as g}from"./shared-9803aa7c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-09fc6fa0.js";import"./shared-2bf89a21.js";import"./foxy-nucleon-element.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-f7a1193f.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-d5ff9121.js";import"./shared-6d11abd7.js";import"./shared-3cf043a7.js";import"./shared-9bf7d9a7.js";import"./shared-e7232c2b.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-226dd830.js";import"./shared-97514fcb.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-bab2ea2c.js";import"./shared-99940888.js";import"./foxy-template-set-card.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./foxy-payment-card-embed.js";import"./shared-01b2cad8.js";import"./shared-6d645dc5.js";import"./shared-a0c6a159.js";import"./shared-8fbebf38.js";import"./shared-651c44fa.js";import"./shared-19f46691.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-e7bff5de.js";import"./shared-ad76e640.js";import"./shared-2d75f154.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-c4124870.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-90706e10.js";import"./shared-d75f83f8.js";import"./shared-471e77dd.js";import"./shared-c5a0cdd7.js";import"./shared-cc8b47c6.js";import"./shared-4a652d60.js";import"./shared-01f18104.js";import"./shared-22ba9566.js";import"./shared-b738ee96.js";import"./shared-ea5ff8bc.js";import"./shared-e5098b19.js";import"./shared-6f4fa343.js";import"./shared-deff3eda.js";import"./shared-e47bd38e.js";import"./shared-5721fb53.js";import"./shared-fb1dd186.js";let z,u,b,$=t=>t;class y extends r{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return h.styles}render(){const t=[],e=[];for(let s=0;s<this.size;++s)t.push(a(z||(z=$` <button id="tab-${0}" role="tab" class="${0}" aria-controls="panel-${0}" aria-selected="${0}" @click="${0}" @keydown="${0}"> <slot name="tab-${0}"></slot> </button> `),s,m({"text-l font-medium px-s rounded focus-outline-none focus-shadow-outline":!0,"text-tertiary hover-text-body focus-text-body":this.value!==s}),s,this.value===s,(()=>this.value=s),this.__handleKeyDown,s)),e.push(a(u||(u=$` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),s,s,m({hidden:this.value!==s}),this.value!==s,s));return a(b||(b=$` <div role="tablist" aria-orientation="horizontal" class="-mx-s mb-s">${0}</div> ${0} `),t,e)}__handleKeyDown(t){if(t.key.startsWith("Arrow")){t.preventDefault();const e=t.target;let s=null;"ArrowRight"===t.key||"ArrowDown"===t.key?s=e.nextElementSibling:"ArrowLeft"!==t.key&&"ArrowUp"!==t.key||(s=e.previousElementSibling),null==s||s.click(),null==s||s.focus()}}}
|
|
2
2
|
/**
|
|
3
3
|
@license
|
|
4
4
|
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-b980ba1d.js";import"./shared-476827c7.js";import"./shared-fae08dfb.js";import"./shared-6d11abd7.js";import"./shared-73045804.js";import"./shared-e5098b19.js";import"./shared-01f18104.js";import{I as e}from"./shared-97514fcb.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-gift-card-code-card.js";import"./foxy-gift-card-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-ea5ff8bc.js";import{I as t}from"./shared-226dd830.js";import"./shared-3b975a29.js";import{R as r,a as o}from"./shared-25502f01.js";import{h as i}from"./shared-dc73b9a5.js";import{_ as s,B as n}from"./shared-0f6e4584.js";import{T as a}from"./shared-8874ec69.js";import{i as d}from"./shared-9803aa7c.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-9637a2de.js";import"./shared-4e709717.js";import"./shared-bab2ea2c.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-22ba9566.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./foxy-swipe-actions.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./foxy-copy-to-clipboard.js";import"./shared-e7bff5de.js";import"./shared-c5a0cdd7.js";import"./shared-51c4a6dd.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-c4124870.js";import"./shared-d5ff9121.js";import"./shared-a8233033.js";import"./shared-cb3b9d8b.js";import"./shared-fb1dd186.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-90706e10.js";import"./shared-471e77dd.js";let l,c,f=e=>e;const m=r(t);customElements.define("foxy-internal-gift-card-form-provisioning-control",class extends m{constructor(){super(...arguments),this.__maxBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_max},this.__maxBalanceValueSetter=e=>{var t,r,o,i;const s=null!==(o=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==o?o:e;null===(i=this.nucleon)||void 0===i||i.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:s>e?e:s,initial_balance_max:e}})},this.__minBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_min},this.__minBalanceValueSetter=e=>{var t,r,o,i;const s=null!==(o=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===r?void 0:r.initial_balance_max)&&void 0!==o?o:e;null===(i=this.nucleon)||void 0===i||i.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:s<e?e:s}})},this.__toggleValueGetter=()=>{var e,t;return(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?["allow"]:[]},this.__toggleValueSetter=e=>{var t,r,o,i,s,n,a,d;e.includes("allow")?null===(t=this.nucleon)||void 0===t||t.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(i=null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.form.provisioning_config)||void 0===o?void 0:o.initial_balance_min)&&void 0!==i?i:0,initial_balance_max:null!==(a=null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.form.provisioning_config)||void 0===n?void 0:n.initial_balance_max)&&void 0!==a?a:0}}):null===(d=this.nucleon)||void 0===d||d.edit({provisioning_config:null})},this.__toggleOptions=[{label:"text",value:"allow"}]}renderControl(){var e,t;return i(l||(l=f` <foxy-internal-checkbox-group-control infer="toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__toggleValueGetter,this.__toggleValueSetter,this.__toggleOptions,(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?i(c||(c=f` <div class="grid grid-cols-2 sm-grid-cols-4 gap-m mt-s"> <foxy-internal-text-control infer="sku" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-integer-control infer="min-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> </div> `),this.__minBalanceValueGetter,this.__minBalanceValueSetter,this.__maxBalanceValueGetter,this.__maxBalanceValueSetter):"")}});const p=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let u,_,h=e=>e;const g=r(o(e,"gift-card-form"));class v extends g{constructor(){var e;super(...arguments),e=this,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join(",")})},this.__currencyCodeGetValue=()=>{var e;return null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase()},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:a.String},{label:"current_balance",path:"current_balance",type:a.Number},{label:"end_date",path:"end_date",type:a.Date},{label:"date_created",path:"date_created",type:a.Date},{label:"date_modified",path:"date_modified",type:a.Date}],this.__codesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__codesActions[0].state="busy",e.__codesActions=[...e.__codesActions];try{await navigator.clipboard.writeText(t.code),e.__codesActions[0].state="end"}catch(t){e.__codesActions[0].state="error"}finally{e.__codesActions=[...e.__codesActions],setTimeout((()=>{e.__codesActions[0].state="idle",e.__codesActions=[...e.__codesActions]}),1e3)}}}]}static get properties(){return s(s({},super.properties),{},{getCustomerHref:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",e=>{var t;if(null===(t=e.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var t;const r=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_min;return!("number"==typeof r&&r<0)||"min-balance:v8n_negative"},e=>{var t;const r=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_max;return!("number"==typeof r&&r<0)||"max-balance:v8n_negative"},({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("codes","category-restrictions","attributes"),new n(e.join(" ").trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeaderActions(e){return i(u||(u=h` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-gift-card-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:gift_card_codes"].href],e._links["fx:gift_card_codes"].href,[e._links["fx:gift_card_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,o,s,n,a,l;let c;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),c=r.toString()}catch(e){c=void 0}return i(_||(_=h` ${0} <div class="grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m"> <foxy-internal-text-control infer="name" class="md-col-span-2"> </foxy-internal-text-control> <foxy-internal-select-control property="currency_code" infer="currency" .getValue="${0}" .options="${0}"> </foxy-internal-select-control> <foxy-internal-frequency-control property="expires_after" infer="expires"> </foxy-internal-frequency-control> </div> <foxy-internal-gift-card-form-provisioning-control infer="provisioning"> </foxy-internal-gift-card-form-provisioning-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="codes" item="foxy-gift-card-code-card" form="foxy-gift-card-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="gift_card_uri" options-href="${0}" links-href="${0}" embed-key="fx:gift_card_item_categories" own-uri="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__currencyCodeGetValue,p.map((e=>({label:this.t(`currency.code_${e}`),value:e}))),c,{".getCustomerHref":this.getCustomerHref},this.__codesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],d(null===(o=null===(r=this.__storeLoader)||void 0===r?void 0:r.data)||void 0===o?void 0:o._links["fx:item_categories"].href),d(null===(s=this.data)||void 0===s?void 0:s._links["fx:gift_card_item_categories"].href),d(null===(n=this.data)||void 0===n?void 0:n._links.self.href),d(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),d(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-form",v);export{v as GiftCardForm};
|
|
1
|
+
import"./shared-1d4fdfa8.js";import"./shared-476827c7.js";import"./shared-fae08dfb.js";import"./shared-6d11abd7.js";import"./shared-73045804.js";import"./shared-e5098b19.js";import"./shared-01f18104.js";import{I as e}from"./shared-97514fcb.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-gift-card-code-card.js";import"./foxy-gift-card-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-ea5ff8bc.js";import{I as t}from"./shared-226dd830.js";import"./shared-3b975a29.js";import{R as r,a as o}from"./shared-25502f01.js";import{h as i}from"./shared-dc73b9a5.js";import{_ as s,B as n}from"./shared-0f6e4584.js";import{T as a}from"./shared-8874ec69.js";import{i as d}from"./shared-9803aa7c.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-9637a2de.js";import"./shared-4e709717.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-22ba9566.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./foxy-swipe-actions.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-e7bff5de.js";import"./shared-c5a0cdd7.js";import"./shared-51c4a6dd.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-c4124870.js";import"./shared-d5ff9121.js";import"./shared-a8233033.js";import"./shared-cb3b9d8b.js";import"./shared-fb1dd186.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-90706e10.js";import"./shared-471e77dd.js";let l,c,f=e=>e;const m=r(t);customElements.define("foxy-internal-gift-card-form-provisioning-control",class extends m{constructor(){super(...arguments),this.__maxBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_max},this.__maxBalanceValueSetter=e=>{var t,r,o,i;const s=null!==(o=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==o?o:e;null===(i=this.nucleon)||void 0===i||i.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:s>e?e:s,initial_balance_max:e}})},this.__minBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_min},this.__minBalanceValueSetter=e=>{var t,r,o,i;const s=null!==(o=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===r?void 0:r.initial_balance_max)&&void 0!==o?o:e;null===(i=this.nucleon)||void 0===i||i.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:s<e?e:s}})},this.__toggleValueGetter=()=>{var e,t;return(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?["allow"]:[]},this.__toggleValueSetter=e=>{var t,r,o,i,s,n,a,d;e.includes("allow")?null===(t=this.nucleon)||void 0===t||t.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(i=null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.form.provisioning_config)||void 0===o?void 0:o.initial_balance_min)&&void 0!==i?i:0,initial_balance_max:null!==(a=null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.form.provisioning_config)||void 0===n?void 0:n.initial_balance_max)&&void 0!==a?a:0}}):null===(d=this.nucleon)||void 0===d||d.edit({provisioning_config:null})},this.__toggleOptions=[{label:"text",value:"allow"}]}renderControl(){var e,t;return i(l||(l=f` <foxy-internal-checkbox-group-control infer="toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__toggleValueGetter,this.__toggleValueSetter,this.__toggleOptions,(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?i(c||(c=f` <div class="grid grid-cols-2 sm-grid-cols-4 gap-m mt-s"> <foxy-internal-text-control infer="sku" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-integer-control infer="min-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> </div> `),this.__minBalanceValueGetter,this.__minBalanceValueSetter,this.__maxBalanceValueGetter,this.__maxBalanceValueSetter):"")}});const p=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let u,_,h=e=>e;const g=r(o(e,"gift-card-form"));class v extends g{constructor(){var e;super(...arguments),e=this,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join(",")})},this.__currencyCodeGetValue=()=>{var e;return null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase()},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:a.String},{label:"current_balance",path:"current_balance",type:a.Number},{label:"end_date",path:"end_date",type:a.Date},{label:"date_created",path:"date_created",type:a.Date},{label:"date_modified",path:"date_modified",type:a.Date}],this.__codesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__codesActions[0].state="busy",e.__codesActions=[...e.__codesActions];try{await navigator.clipboard.writeText(t.code),e.__codesActions[0].state="end"}catch(t){e.__codesActions[0].state="error"}finally{e.__codesActions=[...e.__codesActions],setTimeout((()=>{e.__codesActions[0].state="idle",e.__codesActions=[...e.__codesActions]}),1e3)}}}]}static get properties(){return s(s({},super.properties),{},{getCustomerHref:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",e=>{var t;if(null===(t=e.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var t;const r=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_min;return!("number"==typeof r&&r<0)||"min-balance:v8n_negative"},e=>{var t;const r=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_max;return!("number"==typeof r&&r<0)||"max-balance:v8n_negative"},({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("codes","category-restrictions","attributes"),new n(e.join(" ").trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeaderActions(e){return i(u||(u=h` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-gift-card-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:gift_card_codes"].href],e._links["fx:gift_card_codes"].href,[e._links["fx:gift_card_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,o,s,n,a,l;let c;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),c=r.toString()}catch(e){c=void 0}return i(_||(_=h` ${0} <div class="grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m"> <foxy-internal-text-control infer="name" class="md-col-span-2"> </foxy-internal-text-control> <foxy-internal-select-control property="currency_code" infer="currency" .getValue="${0}" .options="${0}"> </foxy-internal-select-control> <foxy-internal-frequency-control property="expires_after" infer="expires"> </foxy-internal-frequency-control> </div> <foxy-internal-gift-card-form-provisioning-control infer="provisioning"> </foxy-internal-gift-card-form-provisioning-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="codes" item="foxy-gift-card-code-card" form="foxy-gift-card-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="gift_card_uri" options-href="${0}" links-href="${0}" embed-key="fx:gift_card_item_categories" own-uri="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__currencyCodeGetValue,p.map((e=>({label:this.t(`currency.code_${e}`),value:e}))),c,{".getCustomerHref":this.getCustomerHref},this.__codesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],d(null===(o=null===(r=this.__storeLoader)||void 0===r?void 0:r.data)||void 0===o?void 0:o._links["fx:item_categories"].href),d(null===(s=this.data)||void 0===s?void 0:s._links["fx:gift_card_item_categories"].href),d(null===(n=this.data)||void 0===n?void 0:n._links.self.href),d(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),d(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-form",v);export{v as GiftCardForm};
|