@foxy.io/elements 1.32.0-beta.3 → 1.32.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +2 -2
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +7 -7
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-4efc6bb8.js → shared-001dfdb6.js} +1 -1
- package/dist/cdn/{shared-b6ab5711.js → shared-02d4f592.js} +1 -1
- package/dist/cdn/shared-03427c91.js +1 -0
- package/dist/cdn/{shared-24c7c37f.js → shared-08e7b7e5.js} +1 -1
- package/dist/cdn/{shared-9de0a899.js → shared-09350008.js} +1 -1
- package/dist/cdn/{shared-838cc86b.js → shared-0e58c95c.js} +1 -1
- package/dist/cdn/{shared-9e94c56d.js → shared-0e80f20c.js} +1 -1
- package/dist/cdn/{shared-a4b0ccf4.js → shared-0ec6badf.js} +1 -1
- package/dist/cdn/{shared-f97ed2ff.js → shared-10674b72.js} +1 -1
- package/dist/cdn/{shared-9ef03974.js → shared-1183a365.js} +1 -1
- package/dist/cdn/{shared-64d9ac2a.js → shared-11902e83.js} +1 -1
- package/dist/cdn/{shared-c9f3f8d3.js → shared-12c2e2c7.js} +1 -1
- package/dist/cdn/{shared-55bc51c8.js → shared-1e827d8b.js} +1 -1
- package/dist/cdn/{shared-4e1b5fa3.js → shared-20b733ff.js} +1 -1
- package/dist/cdn/{shared-978aaaf2.js → shared-297ee58c.js} +1 -1
- package/dist/cdn/{shared-1c169878.js → shared-2ae2767e.js} +1 -1
- package/dist/cdn/{shared-91560256.js → shared-2d2e210c.js} +1 -1
- package/dist/cdn/{shared-1cd2db2d.js → shared-32af1656.js} +1 -1
- package/dist/cdn/{shared-45bef1ac.js → shared-33c54c6e.js} +1 -1
- package/dist/cdn/{shared-f1b29592.js → shared-35093aea.js} +7 -7
- package/dist/cdn/{shared-f0d70be1.js → shared-394d6660.js} +1 -1
- package/dist/cdn/{shared-537d2efe.js → shared-395b2f4c.js} +1 -1
- package/dist/cdn/{shared-ed9c9bab.js → shared-3e302c9e.js} +1 -1
- package/dist/cdn/{shared-ac6e1790.js → shared-513e54c9.js} +1 -1
- package/dist/cdn/{shared-783f6e58.js → shared-51415f88.js} +1 -1
- package/dist/cdn/{shared-30b4c05b.js → shared-532dd9aa.js} +1 -1
- package/dist/cdn/{shared-1cfea4b6.js → shared-555c2785.js} +1 -1
- package/dist/cdn/{shared-eff5dcb0.js → shared-58e2c070.js} +1 -1
- package/dist/cdn/{shared-3a066450.js → shared-5f00bc80.js} +1 -1
- package/dist/cdn/{shared-c6b69d4e.js → shared-65c53765.js} +1 -1
- package/dist/cdn/{shared-d713c00f.js → shared-6745d2ec.js} +1 -1
- package/dist/cdn/{shared-906fe068.js → shared-676a6445.js} +1 -1
- package/dist/cdn/{shared-de45ad84.js → shared-68470d06.js} +1 -1
- package/dist/cdn/{shared-be093279.js → shared-68ae5d92.js} +1 -1
- package/dist/cdn/{shared-08c637a9.js → shared-772745f5.js} +1 -1
- package/dist/cdn/shared-7c1d9bf8.js +1 -0
- package/dist/cdn/{shared-4a86d1ca.js → shared-8405bdfa.js} +1 -1
- package/dist/cdn/{shared-25324930.js → shared-89db9c39.js} +1 -1
- package/dist/cdn/{shared-d8cd61ed.js → shared-8f8c3902.js} +1 -1
- package/dist/cdn/{shared-85989cf3.js → shared-94965d32.js} +1 -1
- package/dist/cdn/{shared-8a8bfd72.js → shared-960eac62.js} +1 -1
- package/dist/cdn/{shared-787e52c4.js → shared-a62af87b.js} +1 -1
- package/dist/cdn/{shared-5ff1affd.js → shared-a811962b.js} +1 -1
- package/dist/cdn/{shared-26425c01.js → shared-abc64854.js} +1 -1
- package/dist/cdn/{shared-08e42e78.js → shared-acba6fbd.js} +1 -1
- package/dist/cdn/{shared-0f261023.js → shared-ad9eae20.js} +1 -1
- package/dist/cdn/{shared-51bb937b.js → shared-af70646d.js} +1 -1
- package/dist/cdn/{shared-011d6240.js → shared-b4b7767a.js} +1 -1
- package/dist/cdn/{shared-45ecb912.js → shared-b6c5ab3b.js} +1 -1
- package/dist/cdn/shared-b79fd251.js +1 -0
- package/dist/cdn/{shared-0a24f318.js → shared-b7ee8271.js} +1 -1
- package/dist/cdn/{shared-c7ffb9f2.js → shared-b8bdf3ae.js} +2 -2
- package/dist/cdn/{shared-620dccaa.js → shared-b9af1789.js} +1 -1
- package/dist/cdn/{shared-4d543043.js → shared-bd59ddc4.js} +1 -1
- package/dist/cdn/{shared-0e44bfff.js → shared-c1c20484.js} +1 -1
- package/dist/cdn/{shared-37cf92bd.js → shared-c1c481c3.js} +1 -1
- package/dist/cdn/{shared-c89f7ad5.js → shared-ca0700a7.js} +1 -1
- package/dist/cdn/{shared-b74187e9.js → shared-d6bf2433.js} +1 -1
- package/dist/cdn/{shared-8f3fdf8b.js → shared-de2dfe65.js} +5 -5
- package/dist/cdn/{shared-34c84b9f.js → shared-e24f4d30.js} +1 -1
- package/dist/cdn/{shared-c40a4b0c.js → shared-e86b8958.js} +1 -1
- package/dist/cdn/{shared-9411a937.js → shared-e95ac70b.js} +1 -1
- package/dist/cdn/{shared-e3647540.js → shared-ea378d0a.js} +1 -1
- package/dist/cdn/{shared-3491d10e.js → shared-f0c7a963.js} +1 -1
- package/dist/cdn/{shared-e1850e5f.js → shared-f23cde6c.js} +1 -1
- package/dist/cdn/{shared-045bd59c.js → shared-f7474be7.js} +1 -1
- package/dist/cdn/{shared-57cc81b4.js → shared-fa5e0813.js} +1 -1
- package/dist/cdn/{shared-8b9ae780.js → shared-fc176bc4.js} +1 -1
- package/dist/cdn/translations/coupon-form/en.json +39 -39
- package/dist/cdn/translations/user-invitation-card/en.json +2 -0
- package/dist/cdn/translations/user-invitation-form/en.json +26 -22
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js +13 -27
- package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js.map +1 -1
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +123 -139
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -1
- package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.d.ts +2 -2
- package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js +28 -47
- package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.d.ts +1 -0
- package/dist/elements/public/CouponForm/CouponForm.js +27 -24
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/InternalCouponFormRulesControl.js +9 -27
- package/dist/elements/public/CouponForm/internal/InternalCouponFormRulesControl/InternalCouponFormRulesControl.js.map +1 -1
- package/dist/elements/public/DiscountBuilder/DiscountBuilder.js +1 -5
- package/dist/elements/public/DiscountBuilder/DiscountBuilder.js.map +1 -1
- package/dist/elements/public/QueryBuilder/QueryBuilder.d.ts +4 -2
- package/dist/elements/public/QueryBuilder/QueryBuilder.js +6 -3
- package/dist/elements/public/QueryBuilder/QueryBuilder.js.map +1 -1
- package/dist/elements/public/QueryBuilder/components/Rule.js +4 -3
- package/dist/elements/public/QueryBuilder/components/Rule.js.map +1 -1
- package/dist/elements/public/QueryBuilder/utils/stringify.d.ts +1 -1
- package/dist/elements/public/QueryBuilder/utils/stringify.js +7 -5
- package/dist/elements/public/QueryBuilder/utils/stringify.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.d.ts +2 -0
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.js +63 -47
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/index.d.ts +1 -1
- package/dist/elements/public/UserInvitationForm/index.js +1 -1
- package/dist/elements/public/UserInvitationForm/index.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormAsyncAction/InternalUserInvitationFormAsyncAction.js +3 -3
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormAsyncAction/InternalUserInvitationFormAsyncAction.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/types.d.ts +10 -1
- package/dist/elements/public/UserInvitationForm/types.js.map +1 -1
- package/dist/mixins/themeable.js +0 -5
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-56d1eae5.js +0 -1
- package/dist/cdn/shared-73c1d31e.js +0 -1
- package/dist/cdn/shared-97e1f413.js +0 -1
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormSyncAction/InternalUserInvitationFormSyncAction.d.ts +0 -9
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormSyncAction/InternalUserInvitationFormSyncAction.js +0 -32
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormSyncAction/InternalUserInvitationFormSyncAction.js.map +0 -1
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormSyncAction/index.d.ts +0 -5
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormSyncAction/index.js +0 -7
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormSyncAction/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./foxy-spinner.js";import{_ as e}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import{a as s}from"./shared-
|
|
1
|
+
import"./foxy-spinner.js";import{_ as e}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import{a as s}from"./shared-001dfdb6.js";import{C as r}from"./shared-d1cb97c6.js";import{F as i}from"./shared-343d1fd7.js";import{N as n}from"./shared-2ad18636.js";import{r as a}from"./shared-a0c6a159.js";import{s as o}from"./shared-99940888.js";import"./shared-f23cde6c.js";import"./shared-bd59ddc4.js";import"./shared-11902e83.js";import"./shared-af70646d.js";import"./shared-17a61265.js";import"./shared-9803aa7c.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";let d,l=e=>e;const h=r(s(n));class c extends h{constructor(){super(),this.props={},this.__pageFetchEventHandler=e=>this.__handlePageFetchEvent(e),this.item="foxy-null"}static get properties(){return e(e({},super.properties),{},{props:{type:Object},item:{type:String}})}get item(){return this.__item}set item(e){const t=null!=e?e:"foxy-null";this.__renderItem="string"==typeof t?new Function("ctx",`return ctx.html\`\n <${t}\n disabledcontrols=\${ctx.disabledControls.toString()}\n readonlycontrols=\${ctx.readonlyControls.toString()}\n hiddencontrols=\${ctx.hiddenControls.toString()}\n data-testclass="items"\n related=\${JSON.stringify(ctx.related)}\n parent=\${ctx.parent}\n group=\${ctx.group}\n href=\${ctx.href}\n lang=\${ctx.lang}\n ns="\${ctx.ns} \${customElements.get('${t}')?.defaultNS ?? ''}"\n ?disabled=\${ctx.disabled}\n ?readonly=\${ctx.readonly}\n ?hidden=\${ctx.hidden}\n .simplifyNsLoading=\${ctx.simplifyNsLoading}\n .templates=\${ctx.templates}\n ...=\${ctx.spread(ctx.props)}\n >\n </${t}>\``):t,this.__item=e,this.requestUpdate()}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__pageFetchEventHandler)}render(){let e=[];return e=this.in("busy")?[{key:"stalled",href:"foxy://collection-page/stall",data:null}]:this.in("fail")?[{key:"failed",href:"foxy://collection-page/fail",data:null}]:this.in({idle:"template"})||0===this.__items.length?[{key:"empty",href:"",data:null}]:this.__items.map((e=>({key:e._links.self.href,href:e._links.self.href,data:e}))),t(d||(d=l`${0}`),a(e,(e=>e.key),((s,r)=>{var i,n,a,d,l;return null===(i=this.__renderItem)||void 0===i?void 0:i.call(this,{simplifyNsLoading:this.simplifyNsLoading,disabledControls:this.disabledControls,readonlyControls:this.readonlyControls,hiddenControls:this.hiddenControls,templates:this.templates,disabled:this.disabled,readonly:this.readonly,previous:null!==(a=null===(n=e[r-1])||void 0===n?void 0:n.data)&&void 0!==a?a:null,related:this.related,hidden:this.hidden,parent:this.href,spread:o,props:this.props,group:this.group,lang:this.lang,data:s.data,href:s.href,next:null!==(l=null===(d=e[r+1])||void 0===d?void 0:d.data)&&void 0!==l?l:null,ns:this.ns,html:t})})))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__pageFetchEventHandler)}get __items(){var e,t;return Array.from(Object.values(null!==(t=null===(e=this.form)||void 0===e?void 0:e._embedded)&&void 0!==t?t:{})).reduce(((e,t)=>[...e,...t]),[])}__handlePageFetchEvent(e){if(!(e instanceof i)||e.target===this)return;const{method:t,url:s}=e.request;return"GET"===t?"foxy://collection-page/stall"===s?this.__stallRequest(e):"foxy://collection-page/fail"===s?this.__failRequest(e):void 0:void 0}__stallRequest(e){e.stopImmediatePropagation(),e.respondWith(new Promise((()=>{})))}__failRequest(e){e.stopImmediatePropagation(),e.respondWith(Promise.resolve(new Response(null,{status:500})))}}customElements.define("foxy-collection-page",c);export{c as CollectionPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-12c2e2c7.js";import"./foxy-collection-page.js";import"./shared-af70646d.js";import{o as e,aE as t,_ as s,R as r}from"./shared-d1195c27.js";import{h as a,L as i}from"./shared-dc73b9a5.js";import{C as n}from"./shared-d1cb97c6.js";import{F as o}from"./shared-343d1fd7.js";import{N as d,s as l}from"./shared-2ad18636.js";import{r as c}from"./shared-a0c6a159.js";import{I as h}from"./shared-17a61265.js";import{i as p}from"./shared-fcdb896f.js";import{s as u}from"./shared-99940888.js";import"./shared-555c2785.js";import"./shared-bd59ddc4.js";import"./shared-001dfdb6.js";import"./shared-960eac62.js";import"./shared-61ade33e.js";import"./foxy-spinner.js";import"./shared-f23cde6c.js";import"./shared-11902e83.js";import"./shared-9803aa7c.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";const _=e({manual:(e,t)=>t.data}),g=e({error:(e,t)=>t.data}),m=e({first:(e,t)=>t.data,pages:[],error:null}),f=e({first:(e,t)=>{var s,r;return null!==(r=null===(s=t.data[0])||void 0===s?void 0:s._links.self.href)&&void 0!==r?r:""},pages:(e,t)=>t.data,error:null}),v=e({pages:(e,t)=>0===t.data.returned_items?e.pages:[...e.pages,t.data]}),y=e=>e.manual,x=t({id:"pages",initial:"idle",context:{first:"",pages:[],error:null,manual:!1},states:{busy:{invoke:{src:"sendGet",onError:{target:"fail",actions:g},onDone:[{target:"idle.empty",cond:(e,t)=>0==t.data.total_items},{target:"idle.end",cond:(e,t)=>t.data.returned_items<t.data.limit,actions:v},{target:"idle.paused.manual",cond:y,actions:v},{target:"idle.paused.auto",actions:v}]},on:{SET_MANUAL:{actions:_}}},fail:{on:{SET_MANUAL:{actions:_}}},idle:{initial:"empty",states:{paused:{states:{auto:{invoke:{src:"observeChildren"}},manual:{}},on:{RESUME:"#pages.busy",SET_MANUAL:[{cond:y,actions:_,target:".manual"},{actions:_,target:".auto"}]}},empty:{on:{SET_MANUAL:{actions:_}}},end:{on:{SET_MANUAL:{actions:_}}}}}},on:{SET_FIRST:[{cond:(e,t)=>0===t.data.trim().length,target:"idle.empty",actions:m},{target:"busy",actions:m}],SET_PAGES:[{cond:(e,t)=>0===t.data.length,target:"idle.empty",actions:f},{target:"idle.paused",actions:f}]}});let E,b,k,S=e=>e;const j=n(h(i));class R extends j{constructor(){var e;super(),e=this,this.props={},this.lang="",this.ns="",this.__group="",this.__fetchEventHandler=e=>this.__handleFetchEvent(e),this.__service=p(x.withConfig({services:{observeChildren:()=>e=>{const t=new IntersectionObserver((t=>{t.some((e=>e.isIntersecting))&&e("RESUME")}));return t.observe(this.renderRoot.children[this.renderRoot.children.length-1]),()=>t.disconnect()},sendGet:async function(t){var s;const r=t.pages[t.pages.length-1],a=null!==(s=null==r?void 0:r._links.next.href)&&void 0!==s?s:t.first,i=await new d.API(e).fetch(a);if(!i.ok)throw i;const n=await i.json();return e.__stopTrackingRumour(),d.Rumour(e.group).share({source:n._links.self.href,data:n}),e.__trackRumour(),n}}})),this.page="foxy-collection-page foxy-null"}static get properties(){return s(s({},super.properties),{},{manual:{type:Boolean,reflect:!0},first:{type:String,noAccessor:!0},pages:{type:Array,noAccessor:!0},group:{type:String},props:{type:Object},lang:{type:String},page:{type:String},ns:{type:String}})}get page(){return this.__page}set page(e){if("string"==typeof e){const t=e.split(" ").pop(),s=t?`item="${t}"`:"";this.__renderPage=new Function("ctx",`return ctx.html\`\n <${e}\n disabledcontrols=\${ctx.disabledControls.toString()}\n readonlycontrols=\${ctx.readonlyControls.toString()}\n hiddencontrols=\${ctx.hiddenControls.toString()}\n group=\${ctx.group}\n href=\${ctx.href}\n lang=\${ctx.lang}\n ns="\${ctx.ns} \${customElements.get('${e}')?.defaultNS ?? ''}"\n ${s}\n ?disabled=\${ctx.disabled}\n ?readonly=\${ctx.readonly}\n ?hidden=\${ctx.hidden}\n .templates=\${ctx.templates}\n ...=\${ctx.spread(ctx.props)}\n >\n </${e}>\``)}else this.__renderPage=e;this.__page=e,this.requestUpdate()}get first(){var e,t;return null!==(t=null===(e=this.__service.state)||void 0===e?void 0:e.context.first)&&void 0!==t?t:""}set first(e){this.__service.send({type:"SET_FIRST",data:e})}get pages(){var e,t;return null!==(t=null===(e=this.__service.state)||void 0===e?void 0:e.context.pages)&&void 0!==t?t:[]}set pages(e){this.__service.send({type:"SET_PAGES",data:e})}get group(){return this.__group}set group(e){var t;this.__group=e,null===(t=this.__stopTrackingRumour)||void 0===t||t.call(this),this.__trackRumour()}get manual(){var e;return!!(null===(e=this.__service.state)||void 0===e?void 0:e.context.manual)}set manual(e){this.__service.send({type:"SET_MANUAL",data:e})}in(e){var t;return!!(null===(t=this.__service.state)||void 0===t?void 0:t.matches(e))}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__fetchEventHandler),this.__createService(),this.__trackRumour()}render(){var e,t,s;const r=this.pages.map((e=>({key:e._links.self.href,href:e._links.self.href})));return(null===(e=this.__service.state)||void 0===e?void 0:e.matches("busy"))?r.push({key:"stalled",href:"foxy://collection-pages/stall"}):(null===(t=this.__service.state)||void 0===t?void 0:t.matches("fail"))?r.push({key:"failed",href:"foxy://collection-pages/fail"}):(null===(s=this.__service.state)||void 0===s?void 0:s.matches({idle:"empty"}))&&r.push({key:"empty",href:""}),a(E||(E=S` ${0} ${0} `),c(r,(e=>e.key),((e,t)=>{var s;return this.__renderPage({disabledControls:this.disabledControls,readonlyControls:this.readonlyControls,hiddenControls:this.hiddenControls,templates:this.templates,disabled:this.disabled,readonly:this.readonly,hidden:this.hidden,spread:u,props:this.props,group:this.group,data:null!==(s=this.pages[t])&&void 0!==s?s:null,href:e.href,lang:this.lang,ns:this.ns,html:a})})),this.manual?this.in({idle:"paused"})?a(b||(b=S` <vaadin-button theme="small contrast" @click="${0}"> <foxy-i18n lang="${0}" key="load_more" ns="${0}"></foxy-i18n> </vaadin-button> `),(()=>this.__service.send("RESUME")),this.lang,this.ns):"":a(k||(k=S` <span></span> `)))}updated(e){super.updated(e),this.dispatchEvent(new d.UpdateEvent)}disconnectedCallback(){var e;super.disconnectedCallback(),this.removeEventListener("fetch",this.__fetchEventHandler),this.__service.stop(),null===(e=this.__stopTrackingRumour)||void 0===e||e.call(this)}__trackRumour(){this.__stopTrackingRumour=d.Rumour(this.group).track((e=>{try{0===this.pages.length?e({_links:{self:{href:this.first}}}):this.pages.map((t=>e(t)))}catch(e){if(!(e instanceof r.UpdateError))throw e;this.__service.send({type:"SET_FIRST",data:this.first})}}))}__createService(){this.__service.onTransition((({changed:e})=>e&&this.requestUpdate())).onChange((()=>this.requestUpdate())).start()}__handleFetchEvent(e){if(!(e instanceof o)||e.target===this)return;const{method:t,url:s}=e.request;return"GET"===t?"foxy://collection-pages/stall"===s?this.__stallRequest(e):"foxy://collection-pages/fail"===s?this.__failRequest(e):void this.__respondIfPossible(e):void 0}__respondIfPossible(e){const t=l(e.request.url,this.pages);t.ok&&(e.respondWith(Promise.resolve(t)),console.debug(`%c@foxy.io/elements::${this.localName}\n%c200%c GET ${e.request.url}`,"color: gray","background: gray; padding: 0 .2em; border-radius: .2em; color: white;",""))}__stallRequest(e){e.stopImmediatePropagation(),e.respondWith(new Promise((()=>{})))}__failRequest(e){var t;const s=null===(t=this.__service.state)||void 0===t?void 0:t.context.error,r=null!=s?s:new Response("Unknown error, details unavailable.",{status:500});e.stopImmediatePropagation(),e.respondWith(Promise.resolve(r))}}customElements.define("foxy-collection-pages",R);export{R as CollectionPages};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-08e7b7e5.js";import"./shared-11902e83.js";import"./shared-f23cde6c.js";import"./shared-af70646d.js";import{_ as t}from"./shared-d1195c27.js";import{c as o,h as e,L as i}from"./shared-dc73b9a5.js";import{a as s}from"./shared-001dfdb6.js";import{C as r}from"./shared-d1cb97c6.js";import{I as n}from"./shared-17a61265.js";import{i as a}from"./shared-9803aa7c.js";import"./shared-bd59ddc4.js";import"./shared-960eac62.js";import"./shared-555c2785.js";import"./shared-20b733ff.js";import"./shared-343d1fd7.js";let c,d,l,h,p=t=>t;const u=r(s(n(i),"copy-to-clipboard"));class b extends u{constructor(){super(...arguments),this.layout=null,this.theme=null,this.icon=null,this.text=null,this.__state="idle"}static get properties(){return t(t({},super.properties),{},{layout:{},theme:{},text:{type:String},icon:{type:String},__state:{attribute:!1}})}static get styles(){return o(c||(c=p`.icon-button{position:relative;appearance:none;background:0 0;border:none;border-radius:var(--lumo-border-radius-s);color:inherit;font-size:inherit;padding:0;width:1.5em;height:1.5em;display:flex;justify-content:center;align-items:center}.icon-button::before{position:absolute;inset:0;content:' ';display:block;background:currentColor;opacity:.08;transition:opacity .15s ease;border-radius:var(--lumo-border-radius-s)}.icon-button:focus{outline:0;box-shadow:0 0 0 2px currentColor}.icon-button:disabled{opacity:.5;cursor:default}@media (hover:hover){.icon-button:not(:disabled):hover{cursor:pointer}.icon-button:not(:disabled):hover::before{opacity:.16}}iron-icon{--iron-icon-height:1em;--iron-icon-width:1em}`))}render(){var t,o;const i="text"===this.layout?"text":"icon";let s="",r="";return"busy"===this.__state?(s="copying",r="icons:hourglass-empty"):"fail"===this.__state?(s="failed_to_copy",r="icons:error-outline"):"done"===this.__state?(s="done",r="icons:done"):(s="click_to_copy",r=null!==(t=this.icon)&&void 0!==t?t:"icons:content-copy"),e(d||(d=p` ${0} `),"icon"===i?e(l||(l=p` <button id="trigger" class="icon-button" ?disabled="${0}" @click="${0}"> <iron-icon icon="${0}"></iron-icon> </button> <vcf-tooltip position="bottom" style="--lumo-base-color:black" theme="light" for="trigger"> <span class="text-s" style="color:#fff"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </span> </vcf-tooltip> `),this.disabled,this.__copy,r,s):e(h||(h=p` <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-button> `),a(null!==(o=this.theme)&&void 0!==o?o:void 0),this.disabled,this.__copy,s))}__copy(){var t;"idle"===this.__state&&(this.__state="busy",navigator.clipboard.writeText(null!==(t=this.text)&&void 0!==t?t:"").then((()=>this.__state="done")).catch((()=>this.__state="fail")).then((()=>setTimeout((()=>this.__state="idle"),2e3))))}}customElements.define("foxy-copy-to-clipboard",b);export{b as CopyToClipboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-af70646d.js";import{h as t}from"./shared-dc73b9a5.js";import{C as s}from"./shared-d1cb97c6.js";import{N as e}from"./shared-2ad18636.js";import{T as i,a}from"./shared-001dfdb6.js";import{c as r}from"./shared-4e709717.js";import"./shared-f23cde6c.js";import"./shared-bd59ddc4.js";import"./shared-11902e83.js";import"./shared-d1195c27.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-9803aa7c.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";let d,n,o,l,c,p,h,m=t=>t;const u=i(s(a(e,"coupon-card")));class f extends u{render(){var s,e;const i=this.hiddenSelector;return t(d||(d=m` <div aria-busy="${0}" aria-live="polite" class="relative leading-m font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),r({"transition-opacity":!0,"opacity-0":!this.data}),i.matches("title",!0)?"":this.__renderTitle(),i.matches("description",!0)?"":this.__renderDescription(),i.matches("status",!0)?"":this.__renderStatus(),r({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(e=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==e?e:"")}__renderTitle(){var s,e,i,a,r,d;const l=null!==(e=null===(s=this.data)||void 0===s?void 0:s.number_of_uses_to_date)&&void 0!==e?e:0,c=null!==(a=null===(i=this.data)||void 0===i?void 0:i.number_of_uses_allowed)&&void 0!==a?a:0;return t(n||(n=m` <div data-testid="title"> ${0} <div class="flex items-center justify-between"> <div class="font-medium truncate">${0}</div> <foxy-i18n options="${0}" class="text-tertiary text-s flex-shrink-0" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("title:before"),null!==(d=null===(r=this.data)||void 0===r?void 0:r.name)&&void 0!==d?d:t(o||(o=m`​`)),JSON.stringify({count:l,total:c}),this.lang,0===c?"uses_count":"uses_to_total_count",this.ns,this.renderTemplateOrSlot("title:after"))}__renderDescription(){let s=null;if(this.data){const e=this.data.coupon_discount_details,i=this.data.coupon_discount_type,a=this.ns;s=t(l||(l=m` <foxy-i18n options="${0}" lang="${0}" key="discount_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify({params:{details:e,type:i,ns:a}}),this.lang,this.ns)}return t(c||(c=m` <div data-testid="description"> ${0} <div class="truncate text-s text-secondary">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),null!=s?s:t(p||(p=m`​`)),this.renderTemplateOrSlot("description:after"))}__renderStatus(){var s;const{start_date:e,end_date:i}=null!==(s=this.data)&&void 0!==s?s:{},a=e&&i?"complete":e?"from":i?"until":"any";return t(h||(h=m` <div data-testid="status"> ${0} <foxy-i18n options="${0}" class="block truncate text-s text-tertiary" lang="${0}" key="date_range_${0}" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({start:e,end:i}),this.lang,a,this.ns,this.renderTemplateOrSlot("status:after"))}}customElements.define("foxy-coupon-card",f);export{f as CouponCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-03427c91.js";import"./shared-af70646d.js";import{a as s}from"./shared-001dfdb6.js";import{I as e}from"./shared-1183a365.js";import{h as t}from"./shared-dc73b9a5.js";import"./foxy-spinner.js";import"./shared-f23cde6c.js";import"./shared-bd59ddc4.js";import"./shared-11902e83.js";import"./shared-d1195c27.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";let r,o=s=>s;const a=s(e,"coupon-code-card");class d extends a{renderBody(){var s;return t(r||(r=o` <section class="h-s flex flex-col justify-center leading-xs"> <p class="flex items-center justify-between min-w-0"> <foxy-i18n infer="" class="block truncate text-m font-medium" key="line_1" .options="${0}"> </foxy-i18n> <foxy-i18n infer="" class="text-s text-tertiary" key="uses_count" .options="${0}"> </foxy-i18n> </p> <p class="text-s text-secondary min-w-0"> <foxy-i18n infer="" class="block truncate" key="line_2" .options="${0}"> </foxy-i18n> </p> </section> `),this.data,{count:null===(s=this.data)||void 0===s?void 0:s.number_of_uses_to_date},this.data)}}customElements.define("foxy-coupon-code-card",d);export{d as CouponCodeCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-5f00bc80.js";import"./shared-0e58c95c.js";import{I as r}from"./shared-0ec6badf.js";import"./foxy-transaction-card.js";import{_ as e,B as s}from"./shared-d1195c27.js";import{a as o}from"./shared-001dfdb6.js";import{i as t}from"./shared-9803aa7c.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-555c2785.js";import"./shared-bd59ddc4.js";import"./shared-f23cde6c.js";import"./shared-960eac62.js";import"./shared-b7ee8271.js";import"./shared-61ade33e.js";import"./shared-e24f4d30.js";import"./shared-10674b72.js";import"./shared-b8bdf3ae.js";import"./shared-12c2e2c7.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-11902e83.js";import"./shared-af70646d.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-ca0700a7.js";import"./shared-51415f88.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-1e827d8b.js";import"./shared-51c4a6dd.js";import"./shared-0e80f20c.js";import"./shared-68470d06.js";import"./shared-b4b7767a.js";import"./shared-8f8c3902.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-08e7b7e5.js";import"./shared-20b733ff.js";import"./shared-bab2ea2c.js";import"./shared-03427c91.js";import"./shared-1183a365.js";let i,d=r=>r;const c=o(r,"coupon-code-form");class n extends c{constructor(){super(...arguments),this.getTransactionPageHref=null}static get properties(){return e(e({},super.properties),{},{getTransactionPageHref:{attribute:!1}})}static get v8n(){return[({code:r})=>!!r||"code:v8n_required",({code:r})=>!r||r.length<=50||"code:v8n_too_long",({code:r})=>!(null==r?void 0:r.includes(" "))||"code:v8n_has_spaces"]}get hiddenSelector(){const r=[super.hiddenSelector.toString()];return this.href||r.unshift("transactions"),new s(r.join(" ").trim())}renderBody(){var r,e;let s;try{const o=new URL(null!==(e=null===(r=this.data)||void 0===r?void 0:r._links["fx:coupon_code_transactions"].href)&&void 0!==e?e:"");o.searchParams.set("zoom","items"),s=o.toString()}catch(r){s=void 0}return a(i||(i=d` ${0} <foxy-internal-text-control infer="code"></foxy-internal-text-control> <foxy-internal-async-list-control first="${0}" infer="transactions" limit="5" item="foxy-transaction-card" .getPageHref="${0}" hide-delete-button> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),t(s),this.getTransactionPageHref,super.renderBody())}}customElements.define("foxy-coupon-code-form",n);export{n as CouponCodeForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-3e302c9e.js";import{I as e}from"./shared-0ec6badf.js";import{a as s}from"./shared-001dfdb6.js";import{B as r}from"./shared-d1195c27.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-08e7b7e5.js";import"./shared-bd59ddc4.js";import"./shared-960eac62.js";import"./shared-555c2785.js";import"./shared-f23cde6c.js";import"./shared-20b733ff.js";import"./shared-1e827d8b.js";import"./shared-51c4a6dd.js";import"./shared-af70646d.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-12c2e2c7.js";import"./shared-61ade33e.js";import"./shared-ca0700a7.js";import"./shared-51415f88.js";import"./foxy-copy-to-clipboard.js";import"./shared-11902e83.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let t,d=e=>e;const a=s(e,"coupon-codes-form");class i extends a{constructor(){super(...arguments),this.__couponCodesGetValue=()=>{var e,s;return null!==(s=null===(e=this.form.coupon_codes)||void 0===e?void 0:e.map((e=>({value:e}))))&&void 0!==s?s:[]},this.__couponCodesSetValue=e=>{this.edit({coupon_codes:e.map((({value:e})=>e.split(" ").map((e=>e.trim())))).flat().filter(((e,s,r)=>r.indexOf(e)===s))})}}static get v8n(){return[({coupon_codes:e})=>e&&e.length>0||"coupon-codes:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("coupon-codes"),new r(e.join(" ").trim())}get hiddenSelector(){const e=["delete timestamps",super.hiddenSelector.toString()];return new r(e.join(" ").trim())}renderBody(){return o(t||(t=d` <foxy-internal-editable-list-control infer="coupon-codes" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__couponCodesGetValue,this.__couponCodesSetValue,super.renderBody())}async _sendPost(e){const s=JSON.stringify(e),r=await this._fetch(this.parent,{body:s,method:"POST"});return this.status={key:"success"},r}}customElements.define("foxy-coupon-codes-form",i);export{i as CouponCodesForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-af70646d.js";import{h as r}from"./shared-dc73b9a5.js";import{a as s}from"./shared-001dfdb6.js";import{T as e}from"./shared-ad9eae20.js";import"./shared-f23cde6c.js";import"./shared-bd59ddc4.js";import"./shared-11902e83.js";import"./shared-d1195c27.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-1183a365.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";let t,a,c=r=>r;const i=s(e,"coupon-detail-card");class d extends i{constructor(){super(...arguments),this.__currencyDisplay="",this.__currency=""}renderBody(){return super.renderBody({title:s=>r(t||(t=c`${0} • ${0}`),s.name,s.code),subtitle:s=>{let e;try{e=Math.abs(s.amount_per).toLocaleString(this.lang||"en",{maximumFractionDigits:2,minimumFractionDigits:2,currencyDisplay:this.__currencyDisplay,currency:this.__currency,style:"currency"})}catch(r){e="--"}return r(a||(a=c` <span class="${0}">${0}</span> `),s.amount_per>0?"text-success":"text-error",e)}})}async _sendGet(){const r=await super._sendGet(),[s,e]=await Promise.all([super._fetch(r._links["fx:transaction"].href),super._fetch(r._links["fx:store"].href)]);return this.__currency=s.currency_code,this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",r}}customElements.define("foxy-coupon-detail-card",d);export{d as CouponDetailCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-56d1eae5.js";import"./shared-c40a4b0c.js";import"./shared-ed9c9bab.js";import{I as e}from"./shared-55bc51c8.js";import{s as t,p as r}from"./shared-f1b29592.js";import{_ as s,B as o}from"./shared-d1195c27.js";import{O as i,T as n}from"./shared-8874ec69.js";import{c as a}from"./shared-4e709717.js";import{h as l,c as d,s as c}from"./shared-dc73b9a5.js";import"./shared-51bb937b.js";import{R as u,a as m}from"./shared-4efc6bb8.js";import{r as p}from"./shared-a0c6a159.js";import"./shared-25324930.js";import"./shared-b74187e9.js";import"./shared-ac6e1790.js";import"./shared-838cc86b.js";import"./shared-57cc81b4.js";import{I as f}from"./shared-a4b0ccf4.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{i as h}from"./shared-9803aa7c.js";import"./shared-0a24f318.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-e1850e5f.js";import"./shared-64d9ac2a.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-c9f3f8d3.js";import"./foxy-form-dialog.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-045bd59c.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-9e94c56d.js";import"./shared-de45ad84.js";import"./shared-537d2efe.js";import"./shared-906fe068.js";import"./shared-f97ed2ff.js";import"./shared-c6b69d4e.js";import"./shared-34c84b9f.js";import"./shared-c7ffb9f2.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-43e2c3f6.js";import"./shared-bab2ea2c.js";import"./shared-9411a937.js";import"./shared-91560256.js";import"./shared-0f261023.js";import"./shared-9ef03974.js";import"./shared-97e1f413.js";import"./shared-3a066450.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-3491d10e.js";let y,_,x,b,v,g=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.operators=Object.values(i),this.disableOr=!1,this.layout=null}static get properties(){return s(s({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"},layout:{}})}renderControl(){var e;const{label:t,helperText:r,_errorMessage:s}=this,o=s&&!this.disabled&&!this.readonly,i=null!==(e=this.layout)&&void 0!==e?e:"standalone",n=l(y||(y=g` <foxy-query-builder infer="query-builder" class="${0}" style="${0}" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> `),a({"mt-xs":"summary-item"===i}),"summary-item"===i?"--lumo-border-radius: var(--lumo-border-radius-s)":"",this.operators,this._value,this.disableOr,(e=>{var t;const r=e.currentTarget;this._value=null!==(t=r.value)&&void 0!==t?t:""}));return l(_||(_=g` <section class="${0}"> ${0} ${0} ${0} ${0} ${0} </section> `),a({"grid gap-xs leading-xs transition-colors text-secondary":!0,"hover-text-body":"standalone"===i&&!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),t?l(x||(x=g` <p class="${0}"> ${0} </p> `),a({"text-s font-medium":"standalone"===i,"text-m text-body":"summary-item"===i,hidden:!t}),t):"","standalone"===i?n:"",r?l(b||(b=g`<p class="text-xs">${0}</p>`),r):"",o?l(v||(v=g`<p class="text-xs text-error">${0}</p>`),s):"","summary-item"===i?n:"")}});let j,$,w,C,k,A,S,V,R,q,T=e=>e;class H extends(u(e)){static get styles(){return[super.styles,d(j||(j=T`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}`))]}renderControl(){const e=l($||($=T` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20"> <foxy-i18n infer="" key="or"></foxy-i18n> </div> <div class="flex-1 border-t border-contrast-10"></div> <div class="w-m ml-s flex-shrink-0"></div> </div> `));return l(w||(w=T` <div class="mb-s" ?hidden="${0}"> <p class="font-medium text-body text-l" ?hidden="${0}">${0}</p> <p class="text-s text-secondary" ?hidden="${0}">${0}</p> </div> <div class="rounded bg-contrast-5" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> <p class="text-s text-error mt-s" ?hidden="${0}"> ${0} </p> `),!this.label&&!this.helperText,!this.label,this.label,!this.helperText,this.helperText,p([...Object.entries(this._value||{}),null],((e,t)=>String(t)),((t,r)=>null===t?[r>0?e:"",this.__renderRule({onChange:({key:e,items:t})=>{var r;this._value=s(s({},this._value),{},{[e]:[...null!==(r=this._value[e])&&void 0!==r?r:[],...t]})}})]:[r>0?e:"",this.__renderRule({rule:{key:t[0],items:t[1]},onChange:e=>{var r,s;const o={},i=Object.keys(this._value);for(let n=0;n<i.length;n++){const a=i[n];if(a===t[0])if(e.key===a)o[a]=e.items;else{const t=null!==(r=this._value[e.key])&&void 0!==r?r:[];n>i.indexOf(e.key)?o[e.key]=[...t,...e.items]:(o[e.key]=[...e.items,...t],i.splice(i.indexOf(e.key),1))}else o[a]=null!==(s=this._value[a])&&void 0!==s?s:[]}this._value=o},onDelete:()=>{const e=s({},this._value);delete e[t[0]],this._value=e}})])),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:{}}set _value(e){super._value=e}__renderRule({rule:e,onDelete:t,onChange:r}){var s,o;const i=null!==(s=null==e?void 0:e.items)&&void 0!==s?s:[];return l(C||(C=T` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base"> <div class="${0}"> <div aria-hidden="true"> ${0} </div> </div> </div> <div class="bg-base"> <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> </div> </div> </div> </div> <div class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent" ?hidden="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> </div> `),this.t("rule"),a({"text-tertiary":!this.readonly&&!this.disabled,"text-disabled":this.readonly||this.disabled,"w-m h-m":!0}),c(k||(k=T`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/></svg>`)),this.__renderInput({value:null!==(o=null==e?void 0:e.key)&&void 0!==o?o:"",label:this.t("option_name"),onChange:e=>{void 0===e?null==t||t():r({key:e,items:i})}}),a({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"cursor-default text-tertiary":!(this.disabled||this.readonly),"text-disabled cursor-default":this.disabled||this.readonly}),c(A||(A=T`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/><path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/></svg>`)),p(this.readonly?i:[...i,null],((e,t)=>t),((t,s)=>l(S||(S=T` <div class="bg-base"> ${0} </div> `),this.__renderInput({value:null!=t?t:"",label:t?String(s+1):this.t("add_value"),onChange:o=>{const n=[...i];o?null===t?n.push(o):n[s]=o:n.splice(s,1),e&&r({key:e.key,items:n})}})))),this.readonly||0===Object.keys(this._value).length,this.t("delete"),a({"box-content flex items-center justify-center":!0,"w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!e}),this.disabled||this.readonly||!e,(()=>null==t?void 0:t()),c(V||(V=T`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)))}__renderInput(e){return l(R||(R=T` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @change="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.label,a({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,this.disabled||this.readonly,(t=>{const r=t.currentTarget;"Backspace"!==t.key||r.value||e.onChange()}),(t=>{t.currentTarget.value||e.onChange()}),(t=>{const r=t.currentTarget;e.onChange(r.value)}),a({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly}),this.t(e.label),this.disabled||this.readonly?"":l(q||(q=T` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}}customElements.define("foxy-internal-array-map-control",H);let O,L,M,I,P,B=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_details)&&void 0!==e?e:"",o=null!==(t=null==r?void 0:r.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",i=this.helperText,n=this.__renderRulesDescription(),d=this._errorMessage;return l(O||(O=B` <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> `),a({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:s,type:o,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,r=this.nucleon;null==r||r.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),i||n?l(L||(L=B` <p class="${0}"> ${0} </p> `),a({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),n||i):"",!d||this.disabled||this.readonly?"":l(M||(M=B`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",o=null!==(t=null==r?void 0:r.form.coupon_discount_details)&&void 0!==t?t:"";return o?this.t("discount_summary",{params:{details:o,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,t=null==e?void 0:e.form.coupon_discount_details,r=null==e?void 0:e.form.coupon_discount_type,o=[{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"}],i=o.find((e=>e.details===t&&e.type===r));return l(I||(I=B` <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> `),a({"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}),i?this.t("discount_summary",{params:s(s({},i),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,r;const s=e.currentTarget,i=o[s.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(r=null==i?void 0:i.type)&&void 0!==r?r:"quantity_amount"})}),o.map((e=>l(P||(P=B` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===i,this.t("discount_summary",{params:s(s({},e),{},{ns:this.ns})})))),!i&&!!t&&!!r,this.t("custom_discount"))}});let z,D,G=e=>e;const Z=u(m(f,"coupon-form"));class E extends Z{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerAttributeRestrictionsGetValue=()=>{var e;const s=new URLSearchParams(t(r(null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:"").filter((e=>Array.isArray(e)||"string"==typeof e.name)).map((e=>{if(Array.isArray(e))return e.filter((({name:e})=>"string"==typeof e)).map((({name:e,operator:t,value:r})=>({path:e,operator:t,value:r})));return{operator:e.operator,value:e.value,path:e.name}}))));return s.delete("zoom"),s.toString()},this.__customerAttributeRestrictionsSetValue=e=>{const s=new URLSearchParams(t(r(e).map((e=>{if(Array.isArray(e))return e.map((({path:e,operator:t,value:r})=>({name:e,path:"attributes",operator:t,value:r})));return{operator:e.operator,value:e.value,path:"attributes",name:e.path}}))));s.delete("zoom"),this.edit({customer_attribute_restrictions:s.toString()})},this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},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.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:n.String},{label:"used_codes",path:"number_of_uses_to_date",type:n.Number},{label:"date_created",path:"date_created",type:n.Date},{label:"date_modified",path:"date_modified",type:n.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return s(s({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),new o(e.join(" ").trim())}get headerSubtitleOptions(){return s(s({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return l(z||(z=G` <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} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,s,o,i,n,a;let d;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),d=r.toString()}catch(e){d=void 0}return l(D||(D=G` ${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-array-map-control infer="item-option-restrictions"> </foxy-internal-array-map-control> <foxy-internal-summary-control infer="customer-restrictions"> <foxy-internal-query-builder-control layout="summary-item" infer="customer-attribute-restrictions" .getValue="${0}" .setValue="${0}"> </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(),d,{".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.__customerAttributeRestrictionsGetValue,this.__customerAttributeRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,h(null===(r=this.data)||void 0===r?void 0:r._links.self.href),h(null===(o=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===o?void 0:o._links["fx:item_categories"].href),h(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),h(null===(n=this.data)||void 0===n?void 0:n._links["fx:attributes"].href),super.renderBody(),h(null===(a=this.data)||void 0===a?void 0:a._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",E);export{E as CouponForm};
|
|
1
|
+
import"./shared-b79fd251.js";import"./shared-e86b8958.js";import"./shared-3e302c9e.js";import{I as e}from"./shared-1e827d8b.js";import{p as t,s as r}from"./shared-35093aea.js";import{_ as s,B as o}from"./shared-d1195c27.js";import{O as i,T as n}from"./shared-8874ec69.js";import{h as a,c as l,s as d}from"./shared-dc73b9a5.js";import"./shared-af70646d.js";import{R as c,a as u}from"./shared-001dfdb6.js";import{c as m}from"./shared-4e709717.js";import{r as p}from"./shared-a0c6a159.js";import"./shared-89db9c39.js";import"./shared-d6bf2433.js";import"./shared-513e54c9.js";import"./shared-0e58c95c.js";import"./shared-fa5e0813.js";import{I as f}from"./shared-0ec6badf.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{i as h}from"./shared-9803aa7c.js";import"./shared-b7ee8271.js";import"./shared-555c2785.js";import"./shared-bd59ddc4.js";import"./shared-960eac62.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-f23cde6c.js";import"./shared-11902e83.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-12c2e2c7.js";import"./foxy-form-dialog.js";import"./shared-ca0700a7.js";import"./shared-51415f88.js";import"./shared-08e7b7e5.js";import"./shared-20b733ff.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-f7474be7.js";import"./shared-b4b7767a.js";import"./shared-8f8c3902.js";import"./shared-0e80f20c.js";import"./shared-68470d06.js";import"./shared-395b2f4c.js";import"./shared-676a6445.js";import"./shared-10674b72.js";import"./shared-65c53765.js";import"./shared-e24f4d30.js";import"./shared-b8bdf3ae.js";import"./shared-acba6fbd.js";import"./shared-09350008.js";import"./shared-43e2c3f6.js";import"./shared-bab2ea2c.js";import"./shared-e95ac70b.js";import"./shared-2d2e210c.js";import"./shared-ad9eae20.js";import"./shared-1183a365.js";import"./shared-03427c91.js";import"./shared-5f00bc80.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-f0c7a963.js";let y,_,b,x,v=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.disableZoom=!1,this.disableOr=!1,this.operators=Object.values(i)}static get properties(){return s(s({},super.properties),{},{disableZoom:{type:Boolean,attribute:"disable-zoom"},disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array}})}renderControl(){const{label:e,helperText:t,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly;return a(y||(y=v` <section class="grid gap-s leading-xs"> <div ?hidden="${0}"> ${0} ${0} </div> <div class="bg-contrast-5 rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-query-builder infer="query-builder" style="--lumo-border-radius:var(--lumo-border-radius-s);--lumo-border-radius-l:var(--lumo-border-radius-s)" .operators="${0}" .value="${0}" ?disable-zoom="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> </div> ${0} </section> `),!e&&!t,e?a(_||(_=v`<p class="text-l font-medium">${0}</p>`),e):"",t?a(b||(b=v`<p class="text-s text-secondary">${0}</p>`),t):"",this.operators,this._value,this.disableZoom,this.disableOr,(e=>{var t;const r=e.currentTarget;this._value=null!==(t=r.value)&&void 0!==t?t:""}),s?a(x||(x=v`<p class="text-s text-error">${0}</p>`),r):"")}});let g,j,$,w,C,k,A,V,R,S,q=e=>e;class O extends(c(e)){static get styles(){return[super.styles,l(g||(g=q`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}`))]}renderControl(){const e=a(j||(j=q` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20"> <foxy-i18n infer="" key="or"></foxy-i18n> </div> <div class="flex-1 border-t border-contrast-10"></div> <div class="w-m ml-s flex-shrink-0"></div> </div> `));return a($||($=q` <div class="mb-s" ?hidden="${0}"> <p class="font-medium text-body text-l" ?hidden="${0}">${0}</p> <p class="text-s text-secondary" ?hidden="${0}">${0}</p> </div> <div class="rounded bg-contrast-5" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> <p class="text-s text-error mt-s" ?hidden="${0}"> ${0} </p> `),!this.label&&!this.helperText,!this.label,this.label,!this.helperText,this.helperText,p([...Object.entries(this._value||{}),null],((e,t)=>String(t)),((t,r)=>null===t?[r>0?e:"",this.__renderRule({onChange:({key:e,items:t})=>{var r;this._value=s(s({},this._value),{},{[e]:[...null!==(r=this._value[e])&&void 0!==r?r:[],...t]})}})]:[r>0?e:"",this.__renderRule({rule:{key:t[0],items:t[1]},onChange:e=>{var r,s;const o={},i=Object.keys(this._value);for(let n=0;n<i.length;n++){const a=i[n];if(a===t[0])if(e.key===a)o[a]=e.items;else{const t=null!==(r=this._value[e.key])&&void 0!==r?r:[];n>i.indexOf(e.key)?o[e.key]=[...t,...e.items]:(o[e.key]=[...e.items,...t],i.splice(i.indexOf(e.key),1))}else o[a]=null!==(s=this._value[a])&&void 0!==s?s:[]}this._value=o},onDelete:()=>{const e=s({},this._value);delete e[t[0]],this._value=e}})])),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:{}}set _value(e){super._value=e}__renderRule({rule:e,onDelete:t,onChange:r}){var s,o;const i=null!==(s=null==e?void 0:e.items)&&void 0!==s?s:[];return a(w||(w=q` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base"> <div class="${0}"> <div aria-hidden="true"> ${0} </div> </div> </div> <div class="bg-base"> <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> </div> </div> </div> </div> <div class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent" ?hidden="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> </div> `),this.t("rule"),m({"text-tertiary":!this.readonly&&!this.disabled,"text-disabled":this.readonly||this.disabled,"w-m h-m":!0}),d(C||(C=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/></svg>`)),this.__renderInput({value:null!==(o=null==e?void 0:e.key)&&void 0!==o?o:"",label:this.t("option_name"),onChange:e=>{void 0===e?null==t||t():r({key:e,items:i})}}),m({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"cursor-default text-tertiary":!(this.disabled||this.readonly),"text-disabled cursor-default":this.disabled||this.readonly}),d(k||(k=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/><path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/></svg>`)),p(this.readonly?i:[...i,null],((e,t)=>t),((t,s)=>a(A||(A=q` <div class="bg-base"> ${0} </div> `),this.__renderInput({value:null!=t?t:"",label:t?String(s+1):this.t("add_value"),onChange:o=>{const n=[...i];o?null===t?n.push(o):n[s]=o:n.splice(s,1),e&&r({key:e.key,items:n})}})))),this.readonly||0===Object.keys(this._value).length,this.t("delete"),m({"box-content flex items-center justify-center":!0,"w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!e}),this.disabled||this.readonly||!e,(()=>null==t?void 0:t()),d(V||(V=q`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)))}__renderInput(e){return a(R||(R=q` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @change="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.label,m({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,this.disabled||this.readonly,(t=>{const r=t.currentTarget;"Backspace"!==t.key||r.value||e.onChange()}),(t=>{t.currentTarget.value||e.onChange()}),(t=>{const r=t.currentTarget;e.onChange(r.value)}),m({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly}),this.t(e.label),this.disabled||this.readonly?"":a(S||(S=q` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}}customElements.define("foxy-internal-array-map-control",O);let T,H,L,I,M,B=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_details)&&void 0!==e?e:"",o=null!==(t=null==r?void 0:r.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",i=this.helperText,n=this.__renderRulesDescription(),l=this._errorMessage;return a(T||(T=B` <section> <div class="mb-s" ?hidden="${0}"> <p class="flex items-center justify-between space-x-m"> <span class="font-medium flex-1 text-l">${0}</span> <span class="min-w-0">${0}</span> </p> <p class="text-s text-secondary">${0}</p> </div> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),!this.label&&!i&&!n,this.label,this.__renderPreset(),i,{details:s,type:o,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,r=this.nucleon;null==r||r.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),n?a(H||(H=B`<p class="text-s text-secondary mt-s">${0}</p>`),n):"",!l||this.disabled||this.readonly?"":a(L||(L=B`<p class="mt-s text-s leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",o=null!==(t=null==r?void 0:r.form.coupon_discount_details)&&void 0!==t?t:"";return o?this.t("discount_summary",{params:{details:o,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,t=null==e?void 0:e.form.coupon_discount_details,r=null==e?void 0:e.form.coupon_discount_type,o=[{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"}],i=o.find((e=>e.details===t&&e.type===r));return a(I||(I=B` <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> `),m({"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}),i?this.t("discount_summary",{params:s(s({},i),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,r;const s=e.currentTarget,i=o[s.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(r=null==i?void 0:i.type)&&void 0!==r?r:"quantity_amount"})}),o.map((e=>a(M||(M=B` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===i,this.t("discount_summary",{params:s(s({},e),{},{ns:this.ns})})))),!i&&!!t&&!!r,this.t("custom_discount"))}});let Z,z,P=e=>e;const D=c(u(f,"coupon-form"));class G extends D{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerAttributeRestrictionsOperators=[i.Not,i.In],this.__customerAttributeRestrictionsGetValue=()=>{var e;const s=t(null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:"").filter((e=>Array.isArray(e)||"string"==typeof e.name)).map((e=>{if(Array.isArray(e))return e.filter((({name:e})=>"string"==typeof e)).map((({name:e,operator:t,value:r})=>({path:e,operator:t,value:r})));return{operator:e.operator,value:e.value,path:e.name}}));return r(s,!0)},this.__customerAttributeRestrictionsSetValue=e=>{const s=t(e).map((e=>{if(Array.isArray(e))return e.map((({path:e,operator:t,value:r})=>({name:e,path:"attributes",operator:t,value:r})));return{operator:e.operator,value:e.value,path:"attributes",name:e.path}}));this.edit({customer_attribute_restrictions:r(s,!0)})},this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},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.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:n.String},{label:"used_codes",path:"number_of_uses_to_date",type:n.Number},{label:"date_created",path:"date_created",type:n.Date},{label:"date_modified",path:"date_modified",type:n.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return s(s({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),new o(e.join(" ").trim())}get headerSubtitleOptions(){return s(s({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return a(Z||(Z=P` <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} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,s,o,i,n,l;let d;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),d=r.toString()}catch(e){d=void 0}return a(z||(z=P` ${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-array-map-control infer="item-option-restrictions"> </foxy-internal-array-map-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions" disable-zoom disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-summary-control infer="auto-apply"> <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(),d,{".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.__customerAttributeRestrictionsOperators,this.__customerAttributeRestrictionsGetValue,this.__customerAttributeRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,h(null===(r=this.data)||void 0===r?void 0:r._links.self.href),h(null===(o=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===o?void 0:o._links["fx:item_categories"].href),h(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),h(null===(n=this.data)||void 0===n?void 0:n._links["fx:attributes"].href),super.renderBody(),h(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",G);export{G as CouponForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-51c4a6dd.js";import"./shared-
|
|
1
|
+
import"./shared-51c4a6dd.js";import"./shared-03427c91.js";import{h as r}from"./shared-dc73b9a5.js";import{a as s}from"./shared-001dfdb6.js";import{T as d}from"./shared-ad9eae20.js";import"./foxy-spinner.js";import"./shared-f23cde6c.js";import"./shared-bd59ddc4.js";import"./shared-11902e83.js";import"./shared-af70646d.js";import"./shared-d1195c27.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-1183a365.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";let e,a,t=r=>r;class o extends(s(d,"custom-field-card")){renderBody(){return super.renderBody({title:s=>r(e||(e=t`${0}`),s.name),subtitle:s=>r(a||(a=t`${0}`),s.value)})}}customElements.define("foxy-custom-field-card",o);export{o as CustomFieldCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-c1c20484.js";import"./shared-2d2e210c.js";import{I as e}from"./shared-0ec6badf.js";import{a as r}from"./shared-001dfdb6.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-b7ee8271.js";import"./shared-555c2785.js";import"./shared-bd59ddc4.js";import"./shared-960eac62.js";import"./shared-61ade33e.js";import"./shared-68470d06.js";import"./shared-f23cde6c.js";import"./shared-1e827d8b.js";import"./shared-51c4a6dd.js";import"./shared-af70646d.js";import"./shared-d1195c27.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-12c2e2c7.js";import"./shared-ca0700a7.js";import"./shared-51415f88.js";import"./shared-4e709717.js";import"./foxy-copy-to-clipboard.js";import"./shared-08e7b7e5.js";import"./shared-20b733ff.js";import"./shared-11902e83.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let i,t=e=>e;const o=r(e,"custom-field-form");class d extends o{constructor(){super(...arguments),this.__visibilityGetValue=()=>this.form.is_hidden?["hidden"]:[],this.__visibilitySetValue=e=>{this.edit({is_hidden:e.includes("hidden")})},this.__visibilityOptions=[{label:"option_hidden",value:"hidden"}]}static get v8n(){return[({value:e})=>e&&e.length>0||"value:v8n_required",({value:e})=>!e||e.length<=700||"value:v8n_too_long",({name:e})=>e&&e.length>0||"name:v8n_required",({name:e})=>!e||e.length<=100||"name:v8n_too_long"]}renderBody(){return s(i||(i=t` ${0} <foxy-internal-source-control infer="name"></foxy-internal-source-control> <foxy-internal-source-control infer="value"></foxy-internal-source-control> <foxy-internal-checkbox-group-control infer="visibility" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.renderHeader(),this.__visibilityGetValue,this.__visibilitySetValue,this.__visibilityOptions,super.renderBody())}}customElements.define("foxy-custom-field-form",d);export{d as CustomFieldForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-af70646d.js";import{h as e}from"./shared-dc73b9a5.js";import{C as t}from"./shared-d1cb97c6.js";import{N as s}from"./shared-2ad18636.js";import{T as a,a as i}from"./shared-001dfdb6.js";import{c as r}from"./shared-4e709717.js";import"./shared-f23cde6c.js";import"./shared-bd59ddc4.js";import"./shared-11902e83.js";import"./shared-d1195c27.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-9803aa7c.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";let d,o,n,l,m,c,h,p=e=>e;const v=a(t(i(s,"customer-card")));class f extends v{render(){var t,s;const a=this.hiddenSelector;return e(d||(d=p` <div aria-busy="${0}" aria-live="polite" class="relative leading-m font-lumo text-m"> <div class="${0}"> ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),r({"leading-xs transition-opacity":!0,"opacity-0":!this.data}),a.matches("name",!0)?"":this.__renderName(),a.matches("email",!0)?"":this.__renderEmail(),r({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==s?s:"")}__renderName(){var t,s,a,i,r;const d=this.data,m=`${null!==(t=null==d?void 0:d.first_name)&&void 0!==t?t:""} ${null!==(s=null==d?void 0:d.last_name)&&void 0!==s?s:""}`.trim()||"–",c=d?e(o||(o=p`${0}`),m):e(n||(n=p`​`));let h;try{h=null!==(r=new URL(null!==(i=null===(a=this.data)||void 0===a?void 0:a._links.self.href)&&void 0!==i?i:"").pathname.split("/").pop())&&void 0!==r?r:""}catch(e){h=""}return e(l||(l=p` <div data-testid="name"> ${0} <div class="flex items-center gap-m"> <div class="font-medium text-body truncate mr-auto">${0}</div> <div class="text-tertiary text-s">ID ${0}</div> </div> ${0} </div> `),this.renderTemplateOrSlot("name:before"),c,h,this.renderTemplateOrSlot("name:after"))}__renderEmail(){var t;const s=this.data,a=`${null!==(t=null==s?void 0:s.email)&&void 0!==t?t:""}`.trim()||"–",i=s?e(m||(m=p`${0}`),a):e(c||(c=p`​`));return e(h||(h=p` <div data-testid="email"> ${0} <div class="text-secondary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("email:before"),i,this.renderTemplateOrSlot("email:after"))}}customElements.define("foxy-customer-card",f);export{f as CustomerCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-3491d10e.js";import"./shared-787e52c4.js";import"./shared-838cc86b.js";import{I as t}from"./shared-a4b0ccf4.js";import{a as e}from"./shared-55bc51c8.js";import"./shared-51bb937b.js";import{i as s}from"./shared-9803aa7c.js";import{h as o}from"./shared-dc73b9a5.js";import{c as r,_ as i,B as a}from"./shared-d1195c27.js";import{S as n,a as d}from"./shared-4efc6bb8.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./shared-de45ad84.js";import"./shared-e1850e5f.js";import"./shared-1cd2db2d.js";import"./shared-011d6240.js";import"./shared-9e94c56d.js";import"./shared-d8cd61ed.js";import"./shared-22ba9566.js";import"./shared-c9f3f8d3.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./foxy-copy-to-clipboard.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-64d9ac2a.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-2ad18636.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.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),i=document.createElement("script");return i.src=r,i.async=!0,i.defer=!0,i.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${r}"`;console.error(e,t),o(e)},document.head.appendChild(i),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 i=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&i.push({regex:`[${o}]`,message:"symbol"});let a={};a.contains=i.filter((t=>new RegExp(`${t.regex}`).test(r))).map((t=>t.message)),a.length=r.length;let n=s.filter((t=>a.contains.length>=t.minDiversity)).filter((t=>a.length>=t.minLength)).sort(((t,e)=>e.id-t.id)).map((t=>({id:t.id,value:t.value})));return Object.assign(a,n[0]),a};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.__passwordGeneratorOptions={checkStrength:t=>y(t).id>=2},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 i(i({},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 a(Array.from(t).join(" ").trim())}get headerTitleOptions(){var t,e;const s=this.data;return!s||(null===(t=s.first_name)||void 0===t?void 0:t.trim())||(null===(e=s.last_name)||void 0===e?void 0:e.trim())?super.headerTitleOptions:i(i({},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 i(i({},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 i=this.hiddenSelector.matches("first-name",!0),a=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 .generatorOptions="${0}"> </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":!i&&!a,hidden:i&&a,"gap-m":!0,grid:!i||!a}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__passwordGeneratorOptions,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-f0c7a963.js";import"./shared-a62af87b.js";import"./shared-0e58c95c.js";import{I as t}from"./shared-0ec6badf.js";import{a as e}from"./shared-1e827d8b.js";import"./shared-af70646d.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-d1195c27.js";import{S as n,a as d}from"./shared-001dfdb6.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-555c2785.js";import"./shared-bd59ddc4.js";import"./shared-960eac62.js";import"./shared-61ade33e.js";import"./shared-68470d06.js";import"./shared-f23cde6c.js";import"./shared-32af1656.js";import"./shared-b4b7767a.js";import"./shared-0e80f20c.js";import"./shared-8f8c3902.js";import"./shared-22ba9566.js";import"./shared-12c2e2c7.js";import"./shared-ca0700a7.js";import"./shared-51415f88.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./foxy-copy-to-clipboard.js";import"./shared-08e7b7e5.js";import"./shared-20b733ff.js";import"./shared-11902e83.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-2ad18636.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.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.__passwordGeneratorOptions={checkStrength:t=>y(t).id>=2},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(){var t,e;const s=this.data;return!s||(null===(t=s.first_name)||void 0===t?void 0:t.trim())||(null===(e=s.last_name)||void 0===e?void 0:e.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 .generatorOptions="${0}"> </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.__passwordGeneratorOptions,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-0e44bfff.js";import"./shared-ed9c9bab.js";import"./shared-3a066450.js";import"./shared-85989cf3.js";import"./shared-787e52c4.js";import{I as e}from"./shared-a4b0ccf4.js";import"./shared-91560256.js";import{a as t}from"./shared-4efc6bb8.js";import{B as i}from"./shared-d1195c27.js";import{p as s}from"./shared-73c1d31e.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-97e1f413.js";import{p as n}from"./shared-51bb937b.js";import{I as a}from"./shared-9ef03974.js";import"./shared-3491d10e.js";import"./shared-0a24f318.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./shared-de45ad84.js";import"./shared-e1850e5f.js";import"./shared-55bc51c8.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-17a61265.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-34c84b9f.js";import"./shared-f97ed2ff.js";import"./shared-c7ffb9f2.js";import"./shared-c9f3f8d3.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-64d9ac2a.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./foxy-pagination.js";import"./shared-045bd59c.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-9e94c56d.js";import"./shared-9411a937.js";import"./shared-be093279.js";import"./shared-f0d70be1.js";import"./shared-906fe068.js";import"./shared-651c44fa.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-1cd2db2d.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-c1c20484.js";import"./shared-3e302c9e.js";import"./shared-5f00bc80.js";import"./shared-94965d32.js";import"./shared-a62af87b.js";import{I as e}from"./shared-0ec6badf.js";import"./shared-2d2e210c.js";import{a as t}from"./shared-001dfdb6.js";import{B as i}from"./shared-d1195c27.js";import{p as s}from"./shared-7c1d9bf8.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-03427c91.js";import{p as n}from"./shared-af70646d.js";import{I as a}from"./shared-1183a365.js";import"./shared-f0c7a963.js";import"./shared-b7ee8271.js";import"./shared-555c2785.js";import"./shared-bd59ddc4.js";import"./shared-960eac62.js";import"./shared-61ade33e.js";import"./shared-68470d06.js";import"./shared-f23cde6c.js";import"./shared-1e827d8b.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-17a61265.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-08e7b7e5.js";import"./shared-20b733ff.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-e24f4d30.js";import"./shared-10674b72.js";import"./shared-b8bdf3ae.js";import"./shared-12c2e2c7.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-11902e83.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-ca0700a7.js";import"./shared-51415f88.js";import"./foxy-pagination.js";import"./shared-f7474be7.js";import"./shared-b4b7767a.js";import"./shared-8f8c3902.js";import"./shared-0e80f20c.js";import"./shared-e95ac70b.js";import"./shared-68ae5d92.js";import"./shared-394d6660.js";import"./shared-676a6445.js";import"./shared-651c44fa.js";import"./shared-acba6fbd.js";import"./shared-09350008.js";import"./shared-32af1656.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 p=t(a);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-card",class extends p{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 f,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(f||(f=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},p={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")},f=`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,p,f,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};
|