@foxy.io/elements 1.21.0-beta.1 → 1.21.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cdn/foxy-customer-portal.js +1 -1
  2. package/dist/cdn/foxy-customer.js +1 -1
  3. package/dist/cdn/foxy-payments-api.js +1 -1
  4. package/dist/cdn/foxy-report-form.js +1 -1
  5. package/dist/cdn/foxy-store-form.js +1 -1
  6. package/dist/cdn/foxy-subscription-card.js +1 -1
  7. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  8. package/dist/cdn/foxy-transaction-card.js +1 -1
  9. package/dist/cdn/foxy-transaction.js +1 -1
  10. package/dist/cdn/foxy-transactions-table.js +1 -1
  11. package/dist/cdn/{shared-4f9d2417.js → shared-4393ad93.js} +1 -1
  12. package/dist/cdn/translations/cart-form/en.json +1 -1
  13. package/dist/cdn/translations/customer/en.json +2 -2
  14. package/dist/cdn/translations/customer-portal/de.json +1 -1
  15. package/dist/cdn/translations/customer-portal/en.json +1 -1
  16. package/dist/cdn/translations/customer-portal/es.json +1 -1
  17. package/dist/cdn/translations/customer-portal/fr.json +2 -2
  18. package/dist/cdn/translations/customer-portal/nl.json +1 -1
  19. package/dist/cdn/translations/customer-portal/pl.json +1 -1
  20. package/dist/cdn/translations/customer-portal/se.json +1 -1
  21. package/dist/cdn/translations/item-category-form/en.json +2 -2
  22. package/dist/cdn/translations/item-form/en.json +1 -1
  23. package/dist/cdn/translations/shipment-card/en.json +1 -1
  24. package/dist/cdn/translations/subscription-form/en.json +1 -1
  25. package/dist/cdn/translations/transaction/en.json +3 -3
  26. package/dist/cdn/translations/transaction-card/en.json +1 -1
  27. package/dist/cdn/translations/transactions-table/en.json +1 -1
  28. package/dist/elements/public/PaymentsApi/PaymentsApi.d.ts +21 -2
  29. package/dist/elements/public/PaymentsApi/PaymentsApi.js +22 -3
  30. package/dist/elements/public/PaymentsApi/PaymentsApi.js.map +1 -1
  31. package/dist/elements/public/ReportForm/utils.js +3 -2
  32. package/dist/elements/public/ReportForm/utils.js.map +1 -1
  33. package/dist/elements/public/StoreForm/StoreForm.js +1 -1
  34. package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
  35. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +1 -0
  36. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
  37. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js +1 -0
  38. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js.map +1 -1
  39. package/dist/elements/public/TransactionCard/TransactionCard.js +1 -0
  40. package/dist/elements/public/TransactionCard/TransactionCard.js.map +1 -1
  41. package/dist/elements/public/TransactionsTable/TransactionsTable.js +1 -0
  42. package/dist/elements/public/TransactionsTable/TransactionsTable.js.map +1 -1
  43. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import"./foxy-customer.js";import"./shared-bc814810.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-0479553e.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import"./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-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as e,k as t}from"./shared-a8ced8bf.js";import{h as s,L as r,c as o}from"./shared-7f33a83a.js";import{A as i}from"./shared-ea67b3f3.js";import"./shared-75e78c70.js";import{C as n}from"./shared-8b6addec.js";import{a,T as l,R as d}from"./shared-2cc638ad.js";import{A as c}from"./shared-a85afa33.js";import{I as m}from"./shared-4f037e43.js";import{c as h}from"./shared-4e709717.js";import{C as u}from"./shared-43bcce74.js";import{N as p}from"./shared-181f51bd.js";import{B as f}from"./shared-76b3d76a.js";import{i as g}from"./shared-d3bf9ac0.js";import"./shared-0ce006b9.js";import"./foxy-attribute-card.js";import"./shared-0821cfdc.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./foxy-attribute-form.js";import"./shared-ed0dee03.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-8dd0af4d.js";import"./shared-62a54a6c.js";import"./shared-5a4829e3.js";import"./shared-1c94a156.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-11c2efc8.js";import"./shared-101d1234.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./foxy-customer-form.js";import"./foxy-nucleon-element.js";import"./shared-b738ee96.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-f80f402a.js";import"./shared-4f9d2417.js";import"./shared-d61b3e4f.js";import"./shared-99065f2a.js";import"./shared-6581241a.js";import"./shared-9bdacf65.js";import"./shared-1000b848.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-39c10b22.js";import"./shared-d518bd55.js";import"./foxy-cancellation-form.js";import"./shared-f7e4cd67.js";import"./shared-bc7f58ef.js";import"./foxy-transaction-card.js";import"./foxy-item-card.js";import"./shared-21679ebd.js";import"./shared-486d7bb5.js";import"./shared-d519a301.js";import"./shared-71d8d167.js";import"./shared-83596b46.js";import"./shared-88c4cfec.js";let $,y,b=e=>e;class v extends(a(l(n),"customer-portal")){constructor(){super(...arguments),this.group=""}static get properties(){return e(e({},super.properties),{},{group:{type:String}})}render(){return this.api.storage.getItem(i.SESSION)?s($||($=b` <foxy-internal-customer-portal-logged-in-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" customer="${0}" group="${0}" class="h-full" lang="${0}" href="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.base,this.group,this.lang,new URL("./customer_portal_settings",this.base).toString(),this.ns,this.templates):s(y||(y=b` <foxy-internal-customer-portal-logged-out-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" group="${0}" class="h-full" lang="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-out-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.group,this.lang,this.ns,this.templates)}}let S,x,_=e=>e;const j=d(l(a(m(r))));let w,T,O,k,E=e=>e;class R extends(l(r)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return e(e({},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=s(w||(w=E` ${0} <slot></slot> `),this.icon?s(T||(T=E`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?s(O||(O=E`<button class="${0}" disabled="disabled">${0}</button>`),e,t):s(k||(k=E` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,t)}}let z,N,A,F,I,H,U,q,L,P,C=e=>e;const D=l(u(a(p)));let V,B,J,W,G,K,M,Q,X,Y,Z=e=>e;const ee=l(u(a(m(r))));const te=["html"],se=["html"];let re,oe,ie,ne,ae,le,de,ce,me,he,ue,pe,fe=e=>e;const ge=a(u(l(m(r))));let $e,ye,be,ve=e=>e;const Se=u(l(a(m(r),"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends D{constructor(){var e;super(...arguments),e=this,this.templates={},this.customer="",this.loggingOutState="idle",this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var t,r,o,i,n;const a="customer:header:actions:sign-out",l=this.loggingOutState,d=this.disabledSelector.matches(a)||!(null===(t=this.__customerElement)||void 0===t?void 0:t.in({idle:"snapshot"}))||"idle"!==l,m={"border-radius":"100%",padding:"var(--lumo-space-xs)",display:"flex",margin:"0",cursor:d?"default":"pointer"};return s(z||(z=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(m).reduce(((e,[t,s])=>`${e}${t}:${s};`),""),d,(async function(){try{e.loggingOutState="busy",await new c(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"===l?s(N||(N=C`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):s(A||(A=C` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0}"> </foxy-spinner> `),"fail"===l?"error":"busy",this.lang,[this.ns,null!==(o=null===(r=customElements.get("foxy-customer"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:"",null!==(n=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==n?n:""].join(" ")),this.renderTemplateOrSlot(`${a}:after`))},this.__renderSubscriptions=(e,t)=>{const s="customer:subscriptions";return e(F||(F=C`
1
+ import"./foxy-customer.js";import"./shared-bc814810.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-0479553e.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import"./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-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as e,k as t}from"./shared-a8ced8bf.js";import{h as s,L as r,c as o}from"./shared-7f33a83a.js";import{A as i}from"./shared-ea67b3f3.js";import"./shared-75e78c70.js";import{C as n}from"./shared-8b6addec.js";import{a,T as l,R as d}from"./shared-2cc638ad.js";import{A as c}from"./shared-a85afa33.js";import{I as m}from"./shared-4f037e43.js";import{c as h}from"./shared-4e709717.js";import{C as u}from"./shared-43bcce74.js";import{N as p}from"./shared-181f51bd.js";import{B as f}from"./shared-76b3d76a.js";import{i as g}from"./shared-d3bf9ac0.js";import"./shared-0ce006b9.js";import"./foxy-attribute-card.js";import"./shared-0821cfdc.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./foxy-attribute-form.js";import"./shared-ed0dee03.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-8dd0af4d.js";import"./shared-62a54a6c.js";import"./shared-5a4829e3.js";import"./shared-1c94a156.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-11c2efc8.js";import"./shared-101d1234.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./foxy-customer-form.js";import"./foxy-nucleon-element.js";import"./shared-b738ee96.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-f80f402a.js";import"./shared-4393ad93.js";import"./shared-d61b3e4f.js";import"./shared-99065f2a.js";import"./shared-6581241a.js";import"./shared-9bdacf65.js";import"./shared-1000b848.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-39c10b22.js";import"./shared-d518bd55.js";import"./foxy-cancellation-form.js";import"./shared-f7e4cd67.js";import"./shared-bc7f58ef.js";import"./foxy-transaction-card.js";import"./foxy-item-card.js";import"./shared-21679ebd.js";import"./shared-486d7bb5.js";import"./shared-d519a301.js";import"./shared-71d8d167.js";import"./shared-83596b46.js";import"./shared-88c4cfec.js";let $,y,b=e=>e;class v extends(a(l(n),"customer-portal")){constructor(){super(...arguments),this.group=""}static get properties(){return e(e({},super.properties),{},{group:{type:String}})}render(){return this.api.storage.getItem(i.SESSION)?s($||($=b` <foxy-internal-customer-portal-logged-in-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" customer="${0}" group="${0}" class="h-full" lang="${0}" href="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.base,this.group,this.lang,new URL("./customer_portal_settings",this.base).toString(),this.ns,this.templates):s(y||(y=b` <foxy-internal-customer-portal-logged-out-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" group="${0}" class="h-full" lang="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-out-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.group,this.lang,this.ns,this.templates)}}let S,x,_=e=>e;const j=d(l(a(m(r))));let w,T,O,k,E=e=>e;class R extends(l(r)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return e(e({},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=s(w||(w=E` ${0} <slot></slot> `),this.icon?s(T||(T=E`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?s(O||(O=E`<button class="${0}" disabled="disabled">${0}</button>`),e,t):s(k||(k=E` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,t)}}let z,N,A,F,I,H,U,q,L,P,C=e=>e;const D=l(u(a(p)));let V,B,J,W,G,K,M,Q,X,Y,Z=e=>e;const ee=l(u(a(m(r))));const te=["html"],se=["html"];let re,oe,ie,ne,ae,le,de,ce,me,he,ue,pe,fe=e=>e;const ge=a(u(l(m(r))));let $e,ye,be,ve=e=>e;const Se=u(l(a(m(r),"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends D{constructor(){var e;super(...arguments),e=this,this.templates={},this.customer="",this.loggingOutState="idle",this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var t,r,o,i,n;const a="customer:header:actions:sign-out",l=this.loggingOutState,d=this.disabledSelector.matches(a)||!(null===(t=this.__customerElement)||void 0===t?void 0:t.in({idle:"snapshot"}))||"idle"!==l,m={"border-radius":"100%",padding:"var(--lumo-space-xs)",display:"flex",margin:"0",cursor:d?"default":"pointer"};return s(z||(z=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(m).reduce(((e,[t,s])=>`${e}${t}:${s};`),""),d,(async function(){try{e.loggingOutState="busy",await new c(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"===l?s(N||(N=C`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):s(A||(A=C` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0}"> </foxy-spinner> `),"fail"===l?"error":"busy",this.lang,[this.ns,null!==(o=null===(r=customElements.get("foxy-customer"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:"",null!==(n=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==n?n:""].join(" ")),this.renderTemplateOrSlot(`${a}:after`))},this.__renderSubscriptions=(e,t)=>{const s="customer:subscriptions";return e(F||(F=C`
2
2
  ${0}
3
3
 
4
4
  <foxy-internal-customer-portal-subscriptions
@@ -1,4 +1,4 @@
1
- import"./shared-62c088b7.js";import"./shared-2092d86f.js";import{h as t}from"./shared-0ce006b9.js";import"./shared-bc814810.js";import"./shared-0479553e.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-0821cfdc.js";import{k as e}from"./shared-a8ced8bf.js";import{L as s,h as r,c as a}from"./shared-7f33a83a.js";import{C as o}from"./shared-43bcce74.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{w as i,S as h,T as d,a as n}from"./shared-2cc638ad.js";import{c as l}from"./shared-4e709717.js";import"./shared-1c94a156.js";import"./shared-62a54a6c.js";import{S as m}from"./shared-101d1234.js";import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import{G as c}from"./shared-d8dc97f0.js";import"./shared-5ea18e60.js";import{N as v}from"./shared-181f51bd.js";import{S as p}from"./shared-4f9d2417.js";import{i as f}from"./shared-d3bf9ac0.js";import"./shared-8dd0af4d.js";import"./shared-99065f2a.js";import"./shared-76b3d76a.js";import"./foxy-nucleon-element.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-4f037e43.js";import"./shared-2f7dcefa.js";import"./shared-6581241a.js";import"./shared-9bdacf65.js";import"./shared-1000b848.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-39c10b22.js";import"./shared-d518bd55.js";import"./foxy-cancellation-form.js";import"./shared-f7e4cd67.js";import"./shared-bc7f58ef.js";import"./shared-ed0dee03.js";import"./shared-11c2efc8.js";import"./shared-404aa9cc.js";import"./shared-08e27fe9.js";import"./foxy-transaction-card.js";import"./foxy-item-card.js";import"./shared-21679ebd.js";import"./shared-486d7bb5.js";import"./shared-d61b3e4f.js";import"./shared-ea67b3f3.js";import"./shared-75e78c70.js";import"./shared-d519a301.js";import"./shared-5378bd8c.js";import"./shared-f80f402a.js";import"./shared-b738ee96.js";let g,z,u,b=t=>t;class $ extends s{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return i.styles}render(){const t=[],e=[];for(let s=0;s<this.size;++s)t.push(r(g||(g=b` <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,l({"text-l font-semibold 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(r(z||(z=b` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),s,s,l({hidden:this.value!==s}),this.value!==s,s));return r(u||(u=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()}}}
1
+ import"./shared-62c088b7.js";import"./shared-2092d86f.js";import{h as t}from"./shared-0ce006b9.js";import"./shared-bc814810.js";import"./shared-0479553e.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-0821cfdc.js";import{k as e}from"./shared-a8ced8bf.js";import{L as s,h as r,c as a}from"./shared-7f33a83a.js";import{C as o}from"./shared-43bcce74.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{w as i,S as h,T as d,a as n}from"./shared-2cc638ad.js";import{c as l}from"./shared-4e709717.js";import"./shared-1c94a156.js";import"./shared-62a54a6c.js";import{S as m}from"./shared-101d1234.js";import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import{G as c}from"./shared-d8dc97f0.js";import"./shared-5ea18e60.js";import{N as v}from"./shared-181f51bd.js";import{S as p}from"./shared-4393ad93.js";import{i as f}from"./shared-d3bf9ac0.js";import"./shared-8dd0af4d.js";import"./shared-99065f2a.js";import"./shared-76b3d76a.js";import"./foxy-nucleon-element.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-4f037e43.js";import"./shared-2f7dcefa.js";import"./shared-6581241a.js";import"./shared-9bdacf65.js";import"./shared-1000b848.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-39c10b22.js";import"./shared-d518bd55.js";import"./foxy-cancellation-form.js";import"./shared-f7e4cd67.js";import"./shared-bc7f58ef.js";import"./shared-ed0dee03.js";import"./shared-11c2efc8.js";import"./shared-404aa9cc.js";import"./shared-08e27fe9.js";import"./foxy-transaction-card.js";import"./foxy-item-card.js";import"./shared-21679ebd.js";import"./shared-486d7bb5.js";import"./shared-d61b3e4f.js";import"./shared-ea67b3f3.js";import"./shared-75e78c70.js";import"./shared-d519a301.js";import"./shared-5378bd8c.js";import"./shared-f80f402a.js";import"./shared-b738ee96.js";let g,z,u,b=t=>t;class $ extends s{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return i.styles}render(){const t=[],e=[];for(let s=0;s<this.size;++s)t.push(r(g||(g=b` <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,l({"text-l font-semibold 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(r(z||(z=b` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),s,s,l({hidden:this.value!==s}),this.value!==s,s));return r(u||(u=b` <div role="tablist" aria-orientation="horizontal" class="-mx-s mb-s">${0}</div> ${0} `),t,e)}__handleKeyDown(t){if(t.key.startsWith("Arrow")){t.preventDefault();const e=t.target;let s=null;"ArrowRight"===t.key||"ArrowDown"===t.key?s=e.nextElementSibling:"ArrowLeft"!==t.key&&"ArrowUp"!==t.key||(s=e.previousElementSibling),null==s||s.click(),null==s||s.focus()}}}
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -1 +1 @@
1
- import{L as e,h as t}from"./shared-7f33a83a.js";import{F as a}from"./shared-76b3d76a.js";import{l as s,_ as n,k as r}from"./shared-a8ced8bf.js";import{A as o}from"./shared-a85afa33.js";async function i(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function l(e){var t;let a,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:o,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw a=405,new Error("Method not allowed. Allowed methods: GET.");const p=s(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=i(m(r)),y=i(m(o)),f=null===(t=(await i(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,c=f?await i(m(f)):void 0,u=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:c,base:new URL(d.url).origin});n=JSON.stringify(u),a=200}catch(e){n=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(n,{status:a})}function d(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout if your webhook fails.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function m(e){let t,a;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=d({paymentPresetId:s(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});a=JSON.stringify(r),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}const p=["_links"];function h(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:s,base:o}=e,{_links:i}=s,l=r(s,p),m=d({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return n(n({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},l),{},{helper:m.values[s.type]})}async function y(e){var t,a;let n,r;try{const{fraudProtectionsUrl:o,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const p=new URL(d.url),y=s(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(p.pathname).groups.presetId,f=await i(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=p.searchParams.get("offset"))&&void 0!==t?t:"0"),s=parseInt(null!==(a=p.searchParams.get("limit"))&&void 0!==a?a:"20"),o=new URL(f._links["fx:payment_method_set_fraud_protections"].href);o.searchParams.set("offset",String(Math.max(0,e-1))),o.searchParams.set("limit",String(s));const l=await i(m(o.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>i(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return h({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(o,{method:"POST",body:JSON.stringify(e)}),a=await i(t),s=await i(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=h({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function f(e){let t,a;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:o,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(o.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=s(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:p}=d.exec(o.url).groups,y=n(m),f=p.substring(0,p.indexOf("C"));if("DELETE"===o.method){const e=(await i(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await i(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>i(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await o.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:o.method,body:"PATCH"===o.method?c:null}),_=await i(u);a="DELETE"===o.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(h({paymentMethodSetFraudProtectionId:p.substring(p.indexOf("C")+1),fraudProtection:_,paymentPresetId:m,base:new URL(o.url).origin}))}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}const c=["_links"];function u(e){const{paymentPresetId:t,helper:a,base:s}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=r(o,c),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,s),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,s);return n(n({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function _(e){var t,a,n,r;let o,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:c}=e;if(!["GET","POST"].includes(f.method))throw o=405,new Error("Method not allowed. Allowed methods: GET, POST.");const _=new URL(f.url),w=s(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(_.pathname).groups.presetId,[g,P,S]=await Promise.all([i(c(d)),i(c(m)),i(c(h(w)))]);if("GET"===f.method){const e=parseInt(null!==(t=_.searchParams.get("offset"))&&void 0!==t?t:"0"),s=parseInt(null!==(a=_.searchParams.get("limit"))&&void 0!==a?a:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(s));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?i(c(d)):null,i(c(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>i(c(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),c=s.returned_items+(l&&"not-on-page"!==l?1:0),_=new URL(`/payment_presets/${i}/payment_methods`,m);_.search=d;const w=new URL(_.toString()),g=new URL(_.toString()),P=new URL(_.toString()),S=new URL(_.toString());w.searchParams.set("limit",String(y)),w.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return u(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:w.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:_.toString()}},_embedded:{"fx:payment_methods":U},returned_items:c,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:w,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});o=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await i(c(p,{method:"POST",body:JSON.stringify(e)})),a=await i(c(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=u({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:w,helper:g.values[t.type],base:new URL(f.url).origin});o=200,l=JSON.stringify(s)}else{const t=c(y,{method:f.method,body:JSON.stringify(e)}),a=await i(t),s={gateway_uri:a._links.self.href};await Promise.all([i(c(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?i(c(S.gateway_uri,{method:"DELETE"})):null]);const n=u({paymentPresetId:w,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});o=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),o=null!=o?o:500}return new Response(l,{status:o})}const w=["_links"];function g(e){const{paymentMethodSet:t,base:a}=e,{_links:s}=t,o=r(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_links:{self:{href:l.toString()},"fx:store":s["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const P=["_embedded","_links"];async function S(e){let t,a;try{const{paymentMethodSetsUrl:s,request:o,fetch:l}=e;if(!["GET","POST"].includes(o.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(o.url),m=new URL(s);let p;if(m.search=d.search,"POST"===o.method){const e=l(m.toString(),{method:"POST",body:await o.text()});p=g({paymentMethodSet:await i(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:s,_links:o}=t,i=r(t,P),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",a),_=new URL(o.self.href);return u.search=_.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":s["fx:payment_method_sets"].map((e=>g({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await i(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function U(e){let t,a;try{const{getPaymentMethodSetUrl:n,request:r,fetch:o}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=s(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await i(o(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));a="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(g({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function b(e){let t,a;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:o,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=s(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:c}=y.exec(p.url).groups,_=c.startsWith("H"),w=d(f),g=c.substring(1,_?c.indexOf("C"):void 0),P=i(h(n)),S=i(h(r));if("DELETE"===p.method)if(_){const e=o(c.substring(c.indexOf("C")+1));await i(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await i(h(w,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(_){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,s=await i(e);a="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentMethodSetHostedPaymentGatewayId:c.substring(c.indexOf("C")+1),hostedPaymentGateway:s,paymentPresetId:f,helper:t.values[s.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,s=await i(e);a="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentGateway:s,paymentPresetId:f,helper:t.values[s.type],base:new URL(p.url).origin}))}}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}let L,E=e=>e;class G extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewaysUrl=null,this.__api=new o(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{if(!(e instanceof a))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:t,hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:i,fraudProtectionsUrl:d,paymentGatewaysUrl:p}=this;if(null===t)return;if(null===n)return;if(null===r)return;if(null===o)return;if(null===i)return;if(null===d)return;if(null===p)return;const h=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},c=function(e){const t=[[s(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),b],[s(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),m],[s(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),l],[s(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),f],[s(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),y],[s(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),_],[s(/\/payment_presets\/(.+)/,{presetId:1}),U],[/\/payment_presets/,S]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:i,fraudProtectionsUrl:d,paymentGatewaysUrl:p,getPaymentMethodSetHostedPaymentGatewayUrl:h(t),getHostedPaymentGatewayUrl:h(o),getPaymentMethodSetUrl:h(i),getFraudProtectionUrl:h(d),getPaymentGatewayUrl:h(p),request:e.request,fetch:this.__fetch});c&&(e.preventDefault(),e.respondWith(c))}}static get properties(){return{paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}render(){return t(L||(L=E`<slot></slot>`))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",G);export{G as PaymentsApi};
1
+ import{L as e}from"./shared-7f33a83a.js";import{F as t}from"./shared-76b3d76a.js";import{l as a,_ as s,k as n}from"./shared-a8ced8bf.js";import{A as r}from"./shared-a85afa33.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=null===(t=(await o(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,c=f?await o(m(f)):void 0,u=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:c,base:new URL(d.url).origin});n=JSON.stringify(u),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout if your webhook fails.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function d(e){let t,s;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=l({paymentPresetId:a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});s=JSON.stringify(r),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=n(r,m),p=l({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return s(s({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const h=new URL(d.url),y=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=h.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function y(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await i.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:i.method,body:"PATCH"===i.method?c:null}),_=await o(u);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:_,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function c(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=n(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return s(s({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function u(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:u}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const _=new URL(f.url),w=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(_.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(w)))]);if("GET"===f.method){const e=parseInt(null!==(t=_.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=_.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(u(d)):null,o(u(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(u(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),u=s.returned_items+(l&&"not-on-page"!==l?1:0),_=new URL(`/payment_presets/${i}/payment_methods`,m);_.search=d;const w=new URL(_.toString()),g=new URL(_.toString()),P=new URL(_.toString()),S=new URL(_.toString());w.searchParams.set("limit",String(y)),w.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return c(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:w.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:_.toString()}},_embedded:{"fx:payment_methods":U},returned_items:u,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:w,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(u(p,{method:"POST",body:JSON.stringify(e)})),a=await o(u(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=c({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:w,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=u(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(u(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(u(S.gateway_uri,{method:"DELETE"})):null]);const n=c({paymentPresetId:w,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const _=["_links"];function w(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=n(t,_),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return s({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=w({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=n(t,g),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",a),_=new URL(o.self.href);return u.search=_.search,s(s({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>w({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(w({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:u}=y.exec(p.url).groups,_=u.startsWith("H"),w=d(f),g=u.substring(1,_?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(_){const e=i(u.substring(u.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(h(w,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(_){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentMethodSetHostedPaymentGatewayId:u.substring(u.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:s,hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:l,fraudProtectionsUrl:m,paymentGatewaysUrl:p}=this;if(null===s)return;if(null===n)return;if(null===r)return;if(null===o)return;if(null===l)return;if(null===m)return;if(null===p)return;const f=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},c=function(e){const t=[[a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),y],[a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),h],[a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),u],[a(/\/payment_presets\/(.+)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:l,fraudProtectionsUrl:m,paymentGatewaysUrl:p,getPaymentMethodSetHostedPaymentGatewayUrl:f(s),getHostedPaymentGatewayUrl:f(o),getPaymentMethodSetUrl:f(l),getFraudProtectionUrl:f(m),getPaymentGatewayUrl:f(p),request:e.request,fetch:this.__fetch});c&&(e.preventDefault(),e.respondWith(c))}}static get properties(){return{paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
@@ -192,4 +192,4 @@ const Y=document.createElement("template");Y.innerHTML='<dom-module id="date-tim
192
192
  </div>
193
193
  <slot name="helper" slot="helper">[[helperText]]</slot>
194
194
  </vaadin-date-time-picker-custom-field>
195
- `}static get is(){return"vaadin-date-time-picker"}static get version(){return"1.4.0"}static get properties(){return{name:{type:String},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},required:{type:Boolean,value:!1},errorMessage:String,value:{type:String,notify:!0,value:"",observer:"__valueChanged"},min:{type:String,observer:"__minChanged"},max:{type:String,observer:"__maxChanged"},__minDateTime:{type:Date,value:""},__maxDateTime:{type:Date,value:""},datePlaceholder:{type:String},timePlaceholder:{type:String},helperText:{type:String,value:""},step:{type:Number},initialPosition:String,showWeekNumbers:{type:Boolean},label:{type:String,value:""},autoOpenDisabled:Boolean,disabled:{type:Boolean,value:!1,reflectToAttribute:!0},readonly:{type:Boolean,value:!1,reflectToAttribute:!0},autofocus:{type:Boolean},__selectedDateTime:{type:Date},__customFieldValueFormat:{type:Object,value:()=>({parseValue:e=>e.split("T"),formatValue:e=>e.join("T")})},i18n:{type:Object,value:()=>Object.assign({},U,G)}}}static get observers(){return["__selectedDateTimeChanged(__selectedDateTime)","__datePlaceholderChanged(datePlaceholder)","__timePlaceholderChanged(timePlaceholder)","__stepChanged(step)","__initialPositionChanged(initialPosition)","__showWeekNumbersChanged(showWeekNumbers)","__requiredChanged(required)","__invalidChanged(invalid)","__disabledChanged(disabled)","__readonlyChanged(readonly)","__i18nChanged(i18n.*)","__autoOpenDisabledChanged(autoOpenDisabled)"]}constructor(){super(),this.__defaultDateMinMaxValue=void 0,this.__defaultTimeMinValue="00:00:00.000",this.__defaultTimeMaxValue="23:59:59.999"}ready(){super.ready(),this.addEventListener("focusout",(e=>{e.relatedTarget!==this.__datePicker.$.overlay&&this.validate()})),this.__changeEventHandler=this.__changeEventHandler.bind(this),this.__filterElements=e=>e.nodeType===Node.ELEMENT_NODE,this.__datePickerChanged(),this.__timePickerChanged(),this.$.dateSlot.addEventListener("slotchange",this.__datePickerChanged.bind(this)),this.$.timeSlot.addEventListener("slotchange",this.__timePickerChanged.bind(this)),this.autofocus&&!this.disabled&&window.requestAnimationFrame((()=>this.focus()))}focus(){this.$.customField.focus()}__syncI18n(e,t,i){(i=i||Object.keys(t.i18n)).forEach((i=>{t.i18n.hasOwnProperty(i)&&e.set(`i18n.${i}`,t.i18n[i])}))}__updateCustomFieldInputs(){const e=this.$.customField.inputs;this.__datePicker&&this.__timePicker&&(e[0]!==this.__datePicker||e[1]!==this.__timePicker)&&this.$.customField._setInputs([this.__datePicker,this.__timePicker])}__changeEventHandler(e){this.__doDispatchChange=!0}__removeChangeListener(e){e&&e.removeEventListener("change",this.__changeEventHandler,!1)}__addChangeListener(e){e.addEventListener("change",this.__changeEventHandler,!1)}__datePickerChanged(){const e=this.shadowRoot.querySelector('[part="date"]'),t=this.$.dateSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__datePicker!==t&&(this.__removeChangeListener(this.__datePicker),this.__addChangeListener(t),this.__datePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.datePlaceholder,t.invalid=this.invalid,t.initialPosition=this.initialPosition,t.showWeekNumbers=this.showWeekNumbers,this.__syncI18n(t,this,z)):(this.datePlaceholder=t.placeholder,this.initialPosition=t.initialPosition,this.showWeekNumbers=t.showWeekNumbers,this.__syncI18n(this,t,z)),t.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue),t.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{},t._validateInput=()=>{})}__timePickerChanged(){const e=this.shadowRoot.querySelector('[part="time"]'),t=this.$.timeSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__timePicker!==t&&(this.__removeChangeListener(this.__timePicker),this.__addChangeListener(t),this.__timePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.timePlaceholder,t.step=this.step,t.invalid=this.invalid,this.__syncI18n(t,this,J)):(this.timePlaceholder=t.placeholder,this.step=t.step,this.__syncI18n(this,t,J)),this.__updateTimePickerMinMax(),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{})}__updateTimePickerMinMax(){if(this.__timePicker&&this.__datePicker){const e=i._dateEquals,t=this.__parseDate(this.__datePicker.value),a=e(this.__minDateTime,this.__maxDateTime),s=this.__timePicker.value;this.__minDateTime&&e(t,this.__minDateTime)||a?this.__timePicker.min=this.__dateToIsoTimeString(this.__minDateTime):this.__timePicker.min=this.__defaultTimeMinValue,this.__maxDateTime&&e(t,this.__maxDateTime)||a?this.__timePicker.max=this.__dateToIsoTimeString(this.__maxDateTime):this.__timePicker.max=this.__defaultTimeMaxValue,this.__timePicker.value!==s&&(this.__timePicker.value=s)}}__i18nChanged(e){this.__datePicker&&this.__datePicker.set(e.path,e.value),this.__timePicker&&this.__timePicker.set(e.path,e.value)}__datePlaceholderChanged(e){this.__datePicker&&(this.__datePicker.placeholder=e)}__timePlaceholderChanged(e){this.__timePicker&&(this.__timePicker.placeholder=e)}__stepChanged(e){if(this.__timePicker&&this.__timePicker.step!==e){const t=this.__timePicker.value;this.__timePicker.step=e,this.__timePicker.value!==t&&this.__triggerCustomFieldValueUpdate()}}__triggerCustomFieldValueUpdate(){this.__timePicker&&this.__timePicker.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__initialPositionChanged(e){this.__datePicker&&(this.__datePicker.initialPosition=e)}__showWeekNumbersChanged(e){this.__datePicker&&(this.__datePicker.showWeekNumbers=e)}__invalidChanged(e){this.__datePicker&&(this.__datePicker.invalid=e),this.__timePicker&&(this.__timePicker.invalid=e)}__requiredChanged(e){this.__datePicker&&(this.__datePicker.required=e),this.__timePicker&&(this.__timePicker.required=e)}__disabledChanged(e){this.__datePicker&&(this.__datePicker.disabled=e),this.__timePicker&&(this.__timePicker.disabled=e)}__readonlyChanged(e){this.__datePicker&&(this.__datePicker.readonly=e),this.__timePicker&&(this.__timePicker.readonly=e)}__parseDate(e){return W.prototype._parseDate(e)}__formatDateISO(e,t){return e?W.prototype._formatISO(e):t}__formatTimeISO(e){return G.formatTime(e)}__parseTimeISO(e){return G.parseTime(e)}__parseDateTime(e){const[t,i]=e.split("T");if(!t||!i)return;const a=this.__parseDate(t);if(!a)return;const s=this.__parseTimeISO(i);return s?(a.setHours(parseInt(s.hours)),a.setMinutes(parseInt(s.minutes||0)),a.setSeconds(parseInt(s.seconds||0)),a.setMilliseconds(parseInt(s.milliseconds||0)),a):void 0}__formatDateTime(e){if(!e)return"";return`${this.__formatDateISO(e,"")}T${this.__dateToIsoTimeString(e)}`}__dateToIsoTimeString(e){return this.__formatTimeISO(this.__validateTime({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}))}__validateTime(e){return e&&(e.seconds=this.__stepSegment<3?void 0:e.seconds,e.milliseconds=this.__stepSegment<4?void 0:e.milliseconds),e}validate(){return!(this.invalid=!this.checkValidity())}checkValidity(){const e=this.$.customField.inputs.filter((e=>!e.checkValidity.call(e))).length>0,t=this.required&&this.$.customField.inputs.filter((e=>!e.value)).length>0;return!e&&!t}get __stepSegment(){const e=null==this.step?60:parseFloat(this.step);return e%3600==0?1:e%60!=0&&e?e%1==0?3:e<1?4:void 0:2}__dateTimeEquals(e,t){return!!i._dateEquals(e,t)&&(e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes()&&e.getSeconds()===t.getSeconds()&&e.getMilliseconds()===t.getMilliseconds())}__handleDateTimeChange(e,t,i,a){if(!i)return this[e]="",void(this[t]="");const s=this.__parseDateTime(i);s?this.__dateTimeEquals(this[t],s)||(this[t]=s):this[e]=a}__valueChanged(e,t){this.__handleDateTimeChange("value","__selectedDateTime",e,t),this.__doDispatchChange&&(this.__dispatchChange(),this.validate())}__dispatchChange(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__minChanged(e,t){this.__handleDateTimeChange("min","__minDateTime",e,t),this.__datePicker&&(this.__datePicker.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__maxChanged(e,t){this.__handleDateTimeChange("max","__maxDateTime",e,t),this.__datePicker&&(this.__datePicker.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__selectedDateTimeChanged(e){const t=this.__formatDateTime(e);this.value!==t&&(this.value=t);if(!!this.$.customField.inputs[0].$){const e=this.__doDispatchChange;this.$.customField.value=""!==this.value?this.value:"T",this.__doDispatchChange=e}}__customFieldValueChanged(e){const t=e.detail.value;if("T"===t&&!this.__customFieldInitialValueChangeReceived)return void(this.__customFieldInitialValueChangeReceived=!0);const[i,a]=t.split("T");this.__oldDateValue!==i&&(this.__oldDateValue=i,this.__updateTimePickerMinMax()),i&&a?t!==this.value&&(this.value=t):this.value="",this.__doDispatchChange=!1}__autoOpenDisabledChanged(e){this.__datePicker&&(this.__datePicker.autoOpenDisabled=e),this.__timePicker&&(this.__timePicker.autoOpenDisabled=e)}}customElements.define(Q.is,Q);const X=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function Z(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=0===i?X.length-1:i-1,s=X[a][0],n=new Date(e.getFullYear(),s),r=X[a][2];return{start:n,end:new Date(new Date(e.getFullYear(),r+1).getTime()-1)}}function ee(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=X[i][0],s=new Date(e.getFullYear(),a),n=X[i][2];return{start:s,end:new Date(new Date(e.getFullYear(),n+1).getTime()-1)}}function te(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()-1),end:new Date(new Date(e.getFullYear(),e.getMonth()).getTime()-1)}}function ie(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()),end:new Date(new Date(e.getFullYear(),e.getMonth()+1).getTime()-1)}}function ae(e=new Date){return{start:new Date(e.getFullYear()-1,0),end:new Date(new Date(e.getFullYear(),0).getTime()-1)}}function se(e=new Date){return{start:new Date(e.getFullYear(),0),end:new Date(new Date(e.getFullYear()+1,0).getTime()-1)}}function ne(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-365),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function re(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-30),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function de(e){return`${e.getFullYear().toString().padStart(4,"0")}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`}let le,oe,he,me,_e,ce,ue,pe,ge,ve,fe,be,ye,ke,Te,xe=e=>e;const $e=g(v(f(D(b(E,"report-form")))));class De extends $e{constructor(){super(...arguments),this.templates={},this.__showRangeTime=!1}static get scopedElements(){return{"vaadin-date-time-picker":customElements.get("vaadin-date-time-picker"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-checkbox":customElements.get("vaadin-checkbox"),"vaadin-select":customElements.get("vaadin-select"),"vaadin-button":customElements.get("vaadin-button"),"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-property-table":$,"x-choice":k,"x-group":x}}static get properties(){return c(c({},super.properties),{},{__showRangeTime:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({datetime_start:e})=>!!e||"datetime_start_required",({datetime_end:e})=>!!e||"datetime_end_required"]}render(){var e,t;const i=this.hiddenSelector;return u(le||(le=xe` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="space-y-m"> ${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> `),this.in("busy"),i.matches("name",!0)?"":this.__renderName(),i.matches("range",!0)?"":this.__renderRange(),i.matches("timestamps",!0)||!this.data?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),y({"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:"")}__renderName(){const e="name",t=["complete","customers","customers_ltv"],i=!this.in("idle")||this.disabledSelector.matches(e),a=this.readonlySelector.matches(e);return u(oe||(oe=xe` <div data-testid="${0}"> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="name" ns="${0}"></foxy-i18n> <x-choice data-testid="name-choice" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),e,this.renderTemplateOrSlot("name:before"),this.lang,this.ns,this.form.name,t,a,i,(e=>{e instanceof T&&this.edit({name:e.detail})}),t.map((e=>u(he||(he=xe` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="name_${0}" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s opacity-70" lang="${0}" key="name_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns,this.lang,e,this.ns))),this.renderTemplateOrSlot("name:after"))}__renderRangePreset(){var e;const t=[[c({value:"0",label:"preset_previous_quarter"},Z()),c({value:"1",label:"preset_previous_month"},te()),c({value:"2",label:"preset_previous_year"},ae())],[c({value:"3",label:"preset_this_quarter"},ee()),c({value:"4",label:"preset_this_month"},ie()),c({value:"5",label:"preset_this_year"},se())],[c({value:"6",label:"preset_last_365_days"},ne()),c({value:"7",label:"preset_last_30_days"},re())]],i=t.flat(1).find((e=>{const{datetime_end:t,datetime_start:i}=this.form;return i&&t&&de(e.start)===i&&de(e.end)===t}));return u(ge||(ge=xe` <div> <vaadin-select data-testid="range:preset" label="${0}" class="w-full -mt-m -mb-xs" ?disabled="${0}" ?readonly="${0}" .value="${0}" .renderer="${0}" @change="${0}"> </vaadin-select> </div> `),this.t("preset"),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),S(null!==(e=null==i?void 0:i.value)&&void 0!==e?e:"custom"),(e=>{const i=u(me||(me=xe`<vaadin-item value="custom">${0}</vaadin-item>`),this.t("preset_custom")),a=u(_e||(_e=xe`<hr>`)),s=t.map((e=>{const t=e.map((({value:e,label:t})=>u(ce||(ce=xe`<vaadin-item value="${0}">${0}</vaadin-item>`),e,this.t(t))));return u(ue||(ue=xe`${0}${0}`),t,a)}));e.firstElementChild||e.appendChild(document.createElement("vaadin-list-box")),p(u(pe||(pe=xe`${0}${0}`),s,i),e.firstElementChild)}),(e=>{const i=e.currentTarget,a=t.flat(1).find((e=>e.value===i.value));a&&this.edit({datetime_start:de(a.start),datetime_end:de(a.end)})}))}__renderRangeDateTimePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(ve||(ve=xe` <vaadin-date-time-picker date-placeholder="${0}" time-placeholder="${0}" error-message="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-time-picker> `),this.t("select_date"),this.t("select_time"),w(i?this.t(i):void 0),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(e=>{const i=e.currentTarget;this.edit({[t]:i.value})}));var s,n}__renderRangeDatePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(fe||(fe=xe` <vaadin-date-picker error-message="${0}" placeholder="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),w(i?this.t(i):void 0),this.t("select_date"),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(i=>{const a=i.currentTarget,s="end"===e?"23:59:59":"00:00:00";this.edit({[t]:`${a.value}T${s}`})}));var s,n}__renderRange(){const e=this.__showRangeTime?this.__renderRangeDateTimePicker:this.__renderRangeDatePicker;return u(be||(be=xe` <div data-testid="range"> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="range" ns="${0}"></foxy-i18n> <div style="--lumo-border-radius:var(--lumo-border-radius-s)" class="p-m grid gap-m ${0}"> <div class="${0}"> ${0} </div> ${0} ${0} <vaadin-checkbox data-testid="range:toggle" class="-my-xs w-full ${0}" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="use_precise_time" ns="${0}"></foxy-i18n> </vaadin-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("range:before"),this.lang,this.ns,this.__showRangeTime?"grid-cols-1":"sm-grid-cols-2",this.__showRangeTime?"col-span-1":"sm-col-span-2",this.__renderRangePreset(),e.call(this,"start"),e.call(this,"end"),this.__showRangeTime?"col-span-1":"sm-col-span-2",!this.in("idle")||this.disabledSelector.matches("range",!0),this.__showRangeTime,(e=>{const t=e.currentTarget;this.__showRangeTime=t.checked}),this.lang,this.ns,this.renderTemplateOrSlot("range:after"))}__renderTimestamps(){return u(ye||(ye=xe` <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"}}}),a=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||a),n=this.in("idle");return u(ke||(ke=xe` <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"),!n||s||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return u(Te||(Te=xe` <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"))}}customElements.define("foxy-report-form",De);export{De as ReportForm};
195
+ `}static get is(){return"vaadin-date-time-picker"}static get version(){return"1.4.0"}static get properties(){return{name:{type:String},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},required:{type:Boolean,value:!1},errorMessage:String,value:{type:String,notify:!0,value:"",observer:"__valueChanged"},min:{type:String,observer:"__minChanged"},max:{type:String,observer:"__maxChanged"},__minDateTime:{type:Date,value:""},__maxDateTime:{type:Date,value:""},datePlaceholder:{type:String},timePlaceholder:{type:String},helperText:{type:String,value:""},step:{type:Number},initialPosition:String,showWeekNumbers:{type:Boolean},label:{type:String,value:""},autoOpenDisabled:Boolean,disabled:{type:Boolean,value:!1,reflectToAttribute:!0},readonly:{type:Boolean,value:!1,reflectToAttribute:!0},autofocus:{type:Boolean},__selectedDateTime:{type:Date},__customFieldValueFormat:{type:Object,value:()=>({parseValue:e=>e.split("T"),formatValue:e=>e.join("T")})},i18n:{type:Object,value:()=>Object.assign({},U,G)}}}static get observers(){return["__selectedDateTimeChanged(__selectedDateTime)","__datePlaceholderChanged(datePlaceholder)","__timePlaceholderChanged(timePlaceholder)","__stepChanged(step)","__initialPositionChanged(initialPosition)","__showWeekNumbersChanged(showWeekNumbers)","__requiredChanged(required)","__invalidChanged(invalid)","__disabledChanged(disabled)","__readonlyChanged(readonly)","__i18nChanged(i18n.*)","__autoOpenDisabledChanged(autoOpenDisabled)"]}constructor(){super(),this.__defaultDateMinMaxValue=void 0,this.__defaultTimeMinValue="00:00:00.000",this.__defaultTimeMaxValue="23:59:59.999"}ready(){super.ready(),this.addEventListener("focusout",(e=>{e.relatedTarget!==this.__datePicker.$.overlay&&this.validate()})),this.__changeEventHandler=this.__changeEventHandler.bind(this),this.__filterElements=e=>e.nodeType===Node.ELEMENT_NODE,this.__datePickerChanged(),this.__timePickerChanged(),this.$.dateSlot.addEventListener("slotchange",this.__datePickerChanged.bind(this)),this.$.timeSlot.addEventListener("slotchange",this.__timePickerChanged.bind(this)),this.autofocus&&!this.disabled&&window.requestAnimationFrame((()=>this.focus()))}focus(){this.$.customField.focus()}__syncI18n(e,t,i){(i=i||Object.keys(t.i18n)).forEach((i=>{t.i18n.hasOwnProperty(i)&&e.set(`i18n.${i}`,t.i18n[i])}))}__updateCustomFieldInputs(){const e=this.$.customField.inputs;this.__datePicker&&this.__timePicker&&(e[0]!==this.__datePicker||e[1]!==this.__timePicker)&&this.$.customField._setInputs([this.__datePicker,this.__timePicker])}__changeEventHandler(e){this.__doDispatchChange=!0}__removeChangeListener(e){e&&e.removeEventListener("change",this.__changeEventHandler,!1)}__addChangeListener(e){e.addEventListener("change",this.__changeEventHandler,!1)}__datePickerChanged(){const e=this.shadowRoot.querySelector('[part="date"]'),t=this.$.dateSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__datePicker!==t&&(this.__removeChangeListener(this.__datePicker),this.__addChangeListener(t),this.__datePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.datePlaceholder,t.invalid=this.invalid,t.initialPosition=this.initialPosition,t.showWeekNumbers=this.showWeekNumbers,this.__syncI18n(t,this,z)):(this.datePlaceholder=t.placeholder,this.initialPosition=t.initialPosition,this.showWeekNumbers=t.showWeekNumbers,this.__syncI18n(this,t,z)),t.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue),t.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{},t._validateInput=()=>{})}__timePickerChanged(){const e=this.shadowRoot.querySelector('[part="time"]'),t=this.$.timeSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__timePicker!==t&&(this.__removeChangeListener(this.__timePicker),this.__addChangeListener(t),this.__timePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.timePlaceholder,t.step=this.step,t.invalid=this.invalid,this.__syncI18n(t,this,J)):(this.timePlaceholder=t.placeholder,this.step=t.step,this.__syncI18n(this,t,J)),this.__updateTimePickerMinMax(),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{})}__updateTimePickerMinMax(){if(this.__timePicker&&this.__datePicker){const e=i._dateEquals,t=this.__parseDate(this.__datePicker.value),a=e(this.__minDateTime,this.__maxDateTime),s=this.__timePicker.value;this.__minDateTime&&e(t,this.__minDateTime)||a?this.__timePicker.min=this.__dateToIsoTimeString(this.__minDateTime):this.__timePicker.min=this.__defaultTimeMinValue,this.__maxDateTime&&e(t,this.__maxDateTime)||a?this.__timePicker.max=this.__dateToIsoTimeString(this.__maxDateTime):this.__timePicker.max=this.__defaultTimeMaxValue,this.__timePicker.value!==s&&(this.__timePicker.value=s)}}__i18nChanged(e){this.__datePicker&&this.__datePicker.set(e.path,e.value),this.__timePicker&&this.__timePicker.set(e.path,e.value)}__datePlaceholderChanged(e){this.__datePicker&&(this.__datePicker.placeholder=e)}__timePlaceholderChanged(e){this.__timePicker&&(this.__timePicker.placeholder=e)}__stepChanged(e){if(this.__timePicker&&this.__timePicker.step!==e){const t=this.__timePicker.value;this.__timePicker.step=e,this.__timePicker.value!==t&&this.__triggerCustomFieldValueUpdate()}}__triggerCustomFieldValueUpdate(){this.__timePicker&&this.__timePicker.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__initialPositionChanged(e){this.__datePicker&&(this.__datePicker.initialPosition=e)}__showWeekNumbersChanged(e){this.__datePicker&&(this.__datePicker.showWeekNumbers=e)}__invalidChanged(e){this.__datePicker&&(this.__datePicker.invalid=e),this.__timePicker&&(this.__timePicker.invalid=e)}__requiredChanged(e){this.__datePicker&&(this.__datePicker.required=e),this.__timePicker&&(this.__timePicker.required=e)}__disabledChanged(e){this.__datePicker&&(this.__datePicker.disabled=e),this.__timePicker&&(this.__timePicker.disabled=e)}__readonlyChanged(e){this.__datePicker&&(this.__datePicker.readonly=e),this.__timePicker&&(this.__timePicker.readonly=e)}__parseDate(e){return W.prototype._parseDate(e)}__formatDateISO(e,t){return e?W.prototype._formatISO(e):t}__formatTimeISO(e){return G.formatTime(e)}__parseTimeISO(e){return G.parseTime(e)}__parseDateTime(e){const[t,i]=e.split("T");if(!t||!i)return;const a=this.__parseDate(t);if(!a)return;const s=this.__parseTimeISO(i);return s?(a.setHours(parseInt(s.hours)),a.setMinutes(parseInt(s.minutes||0)),a.setSeconds(parseInt(s.seconds||0)),a.setMilliseconds(parseInt(s.milliseconds||0)),a):void 0}__formatDateTime(e){if(!e)return"";return`${this.__formatDateISO(e,"")}T${this.__dateToIsoTimeString(e)}`}__dateToIsoTimeString(e){return this.__formatTimeISO(this.__validateTime({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}))}__validateTime(e){return e&&(e.seconds=this.__stepSegment<3?void 0:e.seconds,e.milliseconds=this.__stepSegment<4?void 0:e.milliseconds),e}validate(){return!(this.invalid=!this.checkValidity())}checkValidity(){const e=this.$.customField.inputs.filter((e=>!e.checkValidity.call(e))).length>0,t=this.required&&this.$.customField.inputs.filter((e=>!e.value)).length>0;return!e&&!t}get __stepSegment(){const e=null==this.step?60:parseFloat(this.step);return e%3600==0?1:e%60!=0&&e?e%1==0?3:e<1?4:void 0:2}__dateTimeEquals(e,t){return!!i._dateEquals(e,t)&&(e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes()&&e.getSeconds()===t.getSeconds()&&e.getMilliseconds()===t.getMilliseconds())}__handleDateTimeChange(e,t,i,a){if(!i)return this[e]="",void(this[t]="");const s=this.__parseDateTime(i);s?this.__dateTimeEquals(this[t],s)||(this[t]=s):this[e]=a}__valueChanged(e,t){this.__handleDateTimeChange("value","__selectedDateTime",e,t),this.__doDispatchChange&&(this.__dispatchChange(),this.validate())}__dispatchChange(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__minChanged(e,t){this.__handleDateTimeChange("min","__minDateTime",e,t),this.__datePicker&&(this.__datePicker.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__maxChanged(e,t){this.__handleDateTimeChange("max","__maxDateTime",e,t),this.__datePicker&&(this.__datePicker.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__selectedDateTimeChanged(e){const t=this.__formatDateTime(e);this.value!==t&&(this.value=t);if(!!this.$.customField.inputs[0].$){const e=this.__doDispatchChange;this.$.customField.value=""!==this.value?this.value:"T",this.__doDispatchChange=e}}__customFieldValueChanged(e){const t=e.detail.value;if("T"===t&&!this.__customFieldInitialValueChangeReceived)return void(this.__customFieldInitialValueChangeReceived=!0);const[i,a]=t.split("T");this.__oldDateValue!==i&&(this.__oldDateValue=i,this.__updateTimePickerMinMax()),i&&a?t!==this.value&&(this.value=t):this.value="",this.__doDispatchChange=!1}__autoOpenDisabledChanged(e){this.__datePicker&&(this.__datePicker.autoOpenDisabled=e),this.__timePicker&&(this.__timePicker.autoOpenDisabled=e)}}customElements.define(Q.is,Q);const X=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function Z(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=0===i?X.length-1:i-1,s=e.getFullYear()-(0===i?1:0),n=X[a][0],r=new Date(s,n),d=X[a][2];return{start:r,end:new Date(new Date(s,d+1).getTime()-1)}}function ee(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=X[i][0],s=new Date(e.getFullYear(),a),n=X[i][2];return{start:s,end:new Date(new Date(e.getFullYear(),n+1).getTime()-1)}}function te(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()-1),end:new Date(new Date(e.getFullYear(),e.getMonth()).getTime()-1)}}function ie(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()),end:new Date(new Date(e.getFullYear(),e.getMonth()+1).getTime()-1)}}function ae(e=new Date){return{start:new Date(e.getFullYear()-1,0),end:new Date(new Date(e.getFullYear(),0).getTime()-1)}}function se(e=new Date){return{start:new Date(e.getFullYear(),0),end:new Date(new Date(e.getFullYear()+1,0).getTime()-1)}}function ne(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-365),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function re(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-30),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function de(e){return`${e.getFullYear().toString().padStart(4,"0")}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`}let le,oe,he,me,_e,ce,ue,pe,ge,ve,fe,be,ye,ke,Te,xe=e=>e;const $e=g(v(f(D(b(E,"report-form")))));class De extends $e{constructor(){super(...arguments),this.templates={},this.__showRangeTime=!1}static get scopedElements(){return{"vaadin-date-time-picker":customElements.get("vaadin-date-time-picker"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-checkbox":customElements.get("vaadin-checkbox"),"vaadin-select":customElements.get("vaadin-select"),"vaadin-button":customElements.get("vaadin-button"),"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-property-table":$,"x-choice":k,"x-group":x}}static get properties(){return c(c({},super.properties),{},{__showRangeTime:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({datetime_start:e})=>!!e||"datetime_start_required",({datetime_end:e})=>!!e||"datetime_end_required"]}render(){var e,t;const i=this.hiddenSelector;return u(le||(le=xe` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="space-y-m"> ${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> `),this.in("busy"),i.matches("name",!0)?"":this.__renderName(),i.matches("range",!0)?"":this.__renderRange(),i.matches("timestamps",!0)||!this.data?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),y({"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:"")}__renderName(){const e="name",t=["complete","customers","customers_ltv"],i=!this.in("idle")||this.disabledSelector.matches(e),a=this.readonlySelector.matches(e);return u(oe||(oe=xe` <div data-testid="${0}"> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="name" ns="${0}"></foxy-i18n> <x-choice data-testid="name-choice" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),e,this.renderTemplateOrSlot("name:before"),this.lang,this.ns,this.form.name,t,a,i,(e=>{e instanceof T&&this.edit({name:e.detail})}),t.map((e=>u(he||(he=xe` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="name_${0}" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s opacity-70" lang="${0}" key="name_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns,this.lang,e,this.ns))),this.renderTemplateOrSlot("name:after"))}__renderRangePreset(){var e;const t=[[c({value:"0",label:"preset_previous_quarter"},Z()),c({value:"1",label:"preset_previous_month"},te()),c({value:"2",label:"preset_previous_year"},ae())],[c({value:"3",label:"preset_this_quarter"},ee()),c({value:"4",label:"preset_this_month"},ie()),c({value:"5",label:"preset_this_year"},se())],[c({value:"6",label:"preset_last_365_days"},ne()),c({value:"7",label:"preset_last_30_days"},re())]],i=t.flat(1).find((e=>{const{datetime_end:t,datetime_start:i}=this.form;return i&&t&&de(e.start)===i&&de(e.end)===t}));return u(ge||(ge=xe` <div> <vaadin-select data-testid="range:preset" label="${0}" class="w-full -mt-m -mb-xs" ?disabled="${0}" ?readonly="${0}" .value="${0}" .renderer="${0}" @change="${0}"> </vaadin-select> </div> `),this.t("preset"),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),S(null!==(e=null==i?void 0:i.value)&&void 0!==e?e:"custom"),(e=>{const i=u(me||(me=xe`<vaadin-item value="custom">${0}</vaadin-item>`),this.t("preset_custom")),a=u(_e||(_e=xe`<hr>`)),s=t.map((e=>{const t=e.map((({value:e,label:t})=>u(ce||(ce=xe`<vaadin-item value="${0}">${0}</vaadin-item>`),e,this.t(t))));return u(ue||(ue=xe`${0}${0}`),t,a)}));e.firstElementChild||e.appendChild(document.createElement("vaadin-list-box")),p(u(pe||(pe=xe`${0}${0}`),s,i),e.firstElementChild)}),(e=>{const i=e.currentTarget,a=t.flat(1).find((e=>e.value===i.value));a&&this.edit({datetime_start:de(a.start),datetime_end:de(a.end)})}))}__renderRangeDateTimePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(ve||(ve=xe` <vaadin-date-time-picker date-placeholder="${0}" time-placeholder="${0}" error-message="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-time-picker> `),this.t("select_date"),this.t("select_time"),w(i?this.t(i):void 0),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(e=>{const i=e.currentTarget;this.edit({[t]:i.value})}));var s,n}__renderRangeDatePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(fe||(fe=xe` <vaadin-date-picker error-message="${0}" placeholder="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),w(i?this.t(i):void 0),this.t("select_date"),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(i=>{const a=i.currentTarget,s="end"===e?"23:59:59":"00:00:00";this.edit({[t]:`${a.value}T${s}`})}));var s,n}__renderRange(){const e=this.__showRangeTime?this.__renderRangeDateTimePicker:this.__renderRangeDatePicker;return u(be||(be=xe` <div data-testid="range"> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="range" ns="${0}"></foxy-i18n> <div style="--lumo-border-radius:var(--lumo-border-radius-s)" class="p-m grid gap-m ${0}"> <div class="${0}"> ${0} </div> ${0} ${0} <vaadin-checkbox data-testid="range:toggle" class="-my-xs w-full ${0}" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="use_precise_time" ns="${0}"></foxy-i18n> </vaadin-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("range:before"),this.lang,this.ns,this.__showRangeTime?"grid-cols-1":"sm-grid-cols-2",this.__showRangeTime?"col-span-1":"sm-col-span-2",this.__renderRangePreset(),e.call(this,"start"),e.call(this,"end"),this.__showRangeTime?"col-span-1":"sm-col-span-2",!this.in("idle")||this.disabledSelector.matches("range",!0),this.__showRangeTime,(e=>{const t=e.currentTarget;this.__showRangeTime=t.checked}),this.lang,this.ns,this.renderTemplateOrSlot("range:after"))}__renderTimestamps(){return u(ye||(ye=xe` <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"}}}),a=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||a),n=this.in("idle");return u(ke||(ke=xe` <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"),!n||s||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return u(Te||(Te=xe` <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"))}}customElements.define("foxy-report-form",De);export{De as ReportForm};
@@ -1 +1 @@
1
- import"./shared-bc814810.js";import"./shared-2add595d.js";import"./shared-c95c17e6.js";import"./shared-71f2ef1f.js";import"./shared-a37abe4c.js";import"./shared-af226a9a.js";import"./shared-4979dca4.js";import"./shared-988ec916.js";import"./shared-d518bd55.js";import"./shared-cba08e1c.js";import"./shared-80fc2b6a.js";import{I as e}from"./shared-6581241a.js";import"./foxy-nucleon-element.js";import"./shared-0821cfdc.js";import{_ as t}from"./shared-a8ced8bf.js";import{R as o,a as i}from"./shared-2cc638ad.js";import{i as r}from"./shared-d3bf9ac0.js";import{c as s}from"./shared-4e709717.js";import{h as n}from"./shared-7f33a83a.js";import{c as a}from"./shared-63139d9e.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-88c4cfec.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-62c088b7.js";import"./shared-39c10b22.js";import"./shared-9bdacf65.js";import"./shared-0479553e.js";import"./shared-43bcce74.js";import"./shared-76b3d76a.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-d519a301.js";import"./shared-f3b35364.js";import"./shared-11c2efc8.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-83596b46.js";import"./shared-8dd0af4d.js";import"./shared-62a54a6c.js";import"./foxy-spinner.js";import"./shared-2092d86f.js";import"./shared-839dd3a8.js";let l,c,d,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w,q=e=>e;const O=o(i(e,"store-form"));class C extends O{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.templates={},this.__singleCheckboxGroupOptions=[{label:"option_checked",value:"checked"}],this.__appSessionTimeOptions=[{value:"s",label:"second"},{value:"m",label:"minute"},{value:"h",label:"hour"},{value:"d",label:"day"}],this.__getStoreEmailValue=()=>{var e;return(null!==(e=this.form.store_email)&&void 0!==e?e:"").split(",").map((e=>({value:e.trim()}))).filter((({value:e})=>e.length>0))},this.__setStoreEmailValue=e=>{this.edit({store_email:e.map((e=>e.value)).join(",")})},this.__getBccOnReceiptEmailValue=()=>this.form.bcc_on_receipt_email?["checked"]:[],this.__setBccOnReceiptEmailValue=e=>{this.edit({bcc_on_receipt_email:e.includes("checked")})},this.__getUseEmailDnsValue=()=>this.form.use_email_dns?["checked"]:[],this.__setUseEmailDnsValue=e=>{this.edit({use_email_dns:e.includes("checked")})},this.__getUseSmtpConfigValue=()=>this.form.smtp_config?["checked"]:[],this.__setUseSmtpConfigValue=e=>{e.includes("checked")?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getFeaturesMultishipValue=()=>this.form.features_multiship?["checked"]:[],this.__setFeaturesMultishipValue=e=>{this.edit({features_multiship:e.includes("checked")})},this.__getRequireSignedShippingRatesValue=()=>this.form.require_signed_shipping_rates?["checked"]:[],this.__setRequireSignedShippingRatesValue=e=>{this.edit({require_signed_shipping_rates:e.includes("checked")})},this.__getAppSessionTimeValue=()=>{const e=this.form.app_session_time||43200;return e%86400==0?e/86400+"d":e%3600==0?e/3600+"h":e%60==0?e/60+"m":`${e}s`},this.__setAppSessionTimeValue=e=>{const t=e[e.length-1],o=parseInt(e.substring(0,e.length-1));this.edit({app_session_time:{d:86400,h:3600,m:60,s:1}[t]*o})},this.__getProductsRequireExpiresPropertyValue=()=>this.form.products_require_expires_property?["checked"]:[],this.__setProductsRequireExpiresPropertyValue=e=>{this.edit({products_require_expires_property:e.includes("checked")})},this.__getUseCartValidationValue=()=>this.form.use_cart_validation?["checked"]:[],this.__setUseCartValidationValue=e=>{this.edit({use_cart_validation:e.includes("checked")})},this.__getSingleSignOnUrlValue=()=>{var e;return this.form.use_single_sign_on&&null!==(e=this.form.single_sign_on_url)&&void 0!==e?e:""},this.__setSingleSignOnUrlValue=e=>{this.edit({use_single_sign_on:!!e,single_sign_on_url:e})},this.__getWebhookUrlValue=()=>{var e;return this.form.use_webhook&&null!==(e=this.form.webhook_url)&&void 0!==e?e:""},this.__setWebhookUrlValue=e=>{this.edit({use_webhook:!!e,webhook_url:e})},this.__setStoreDomainValue=e=>{if(e.endsWith(".foxycart.com")){const t=e.substring(0,e.length-13);this.edit({store_domain:t,use_remote_domain:t.includes(".")})}else this.edit({store_domain:e,use_remote_domain:e.includes(".")})}}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},storeVersions:{attribute:"store-versions"},checkoutTypes:{attribute:"checkout-types"},localeCodes:{attribute:"locale-codes"},languages:{},timezones:{},countries:{},regions:{}})}static get v8n(){return[({store_name:e})=>!!e||"store-name:v8n_required",({store_name:e})=>e&&e.length<=50||"store-name:v8n_too_long",({store_domain:e})=>!!e||"store-domain:v8n_required",({store_domain:e})=>e&&e.length<=50||"store-domain:v8n_too_long",({store_url:e})=>!!e||"store-url:v8n_required",({store_url:e})=>e&&e.length<=300||"store-url:v8n_too_long",({receipt_continue_url:e})=>!e||e.length<=300||"receipt-continue-url:v8n_too_long",({store_email:e})=>!!e||"store-email:v8n_required",({store_email:e})=>e&&e.length<=300||"store-email:v8n_too_long",({from_email:e})=>!e||e.length<=100||"from-email:v8n_too_long",({smtp_config:e})=>!e||e.length<=1e3||"use-smtp-config:v8n_too_long",({postal_code:e})=>!!e||"postal-code:v8n_required",({postal_code:e})=>e&&e.length<=50||"postal-code:v8n_too_long",({region:e})=>!!e||"region:v8n_required",({region:e})=>e&&e.length<=100||"region:v8n_too_long",({country:e})=>!!e||"country:v8n_required",({logo_url:e})=>!e||e.length<=100||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!!e||"webhook-url:v8n_required",({webhook_url:e,use_webhook:t})=>!t||!e||e.length<=300||"webhook-url:v8n_too_long",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!!e||"webhook-key:v8n_required",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!e||e.length<=200||"webhook-key:v8n_too_long",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!!e||"single-sign-on-url:v8n_required",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!e||e.length<=300||"single-sign-on-url:v8n_too_long",({customer_password_hash_config:e})=>!e||String(e).length<=100||"customer-password-hash-config:v8n_too_long",({unified_order_entry_password:e})=>!e||String(e).length<=100||"unified-order-entry-password:v8n_too_long",({custom_display_id_config:e})=>!e||String(e).length<=100||"custom-display-id-config-enabled:v8n_too_long"]}renderBody(){var e,t,o,i,s,a,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w;const O=this.form.use_email_dns&&!(null===(e=this.data)||void 0===e?void 0:e.use_email_dns)&&!this.hiddenSelector.matches("use-email-dns",!0),C=this.form.require_signed_shipping_rates&&!(null===(t=this.data)||void 0===t?void 0:t.require_signed_shipping_rates)&&!this.hiddenSelector.matches("require-signed-shipping-rates",!0),U=this.form.products_require_expires_property&&!(null===(o=this.data)||void 0===o?void 0:o.products_require_expires_property)&&!this.hiddenSelector.matches("products-require-expires-property",!0),N=this.form.use_cart_validation&&!(null===(i=this.data)||void 0===i?void 0:i.use_cart_validation)&&!this.hiddenSelector.matches("use-cart-validation",!0),R=this.t(this.form.use_remote_domain&&!(null===(s=this.data)||void 0===s?void 0:s.use_remote_domain)?"store-domain.custom_domain_note":"store-domain.helper_text"),E=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",J=this.__renderLoader(1),M=this.__renderLoader(2),T=this.__renderLoader(3),P=this.__renderLoader(4),D=this.__renderLoader(5),L=this.__renderLoader(6),W=this.__renderLoader(7),A=this.__renderLoader(8),B=this.__renderLoader(9),G=Object.entries(null!==(u=null===(a=null==M?void 0:M.data)||void 0===a?void 0:a.values)&&void 0!==u?u:{}),I=null==P?void 0:P.data,z=null==D?void 0:D.data,F=null==L?void 0:L.data,H=null!==(p=null===(_=null==W?void 0:W.data)||void 0===_?void 0:_.values.timezone)&&void 0!==p?p:[],K=Object.values(null!==(m=null===(h=null==A?void 0:A.data)||void 0===h?void 0:h.values)&&void 0!==m?m:{}),Q=Object.values(null!==(g=null===(f=null==B?void 0:B.data)||void 0===f?void 0:f.values)&&void 0!==g?g:{}),X=Object.entries(null!==(x=null===(y=null==J?void 0:J.data)||void 0===y?void 0:y.values)&&void 0!==x?x:{}),Y=Object.entries(null!==(v=null===(b=null==T?void 0:T.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),Z=Object.entries(null!==($=null==z?void 0:z.values)&&void 0!==$?$:{}),ee=Object.entries(null!==(V=null==F?void 0:F.values)&&void 0!==V?V:{}),te=X.map((e=>({label:e[1].description,value:e[0]}))),oe=G.map((([e,t])=>({label:t,value:e}))),ie=Y.map((([e,t])=>({label:t,value:e}))),re=Z.map((([e,t])=>({value:e,label:t}))),se=ee.map((([e,t])=>({value:e,label:t}))),ne=H.map((e=>({label:e.description,value:e.timezone}))),ae=K.map((e=>({label:e.default,value:e.cc2}))),le=Q.map((e=>({label:e.default,value:e.code})));let ce;try{const e=new URL(null!==(k=this.regions)&&void 0!==k?k:""),t=this.form.country;t&&e.searchParams.set("country_code",t),ce=e.toString()}catch(e){ce=void 0}return n(l||(l=q` ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div class="grid gap-m grid-cols-1 sm-grid-cols-2"> <foxy-internal-text-control infer="store-name"></foxy-internal-text-control> <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="store-url"></foxy-internal-text-control> <foxy-internal-editable-list-control infer="store-email" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-select-control infer="timezone" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="version" item-value-path="_links.self.href" infer="store-version-uri" first="${0}" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="from-email" class="sm-col-span-2" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-checkbox-group-control infer="bcc-on-receipt-email" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="use-email-dns" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-smtp-config" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control> <foxy-internal-select-control infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-checkbox-group-control infer="features-multiship" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="require-signed-shipping-rates" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="locale-code" .options="${0}"> </foxy-internal-select-control> ${0} ${0} <foxy-internal-text-control class="sm-col-span-2" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-frequency-control class="sm-col-span-2" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-checkbox-group-control infer="products-require-expires-property" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-cart-validation" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="checkout-type" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-password-control infer="unified-order-entry-password"> </foxy-internal-password-control> <foxy-internal-text-control infer="single-sign-on-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webhook-url" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} ${0} </div> ${0} `),J.render(this.customerPasswordHashTypes),M.render(this.shippingAddressTypes),T.render(this.checkoutTypes),P.render(this.form.store_version_uri),D.render(this.localeCodes),W.render(this.timezones),A.render(this.countries),L.render(this.languages),B.render(ce),R,E,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,ne,r(null!==(j=this.storeVersions)&&void 0!==j?j:void 0),I,null!==(w=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==w?w:this.t("from-email.placeholder"),this.__getBccOnReceiptEmailValue,this.__setBccOnReceiptEmailValue,this.__singleCheckboxGroupOptions,this.__getUseEmailDnsValue,this.__setUseEmailDnsValue,this.__singleCheckboxGroupOptions,O?this.__renderWarning("use_email_dns_helper_text",{href:"https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc",caption:"How Emails Are Sent (SPF, DKIM, DMARC, etc.)"}):"",this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.__singleCheckboxGroupOptions,this.form.smtp_config&&!this.hiddenSelector.matches("smtp-config",!0)?this.__renderSmtpConfig():"",ae,le,oe,this.__getFeaturesMultishipValue,this.__setFeaturesMultishipValue,this.__singleCheckboxGroupOptions,this.__getRequireSignedShippingRatesValue,this.__setRequireSignedShippingRatesValue,this.__singleCheckboxGroupOptions,C?this.__renderWarning("require_signed_shipping_rates_helper_text"):"",se,re,this.hiddenSelector.matches("currency-style",!0)?"":this.__renderCurrencyStyleSelector(),this.hiddenSelector.matches("custom-display-id-config",!0)?"":this.__renderCustomIDSettings(),this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__getProductsRequireExpiresPropertyValue,this.__setProductsRequireExpiresPropertyValue,this.__singleCheckboxGroupOptions,U?this.__renderWarning("products_require_expires_property_helper_text"):"",this.__getUseCartValidationValue,this.__setUseCartValidationValue,this.__singleCheckboxGroupOptions,N?this.__renderWarning("use_cart_validation_helper_text",{href:"https://wiki.foxycart.com/v/2.0/hmac_validation",caption:"HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms"}):"",ie,te,(e=>{var t;const o=X.find((([t])=>t===e));this.edit({customer_password_hash_type:e,customer_password_hash_config:null!==(t=null==o?void 0:o[1].config)&&void 0!==t?t:""})}),"number"==typeof this.form.customer_password_hash_config?n(c||(c=q` <foxy-internal-number-control infer="customer-password-hash-config"> </foxy-internal-number-control> `)):n(d||(d=q` <foxy-internal-text-control infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.__getSingleSignOnUrlValue,this.__setSingleSignOnUrlValue,this.__getWebhookUrlValue,this.__setWebhookUrlValue,this.__renderWebhookKey(),this.data&&!this.hiddenSelector.matches("is-maintenance-mode",!0)?this.__renderMaintenanceModeSwitch():"",super.renderBody())}__renderWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const i=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:i,xml_datafeed:i,api_legacy:i,sso:i}}return Object.keys(o).map((e=>n(u||(u=q` <foxy-internal-password-control infer="webhook-key-${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),e.replace("_","-"),(()=>o[e]),(t=>{o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}))))}__renderMaintenanceModeSwitch(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.is_maintenance_mode),o=(t?"disable":"enable")+"_maintenance_mode",i=`maintenance_mode_${t?"on":"off"}_explainer`;return n(_||(_=q` <div data-testid="is-maintenance-mode" class="${0}"> <foxy-i18n infer="" class="block mb-s" key="${0}"></foxy-i18n> <vaadin-button theme="tertiary small ${0}" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-button> </div> `),s({"rounded leading-s text-s sm-col-span-2":!0,"text-tertiary":!t,"text-error":t}),i,t?"contrast":"",this.disabledSelector.matches("is-maintenance-mode",!0),(()=>{this.edit({is_maintenance_mode:!this.form.is_maintenance_mode}),this.submit()}),o)}__renderCurrencyStyleSelector(){const e={101:0,100:0,"001":1,"000":2,111:3,110:3,"011":4,"010":5},t=[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join(""),o=e[t],i=this.disabledSelector.matches("currency-style",!0),r=this.readonlySelector.matches("currency-style",!0);return n(p||(p=q` <div data-testid="currency-style"> ${0} <div class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"> <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"></foxy-i18n> <div class="grid grid-cols-3 bg-contrast-10 rounded" style="gap:1px;padding:1px"> ${0} </div> <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("currency-style:before"),["12.34","USD 12.34","$12.34","12","USD 12","$12"].map(((t,a)=>n(h||(h=q` <label style="--lumo-border-radius:calc(var(--lumo-border-radius-m) - 1px)" class="${0}"> <span class="font-medium font-tnum">${0}</span> <input class="sr-only" value="${0}" type="radio" name="currency-style" ?checked="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </label> `),s({"relative z-0 px-s h-m flex items-center transition-colors":!0,"hover-cursor-pointer":!0,"focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50":!0,"bg-base text-body hover-bg-transparent":a!==o,"bg-primary text-primary-contrast":a===o,"rounded-tl":0===a,"rounded-tr":2===a,"rounded-bl":3===a,"rounded-br":5===a}),t,a,a===o,i,r,(()=>{const t=Object.entries(e).find((e=>e[1]===a))[0];this.edit({hide_currency_symbol:Boolean(Number(t[0])),hide_decimal_characters:Boolean(Number(t[1])),use_international_currency_symbol:Boolean(Number(t[2]))})})))),this.renderTemplateOrSlot("currency-style:after"))}__renderCustomIDSettings(){var e;const t={enabled:!1,start:"0",length:"0",prefix:"",suffix:"",transaction_journal_entries:{enabled:!1,transaction_separator:"",log_detail_request_types:{transaction_authcapture:{prefix:""},transaction_capture:{prefix:""},transaction_refund:{prefix:""},transaction_void:{prefix:""}}}};let o;try{o=JSON.parse(null!==(e=this.form.custom_display_id_config)&&void 0!==e?e:"")}catch(e){o=a(t)}const i=parseInt(o.start||"0"),r=parseInt(o.length||"0")-o.prefix.length-o.suffix.length,s=Math.min(i+Math.floor(Math.random()*Math.pow(10,r)),Math.pow(10,r)-1),l=`${o.prefix}${s.toString().padStart(r,"0")}${o.suffix}`,c=Math.floor(1e3*Math.random()),d=String(c).padStart(3,"0");return n(m||(m=q` <foxy-internal-checkbox-group-control infer="custom-display-id-config-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>o.enabled?["checked"]:[]),(e=>{o.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.enabled?n(f||(f=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-integer-control infer="custom-display-id-config-start" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="custom-display-id-config-length" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-text-control infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> <foxy-internal-checkbox-group-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>parseInt(o.start||"0")),(e=>{o.start=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>parseInt(o.length||"0")),(e=>{o.length=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.prefix),(e=>{o.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.suffix),(e=>{o.suffix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(g||(g=q` <table data-testid="custom-display-id-config-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-first-example"> </foxy-i18n> </td> <td> ${0}${0}${0} </td> </tr> <tr style="width:1%"> <td> <foxy-i18n infer="" key="custom-display-id-config-random-example"> </foxy-i18n> </td> <td>${0}</td> </tr> </tbody> </table> `),o.prefix,i.toString().padStart(r,"0"),o.suffix,l):"",(()=>o.transaction_journal_entries.enabled?["checked"]:[]),(e=>{o.transaction_journal_entries.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.transaction_journal_entries.enabled?n(y||(y=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-authcapture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-capture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-void-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> `),(()=>o.transaction_journal_entries.transaction_separator),(e=>{o.transaction_journal_entries.transaction_separator=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(x||(x=q` <table data-testid="custom-display-id-config-transaction-journal-entries-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> </tbody> </table> `),l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix,d):""):""):"")}__renderSmtpConfig(){return n(b||(b=q` <div class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"> ${0} </div> `),["host","port","username","password","security"].map((e=>{const t=()=>JSON.parse(this.form.smtp_config||"{}")[e],o=t=>{var o,i,r,s,n;const a=JSON.parse(this.form.smtp_config||"{}");this.edit({smtp_config:JSON.stringify({username:null!==(o=a.username)&&void 0!==o?o:"",password:null!==(i=a.password)&&void 0!==i?i:"",security:null!==(r=a.security)&&void 0!==r?r:"",host:null!==(s=a.host)&&void 0!==s?s:"",port:null!==(n=a.port)&&void 0!==n?n:"",[e]:t})})},i=`smtp-config-${e}`;return"password"===e?n(v||(v=q` <foxy-internal-password-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),i,t,o):"port"===e?n($||($=q` <foxy-internal-integer-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> `),i,t,o):"security"===e?n(V||(V=q` <foxy-internal-radio-group-control infer="${0}" class="-mt-xs -mx-xs -mb-m col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),i,t,o,[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}]):n(k||(k=q` <foxy-internal-text-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),i,t,o)})))}__renderWarning(e,t){return n(j||(j=q` <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2"> <foxy-i18n infer="" key="${0}"></foxy-i18n> ${0} </div> `),e,t?n(S||(S=q` <a target="_blank" class="font-semibold hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary" href="${0}" lang="en"> ${0} <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon> </a> `),t.href,t.caption):"")}__renderLoader(e){var t;const o=`loader-${e}`;return{data:null===(t=this.renderRoot.querySelector(`#${o}`))||void 0===t?void 0:t.data,render:e=>n(w||(w=q` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),r(null!=e?e:void 0),o,(()=>this.requestUpdate()))}}}customElements.define("foxy-store-form",C);export{C as StoreForm};
1
+ import"./shared-bc814810.js";import"./shared-2add595d.js";import"./shared-c95c17e6.js";import"./shared-71f2ef1f.js";import"./shared-a37abe4c.js";import"./shared-af226a9a.js";import"./shared-4979dca4.js";import"./shared-988ec916.js";import"./shared-d518bd55.js";import"./shared-cba08e1c.js";import"./shared-80fc2b6a.js";import{I as e}from"./shared-6581241a.js";import"./foxy-nucleon-element.js";import"./shared-0821cfdc.js";import{_ as t}from"./shared-a8ced8bf.js";import{R as o,a as i}from"./shared-2cc638ad.js";import{i as r}from"./shared-d3bf9ac0.js";import{c as s}from"./shared-4e709717.js";import{h as n}from"./shared-7f33a83a.js";import{c as a}from"./shared-63139d9e.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-88c4cfec.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-62c088b7.js";import"./shared-39c10b22.js";import"./shared-9bdacf65.js";import"./shared-0479553e.js";import"./shared-43bcce74.js";import"./shared-76b3d76a.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-d519a301.js";import"./shared-f3b35364.js";import"./shared-11c2efc8.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-83596b46.js";import"./shared-8dd0af4d.js";import"./shared-62a54a6c.js";import"./foxy-spinner.js";import"./shared-2092d86f.js";import"./shared-839dd3a8.js";let l,c,d,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w,q=e=>e;const O=o(i(e,"store-form"));class C extends O{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.templates={},this.__singleCheckboxGroupOptions=[{label:"option_checked",value:"checked"}],this.__appSessionTimeOptions=[{value:"s",label:"second"},{value:"m",label:"minute"},{value:"h",label:"hour"},{value:"d",label:"day"}],this.__getStoreEmailValue=()=>{var e;return(null!==(e=this.form.store_email)&&void 0!==e?e:"").split(",").map((e=>({value:e.trim()}))).filter((({value:e})=>e.length>0))},this.__setStoreEmailValue=e=>{this.edit({store_email:e.map((e=>e.value)).join(",")})},this.__getBccOnReceiptEmailValue=()=>this.form.bcc_on_receipt_email?["checked"]:[],this.__setBccOnReceiptEmailValue=e=>{this.edit({bcc_on_receipt_email:e.includes("checked")})},this.__getUseEmailDnsValue=()=>this.form.use_email_dns?["checked"]:[],this.__setUseEmailDnsValue=e=>{this.edit({use_email_dns:e.includes("checked")})},this.__getUseSmtpConfigValue=()=>this.form.smtp_config?["checked"]:[],this.__setUseSmtpConfigValue=e=>{e.includes("checked")?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getFeaturesMultishipValue=()=>this.form.features_multiship?["checked"]:[],this.__setFeaturesMultishipValue=e=>{this.edit({features_multiship:e.includes("checked")})},this.__getRequireSignedShippingRatesValue=()=>this.form.require_signed_shipping_rates?["checked"]:[],this.__setRequireSignedShippingRatesValue=e=>{this.edit({require_signed_shipping_rates:e.includes("checked")})},this.__getAppSessionTimeValue=()=>{const e=this.form.app_session_time||43200;return e%86400==0?e/86400+"d":e%3600==0?e/3600+"h":e%60==0?e/60+"m":`${e}s`},this.__setAppSessionTimeValue=e=>{const t=e[e.length-1],o=parseInt(e.substring(0,e.length-1));this.edit({app_session_time:{d:86400,h:3600,m:60,s:1}[t]*o})},this.__getProductsRequireExpiresPropertyValue=()=>this.form.products_require_expires_property?["checked"]:[],this.__setProductsRequireExpiresPropertyValue=e=>{this.edit({products_require_expires_property:e.includes("checked")})},this.__getUseCartValidationValue=()=>this.form.use_cart_validation?["checked"]:[],this.__setUseCartValidationValue=e=>{this.edit({use_cart_validation:e.includes("checked")})},this.__getSingleSignOnUrlValue=()=>{var e;return this.form.use_single_sign_on&&null!==(e=this.form.single_sign_on_url)&&void 0!==e?e:""},this.__setSingleSignOnUrlValue=e=>{this.edit({use_single_sign_on:!!e,single_sign_on_url:e})},this.__getWebhookUrlValue=()=>{var e;return this.form.use_webhook&&null!==(e=this.form.webhook_url)&&void 0!==e?e:""},this.__setWebhookUrlValue=e=>{this.edit({use_webhook:!!e,webhook_url:e})},this.__setStoreDomainValue=e=>{if(e.endsWith(".foxycart.com")){const t=e.substring(0,e.length-13);this.edit({store_domain:t,use_remote_domain:t.includes(".")})}else this.edit({store_domain:e,use_remote_domain:e.includes(".")})}}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},storeVersions:{attribute:"store-versions"},checkoutTypes:{attribute:"checkout-types"},localeCodes:{attribute:"locale-codes"},languages:{},timezones:{},countries:{},regions:{}})}static get v8n(){return[({store_name:e})=>!!e||"store-name:v8n_required",({store_name:e})=>e&&e.length<=50||"store-name:v8n_too_long",({store_domain:e})=>!!e||"store-domain:v8n_required",({store_domain:e})=>e&&e.length<=50||"store-domain:v8n_too_long",({store_url:e})=>!!e||"store-url:v8n_required",({store_url:e})=>e&&e.length<=300||"store-url:v8n_too_long",({receipt_continue_url:e})=>!e||e.length<=300||"receipt-continue-url:v8n_too_long",({store_email:e})=>!!e||"store-email:v8n_required",({store_email:e})=>e&&e.length<=300||"store-email:v8n_too_long",({from_email:e})=>!e||e.length<=100||"from-email:v8n_too_long",({smtp_config:e})=>!e||e.length<=1e3||"use-smtp-config:v8n_too_long",({postal_code:e})=>!!e||"postal-code:v8n_required",({postal_code:e})=>e&&e.length<=50||"postal-code:v8n_too_long",({region:e})=>!!e||"region:v8n_required",({region:e})=>e&&e.length<=100||"region:v8n_too_long",({country:e})=>!!e||"country:v8n_required",({logo_url:e})=>!e||e.length<=100||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!!e||"webhook-url:v8n_required",({webhook_url:e,use_webhook:t})=>!t||!e||e.length<=300||"webhook-url:v8n_too_long",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!!e||"webhook-key:v8n_required",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!e||e.length<=200||"webhook-key:v8n_too_long",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!!e||"single-sign-on-url:v8n_required",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!e||e.length<=300||"single-sign-on-url:v8n_too_long",({customer_password_hash_config:e})=>!e||String(e).length<=100||"customer-password-hash-config:v8n_too_long",({unified_order_entry_password:e})=>!e||String(e).length<=100||"unified-order-entry-password:v8n_too_long",({custom_display_id_config:e})=>!e||String(e).length<=100||"custom-display-id-config-enabled:v8n_too_long"]}renderBody(){var e,t,o,i,s,a,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w;const O=this.form.use_email_dns&&!(null===(e=this.data)||void 0===e?void 0:e.use_email_dns)&&!this.hiddenSelector.matches("use-email-dns",!0),C=this.form.require_signed_shipping_rates&&!(null===(t=this.data)||void 0===t?void 0:t.require_signed_shipping_rates)&&!this.hiddenSelector.matches("require-signed-shipping-rates",!0),U=this.form.products_require_expires_property&&!(null===(o=this.data)||void 0===o?void 0:o.products_require_expires_property)&&!this.hiddenSelector.matches("products-require-expires-property",!0),N=this.form.use_cart_validation&&!(null===(i=this.data)||void 0===i?void 0:i.use_cart_validation)&&!this.hiddenSelector.matches("use-cart-validation",!0),R=this.t(this.form.use_remote_domain&&!(null===(s=this.data)||void 0===s?void 0:s.use_remote_domain)?"store-domain.custom_domain_note":"store-domain.helper_text"),E=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",J=this.__renderLoader(1),M=this.__renderLoader(2),T=this.__renderLoader(3),P=this.__renderLoader(4),D=this.__renderLoader(5),L=this.__renderLoader(6),W=this.__renderLoader(7),A=this.__renderLoader(8),B=this.__renderLoader(9),G=Object.entries(null!==(u=null===(a=null==M?void 0:M.data)||void 0===a?void 0:a.values)&&void 0!==u?u:{}),I=null==P?void 0:P.data,z=null==D?void 0:D.data,F=null==L?void 0:L.data,H=null!==(p=null===(_=null==W?void 0:W.data)||void 0===_?void 0:_.values.timezone)&&void 0!==p?p:[],K=Object.values(null!==(m=null===(h=null==A?void 0:A.data)||void 0===h?void 0:h.values)&&void 0!==m?m:{}),Q=Object.values(null!==(g=null===(f=null==B?void 0:B.data)||void 0===f?void 0:f.values)&&void 0!==g?g:{}),X=Object.entries(null!==(x=null===(y=null==J?void 0:J.data)||void 0===y?void 0:y.values)&&void 0!==x?x:{}),Y=Object.entries(null!==(v=null===(b=null==T?void 0:T.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),Z=Object.entries(null!==($=null==z?void 0:z.values)&&void 0!==$?$:{}),ee=Object.entries(null!==(V=null==F?void 0:F.values)&&void 0!==V?V:{}),te=X.map((e=>({label:e[1].description,value:e[0]}))),oe=G.map((([e,t])=>({label:t,value:e}))),ie=Y.map((([e,t])=>({label:t,value:e}))),re=Z.map((([e,t])=>({value:e,label:t}))),se=ee.map((([e,t])=>({value:e,label:t}))),ne=H.map((e=>({label:e.description,value:e.timezone}))),ae=K.map((e=>({label:e.default,value:e.cc2}))),le=Q.map((e=>({label:e.default,value:e.code})));let ce;try{const e=new URL(null!==(k=this.regions)&&void 0!==k?k:""),t=this.form.country;t&&e.searchParams.set("country_code",t),ce=e.toString()}catch(e){ce=void 0}return n(l||(l=q` ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div class="grid gap-m grid-cols-1 sm-grid-cols-2"> <foxy-internal-text-control infer="store-name"></foxy-internal-text-control> <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="store-url"></foxy-internal-text-control> <foxy-internal-editable-list-control infer="store-email" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-select-control infer="timezone" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="version" item-value-path="_links.self.href" infer="store-version-uri" first="${0}" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="from-email" class="sm-col-span-2" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-checkbox-group-control infer="bcc-on-receipt-email" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="use-email-dns" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-smtp-config" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control> <foxy-internal-select-control infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-checkbox-group-control infer="features-multiship" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="require-signed-shipping-rates" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="locale-code" .options="${0}"> </foxy-internal-select-control> ${0} ${0} <foxy-internal-text-control class="sm-col-span-2" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-frequency-control class="sm-col-span-2" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-checkbox-group-control infer="products-require-expires-property" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-cart-validation" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="checkout-type" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-password-control infer="unified-order-entry-password"> </foxy-internal-password-control> <foxy-internal-text-control infer="single-sign-on-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webhook-url" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} ${0} </div> ${0} `),J.render(this.customerPasswordHashTypes),M.render(this.shippingAddressTypes),T.render(this.checkoutTypes),P.render(this.form.store_version_uri),D.render(this.localeCodes),W.render(this.timezones),A.render(this.countries),L.render(this.languages),B.render(ce),R,E,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,ne,r(null!==(j=this.storeVersions)&&void 0!==j?j:void 0),I,null!==(w=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==w?w:this.t("from-email.placeholder"),this.__getBccOnReceiptEmailValue,this.__setBccOnReceiptEmailValue,this.__singleCheckboxGroupOptions,this.__getUseEmailDnsValue,this.__setUseEmailDnsValue,this.__singleCheckboxGroupOptions,O?this.__renderWarning("use_email_dns_helper_text",{href:"https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc",caption:"How Emails Are Sent (SPF, DKIM, DMARC, etc.)"}):"",this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.__singleCheckboxGroupOptions,this.form.smtp_config&&!this.hiddenSelector.matches("smtp-config",!0)?this.__renderSmtpConfig():"",ae,le,oe,this.__getFeaturesMultishipValue,this.__setFeaturesMultishipValue,this.__singleCheckboxGroupOptions,this.__getRequireSignedShippingRatesValue,this.__setRequireSignedShippingRatesValue,this.__singleCheckboxGroupOptions,C?this.__renderWarning("require_signed_shipping_rates_helper_text"):"",se,re,this.hiddenSelector.matches("currency-style",!0)?"":this.__renderCurrencyStyleSelector(),this.hiddenSelector.matches("custom-display-id-config",!0)?"":this.__renderCustomIDSettings(),this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__getProductsRequireExpiresPropertyValue,this.__setProductsRequireExpiresPropertyValue,this.__singleCheckboxGroupOptions,U?this.__renderWarning("products_require_expires_property_helper_text"):"",this.__getUseCartValidationValue,this.__setUseCartValidationValue,this.__singleCheckboxGroupOptions,N?this.__renderWarning("use_cart_validation_helper_text",{href:"https://wiki.foxycart.com/v/2.0/hmac_validation",caption:"HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms"}):"",ie,te,(e=>{var t;const o=X.find((([t])=>t===e));this.edit({customer_password_hash_type:e,customer_password_hash_config:null!==(t=null==o?void 0:o[1].config)&&void 0!==t?t:""})}),"number"==typeof this.form.customer_password_hash_config?n(c||(c=q` <foxy-internal-number-control infer="customer-password-hash-config"> </foxy-internal-number-control> `)):n(d||(d=q` <foxy-internal-text-control infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.__getSingleSignOnUrlValue,this.__setSingleSignOnUrlValue,this.__getWebhookUrlValue,this.__setWebhookUrlValue,this.__renderWebhookKey(),this.data&&!this.hiddenSelector.matches("is-maintenance-mode",!0)?this.__renderMaintenanceModeSwitch():"",super.renderBody())}__renderWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const i=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:i,xml_datafeed:i,api_legacy:i,sso:i}}return Object.keys(o).map((e=>n(u||(u=q` <foxy-internal-password-control infer="webhook-key-${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),e.replace("_","-"),(()=>o[e]),(t=>{o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}))))}__renderMaintenanceModeSwitch(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.is_maintenance_mode),o=(t?"disable":"enable")+"_maintenance_mode",i=`maintenance_mode_${t?"on":"off"}_explainer`;return n(_||(_=q` <div data-testid="is-maintenance-mode" class="${0}"> <foxy-i18n infer="" class="block mb-s" key="${0}"></foxy-i18n> <vaadin-button theme="tertiary small ${0}" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-button> </div> `),s({"rounded leading-s text-s sm-col-span-2":!0,"text-tertiary":!t,"text-error":t}),i,t?"contrast":"",this.disabledSelector.matches("is-maintenance-mode",!0),(()=>{this.edit({is_maintenance_mode:!this.form.is_maintenance_mode}),this.submit()}),o)}__renderCurrencyStyleSelector(){const e={101:0,100:0,"001":1,"000":2,111:3,110:3,"011":4,"010":5},t=[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join(""),o=e[t],i=this.disabledSelector.matches("currency-style",!0),r=this.readonlySelector.matches("currency-style",!0);return n(p||(p=q` <div data-testid="currency-style" class="sm-col-span-2"> ${0} <div class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"> <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"></foxy-i18n> <div class="grid grid-cols-3 bg-contrast-10 rounded" style="gap:1px;padding:1px"> ${0} </div> <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("currency-style:before"),["12.34","USD 12.34","$12.34","12","USD 12","$12"].map(((t,a)=>n(h||(h=q` <label style="--lumo-border-radius:calc(var(--lumo-border-radius-m) - 1px)" class="${0}"> <span class="font-medium font-tnum">${0}</span> <input class="sr-only" value="${0}" type="radio" name="currency-style" ?checked="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </label> `),s({"relative z-0 px-s h-m flex items-center transition-colors":!0,"hover-cursor-pointer":!0,"focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50":!0,"bg-base text-body hover-bg-transparent":a!==o,"bg-primary text-primary-contrast":a===o,"rounded-tl":0===a,"rounded-tr":2===a,"rounded-bl":3===a,"rounded-br":5===a}),t,a,a===o,i,r,(()=>{const t=Object.entries(e).find((e=>e[1]===a))[0];this.edit({hide_currency_symbol:Boolean(Number(t[0])),hide_decimal_characters:Boolean(Number(t[1])),use_international_currency_symbol:Boolean(Number(t[2]))})})))),this.renderTemplateOrSlot("currency-style:after"))}__renderCustomIDSettings(){var e;const t={enabled:!1,start:"0",length:"0",prefix:"",suffix:"",transaction_journal_entries:{enabled:!1,transaction_separator:"",log_detail_request_types:{transaction_authcapture:{prefix:""},transaction_capture:{prefix:""},transaction_refund:{prefix:""},transaction_void:{prefix:""}}}};let o;try{o=JSON.parse(null!==(e=this.form.custom_display_id_config)&&void 0!==e?e:"")}catch(e){o=a(t)}const i=parseInt(o.start||"0"),r=parseInt(o.length||"0")-o.prefix.length-o.suffix.length,s=Math.min(i+Math.floor(Math.random()*Math.pow(10,r)),Math.pow(10,r)-1),l=`${o.prefix}${s.toString().padStart(r,"0")}${o.suffix}`,c=Math.floor(1e3*Math.random()),d=String(c).padStart(3,"0");return n(m||(m=q` <foxy-internal-checkbox-group-control infer="custom-display-id-config-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>o.enabled?["checked"]:[]),(e=>{o.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.enabled?n(f||(f=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-integer-control infer="custom-display-id-config-start" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="custom-display-id-config-length" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-text-control infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> <foxy-internal-checkbox-group-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>parseInt(o.start||"0")),(e=>{o.start=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>parseInt(o.length||"0")),(e=>{o.length=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.prefix),(e=>{o.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.suffix),(e=>{o.suffix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(g||(g=q` <table data-testid="custom-display-id-config-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-first-example"> </foxy-i18n> </td> <td> ${0}${0}${0} </td> </tr> <tr style="width:1%"> <td> <foxy-i18n infer="" key="custom-display-id-config-random-example"> </foxy-i18n> </td> <td>${0}</td> </tr> </tbody> </table> `),o.prefix,i.toString().padStart(r,"0"),o.suffix,l):"",(()=>o.transaction_journal_entries.enabled?["checked"]:[]),(e=>{o.transaction_journal_entries.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.transaction_journal_entries.enabled?n(y||(y=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-authcapture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-capture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-void-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> `),(()=>o.transaction_journal_entries.transaction_separator),(e=>{o.transaction_journal_entries.transaction_separator=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(x||(x=q` <table data-testid="custom-display-id-config-transaction-journal-entries-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> </tbody> </table> `),l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix,d):""):""):"")}__renderSmtpConfig(){return n(b||(b=q` <div class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"> ${0} </div> `),["host","port","username","password","security"].map((e=>{const t=()=>JSON.parse(this.form.smtp_config||"{}")[e],o=t=>{var o,i,r,s,n;const a=JSON.parse(this.form.smtp_config||"{}");this.edit({smtp_config:JSON.stringify({username:null!==(o=a.username)&&void 0!==o?o:"",password:null!==(i=a.password)&&void 0!==i?i:"",security:null!==(r=a.security)&&void 0!==r?r:"",host:null!==(s=a.host)&&void 0!==s?s:"",port:null!==(n=a.port)&&void 0!==n?n:"",[e]:t})})},i=`smtp-config-${e}`;return"password"===e?n(v||(v=q` <foxy-internal-password-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),i,t,o):"port"===e?n($||($=q` <foxy-internal-integer-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> `),i,t,o):"security"===e?n(V||(V=q` <foxy-internal-radio-group-control infer="${0}" class="-mt-xs -mx-xs -mb-m col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),i,t,o,[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}]):n(k||(k=q` <foxy-internal-text-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),i,t,o)})))}__renderWarning(e,t){return n(j||(j=q` <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2"> <foxy-i18n infer="" key="${0}"></foxy-i18n> ${0} </div> `),e,t?n(S||(S=q` <a target="_blank" class="font-semibold hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary" href="${0}" lang="en"> ${0} <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon> </a> `),t.href,t.caption):"")}__renderLoader(e){var t;const o=`loader-${e}`;return{data:null===(t=this.renderRoot.querySelector(`#${o}`))||void 0===t?void 0:t.data,render:e=>n(w||(w=q` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),r(null!=e?e:void 0),o,(()=>this.requestUpdate()))}}}customElements.define("foxy-store-form",C);export{C as StoreForm};
@@ -1 +1 @@
1
- import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{_ as t}from"./shared-a8ced8bf.js";import{h as s}from"./shared-7f33a83a.js";import{C as e}from"./shared-43bcce74.js";import{N as i}from"./shared-181f51bd.js";import{R as a,T as r,a as n}from"./shared-2cc638ad.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-d61b3e4f.js";import"./shared-0ce006b9.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-d3bf9ac0.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let l,c=t=>t;const m=e(a(r(n(i,"subscription-card"))));class f extends m{render(){var t,e,i,a,r;const n=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date);return s(l||(l=c` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-semibold origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 font-semibold leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body"> <foxy-i18n data-testid="price" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":n&&!d,"text-body bg-contrast-5":!n&&!d,"text-error bg-error-10":d}),d?"error-outline":n?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!n&&!d,"text-success":n&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(r=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(!this.in({idle:"snapshot"}))return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,s)=>t.price-s.price))[0],count:t.length}}__getStatusOptions(){var t,s;return this.in({idle:"snapshot"})?{date:null!==(s=null!==(t=this.data.first_failed_transaction_date)&&void 0!==t?t:this.data.end_date)&&void 0!==s?s:this.data.next_transaction_date}:{}}__getPriceOptions(){if(!this.in({idle:"snapshot"}))return{};const s=this.data._embedded["fx:last_transaction"],e=`${s.total_order} ${s.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:e})}__getStatusKey(){var t,s,e;if(null===(t=this.data)||void 0===t?void 0:t.first_failed_transaction_date)return"subscription_failed";if(null===(s=this.data)||void 0===s?void 0:s.end_date){return new Date(this.data.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return"subscription_"+((null===(e=this.data)||void 0===e?void 0:e.is_active)?"active":"inactive")}}customElements.define("foxy-subscription-card",f);export{f as SubscriptionCard};
1
+ import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{_ as t}from"./shared-a8ced8bf.js";import{h as s}from"./shared-7f33a83a.js";import{C as e}from"./shared-43bcce74.js";import{N as i}from"./shared-181f51bd.js";import{R as a,T as n,a as r}from"./shared-2cc638ad.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-d61b3e4f.js";import"./shared-0ce006b9.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-d3bf9ac0.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let l,c=t=>t;const m=e(a(n(r(i,"subscription-card"))));class f extends m{render(){var t,e,i,a,n;const r=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date);return s(l||(l=c` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-semibold origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 font-semibold leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body"> <foxy-i18n data-testid="price" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":r&&!d,"text-body bg-contrast-5":!r&&!d,"text-error bg-error-10":d}),d?"error-outline":r?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!r&&!d,"text-success":r&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(n=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==n?n:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(!this.in({idle:"snapshot"}))return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,s)=>t.price-s.price))[0],count_minus_one:t.length-1,count:t.length}}__getStatusOptions(){var t,s;return this.in({idle:"snapshot"})?{date:null!==(s=null!==(t=this.data.first_failed_transaction_date)&&void 0!==t?t:this.data.end_date)&&void 0!==s?s:this.data.next_transaction_date}:{}}__getPriceOptions(){if(!this.in({idle:"snapshot"}))return{};const s=this.data._embedded["fx:last_transaction"],e=`${s.total_order} ${s.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:e})}__getStatusKey(){var t,s,e;if(null===(t=this.data)||void 0===t?void 0:t.first_failed_transaction_date)return"subscription_failed";if(null===(s=this.data)||void 0===s?void 0:s.end_date){return new Date(this.data.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return"subscription_"+((null===(e=this.data)||void 0===e?void 0:e.is_active)?"active":"inactive")}}customElements.define("foxy-subscription-card",f);export{f as SubscriptionCard};
@@ -1 +1 @@
1
- import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{S as s}from"./shared-4f9d2417.js";export{S as SubscriptionsTable}from"./shared-4f9d2417.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2cc638ad.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-f80f402a.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./foxy-nucleon-element.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-4e709717.js";import"./shared-d61b3e4f.js";customElements.define("foxy-subscriptions-table",s);
1
+ import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{S as s}from"./shared-4393ad93.js";export{S as SubscriptionsTable}from"./shared-4393ad93.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2cc638ad.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-f80f402a.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./foxy-nucleon-element.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-4e709717.js";import"./shared-d61b3e4f.js";customElements.define("foxy-subscriptions-table",s);
@@ -1 +1 @@
1
- import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{h as t}from"./shared-7f33a83a.js";import{C as e}from"./shared-43bcce74.js";import{N as s}from"./shared-181f51bd.js";import{T as i,a as r}from"./shared-2cc638ad.js";import{c as a}from"./shared-4e709717.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-a8ced8bf.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-d3bf9ac0.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let o,n,d,c,l,m,h,p,u,f,v,y,_=t=>t;const $=i(e(r(s,"transaction-card")));class x extends ${constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(o||(o=_` <div aria-busy="${0}" aria-live="polite" class="relative leading-s font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),a({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(n||(n=_` <div class="flex items-center justify-between"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),a({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){const t=await super._sendGet(),e=await super._fetch(t._links["fx:store"].href);return this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",t}__renderTotal(){const e=this.data;let s;if(e){const i=`${e.total_order} ${e.currency_code}`,r=this.__currencyDisplay;s=t(d||(d=_` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:i,currencyDisplay:r}),this.lang,this.ns)}else s=t(c||(c=_`&ZeroWidthSpace;`));return t(l||(l=_` <div data-testid="total"> ${0} <div class="font-semibold truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),s,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const a=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(m||(m=_` <div data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[a])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${a}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[a])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count:i.length};r=t(h||(h=_` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(p||(p=_`&ZeroWidthSpace;`));return t(u||(u=_` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(f||(f=_`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(v||(v=_`&ZeroWidthSpace;`));return t(y||(y=_` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",x);export{x as TransactionCard};
1
+ import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{h as t}from"./shared-7f33a83a.js";import{C as e}from"./shared-43bcce74.js";import{N as s}from"./shared-181f51bd.js";import{T as i,a as r}from"./shared-2cc638ad.js";import{c as a}from"./shared-4e709717.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-a8ced8bf.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-d3bf9ac0.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let n,o,d,c,l,m,h,p,u,f,v,y,_=t=>t;const $=i(e(r(s,"transaction-card")));class x extends ${constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(n||(n=_` <div aria-busy="${0}" aria-live="polite" class="relative leading-s font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),a({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(o||(o=_` <div class="flex items-center justify-between"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),a({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){const t=await super._sendGet(),e=await super._fetch(t._links["fx:store"].href);return this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",t}__renderTotal(){const e=this.data;let s;if(e){const i=`${e.total_order} ${e.currency_code}`,r=this.__currencyDisplay;s=t(d||(d=_` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:i,currencyDisplay:r}),this.lang,this.ns)}else s=t(c||(c=_`&ZeroWidthSpace;`));return t(l||(l=_` <div data-testid="total"> ${0} <div class="font-semibold truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),s,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const a=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(m||(m=_` <div data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[a])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${a}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[a])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count_minus_one:i.length-1,count:i.length};r=t(h||(h=_` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(p||(p=_`&ZeroWidthSpace;`));return t(u||(u=_` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(f||(f=_`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(v||(v=_`&ZeroWidthSpace;`));return t(y||(y=_` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",x);export{x as TransactionCard};