@foxy.io/elements 1.29.0 → 1.30.0-beta.2
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-form.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-form.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- package/dist/cdn/foxy-client-form.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-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-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-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-form.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-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +3 -3
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.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-form.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-sign-in-form.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-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-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-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-cfb33387.js → shared-01f18104.js} +1 -1
- package/dist/cdn/{shared-3483c729.js → shared-09fc6fa0.js} +1 -1
- package/dist/cdn/{shared-8bb3eb45.js → shared-1729e19a.js} +1 -1
- package/dist/cdn/{shared-fe4a2e3d.js → shared-19f46691.js} +1 -1
- package/dist/cdn/{shared-38f0bda5.js → shared-2bd96ec7.js} +2 -2
- package/dist/cdn/{shared-a97c3129.js → shared-2d75f154.js} +1 -1
- package/dist/cdn/{shared-8526ed32.js → shared-3b975a29.js} +1 -1
- package/dist/cdn/{shared-ae00ce7c.js → shared-3cf043a7.js} +1 -1
- package/dist/cdn/{shared-0ad0fb9f.js → shared-41e7554e.js} +1 -1
- package/dist/cdn/{shared-ee2cda29.js → shared-471e77dd.js} +1 -1
- package/dist/cdn/{shared-1467a889.js → shared-476827c7.js} +1 -1
- package/dist/cdn/{shared-75331d5e.js → shared-4a652d60.js} +1 -1
- package/dist/cdn/{shared-22ba950a.js → shared-4d172731.js} +1 -1
- package/dist/cdn/{shared-70747a5c.js → shared-5721fb53.js} +1 -1
- package/dist/cdn/{shared-376784f0.js → shared-5bc86d84.js} +1 -1
- package/dist/cdn/shared-6d11abd7.js +280 -0
- package/dist/cdn/{shared-13203be0.js → shared-6f4fa343.js} +1 -1
- package/dist/cdn/{shared-f21254a3.js → shared-6f877b15.js} +1 -1
- package/dist/cdn/{shared-d0e4d7b1.js → shared-73045804.js} +1 -1
- package/dist/cdn/{shared-f4abc29a.js → shared-787e8da4.js} +1 -1
- package/dist/cdn/{shared-9a22d597.js → shared-7dd710e4.js} +1 -1
- package/dist/cdn/{shared-970d98db.js → shared-8fbebf38.js} +1 -1
- package/dist/cdn/{shared-cc808e01.js → shared-9637a2de.js} +1 -1
- package/dist/cdn/{shared-dfc47fd9.js → shared-96a392d9.js} +1 -1
- package/dist/cdn/{shared-4f183419.js → shared-97514fcb.js} +1 -1
- package/dist/cdn/{shared-c9845b4a.js → shared-9bf7d9a7.js} +1 -1
- package/dist/cdn/{shared-421a3ced.js → shared-a0efdc94.js} +1 -1
- package/dist/cdn/{shared-32e92c3b.js → shared-a8233033.js} +1 -1
- package/dist/cdn/{shared-edae6816.js → shared-ad76e640.js} +1 -1
- package/dist/cdn/{shared-6a8a40cc.js → shared-b38762ef.js} +1 -1
- package/dist/cdn/{shared-ce0465c6.js → shared-b980ba1d.js} +1 -1
- package/dist/cdn/{shared-afd7214a.js → shared-cb3b9d8b.js} +1 -1
- package/dist/cdn/{shared-ecf479f2.js → shared-d5ff9121.js} +1 -1
- package/dist/cdn/{shared-1ecfa77b.js → shared-deff3eda.js} +1 -1
- package/dist/cdn/{shared-301a779e.js → shared-e47bd38e.js} +1 -1
- package/dist/cdn/{shared-dbda59a0.js → shared-e5098b19.js} +1 -1
- package/dist/cdn/{shared-19768452.js → shared-e7bff5de.js} +1 -1
- package/dist/cdn/{shared-e4870c47.js → shared-ea5ff8bc.js} +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +108 -0
- package/dist/cdn/translations/coupon-form/en.json +103 -50
- package/dist/cdn/translations/transaction/en.json +108 -0
- package/dist/cdn/translations/webhook-card/en.json +5 -1
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +9 -2
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +150 -32
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
- package/dist/elements/internal/InternalAsyncListControl/index.d.ts +3 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js +3 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
- package/dist/elements/internal/InternalAsyncListControl/styles.d.ts +1 -0
- package/dist/elements/internal/InternalAsyncListControl/styles.js +12 -0
- package/dist/elements/internal/InternalAsyncListControl/styles.js.map +1 -0
- package/dist/elements/internal/InternalAsyncListControl/types.d.ts +5 -1
- package/dist/elements/internal/InternalAsyncListControl/types.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.d.ts +0 -3
- package/dist/elements/public/CouponForm/CouponForm.js +56 -76
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CouponForm/index.d.ts +2 -2
- package/dist/elements/public/CouponForm/index.js +2 -2
- package/dist/elements/public/CouponForm/index.js.map +1 -1
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.d.ts +2 -0
- package/dist/elements/public/Transaction/Transaction.js +114 -19
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/Transaction/index.d.ts +6 -0
- package/dist/elements/public/Transaction/index.js +6 -0
- package/dist/elements/public/Transaction/index.js.map +1 -1
- package/dist/elements/public/WebhookCard/WebhookCard.d.ts +8 -0
- package/dist/elements/public/WebhookCard/WebhookCard.js +73 -6
- package/dist/elements/public/WebhookCard/WebhookCard.js.map +1 -1
- package/dist/elements/public/WebhookCard/index.d.ts +2 -0
- package/dist/elements/public/WebhookCard/index.js +2 -0
- package/dist/elements/public/WebhookCard/index.js.map +1 -1
- package/dist/elements/public/WebhookForm/WebhookForm.d.ts +7 -0
- package/dist/elements/public/WebhookForm/WebhookForm.js +40 -4
- package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-ba7354fa.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-7dd710e4.js";import{I as e}from"./shared-97514fcb.js";import{a as s}from"./shared-25502f01.js";import{B as r}from"./shared-0f6e4584.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-1729e19a.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-fb1602a2.js";import"./shared-887e1795.js";import"./shared-6be24929.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-9637a2de.js";import"./shared-61ade33e.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-59b7fcc0.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-ce0465c6.js";import"./shared-e4870c47.js";import"./shared-1467a889.js";import"./shared-9a22d597.js";import{I as e}from"./shared-226dd830.js";import"./foxy-query-builder.js";import{_ as t,B as o}from"./shared-0f6e4584.js";import{O as s,T as r}from"./shared-8874ec69.js";import{c as i}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import"./shared-8526ed32.js";import"./shared-19768452.js";import"./shared-cfb33387.js";import"./shared-32e92c3b.js";import{I as a}from"./shared-4f183419.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./shared-49ecea83.js";import{R as l,a as d}from"./shared-25502f01.js";import{i as c}from"./shared-9803aa7c.js";import"./shared-ae00ce7c.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-cc808e01.js";import"./shared-bab2ea2c.js";import"./shared-77e15843.js";import"./foxy-form-dialog.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./shared-8bb3eb45.js";import"./shared-6be24929.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-edae6816.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-fe4a2e3d.js";import"./shared-13203be0.js";import"./shared-afd7214a.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-fb1dd186.js";import"./shared-c9845b4a.js";import"./shared-e7232c2b.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-43e2c3f6.js";import"./shared-c5a0cdd7.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-c4124870.js";import"./shared-ba7354fa.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-ee2cda29.js";let u,p,_,m,f=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.operators=Object.values(s),this.disableOr=!1}static get properties(){return t(t({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"}})}renderControl(){const{label:e,helperText:t,_errorMessage:o}=this,s=o&&!this.disabled&&!this.readonly;return n(u||(u=f` <section class="${0}"> ${0} <foxy-query-builder infer="query-builder" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> ${0} ${0} </section> `),i({"grid gap-xs leading-xs transition-colors":!0,"text-secondary hover-text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),e?n(p||(p=f`<p class="text-s font-medium">${0}</p>`),e):"",this.operators,this._value,this.disableOr,(e=>{var t;const o=e.currentTarget;this._value=null!==(t=o.value)&&void 0!==t?t:""}),t?n(_||(_=f`<p class="text-xs">${0}</p>`),t):"",s?n(m||(m=f`<p class="text-xs text-error">${0}</p>`),o):"")}});let h,y,b,x,g,v=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const o=this.nucleon,s=null!==(e=null==o?void 0:o.form.coupon_discount_details)&&void 0!==e?e:"",r=null!==(t=null==o?void 0:o.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",a=this.helperText,l=this.__renderRulesDescription(),d=this._errorMessage;return n(h||(h=v` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),i({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:s,type:r,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,o=this.nucleon;null==o||o.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),a||l?n(y||(y=v` <p class="${0}"> ${0} </p> `),i({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),l||a):"",!d||this.disabled||this.readonly?"":n(b||(b=v`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const o=this.nucleon,s=null!==(e=null==o?void 0:o.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",r=null!==(t=null==o?void 0:o.form.coupon_discount_details)&&void 0!==t?t:"";return r?this.t("discount_summary",{params:{details:r,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,o=null==e?void 0:e.form.coupon_discount_details,s=null==e?void 0:e.form.coupon_discount_type,r=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],a=r.find((e=>e.details===o&&e.type===s));return n(x||(x=v` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),i({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),a?this.t("discount_summary",{params:t(t({},a),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,o;const s=e.currentTarget,i=r[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!==(o=null==i?void 0:i.type)&&void 0!==o?o:"quantity_amount"})}),r.map((e=>n(g||(g=v` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===a,this.t("discount_summary",{params:t(t({},e),{},{ns:this.ns})})))),!a&&!!o&&!!s,this.t("custom_discount"))}});let j,$,w=e=>e;const k=l(d(a,"coupon-form"));class V extends k{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,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,o)=>!!e&&o.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,o)=>!!e&&o.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,o)=>!!e&&o.indexOf(e)===t)).join(",")})},this.__itemOptionRestrictionsOperators=[s.In],this.__itemOptionRestrictionsGetValue=()=>{var e;const t=new URLSearchParams,o=null!==(e=this.form.item_option_restrictions)&&void 0!==e?e:{};for(const e in o)t.set(`${e}:in`,o[e].join(","));return t.toString()},this.__itemOptionRestrictionsSetValue=e=>{const t=Object.fromEntries(Array.from(new URLSearchParams(e).entries()).map((([e,t])=>[e.replace(":in",""),t.split(",").filter((e=>!!e.trim()))])));this.edit({item_option_restrictions:t})},this.__optionsGetValue=()=>{const e=[];return this.form.multiple_codes_allowed&&e.push("multiple_codes_allowed"),this.form.combinable&&e.push("combinable"),this.form.exclude_category_discounts&&e.push("exclude_category_discounts"),this.form.exclude_line_item_discounts&&e.push("exclude_line_item_discounts"),this.form.is_taxable&&e.push("is_taxable"),this.form.shared_codes_allowed&&e.push("shared_codes_allowed"),this.form.customer_auto_apply&&e.push("customer_auto_apply"),e},this.__optionsSetValue=e=>{this.edit({multiple_codes_allowed:e.includes("multiple_codes_allowed"),combinable:e.includes("combinable"),exclude_category_discounts:e.includes("exclude_category_discounts"),exclude_line_item_discounts:e.includes("exclude_line_item_discounts"),is_taxable:e.includes("is_taxable"),shared_codes_allowed:e.includes("shared_codes_allowed"),customer_auto_apply:e.includes("customer_auto_apply")})},this.__optionsOptions=[{value:"multiple_codes_allowed",label:"option_multiple_codes_allowed"},{value:"combinable",label:"option_combinable"},{value:"exclude_category_discounts",label:"option_exclude_category_discounts"},{value:"exclude_line_item_discounts",label:"option_exclude_line_item_discounts"},{value:"is_taxable",label:"option_is_taxable"},{value:"shared_codes_allowed",label:"option_shared_codes_allowed"},{value:"customer_auto_apply",label:"option_customer_auto_apply"}],this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:r.String},{label:"used_codes",path:"number_of_uses_to_date",type:r.Number},{label:"date_created",path:"date_created",type:r.Date},{label:"date_modified",path:"date_modified",type:r.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 t(t({},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"),this.form.customer_auto_apply||e.push("customer-attribute-restrictions","customer-subscription-restrictions"),new o(e.join(" ").trim())}get headerSubtitleOptions(){return t(t({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return n(j||(j=w` <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,o,s,r,i,a,l;let d;try{const o=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");o.searchParams.set("order","date_created desc"),d=o.toString()}catch(e){d=void 0}return n($||($=w` ${0} <foxy-internal-text-control infer="name"></foxy-internal-text-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-query-builder-control infer="item-option-restrictions" disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="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> <div class="grid gap-l sm-grid-cols-3"> <foxy-internal-integer-control infer="number-of-uses-allowed" min="0" show-controls> </foxy-internal-integer-control> <foxy-internal-integer-control infer="number-of-uses-allowed-per-customer" min="0" show-controls> </foxy-internal-integer-control> <foxy-internal-integer-control infer="number-of-uses-allowed-per-code" min="0" show-controls> </foxy-internal-integer-control> </div> <div class="grid gap-l sm-grid-cols-2"> <foxy-internal-date-control infer="start-date"></foxy-internal-date-control> <foxy-internal-date-control infer="end-date"></foxy-internal-date-control> </div> <foxy-internal-number-control min="0" max="1" infer="inclusive-tax-rate"> </foxy-internal-number-control> <foxy-internal-checkbox-group-control infer="options" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions"> </foxy-internal-query-builder-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.__itemOptionRestrictionsOperators,this.__itemOptionRestrictionsGetValue,this.__itemOptionRestrictionsSetValue,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],c(null===(o=this.data)||void 0===o?void 0:o._links.self.href),c(null===(r=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===r?void 0:r._links["fx:item_categories"].href),c(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),this.__optionsGetValue,this.__optionsSetValue,this.__optionsOptions,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,c(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),c(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",V);export{V as CouponForm};
|
|
1
|
+
import"./shared-b980ba1d.js";import"./shared-476827c7.js";import"./shared-7dd710e4.js";import{I as t}from"./shared-226dd830.js";import"./foxy-query-builder.js";import{_ as e,B as o}from"./shared-0f6e4584.js";import{O as r,T as s}from"./shared-8874ec69.js";import{c as i}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import"./shared-40c6b1f6.js";import"./shared-787e8da4.js";import"./shared-e7bff5de.js";import"./shared-01f18104.js";import"./shared-a8233033.js";import{I as a}from"./shared-97514fcb.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./shared-49ecea83.js";import{R as l,a as c}from"./shared-25502f01.js";import{i as d}from"./shared-9803aa7c.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-9637a2de.js";import"./shared-bab2ea2c.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-cb3b9d8b.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-fb1dd186.js";import"./shared-9bf7d9a7.js";import"./shared-e7232c2b.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-43e2c3f6.js";import"./shared-3b975a29.js";import"./shared-6f4fa343.js";import"./shared-c5a0cdd7.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-c4124870.js";import"./shared-6d11abd7.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-471e77dd.js";let u,m,p,f,_=t=>t;customElements.define("foxy-internal-query-builder-control",class extends t{constructor(){super(...arguments),this.operators=Object.values(r),this.disableOr=!1}static get properties(){return e(e({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"}})}renderControl(){const{label:t,helperText:e,_errorMessage:o}=this,r=o&&!this.disabled&&!this.readonly;return n(u||(u=_` <section class="${0}"> ${0} <foxy-query-builder infer="query-builder" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> ${0} ${0} </section> `),i({"grid gap-xs leading-xs transition-colors":!0,"text-secondary hover-text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),t?n(m||(m=_`<p class="text-s font-medium">${0}</p>`),t):"",this.operators,this._value,this.disableOr,(t=>{var e;const o=t.currentTarget;this._value=null!==(e=o.value)&&void 0!==e?e:""}),e?n(p||(p=_`<p class="text-xs">${0}</p>`),e):"",r?n(f||(f=_`<p class="text-xs text-error">${0}</p>`),o):"")}});let h,y,x,b,j,v=t=>t;customElements.define("foxy-internal-coupon-form-rules-control",class extends t{renderControl(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_details)&&void 0!==t?t:"",s=null!==(e=null==o?void 0:o.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",a=this.helperText,l=this.__renderRulesDescription(),c=this._errorMessage;return n(h||(h=v` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),i({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:r,type:s,name:"Rules"},(t=>{const e=t.currentTarget.parsedValue,o=this.nucleon;null==o||o.edit({coupon_discount_details:e.details,coupon_discount_type:e.type})}),a||l?n(y||(y=v` <p class="${0}"> ${0} </p> `),i({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),l||a):"",!c||this.disabled||this.readonly?"":n(x||(x=v`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",s=null!==(e=null==o?void 0:o.form.coupon_discount_details)&&void 0!==e?e:"";return s?this.t("discount_summary",{params:{details:s,type:r,ns:this.ns}}):null}__renderPreset(){const t=this.nucleon,o=null==t?void 0:t.form.coupon_discount_details,r=null==t?void 0:t.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],a=s.find((t=>t.details===o&&t.type===r));return n(b||(b=v` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),i({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),a?this.t("discount_summary",{params:e(e({},a),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(t=>{var e,o;const r=t.currentTarget,i=s[r.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(e=null==i?void 0:i.details)&&void 0!==e?e:"",coupon_discount_type:null!==(o=null==i?void 0:i.type)&&void 0!==o?o:"quantity_amount"})}),s.map((t=>n(j||(j=v` <option value="${0}" ?selected="${0}"> ${0} </option> `),t.details,t===a,this.t("discount_summary",{params:e(e({},t),{},{ns:this.ns})})))),!a&&!!o&&!!r,this.t("custom_discount"))}});let g,$,w=t=>t;const k=l(c(a,"coupon-form"));class q extends k{constructor(){var t;super(...arguments),t=this,this.getTransactionPageHref=null,this.__customerSubscriptionRestrictionsGetValue=()=>{var t;const e=null===(t=this.form.customer_subscription_restrictions)||void 0===t?void 0:t.split(",").map((t=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).map((t=>({value:t})));return null!=e?e:[]},this.__customerSubscriptionRestrictionsSetValue=t=>{this.edit({customer_subscription_restrictions:t.map((({value:t})=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var t;return null===(t=this.form.product_code_restrictions)||void 0===t?void 0:t.split(",").filter((t=>!!t.trim())).map((t=>({value:t,label:t.startsWith("-")?this.t("product-code-restrictions.label_block",{value:t.substring(1)}):this.t("product-code-restrictions.label_allow",{value:t})})))},this.__productCodeRestrictionsSetValue=t=>{this.edit({product_code_restrictions:t.map((({value:t,unit:e})=>"block"===e?`-${t}`:t)).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join(",")})},this.__itemOptionRestrictionsOperators=[r.In],this.__itemOptionRestrictionsGetValue=()=>{var t;const e=new URLSearchParams,o=null!==(t=this.form.item_option_restrictions)&&void 0!==t?t:{};for(const t in o)e.set(`${t}:in`,o[t].join(","));return e.toString()},this.__itemOptionRestrictionsSetValue=t=>{const e=Object.fromEntries(Array.from(new URLSearchParams(t).entries()).map((([t,e])=>[t.replace(":in",""),e.split(",").filter((t=>!!t.trim()))])));this.edit({item_option_restrictions:e})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:s.String},{label:"used_codes",path:"number_of_uses_to_date",type:s.Number},{label:"date_created",path:"date_created",type:s.Date},{label:"date_modified",path:"date_modified",type:s.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(e){t.__couponCodesActions[0].state="busy",t.__couponCodesActions=[...t.__couponCodesActions];try{await navigator.clipboard.writeText(e.code),t.__couponCodesActions[0].state="end"}catch(e){t.__couponCodesActions[0].state="error"}finally{t.__couponCodesActions=[...t.__couponCodesActions],setTimeout((()=>{t.__couponCodesActions[0].state="idle",t.__couponCodesActions=[...t.__couponCodesActions]}),1e3)}}}]}static get properties(){return e(e({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!t||t.length<=50||"name:v8n_too_long",({inclusive_tax_rate:t})=>!t||t>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:t})=>!t||t<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:t})=>!t||t>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:t})=>!!t||"rules:v8n_required",({coupon_discount_details:t})=>!t||t.length<=200||"rules:v8n_too_long",({item_option_restrictions:t})=>!t||JSON.stringify(t).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:t})=>!t||t.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:t})=>!t||t.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:t})=>!t||t>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:t})=>!t||t.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:t})=>!t||t>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const t=[super.hiddenSelector.toString()];return this.data||t.push("coupon-codes","category-restrictions","attributes"),new o(t.join(" ").trim())}get headerSubtitleOptions(){return e(e({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(t){return n(g||(g=w` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),t._links["fx:generate_codes"].href,[t._links["fx:coupon_codes"].href],t._links["fx:coupon_codes"].href,[t._links["fx:coupon_codes"].href],super.renderHeaderActions(t))}renderBody(){var t,e,o,r,s,i,a,l;let c;try{const o=new URL(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:coupon_codes"].href)&&void 0!==e?e:"");o.searchParams.set("order","date_created desc"),c=o.toString()}catch(t){c=void 0}return n($||($=w` ${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-query-builder-control infer="item-option-restrictions" disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="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-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),c,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__itemOptionRestrictionsOperators,this.__itemOptionRestrictionsGetValue,this.__itemOptionRestrictionsSetValue,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.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,d(null===(o=this.data)||void 0===o?void 0:o._links.self.href),d(null===(s=null===(r=this.__storeLoader)||void 0===r?void 0:r.data)||void 0===s?void 0:s._links["fx:item_categories"].href),d(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),d(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),d(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",q);export{q as CouponForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-ea5ff8bc.js";import"./shared-c5a0cdd7.js";import{I as e}from"./shared-97514fcb.js";import{a as r}from"./shared-25502f01.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-49ecea83.js";import"./shared-0f6e4584.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-9637a2de.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-4e709717.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let i,t=e=>e;const o=r(e,"custom-field-form");class a 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",a);export{a as CustomFieldForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-ee2cda29.js";import"./shared-dfc47fd9.js";import"./shared-cfb33387.js";import{I as t}from"./shared-4f183419.js";import{a as e}from"./shared-226dd830.js";import"./shared-49ecea83.js";import{i as s}from"./shared-9803aa7c.js";import{h as o}from"./shared-dc73b9a5.js";import{c as r,_ as a,B as i}from"./shared-0f6e4584.js";import{S as n,a as d}from"./shared-25502f01.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-75331d5e.js";import"./shared-ff7b2af6.js";import"./shared-fe4a2e3d.js";import"./shared-0f00d4d8.js";import"./shared-22ba9566.js";import"./shared-cc808e01.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./foxy-copy-to-clipboard.js";import"./shared-8bb3eb45.js";import"./shared-6be24929.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-51c4a6dd.js";!function(){function t(t,e,s){if(null!=s){const o=t.includes("?")?"&":"?";return t+o+e+"="+encodeURIComponent(s)}return t}class e extends Error{constructor(t){super(`[hcaptcha-web-component]: ${t}`),Object.setPrototypeOf(this,e.prototype)}}class s extends HTMLElement{connectedCallback(){(function(e){if(window._hCaptchaOnLoadPromise)return window._hCaptchaOnLoadPromise;if(window.hcaptcha)return console.warn("[vanilla-hcaptcha] hCaptcha JS API detected to be externally loaded. Unless you know what are you doing, this task should be delegated to this web component."),window._hCaptchaOnLoadPromise=Promise.resolve(),window._hCaptchaOnLoadPromise;{let s,o;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,o=e})),window._hCaptchaOnLoad=s;const r=function(e){let s=e.jsapi;return s=t(s,"render","explicit"),s=t(s,"onload","_hCaptchaOnLoad"),s=t(s,"recaptchacompat",!1===e.reCaptchaCompat?"off":null),s=t(s,"host",e.host),s=t(s,"hl",e.hl),s=t(s,"sentry",JSON.stringify(e.sentry)),s=t(s,"endpoint",e.endpoint),s=t(s,"assethost",e.assethost),s=t(s,"imghost",e.imghost),s=t(s,"reportapi",e.reportapi),s}(e),a=document.createElement("script");return a.src=r,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${r}"`;console.error(e,t),o(e)},document.head.appendChild(a),window._hCaptchaOnLoadPromise}})({host:this.getAttribute("host"),hl:this.getAttribute("hl"),sentry:"false"!==this.getAttribute("sentry"),reCaptchaCompat:"false"===this.getAttribute("reCaptchaCompat"),jsapi:this.getAttribute("jsapi")||"https://js.hcaptcha.com/1/api.js",endpoint:this.getAttribute("endpoint"),reportapi:this.getAttribute("reportapi"),assethost:this.getAttribute("assethost"),imghost:this.getAttribute("imghost")}).then(this.onApiLoaded.bind(this)).catch(this.onError.bind(this))}onApiLoaded(){this.$emit("loaded");const t="false"!==this.getAttribute("auto-render"),e={sitekey:this.getAttribute("sitekey")||this.getAttribute("site-key"),theme:this.getAttribute("theme"),size:this.getAttribute("size"),hl:this.getAttribute("hl"),tplinks:"off"===this.getAttribute("tplinks")?"off":"on",tabindex:parseInt(this.getAttribute("tabindex")),custom:"true"===this.getAttribute("custom")},s=this.getAttribute("challenge-container");s&&(e["challenge-container"]=s);const o=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(o))}assertApiLoaded(t){if(!hcaptcha)throw new e(`hCaptcha JS API was not loaded yet. Please wait for \`loaded\` event to safely call "${t}".`)}assertRendered(){if(!this.hcaptchaId)throw new e('hCaptcha was not yet rendered. Please call "render()" first.')}onError(t){console.error(t),this.$emit("error",{error:t})}$emit(t,e){let s;"function"==typeof Event?s=new Event(t):(s=document.createEvent("Event"),s.initEvent(t,!1,!1)),e&&Object.assign(s,e),this.dispatchEvent(s)}render(t){this.assertApiLoaded("render"),this.hcaptchaId?console.warn("hCaptcha was already rendered. You may want to call 'reset()' first."):this.hcaptchaId=hcaptcha.render(this,Object.assign(Object.assign({},t),{callback:()=>{const t=hcaptcha.getResponse(this.hcaptchaId),e=hcaptcha.getRespKey(this.hcaptchaId);this.$emit("verified",{token:t,eKey:e,key:t})},"expired-callback":()=>{this.$emit("expired")},"chalexpired-callback":()=>{this.$emit("challenge-expired")},"error-callback":this.onError.bind(this),"open-callback":()=>{this.$emit("opened")},"close-callback":()=>{this.$emit("closed")}}))}setData(t){this.assertRendered(),hcaptcha.setData(this.hcaptchaId,{rqdata:t})}execute(){this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId)}executeAsync(){return this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId,{async:!0})}reset(){this.assertApiLoaded("reset"),this.assertRendered(),hcaptcha.reset(this.hcaptchaId)}}customElements.define("h-captcha",s)}();let c,p=t=>t;customElements.define("foxy-internal-customer-form-legal-notice-control",class extends e{renderControl(){var t,e;const r=this.nucleon;return o(c||(c=p` <p class="leading-s text-xs text-secondary"> <foxy-i18n infer="" key="text"></foxy-i18n> <a class="font-medium text-body rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" target="_blank" href="${0}" rel="noopener noreferrer"> <foxy-i18n infer="" key="link"></foxy-i18n> </a> </p> `),s(null===(e=null===(t=null==r?void 0:r.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=r((function(t){!function(){const e=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],s=(t,s=e,o="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";s[0].minDiversity=0,s[0].minLength=0;const a=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&a.push({regex:`[${o}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(r))).map((t=>t.message)),i.length=r.length;let n=s.filter((t=>i.contains.length>=t.minDiversity)).filter((t=>i.length>=t.minLength)).sort(((t,e)=>e.id-t.id)).map((t=>({id:t.id,value:t.value})));return Object.assign(i,n[0]),i};t.exports={passwordStrength:s,defaultOptions:e}}()}));let u,f,g=t=>t;const _=n(d(t,"customer-form")),y=m.passwordStrength;class x extends _{constructor(){super(...arguments),this.passwordless=!1,this.settings=null,this.__isAnonymousGetValue=()=>{var t;return!1===(null===(t=this.form)||void 0===t?void 0:t.is_anonymous)?"false":"true"},this.__isAnonymousSetValue=t=>{const e="true"===t;this.edit({is_anonymous:e}),e&&this.form.password&&this.edit({password:""}),e&&this.form.password_old&&this.edit({password_old:""}),e&&this.form.forgot_password&&this.edit({forgot_password:""})},this.__isAnonymousOptions=[{value:"true",label:"option_true"},{value:"false",label:"option_false"}],this.__refreshInterval=null}static get scopedElements(){return{"foxy-internal-customer-form-legal-notice-control":customElements.get("foxy-internal-customer-form-legal-notice-control"),"foxy-internal-radio-group-control":customElements.get("foxy-internal-radio-group-control"),"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-password-control":customElements.get("foxy-internal-password-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"h-captcha":customElements.get("h-captcha"),"vaadin-button":customElements.get("vaadin-button")}}static get properties(){return a(a({},super.properties),{},{passwordless:{type:Boolean},settings:{type:Object}})}static get v8n(){return[({password:t,_links:e,is_anonymous:s=!0},o)=>!!o.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},o)=>{var r;return!s||(void 0===(null===(r=o.settings)||void 0===r?void 0:r.sign_up)||(!(e&&!t)||"password-old:v8n_required"))},({first_name:t})=>!t||t.length<=50||"first-name:v8n_too_long",({last_name:t})=>!t||t.length<=50||"last-name:v8n_too_long",({password:t})=>!t||y(t).id>=2||"password:v8n_too_weak",({password:t})=>!t||t.length<=50||"password:v8n_too_long",({tax_id:t})=>!t||t.length<=50||"tax-id:v8n_too_long",({email:t})=>t&&t.length>0||"email:v8n_required",({email:t})=>!t||t.length<=100||"email:v8n_too_long",({email:t})=>!t||l(t)||"email:v8n_invalid_email"]}get hiddenSelector(){const t=new Set(super.hiddenSelector.toString().split(" "));return this.settings?(t.add("forgot-password"),t.add("is-anonymous"),this.form.password||t.add("password-old"),"none"===this.settings.tos_checkbox_settings.usage&&t.add("legal-notice")):(!1!==this.form.is_anonymous&&(t.add("forgot-password"),t.add("password")),t.add("password-old"),t.add("legal-notice")),this.href&&(t.add("is-anonymous"),t.add("legal-notice")),new i(Array.from(t).join(" ").trim())}get headerTitleOptions(){const t=this.data;return!t||t.first_name.trim()||t.last_name.trim()?super.headerTitleOptions:a(a({},super.headerTitleOptions),{},{context:"no_name"})}get headerSubtitleKey(){var t;return(null===(t=this.data)||void 0===t?void 0:t.is_anonymous)?"subtitle_anonymous":"subtitle_registered"}get headerSubtitleOptions(){return a(a({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}disconnectedCallback(){super.disconnectedCallback();const t=this.__refreshInterval;t&&clearInterval(t)}connectedCallback(){super.connectedCallback();const t=setInterval((()=>this.requestUpdate()),6e4);this.__refreshInterval=t}renderBody(){var t,e,s,r;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return o(u||(u=g` ${0} <div class="${0}"> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> </div> <foxy-internal-text-control helper-text="${0}" infer="email"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="is-anonymous" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-password-control placeholder="${0}" helper-text="${0}" infer="password" show-generator> </foxy-internal-password-control> <foxy-internal-password-control infer="password-old"></foxy-internal-password-control> <foxy-internal-password-control helper-text="${0}" infer="forgot-password" show-generator> </foxy-internal-password-control> <foxy-internal-text-control infer="tax-id"></foxy-internal-text-control> <foxy-internal-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),this.renderHeader(),h({"grid-cols-2":!a&&!i,hidden:a&&i,"gap-m":!0,grid:!a||!i}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__forgotPasswordHelperText,!this.data&&(null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.enabled)&&"hcaptcha"===(null===(r=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===r?void 0:r.verification.type)?o(f||(f=g` <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> `),this.settings.sign_up.verification.site_key,this.lang,(({token:t})=>{this.edit({verification:{type:"hcaptcha",token:t}}),super.submit()})):"",super.renderBody())}submit(){var t,e,s,o,r;"hcaptcha"!==(null===(s=null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.verification)||void 0===s?void 0:s.type)||this.data?super.submit():(null===(o=this.__hcaptcha)||void 0===o||o.reset(),null===(r=this.__hcaptcha)||void 0===r||r.execute())}async _sendPatch(t){const e=await super._sendPatch(t);if(t.password){const t={key:"password_change_success",options:{email:e.email}};this.status=t}return e}async _sendGet(){return this.status=null,await super._sendGet()}async _fetch(...t){try{return await super._fetch(...t)}catch(t){let e;try{e=(await t.json())._embedded["fx:errors"][0].message}catch(e){throw t}throw"Conflict"===e||e.startsWith("This email address is already in use")?["error:email_already_used"]:e.startsWith("Customer registration is disabled")?["error:registration_disabled"]:e.startsWith("Client verification failed")?["error:verification_failed"]:e.startsWith("Provided password is incorrect")?["error:old_password_incorrect"]:t}}get __forgotPasswordHelperText(){var t,e;const s=null===(t=this.data)||void 0===t?void 0:t.forgot_password_timestamp,o="forgot-password.helper_text";if((null===(e=this.data)||void 0===e?void 0:e.forgot_password)&&s){const t=new Date(new Date(s).getTime()+18e5),e=Math.floor((t.getTime()-Date.now())/1e3/60);return e<=0?this.t(`${o}_expired_on`,{expiresOn:t}):this.t(`${o}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(o)}get __passwordPlaceholder(){return this.data?this.t("password.placeholder_new"):this.t("password.placeholder")}get __passwordHelperText(){return this.data?this.t("password.helper_text_new"):this.t("password.helper_text")}get __emailHelperText(){var t;return(null===(t=this.data)||void 0===t?void 0:t.last_login_date)?this.t("email.helper_text_last_login_date",{date:this.data.last_login_date}):this.t("email.helper_text")}get __hcaptcha(){return this.renderRoot.querySelector("h-captcha")}}customElements.define("foxy-customer-form",x);export{x as CustomerForm};
|
|
1
|
+
import"./shared-471e77dd.js";import"./shared-96a392d9.js";import"./shared-01f18104.js";import{I as t}from"./shared-97514fcb.js";import{a as e}from"./shared-226dd830.js";import"./shared-49ecea83.js";import{i as s}from"./shared-9803aa7c.js";import{h as o}from"./shared-dc73b9a5.js";import{c as r,_ as a,B as i}from"./shared-0f6e4584.js";import{S as n,a as d}from"./shared-25502f01.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-4a652d60.js";import"./shared-ff7b2af6.js";import"./shared-19f46691.js";import"./shared-0f00d4d8.js";import"./shared-22ba9566.js";import"./shared-9637a2de.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-51c4a6dd.js";!function(){function t(t,e,s){if(null!=s){const o=t.includes("?")?"&":"?";return t+o+e+"="+encodeURIComponent(s)}return t}class e extends Error{constructor(t){super(`[hcaptcha-web-component]: ${t}`),Object.setPrototypeOf(this,e.prototype)}}class s extends HTMLElement{connectedCallback(){(function(e){if(window._hCaptchaOnLoadPromise)return window._hCaptchaOnLoadPromise;if(window.hcaptcha)return console.warn("[vanilla-hcaptcha] hCaptcha JS API detected to be externally loaded. Unless you know what are you doing, this task should be delegated to this web component."),window._hCaptchaOnLoadPromise=Promise.resolve(),window._hCaptchaOnLoadPromise;{let s,o;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,o=e})),window._hCaptchaOnLoad=s;const r=function(e){let s=e.jsapi;return s=t(s,"render","explicit"),s=t(s,"onload","_hCaptchaOnLoad"),s=t(s,"recaptchacompat",!1===e.reCaptchaCompat?"off":null),s=t(s,"host",e.host),s=t(s,"hl",e.hl),s=t(s,"sentry",JSON.stringify(e.sentry)),s=t(s,"endpoint",e.endpoint),s=t(s,"assethost",e.assethost),s=t(s,"imghost",e.imghost),s=t(s,"reportapi",e.reportapi),s}(e),a=document.createElement("script");return a.src=r,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${r}"`;console.error(e,t),o(e)},document.head.appendChild(a),window._hCaptchaOnLoadPromise}})({host:this.getAttribute("host"),hl:this.getAttribute("hl"),sentry:"false"!==this.getAttribute("sentry"),reCaptchaCompat:"false"===this.getAttribute("reCaptchaCompat"),jsapi:this.getAttribute("jsapi")||"https://js.hcaptcha.com/1/api.js",endpoint:this.getAttribute("endpoint"),reportapi:this.getAttribute("reportapi"),assethost:this.getAttribute("assethost"),imghost:this.getAttribute("imghost")}).then(this.onApiLoaded.bind(this)).catch(this.onError.bind(this))}onApiLoaded(){this.$emit("loaded");const t="false"!==this.getAttribute("auto-render"),e={sitekey:this.getAttribute("sitekey")||this.getAttribute("site-key"),theme:this.getAttribute("theme"),size:this.getAttribute("size"),hl:this.getAttribute("hl"),tplinks:"off"===this.getAttribute("tplinks")?"off":"on",tabindex:parseInt(this.getAttribute("tabindex")),custom:"true"===this.getAttribute("custom")},s=this.getAttribute("challenge-container");s&&(e["challenge-container"]=s);const o=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(o))}assertApiLoaded(t){if(!hcaptcha)throw new e(`hCaptcha JS API was not loaded yet. Please wait for \`loaded\` event to safely call "${t}".`)}assertRendered(){if(!this.hcaptchaId)throw new e('hCaptcha was not yet rendered. Please call "render()" first.')}onError(t){console.error(t),this.$emit("error",{error:t})}$emit(t,e){let s;"function"==typeof Event?s=new Event(t):(s=document.createEvent("Event"),s.initEvent(t,!1,!1)),e&&Object.assign(s,e),this.dispatchEvent(s)}render(t){this.assertApiLoaded("render"),this.hcaptchaId?console.warn("hCaptcha was already rendered. You may want to call 'reset()' first."):this.hcaptchaId=hcaptcha.render(this,Object.assign(Object.assign({},t),{callback:()=>{const t=hcaptcha.getResponse(this.hcaptchaId),e=hcaptcha.getRespKey(this.hcaptchaId);this.$emit("verified",{token:t,eKey:e,key:t})},"expired-callback":()=>{this.$emit("expired")},"chalexpired-callback":()=>{this.$emit("challenge-expired")},"error-callback":this.onError.bind(this),"open-callback":()=>{this.$emit("opened")},"close-callback":()=>{this.$emit("closed")}}))}setData(t){this.assertRendered(),hcaptcha.setData(this.hcaptchaId,{rqdata:t})}execute(){this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId)}executeAsync(){return this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId,{async:!0})}reset(){this.assertApiLoaded("reset"),this.assertRendered(),hcaptcha.reset(this.hcaptchaId)}}customElements.define("h-captcha",s)}();let c,p=t=>t;customElements.define("foxy-internal-customer-form-legal-notice-control",class extends e{renderControl(){var t,e;const r=this.nucleon;return o(c||(c=p` <p class="leading-s text-xs text-secondary"> <foxy-i18n infer="" key="text"></foxy-i18n> <a class="font-medium text-body rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" target="_blank" href="${0}" rel="noopener noreferrer"> <foxy-i18n infer="" key="link"></foxy-i18n> </a> </p> `),s(null===(e=null===(t=null==r?void 0:r.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=r((function(t){!function(){const e=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],s=(t,s=e,o="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";s[0].minDiversity=0,s[0].minLength=0;const a=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&a.push({regex:`[${o}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(r))).map((t=>t.message)),i.length=r.length;let n=s.filter((t=>i.contains.length>=t.minDiversity)).filter((t=>i.length>=t.minLength)).sort(((t,e)=>e.id-t.id)).map((t=>({id:t.id,value:t.value})));return Object.assign(i,n[0]),i};t.exports={passwordStrength:s,defaultOptions:e}}()}));let u,f,g=t=>t;const _=n(d(t,"customer-form")),y=m.passwordStrength;class x extends _{constructor(){super(...arguments),this.passwordless=!1,this.settings=null,this.__isAnonymousGetValue=()=>{var t;return!1===(null===(t=this.form)||void 0===t?void 0:t.is_anonymous)?"false":"true"},this.__isAnonymousSetValue=t=>{const e="true"===t;this.edit({is_anonymous:e}),e&&this.form.password&&this.edit({password:""}),e&&this.form.password_old&&this.edit({password_old:""}),e&&this.form.forgot_password&&this.edit({forgot_password:""})},this.__isAnonymousOptions=[{value:"true",label:"option_true"},{value:"false",label:"option_false"}],this.__refreshInterval=null}static get scopedElements(){return{"foxy-internal-customer-form-legal-notice-control":customElements.get("foxy-internal-customer-form-legal-notice-control"),"foxy-internal-radio-group-control":customElements.get("foxy-internal-radio-group-control"),"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-password-control":customElements.get("foxy-internal-password-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"h-captcha":customElements.get("h-captcha"),"vaadin-button":customElements.get("vaadin-button")}}static get properties(){return a(a({},super.properties),{},{passwordless:{type:Boolean},settings:{type:Object}})}static get v8n(){return[({password:t,_links:e,is_anonymous:s=!0},o)=>!!o.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},o)=>{var r;return!s||(void 0===(null===(r=o.settings)||void 0===r?void 0:r.sign_up)||(!(e&&!t)||"password-old:v8n_required"))},({first_name:t})=>!t||t.length<=50||"first-name:v8n_too_long",({last_name:t})=>!t||t.length<=50||"last-name:v8n_too_long",({password:t})=>!t||y(t).id>=2||"password:v8n_too_weak",({password:t})=>!t||t.length<=50||"password:v8n_too_long",({tax_id:t})=>!t||t.length<=50||"tax-id:v8n_too_long",({email:t})=>t&&t.length>0||"email:v8n_required",({email:t})=>!t||t.length<=100||"email:v8n_too_long",({email:t})=>!t||l(t)||"email:v8n_invalid_email"]}get hiddenSelector(){const t=new Set(super.hiddenSelector.toString().split(" "));return this.settings?(t.add("forgot-password"),t.add("is-anonymous"),this.form.password||t.add("password-old"),"none"===this.settings.tos_checkbox_settings.usage&&t.add("legal-notice")):(!1!==this.form.is_anonymous&&(t.add("forgot-password"),t.add("password")),t.add("password-old"),t.add("legal-notice")),this.href&&(t.add("is-anonymous"),t.add("legal-notice")),new i(Array.from(t).join(" ").trim())}get headerTitleOptions(){const t=this.data;return!t||t.first_name.trim()||t.last_name.trim()?super.headerTitleOptions:a(a({},super.headerTitleOptions),{},{context:"no_name"})}get headerSubtitleKey(){var t;return(null===(t=this.data)||void 0===t?void 0:t.is_anonymous)?"subtitle_anonymous":"subtitle_registered"}get headerSubtitleOptions(){return a(a({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}disconnectedCallback(){super.disconnectedCallback();const t=this.__refreshInterval;t&&clearInterval(t)}connectedCallback(){super.connectedCallback();const t=setInterval((()=>this.requestUpdate()),6e4);this.__refreshInterval=t}renderBody(){var t,e,s,r;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return o(u||(u=g` ${0} <div class="${0}"> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> </div> <foxy-internal-text-control helper-text="${0}" infer="email"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="is-anonymous" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-password-control placeholder="${0}" helper-text="${0}" infer="password" show-generator> </foxy-internal-password-control> <foxy-internal-password-control infer="password-old"></foxy-internal-password-control> <foxy-internal-password-control helper-text="${0}" infer="forgot-password" show-generator> </foxy-internal-password-control> <foxy-internal-text-control infer="tax-id"></foxy-internal-text-control> <foxy-internal-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),this.renderHeader(),h({"grid-cols-2":!a&&!i,hidden:a&&i,"gap-m":!0,grid:!a||!i}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__forgotPasswordHelperText,!this.data&&(null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.enabled)&&"hcaptcha"===(null===(r=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===r?void 0:r.verification.type)?o(f||(f=g` <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> `),this.settings.sign_up.verification.site_key,this.lang,(({token:t})=>{this.edit({verification:{type:"hcaptcha",token:t}}),super.submit()})):"",super.renderBody())}submit(){var t,e,s,o,r;"hcaptcha"!==(null===(s=null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.verification)||void 0===s?void 0:s.type)||this.data?super.submit():(null===(o=this.__hcaptcha)||void 0===o||o.reset(),null===(r=this.__hcaptcha)||void 0===r||r.execute())}async _sendPatch(t){const e=await super._sendPatch(t);if(t.password){const t={key:"password_change_success",options:{email:e.email}};this.status=t}return e}async _sendGet(){return this.status=null,await super._sendGet()}async _fetch(...t){try{return await super._fetch(...t)}catch(t){let e;try{e=(await t.json())._embedded["fx:errors"][0].message}catch(e){throw t}throw"Conflict"===e||e.startsWith("This email address is already in use")?["error:email_already_used"]:e.startsWith("Customer registration is disabled")?["error:registration_disabled"]:e.startsWith("Client verification failed")?["error:verification_failed"]:e.startsWith("Provided password is incorrect")?["error:old_password_incorrect"]:t}}get __forgotPasswordHelperText(){var t,e;const s=null===(t=this.data)||void 0===t?void 0:t.forgot_password_timestamp,o="forgot-password.helper_text";if((null===(e=this.data)||void 0===e?void 0:e.forgot_password)&&s){const t=new Date(new Date(s).getTime()+18e5),e=Math.floor((t.getTime()-Date.now())/1e3/60);return e<=0?this.t(`${o}_expired_on`,{expiresOn:t}):this.t(`${o}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(o)}get __passwordPlaceholder(){return this.data?this.t("password.placeholder_new"):this.t("password.placeholder")}get __passwordHelperText(){return this.data?this.t("password.helper_text_new"):this.t("password.helper_text")}get __emailHelperText(){var t;return(null===(t=this.data)||void 0===t?void 0:t.last_login_date)?this.t("email.helper_text_last_login_date",{date:this.data.last_login_date}):this.t("email.helper_text")}get __hcaptcha(){return this.renderRoot.querySelector("h-captcha")}}customElements.define("foxy-customer-form",x);export{x as CustomerForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-e4870c47.js";import"./shared-9a22d597.js";import"./shared-ba7354fa.js";import"./shared-d0e4d7b1.js";import"./shared-dfc47fd9.js";import{I as e}from"./shared-4f183419.js";import"./shared-c5a0cdd7.js";import{a as t}from"./shared-25502f01.js";import{B as i}from"./shared-0f6e4584.js";import{p as s}from"./shared-90706e10.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-c4124870.js";import{p as n}from"./shared-49ecea83.js";import{I as a}from"./shared-df42c94f.js";import"./shared-ee2cda29.js";import"./shared-ae00ce7c.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-8bb3eb45.js";import"./shared-6be24929.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-c9845b4a.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-cc808e01.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./foxy-pagination.js";import"./shared-edae6816.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-fe4a2e3d.js";import"./shared-13203be0.js";import"./shared-301a779e.js";import"./shared-970d98db.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-75331d5e.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};
|
|
1
|
+
import"./shared-ea5ff8bc.js";import"./shared-7dd710e4.js";import"./shared-6d11abd7.js";import"./shared-73045804.js";import"./shared-96a392d9.js";import{I as e}from"./shared-97514fcb.js";import"./shared-c5a0cdd7.js";import{a as t}from"./shared-25502f01.js";import{B as i}from"./shared-0f6e4584.js";import{p as s}from"./shared-90706e10.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-c4124870.js";import{p as n}from"./shared-49ecea83.js";import{I as a}from"./shared-df42c94f.js";import"./shared-471e77dd.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-9637a2de.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-pagination.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-6f4fa343.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-4a652d60.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";let r,l=e=>e;const d=t(e);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-form",class extends d{constructor(){super(...arguments),this.__valuesInputParams={type:"number",step:"1",min:"1",max:"999"},this.__valuesGetValue=()=>{var e;return null===(e=this.form.values)||void 0===e?void 0:e.map((e=>{if(".5m"===e)return{value:e,label:this.t("values.twice_a_week")};const{units:t,count:i}=s(e);return{value:e,label:this.t(`values.${t}`,{count:i})}}))},this.__valuesSetValue=e=>{const t=e.filter((({value:e})=>parseFloat(e)<=999)).map((({unit:e,value:t})=>e?`${t}${e}`:t)).filter(((e,t,i)=>i.indexOf(e)===t));this.edit({values:t})}}static get v8n(){return[({jsonataQuery:e})=>!!e||"jsonata-query:v8n_required",({jsonataQuery:e})=>!e||e.length<=200||"jsonata-query:v8n_too_long",({values:e})=>!!e&&e.length>0||"values:v8n_required",({values:e})=>!e||e.length<=20||"values:v8n_too_long"]}get hiddenSelector(){return new i(`timestamps ${super.hiddenSelector}`.trim())}renderBody(){return o(r||(r=l` <foxy-internal-source-control infer="jsonata-query" property="jsonataQuery"> </foxy-internal-source-control> <foxy-internal-editable-list-control infer="values" .inputParams="${0}" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__valuesInputParams,this.__valuesGetValue,this.__valuesSetValue,[{label:this.t("values.unit_years"),value:"y"},{label:this.t("values.unit_months"),value:"m"},{label:this.t("values.unit_weeks"),value:"w"},{label:this.t("values.unit_days"),value:"d"}],super.renderBody())}});let u,c=e=>e;const f=t(a);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-card",class extends f{renderBody(){var e;const{jsonataQuery:t,values:i}=null!==(e=this.data)&&void 0!==e?e:{},n=null==i?void 0:i.map((e=>{if(".5m"===e)return this.t("twice_a_week");const{units:t,count:i}=s(e);return this.t(t,{count:i})}));return o(u||(u=c` <section class="h-s flex flex-col justify-center leading-xs"> <p class="text-m font-medium min-w-0"> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> <p class="text-s text-secondary min-w-0"> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> </section> `),"*"===t?"title_all":"title_matching",{query:t},(null==i?void 0:i.length)?"subtitle_list":"subtitle_empty",{list:null==n?void 0:n.join(", ")})}});let p,h=e=>e;const m=t(e);customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-form",class extends m{constructor(){super(...arguments),this.__minmaxRestrictionsGetValue=()=>{const e=[],t=this.form;return t.min&&e.push("min"),t.max&&e.push("max"),e},this.__minmaxRestrictionsSetValue=e=>{const t=this.form;this.edit({min:e.includes("min")?t.min||"1m":null,max:e.includes("max")?t.max||"1y":null})},this.__minmaxRestrictionsOptions=[{label:"option_min",value:"min"},{label:"option_max",value:"max"}],this.__dayAndDateRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.type;return"day"===t?"days":"month"===t?"dates":"none"},this.__dayAndDateRestrictionsSetValue=e=>{"dates"===e?this.edit({allowedDays:{type:"month",days:[]}}):"days"===e?this.edit({allowedDays:{type:"day",days:[]}}):this.edit({allowedDays:null})},this.__dayAndDateRestrictionsOptions=[{label:"option_none",value:"none"},{label:"option_dates",value:"dates"},{label:"option_days",value:"days"}],this.__daysOfWeekGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.days.map((e=>String(e))))&&void 0!==t?t:[]},this.__daysOfWeekSetValue=e=>{this.edit({allowedDays:{type:"day",days:e.map(Number)}})},this.__daysOfWeekOptions=[{label:"option_1",value:"1"},{label:"option_2",value:"2"},{label:"option_3",value:"3"},{label:"option_4",value:"4"},{label:"option_5",value:"5"},{label:"option_6",value:"6"},{label:"option_7",value:"7"}],this.__datesOfMonthInputParams={type:"number",min:"1",max:"31",step:"1"},this.__datesOfMonthGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.allowedDays)||void 0===e?void 0:e.days.map((e=>({value:String(e)}))))&&void 0!==t?t:[]},this.__datesOfMonthSetValue=e=>{this.edit({allowedDays:{type:"month",days:e.map((e=>parseInt(e.value))).filter((e=>Number.isInteger(e)&&e>=1&&e<=31))}})},this.__disallowedDatesInputParams={type:"date"},this.__disallowedDatesGetValue=()=>{var e,t;return null!==(t=null===(e=this.form.disallowedDates)||void 0===e?void 0:e.map((e=>({value:e}))))&&void 0!==t?t:[]},this.__disallowedDatesSetValue=e=>{this.edit({disallowedDates:e.map((e=>e.value))})}}static get v8n(){return[({jsonataQuery:e})=>!!e||"jsonata-query:v8n_required",({jsonataQuery:e})=>!e||e.length<=200||"jsonata-query:v8n_too_long",({disallowedDates:e})=>!e||e.length<=10||"disallowed-dates:v8n_too_long"]}get hiddenSelector(){var e,t;const s=["timestamps",super.hiddenSelector.toString()],o=this.form;return o.min||s.unshift("min"),o.max||s.unshift("max"),"day"!==(null===(e=o.allowedDays)||void 0===e?void 0:e.type)&&s.unshift("days-of-week"),"month"!==(null===(t=o.allowedDays)||void 0===t?void 0:t.type)&&s.unshift("dates-of-month"),new i(s.join(" ").trim())}renderBody(){return o(p||(p=h` <foxy-internal-source-control infer="jsonata-query" property="jsonataQuery"> </foxy-internal-source-control> <foxy-internal-checkbox-group-control infer="minmax-restrictions" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-frequency-control infer="min"></foxy-internal-frequency-control> <foxy-internal-frequency-control infer="max"></foxy-internal-frequency-control> <foxy-internal-radio-group-control infer="day-and-date-restrictions" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="days-of-week" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-editable-list-control infer="dates-of-month" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="disallowed-dates" range="optional" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__minmaxRestrictionsGetValue,this.__minmaxRestrictionsSetValue,this.__minmaxRestrictionsOptions,this.__dayAndDateRestrictionsGetValue,this.__dayAndDateRestrictionsSetValue,this.__dayAndDateRestrictionsOptions,this.__daysOfWeekGetValue,this.__daysOfWeekSetValue,this.__daysOfWeekOptions,this.__datesOfMonthInputParams,this.__datesOfMonthGetValue,this.__datesOfMonthSetValue,this.__disallowedDatesInputParams,this.__disallowedDatesGetValue,this.__disallowedDatesSetValue,super.renderBody())}});let y,_=e=>e;const v=t(a);function x(e){try{return new URL(e).origin===e.toLowerCase()}catch(e){return!1}}customElements.define("foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-card",class extends v{renderBody(){var e;const{min:t,max:i,allowedDays:s,jsonataQuery:a,disallowedDates:r}=null!==(e=this.data)&&void 0!==e?e:{},l=t?n(t):void 0,d=i?n(i):void 0,u="*"===a?"line_1_all":"line_1_matching",c={query:a},f={from:l?this.t(`unit_${l.units}`,{count:l.count}):this.t("any"),to:d?this.t(`unit_${d.units}`,{count:d.count}):this.t("any")},p=`line_3_${s?s.type:"any"}`,h={list:"month"===(null==s?void 0:s.type)?null==s?void 0:s.days.join(", "):null==s?void 0:s.days.map((e=>this.t(`day_${e}`))).join(", ")},m=r?"line_4_some":"line_4_none",v={list:null==r?void 0:r.map((e=>{const[t,i]=e.split("..");return t&&i?this.t("date_range",{from:t,to:i}):this.t("single_date",{value:e})})).join(", ")};return o(y||(y=_` <section class="leading-xs" style="margin:-.25ch 0"> <p class="text-m font-medium truncate"> <foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n> </p> <p class="text-s text-secondary"> <foxy-i18n infer="" class="block truncate" key="line_2" .options="${0}"> </foxy-i18n> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> <foxy-i18n infer="" class="block truncate" key="${0}" .options="${0}"> </foxy-i18n> </p> </section> `),u,c,f,p,h,m,v)}});let g,b=e=>e;const j=t(e,"customer-portal-settings-form");class w extends j{constructor(){super(...arguments),this.__sessionLifespanInMinutesOptions=[{value:"m",label:"option_minute"},{value:"h",label:"option_hour"},{value:"d",label:"option_day"},{value:"w",label:"option_week"}],this.__sessionLifespanInMinutesGetValue=()=>{var e;const t=null!==(e=this.form.sessionLifespanInMinutes)&&void 0!==e?e:0;return t%10080==0?t/10080+"w":t%1440==0?t/1440+"d":t%60==0?t/60+"h":`${t}m`},this.__sessionLifespanInMinutesSetValue=e=>{const t=parseInt(e);e.endsWith("w")?this.edit({sessionLifespanInMinutes:10080*t}):e.endsWith("d")?this.edit({sessionLifespanInMinutes:1440*t}):e.endsWith("h")?this.edit({sessionLifespanInMinutes:60*t}):this.edit({sessionLifespanInMinutes:t})},this.__allowedOriginsGetValue=()=>{var e;return null===(e=this.form.allowedOrigins)||void 0===e?void 0:e.map((e=>({label:x(e)?e:`⚠️ ${e}`,value:e})))},this.__allowedOriginsSetValue=e=>{this.edit({allowedOrigins:e.map((({value:e})=>function(e){try{return new URL(e).origin}catch(t){return e}}(e))).filter(((e,t,i)=>i.indexOf(e)===t))})},this.__featuresOptions=[{value:"sso",label:"option_sso"},{value:"sign-up",label:"option_sign_up"},{value:"frequency-modification",label:"option_frequency_modification"},{value:"next-date-modification",label:"option_next_date_modification"}],this.__featuresGetValue=()=>{var e,t,i;const s=[];return this.form.sso&&s.push("sso"),(null===(e=this.form.signUp)||void 0===e?void 0:e.enabled)&&s.push("sign-up"),(null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowNextDateModification)&&s.push("next-date-modification"),(null===(i=this.form.subscriptions)||void 0===i?void 0:i.allowFrequencyModification.length)&&s.push("frequency-modification"),s},this.__featuresSetValue=e=>{var t,i,s,o,n;const a=null!==(i=null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowFrequencyModification)&&void 0!==i?i:[];this.edit({sso:e.includes("sso"),signUp:{enabled:e.includes("sign-up"),verification:null!==(o=null===(s=this.form.signUp)||void 0===s?void 0:s.verification)&&void 0!==o?o:{type:"hcaptcha",siteKey:"",secretKey:""}},subscriptions:{allowFrequencyModification:e.includes("frequency-modification")?0===a.length?[{jsonataQuery:"*",values:[]}]:a:[],allowNextDateModification:!!e.includes("next-date-modification")&&((null===(n=this.form.subscriptions)||void 0===n?void 0:n.allowNextDateModification)||[])}})},this.__signUpVerificationHcaptchaSiteKeyGetValue=()=>{var e,t,i;return null!==(i=null===(t=null===(e=this.form.signUp)||void 0===e?void 0:e.verification)||void 0===t?void 0:t.siteKey)&&void 0!==i?i:""},this.__signUpVerificationHcaptchaSiteKeySetValue=e=>{var t,i,s,o;this.edit({signUp:{enabled:!!(null===(t=this.form.signUp)||void 0===t?void 0:t.enabled),verification:{secretKey:null!==(o=null===(s=null===(i=this.form.signUp)||void 0===i?void 0:i.verification)||void 0===s?void 0:s.secretKey)&&void 0!==o?o:"",siteKey:e,type:"hcaptcha"}}})},this.__signUpVerificationHcaptchaSecretKeyGetValue=()=>{var e,t,i;return null!==(i=null===(t=null===(e=this.form.signUp)||void 0===e?void 0:e.verification)||void 0===t?void 0:t.secretKey)&&void 0!==i?i:""},this.__signUpVerificationHcaptchaSecretKeySetValue=e=>{var t,i,s,o;this.edit({signUp:{enabled:!!(null===(t=this.form.signUp)||void 0===t?void 0:t.enabled),verification:{secretKey:e,siteKey:null!==(o=null===(s=null===(i=this.form.signUp)||void 0===i?void 0:i.verification)||void 0===s?void 0:s.siteKey)&&void 0!==o?o:"",type:"hcaptcha"}}})},this.__jwtSecretGeneratorOptions={charset:"abcdefghijklmnopqrstuvwxyz0123456789",length:64}}static get v8n(){return[({sessionLifespanInMinutes:e})=>"number"!=typeof e||e<=40320||"session-lifespan-in-minutes:v8n_too_long",({allowedOrigins:e=[]})=>e.length<=10||"allowed-origins:v8n_too_many",({allowedOrigins:e=[]})=>e.every(x)||"allowed-origins:v8n_invalid",({jwtSharedSecret:e})=>!e||/^[a-z0-9-]+$/.test(e)||"jwt-shared-secret:v8n_invalid",({jwtSharedSecret:e})=>!e||e.length>=40||"jwt-shared-secret:v8n_too_short",({jwtSharedSecret:e})=>!e||e.length<=100||"jwt-shared-secret:v8n_too_long",({signUp:e})=>{const t=null==e?void 0:e.verification.siteKey;return!t||t.length<=100||"sign-up-verification-hcaptcha-site-key:v8n_too_long"},({signUp:e})=>{const t=null==e?void 0:e.verification.secretKey;return!t||t.length<=100||"sign-up-verification-hcaptcha-secret-key:v8n_too_long"}]}get hiddenSelector(){var e,t,s;const o=["header:copy-id",super.hiddenSelector.toString()];return(null===(e=this.form.signUp)||void 0===e?void 0:e.enabled)||o.push("sign-up-verification-hcaptcha-site-key","sign-up-verification-hcaptcha-secret-key"),(null===(t=this.form.subscriptions)||void 0===t?void 0:t.allowFrequencyModification.length)||o.push("subscriptions-allow-frequency-modification"),(null===(s=this.form.subscriptions)||void 0===s?void 0:s.allowNextDateModification)||o.push("subscriptions-allow-next-date-modification"),new i(o.join(" ").trim())}renderBody(){return o(g||(g=b` ${0} <foxy-internal-editable-list-control infer="allowed-origins" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="features" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="sign-up-verification-hcaptcha-site-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-password-control infer="sign-up-verification-hcaptcha-secret-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-async-list-control first="foxy://${0}/form/subscriptions/allowFrequencyModification" infer="subscriptions-allow-frequency-modification" limit="20" form="foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-form" item="foxy-internal-customer-portal-settings-form-subscriptions-allow-frequency-modification-rule-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="foxy://${0}/form/subscriptions/allowNextDateModification" infer="subscriptions-allow-next-date-modification" limit="20" form="foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-form" item="foxy-internal-customer-portal-settings-form-subscriptions-allow-next-date-modification-rule-card" alert> </foxy-internal-async-list-control> <foxy-internal-frequency-control infer="session-lifespan-in-minutes" max="" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-password-control property="jwtSharedSecret" infer="jwt-shared-secret" show-generator .generatorOptions="${0}"> </foxy-internal-password-control> ${0} `),this.renderHeader(),this.__allowedOriginsGetValue,this.__allowedOriginsSetValue,this.__featuresGetValue,this.__featuresSetValue,this.__featuresOptions,this.__signUpVerificationHcaptchaSiteKeyGetValue,this.__signUpVerificationHcaptchaSiteKeySetValue,this.__signUpVerificationHcaptchaSecretKeyGetValue,this.__signUpVerificationHcaptchaSecretKeySetValue,this.virtualHost,this.virtualHost,this.__sessionLifespanInMinutesGetValue,this.__sessionLifespanInMinutesSetValue,this.__sessionLifespanInMinutesOptions,this.__jwtSecretGeneratorOptions,super.renderBody())}async _sendPost(e){return this.__removeNullProperties(e),super._sendPost(e)}async _sendPatch(e){return this.__removeNullProperties(e),super._sendPatch(e)}__removeNullProperties(e){var t,i;"object"==typeof(null===(t=e.subscriptions)||void 0===t?void 0:t.allowNextDateModification)&&(null===(i=e.subscriptions)||void 0===i||i.allowNextDateModification.forEach((e=>{for(const t in e){const i=t;null===e[i]&&delete e[i]}})))}}customElements.define("foxy-customer-portal-settings-form",w);export{w as CustomerPortalSettingsForm};
|