@foxy.io/elements 1.24.0 → 1.24.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-address-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-cart-form.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-coupon-code-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.js +1 -1
- package/dist/cdn/foxy-customer.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-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.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 +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-report-form.js +2 -2
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-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-form.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction.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-form.js +1 -1
- package/dist/cdn/shared-4205699e.js +1 -0
- package/dist/cdn/shared-5280c80a.js +1 -0
- package/dist/cdn/{shared-baeef007.js → shared-94798eb5.js} +1 -1
- package/dist/cdn/translations/address-form/en.json +1 -1
- package/dist/cdn/translations/attribute-form/en.json +1 -1
- package/dist/cdn/translations/cart-form/en.json +45 -65
- package/dist/cdn/translations/client-form/en.json +1 -1
- package/dist/cdn/translations/coupon-code-form/en.json +1 -1
- package/dist/cdn/translations/coupon-form/en.json +4 -4
- package/dist/cdn/translations/custom-field-form/en.json +1 -1
- package/dist/cdn/translations/customer/en.json +3 -3
- package/dist/cdn/translations/customer-form/en.json +1 -1
- package/dist/cdn/translations/customer-portal/en.json +2 -2
- package/dist/cdn/translations/downloadable-form/en.json +1 -1
- package/dist/cdn/translations/email-template-form/en.json +1 -1
- package/dist/cdn/translations/gift-card-code-form/en.json +1 -1
- package/dist/cdn/translations/gift-card-form/en.json +3 -3
- package/dist/cdn/translations/item-category-form/en.json +1 -1
- package/dist/cdn/translations/item-form/en.json +28 -32
- package/dist/cdn/translations/item-option-form/en.json +1 -1
- package/dist/cdn/translations/passkey-form/en.json +1 -1
- package/dist/cdn/translations/payments-api-fraud-protection-form/en.json +1 -1
- package/dist/cdn/translations/payments-api-payment-method-form/en.json +1 -1
- package/dist/cdn/translations/payments-api-payment-preset-form/en.json +1 -1
- package/dist/cdn/translations/report-form/en.json +1 -1
- package/dist/cdn/translations/shipment-card/en.json +45 -64
- package/dist/cdn/translations/store-form/en.json +2 -2
- package/dist/cdn/translations/store-shipping-method-form/en.json +1 -1
- package/dist/cdn/translations/subscription-form/en.json +2 -2
- package/dist/cdn/translations/subscription-settings-form/en.json +1 -1
- package/dist/cdn/translations/tax-form/en.json +1 -1
- package/dist/cdn/translations/template-form/en.json +1 -1
- package/dist/cdn/translations/template-set-form/en.json +1 -1
- package/dist/cdn/translations/transaction/en.json +50 -69
- package/dist/cdn/translations/webhook-form/en.json +1 -1
- package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.d.ts +1 -3
- package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js +18 -41
- package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js.map +1 -1
- package/dist/elements/private/Metadata/Metadata.d.ts +13 -0
- package/dist/elements/private/Metadata/Metadata.js +27 -0
- package/dist/elements/private/Metadata/Metadata.js.map +1 -0
- package/dist/elements/private/index.d.ts +1 -1
- package/dist/elements/private/index.js +1 -1
- package/dist/elements/private/index.js.map +1 -1
- package/dist/elements/public/AddressForm/AddressForm.js +3 -3
- package/dist/elements/public/AddressForm/AddressForm.js.map +1 -1
- package/dist/elements/public/AttributeForm/AttributeForm.js +3 -3
- package/dist/elements/public/AttributeForm/AttributeForm.js.map +1 -1
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js +4 -4
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js +4 -4
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js +3 -3
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +4 -4
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +4 -4
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
- package/dist/elements/public/GiftCardForm/GiftCardForm.js +4 -4
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
- package/dist/elements/public/ItemForm/ItemForm.js +26 -13
- package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
- package/dist/elements/public/ItemForm/index.d.ts +1 -1
- package/dist/elements/public/ItemForm/index.js +1 -1
- package/dist/elements/public/ItemForm/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js +8 -14
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js +13 -19
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js +17 -23
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js +14 -20
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js +28 -26
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.d.ts +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js +0 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js.map +1 -1
- package/dist/elements/public/PaymentsApi/PaymentsApi.js +7 -1
- package/dist/elements/public/PaymentsApi/PaymentsApi.js.map +1 -1
- package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js +1 -1
- package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js.map +1 -1
- package/dist/elements/public/ReportForm/ReportForm.js +4 -4
- package/dist/elements/public/ReportForm/ReportForm.js.map +1 -1
- package/dist/elements/public/StoreForm/StoreForm.js +1 -1
- package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
- package/dist/elements/public/TaxForm/TaxForm.js +4 -4
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.js +4 -4
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-7fab31ac.js +0 -1
- package/dist/cdn/shared-e2e2ca6a.js +0 -1
- package/dist/elements/private/PropertyTable/PropertyTable.d.ts +0 -12
- package/dist/elements/private/PropertyTable/PropertyTable.js +0 -43
- package/dist/elements/private/PropertyTable/PropertyTable.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-13fbea95.js";import"./shared-7abbc95c.js";import"./shared-3c2414d4.js";import"./shared-c76ef8d8.js";import"./shared-9048eeb2.js";import"./shared-b446c140.js";import"./shared-5784c088.js";import"./shared-9b486845.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-generate-codes-form.js";import"./foxy-coupon-codes-form.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./foxy-coupon-code-form.js";import{T as e}from"./shared-ddac7722.js";import"./foxy-pagination.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-2edcd981.js";import{_ as t}from"./shared-4c2e9064.js";import{h as s}from"./shared-7f33a83a.js";import{C as i,a as r}from"./shared-7723f756.js";import{C as o}from"./shared-5cf7b194.js";import{N as a}from"./shared-9b12aeac.js";import{S as n,T as l,a as d,R as c}from"./shared-3b709ddc.js";import{i as u}from"./shared-d3bf9ac0.js";import{c as m}from"./shared-4e709717.js";import{E as p}from"./shared-59fc6288.js";import{G as h}from"./shared-d1f5de89.js";import{P as f}from"./shared-7fab31ac.js";import{l as y}from"./shared-f3b35364.js";import{s as g}from"./shared-79d0699c.js";import"./shared-3f04e4cc.js";import"./shared-e5239bec.js";import"./shared-eb8a0fdf.js";import"./shared-ef7f2d07.js";import"./shared-fff03a45.js";import"./shared-f21e5761.js";import"./shared-f5bbb1e0.js";import"./shared-601f27b1.js";import"./shared-099c1f57.js";import"./shared-6daeb197.js";import"./shared-bee111d6.js";import"./shared-fd96bcd1.js";import"./shared-11c2efc8.js";import"./shared-e8a51c60.js";import"./shared-ff7fd5fa.js";import"./shared-ba93be6b.js";import"./shared-d519a301.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-bb05cfed.js";import"./shared-7a455b15.js";import"./foxy-nucleon-element.js";let x,$=e=>e;const _=o(n(l(a)));class b extends _{constructor(){super(...arguments),this.itemCategory="",this.coupon=""}static get scopedElements(){return{"x-checkbox":i}}static get properties(){return t(t({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},coupon:{type:String}})}render(){return s(x||(x=$` <div class="h-full flex items-center"> <x-checkbox data-testid="checkbox" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <slot></slot> </x-checkbox> </div> `),!this.in("idle")||this.disabled,this.readonly,!!this.data,(e=>{e.detail?(this.edit({item_category_uri:this.itemCategory,coupon_uri:this.coupon}),this.submit()):this.delete()}))}}let v,S=e=>e;const k=o(n(l(a)));class j extends k{constructor(){super(...arguments),this.itemCategory="",this.coupon=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item-content":b}}static get properties(){return t(t({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},coupon:{type:String}})}render(){var e;const t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:coupon_item_categories"][0],i=t?void 0:this.href,r=t?t._links.self.href:void 0;return s(v||(v=S` <x-category-restrictions-page-item-content item-category="${0}" data-testid="content" coupon="${0}" parent="${0}" class="h-full" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> <slot></slot> </x-category-restrictions-page-item-content> `),this.itemCategory,this.coupon,u(i),this.group,u(r),!this.in("idle")||this.disabled,this.readonly)}}let w,T,E,O=e=>e;const R=o(n(l(d(a))));class C extends R{constructor(){super(...arguments),this.couponItemCategories="",this.coupon=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item":j}}static get properties(){return t(t({},super.properties),{},{couponItemCategories:{type:String,attribute:"coupon-item-categories"},coupon:{type:String}})}render(){var e,t,i,r,o;const a=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:item_categories"])&&void 0!==t?t:[];let n=20;try{const e=parseInt(null!==(i=new URL(this.href).searchParams.get("limit"))&&void 0!==i?i:"");isNaN(e)||(n=e)}catch(e){}return s(w||(w=O` <div class="relative"> <div class="relative divide-y divide-contrast-10 ml-m"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" state="${0}" class="m-auto p-m bg-base rounded-t-l rounded-b-l shadow-xs" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),new Array(n).fill(0).map(((e,t)=>{const i=a[t];let r;if(i)try{const e=new URL(this.couponItemCategories),t=new URL(i._links.self.href).pathname.split("/").pop();e.searchParams.set("item_category_id",t),e.searchParams.set("limit","1"),r=e.toString()}catch(e){}return r?s(E||(E=O` <x-category-restrictions-page-item data-testclass="item" item-category="${0}" coupon="${0}" class="h-l" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> ${0} </x-category-restrictions-page-item> `),i._links.self.href,this.coupon,this.group,r,!this.in("idle")||this.disabled,this.readonly,null==i?void 0:i.name):s(T||(T=O`<div class="h-l"></div>`))})),m({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(o=null===(r=customElements.get("foxy-spinner"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:"")}}let q,N,P,D,U,V,z,I,J,Q,L,G,A,M,W,B,F,H,K,X,Y,Z,ee,te,se,ie,re,oe,ae=e=>e;const ne=n(l(o(c(d(a,"coupon-form")))));class le extends ne{constructor(){super(...arguments),this.__codesTableColumns=[{header:e=>s(q||(q=ae`<foxy-i18n lang="${0}" key="code" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>{const t=!this.in("idle")||this.disabledSelector.matches("codes",!0);return s(N||(N=ae` <div class="flex items-center gap-xs"> <vaadin-button theme="tertiary-inline contrast" class="p-0" ?disabled="${0}" @click="${0}"> <span class="font-tnum">${0}</span> </vaadin-button> <foxy-copy-to-clipboard ?disabled="${0}" text="${0}" lang="${0}" ns="${0} copy-to-clipboard"> </foxy-copy-to-clipboard> </div> `),t,(t=>{const s=this.renderRoot.querySelector("#code-dialog"),i=t.currentTarget;s.href=e.data._links.self.href,s.show(i)}),e.data.code,t,e.data.code,e.lang,e.ns)}},{header:e=>s(P||(P=ae`<foxy-i18n lang="${0}" key="date_created" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>s(D||(D=ae` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.date_created}),e.lang,e.ns)},{hideBelow:"sm",header:e=>s(U||(U=ae`<foxy-i18n lang="${0}" key="date_modified" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>s(V||(V=ae` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.date_modified}),e.lang,e.ns)},{header:e=>s(z||(z=ae`<foxy-i18n lang="${0}" key="used_codes" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>s(I||(I=ae`${0}`),e.data.number_of_uses_to_date)}],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,s)=>!!e&&s.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,s)=>!!e&&s.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__codesTableQuery=null,this.__itemCategories=""}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"iron-dropdown":customElements.get("iron-dropdown"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-editable-list-control":customElements.get("foxy-internal-editable-list-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-discount-builder":customElements.get("foxy-discount-builder"),"foxy-query-builder":customElements.get("foxy-query-builder"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"foxy-pagination":customElements.get("foxy-pagination"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"x-category-restrictions-page":C,"x-property-table":f,"x-editable-list":p,"x-checkbox":i,"x-group":h}}static get properties(){return t(t({},super.properties),{},{__codesTableQuery:{attribute:!1},__itemCategories:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({name:e})=>!e||e.length<=50||"name_too_long"]}render(){var e,t;const i=this.hiddenSelector;return s(J||(J=ae` <div class="relative space-y-l"> ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),i.matches("name",!0)?"":this.__renderName(),i.matches("rules",!0)?"":this.__renderRules(),i.matches("codes",!0)||!this.data?"":this.__renderCodes(),i.matches("usage",!0)?"":this.__renderUsage(),i.matches("product-restrictions",!0)?"":this.__renderProductRestrictions(),i.matches("category-restrictions",!0)||!this.data?"":this.__renderCategoryRestrictions(),this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,i.matches("customer-attribute-restrictions",!0)?"":this.__renderCustomerAttributeRestrictions(),i.matches("options",!0)?"":this.__renderOptions(),i.matches("timestamps",!0)?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),m({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}async _sendGet(){const e=await super._sendGet(),t=await super._fetch(e._links["fx:store"].href),s=new URL(t._links["fx:item_categories"].href);return s.searchParams.set("limit","5"),this.__itemCategories=s.toString(),e}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){return s(Q||(Q=ae` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" data-testid="name" class="w-full" label="${0}" .checkValidity="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.__getErrorMessage("name"),this.t("coupon_name_helper_text"),this.t("name"),this.__getValidator("name"),this.form.name,!this.in("idle")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderRulesPreset(){const e=!this.in("idle")||this.disabledSelector.matches("rules",!0),i=this.readonlySelector.matches("rules",!0),r=this.form.coupon_discount_details,o=this.form.coupon_discount_type,a=[{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"}],n=a.find((e=>e.details===r&&e.type===o));return s(L||(L=ae` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" lang="${0}" key="preset" ns="${0}"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),m({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!e&&!i,"text-disabled":e,"text-secondary":i}),this.lang,this.ns,n?this.t("discount_summary",{params:t(t({},n),{},{ns:this.ns})}):this.t("custom_discount"),e||i,(e=>{var t,s;const i=e.currentTarget,r=a[i.selectedIndex];this.edit({coupon_discount_details:null!==(t=null==r?void 0:r.details)&&void 0!==t?t:"",coupon_discount_type:null!==(s=null==r?void 0:r.type)&&void 0!==s?s:"quantity_amount"})}),a.map((e=>s(G||(G=ae` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===n,this.t("discount_summary",{params:t(t({},e),{},{ns:this.ns})})))),!n,this.t("custom_discount"))}__renderRulesUrlParameter(){var e,t,i;const r=null!==(e=this.form.name)&&void 0!==e?e:"",o=null!==(t=this.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",a=null!==(i=this.form.coupon_discount_details)&&void 0!==i?i:"",n=`discount_${o}=${encodeURIComponent(`${r}{${a}}`)}`,l=!this.in("idle")||this.disabledSelector.matches("rules",!0);return s(A||(A=ae` <div data-testid="rules:url" class="text-xs flex space-x-xs"> <span class="${0}"> <foxy-i18n lang="${0}" key="url_parameter" ns="${0}"></foxy-i18n>: </span> <code class="${0}"> ${0} </code> <foxy-copy-to-clipboard data-testid="rules:url:copy" text="${0}" lang="${0}" ns="${0} copy-to-clipboard" ?disabled="${0}"> </foxy-copy-to-clipboard> </div> `),m({"flex-shrink-0 transition-colors":!0,"text-tertiary":!l,"text-disabled":l}),this.lang,this.ns,m({"bg-contrast-5 transition-colors font-lumo truncate rounded-s px-xs":!0,"text-secondary":!l,"text-disabled":l}),n,n,this.lang,this.ns,l)}__renderRulesDescription(){var e,t;const i=null!==(e=this.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",r=null!==(t=this.form.coupon_discount_details)&&void 0!==t?t:"",o=!this.in("idle")||this.disabledSelector.matches("rules",!0);return s(M||(M=ae` <div data-testid="rules:description" class="text-xs leading-m"> <span class="transition-colors ${0}"> <foxy-i18n lang="${0}" key="description" ns="${0}"></foxy-i18n>: </span> <foxy-i18n options="${0}" class="transition-colors ${0}" lang="${0}" key="discount_summary" ns="${0}"> </foxy-i18n> </div> `),o?"text-disabled":"text-tertiary",this.lang,this.ns,JSON.stringify({params:{details:r,type:i,ns:this.ns}}),o?"text-disabled":"text-secondary",this.lang,this.ns)}__renderRules(){var e,t;const i=!this.in("idle")||this.disabledSelector.matches("rules",!0),r=this.readonlySelector.matches("rules",!0),o=null!==(e=this.form.coupon_discount_details)&&void 0!==e?e:"",a=null!==(t=this.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount";return s(W||(W=ae` <div data-testid="rules"> ${0} <div> <div class="flex items-center justify-between space-x-m text-s mb-xs"> <foxy-i18n class="${0}" lang="${0}" key="rule_plural" ns="${0}"> </foxy-i18n> <div class="min-w-0">${0}</div> </div> <foxy-discount-builder data-testclass="interactive" lang="${0}" ns="${0}" ?readonly="${0}" ?disabled="${0}" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> <div class="space-y-xs mt-m"> ${0} ${0} </div> </div> ${0} </div> `),this.renderTemplateOrSlot("rules:before"),m({"transition-colors font-medium flex-1":!0,"text-secondary":!i,"text-disabled":i}),this.lang,this.ns,this.__renderRulesPreset(),this.lang,this.ns,r,i,{details:o,type:a,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue;this.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),this.__renderRulesUrlParameter(),this.__renderRulesDescription(),this.renderTemplateOrSlot("rules:after"))}__renderCodes(){var e,t,i,r,o;const{disabledSelector:a,group:n,data:l,lang:d,ns:c}=this,u=!this.in("idle")||a.matches("codes",!0),m=this.__codesTableQuery,p=new URL(l._links["fx:coupon_codes"].href);new URLSearchParams(null!=m?m:"").forEach(((e,t)=>p.searchParams.set(t,e))),p.searchParams.set("limit","5");const h=null===m?"filter":"clear_filters",f="icons:"+(null===m?"filter-list":"clear");return s(B||(B=ae` <div data-testid="codes"> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button current-balance ${0}" related="${0}" header="generate" parent="${0}" group="${0}" lang="${0}" form="foxy-generate-codes-form" ns="${0}" id="generate-codes-dialog" alert .related="${0}"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" header="code" parent="${0}" group="${0}" lang="${0}" form="foxy-coupon-code-form" ns="${0}" id="code-dialog"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button ${0}" header="import" parent="${0}" group="${0}" lang="${0}" form="foxy-coupon-codes-form" ns="${0}" id="import-dialog"> </foxy-form-dialog> ${0} <div class="flex items-center justify-between mb-xs space-x-s"> <foxy-i18n class="text-s font-medium text-secondary leading-none flex-1" lang="${0}" key="code_plural" ns="${0}"> </foxy-i18n> <vaadin-button data-testid="codes:generate-button" theme="success tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="generate" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:add"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:import-button" theme="contrast tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="import" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:open-in-browser"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:filter-button" theme="contrast ${0} small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="${0}" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="${0}"></iron-icon> </vaadin-button> </div> <foxy-query-builder class="my-s" lang="${0}" ns="${0} ${0}" ?disabled="${0}" ?hidden="${0}" .options="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-table class="px-m mb-s border border-contrast-10 rounded" group="${0}" lang="${0}" ns="${0}" .columns="${0}"> </foxy-table> </foxy-pagination> ${0} </div> `),a.zoom("codes:generate:form").toString(),this.readonlySelector.zoom("codes:generate:form").toString(),this.hiddenSelector.zoom("codes:generate:form").toString(),JSON.stringify([p.toString()]),null!==(e=null==l?void 0:l._links["fx:generate_codes"].href)&&void 0!==e?e:"",n,d,c,[p.toString()],a.zoom("codes:form").toString(),this.readonlySelector.zoom("codes:form").toString(),this.hiddenSelector.zoom("codes:form").toString(),p.toString(),n,d,c,a.zoom("codes:import:form").toString(),this.readonlySelector.zoom("codes:import:form").toString(),this.hiddenSelector.zoom("codes:import:form").toString(),l._links["fx:coupon_codes"].href,n,d,c,this.renderTemplateOrSlot("codes:before"),d,c,u,(e=>{const t=this.renderRoot.querySelector("#generate-codes-dialog"),s=e.currentTarget;null==t||t.show(s)}),d,c,u,(e=>{const t=this.renderRoot.querySelector("#import-dialog"),s=e.currentTarget;null==t||t.show(s)}),d,c,null===m?"tertiary":"",u,(()=>this.__codesTableQuery=null===m?"":null),d,h,c,f,d,c,null!==(i=null===(t=customElements.get("foxy-query-builder"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"",u,null===m,le.__codesQueryOptions,m,(e=>{const t=e.currentTarget;this.__codesTableQuery=t.value}),p.toString(),d,c,null!==(o=null===(r=customElements.get("foxy-pagination"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:"",u,n,d,c,this.__codesTableColumns,this.renderTemplateOrSlot("codes:after"))}__renderUsage(){var e,t,i;const r=!this.in("idle")||this.disabledSelector.matches("usage",!0),o=this.readonlySelector.matches("usage",!0),a=null!==(e=this.form.number_of_uses_allowed)&&void 0!==e?e:0,n=null!==(t=this.form.number_of_uses_allowed_per_customer)&&void 0!==t?t:0,l=null!==(i=this.form.number_of_uses_allowed_per_code)&&void 0!==i?i:0;return s(F||(F=ae` <div data-testid="usage"> ${0} <div class="space-y-s"> <div class="grid gap-m grid-cols-3"> <vaadin-integer-field placeholder="${0}" data-testid="usage:per-coupon" label="${0}" class="w-full" min="0" prevent-invalid-input has-controls .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-integer-field> <vaadin-integer-field placeholder="${0}" data-testid="usage:per-coupon-code" label="${0}" class="w-full" min="0" prevent-invalid-input has-controls .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-integer-field> <vaadin-integer-field placeholder="${0}" data-testid="usage:per-customer" label="${0}" class="w-full" min="0" prevent-invalid-input has-controls .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-integer-field> </div> <div class="${0}"> <foxy-i18n options="${0}" lang="${0}" key="uses_per_coupon_summary${0}" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="uses_per_coupon_code_summary${0}" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="uses_per_customer_summary${0}" ns="${0}"> </foxy-i18n> </div> </div> ${0} </div> `),this.renderTemplateOrSlot("usage:before"),this.t("unlimited"),this.t("uses_per_coupon"),a||"",r,o,(e=>{const t=e.currentTarget;this.edit({number_of_uses_allowed:parseInt(t.value)})}),this.t("unlimited"),this.t("uses_per_coupon_code"),l||"",r,o,(e=>{const t=e.currentTarget;this.edit({number_of_uses_allowed_per_code:parseInt(t.value)})}),this.t("unlimited"),this.t("uses_per_customer"),n||"",r,o,(e=>{const t=e.currentTarget;this.edit({number_of_uses_allowed_per_customer:parseInt(t.value)})}),m({"transition-colors text-xs leading-s":!0,"text-secondary":!r,"text-disabled":r}),JSON.stringify({count:a}),this.lang,a?"":"_0",this.ns,JSON.stringify({count:l}),this.lang,l?"":"_0",this.ns,JSON.stringify({count:n}),this.lang,n?"":"_0",this.ns,this.renderTemplateOrSlot("usage:after"))}__renderProductRestrictions(){var e;const t="product-restrictions",i=!this.in("idle")||this.disabledSelector.matches(t,!0),r=this.readonlySelector.matches(t,!0),o=null!==(e=this.form.product_code_restrictions)&&void 0!==e?e:"",a=[{header:"allow",items:[]},{header:"block",items:[]}];return o&&o.split(",").forEach((e=>{const t=e.trim();if(!t)return;const s=t.startsWith("-"),i=s?1:0,r=s?t.substring(1):t;a[i].items.push({label:r,value:t})})),s(H||(H=ae` <div data-testid="product-restrictions"> ${0} <div class="space-y-s"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="product_restrictions" ns="${0}"> </foxy-i18n> <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap:1px"> ${0} </div> </x-group> <foxy-i18n class="${0}" lang="${0}" key="product_restrictions_explainer" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("product-restrictions:before"),i?"text-disabled":"text-secondary",this.lang,this.ns,a.map(((e,t)=>s(K||(K=ae` <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <x-editable-list data-testid="product-restrictions:${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" .items="${0}" @change="${0}"> </x-editable-list> </x-group> `),i?"text-disabled":"text-tertiary",this.lang,e.header,this.ns,e.header,this.lang,this.ns,i,r,e.items,(e=>{const s=[0===t?e.currentTarget.items:a[0].items,1===t?e.currentTarget.items:a[1].items].map((e=>e.map((e=>e.value.replace(/^[\s-]*/,"").trimEnd())))).map((e=>e.filter((e=>!!e)))).map((e=>Array.from(new Set(e)))),i=s[0].concat(s[1].map((e=>`-${e}`))).join(",");this.edit({product_code_restrictions:i})})))),m({"block text-xs leading-s transition-colors":!0,"text-secondary":!i,"text-disabled":i}),this.lang,this.ns,this.renderTemplateOrSlot("product-restrictions:after"))}__renderCategoryRestrictions(){var e,t,i;const r="category-restrictions",o=!this.in("idle")||this.disabledSelector.matches(r,!0),a=this.readonlySelector.matches(r,!0);return s(X||(X=ae` <div data-testid="category-restrictions"> ${0} <div class="space-y-xs"> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" lang="${0}" key="category_restrictions" ns="${0}"> </foxy-i18n> <x-category-restrictions-page coupon-item-categories="${0}" data-testid="category-restrictions:page" coupon="${0}" class="border border-contrast-10 rounded mb-s" group="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}"> </x-category-restrictions-page> </foxy-pagination> <foxy-i18n class="block text-xs leading-s text-tertiary" lang="${0}" key="category_restrictions_helper_text" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("category-restrictions:before"),this.__itemCategories,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-pagination"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",o,this.lang,this.ns,u(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),this.href,this.group,this.lang,this.ns,o,a,this.lang,this.ns,this.renderTemplateOrSlot("category-restrictions:after"))}__renderCustomerAttributeRestrictions(){var e;const t="customer-attribute-restrictions",i=this.disabledSelector.matches(t,!0),r=this.readonlySelector.matches(t,!0);return s(Y||(Y=ae` <div data-testid="customer-attribute-restrictions"> ${0} <div class="${0}"> <foxy-i18n class="text-s font-medium" infer="${0}" key="label"></foxy-i18n> <foxy-query-builder infer="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-i18n class="text-xs" infer="${0}" key="helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot(`${t}:before`),m({"grid gap-xs leading-xs transition-colors":!0,"text-secondary hover-text-body":!i&&!r,"text-disabled":i,"text-body":r}),t,t,null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:null,(e=>{var t;const s=e.currentTarget;this.edit({customer_attribute_restrictions:null!==(t=s.value)&&void 0!==t?t:""}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})}),t,this.renderTemplateOrSlot(`${t}:after`))}__renderOptions(){const e=!this.in("idle")||this.disabledSelector.matches("options",!0),t=this.readonlySelector.matches("options",!0);return s(Z||(Z=ae` <div data-testid="options"> ${0} <x-group frame> <foxy-i18n class="transition-colors ${0}" slot="header" lang="${0}" key="option_plural" ns="${0}"> </foxy-i18n> ${0} <x-checkbox data-testclass="inputs" data-testid="options:dates" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="set_time_constraints" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="set_time_constraints_explainer" ns="${0}"> </foxy-i18n> </div> ${0} </x-checkbox> </x-group> ${0} </div> `),this.renderTemplateOrSlot("options:before"),e?"text-disabled":"text-secondary",this.lang,this.ns,[{param:"multiple_codes_allowed"},{param:"combinable"},{param:"exclude_category_discounts",label:"combine_with_category_discounts",flip:!0},{param:"exclude_line_item_discounts",label:"combine_with_line_discounts",flip:!0},{param:"is_taxable",label:"apply_taxes_before_coupon"}].map((i=>{var r;const o=this.form[i.param],a=null!==(r=i.label)&&void 0!==r?r:i.param,n=e?"text-disabled":"text-secondary";return s(ee||(ee=ae` <x-checkbox data-testclass="inputs" data-testid="options:${0}" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="transition-colors text-xs leading-s ${0}" lang="${0}" key="${0}_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> <div style="margin-left:calc(1.125rem + (var(--lumo-space-m) * 2))"> <div class="border-b border-contrast-10"></div> </div> `),i.param.replace(/_/g,"-"),e,t,i.flip?!o:o,(e=>{this.edit({[i.param]:i.flip?!e.detail:e.detail})}),this.lang,a,this.ns,n,this.lang,a,this.ns)})),e,t,this.form.start_date||this.form.end_date,(e=>{if(e instanceof r){let t=null,s=null;if(e.detail){const e=Date.now(),i=new Date(e).setMonth((new Date).getMonth()+1);t=g(new Date(e)),s=g(new Date(i))}this.edit({start_date:t,end_date:s})}}),this.lang,this.ns,e?"text-disabled":"text-secondary",this.lang,this.ns,this.form.start_date||this.form.end_date?s(te||(te=ae` <div class="grid grid-cols-2 gap-m mt-m" slot="content" style="--lumo-border-radius:var(--lumo-border-radius-s)"> ${0} </div> `),["start_date","end_date"].map((i=>{const r=this.form[i],o=r?r.length>10?g(new Date(r)):r:"";return s(se||(se=ae` <vaadin-date-picker data-testclass="inputs" data-testid="options:${0}" placeholder="${0}" label="${0}" clear-button-visible ?disabled="${0}" ?readonly="${0}" .value="${0}" @change="${0}"> </vaadin-date-picker> `),i.replace("_","-"),this.t("select"),this.t(i),e,t,y(o),(e=>{const t=e.currentTarget;this.edit({[i]:t.value})}))}))):"",this.renderTemplateOrSlot("options:after"))}__renderTimestamps(){return s(ie||(ie=ae` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),r=this.in({idle:{snapshot:{dirty:"invalid"}}}),o=e||t||(i||r),a=this.in("idle");return s(re||(re=ae` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!a||o||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return s(oe||(oe=ae` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}le.__codesQueryOptions=[{label:"code",path:"code",type:e.String},{label:"used_codes",path:"number_of_uses_to_date",type:e.Number},{label:"date_created",path:"date_created",type:e.Date},{label:"date_modified",path:"date_modified",type:e.Date}],customElements.define("foxy-coupon-form",le);export{le as CouponForm};
|
|
1
|
+
import"./shared-13fbea95.js";import"./shared-7abbc95c.js";import"./shared-3c2414d4.js";import"./shared-c76ef8d8.js";import"./shared-9048eeb2.js";import"./shared-b446c140.js";import"./shared-5784c088.js";import"./shared-9b486845.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-generate-codes-form.js";import"./foxy-coupon-codes-form.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./foxy-coupon-code-form.js";import{T as e}from"./shared-ddac7722.js";import"./foxy-pagination.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-2edcd981.js";import{_ as t}from"./shared-4c2e9064.js";import{h as s}from"./shared-7f33a83a.js";import{C as i,a as r}from"./shared-7723f756.js";import{C as o}from"./shared-5cf7b194.js";import{N as a}from"./shared-9b12aeac.js";import{S as n,T as l,a as d,R as c}from"./shared-3b709ddc.js";import{i as u}from"./shared-d3bf9ac0.js";import{c as m}from"./shared-4e709717.js";import{E as p}from"./shared-59fc6288.js";import{G as h}from"./shared-d1f5de89.js";import{M as f}from"./shared-4205699e.js";import{l as y}from"./shared-f3b35364.js";import{s as g}from"./shared-79d0699c.js";import"./shared-3f04e4cc.js";import"./shared-e5239bec.js";import"./shared-eb8a0fdf.js";import"./shared-ef7f2d07.js";import"./shared-fff03a45.js";import"./shared-f21e5761.js";import"./shared-f5bbb1e0.js";import"./shared-601f27b1.js";import"./shared-099c1f57.js";import"./shared-6daeb197.js";import"./shared-bee111d6.js";import"./shared-fd96bcd1.js";import"./shared-11c2efc8.js";import"./shared-e8a51c60.js";import"./shared-ff7fd5fa.js";import"./shared-ba93be6b.js";import"./shared-d519a301.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-bb05cfed.js";import"./shared-7a455b15.js";import"./foxy-nucleon-element.js";let x,$=e=>e;const _=o(n(l(a)));class b extends _{constructor(){super(...arguments),this.itemCategory="",this.coupon=""}static get scopedElements(){return{"x-checkbox":i}}static get properties(){return t(t({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},coupon:{type:String}})}render(){return s(x||(x=$` <div class="h-full flex items-center"> <x-checkbox data-testid="checkbox" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <slot></slot> </x-checkbox> </div> `),!this.in("idle")||this.disabled,this.readonly,!!this.data,(e=>{e.detail?(this.edit({item_category_uri:this.itemCategory,coupon_uri:this.coupon}),this.submit()):this.delete()}))}}let v,S=e=>e;const k=o(n(l(a)));class j extends k{constructor(){super(...arguments),this.itemCategory="",this.coupon=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item-content":b}}static get properties(){return t(t({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},coupon:{type:String}})}render(){var e;const t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:coupon_item_categories"][0],i=t?void 0:this.href,r=t?t._links.self.href:void 0;return s(v||(v=S` <x-category-restrictions-page-item-content item-category="${0}" data-testid="content" coupon="${0}" parent="${0}" class="h-full" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> <slot></slot> </x-category-restrictions-page-item-content> `),this.itemCategory,this.coupon,u(i),this.group,u(r),!this.in("idle")||this.disabled,this.readonly)}}let w,T,E,O=e=>e;const R=o(n(l(d(a))));class C extends R{constructor(){super(...arguments),this.couponItemCategories="",this.coupon=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item":j}}static get properties(){return t(t({},super.properties),{},{couponItemCategories:{type:String,attribute:"coupon-item-categories"},coupon:{type:String}})}render(){var e,t,i,r,o;const a=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:item_categories"])&&void 0!==t?t:[];let n=20;try{const e=parseInt(null!==(i=new URL(this.href).searchParams.get("limit"))&&void 0!==i?i:"");isNaN(e)||(n=e)}catch(e){}return s(w||(w=O` <div class="relative"> <div class="relative divide-y divide-contrast-10 ml-m"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" state="${0}" class="m-auto p-m bg-base rounded-t-l rounded-b-l shadow-xs" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),new Array(n).fill(0).map(((e,t)=>{const i=a[t];let r;if(i)try{const e=new URL(this.couponItemCategories),t=new URL(i._links.self.href).pathname.split("/").pop();e.searchParams.set("item_category_id",t),e.searchParams.set("limit","1"),r=e.toString()}catch(e){}return r?s(E||(E=O` <x-category-restrictions-page-item data-testclass="item" item-category="${0}" coupon="${0}" class="h-l" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> ${0} </x-category-restrictions-page-item> `),i._links.self.href,this.coupon,this.group,r,!this.in("idle")||this.disabled,this.readonly,null==i?void 0:i.name):s(T||(T=O`<div class="h-l"></div>`))})),m({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(o=null===(r=customElements.get("foxy-spinner"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:"")}}let q,N,D,P,U,V,z,I,J,Q,L,G,M,A,W,B,F,H,K,X,Y,Z,ee,te,se,ie,re,oe,ae=e=>e;const ne=n(l(o(c(d(a,"coupon-form")))));class le extends ne{constructor(){super(...arguments),this.__codesTableColumns=[{header:e=>s(q||(q=ae`<foxy-i18n lang="${0}" key="code" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>{const t=!this.in("idle")||this.disabledSelector.matches("codes",!0);return s(N||(N=ae` <div class="flex items-center gap-xs"> <vaadin-button theme="tertiary-inline contrast" class="p-0" ?disabled="${0}" @click="${0}"> <span class="font-tnum">${0}</span> </vaadin-button> <foxy-copy-to-clipboard ?disabled="${0}" text="${0}" lang="${0}" ns="${0} copy-to-clipboard"> </foxy-copy-to-clipboard> </div> `),t,(t=>{const s=this.renderRoot.querySelector("#code-dialog"),i=t.currentTarget;s.href=e.data._links.self.href,s.show(i)}),e.data.code,t,e.data.code,e.lang,e.ns)}},{header:e=>s(D||(D=ae`<foxy-i18n lang="${0}" key="date_created" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>s(P||(P=ae` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.date_created}),e.lang,e.ns)},{hideBelow:"sm",header:e=>s(U||(U=ae`<foxy-i18n lang="${0}" key="date_modified" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>s(V||(V=ae` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.date_modified}),e.lang,e.ns)},{header:e=>s(z||(z=ae`<foxy-i18n lang="${0}" key="used_codes" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>s(I||(I=ae`${0}`),e.data.number_of_uses_to_date)}],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,s)=>!!e&&s.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,s)=>!!e&&s.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__codesTableQuery=null,this.__itemCategories=""}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"iron-dropdown":customElements.get("iron-dropdown"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-editable-list-control":customElements.get("foxy-internal-editable-list-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-discount-builder":customElements.get("foxy-discount-builder"),"foxy-query-builder":customElements.get("foxy-query-builder"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"foxy-pagination":customElements.get("foxy-pagination"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"x-category-restrictions-page":C,"x-metadata":f,"x-editable-list":p,"x-checkbox":i,"x-group":h}}static get properties(){return t(t({},super.properties),{},{__codesTableQuery:{attribute:!1},__itemCategories:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({name:e})=>!e||e.length<=50||"name_too_long"]}render(){var e,t;const i=this.hiddenSelector;return s(J||(J=ae` <div class="relative space-y-l"> ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),i.matches("name",!0)?"":this.__renderName(),i.matches("rules",!0)?"":this.__renderRules(),i.matches("codes",!0)||!this.data?"":this.__renderCodes(),i.matches("usage",!0)?"":this.__renderUsage(),i.matches("product-restrictions",!0)?"":this.__renderProductRestrictions(),i.matches("category-restrictions",!0)||!this.data?"":this.__renderCategoryRestrictions(),this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,i.matches("customer-attribute-restrictions",!0)?"":this.__renderCustomerAttributeRestrictions(),i.matches("options",!0)?"":this.__renderOptions(),i.matches("timestamps",!0)?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),m({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}async _sendGet(){const e=await super._sendGet(),t=await super._fetch(e._links["fx:store"].href),s=new URL(t._links["fx:item_categories"].href);return s.searchParams.set("limit","5"),this.__itemCategories=s.toString(),e}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){return s(Q||(Q=ae` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" data-testid="name" class="w-full" label="${0}" .checkValidity="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.__getErrorMessage("name"),this.t("coupon_name_helper_text"),this.t("name"),this.__getValidator("name"),this.form.name,!this.in("idle")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderRulesPreset(){const e=!this.in("idle")||this.disabledSelector.matches("rules",!0),i=this.readonlySelector.matches("rules",!0),r=this.form.coupon_discount_details,o=this.form.coupon_discount_type,a=[{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"}],n=a.find((e=>e.details===r&&e.type===o));return s(L||(L=ae` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" lang="${0}" key="preset" ns="${0}"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),m({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!e&&!i,"text-disabled":e,"text-secondary":i}),this.lang,this.ns,n?this.t("discount_summary",{params:t(t({},n),{},{ns:this.ns})}):this.t("custom_discount"),e||i,(e=>{var t,s;const i=e.currentTarget,r=a[i.selectedIndex];this.edit({coupon_discount_details:null!==(t=null==r?void 0:r.details)&&void 0!==t?t:"",coupon_discount_type:null!==(s=null==r?void 0:r.type)&&void 0!==s?s:"quantity_amount"})}),a.map((e=>s(G||(G=ae` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===n,this.t("discount_summary",{params:t(t({},e),{},{ns:this.ns})})))),!n,this.t("custom_discount"))}__renderRulesUrlParameter(){var e,t,i;const r=null!==(e=this.form.name)&&void 0!==e?e:"",o=null!==(t=this.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",a=null!==(i=this.form.coupon_discount_details)&&void 0!==i?i:"",n=`discount_${o}=${encodeURIComponent(`${r}{${a}}`)}`,l=!this.in("idle")||this.disabledSelector.matches("rules",!0);return s(M||(M=ae` <div data-testid="rules:url" class="text-xs flex space-x-xs"> <span class="${0}"> <foxy-i18n lang="${0}" key="url_parameter" ns="${0}"></foxy-i18n>: </span> <code class="${0}"> ${0} </code> <foxy-copy-to-clipboard data-testid="rules:url:copy" text="${0}" lang="${0}" ns="${0} copy-to-clipboard" ?disabled="${0}"> </foxy-copy-to-clipboard> </div> `),m({"flex-shrink-0 transition-colors":!0,"text-tertiary":!l,"text-disabled":l}),this.lang,this.ns,m({"bg-contrast-5 transition-colors font-lumo truncate rounded-s px-xs":!0,"text-secondary":!l,"text-disabled":l}),n,n,this.lang,this.ns,l)}__renderRulesDescription(){var e,t;const i=null!==(e=this.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",r=null!==(t=this.form.coupon_discount_details)&&void 0!==t?t:"",o=!this.in("idle")||this.disabledSelector.matches("rules",!0);return s(A||(A=ae` <div data-testid="rules:description" class="text-xs leading-m"> <span class="transition-colors ${0}"> <foxy-i18n lang="${0}" key="description" ns="${0}"></foxy-i18n>: </span> <foxy-i18n options="${0}" class="transition-colors ${0}" lang="${0}" key="discount_summary" ns="${0}"> </foxy-i18n> </div> `),o?"text-disabled":"text-tertiary",this.lang,this.ns,JSON.stringify({params:{details:r,type:i,ns:this.ns}}),o?"text-disabled":"text-secondary",this.lang,this.ns)}__renderRules(){var e,t;const i=!this.in("idle")||this.disabledSelector.matches("rules",!0),r=this.readonlySelector.matches("rules",!0),o=null!==(e=this.form.coupon_discount_details)&&void 0!==e?e:"",a=null!==(t=this.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount";return s(W||(W=ae` <div data-testid="rules"> ${0} <div> <div class="flex items-center justify-between space-x-m text-s mb-xs"> <foxy-i18n class="${0}" lang="${0}" key="rule_plural" ns="${0}"> </foxy-i18n> <div class="min-w-0">${0}</div> </div> <foxy-discount-builder data-testclass="interactive" lang="${0}" ns="${0}" ?readonly="${0}" ?disabled="${0}" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> <div class="space-y-xs mt-m"> ${0} ${0} </div> </div> ${0} </div> `),this.renderTemplateOrSlot("rules:before"),m({"transition-colors font-medium flex-1":!0,"text-secondary":!i,"text-disabled":i}),this.lang,this.ns,this.__renderRulesPreset(),this.lang,this.ns,r,i,{details:o,type:a,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue;this.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),this.__renderRulesUrlParameter(),this.__renderRulesDescription(),this.renderTemplateOrSlot("rules:after"))}__renderCodes(){var e,t,i,r,o;const{disabledSelector:a,group:n,data:l,lang:d,ns:c}=this,u=!this.in("idle")||a.matches("codes",!0),m=this.__codesTableQuery,p=new URL(l._links["fx:coupon_codes"].href);new URLSearchParams(null!=m?m:"").forEach(((e,t)=>p.searchParams.set(t,e))),p.searchParams.set("limit","5");const h=null===m?"filter":"clear_filters",f="icons:"+(null===m?"filter-list":"clear");return s(B||(B=ae` <div data-testid="codes"> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button current-balance ${0}" related="${0}" header="generate" parent="${0}" group="${0}" lang="${0}" form="foxy-generate-codes-form" ns="${0}" id="generate-codes-dialog" alert .related="${0}"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" header="code" parent="${0}" group="${0}" lang="${0}" form="foxy-coupon-code-form" ns="${0}" id="code-dialog"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button ${0}" header="import" parent="${0}" group="${0}" lang="${0}" form="foxy-coupon-codes-form" ns="${0}" id="import-dialog"> </foxy-form-dialog> ${0} <div class="flex items-center justify-between mb-xs space-x-s"> <foxy-i18n class="text-s font-medium text-secondary leading-none flex-1" lang="${0}" key="code_plural" ns="${0}"> </foxy-i18n> <vaadin-button data-testid="codes:generate-button" theme="success tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="generate" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:add"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:import-button" theme="contrast tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="import" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:open-in-browser"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:filter-button" theme="contrast ${0} small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="${0}" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="${0}"></iron-icon> </vaadin-button> </div> <foxy-query-builder class="my-s" lang="${0}" ns="${0} ${0}" ?disabled="${0}" ?hidden="${0}" .options="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-table class="px-m mb-s border border-contrast-10 rounded" group="${0}" lang="${0}" ns="${0}" .columns="${0}"> </foxy-table> </foxy-pagination> ${0} </div> `),a.zoom("codes:generate:form").toString(),this.readonlySelector.zoom("codes:generate:form").toString(),this.hiddenSelector.zoom("codes:generate:form").toString(),JSON.stringify([p.toString()]),null!==(e=null==l?void 0:l._links["fx:generate_codes"].href)&&void 0!==e?e:"",n,d,c,[p.toString()],a.zoom("codes:form").toString(),this.readonlySelector.zoom("codes:form").toString(),this.hiddenSelector.zoom("codes:form").toString(),p.toString(),n,d,c,a.zoom("codes:import:form").toString(),this.readonlySelector.zoom("codes:import:form").toString(),this.hiddenSelector.zoom("codes:import:form").toString(),l._links["fx:coupon_codes"].href,n,d,c,this.renderTemplateOrSlot("codes:before"),d,c,u,(e=>{const t=this.renderRoot.querySelector("#generate-codes-dialog"),s=e.currentTarget;null==t||t.show(s)}),d,c,u,(e=>{const t=this.renderRoot.querySelector("#import-dialog"),s=e.currentTarget;null==t||t.show(s)}),d,c,null===m?"tertiary":"",u,(()=>this.__codesTableQuery=null===m?"":null),d,h,c,f,d,c,null!==(i=null===(t=customElements.get("foxy-query-builder"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"",u,null===m,le.__codesQueryOptions,m,(e=>{const t=e.currentTarget;this.__codesTableQuery=t.value}),p.toString(),d,c,null!==(o=null===(r=customElements.get("foxy-pagination"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:"",u,n,d,c,this.__codesTableColumns,this.renderTemplateOrSlot("codes:after"))}__renderUsage(){var e,t,i;const r=!this.in("idle")||this.disabledSelector.matches("usage",!0),o=this.readonlySelector.matches("usage",!0),a=null!==(e=this.form.number_of_uses_allowed)&&void 0!==e?e:0,n=null!==(t=this.form.number_of_uses_allowed_per_customer)&&void 0!==t?t:0,l=null!==(i=this.form.number_of_uses_allowed_per_code)&&void 0!==i?i:0;return s(F||(F=ae` <div data-testid="usage"> ${0} <div class="space-y-s"> <div class="grid gap-m grid-cols-3"> <vaadin-integer-field placeholder="${0}" data-testid="usage:per-coupon" label="${0}" class="w-full" min="0" prevent-invalid-input has-controls .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-integer-field> <vaadin-integer-field placeholder="${0}" data-testid="usage:per-coupon-code" label="${0}" class="w-full" min="0" prevent-invalid-input has-controls .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-integer-field> <vaadin-integer-field placeholder="${0}" data-testid="usage:per-customer" label="${0}" class="w-full" min="0" prevent-invalid-input has-controls .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-integer-field> </div> <div class="${0}"> <foxy-i18n options="${0}" lang="${0}" key="uses_per_coupon_summary${0}" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="uses_per_coupon_code_summary${0}" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="uses_per_customer_summary${0}" ns="${0}"> </foxy-i18n> </div> </div> ${0} </div> `),this.renderTemplateOrSlot("usage:before"),this.t("unlimited"),this.t("uses_per_coupon"),a||"",r,o,(e=>{const t=e.currentTarget;this.edit({number_of_uses_allowed:parseInt(t.value)})}),this.t("unlimited"),this.t("uses_per_coupon_code"),l||"",r,o,(e=>{const t=e.currentTarget;this.edit({number_of_uses_allowed_per_code:parseInt(t.value)})}),this.t("unlimited"),this.t("uses_per_customer"),n||"",r,o,(e=>{const t=e.currentTarget;this.edit({number_of_uses_allowed_per_customer:parseInt(t.value)})}),m({"transition-colors text-xs leading-s":!0,"text-secondary":!r,"text-disabled":r}),JSON.stringify({count:a}),this.lang,a?"":"_0",this.ns,JSON.stringify({count:l}),this.lang,l?"":"_0",this.ns,JSON.stringify({count:n}),this.lang,n?"":"_0",this.ns,this.renderTemplateOrSlot("usage:after"))}__renderProductRestrictions(){var e;const t="product-restrictions",i=!this.in("idle")||this.disabledSelector.matches(t,!0),r=this.readonlySelector.matches(t,!0),o=null!==(e=this.form.product_code_restrictions)&&void 0!==e?e:"",a=[{header:"allow",items:[]},{header:"block",items:[]}];return o&&o.split(",").forEach((e=>{const t=e.trim();if(!t)return;const s=t.startsWith("-"),i=s?1:0,r=s?t.substring(1):t;a[i].items.push({label:r,value:t})})),s(H||(H=ae` <div data-testid="product-restrictions"> ${0} <div class="space-y-s"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="product_restrictions" ns="${0}"> </foxy-i18n> <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap:1px"> ${0} </div> </x-group> <foxy-i18n class="${0}" lang="${0}" key="product_restrictions_explainer" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("product-restrictions:before"),i?"text-disabled":"text-secondary",this.lang,this.ns,a.map(((e,t)=>s(K||(K=ae` <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <x-editable-list data-testid="product-restrictions:${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" .items="${0}" @change="${0}"> </x-editable-list> </x-group> `),i?"text-disabled":"text-tertiary",this.lang,e.header,this.ns,e.header,this.lang,this.ns,i,r,e.items,(e=>{const s=[0===t?e.currentTarget.items:a[0].items,1===t?e.currentTarget.items:a[1].items].map((e=>e.map((e=>e.value.replace(/^[\s-]*/,"").trimEnd())))).map((e=>e.filter((e=>!!e)))).map((e=>Array.from(new Set(e)))),i=s[0].concat(s[1].map((e=>`-${e}`))).join(",");this.edit({product_code_restrictions:i})})))),m({"block text-xs leading-s transition-colors":!0,"text-secondary":!i,"text-disabled":i}),this.lang,this.ns,this.renderTemplateOrSlot("product-restrictions:after"))}__renderCategoryRestrictions(){var e,t,i;const r="category-restrictions",o=!this.in("idle")||this.disabledSelector.matches(r,!0),a=this.readonlySelector.matches(r,!0);return s(X||(X=ae` <div data-testid="category-restrictions"> ${0} <div class="space-y-xs"> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" lang="${0}" key="category_restrictions" ns="${0}"> </foxy-i18n> <x-category-restrictions-page coupon-item-categories="${0}" data-testid="category-restrictions:page" coupon="${0}" class="border border-contrast-10 rounded mb-s" group="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}"> </x-category-restrictions-page> </foxy-pagination> <foxy-i18n class="block text-xs leading-s text-tertiary" lang="${0}" key="category_restrictions_helper_text" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("category-restrictions:before"),this.__itemCategories,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-pagination"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",o,this.lang,this.ns,u(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),this.href,this.group,this.lang,this.ns,o,a,this.lang,this.ns,this.renderTemplateOrSlot("category-restrictions:after"))}__renderCustomerAttributeRestrictions(){var e;const t="customer-attribute-restrictions",i=this.disabledSelector.matches(t,!0),r=this.readonlySelector.matches(t,!0);return s(Y||(Y=ae` <div data-testid="customer-attribute-restrictions"> ${0} <div class="${0}"> <foxy-i18n class="text-s font-medium" infer="${0}" key="label"></foxy-i18n> <foxy-query-builder infer="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-i18n class="text-xs" infer="${0}" key="helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot(`${t}:before`),m({"grid gap-xs leading-xs transition-colors":!0,"text-secondary hover-text-body":!i&&!r,"text-disabled":i,"text-body":r}),t,t,null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:null,(e=>{var t;const s=e.currentTarget;this.edit({customer_attribute_restrictions:null!==(t=s.value)&&void 0!==t?t:""}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})}),t,this.renderTemplateOrSlot(`${t}:after`))}__renderOptions(){const e=!this.in("idle")||this.disabledSelector.matches("options",!0),t=this.readonlySelector.matches("options",!0);return s(Z||(Z=ae` <div data-testid="options"> ${0} <x-group frame> <foxy-i18n class="transition-colors ${0}" slot="header" lang="${0}" key="option_plural" ns="${0}"> </foxy-i18n> ${0} <x-checkbox data-testclass="inputs" data-testid="options:dates" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="set_time_constraints" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="set_time_constraints_explainer" ns="${0}"> </foxy-i18n> </div> ${0} </x-checkbox> </x-group> ${0} </div> `),this.renderTemplateOrSlot("options:before"),e?"text-disabled":"text-secondary",this.lang,this.ns,[{param:"multiple_codes_allowed"},{param:"combinable"},{param:"exclude_category_discounts",label:"combine_with_category_discounts",flip:!0},{param:"exclude_line_item_discounts",label:"combine_with_line_discounts",flip:!0},{param:"is_taxable",label:"apply_taxes_before_coupon"}].map((i=>{var r;const o=this.form[i.param],a=null!==(r=i.label)&&void 0!==r?r:i.param,n=e?"text-disabled":"text-secondary";return s(ee||(ee=ae` <x-checkbox data-testclass="inputs" data-testid="options:${0}" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="transition-colors text-xs leading-s ${0}" lang="${0}" key="${0}_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> <div style="margin-left:calc(1.125rem + (var(--lumo-space-m) * 2))"> <div class="border-b border-contrast-10"></div> </div> `),i.param.replace(/_/g,"-"),e,t,i.flip?!o:o,(e=>{this.edit({[i.param]:i.flip?!e.detail:e.detail})}),this.lang,a,this.ns,n,this.lang,a,this.ns)})),e,t,this.form.start_date||this.form.end_date,(e=>{if(e instanceof r){let t=null,s=null;if(e.detail){const e=Date.now(),i=new Date(e).setMonth((new Date).getMonth()+1);t=g(new Date(e)),s=g(new Date(i))}this.edit({start_date:t,end_date:s})}}),this.lang,this.ns,e?"text-disabled":"text-secondary",this.lang,this.ns,this.form.start_date||this.form.end_date?s(te||(te=ae` <div class="grid grid-cols-2 gap-m mt-m" slot="content" style="--lumo-border-radius:var(--lumo-border-radius-s)"> ${0} </div> `),["start_date","end_date"].map((i=>{const r=this.form[i],o=r?r.length>10?g(new Date(r)):r:"";return s(se||(se=ae` <vaadin-date-picker data-testclass="inputs" data-testid="options:${0}" placeholder="${0}" label="${0}" clear-button-visible ?disabled="${0}" ?readonly="${0}" .value="${0}" @change="${0}"> </vaadin-date-picker> `),i.replace("_","-"),this.t("select"),this.t(i),e,t,y(o),(e=>{const t=e.currentTarget;this.edit({[i]:t.value})}))}))):"",this.renderTemplateOrSlot("options:after"))}__renderTimestamps(){return s(ie||(ie=ae` <div> ${0} <x-metadata data-testid="timestamps" .items="${0}"> </x-metadata> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),r=this.in({idle:{snapshot:{dirty:"invalid"}}}),o=e||t||(i||r),a=this.in("idle");return s(re||(re=ae` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!a||o||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return s(oe||(oe=ae` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}le.__codesQueryOptions=[{label:"code",path:"code",type:e.String},{label:"used_codes",path:"number_of_uses_to_date",type:e.Number},{label:"date_created",path:"date_created",type:e.Date},{label:"date_modified",path:"date_modified",type:e.Date}],customElements.define("foxy-coupon-form",le);export{le as CouponForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-7abbc95c.js";import"./shared-ad80244a.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{h as e}from"./shared-7f33a83a.js";import{C as t}from"./shared-5cf7b194.js";import{N as i}from"./shared-9b12aeac.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{a as s,T as
|
|
1
|
+
import"./shared-7abbc95c.js";import"./shared-ad80244a.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{h as e}from"./shared-7f33a83a.js";import{C as t}from"./shared-5cf7b194.js";import{N as i}from"./shared-9b12aeac.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{a as s,T as a,S as r}from"./shared-3b709ddc.js";import{c as d}from"./shared-4e709717.js";import"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import{m as n}from"./shared-4c2e9064.js";import"./shared-3f04e4cc.js";import{M as o}from"./shared-4205699e.js";import{i as l}from"./shared-d3bf9ac0.js";import"./shared-e5239bec.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-6daeb197.js";import"./shared-11c2efc8.js";import"./shared-f5bbb1e0.js";import"./shared-fff03a45.js";let h,m,c,f,p,b,u=e=>e;const _=s(t(a(r(i))),"custom-field-form");class v extends _{constructor(){super(...arguments),this.templates={},this.__getValidator=n((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=n((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderTextField=({field:t})=>{var i,s;const a=t.replace(/_/,"-");return this.hiddenSelector.matches(a)?"":e(h||(h=u` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t(t).toString(),l(null===(s=null===(i=this.form)||void 0===i?void 0:i[t])||void 0===s?void 0:s.toString()),this.__getErrorMessage(t),t,this.__getValidator(t),!this.in("idle")||this.disabledSelector.matches(a),this.readonlySelector.matches(a),this.__bindField(t),this.__handleKeyDown,this.renderTemplateOrSlot(`${a}:after`))},this.__renderVisibility=()=>{const{disabledSelector:t,form:i,lang:s,ns:a}=this,r=!this.in("idle")||t.matches("visibility",!0);return e(m||(m=u` <div data-testid="visibility"> ${0} <vaadin-checkbox ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_on_receipt" ns="${0}"></foxy-i18n> </vaadin-checkbox> ${0} </div> `),this.renderTemplateOrSlot("visibility:before"),r,!i.is_hidden,(e=>{const t=e.currentTarget;this.edit({is_hidden:!t.checked})}),s,a,this.renderTemplateOrSlot("visibility:after"))},this.__renderTimestamps=()=>{const t=["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}}));return e(c||(c=u` <div> ${0} <x-metadata .items="${0}" data-testid="timestamps"></x-metadata> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderDelete=()=>e(f||(f=u` <div> ${0} <vaadin-button class="w-full" data-testid="delete" theme="error" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="delete"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),this.__handleDeleteClick,this.ns,this.lang,this.renderTemplateOrSlot("delete:after")),this.__renderCreate=()=>{const t=this.in({idle:{template:{dirty:"valid"}}}),i=this.in({idle:{snapshot:{dirty:"valid"}}}),s=t||i;return e(p||(p=u` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="success primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="create"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!this.in("idle")||!s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-checkbox":customElements.get("vaadin-checkbox"),"x-metadata":o,"vaadin-button":customElements.get("vaadin-button"),"foxy-i18n":customElements.get("foxy-i18n"),"foxy-spinner":customElements.get("foxy-spinner")}}static get v8n(){return[({value:e})=>e&&e.length>0||"value_required",({value:e})=>e&&e.length<=1e3||"value_too_long",({name:e})=>e&&e.length>0||"name_required",({name:e})=>e&&e.length<=500||"name_too_long"]}render(){var t,i;const{hiddenSelector:s,data:a,lang:r,ns:n}=this,o=this.in("busy"),l=this.in("fail");return e(b||(b=u` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="grid grid-cols-1 gap-l"> ${0} ${0} ${0} ${0} ${0} ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),r,n,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"name"}),this.__maybeRenderTextField({field:"value"}),s.matches("visibility",!0)?"":this.__renderVisibility(),s.matches("timestamps",!0)||!a?"":this.__renderTimestamps(),s.matches("delete",!0)||!a?"":this.__renderDelete(),s.matches("create",!0)||a?"":this.__renderCreate(),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!o&&!l}),l?"error":o?"busy":"empty",r,n,null!==(i=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"")}disconnectedCallback(){var e,t,i,s;super.disconnectedCallback(),null===(t=(e=this.__bindField.cache).clear)||void 0===t||t.call(e),null===(s=(i=this.__getValidator.cache).clear)||void 0===s||s.call(i)}get __confirmDialog(){return this.renderRoot.querySelector("#confirm")}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__handleDeleteClick(e){this.__confirmDialog.show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-custom-field-form",v);export{v as CustomFieldForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-b87d1af0.js";import"./shared-1196b6a7.js";import"./shared-d90dbae7.js";import{I as t}from"./shared-e2e2ca6a.js";import{I as e}from"./shared-ba93be6b.js";import"./shared-2edcd981.js";import{i as s}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import{c as o,_ as a,B as i}from"./shared-4c2e9064.js";import{S as n,a as d}from"./shared-3b709ddc.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-5784c088.js";import"./shared-ff7fd5fa.js";import"./shared-de3dae6c.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-5cf7b194.js";import"./shared-fd96bcd1.js";import"./foxy-spinner.js";import"./shared-b446c140.js";import"./shared-9b12aeac.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-f9180815.js";!function(){function t(t,e,s){if(null!=s){const r=t.includes("?")?"&":"?";return t+r+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,r;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,r=e})),window._hCaptchaOnLoad=s;const o=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=o,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${o}"`;console.error(e,t),r(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 r=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(r))}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 o=this.nucleon;return r(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==o?void 0:o.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=o((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,r="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let o=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"}];r&&a.push({regex:`[${r}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(o))).map((t=>t.message)),i.length=o.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.templates={},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-create-control":customElements.get("foxy-internal-create-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-spinner":customElements.get("foxy-spinner"),"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},r)=>!!r.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},r)=>{var o;return!s||(void 0===(null===(o=r.settings)||void 0===o?void 0:o.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 readonlySelector(){const t=this.data?["is-anonymous"]:[];return t.push(super.readonlySelector.toString()),new i(t.join(" ").trim())}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("legal-notice"),new i(Array.from(t).join(" ").trim())}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,o;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return r(u||(u=g` <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 infer="tax-id"></foxy-internal-text-control> <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-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),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===(o=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===o?void 0:o.verification.type)?r(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,r,o;"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===(r=this.__hcaptcha)||void 0===r||r.reset(),null===(o=this.__hcaptcha)||void 0===o||o.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,r="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(`${r}_expired_on`,{expiresOn:t}):this.t(`${r}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(r)}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-b87d1af0.js";import"./shared-1196b6a7.js";import"./shared-d90dbae7.js";import{I as t}from"./shared-5280c80a.js";import{I as e}from"./shared-ba93be6b.js";import"./shared-2edcd981.js";import{i as s}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import{c as o,_ as a,B as i}from"./shared-4c2e9064.js";import{S as n,a as d}from"./shared-3b709ddc.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-5784c088.js";import"./shared-ff7fd5fa.js";import"./shared-de3dae6c.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-5cf7b194.js";import"./shared-fd96bcd1.js";import"./foxy-spinner.js";import"./shared-b446c140.js";import"./shared-9b12aeac.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-f9180815.js";!function(){function t(t,e,s){if(null!=s){const r=t.includes("?")?"&":"?";return t+r+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,r;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,r=e})),window._hCaptchaOnLoad=s;const o=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=o,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${o}"`;console.error(e,t),r(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 r=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(r))}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 o=this.nucleon;return r(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==o?void 0:o.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=o((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,r="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let o=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"}];r&&a.push({regex:`[${r}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(o))).map((t=>t.message)),i.length=o.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.templates={},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-create-control":customElements.get("foxy-internal-create-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-spinner":customElements.get("foxy-spinner"),"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},r)=>!!r.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},r)=>{var o;return!s||(void 0===(null===(o=r.settings)||void 0===o?void 0:o.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 readonlySelector(){const t=this.data?["is-anonymous"]:[];return t.push(super.readonlySelector.toString()),new i(t.join(" ").trim())}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("legal-notice"),new i(Array.from(t).join(" ").trim())}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,o;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return r(u||(u=g` <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 infer="tax-id"></foxy-internal-text-control> <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-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),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===(o=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===o?void 0:o.verification.type)?r(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,r,o;"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===(r=this.__hcaptcha)||void 0===r||r.reset(),null===(o=this.__hcaptcha)||void 0===o||o.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,r="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(`${r}_expired_on`,{expiresOn:t}):this.t(`${r}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(r)}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,4 +1,4 @@
|
|
|
1
|
-
import"./foxy-customer.js";import"./shared-9048eeb2.js";import"./shared-b446c140.js";import"./shared-5784c088.js";import"./shared-f9180815.js";import{I as e}from"./shared-
|
|
1
|
+
import"./foxy-customer.js";import"./shared-9048eeb2.js";import"./shared-b446c140.js";import"./shared-5784c088.js";import"./shared-f9180815.js";import{I as e}from"./shared-5280c80a.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import{TransactionsTable as t}from"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-customer-form.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as s,B as r,al as o}from"./shared-4c2e9064.js";import{h as i,L as n,c as a}from"./shared-7f33a83a.js";import{A as d}from"./shared-e006e82c.js";import"./shared-800ee6c0.js";import{C as l}from"./shared-f241722a.js";import{a as c,T as m}from"./shared-3b709ddc.js";import{i as u}from"./shared-d3bf9ac0.js";import{c as h}from"./shared-4e709717.js";import{A as p}from"./shared-35728235.js";import{C as f}from"./shared-5cf7b194.js";import{I as g}from"./shared-fd96bcd1.js";import"./shared-e5239bec.js";import"./foxy-attribute-card.js";import"./shared-9b12aeac.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-2edcd981.js";import"./foxy-attribute-form.js";import"./shared-6daeb197.js";import"./shared-eb8a0fdf.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-099c1f57.js";import"./shared-601f27b1.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import"./shared-fff03a45.js";import"./shared-11c2efc8.js";import"./shared-f21e5761.js";import"./shared-f5bbb1e0.js";import"./shared-d1f5de89.js";import"./shared-4205699e.js";import"./foxy-address-card.js";import"./shared-9aa72495.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-7a455b15.js";import"./foxy-nucleon-element.js";import"./shared-f29d410a.js";import"./shared-630a0ff2.js";import"./shared-d7be11de.js";import"./shared-ba93be6b.js";import"./shared-5103c1b4.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-ff7fd5fa.js";import"./shared-27d21f4a.js";import"./foxy-cancellation-form.js";import"./shared-efaf8d49.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-584174ff.js";import"./shared-31d8e3b8.js";import"./shared-d519a301.js";import"./shared-b87d1af0.js";import"./shared-1196b6a7.js";import"./shared-de3dae6c.js";import"./shared-d90dbae7.js";import"./shared-b738ee96.js";import"./shared-9954ee26.js";import"./shared-ad80244a.js";let $,y,v=e=>e;class b extends(c(m(l),"customer-portal")){constructor(){super(...arguments),this.transactionsTableColumns=[t.priceColumn,t.summaryColumn,t.statusColumn,t.idColumn,t.dateColumn,t.receiptColumn],this.group=""}static get properties(){return s(s({},super.properties),{},{transactionsTableColumns:{attribute:!1},group:{type:String}})}render(){let e;try{e=new URL("./customer_portal_settings",this.base).toString()}catch(t){e=void 0}return this.api.storage.getItem(d.SESSION)?i($||($=v` <foxy-internal-customer-portal-logged-in-view customer="${0}" class="h-full" infer="" href="${0}" .transactionsTableColumns="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.base,u(e),this.transactionsTableColumns):i(y||(y=v` <foxy-internal-customer-portal-logged-out-view class="h-full" infer="" href="${0}"> </foxy-internal-customer-portal-logged-out-view> `),u(e))}}let S,x,_,j,T=e=>e;class k extends(m(n)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return s(s({},super.properties),{},{disabled:{type:Boolean},href:{type:String},icon:{type:String}})}render(){const e=h({"flex-auto font-medium tracking-wide text-s rounded-s transition-colors":!0,"hover-text-primary hover-cursor-pointer":!this.disabled,"focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2":!this.disabled,"text-disabled cursor-default":this.disabled}),t=i(S||(S=T` ${0} <slot></slot> `),this.icon?i(x||(x=T`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?i(_||(_=T`<button class="${0}" disabled="disabled">${0}</button>`),e,t):i(j||(j=T` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,t)}}let O,w,z,R,E,U,N,A,C=e=>e;const H=c(e);let I,F,L,q,P,B,D,G,J,K,M,Q,V,W,X,Y=e=>e;const Z=c(e);const ee=["html"],te=["html"];let se,re,oe,ie,ne,ae,de,le,ce,me,ue,he,pe=e=>e;const fe=c(f(m(g(n))));let ge,$e,ye,ve=e=>e;const be=f(m(c(g(n),"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends H{constructor(){var e;super(...arguments),e=this,this.templates={},this.customer="",this.loggingOutState="idle",this.transactionsTableColumns=[],this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var t,s,r,o,n;const a="customer:header:actions:sign-out",d=this.loggingOutState,l=this.disabledSelector.matches(a)||!(null===(t=this.__customerElement)||void 0===t?void 0:t.in({idle:"snapshot"}))||"idle"!==d,c={"border-radius":"100%",padding:"var(--lumo-space-xs)",display:"flex",margin:"0",cursor:l?"default":"pointer"};return i(O||(O=C` <div style="display:flex;margin-left:var(--lumo-space-m)"> ${0} <vaadin-button data-testid="sign-out" aria-label="${0}" style="${0}" theme="icon" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t("sign_out").toString(),Object.entries(c).reduce(((e,[t,s])=>`${e}${t}:${s};`),""),l,(async function(){try{e.loggingOutState="busy",await new p(e).fetch("foxy://customer-api/session",{method:"DELETE"}),e.loggingOutState="idle"}catch(t){e.loggingOutState="fail",e.loggingOutStateResetTimeout=setTimeout((()=>{e.loggingOutState="idle",e.loggingOutStateResetTimeout=null}),1e3)}}),"idle"===d?i(w||(w=C`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):i(z||(z=C` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0}"> </foxy-spinner> `),"fail"===d?"error":"busy",this.lang,[this.ns,null!==(r=null===(s=customElements.get("foxy-customer"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",null!==(n=null===(o=customElements.get("foxy-spinner"))||void 0===o?void 0:o.defaultNS)&&void 0!==n?n:""].join(" ")),this.renderTemplateOrSlot(`${a}:after`))},this.__renderSubscriptions=(e,t)=>{const s="customer:subscriptions";return e(R||(R=C`
|
|
2
2
|
${0}
|
|
3
3
|
|
|
4
4
|
<foxy-internal-customer-portal-subscriptions
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-5784c088.js";import"./shared-b446c140.js";import{h as t}from"./shared-e5239bec.js";import"./shared-9048eeb2.js";import"./shared-f9180815.js";import"./foxy-payment-method-card.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-form.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-2edcd981.js";import{al as e,_ as s}from"./shared-4c2e9064.js";import{L as r,h as a,c as o}from"./shared-7f33a83a.js";import{C as i}from"./shared-5cf7b194.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{w as h,S as d,T as n,a as l}from"./shared-3b709ddc.js";import{c as m}from"./shared-4e709717.js";import"./shared-601f27b1.js";import"./shared-621b3283.js";import{S as c}from"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-7abbc95c.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import{G as v}from"./shared-d1f5de89.js";import"./shared-3f04e4cc.js";import{N as p}from"./shared-9b12aeac.js";import{S as f}from"./shared-f29d410a.js";import{i as g}from"./shared-d3bf9ac0.js";import"./shared-799dc083.js";import"./shared-d7be11de.js";import"./foxy-nucleon-element.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-fd96bcd1.js";import"./shared-e8a51c60.js";import"./shared-
|
|
1
|
+
import"./shared-5784c088.js";import"./shared-b446c140.js";import{h as t}from"./shared-e5239bec.js";import"./shared-9048eeb2.js";import"./shared-f9180815.js";import"./foxy-payment-method-card.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-form.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-2edcd981.js";import{al as e,_ as s}from"./shared-4c2e9064.js";import{L as r,h as a,c as o}from"./shared-7f33a83a.js";import{C as i}from"./shared-5cf7b194.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{w as h,S as d,T as n,a as l}from"./shared-3b709ddc.js";import{c as m}from"./shared-4e709717.js";import"./shared-601f27b1.js";import"./shared-621b3283.js";import{S as c}from"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-7abbc95c.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import{G as v}from"./shared-d1f5de89.js";import"./shared-3f04e4cc.js";import{N as p}from"./shared-9b12aeac.js";import{S as f}from"./shared-f29d410a.js";import{i as g}from"./shared-d3bf9ac0.js";import"./shared-799dc083.js";import"./shared-d7be11de.js";import"./foxy-nucleon-element.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-fd96bcd1.js";import"./shared-e8a51c60.js";import"./shared-5280c80a.js";import"./shared-ba93be6b.js";import"./shared-5103c1b4.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-ff7fd5fa.js";import"./shared-27d21f4a.js";import"./foxy-cancellation-form.js";import"./shared-efaf8d49.js";import"./shared-79d0699c.js";import"./shared-6daeb197.js";import"./shared-11c2efc8.js";import"./shared-f5bbb1e0.js";import"./shared-fff03a45.js";import"./foxy-transaction-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-584174ff.js";import"./shared-31d8e3b8.js";import"./shared-630a0ff2.js";import"./shared-e006e82c.js";import"./shared-800ee6c0.js";import"./shared-d519a301.js";import"./shared-4205699e.js";import"./shared-7a455b15.js";import"./shared-b87d1af0.js";import"./shared-1196b6a7.js";import"./shared-de3dae6c.js";import"./shared-d90dbae7.js";import"./shared-b738ee96.js";import"./shared-9aa72495.js";let z,u,b,$=t=>t;class H extends r{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return h.styles}render(){const t=[],e=[];for(let s=0;s<this.size;++s)t.push(a(z||(z=$` <button id="tab-${0}" role="tab" class="${0}" aria-controls="panel-${0}" aria-selected="${0}" @click="${0}" @keydown="${0}"> <slot name="tab-${0}"></slot> </button> `),s,m({"text-l font-medium px-s rounded focus-outline-none focus-shadow-outline":!0,"text-tertiary hover-text-body focus-text-body":this.value!==s}),s,this.value===s,(()=>this.value=s),this.__handleKeyDown,s)),e.push(a(u||(u=$` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),s,s,m({hidden:this.value!==s}),this.value!==s,s));return a(b||(b=$` <div role="tablist" aria-orientation="horizontal" class="-mx-s mb-s">${0}</div> ${0} `),t,e)}__handleKeyDown(t){if(t.key.startsWith("Arrow")){t.preventDefault();const e=t.target;let s=null;"ArrowRight"===t.key||"ArrowDown"===t.key?s=e.nextElementSibling:"ArrowLeft"!==t.key&&"ArrowUp"!==t.key||(s=e.previousElementSibling),null==s||s.click(),null==s||s.focus()}}}
|
|
2
2
|
/**
|
|
3
3
|
@license
|
|
4
4
|
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as e}from"./shared-ba93be6b.js";import"./shared-3f04e4cc.js";import{E as r,T as t}from"./shared-eb8a0fdf.js";import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import{h as o,P as a,B as i}from"./shared-e5239bec.js";import"./shared-5784c088.js";import"./shared-2edcd981.js";import{y as s,a as n}from"./shared-3b709ddc.js";import{c as l,h as A}from"./shared-7f33a83a.js";import{i as d}from"./shared-d3bf9ac0.js";import{c as p}from"./shared-4e709717.js";import"./shared-c839e147.js";import"./shared-27d21f4a.js";import"./shared-d90dbae7.js";import{I as u}from"./shared-
|
|
1
|
+
import{I as e}from"./shared-ba93be6b.js";import"./shared-3f04e4cc.js";import{E as r,T as t}from"./shared-eb8a0fdf.js";import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import{h as o,P as a,B as i}from"./shared-e5239bec.js";import"./shared-5784c088.js";import"./shared-2edcd981.js";import{y as s,a as n}from"./shared-3b709ddc.js";import{c as l,h as A}from"./shared-7f33a83a.js";import{i as d}from"./shared-d3bf9ac0.js";import{c as p}from"./shared-4e709717.js";import"./shared-c839e147.js";import"./shared-27d21f4a.js";import"./shared-d90dbae7.js";import{I as u}from"./shared-5280c80a.js";import"./foxy-nucleon-element.js";import{_ as c,B as m}from"./shared-4c2e9064.js";import"./shared-f9180815.js";import"./shared-5cf7b194.js";import"./shared-fd96bcd1.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-ef7f2d07.js";import"./shared-fff03a45.js";import"./shared-ff7fd5fa.js";import"./shared-13fbea95.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./foxy-spinner.js";import"./shared-b446c140.js";const h=o`<dom-module id="lumo-progress-bar" theme-for="vaadin-progress-bar">
|
|
2
2
|
<template>
|
|
3
3
|
<style>
|
|
4
4
|
:host {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import"./shared-0c0ee663.js";import"./shared-799dc083.js";import"./shared-f29acc38.js";import"./shared-d90dbae7.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{_ as e}from"./shared-4c2e9064.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{h as t}from"./shared-7f33a83a.js";import{S as
|
|
1
|
+
import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import"./shared-0c0ee663.js";import"./shared-799dc083.js";import"./shared-f29acc38.js";import"./shared-d90dbae7.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{_ as e}from"./shared-4c2e9064.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{h as t}from"./shared-7f33a83a.js";import{S as a,T as s,a as i}from"./shared-3b709ddc.js";import{c as r}from"./shared-4e709717.js";import{C as n,a as o}from"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import{G as l}from"./shared-d1f5de89.js";import"./shared-3f04e4cc.js";import{M as d}from"./shared-4205699e.js";import{C as c}from"./shared-5cf7b194.js";import{N as h}from"./shared-9b12aeac.js";import{i as m}from"./shared-d3bf9ac0.js";import"./shared-e5239bec.js";import"./shared-ff7fd5fa.js";import"./shared-ba93be6b.js";import"./shared-fd96bcd1.js";import"./shared-d519a301.js";import"./shared-b446c140.js";import"./shared-343d1fd7.js";import"./shared-6daeb197.js";import"./shared-11c2efc8.js";import"./shared-e8a51c60.js";import"./shared-35728235.js";import"./shared-f5bbb1e0.js";import"./shared-fff03a45.js";import"./shared-3ab0306f.js";let f,p,u,_,b,x,y,$,v=e=>e;const g=a(s(c(i(h,"email-template-form"))));class j extends g{constructor(){super(...arguments),this.templates={},this.__templateLanguageOptions=[{label:"Nunjucks",value:"nunjucks"},{label:"Handlebars",value:"handlebars"},{label:"Pug",value:"pug"},{label:"Twig",value:"twig"},{label:"EJS",value:"ejs"}],this.__textContentChoice="default",this.__htmlContentChoice="default",this.__cacheState="idle"}static get properties(){return e(e({},super.properties),{},{__cacheState:{attribute:!1},__contentChoice:{attribute:!1}})}static get scopedElements(){return{"foxy-internal-select-control":customElements.get("foxy-internal-select-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-source-control":customElements.get("foxy-internal-source-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"x-metadata":d,"x-choice":n,"x-group":l}}render(){var e,a,s;const{hiddenSelector:i,href:n,lang:o,ns:l}=this,d=n?"delete":"create",c=this.in("busy"),h=this.in("fail");return t(f||(f=v` <div class="space-y-m"> ${0} <foxy-internal-text-control infer="subject"></foxy-internal-text-control> ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),i.matches("description",!0)?"":this.__renderDescription(),"Email Receipt Template"===(null===(e=this.data)||void 0===e?void 0:e.description)?"":t(p||(p=v` <foxy-internal-select-control infer="template-language" .options="${0}"> </foxy-internal-select-control> `),this.__templateLanguageOptions),i.matches("content",!0)?"":this.__renderContent(),i.matches("timestamps",!0)||!n?"":this.__renderTimestamps(),i.matches(d)?"":this.__renderAction(d),r({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!c&&!h}),h?"error":c?"busy":"empty",o,l,null!==(s=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==s?s:"")}async _sendPost(e){const t=await super._sendPost(e);if(!t.content_html_url&&!t.content_text_url)return t;this.__cacheState="busy";const a=t._links["fx:cache"].href,s=await new j.API(this).fetch(a,{method:"POST"});return this.__cacheState=s.ok?"idle":"fail",await this._fetch(t._links.self.href)}async _sendPatch(e){const t=await super._sendPatch(e);if(!t.content_html_url&&!t.content_text_url)return t;this.__cacheState="busy";const a=t._links["fx:cache"].href,s=await new j.API(this).fetch(a,{method:"POST"});return this.__cacheState=s.ok?"idle":"fail",await this._fetch(t._links.self.href)}__renderDescription(){var e,a;const s="description";return t(u||(u=v` <div> ${0} <vaadin-text-field data-testid="${0}" class="w-full mb-s" label="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),s,this.t(s),!this.in("idle")||this.disabledSelector.matches(s),this.readonlySelector.matches(s),null!==(a=null===(e=this.form)||void 0===e?void 0:e.description)&&void 0!==a?a:"",(e=>"Enter"===e.key&&this.submit()),(e=>{this.edit({description:e.currentTarget.value})}),this.renderTemplateOrSlot(`${s}:after`))}__renderContent(){return t(_||(_=v` <div data-testid="content"> <div class="space-y-l">${0}</div> </div> `),["text","html"].map((e=>this.__renderContentVariant(e))))}__renderContentVariant(e){var a,s;const i="text"===e?"content_text_url":"content_html_url",n="text"===e?"content_text":"content_html",l="text"===e?"text_template":"html_template",d=this.form[i],c=this.form[n],h="text"===e?"__textContentChoice":"__htmlContentChoice",f=d?"url":c?"clipboard":this[h],p=!this.in("idle")||this.disabledSelector.matches("content",!0),u=this.readonlySelector.matches("content",!0),_=u||!(null===(a=this.data)||void 0===a?void 0:a[i])||d!==this.data[i];return t(b||(b=v` <x-group frame> <foxy-i18n class="${0}" lang="${0}" slot="header" key="${0}" ns="${0}"> </foxy-i18n> <x-choice data-testid="${0}-type" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} <div style="--lumo-border-radius:var(--lumo-border-radius-s)" class="mb-m" slot="url" ?hidden="${0}"> <div class="flex items-end mt-0"> <vaadin-text-field data-testid="${0}-url" placeholder="https://example.com/my-template" label="${0}" class="flex-1 min-w-0" value="${0}" ?readonly="${0}" ?disabled="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> <vaadin-button data-testid="${0}-cache" class="relative flex-shrink-0 ml-s" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="cache" ns="${0}"> </foxy-i18n> <div class="${0}"> <foxy-spinner layout="no-label" class="m-auto" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </vaadin-button> </div> <foxy-internal-source-control placeholder="${0}" helper-text="" property="${0}" label="${0}" infer="content" class="mt-m${0}" style="--lumo-border-radius:var(--lumo-border-radius-s)"> </foxy-internal-source-control> </div> <foxy-internal-source-control placeholder="${0}" helper-text="" property="${0}" label="${0}" infer="content" class="mb-m${0}" style="--lumo-border-radius:var(--lumo-border-radius-s)" slot="clipboard"> </foxy-internal-source-control> </x-choice> </x-group> `),r({"transition-colors":!0,"text-disabled":p}),this.lang,l,this.ns,n.replace("_","-"),f,["default","url","clipboard"],u,p,(e=>{e instanceof o&&(this.edit({[n]:"",[i]:""}),this[h]=e.detail)}),["default","url","clipboard"].map((e=>t(x||(x=v` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="template_${0}" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns))),"url"!==f,n.replace("_","-"),this.t("url"),m(this.form[i]),u,p,(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({[n]:"",[i]:t})}),n.replace("_","-"),p||"busy"===this.__cacheState,_,this.__cache,r({"relative transition-opacity":!0,"opacity-0":"idle"!==this.__cacheState}),this.lang,this.ns,r({"absolute inset-0 flex transition-opacity":!0,"opacity-0":"idle"===this.__cacheState}),"fail"===this.__cacheState?"error":"busy",this.lang,this.ns,this.t("url_source_placeholder"),n,this.t("url_source_label"),(null===(s=this.data)||void 0===s?void 0:s[n])?"":" hidden",this.t("clipboard_source_placeholder"),n,this.t("clipboard_source_label"),"clipboard"===f?"":" hidden")}__renderTimestamps(){const e="timestamps";return t(y||(y=v` <div> ${0} <x-metadata data-testid="timestamps" .items="${0}"> </x-metadata> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot(`${e}:after`))}__renderAction(e){const{disabledSelector:a,href:s,lang:i,ns:r}=this,n=this.in({idle:{template:{dirty:"valid"}}}),o=this.in({idle:{snapshot:{dirty:"valid"}}}),l=!this.in("idle")||a.matches(e,!0),d=n||o;return t($||($=v` <div> ${0} <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),i,r,(e=>{e.detail.cancelled||this.delete()}),this.in("idle")?s?"error":"primary success":"",e,this.in({idle:"template"})&&!d||l,(t=>{if("delete"===e){this.renderRoot.querySelector("#confirm").show(t.currentTarget)}else this.submit()}),r,e,i,this.renderTemplateOrSlot(`${e}:after`))}async __cache(){var e,t;this.__cacheState="busy";try{const a=null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href)&&void 0!==t?t:"",s=await new j.API(this).fetch(a,{method:"POST"});this.__cacheState=s.ok?"idle":"fail",this.refresh()}catch(e){this.__cacheState="fail"}}}customElements.define("foxy-email-template-form",j);export{j as EmailTemplateForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as
|
|
1
|
+
import{I as t}from"./shared-ba93be6b.js";import"./shared-9048eeb2.js";import"./shared-2edcd981.js";import{h as e}from"./shared-7f33a83a.js";import"./shared-d90dbae7.js";import{I as r}from"./shared-5280c80a.js";import"./shared-ddac7722.js";import{_ as s,B as i}from"./shared-4c2e9064.js";import{a}from"./shared-3b709ddc.js";import{d as o,e as n}from"./shared-4b20fc75.js";import"./shared-f9180815.js";import"./shared-5cf7b194.js";import"./shared-d3bf9ac0.js";import"./shared-fd96bcd1.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-ff7fd5fa.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-5784c088.js";import"./shared-b446c140.js";import"./shared-bb05cfed.js";import"./shared-79d0699c.js";import"./shared-d519a301.js";let l,d,m=t=>t;customElements.define("foxy-internal-filter-attribute-form-action-control",class extends t{renderControl(){const t=this.nucleon,r=null==t?void 0:t.in({idle:{snapshot:"dirty"}}),s=!!(null==t?void 0:t.data);return e(l||(l=m` <div class="grid grid-cols-2 gap-m"> ${0} <vaadin-button theme="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </vaadin-button> </div> `),s&&r?e(d||(d=m` <vaadin-button theme="contrast" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="reset"></foxy-i18n> </vaadin-button> `),this.disabled,(()=>null==t?void 0:t.undo())):"",s?r?"secondary":"error":"success",s&&r?"":"col-span-2",this.disabled,(()=>!s||r?null==t?void 0:t.submit():null==t?void 0:t.delete()),s?r?"update":"delete":"create")}});let u,h=t=>t;const c=a(r,"filter-attribute-form");class f extends c{constructor(){super(...arguments),this.pathname=null,this.options=[],this.__filterNameGetValue=()=>{const t=this.constructor;return this.__getValueParam(t.filterNameKey)},this.__filterNameSetValue=t=>{const e=this.constructor;this.__setValueParam(e.filterNameKey,t)}}static get properties(){return s(s({},super.properties),{},{pathname:{},options:{type:Array}})}get hiddenSelector(){const t=[],e=this.constructor,r=this.__getValueParam(e.filterQueryKey),s=!!this.data;return s||t.push("filter-name"),r||s||t.push("action"),new i(`${t.join(" ")} ${super.hiddenSelector}`.trim())}renderBody(){const t=this.constructor;return e(u||(u=h` <foxy-query-builder infer="filter-query" .options="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-internal-text-control infer="filter-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-filter-attribute-form-action-control infer="action"> </foxy-internal-filter-attribute-form-action-control> `),this.options,this.__getValueParam(t.filterQueryKey),this.__handleFilterQueryChange,this.__filterNameGetValue,this.__filterNameSetValue)}updated(t){var e;if(super.updated(t),"string"==typeof this.form.value){const t=new URL(o(this.form.value),"https://example.com");t.pathname=null!==(e=this.pathname)&&void 0!==e?e:"";const r=n(t.toString().substring(t.origin.length));r!==this.form.value&&this.edit({value:r})}}submit(){const t=this.constructor;this.edit({visibility:t.attributeVisibility,name:t.attributeName}),super.submit()}__getValueParam(t){var e,r;try{return null!==(r=new URL(o(null!==(e=this.form.value)&&void 0!==e?e:""),"https://example.com").searchParams.get(t))&&void 0!==r?r:""}catch(t){return""}}__setValueParam(t,e){var r;try{const s=new URL(o(null!==(r=this.form.value)&&void 0!==r?r:""),"https://example.com");s.searchParams.set(t,e),this.edit({value:n(s.toString().substring(s.origin.length))})}catch(t){}}__handleFilterQueryChange(t){var e;const r=this.constructor,s=t.currentTarget;this.__setValueParam(r.filterQueryKey,null!==(e=s.value)&&void 0!==e?e:"")}}f.attributeVisibility="restricted",f.filterQueryKey="filter_query",f.attributeName="foxy-admin-bookmark",f.filterNameKey="filter_name",customElements.define("foxy-filter-attribute-form",f);export{f as FilterAttributeForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-13fbea95.js";import"./shared-7abbc95c.js";import"./shared-c76ef8d8.js";import"./shared-9048eeb2.js";import"./shared-406ce9ad.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{I as e}from"./shared-ba93be6b.js";import"./foxy-item-card.js";import{i as t}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import{C as i}from"./shared-5cf7b194.js";import{N as a}from"./shared-9b12aeac.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{T as s,S as d,a as n}from"./shared-3b709ddc.js";import{c as o}from"./shared-4e709717.js";import"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import"./shared-3f04e4cc.js";import{
|
|
1
|
+
import"./shared-13fbea95.js";import"./shared-7abbc95c.js";import"./shared-c76ef8d8.js";import"./shared-9048eeb2.js";import"./shared-406ce9ad.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{I as e}from"./shared-ba93be6b.js";import"./foxy-item-card.js";import{i as t}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import{C as i}from"./shared-5cf7b194.js";import{N as a}from"./shared-9b12aeac.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{T as s,S as d,a as n}from"./shared-3b709ddc.js";import{c as o}from"./shared-4e709717.js";import"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import"./shared-3f04e4cc.js";import{M as l}from"./shared-4205699e.js";import"./shared-e5239bec.js";import"./shared-fff03a45.js";import"./foxy-collection-page.js";import"./shared-4c2e9064.js";import"./shared-343d1fd7.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-584174ff.js";import"./shared-31d8e3b8.js";import"./foxy-nucleon-element.js";import"./shared-6daeb197.js";import"./shared-f5bbb1e0.js";let c,m=e=>e;customElements.define("foxy-internal-gift-card-code-form-item-control",class extends e{renderControl(){var e,i,a;let s;try{const t=new URL(null!==(a=null===(i=null===(e=this.nucleon)||void 0===e?void 0:e.form._links)||void 0===i?void 0:i["fx:provisioned_by_transaction_detail_id"].href)&&void 0!==a?a:"");t.searchParams.set("zoom","item_options"),s=t.toString()}catch(e){s=void 0}return r(c||(c=m` <foxy-internal-details summary="title" infer="" open> <foxy-item-card infer="item-card" class="p-m" href="${0}"></foxy-item-card> </foxy-internal-details> `),t(s))}});let h,f,u,_,p,b,g,v,y,$=e=>e;const x=i(s(d(n(a,"gift-card-code-form"))));class j extends x{constructor(){super(...arguments),this.templates={}}static get scopedElements(){return{"vaadin-number-field":customElements.get("vaadin-number-field"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"foxy-internal-gift-card-code-form-item-control":customElements.get("foxy-internal-gift-card-code-form-item-control"),"foxy-internal-async-details-control":customElements.get("foxy-internal-async-details-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-metadata":l}}static get v8n(){return[({code:e})=>!!e||"code_required",({code:e})=>!e||e.length<=50||"code_too_long",({code:e})=>!(null==e?void 0:e.includes(" "))||"code_has_spaces",({current_balance:e})=>!!e||"current_balance_required",({current_balance:e})=>!e||!isNaN(e)||"current_balance_required"]}render(){var e,t;return r(h||(h=$` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.__isCodeHidden?null:this.__renderCode(),this.__isCurrentBalanceHidden?null:this.__renderCurrentBalance(),this.__isEndDateHidden?null:this.__renderEndDate(),this.__isLogsControlHidden?null:this.__renderLogsControl(),this.__isCartItemHidden?null:this.__renderCartItem(),this.__isTimestampsHidden?null:this.__renderTimestamps(),this.__isCreateHidden?null:this.__renderCreate(),this.__isDeleteHidden?null:this.__renderDelete(),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}get __isCodeHidden(){return this.hiddenSelector.matches("code",!0)}get __isCurrentBalanceHidden(){return this.hiddenSelector.matches("current-balance",!0)}get __isEndDateHidden(){return this.hiddenSelector.matches("end-date",!0)}get __isLogsControlHidden(){var e;return!(null===(e=this.form._links)||void 0===e?void 0:e["fx:gift_card_code_logs"].href)}get __isCartItemHidden(){var e;return!(null===(e=this.form._links)||void 0===e?void 0:e["fx:provisioned_by_transaction_detail_id"])}get __isTimestampsHidden(){return!!this.hiddenSelector.matches("timestamps",!0)||!this.data}get __isCreateHidden(){return!!this.hiddenSelector.matches("create",!0)||!!this.data}get __isDeleteHidden(){return!!this.hiddenSelector.matches("delete",!0)||!this.data}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderCode(){return r(f||(f=$` <div> ${0} <vaadin-text-field data-testid="code" class="w-full" label="${0}" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("code:before"),this.t("code"),this.__getValidator("code"),this.__getErrorMessage("code"),this.form.code,!this.in("idle")||this.disabledSelector.matches("code",!0),this.readonlySelector.matches("code",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({code:t})}),this.renderTemplateOrSlot("code:after"))}__renderCurrentBalance(){return r(u||(u=$` <div> ${0} <vaadin-number-field data-testid="current-balance" class="w-full" label="${0}" min="0" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" prevent-invalid-input has-controls required @keydown="${0}" @change="${0}"> </vaadin-number-field> ${0} </div> `),this.renderTemplateOrSlot("current-balance:before"),this.t("current_balance"),this.__getValidator("current_balance"),this.__getErrorMessage("current_balance"),this.form.current_balance,!this.in("idle")||this.disabledSelector.matches("current-balance",!0),this.readonlySelector.matches("current-balance",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({current_balance:parseFloat(t)})}),this.renderTemplateOrSlot("current-balance:after"))}__renderEndDate(){return r(_||(_=$` <div> ${0} <vaadin-date-picker data-testid="end-date" class="w-full" label="${0}" min="0" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.t("end_date"),this.__getValidator("end_date"),this.__getErrorMessage("end_date"),this.form.end_date,!this.in("idle")||this.disabledSelector.matches("end-date",!0),this.readonlySelector.matches("end-date",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({end_date:t})}),this.renderTemplateOrSlot("end-date:after"))}__renderLogsControl(){var e;return r(p||(p=$` <foxy-internal-async-details-control infer="logs" first="${0}" limit="5" item="foxy-gift-card-code-log-card" open> </foxy-internal-async-details-control> `),t(null===(e=this.form._links)||void 0===e?void 0:e["fx:gift_card_code_logs"].href))}__renderCartItem(){return r(b||(b=$` <foxy-internal-gift-card-code-form-item-control infer="cart-item"> </foxy-internal-gift-card-code-form-item-control> `))}__renderTimestamps(){return r(g||(g=$` <div> ${0} <x-metadata data-testid="timestamps" .items="${0}"> </x-metadata> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),a=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||a),d=this.in("idle");return r(v||(v=$` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!d||s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return r(y||(y=$` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),this.in("busy")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}customElements.define("foxy-gift-card-code-form",j);export{j as GiftCardCodeForm};
|