@foxy.io/elements 1.37.0-beta.3 → 1.37.0-beta.4

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.
@@ -1 +1 @@
1
- import"./shared-2edce408.js";import"./shared-e1b97b27.js";import"./shared-6aa8f7ee.js";import"./shared-8df437b0.js";import{b as r,I as o}from"./shared-edb68eb7.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import"./shared-bb43f0ad.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as s}from"./shared-53e42a77.js";import{h as a,s as i}from"./shared-ba5c42c7.js";import{a as n}from"./shared-fefaece7.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00b50480.js";import"./shared-00cd0e86.js";import"./shared-5cea7ef0.js";import"./shared-f0afd1ee.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-0564def4.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-b7889b37.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-bab2ea2c.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-1c6a1571.js";import"./shared-b15d45b1.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-31b98ac2.js";import"./foxy-custom-field-card.js";import"./shared-e4159eb9.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-641786b2.js";import"./foxy-payment-card.js";import"./shared-cf613436.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-7ab454fb.js";import"./shared-82614ac9.js";import"./shared-c5fa5c92.js";import"./shared-b293a928.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./shared-6042ee79.js";import"./foxy-item-form.js";import"./shared-79f84a95.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./shared-70bd1896.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends r{constructor(){super(...arguments),this.action=null}static get properties(){return t(t({},super.properties),{},{action:{}})}renderControl(){var r,o;const t=this.nucleon;let e;try{const s=new URL(null!==(o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r._links["fx:sub_token_url"].href)&&void 0!==o?o:"");"cancel"===this.action&&s.searchParams.set("sub_cancel","true"),e=s.toString()}catch(r){e=void 0}return a(d||(d=m` <a target="_blank" class="rounded font-medium text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="caption"> </foxy-i18n> </a> `),s(e))}});let c,f,l=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends r{renderControl(){var r,o;return a(c||(c=l` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),i(f||(f=l`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===o?void 0:o.error_message)}});let p,h,u=r=>r;const j=n(o,"admin-subscription-form");class y extends j{get hiddenSelector(){var r,o;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(o=this.data)||void 0===o?void 0:o.is_active)||t.unshift("view-action","cancel-action"),new e(t.join(" ").trim())}get headerSubtitleOptions(){var r;return{context:(null===(r=this.data)||void 0===r?void 0:r.is_active)?"active":"inactive"}}renderHeaderActions(r){return a(p||(p=u` <foxy-internal-admin-subscription-form-load-in-cart-action infer="view-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> <foxy-internal-admin-subscription-form-load-in-cart-action action="cancel" infer="cancel-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> `))}renderBody(){var r,o,t,e,i;let n;try{const t=new URL(null!==(o=null===(r=this.data)||void 0===r?void 0:r._links["fx:transactions"].href)&&void 0!==o?o:"");t.searchParams.set("zoom","items"),n=t.toString()}catch(r){n=void 0}return a(h||(h=u` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control format="iso-long" layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control format="iso-long" layout="summary-item" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control format="iso-long" layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),s(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),this.renderTemplateOrSlot(),s(null===(i=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===i?void 0:i["fx:attributes"].href),s(n),super.renderBody())}}customElements.define("foxy-admin-subscription-form",y);export{y as AdminSubscriptionForm};
1
+ import"./shared-2edce408.js";import"./shared-e1b97b27.js";import"./shared-6aa8f7ee.js";import"./shared-a42e4325.js";import{b as r,I as o}from"./shared-edb68eb7.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import"./shared-bb43f0ad.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as s}from"./shared-53e42a77.js";import{h as a,s as i}from"./shared-ba5c42c7.js";import{a as n}from"./shared-fefaece7.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00b50480.js";import"./shared-00cd0e86.js";import"./shared-5cea7ef0.js";import"./shared-f0afd1ee.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-0564def4.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-b7889b37.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-bab2ea2c.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-1c6a1571.js";import"./shared-b15d45b1.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-31b98ac2.js";import"./foxy-custom-field-card.js";import"./shared-e4159eb9.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-641786b2.js";import"./foxy-payment-card.js";import"./shared-cf613436.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-7ab454fb.js";import"./shared-82614ac9.js";import"./shared-c5fa5c92.js";import"./shared-b293a928.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./shared-6042ee79.js";import"./foxy-item-form.js";import"./shared-79f84a95.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./shared-70bd1896.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends r{constructor(){super(...arguments),this.action=null}static get properties(){return t(t({},super.properties),{},{action:{}})}renderControl(){var r,o;const t=this.nucleon;let e;try{const s=new URL(null!==(o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r._links["fx:sub_token_url"].href)&&void 0!==o?o:"");"cancel"===this.action&&s.searchParams.set("sub_cancel","true"),e=s.toString()}catch(r){e=void 0}return a(d||(d=m` <a target="_blank" class="rounded font-medium text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="caption"> </foxy-i18n> </a> `),s(e))}});let c,f,l=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends r{renderControl(){var r,o;return a(c||(c=l` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),i(f||(f=l`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===o?void 0:o.error_message)}});let p,h,u=r=>r;const j=n(o,"admin-subscription-form");class y extends j{get hiddenSelector(){var r,o;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(o=this.data)||void 0===o?void 0:o.is_active)||t.unshift("view-action","cancel-action"),new e(t.join(" ").trim())}get headerSubtitleOptions(){var r;return{context:(null===(r=this.data)||void 0===r?void 0:r.is_active)?"active":"inactive"}}renderHeaderActions(r){return a(p||(p=u` <foxy-internal-admin-subscription-form-load-in-cart-action infer="view-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> <foxy-internal-admin-subscription-form-load-in-cart-action action="cancel" infer="cancel-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> `))}renderBody(){var r,o,t,e,i;let n;try{const t=new URL(null!==(o=null===(r=this.data)||void 0===r?void 0:r._links["fx:transactions"].href)&&void 0!==o?o:"");t.searchParams.set("zoom","items"),n=t.toString()}catch(r){n=void 0}return a(h||(h=u` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),s(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),this.renderTemplateOrSlot(),s(null===(i=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===i?void 0:i["fx:attributes"].href),s(n),super.renderBody())}}customElements.define("foxy-admin-subscription-form",y);export{y as AdminSubscriptionForm};
@@ -1,4 +1,4 @@
1
- import"./shared-79f84a95.js";import"./shared-2edce408.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import"./shared-c5fa5c92.js";import"./shared-b293a928.js";import{b as e,a as t,I as r}from"./shared-edb68eb7.js";import"./foxy-applied-coupon-code-card.js";import"./foxy-applied-coupon-code-form.js";import"./foxy-custom-field-card.js";import"./foxy-custom-field-form.js";import"./foxy-template-set-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-bb43f0ad.js";import{_ as i,B as o}from"./shared-d1195c27.js";import{c as s}from"./shared-4e709717.js";import{h as n,c as a}from"./shared-ba5c42c7.js";import"./shared-f0afd1ee.js";import{R as l,a as d}from"./shared-fefaece7.js";import{i as c}from"./shared-53e42a77.js";import"./foxy-update-payment-method-form.js";import{U as u}from"./shared-cd96ff03.js";import{s as m}from"./shared-53e476fd.js";import"./shared-47962c3f.js";import{g as p}from"./shared-bab2ea2c.js";import{T as _}from"./shared-e4159eb9.js";import{T as f}from"./shared-8874ec69.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-256fe764.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-b7889b37.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5cea7ef0.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-4215bff2.js";import"./shared-651c44fa.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-0c61b5ce.js";import"./shared-31b98ac2.js";import"./shared-b15d45b1.js";import"./shared-1c6a1571.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";import"./shared-e1b97b27.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-6aa8f7ee.js";import"./shared-8df437b0.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-payment-card-embed.js";import"./shared-0d757c1c.js";import"./shared-9ca85d1e.js";import"./shared-c2efc54e.js";let h,y,v=e=>e;customElements.define("foxy-internal-cart-form-create-session-action",class extends e{constructor(){super(...arguments),this.__loader=null}static get properties(){return i(i({},super.properties),{},{__loader:{attribute:!1}})}renderControl(){var e,t;const r=null===(e=this.__loader)||void 0===e?void 0:e.state,i=null===(t=this.__loader)||void 0===t?void 0:t.result;return i?n(h||(h=v` <a target="_blank" class="rounded font-medium transition-colors text-body focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="state_idle"></foxy-i18n> </a> `),i):n(y||(y=v` <div class="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </div> `),s({"transition-colors font-medium rounded":!0,"text-tertiary":"fail"!==r,"text-error":"fail"===r}),"fail"===r?"state_fail":"state_busy")}updated(e){var t;super.updated(e);const r=this.nucleon,i=null==r?void 0:r.data,o=null!==(t=null==i?void 0:i._links["fx:create_session"].href)&&void 0!==t?t:null;this.__reloadSessionHref(o)}async __reloadSessionHref(e){var t;if((null===(t=this.__loader)||void 0===t?void 0:t.href)===e)return;const r=this.nucleon;if(r)if(e){const t={result:null,state:"busy",href:e},i=new r.constructor.API(this);this.__loader=t;try{const r=await i.fetch(e,{method:"POST"});if(!r.ok)throw new Error;t.result=(await r.json()).cart_link,t.state="idle"}catch(e){t.state="fail"}finally{this.requestUpdate()}}else this.__loader=null}});let g;const x=a(g||(g=(e=>e)`
1
+ import"./shared-79f84a95.js";import"./shared-2edce408.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import"./shared-c5fa5c92.js";import"./shared-b293a928.js";import{b as e,a as t,I as r}from"./shared-edb68eb7.js";import"./foxy-applied-coupon-code-card.js";import"./foxy-applied-coupon-code-form.js";import"./foxy-custom-field-card.js";import"./foxy-custom-field-form.js";import"./foxy-template-set-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-bb43f0ad.js";import{_ as i,B as o}from"./shared-d1195c27.js";import{c as s}from"./shared-4e709717.js";import{h as n,c as a}from"./shared-ba5c42c7.js";import"./shared-f0afd1ee.js";import{R as l,a as d}from"./shared-fefaece7.js";import{i as c}from"./shared-53e42a77.js";import"./foxy-update-payment-method-form.js";import{U as u}from"./shared-cd96ff03.js";import{s as m}from"./shared-53e476fd.js";import"./shared-47962c3f.js";import{g as p}from"./shared-bab2ea2c.js";import{T as _}from"./shared-e4159eb9.js";import{T as h}from"./shared-8874ec69.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-256fe764.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-b7889b37.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5cea7ef0.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-4215bff2.js";import"./shared-651c44fa.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-0c61b5ce.js";import"./shared-31b98ac2.js";import"./shared-b15d45b1.js";import"./shared-1c6a1571.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";import"./shared-e1b97b27.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-6aa8f7ee.js";import"./shared-a42e4325.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-payment-card-embed.js";import"./shared-0d757c1c.js";import"./shared-9ca85d1e.js";import"./shared-c2efc54e.js";let f,y,v=e=>e;customElements.define("foxy-internal-cart-form-create-session-action",class extends e{constructor(){super(...arguments),this.__loader=null}static get properties(){return i(i({},super.properties),{},{__loader:{attribute:!1}})}renderControl(){var e,t;const r=null===(e=this.__loader)||void 0===e?void 0:e.state,i=null===(t=this.__loader)||void 0===t?void 0:t.result;return i?n(f||(f=v` <a target="_blank" class="rounded font-medium transition-colors text-body focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="state_idle"></foxy-i18n> </a> `),i):n(y||(y=v` <div class="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </div> `),s({"transition-colors font-medium rounded":!0,"text-tertiary":"fail"!==r,"text-error":"fail"===r}),"fail"===r?"state_fail":"state_busy")}updated(e){var t;super.updated(e);const r=this.nucleon,i=null==r?void 0:r.data,o=null!==(t=null==i?void 0:i._links["fx:create_session"].href)&&void 0!==t?t:null;this.__reloadSessionHref(o)}async __reloadSessionHref(e){var t;if((null===(t=this.__loader)||void 0===t?void 0:t.href)===e)return;const r=this.nucleon;if(r)if(e){const t={result:null,state:"busy",href:e},i=new r.constructor.API(this);this.__loader=t;try{const r=await i.fetch(e,{method:"POST"});if(!r.ok)throw new Error;t.result=(await r.json()).cart_link,t.state="idle"}catch(e){t.state="fail"}finally{this.requestUpdate()}}else this.__loader=null}});let g;const x=a(g||(g=(e=>e)`
2
2
  #dialog{
3
3
  width:100dvw;
4
4
  max-height:calc(100dvh - var(--lumo-space-m));
@@ -54,4 +54,4 @@ import"./shared-79f84a95.js";import"./shared-2edce408.js";import"./shared-0564de
54
54
  }
55
55
  }
56
56
  }
57
- `));let b,$,j,k,w,P,U=e=>e;class S extends(l(t)){constructor(){super(...arguments),this.countries=null,this.customer=null,this.regions=null,this.type=null}static get properties(){return i(i({},super.properties),{},{countries:{},customer:{type:Object},regions:{},type:{}})}static get styles(){return[...super.styles,x]}get disabledSelector(){var e;const t=[super.disabledSelector.toString()];return(null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||t.unshift("address:state"),new o(t.join(" ").toString())}renderControl(){var e,t;const r=this.__regionOptions,i=null!==(e=this.type)&&void 0!==e?e:"billing",o=this.__mergedAddress;return n(b||(b=U` <div class="flex flex-col gap-m sm-flex-row items-start leading-xs"> <div class="flex-1"> <p class="text-m text-body">${0}</p> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> <dialog id="dialog" class="p-m bg-base shadow-xxl space-y-m"> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="label"></foxy-i18n> </h2> <foxy-internal-summary-control infer="name"> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="address"> ${0} ${0} ${0} <foxy-internal-select-control placeholder="${0}" property="${0}_country" layout="summary-item" infer="country" .options="${0}"> </foxy-internal-select-control> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="extra"> ${0} ${0} </foxy-internal-summary-control> <p class="text-xs text-secondary"> <foxy-i18n infer="" key="form_helper_text"></foxy-i18n> </p> <div class="flex justify-between gap-m"> <vaadin-button theme="error" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <foxy-i18n infer="" key="reset"></foxy-i18n> </vaadin-button> <vaadin-button theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="done"></foxy-i18n> </vaadin-button> </div> </dialog> <foxy-nucleon class="hidden" infer="" href="${0}" id="countriesLoader" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="regionsLoader" @update="${0}"> </foxy-nucleon> `),this.label,this.helperText,this.disabled||this.readonly,this._errorMessage,this.t("edit"),s({"text-left sm-text-right transition-colors transition-opacity":!0,"text-body cursor-pointer hover-opacity-80":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.disabled||this.readonly,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.showModal()}),this.__isAddressEmpty?n($||($=U`<foxy-i18n infer="" key="not_set"></foxy-i18n>`)):n(j||(j=U` <div> ${0} ${0} </div> <div>${0}</div> <div>${0}</div> <div> ${0} ${0} ${0} ${0} ${0} ${0} </div> `),this.__renderAddressPart(o.first_name),this.__renderAddressPart(o.last_name),this.__renderAddressPart(o.company),this.__renderAddressPart(o.phone),this.__renderAddressPart(o.address1),this.__renderAddressPart(o.address2),this.__renderAddressPart(o.city),this.__renderAddressPart(o.state),this.__renderAddressPart(o.postal_code),this.__renderAddressPart(o.country)),this.__renderTextField(o.first_name),this.__renderTextField(o.last_name),this.__renderTextField(o.address1),this.__renderTextField(o.address2),this.__renderTextField(o.city),c(this.__getPlaceholder(o.country)),i,this.__countryOptions,r.length>0?n(k||(k=U` <foxy-internal-select-control placeholder="${0}" property="${0}_state" layout="summary-item" infer="state" .options="${0}"> </foxy-internal-select-control> `),c(this.__getPlaceholder(o.state)),i,r):this.__renderTextField(o.state),this.__renderTextField(o.postal_code),this.__renderTextField(o.company),this.__renderTextField(o.phone),this.disabled,this.readonly,(()=>{var e;null===(e=this.nucleon)||void 0===e||e.edit({[`${i}_first_name`]:null,[`${i}_last_name`]:null,[`${i}_company`]:null,[`${i}_address1`]:null,[`${i}_address2`]:null,[`${i}_city`]:null,[`${i}_state`]:null,[`${i}_postal_code`]:null,[`${i}_country`]:null,[`${i}_phone`]:null})}),this.disabled,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.close()}),c(null!==(t=this.countries)&&void 0!==t?t:void 0),(()=>this.requestUpdate()),c(this.__regionsUrl),(()=>this.requestUpdate()))}__renderAddressPart(e){const t=this.__getDisplayText(e);return n(w||(w=U` <span class="${0}"> ${0} </span> `),s({"text-success bg-success-10":e.modified&&!this.disabled,"bg-contrast-5":e.modified&&this.disabled,"inline-block":!!t,"rounded-s":!0,hidden:!t}),t)}__renderTextField(e){var t;return n(P||(P=U` <foxy-internal-text-control placeholder="${0}" property="${0}_${0}" layout="summary-item" infer="${0}" @clear="${0}"> </foxy-internal-text-control> `),c(this.__getPlaceholder(e)),null!==(t=this.type)&&void 0!==t?t:"billing",e.field,e.field.replace(/_/g,"-").replace("1","-one").replace("2","-two"),(()=>{var t,r;return null===(t=this.nucleon)||void 0===t?void 0:t.edit({[`${null!==(r=this.type)&&void 0!==r?r:"billing"}_${e.field}`]:null})}))}__getDisplayText(e){return e.value||(e.modified?"--":"")}__getPlaceholder(e){return e.modified?this.t("empty_modified_placeholder"):e.originalValue||void 0}get __countriesLoader(){return this.renderRoot.querySelector("#countriesLoader")}get __countryOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__countriesLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.cc2})))}get __isAddressEmpty(){return Object.values(this.__mergedAddress).every((e=>""===this.__getDisplayText(e)))}get __regionOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.code})))}get __regionsLoader(){return this.renderRoot.querySelector("#regionsLoader")}get __mergedAddress(){var e,t,r;const i=null===(e=this.nucleon)||void 0===e?void 0:e.form,o="shipping"===this.type?"shipping":"billing",s=null!==(r=null===(t=this.customer)||void 0===t?void 0:t._embedded[`fx:default_${o}_address`])&&void 0!==r?r:{},n=["first_name","last_name","company","address1","address2","city","state","postal_code","country","phone"].reduce(((e,t)=>{var r;const n=null==i?void 0:i[`${o}_${t}`],a=null==s?void 0:s["state"===t?"region":t];return e[t]={originalValue:String(null!=a?a:""),modified:null!==n,value:String(null!==(r=null!=n?n:a)&&void 0!==r?r:""),field:t},e}),{});return n}get __regionsUrl(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),r=this.__mergedAddress.country.value;return r&&t.searchParams.set("country_code",r),t.toString()}catch(e){}}get __dialog(){return this.renderRoot.querySelector("#dialog")}}customElements.define("foxy-internal-cart-form-address-summary-item",S);let L,C=e=>e;customElements.define("foxy-internal-cart-form-payment-method-form",class extends r{constructor(){super(...arguments),this.defaultPaymentMethod=null,this.paymentCardEmbedUrl=null,this.selectionProps={}}static get properties(){return i(i({},super.properties),{},{defaultPaymentMethod:{attribute:"default-payment-method"},paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},selectionProps:{attribute:!1}})}renderBody(){var e,t;return n(L||(L=C` <foxy-update-payment-method-form embed-url="${0}" infer="default-payment-method" href="${0}" @update="${0}"> </foxy-update-payment-method-form> <div class="flex items-center gap-m"> <div class="border-t border-contrast-10 flex-1"></div> <foxy-i18n class="text-tertiary" infer="" key="or"></foxy-i18n> <div class="border-t border-contrast-10 flex-1"></div> </div> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="select_previous"></foxy-i18n> </h2> <foxy-internal-async-list-control infer="selection" limit="5" form="foxy-null" hide-delete-button hide-create-button @itemclick="${0}" ...="${0}"> </foxy-internal-async-list-control> `),c(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:void 0),c(null!==(t=this.defaultPaymentMethod)&&void 0!==t?t:void 0),(e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.result)===u.UpdateResult.ResourceUpdated&&(this.edit({selection:""}),this.submit())}),(e=>{e.preventDefault(),this.edit({selection:e.detail}),this.submit()}),m(this.selectionProps))}});let A,E,O=e=>e;customElements.define("foxy-internal-cart-form-payment-method-card",class extends _{renderBody(){return super.renderBody({title:e=>{var t,r,i,o,s;const a=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],l=null!==(i=null==a?void 0:a.cc_type)&&void 0!==i?i:"",d=null===(o=null==a?void 0:a.cc_exp_year)||void 0===o?void 0:o.substring(2),c=null==a?void 0:a.cc_exp_month,u=null===(s=null==a?void 0:a.cc_number_masked)||void 0===s?void 0:s.replace(/x/gi,"");return n(A||(A=O`<foxy-i18n infer="" key="title" .options="${0}"></foxy-i18n>`),{last4Digits:u,context:l&&d&&c&&u?"valid":"invalid",month:c,type:l,year:d})},subtitle:e=>{var t,r,i;const o=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],s={id:p(e._links.self.href),date:null!==(i=null==o?void 0:o.date_created)&&void 0!==i?i:e.transaction_date};return n(E||(E=O`<foxy-i18n infer="" key="subtitle" .options="${0}"></foxy-i18n>`),s)}})}});let T,R,M,q,F,I=e=>e;customElements.define("foxy-internal-cart-form-totals-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,r,i,o;const s=null===(e=this.nucleon)||void 0===e?void 0:e.data;return s?n(R||(R=I` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> <span></span> <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),c(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(s.total_item_price),this.__renderPrice(s.total_shipping,!0),this.__renderPrice(s.total_tax,!0),null===(r=null===(t=null==s?void 0:s._embedded)||void 0===t?void 0:t["fx:applied_gift_card_codes"])||void 0===r?void 0:r.map((e=>{var t;return n(M||(M=I` <span>${0}&colon;</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(o=null===(i=null==s?void 0:s._embedded)||void 0===i?void 0:i["fx:discounts"])||void 0===o?void 0:o.map((e=>n(q||(q=I` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderPrice(s.total_order)):n(T||(T=I``))}get __storeHref(){var e,t,r;return null===(r=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===r?void 0:r.href}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var r,i,o;const s=(null===(r=this.__store)||void 0===r?void 0:r.use_international_currency_symbol)?"code":"symbol",a=null===(o=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===o?void 0:o.currency_code;return n(F||(F=I` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:s,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}});let V,D,H=e=>e;const z=l(d(r,"cart-form"));class B extends z{constructor(){super(...arguments),this.paymentCardEmbedUrl=null,this.getCustomerPageUrl=null,this.itemCategories=null,this.templateSets=null,this.localeCodes=null,this.languages=null,this.customers=null,this.countries=null,this.regions=null,this.coupons=null,this.__languagesLoaderId="languagesLoader",this.__customerLoaderId="customerLoader",this.__paymentMethodUriGetDisplayValueOptions=e=>{var t,r,i,o;const s=null!==(i=null===(r=null===(t=null==e?void 0:e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0])&&void 0!==i?i:null,n=null==s?void 0:s.cc_exp_month,a=null==s?void 0:s.cc_exp_year,l=null===(o=null==s?void 0:s.cc_number_masked)||void 0===o?void 0:o.replace(/x/g,""),d=null==s?void 0:s.cc_type;return{cc_exp_month:null!=n?n:"",cc_exp_year:null!=a?a:"",cc_last4:null!=l?l:"",cc_type:null!=d?d:"",context:l&&n&&a&&d?"":"empty"}},this.__paymentMethodUriSetValue=e=>{try{const t=new URL(e);t.search="",t.pathname+="/payments",this.edit({payment_method_uri:t.toString()})}catch(e){this.edit({payment_method_uri:""})}},this.__paymentMethodUriFilters=[{label:"filter_type",type:f.String,path:"payments:type",list:[{label:"filter_type_value_purchase_order",value:"purchase_order"},{label:"filter_type_value_amazon_mws",value:"amazon_mws"},{label:"filter_type_value_paypal_ec",value:"paypal_ec"},{label:"filter_type_value_paypal",value:"paypal"},{label:"filter_type_value_hosted",value:"hosted"},{label:"filter_type_value_ogone",value:"ogone"}]},{label:"filter_cc_type",type:f.String,path:"payments:cc_type",list:[{label:"filter_cc_type_value_mastercard",value:"mastercard"},{label:"filter_cc_type_value_discover",value:"discover"},{label:"filter_cc_type_value_unionpay",value:"unionpay"},{label:"filter_cc_type_value_maestro",value:"maestro"},{label:"filter_cc_type_value_diners",value:"diners"},{label:"filter_cc_type_value_visa",value:"visa"},{label:"filter_cc_type_value_amex",value:"amex"},{label:"filter_cc_type_value_jcb",value:"jcb"}]},{label:"filter_cc_number_masked",type:f.String,path:"payments:cc_number_masked"}],this.__customerUriSetValue=e=>{this.edit({customer_uri:e,customer_email:""})},this.__customerUriOptions=[{label:"filter_email",path:"email",type:f.String},{label:"filter_is_anonymous",path:"is_anonymous",type:f.String,list:[{value:"false",label:"filter_is_anonymous_value_false"},{value:"true",label:"filter_is_anonymous_value_true"}]}]}static get properties(){return i(i({},super.properties),{},{paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},getCustomerPageUrl:{attribute:!1},itemCategories:{attribute:"item-categories"},templateSets:{attribute:"template-sets"},localeCodes:{attribute:"locale-codes"},languages:{},customers:{},countries:{},regions:{},coupons:{}})}static get v8n(){return[({billing_first_name:e})=>!e||e.length<=50||"billing-first-name:v8n_too_long",({billing_last_name:e})=>!e||e.length<=50||"billing-last-name:v8n_too_long",({billing_state:e})=>!e||e.length<=50||"billing-state:v8n_too_long",({billing_city:e})=>!e||e.length<=50||"billing-city:v8n_too_long",({billing_phone:e})=>!e||e.length<=50||"billing-phone:v8n_too_long",({billing_company:e})=>!e||e.length<=50||"billing-company:v8n_too_long",({billing_address2:e})=>!e||e.length<=100||"billing-address-two:v8n_too_long",({billing_address1:e})=>!e||e.length<=100||"billing-address-one:v8n_too_long",({billing_postal_code:e})=>!e||e.length<=50||"billing-postal-code:v8n_too_long",({shipping_first_name:e})=>!e||e.length<=50||"shipping-first-name:v8n_too_long",({shipping_last_name:e})=>!e||e.length<=50||"shipping-last-name:v8n_too_long",({shipping_state:e})=>!e||e.length<=50||"shipping-state:v8n_too_long",({shipping_city:e})=>!e||e.length<=50||"shipping-city:v8n_too_long",({shipping_phone:e})=>!e||e.length<=50||"shipping-phone:v8n_too_long",({shipping_company:e})=>!e||e.length<=50||"shipping-company:v8n_too_long",({shipping_address2:e})=>!e||e.length<=100||"shipping-address-two:v8n_too_long",({shipping_address1:e})=>!e||e.length<=100||"shipping-address-one:v8n_too_long",({shipping_postal_code:e})=>!e||e.length<=50||"shipping-postal-code:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.form.customer_uri?e.unshift("general:customer-email"):e.unshift("billing:payment-method-uri"),this.data?this.form.use_customer_shipping_address||e.unshift("shipping:shipping-address"):e.unshift("applied-coupon-codes","custom-fields","attributes","shipping","billing","totals","items"),new o(e.join(" ").trim())}renderHeaderActions(){return n(V||(V=H` <foxy-internal-cart-form-create-session-action infer="view-as-customer"> </foxy-internal-cart-form-create-session-action> `))}renderBody(){var e,t,r,i,o,s,a,l,d,u,m;const p=null===(e=this.data)||void 0===e?void 0:e._links,_=this.__customer;return n(D||(D=H` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="template-set-uri" item="foxy-template-set-card"> </foxy-internal-resource-picker-control> <foxy-internal-select-control layout="summary-item" infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control layout="summary-item" infer="customer-email"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" alert wide item="foxy-item-card" form="foxy-item-form" .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-cart-form-totals-control class="min-w-0" infer="totals"> </foxy-internal-cart-form-totals-control> <foxy-internal-async-list-control infer="applied-coupon-codes" class="min-w-0" first="${0}" item="foxy-applied-coupon-code-card" form="foxy-applied-coupon-code-form" alert .related="${0}"> </foxy-internal-async-list-control> <foxy-internal-resource-picker-control first="${0}" infer="customer-uri" item="foxy-customer-card" show-copy-id-button .getItemUrl="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-summary-control infer="billing"> <foxy-internal-resource-picker-control placeholder="${0}" layout="summary-item" first="${0}" infer="payment-method-uri" item="foxy-internal-cart-form-payment-method-card" form="foxy-internal-cart-form-payment-method-form" .getDisplayValueOptions="${0}" .formProps="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="billing-address" type="billing" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-summary-control infer="shipping"> <foxy-internal-switch-control infer="use-customer-shipping-address" invert> </foxy-internal-switch-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="shipping-address" type="shipping" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" item="foxy-custom-field-card" form="foxy-custom-field-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),c(null!==(t=this.templateSets)&&void 0!==t?t:void 0),this.__languageOptions,c(this.__itemsHref),this.href?[this.href]:[],{"locale-codes":this.localeCodes},{"item-categories":this.itemCategories,"locale-codes":this.localeCodes,store:null===(r=this.data)||void 0===r?void 0:r._links["fx:store"].href},c(null==p?void 0:p["fx:applied_coupon_codes"].href),this.href?[this.href]:[],c(null!==(i=this.customers)&&void 0!==i?i:void 0),this.getCustomerPageUrl,this.__customerUriSetValue,this.__customerUriOptions,this.__paymentMethodUriPlaceholder,c(this.__transactionsWithPaymentsUrl),this.__paymentMethodUriGetDisplayValueOptions,{"default-payment-method":null!==(o=null==_?void 0:_._links["fx:default_payment_method"].href)&&void 0!==o?o:"","payment-card-embed-url":null!==(s=this.__pickerPaymentCardEmbedUrl)&&void 0!==s?s:""},this.__paymentMethodUriSetValue,this.__paymentMethodUriFilters,c(null!==(a=this.countries)&&void 0!==a?a:void 0),c(null!==(l=this.regions)&&void 0!==l?l:void 0),_,c(null!==(d=this.countries)&&void 0!==d?d:void 0),c(null!==(u=this.regions)&&void 0!==u?u:void 0),_,c(null==p?void 0:p["fx:custom_fields"].href),c(null==p?void 0:p["fx:attributes"].href),super.renderBody(),c(null!==(m=this.languages)&&void 0!==m?m:void 0),this.__languagesLoaderId,(()=>this.requestUpdate()),c(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()))}get __paymentMethodUriPlaceholder(){var e,t,r,i,o,s;const n=null===(e=this.__customer)||void 0===e?void 0:e._embedded["fx:default_payment_method"],a=null!==(t=null==n?void 0:n.cc_exp_month)&&void 0!==t?t:null,l=null!==(r=null==n?void 0:n.cc_exp_year)&&void 0!==r?r:null,d=null!==(o=null===(i=null==n?void 0:n.cc_number_masked)||void 0===i?void 0:i.replace(/x/g,""))&&void 0!==o?o:null,c=null!==(s=null==n?void 0:n.cc_type)&&void 0!==s?s:null;return this.t("billing.payment-method-uri.value",{cc_exp_month:null!=a?a:"",cc_exp_year:null!=l?l:"",cc_last4:null!=d?d:"",cc_type:null!=c?c:"",context:d&&a&&l&&c?"":"empty"})}get __transactionsWithPaymentsUrl(){var e,t;try{const r=new URL(null!==(t=null===(e=this.__customer)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","payments"),r.toString()}catch(e){}}get __pickerPaymentCardEmbedUrl(){var e,t;try{const r=new URL(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:""),i=p(null!==(t=this.form.template_set_uri)&&void 0!==t?t:"");if(null!==i)return r.searchParams.set("template_set_id",String(i)),r.toString()}catch(e){}}get __customerHref(){var e;try{const t=new URL(null!==(e=this.form.customer_uri)&&void 0!==e?e:"");return t.searchParams.set("zoom","default_payment_method,default_billing_address,default_shipping_address"),t.toString()}catch(e){}}get __itemsHref(){var e,t;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:items"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","item_options"),r.toString()}catch(e){}}get __languageOptions(){var e,t;const r=this.renderRoot.querySelector(`#${this.__languagesLoaderId}`);return Object.entries(null!==(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((([e,t])=>({rawLabel:t,value:e})))}get __customer(){var e;return null===(e=this.renderRoot.querySelector(`#${this.__customerLoaderId}`))||void 0===e?void 0:e.data}}customElements.define("foxy-cart-form",B);export{B as CartForm};
57
+ `));let b,$,j,k,w,P,U=e=>e;class S extends(l(t)){constructor(){super(...arguments),this.countries=null,this.customer=null,this.regions=null,this.type=null}static get properties(){return i(i({},super.properties),{},{countries:{},customer:{type:Object},regions:{},type:{}})}static get styles(){return[...super.styles,x]}get disabledSelector(){var e;const t=[super.disabledSelector.toString()];return(null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||t.unshift("address:state"),new o(t.join(" ").toString())}renderControl(){var e,t;const r=this.__regionOptions,i=null!==(e=this.type)&&void 0!==e?e:"billing",o=this.__mergedAddress;return n(b||(b=U` <div class="flex flex-col gap-m sm-flex-row items-start leading-xs"> <div class="flex-1"> <p class="text-m text-body">${0}</p> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> <dialog id="dialog" class="p-m bg-base shadow-xxl space-y-m"> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="label"></foxy-i18n> </h2> <foxy-internal-summary-control infer="name"> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="address"> ${0} ${0} ${0} <foxy-internal-select-control placeholder="${0}" property="${0}_country" layout="summary-item" infer="country" .options="${0}"> </foxy-internal-select-control> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="extra"> ${0} ${0} </foxy-internal-summary-control> <p class="text-xs text-secondary"> <foxy-i18n infer="" key="form_helper_text"></foxy-i18n> </p> <div class="flex justify-between gap-m"> <vaadin-button theme="error" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <foxy-i18n infer="" key="reset"></foxy-i18n> </vaadin-button> <vaadin-button theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="done"></foxy-i18n> </vaadin-button> </div> </dialog> <foxy-nucleon class="hidden" infer="" href="${0}" id="countriesLoader" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="regionsLoader" @update="${0}"> </foxy-nucleon> `),this.label,this.helperText,this.disabled||this.readonly,this._errorMessage,this.t("edit"),s({"text-left sm-text-right transition-colors transition-opacity":!0,"text-body cursor-pointer hover-opacity-80":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.disabled||this.readonly,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.showModal()}),this.__isAddressEmpty?n($||($=U`<foxy-i18n infer="" key="not_set"></foxy-i18n>`)):n(j||(j=U` <div> ${0} ${0} </div> <div>${0}</div> <div>${0}</div> <div> ${0} ${0} ${0} ${0} ${0} ${0} </div> `),this.__renderAddressPart(o.first_name),this.__renderAddressPart(o.last_name),this.__renderAddressPart(o.company),this.__renderAddressPart(o.phone),this.__renderAddressPart(o.address1),this.__renderAddressPart(o.address2),this.__renderAddressPart(o.city),this.__renderAddressPart(o.state),this.__renderAddressPart(o.postal_code),this.__renderAddressPart(o.country)),this.__renderTextField(o.first_name),this.__renderTextField(o.last_name),this.__renderTextField(o.address1),this.__renderTextField(o.address2),this.__renderTextField(o.city),c(this.__getPlaceholder(o.country)),i,this.__countryOptions,r.length>0?n(k||(k=U` <foxy-internal-select-control placeholder="${0}" property="${0}_state" layout="summary-item" infer="state" .options="${0}"> </foxy-internal-select-control> `),c(this.__getPlaceholder(o.state)),i,r):this.__renderTextField(o.state),this.__renderTextField(o.postal_code),this.__renderTextField(o.company),this.__renderTextField(o.phone),this.disabled,this.readonly,(()=>{var e;null===(e=this.nucleon)||void 0===e||e.edit({[`${i}_first_name`]:null,[`${i}_last_name`]:null,[`${i}_company`]:null,[`${i}_address1`]:null,[`${i}_address2`]:null,[`${i}_city`]:null,[`${i}_state`]:null,[`${i}_postal_code`]:null,[`${i}_country`]:null,[`${i}_phone`]:null})}),this.disabled,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.close()}),c(null!==(t=this.countries)&&void 0!==t?t:void 0),(()=>this.requestUpdate()),c(this.__regionsUrl),(()=>this.requestUpdate()))}__renderAddressPart(e){const t=this.__getDisplayText(e);return n(w||(w=U` <span class="${0}"> ${0} </span> `),s({"text-success bg-success-10":e.modified&&!this.disabled,"bg-contrast-5":e.modified&&this.disabled,"inline-block":!!t,"rounded-s":!0,hidden:!t}),t)}__renderTextField(e){var t;return n(P||(P=U` <foxy-internal-text-control placeholder="${0}" property="${0}_${0}" layout="summary-item" infer="${0}" @clear="${0}"> </foxy-internal-text-control> `),c(this.__getPlaceholder(e)),null!==(t=this.type)&&void 0!==t?t:"billing",e.field,e.field.replace(/_/g,"-").replace("1","-one").replace("2","-two"),(()=>{var t,r;return null===(t=this.nucleon)||void 0===t?void 0:t.edit({[`${null!==(r=this.type)&&void 0!==r?r:"billing"}_${e.field}`]:null})}))}__getDisplayText(e){return e.value||(e.modified?"--":"")}__getPlaceholder(e){return e.modified?this.t("empty_modified_placeholder"):e.originalValue||void 0}get __countriesLoader(){return this.renderRoot.querySelector("#countriesLoader")}get __countryOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__countriesLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.cc2})))}get __isAddressEmpty(){return Object.values(this.__mergedAddress).every((e=>""===this.__getDisplayText(e)))}get __regionOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.code})))}get __regionsLoader(){return this.renderRoot.querySelector("#regionsLoader")}get __mergedAddress(){var e,t,r;const i=null===(e=this.nucleon)||void 0===e?void 0:e.form,o="shipping"===this.type?"shipping":"billing",s=null!==(r=null===(t=this.customer)||void 0===t?void 0:t._embedded[`fx:default_${o}_address`])&&void 0!==r?r:{},n=["first_name","last_name","company","address1","address2","city","state","postal_code","country","phone"].reduce(((e,t)=>{var r;const n=null==i?void 0:i[`${o}_${t}`],a=null==s?void 0:s["state"===t?"region":t];return e[t]={originalValue:String(null!=a?a:""),modified:null!==n,value:String(null!==(r=null!=n?n:a)&&void 0!==r?r:""),field:t},e}),{});return n}get __regionsUrl(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),r=this.__mergedAddress.country.value;return r&&t.searchParams.set("country_code",r),t.toString()}catch(e){}}get __dialog(){return this.renderRoot.querySelector("#dialog")}}customElements.define("foxy-internal-cart-form-address-summary-item",S);let L,C=e=>e;customElements.define("foxy-internal-cart-form-payment-method-form",class extends r{constructor(){super(...arguments),this.defaultPaymentMethod=null,this.paymentCardEmbedUrl=null,this.selectionProps={}}static get properties(){return i(i({},super.properties),{},{defaultPaymentMethod:{attribute:"default-payment-method"},paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},selectionProps:{attribute:!1}})}renderBody(){var e,t;return n(L||(L=C` <foxy-update-payment-method-form embed-url="${0}" infer="default-payment-method" href="${0}" @update="${0}"> </foxy-update-payment-method-form> <div class="flex items-center gap-m"> <div class="border-t border-contrast-10 flex-1"></div> <foxy-i18n class="text-tertiary" infer="" key="or"></foxy-i18n> <div class="border-t border-contrast-10 flex-1"></div> </div> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="select_previous"></foxy-i18n> </h2> <foxy-internal-async-list-control infer="selection" limit="5" form="foxy-null" hide-delete-button hide-create-button @itemclick="${0}" ...="${0}"> </foxy-internal-async-list-control> `),c(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:void 0),c(null!==(t=this.defaultPaymentMethod)&&void 0!==t?t:void 0),(e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.result)===u.UpdateResult.ResourceUpdated&&(this.edit({selection:""}),this.submit())}),(e=>{e.preventDefault(),this.edit({selection:e.detail}),this.submit()}),m(this.selectionProps))}});let A,E,O=e=>e;customElements.define("foxy-internal-cart-form-payment-method-card",class extends _{renderBody(){return super.renderBody({title:e=>{var t,r,i,o,s;const a=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],l=null!==(i=null==a?void 0:a.cc_type)&&void 0!==i?i:"",d=null===(o=null==a?void 0:a.cc_exp_year)||void 0===o?void 0:o.substring(2),c=null==a?void 0:a.cc_exp_month,u=null===(s=null==a?void 0:a.cc_number_masked)||void 0===s?void 0:s.replace(/x/gi,"");return n(A||(A=O`<foxy-i18n infer="" key="title" .options="${0}"></foxy-i18n>`),{last4Digits:u,context:l&&d&&c&&u?"valid":"invalid",month:c,type:l,year:d})},subtitle:e=>{var t,r,i;const o=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],s={id:p(e._links.self.href),date:null!==(i=null==o?void 0:o.date_created)&&void 0!==i?i:e.transaction_date};return n(E||(E=O`<foxy-i18n infer="" key="subtitle" .options="${0}"></foxy-i18n>`),s)}})}});let T,R,M,q,F,I=e=>e;customElements.define("foxy-internal-cart-form-totals-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,r,i,o;const s=null===(e=this.nucleon)||void 0===e?void 0:e.data;return s?n(R||(R=I` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> <span></span> <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),c(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(s.total_item_price),this.__renderPrice(s.total_shipping,!0),this.__renderPrice(s.total_tax,!0),null===(r=null===(t=null==s?void 0:s._embedded)||void 0===t?void 0:t["fx:applied_gift_card_codes"])||void 0===r?void 0:r.map((e=>{var t;return n(M||(M=I` <span>${0}&colon;</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(o=null===(i=null==s?void 0:s._embedded)||void 0===i?void 0:i["fx:discounts"])||void 0===o?void 0:o.map((e=>n(q||(q=I` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderPrice(s.total_order)):n(T||(T=I``))}get __storeHref(){var e,t,r;return null===(r=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===r?void 0:r.href}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var r,i,o;const s=(null===(r=this.__store)||void 0===r?void 0:r.use_international_currency_symbol)?"code":"symbol",a=null===(o=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===o?void 0:o.currency_code;return n(F||(F=I` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:s,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}});let V,D,H=e=>e;const z=l(d(r,"cart-form"));class B extends z{constructor(){super(...arguments),this.paymentCardEmbedUrl=null,this.getCustomerPageUrl=null,this.itemCategories=null,this.templateSets=null,this.localeCodes=null,this.languages=null,this.customers=null,this.countries=null,this.regions=null,this.coupons=null,this.__languagesLoaderId="languagesLoader",this.__customerLoaderId="customerLoader",this.__paymentMethodUriGetDisplayValueOptions=e=>{var t,r,i,o;const s=null!==(i=null===(r=null===(t=null==e?void 0:e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0])&&void 0!==i?i:null,n=null==s?void 0:s.cc_exp_month,a=null==s?void 0:s.cc_exp_year,l=null===(o=null==s?void 0:s.cc_number_masked)||void 0===o?void 0:o.replace(/x/g,""),d=null==s?void 0:s.cc_type;return{cc_exp_month:null!=n?n:"",cc_exp_year:null!=a?a:"",cc_last4:null!=l?l:"",cc_type:null!=d?d:"",context:l&&n&&a&&d?"":"empty"}},this.__paymentMethodUriSetValue=e=>{try{const t=new URL(e);t.search="",t.pathname+="/payments",this.edit({payment_method_uri:t.toString()})}catch(e){this.edit({payment_method_uri:""})}},this.__paymentMethodUriFilters=[{label:"filter_type",type:h.String,path:"payments:type",list:[{label:"filter_type_value_purchase_order",value:"purchase_order"},{label:"filter_type_value_amazon_mws",value:"amazon_mws"},{label:"filter_type_value_paypal_ec",value:"paypal_ec"},{label:"filter_type_value_paypal",value:"paypal"},{label:"filter_type_value_hosted",value:"hosted"},{label:"filter_type_value_ogone",value:"ogone"}]},{label:"filter_cc_type",type:h.String,path:"payments:cc_type",list:[{label:"filter_cc_type_value_mastercard",value:"mastercard"},{label:"filter_cc_type_value_discover",value:"discover"},{label:"filter_cc_type_value_unionpay",value:"unionpay"},{label:"filter_cc_type_value_maestro",value:"maestro"},{label:"filter_cc_type_value_diners",value:"diners"},{label:"filter_cc_type_value_visa",value:"visa"},{label:"filter_cc_type_value_amex",value:"amex"},{label:"filter_cc_type_value_jcb",value:"jcb"}]},{label:"filter_cc_number_masked",type:h.String,path:"payments:cc_number_masked"}],this.__customerUriSetValue=e=>{this.edit({customer_uri:e,customer_email:""})},this.__customerUriOptions=[{label:"filter_email",path:"email",type:h.String},{label:"filter_is_anonymous",path:"is_anonymous",type:h.String,list:[{value:"false",label:"filter_is_anonymous_value_false"},{value:"true",label:"filter_is_anonymous_value_true"}]}]}static get properties(){return i(i({},super.properties),{},{paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},getCustomerPageUrl:{attribute:!1},itemCategories:{attribute:"item-categories"},templateSets:{attribute:"template-sets"},localeCodes:{attribute:"locale-codes"},languages:{},customers:{},countries:{},regions:{},coupons:{}})}static get v8n(){return[({billing_first_name:e})=>!e||e.length<=50||"billing-first-name:v8n_too_long",({billing_last_name:e})=>!e||e.length<=50||"billing-last-name:v8n_too_long",({billing_state:e})=>!e||e.length<=50||"billing-state:v8n_too_long",({billing_city:e})=>!e||e.length<=50||"billing-city:v8n_too_long",({billing_phone:e})=>!e||e.length<=50||"billing-phone:v8n_too_long",({billing_company:e})=>!e||e.length<=50||"billing-company:v8n_too_long",({billing_address2:e})=>!e||e.length<=100||"billing-address-two:v8n_too_long",({billing_address1:e})=>!e||e.length<=100||"billing-address-one:v8n_too_long",({billing_postal_code:e})=>!e||e.length<=50||"billing-postal-code:v8n_too_long",({shipping_first_name:e})=>!e||e.length<=50||"shipping-first-name:v8n_too_long",({shipping_last_name:e})=>!e||e.length<=50||"shipping-last-name:v8n_too_long",({shipping_state:e})=>!e||e.length<=50||"shipping-state:v8n_too_long",({shipping_city:e})=>!e||e.length<=50||"shipping-city:v8n_too_long",({shipping_phone:e})=>!e||e.length<=50||"shipping-phone:v8n_too_long",({shipping_company:e})=>!e||e.length<=50||"shipping-company:v8n_too_long",({shipping_address2:e})=>!e||e.length<=100||"shipping-address-two:v8n_too_long",({shipping_address1:e})=>!e||e.length<=100||"shipping-address-one:v8n_too_long",({shipping_postal_code:e})=>!e||e.length<=50||"shipping-postal-code:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.form.customer_uri?e.unshift("general:customer-email"):e.unshift("billing:payment-method-uri"),this.data?this.form.use_customer_shipping_address||e.unshift("shipping:shipping-address"):e.unshift("applied-coupon-codes","custom-fields","attributes","shipping","billing","totals","items"),new o(e.join(" ").trim())}renderHeaderActions(){return n(V||(V=H` <foxy-internal-cart-form-create-session-action infer="view-as-customer"> </foxy-internal-cart-form-create-session-action> `))}renderBody(){var e,t,r,i,o,s,a,l,d,u,m;const p=null===(e=this.data)||void 0===e?void 0:e._links,_=this.__customer;return n(D||(D=H` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="template-set-uri" item="foxy-template-set-card"> </foxy-internal-resource-picker-control> <foxy-internal-select-control layout="summary-item" infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control layout="summary-item" infer="customer-email"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" alert wide item="foxy-item-card" form="foxy-item-form" .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-cart-form-totals-control class="min-w-0" infer="totals"> </foxy-internal-cart-form-totals-control> <foxy-internal-async-list-control infer="applied-coupon-codes" class="min-w-0" first="${0}" item="foxy-applied-coupon-code-card" form="foxy-applied-coupon-code-form" alert .related="${0}"> </foxy-internal-async-list-control> <foxy-internal-resource-picker-control first="${0}" infer="customer-uri" item="foxy-customer-card" show-copy-id-button .getItemUrl="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-summary-control infer="billing"> <foxy-internal-resource-picker-control placeholder="${0}" layout="summary-item" first="${0}" infer="payment-method-uri" item="foxy-internal-cart-form-payment-method-card" form="foxy-internal-cart-form-payment-method-form" .getDisplayValueOptions="${0}" .formProps="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="billing-address" type="billing" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-summary-control infer="shipping"> <foxy-internal-switch-control infer="use-customer-shipping-address" invert> </foxy-internal-switch-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="shipping-address" type="shipping" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" item="foxy-custom-field-card" form="foxy-custom-field-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),c(null!==(t=this.templateSets)&&void 0!==t?t:void 0),this.__languageOptions,c(this.__itemsHref),this.href?[this.href]:[],{"locale-codes":this.localeCodes},{"item-categories":this.itemCategories,"locale-codes":this.localeCodes,store:null===(r=this.data)||void 0===r?void 0:r._links["fx:store"].href},c(null==p?void 0:p["fx:applied_coupon_codes"].href),this.href?[this.href]:[],c(null!==(i=this.customers)&&void 0!==i?i:void 0),this.getCustomerPageUrl,this.__customerUriSetValue,this.__customerUriOptions,this.__paymentMethodUriPlaceholder,c(this.__transactionsWithPaymentsUrl),this.__paymentMethodUriGetDisplayValueOptions,{"default-payment-method":null!==(o=null==_?void 0:_._links["fx:default_payment_method"].href)&&void 0!==o?o:"","payment-card-embed-url":null!==(s=this.__pickerPaymentCardEmbedUrl)&&void 0!==s?s:""},this.__paymentMethodUriSetValue,this.__paymentMethodUriFilters,c(null!==(a=this.countries)&&void 0!==a?a:void 0),c(null!==(l=this.regions)&&void 0!==l?l:void 0),_,c(null!==(d=this.countries)&&void 0!==d?d:void 0),c(null!==(u=this.regions)&&void 0!==u?u:void 0),_,c(null==p?void 0:p["fx:custom_fields"].href),c(null==p?void 0:p["fx:attributes"].href),super.renderBody(),c(null!==(m=this.languages)&&void 0!==m?m:void 0),this.__languagesLoaderId,(()=>this.requestUpdate()),c(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()))}get __paymentMethodUriPlaceholder(){var e,t,r,i,o,s;const n=null===(e=this.__customer)||void 0===e?void 0:e._embedded["fx:default_payment_method"],a=null!==(t=null==n?void 0:n.cc_exp_month)&&void 0!==t?t:null,l=null!==(r=null==n?void 0:n.cc_exp_year)&&void 0!==r?r:null,d=null!==(o=null===(i=null==n?void 0:n.cc_number_masked)||void 0===i?void 0:i.replace(/x/g,""))&&void 0!==o?o:null,c=null!==(s=null==n?void 0:n.cc_type)&&void 0!==s?s:null;return this.t("billing.payment-method-uri.value",{cc_exp_month:null!=a?a:"",cc_exp_year:null!=l?l:"",cc_last4:null!=d?d:"",cc_type:null!=c?c:"",context:d&&a&&l&&c?"":"empty"})}get __transactionsWithPaymentsUrl(){var e,t;try{const r=new URL(null!==(t=null===(e=this.__customer)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","payments"),r.toString()}catch(e){}}get __pickerPaymentCardEmbedUrl(){var e,t;try{const r=new URL(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:""),i=p(null!==(t=this.form.template_set_uri)&&void 0!==t?t:"");if(null!==i)return r.searchParams.set("template_set_id",String(i)),r.toString()}catch(e){}}get __customerHref(){var e;try{const t=new URL(null!==(e=this.form.customer_uri)&&void 0!==e?e:"");return t.searchParams.set("zoom","default_payment_method,default_billing_address,default_shipping_address"),t.toString()}catch(e){}}get __itemsHref(){var e,t;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:items"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","item_options"),r.toString()}catch(e){}}get __languageOptions(){var e,t;const r=this.renderRoot.querySelector(`#${this.__languagesLoaderId}`);return Object.entries(null!==(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((([e,t])=>({rawLabel:t,value:e})))}get __customer(){var e;return null===(e=this.renderRoot.querySelector(`#${this.__customerLoaderId}`))||void 0===e?void 0:e.data}}customElements.define("foxy-cart-form",B);export{B as CartForm};
@@ -1 +1 @@
1
- import"./shared-6660c6df.js";import"./shared-8f6400d9.js";import"./shared-1fcf3749.js";import{a as e,I as t}from"./shared-edb68eb7.js";import{p as r,s}from"./shared-c05984d1.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{O as n,T as a}from"./shared-8874ec69.js";import{h as l,c as d,s as c}from"./shared-ba5c42c7.js";import"./shared-bb43f0ad.js";import{R as u,a as m}from"./shared-fefaece7.js";import{c as p}from"./shared-4e709717.js";import{r as f}from"./shared-5fd5805c.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import"./shared-8df437b0.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import{i as h}from"./shared-53e42a77.js";import"./shared-5cea7ef0.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-f0afd1ee.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-00b50480.js";import"./shared-b7889b37.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-bab2ea2c.js";import"./shared-63c32024.js";import"./shared-79d0699c.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-05ed8288.js";import"./shared-6524d421.js";import"./shared-421b13a8.js";import"./shared-df76d498.js";import"./shared-188a9c2e.js";import"./shared-15ded782.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-43e2c3f6.js";import"./shared-cf8e2611.js";import"./shared-b15d45b1.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-47962c3f.js";import"./shared-2edce408.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-1c6a1571.js";let y,_,b,x,v=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.disableZoom=!1,this.disableOr=!1,this.operators=Object.values(n)}static get properties(){return o(o({},super.properties),{},{disableZoom:{type:Boolean,attribute:"disable-zoom"},disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array}})}renderControl(){const{label:e,helperText:t,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly;return l(y||(y=v` <section class="grid gap-s leading-xs"> <div ?hidden="${0}"> ${0} ${0} </div> <div class="bg-contrast-5 rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-query-builder infer="query-builder" style="--lumo-border-radius:var(--lumo-border-radius-s);--lumo-border-radius-l:var(--lumo-border-radius-s)" .operators="${0}" .value="${0}" ?disable-zoom="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> </div> ${0} </section> `),!e&&!t,e?l(_||(_=v`<p class="text-l font-medium">${0}</p>`),e):"",t?l(b||(b=v`<p class="text-s text-secondary">${0}</p>`),t):"",this.operators,this._value,this.disableZoom,this.disableOr,(e=>{var t;const r=e.currentTarget;this._value=null!==(t=r.value)&&void 0!==t?t:""}),s?l(x||(x=v`<p class="text-s text-error">${0}</p>`),r):"")}});let g,j,$,w,C,k,A,V,R,S,q=e=>e;class O extends(u(e)){static get styles(){return[super.styles,d(g||(g=q`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}`))]}renderControl(){const e=l(j||(j=q` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20"> <foxy-i18n infer="" key="or"></foxy-i18n> </div> <div class="flex-1 border-t border-contrast-10"></div> <div class="w-m ml-s flex-shrink-0"></div> </div> `));return l($||($=q` <div class="mb-s" ?hidden="${0}"> <p class="font-medium text-body text-l" ?hidden="${0}">${0}</p> <p class="text-s text-secondary" ?hidden="${0}">${0}</p> </div> <div class="rounded bg-contrast-5" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> <p class="text-s text-error mt-s" ?hidden="${0}"> ${0} </p> `),!this.label&&!this.helperText,!this.label,this.label,!this.helperText,this.helperText,f([...Object.entries(this._value||{}),null],((e,t)=>String(t)),((t,r)=>null===t?[r>0?e:"",this.__renderRule({onChange:({key:e,items:t})=>{var r;this._value=o(o({},this._value),{},{[e]:[...null!==(r=this._value[e])&&void 0!==r?r:[],...t]})}})]:[r>0?e:"",this.__renderRule({rule:{key:t[0],items:t[1]},onChange:e=>{var r,s;const o={},i=Object.keys(this._value);for(let n=0;n<i.length;n++){const a=i[n];if(a===t[0])if(e.key===a)o[a]=e.items;else{const t=null!==(r=this._value[e.key])&&void 0!==r?r:[];n>i.indexOf(e.key)?o[e.key]=[...t,...e.items]:(o[e.key]=[...e.items,...t],i.splice(i.indexOf(e.key),1))}else o[a]=null!==(s=this._value[a])&&void 0!==s?s:[]}this._value=o},onDelete:()=>{const e=o({},this._value);delete e[t[0]],this._value=e}})])),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:{}}set _value(e){super._value=e}__renderRule({rule:e,onDelete:t,onChange:r}){var s,o;const i=null!==(s=null==e?void 0:e.items)&&void 0!==s?s:[];return l(w||(w=q` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base"> <div class="${0}"> <div aria-hidden="true"> ${0} </div> </div> </div> <div class="bg-base"> <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> </div> </div> </div> </div> <div class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent" ?hidden="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> </div> `),this.t("rule"),p({"text-tertiary":!this.readonly&&!this.disabled,"text-disabled":this.readonly||this.disabled,"w-m h-m":!0}),c(C||(C=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/></svg>`)),this.__renderInput({value:null!==(o=null==e?void 0:e.key)&&void 0!==o?o:"",label:this.t("option_name"),onChange:e=>{void 0===e?null==t||t():r({key:e,items:i})}}),p({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"cursor-default text-tertiary":!(this.disabled||this.readonly),"text-disabled cursor-default":this.disabled||this.readonly}),c(k||(k=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/><path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/></svg>`)),f(this.readonly?i:[...i,null],((e,t)=>t),((t,s)=>l(A||(A=q` <div class="bg-base"> ${0} </div> `),this.__renderInput({value:null!=t?t:"",label:t?String(s+1):this.t("add_value"),onChange:o=>{const n=[...i];o?null===t?n.push(o):n[s]=o:n.splice(s,1),e&&r({key:e.key,items:n})}})))),this.readonly||0===Object.keys(this._value).length,this.t("delete"),p({"box-content flex items-center justify-center":!0,"w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!e}),this.disabled||this.readonly||!e,(()=>null==t?void 0:t()),c(V||(V=q`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)))}__renderInput(e){return l(R||(R=q` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @change="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.label,p({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,this.disabled||this.readonly,(t=>{const r=t.currentTarget;"Backspace"!==t.key||r.value||e.onChange()}),(t=>{t.currentTarget.value||e.onChange()}),(t=>{const r=t.currentTarget;e.onChange(r.value)}),p({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly}),this.t(e.label),this.disabled||this.readonly?"":l(S||(S=q` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}}customElements.define("foxy-internal-array-map-control",O);let T,H,L,M,I,B=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_details)&&void 0!==e?e:"",o=null!==(t=null==r?void 0:r.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",i=this.helperText,n=this.__renderRulesDescription(),a=this._errorMessage;return l(T||(T=B` <section> <div class="mb-s" ?hidden="${0}"> <p class="flex items-center justify-between space-x-m"> <span class="font-medium flex-1 text-l">${0}</span> <span class="min-w-0">${0}</span> </p> <p class="text-s text-secondary">${0}</p> </div> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),!this.label&&!i&&!n,this.label,this.__renderPreset(),i,{details:s,type:o,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,r=this.nucleon;null==r||r.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),n?l(H||(H=B`<p class="text-s text-secondary mt-s">${0}</p>`),n):"",!a||this.disabled||this.readonly?"":l(L||(L=B`<p class="mt-s text-s leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",o=null!==(t=null==r?void 0:r.form.coupon_discount_details)&&void 0!==t?t:"";return o?this.t("discount_summary",{params:{details:o,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,t=null==e?void 0:e.form.coupon_discount_details,r=null==e?void 0:e.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],i=s.find((e=>e.details===t&&e.type===r));return l(M||(M=B` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),p({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),i?this.t("discount_summary",{params:o(o({},i),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,r;const o=e.currentTarget,i=s[o.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(r=null==i?void 0:i.type)&&void 0!==r?r:"quantity_amount"})}),s.map((e=>l(I||(I=B` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===i,this.t("discount_summary",{params:o(o({},e),{},{ns:this.ns})})))),!i&&!!t&&!!r,this.t("custom_discount"))}});let Z,z,P=e=>e;const D=u(m(t,"coupon-form"));class G extends D{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerAttributeRestrictionsOperators=[n.Not,n.In],this.__customerAttributeRestrictionsGetValue=()=>{var e;const t=r(null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:"").filter((e=>Array.isArray(e)||"string"==typeof e.name)).map((e=>{if(Array.isArray(e))return e.filter((({name:e})=>"string"==typeof e)).map((({name:e,operator:t,value:r})=>({path:e,operator:t,value:r})));return{operator:e.operator,value:e.value,path:e.name}}));return s(t,!0)},this.__customerAttributeRestrictionsSetValue=e=>{const t=r(e).map((e=>{if(Array.isArray(e))return e.map((({path:e,operator:t,value:r})=>({name:e,path:"attributes",operator:t,value:r})));return{operator:e.operator,value:e.value,path:"attributes",name:e.path}}));this.edit({customer_attribute_restrictions:s(t,!0)})},this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join(",")})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:a.String},{label:"used_codes",path:"number_of_uses_to_date",type:a.Number},{label:"date_created",path:"date_created",type:a.Date},{label:"date_modified",path:"date_modified",type:a.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return o(o({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),new i(e.join(" ").trim())}get headerSubtitleOptions(){return o(o({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return l(Z||(Z=P` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,s,o,i,n,a;let d;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),d=r.toString()}catch(e){d=void 0}return l(z||(z=P` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-array-map-control infer="item-option-restrictions"> </foxy-internal-array-map-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions" disable-zoom disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-summary-control infer="auto-apply"> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),d,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],this.__customerAttributeRestrictionsOperators,this.__customerAttributeRestrictionsGetValue,this.__customerAttributeRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,h(null===(r=this.data)||void 0===r?void 0:r._links.self.href),h(null===(o=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===o?void 0:o._links["fx:item_categories"].href),h(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),h(null===(n=this.data)||void 0===n?void 0:n._links["fx:attributes"].href),super.renderBody(),h(null===(a=this.data)||void 0===a?void 0:a._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",G);export{G as CouponForm};
1
+ import"./shared-6660c6df.js";import"./shared-8f6400d9.js";import"./shared-1fcf3749.js";import{a as e,I as t}from"./shared-edb68eb7.js";import{p as r,s}from"./shared-c05984d1.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{O as n,T as a}from"./shared-8874ec69.js";import{h as l,c as d,s as c}from"./shared-ba5c42c7.js";import"./shared-bb43f0ad.js";import{R as u,a as m}from"./shared-fefaece7.js";import{c as p}from"./shared-4e709717.js";import{r as f}from"./shared-5fd5805c.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import"./shared-a42e4325.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import{i as h}from"./shared-53e42a77.js";import"./shared-5cea7ef0.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-f0afd1ee.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-00b50480.js";import"./shared-b7889b37.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-bab2ea2c.js";import"./shared-63c32024.js";import"./shared-79d0699c.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-05ed8288.js";import"./shared-6524d421.js";import"./shared-421b13a8.js";import"./shared-df76d498.js";import"./shared-188a9c2e.js";import"./shared-15ded782.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-43e2c3f6.js";import"./shared-cf8e2611.js";import"./shared-b15d45b1.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-47962c3f.js";import"./shared-2edce408.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-1c6a1571.js";let y,_,b,x,v=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.disableZoom=!1,this.disableOr=!1,this.operators=Object.values(n)}static get properties(){return o(o({},super.properties),{},{disableZoom:{type:Boolean,attribute:"disable-zoom"},disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array}})}renderControl(){const{label:e,helperText:t,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly;return l(y||(y=v` <section class="grid gap-s leading-xs"> <div ?hidden="${0}"> ${0} ${0} </div> <div class="bg-contrast-5 rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-query-builder infer="query-builder" style="--lumo-border-radius:var(--lumo-border-radius-s);--lumo-border-radius-l:var(--lumo-border-radius-s)" .operators="${0}" .value="${0}" ?disable-zoom="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> </div> ${0} </section> `),!e&&!t,e?l(_||(_=v`<p class="text-l font-medium">${0}</p>`),e):"",t?l(b||(b=v`<p class="text-s text-secondary">${0}</p>`),t):"",this.operators,this._value,this.disableZoom,this.disableOr,(e=>{var t;const r=e.currentTarget;this._value=null!==(t=r.value)&&void 0!==t?t:""}),s?l(x||(x=v`<p class="text-s text-error">${0}</p>`),r):"")}});let g,j,$,w,C,k,A,V,R,S,q=e=>e;class O extends(u(e)){static get styles(){return[super.styles,d(g||(g=q`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}`))]}renderControl(){const e=l(j||(j=q` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20"> <foxy-i18n infer="" key="or"></foxy-i18n> </div> <div class="flex-1 border-t border-contrast-10"></div> <div class="w-m ml-s flex-shrink-0"></div> </div> `));return l($||($=q` <div class="mb-s" ?hidden="${0}"> <p class="font-medium text-body text-l" ?hidden="${0}">${0}</p> <p class="text-s text-secondary" ?hidden="${0}">${0}</p> </div> <div class="rounded bg-contrast-5" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> <p class="text-s text-error mt-s" ?hidden="${0}"> ${0} </p> `),!this.label&&!this.helperText,!this.label,this.label,!this.helperText,this.helperText,f([...Object.entries(this._value||{}),null],((e,t)=>String(t)),((t,r)=>null===t?[r>0?e:"",this.__renderRule({onChange:({key:e,items:t})=>{var r;this._value=o(o({},this._value),{},{[e]:[...null!==(r=this._value[e])&&void 0!==r?r:[],...t]})}})]:[r>0?e:"",this.__renderRule({rule:{key:t[0],items:t[1]},onChange:e=>{var r,s;const o={},i=Object.keys(this._value);for(let n=0;n<i.length;n++){const a=i[n];if(a===t[0])if(e.key===a)o[a]=e.items;else{const t=null!==(r=this._value[e.key])&&void 0!==r?r:[];n>i.indexOf(e.key)?o[e.key]=[...t,...e.items]:(o[e.key]=[...e.items,...t],i.splice(i.indexOf(e.key),1))}else o[a]=null!==(s=this._value[a])&&void 0!==s?s:[]}this._value=o},onDelete:()=>{const e=o({},this._value);delete e[t[0]],this._value=e}})])),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:{}}set _value(e){super._value=e}__renderRule({rule:e,onDelete:t,onChange:r}){var s,o;const i=null!==(s=null==e?void 0:e.items)&&void 0!==s?s:[];return l(w||(w=q` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base"> <div class="${0}"> <div aria-hidden="true"> ${0} </div> </div> </div> <div class="bg-base"> <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> </div> </div> </div> </div> <div class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent" ?hidden="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> </div> `),this.t("rule"),p({"text-tertiary":!this.readonly&&!this.disabled,"text-disabled":this.readonly||this.disabled,"w-m h-m":!0}),c(C||(C=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/></svg>`)),this.__renderInput({value:null!==(o=null==e?void 0:e.key)&&void 0!==o?o:"",label:this.t("option_name"),onChange:e=>{void 0===e?null==t||t():r({key:e,items:i})}}),p({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"cursor-default text-tertiary":!(this.disabled||this.readonly),"text-disabled cursor-default":this.disabled||this.readonly}),c(k||(k=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/><path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/></svg>`)),f(this.readonly?i:[...i,null],((e,t)=>t),((t,s)=>l(A||(A=q` <div class="bg-base"> ${0} </div> `),this.__renderInput({value:null!=t?t:"",label:t?String(s+1):this.t("add_value"),onChange:o=>{const n=[...i];o?null===t?n.push(o):n[s]=o:n.splice(s,1),e&&r({key:e.key,items:n})}})))),this.readonly||0===Object.keys(this._value).length,this.t("delete"),p({"box-content flex items-center justify-center":!0,"w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!e}),this.disabled||this.readonly||!e,(()=>null==t?void 0:t()),c(V||(V=q`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)))}__renderInput(e){return l(R||(R=q` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @change="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.label,p({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,this.disabled||this.readonly,(t=>{const r=t.currentTarget;"Backspace"!==t.key||r.value||e.onChange()}),(t=>{t.currentTarget.value||e.onChange()}),(t=>{const r=t.currentTarget;e.onChange(r.value)}),p({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly}),this.t(e.label),this.disabled||this.readonly?"":l(S||(S=q` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}}customElements.define("foxy-internal-array-map-control",O);let T,H,L,M,I,B=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_details)&&void 0!==e?e:"",o=null!==(t=null==r?void 0:r.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",i=this.helperText,n=this.__renderRulesDescription(),a=this._errorMessage;return l(T||(T=B` <section> <div class="mb-s" ?hidden="${0}"> <p class="flex items-center justify-between space-x-m"> <span class="font-medium flex-1 text-l">${0}</span> <span class="min-w-0">${0}</span> </p> <p class="text-s text-secondary">${0}</p> </div> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),!this.label&&!i&&!n,this.label,this.__renderPreset(),i,{details:s,type:o,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,r=this.nucleon;null==r||r.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),n?l(H||(H=B`<p class="text-s text-secondary mt-s">${0}</p>`),n):"",!a||this.disabled||this.readonly?"":l(L||(L=B`<p class="mt-s text-s leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",o=null!==(t=null==r?void 0:r.form.coupon_discount_details)&&void 0!==t?t:"";return o?this.t("discount_summary",{params:{details:o,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,t=null==e?void 0:e.form.coupon_discount_details,r=null==e?void 0:e.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],i=s.find((e=>e.details===t&&e.type===r));return l(M||(M=B` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),p({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),i?this.t("discount_summary",{params:o(o({},i),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,r;const o=e.currentTarget,i=s[o.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(r=null==i?void 0:i.type)&&void 0!==r?r:"quantity_amount"})}),s.map((e=>l(I||(I=B` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===i,this.t("discount_summary",{params:o(o({},e),{},{ns:this.ns})})))),!i&&!!t&&!!r,this.t("custom_discount"))}});let Z,z,P=e=>e;const D=u(m(t,"coupon-form"));class G extends D{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerAttributeRestrictionsOperators=[n.Not,n.In],this.__customerAttributeRestrictionsGetValue=()=>{var e;const t=r(null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:"").filter((e=>Array.isArray(e)||"string"==typeof e.name)).map((e=>{if(Array.isArray(e))return e.filter((({name:e})=>"string"==typeof e)).map((({name:e,operator:t,value:r})=>({path:e,operator:t,value:r})));return{operator:e.operator,value:e.value,path:e.name}}));return s(t,!0)},this.__customerAttributeRestrictionsSetValue=e=>{const t=r(e).map((e=>{if(Array.isArray(e))return e.map((({path:e,operator:t,value:r})=>({name:e,path:"attributes",operator:t,value:r})));return{operator:e.operator,value:e.value,path:"attributes",name:e.path}}));this.edit({customer_attribute_restrictions:s(t,!0)})},this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join(",")})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:a.String},{label:"used_codes",path:"number_of_uses_to_date",type:a.Number},{label:"date_created",path:"date_created",type:a.Date},{label:"date_modified",path:"date_modified",type:a.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return o(o({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),new i(e.join(" ").trim())}get headerSubtitleOptions(){return o(o({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return l(Z||(Z=P` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,s,o,i,n,a;let d;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),d=r.toString()}catch(e){d=void 0}return l(z||(z=P` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-array-map-control infer="item-option-restrictions"> </foxy-internal-array-map-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions" disable-zoom disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-summary-control infer="auto-apply"> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),d,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],this.__customerAttributeRestrictionsOperators,this.__customerAttributeRestrictionsGetValue,this.__customerAttributeRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,h(null===(r=this.data)||void 0===r?void 0:r._links.self.href),h(null===(o=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===o?void 0:o._links["fx:item_categories"].href),h(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),h(null===(n=this.data)||void 0===n?void 0:n._links["fx:attributes"].href),super.renderBody(),h(null===(a=this.data)||void 0===a?void 0:a._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",G);export{G as CouponForm};
@@ -1,4 +1,4 @@
1
- import"./shared-f0afd1ee.js";import"./shared-79f84a95.js";import"./shared-1fcf3749.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import"./shared-c5fa5c92.js";import"./shared-b293a928.js";import{I as e,b as t}from"./shared-edb68eb7.js";import"./foxy-template-set-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-bb43f0ad.js";import"./shared-e1b97b27.js";import"./shared-2edce408.js";import"./shared-6aa8f7ee.js";import"./shared-8df437b0.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-47962c3f.js";import{I as n}from"./shared-0c61b5ce.js";import{h as r,d as i,N as o,i as a,s}from"./shared-ba5c42c7.js";import{_ as l,B as u}from"./shared-d1195c27.js";import{a as d,R as c,w as m}from"./shared-fefaece7.js";import{i as f}from"./shared-53e42a77.js";import{e as h,d as g}from"./shared-641786b2.js";import{c as p}from"./shared-4e709717.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-bab2ea2c.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-56f7db6f.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-5fd5805c.js";import"./shared-d0aed1c1.js";import"./shared-b4b9735c.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-6524d421.js";import"./shared-4215bff2.js";import"./shared-651c44fa.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-5212ef4f.js";import"./shared-e4159eb9.js";import"./shared-b7889b37.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-5cea7ef0.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-63c32024.js";let y,_=e=>e;customElements.define("foxy-internal-experimental-add-to-cart-builder-custom-option-card",class extends n{renderBody(){var e,t;return r(y||(y=_` <div class="flex justify-between items-center h-xs"> <span class="font-medium">${0}&ZeroWidthSpace;</span> <span class="text-secondary">${0}&ZeroWidthSpace;</span> </div> `),null===(e=this.data)||void 0===e?void 0:e.name,null===(t=this.data)||void 0===t?void 0:t.value)}});let b,x=e=>e;const v=d(e,"internal-experimental-add-to-cart-builder-custom-option-form");customElements.define("foxy-internal-experimental-add-to-cart-builder-custom-option-form",class extends v{constructor(){super(...arguments),this.defaultWeightUnit=null,this.existingOptions=[],this.itemCategories=null,this.currencyCode=null}static get properties(){return l(l({},super.properties),{},{defaultWeightUnit:{attribute:"default-weight-unit"},existingOptions:{type:Array,attribute:"existing-options"},itemCategories:{attribute:"item-categories"},currencyCode:{attribute:"currency-code"}})}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.unshift("basics-group"),new u(e.join(" ").trim())}get disabledSelector(){const e=[super.disabledSelector.toString()];return!this.href&&this.existingOptions.some((e=>e.name===this.form.name))&&e.unshift("basics-group:value-configurable"),new u(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.form.value_configurable&&e.unshift("price-group","weight-group","code-group","category-group"),new u(e.join(" ").trim())}renderBody(){var e,t,n,i;return r(b||(b=x` <foxy-internal-summary-control infer="basics-group"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-text-control property="value" layout="summary-item" infer="${0}"> </foxy-internal-text-control> <foxy-internal-switch-control infer="value-configurable"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="price-group"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="price"> </foxy-internal-number-control> <foxy-internal-switch-control infer="replace-price"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="weight-group"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="weight"> </foxy-internal-number-control> <foxy-internal-switch-control infer="replace-weight"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="code-group"> <foxy-internal-text-control layout="summary-item" infer="code"> </foxy-internal-text-control> <foxy-internal-switch-control infer="replace-code"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="category-group"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> </foxy-internal-summary-control> <foxy-nucleon infer="" class="hidden" href="${0}" id="itemCategoryLoader" @update="${0}"> </foxy-nucleon> `),this.form.value_configurable?"default-value":"value",f(null!==(e=this.currencyCode)&&void 0!==e?e:void 0),f(null!==(t=this.__resolvedDefaultWeightUnit)&&void 0!==t?t:void 0),f(null!==(n=this.itemCategories)&&void 0!==n?n:void 0),f(null!==(i=this.form.item_category_uri)&&void 0!==i?i:void 0),(()=>this.requestUpdate()))}async _sendPost(e){const t=this.existingOptions.filter((t=>t.name===e.name));if(t.some((e=>e.value_configurable)))throw["error:option_exists_configurable"];if(t.some((t=>t.value===e.value)))throw["error:option_exists"];return super._sendPost(e)}get __resolvedDefaultWeightUnit(){var e,t;const n=this.renderRoot.querySelector("#itemCategoryLoader");return null!==(t=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.default_weight_unit)&&void 0!==t?t:this.defaultWeightUnit}});let $,w,E,S,j,k,C,N,L,M,R,O,P,T,A,I,q=e=>e;customElements.define("foxy-internal-experimental-add-to-cart-builder-item-control",class extends t{constructor(){super(...arguments),this.defaultItemCategory=null,this.itemCategories=null,this.currencyCode=null,this.index=0}static get properties(){return l(l({},super.properties),{},{defaultItemCategory:{type:Object,attribute:"default-item-category"},itemCategories:{attribute:"item-categories"},currencyCode:{attribute:"currency-code"},index:{type:Number}})}renderControl(){var e,t,n,i,o,a,s,l,u;const d=this.__resolvedItemCategory,c=null==d?void 0:d.item_delivery_type,m=this.nucleon,h=this.index,g=null===(e=null==m?void 0:m.form.items)||void 0===e?void 0:e[h];return r($||($=q` <div class="space-y-m"> <foxy-internal-summary-control infer="basics-group"> <foxy-internal-text-control property="items.${0}.name" layout="summary-item" infer="name"> </foxy-internal-text-control> <foxy-internal-resource-picker-control property="items.${0}.item_category_uri" layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="price-group"> <foxy-internal-number-control property="items.${0}.price" layout="summary-item" suffix="${0}" infer="${0}"> </foxy-internal-number-control> <foxy-internal-switch-control property="items.${0}.price_configurable" layout="summary-item" infer="price-configurable"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="code-group"> <foxy-internal-text-control property="items.${0}.code" layout="summary-item" infer="code"> </foxy-internal-text-control> <foxy-internal-text-control property="items.${0}.parent_code" layout="summary-item" infer="parent-code"> </foxy-internal-text-control> </foxy-internal-summary-control> ${0} <foxy-internal-summary-control infer="subscriptions-group"> <foxy-internal-switch-control property="items.${0}.sub_enabled" layout="summary-item" infer="sub-enabled"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="quantity-group" layout="details"> <foxy-internal-number-control property="items.${0}.quantity" layout="summary-item" infer="quantity" step="1" min="1"> </foxy-internal-number-control> ${0} <foxy-internal-switch-control property="items.${0}.hide_quantity" infer="hide-quantity"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="advanced-group" layout="details"> <foxy-internal-text-control property="items.${0}.discount_name" layout="summary-item" infer="discount-name"> </foxy-internal-text-control> ${0} <foxy-internal-text-control property="items.${0}.image" layout="summary-item" infer="image"> </foxy-internal-text-control> ${0} <foxy-internal-select-control property="items.${0}.expires_format" layout="summary-item" infer="expires-format" .options="${0}"> </foxy-internal-select-control> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-async-list-control layout="details" first="foxy://${0}/form/items/${0}/custom_options" infer="custom-options" form="foxy-internal-experimental-add-to-cart-builder-custom-option-form" item="foxy-internal-experimental-add-to-cart-builder-custom-option-card" alert .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="itemCategoryLoader" @update="${0}"> </foxy-nucleon> </div> `),h,h,f(null!==(t=this.itemCategories)&&void 0!==t?t:void 0),h,f(null!==(n=this.currencyCode)&&void 0!==n?n:void 0),(null==g?void 0:g.price_configurable)?"price-default":"price",h,h,h,"notshipped"===c||"downloaded"===c?"":r(w||(w=q` <foxy-internal-summary-control infer="appearance-group"> <foxy-internal-number-control placeholder="${0}" property="items.${0}.weight" layout="summary-item" suffix="${0}" infer="weight" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> `),f(null==d?void 0:d.default_weight),h,f(null==d?void 0:d.default_weight_unit)),h,(null==g?void 0:g.sub_enabled)?r(E||(E=q` <foxy-internal-frequency-control property="items.${0}.sub_frequency" layout="summary-item" infer="sub-frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-select-control property="items.${0}.sub_startdate_format" layout="summary-item" infer="sub-startdate-format" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-select-control property="items.${0}.sub_enddate_format" layout="summary-item" infer="sub-enddate-format" .options="${0}"> </foxy-internal-select-control> ${0} `),h,h,[{label:"option_none",value:"none"},{label:"option_yyyymmdd",value:"yyyymmdd"},{label:"option_dd",value:"dd"},{label:"option_duration",value:"duration"}],"yyyymmdd"===g.sub_startdate_format?r(S||(S=q` <foxy-internal-date-control property="items.${0}.sub_startdate" layout="summary-item" infer="sub-startdate-yyyymmdd"> </foxy-internal-date-control> `),h):"duration"===g.sub_startdate_format?r(j||(j=q` <foxy-internal-frequency-control property="items.${0}.sub_startdate" layout="summary-item" infer="sub-startdate-duration"> </foxy-internal-frequency-control> `),h):"dd"===g.sub_startdate_format?r(k||(k=q` <foxy-internal-number-control property="items.${0}.sub_startdate" layout="summary-item" infer="sub-startdate-dd" step="1" min="1" max="31"> </foxy-internal-number-control> `),h):"",h,[{label:"option_none",value:"none"},{label:"option_yyyymmdd",value:"yyyymmdd"},{label:"option_duration",value:"duration"}],"yyyymmdd"===g.sub_enddate_format?r(C||(C=q` <foxy-internal-date-control property="items.${0}.sub_enddate" layout="summary-item" infer="sub-enddate-yyyymmdd"> </foxy-internal-date-control> `),h):"duration"===g.sub_enddate_format?r(N||(N=q` <foxy-internal-frequency-control property="items.${0}.sub_enddate" layout="summary-item" infer="sub-enddate-duration"> </foxy-internal-frequency-control> `),h):""):"",h,"minutes"===(null==g?void 0:g.expires_format)?"":r(L||(L=q` <foxy-internal-number-control property="items.${0}.quantity_min" layout="summary-item" infer="quantity-min" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-number-control property="items.${0}.quantity_max" layout="summary-item" infer="quantity-max" step="1" min="1"> </foxy-internal-number-control> `),h,h),h,h,(null==g?void 0:g.discount_name)?r(M||(M=q` <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),{details:null!==(i=null==g?void 0:g.discount_details)&&void 0!==i?i:"",type:null!==(o=null==g?void 0:g.discount_type)&&void 0!==o?o:"amount_percentage",name:null!==(a=null==g?void 0:g.discount_name)&&void 0!==a?a:""},(e=>{this.__handleDiscountBuilderChange(e,g,h)})):"",h,(null==g?void 0:g.image)?r(R||(R=q` <foxy-internal-text-control property="items.${0}.url" layout="summary-item" infer="url"> </foxy-internal-text-control> `),h):"",h,[{label:"option_none",value:"none"},{label:"option_minutes",value:"minutes"},{label:"option_timestamp",value:"timestamp"}],"minutes"===(null==g?void 0:g.expires_format)?r(O||(O=q` <foxy-internal-number-control property="items.${0}.expires_value" layout="summary-item" suffix="min" infer="expires-value-minutes"> </foxy-internal-number-control> `),h):"timestamp"===(null==g?void 0:g.expires_format)?r(P||(P=q` <foxy-internal-date-control property="items.${0}.expires_value" layout="summary-item" format="unix" infer="expires-value-timestamp"> </foxy-internal-date-control> `),h):"","notshipped"===c||"downloaded"===c?"":r(T||(T=q` <foxy-internal-number-control property="items.${0}.length" layout="summary-item" suffix="${0}" infer="length" min="0"> </foxy-internal-number-control> <foxy-internal-number-control property="items.${0}.width" layout="summary-item" suffix="${0}" infer="width" min="0"> </foxy-internal-number-control> <foxy-internal-number-control property="items.${0}.height" layout="summary-item" suffix="${0}" infer="height" min="0"> </foxy-internal-number-control> `),h,f(null==d?void 0:d.default_length_unit),h,f(null==d?void 0:d.default_length_unit),h,f(null==d?void 0:d.default_length_unit)),null==m?void 0:m.virtualHost,h,{".defaultWeightUnit":null==d?void 0:d.default_weight_unit,".existingOptions":null!==(s=null==g?void 0:g.custom_options)&&void 0!==s?s:[],".itemCategories":this.itemCategories,".currencyCode":this.currencyCode},(null!==(u=null===(l=null==m?void 0:m.form.items)||void 0===l?void 0:l.length)&&void 0!==u?u:0)<=1?r(A||(A=q``)):r(I||(I=q` <vaadin-button theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="delete" key="caption"></foxy-i18n> </vaadin-button> `),this.disabled,(()=>this.dispatchEvent(new CustomEvent("remove")))),f(null==g?void 0:g.item_category_uri),(()=>this.requestUpdate()))}get __resolvedItemCategory(){var e,t;return null!==(t=null===(e=this.__itemCategoryLoader)||void 0===e?void 0:e.data)&&void 0!==t?t:this.defaultItemCategory}get __itemCategoryLoader(){return this.renderRoot.querySelector("#itemCategoryLoader")}__handleDiscountBuilderChange(e,t,n){var r;const i=e.currentTarget,o=this.nucleon;t.discount_details=i.parsedValue.details,t.discount_type=i.parsedValue.type,t.discount_name=i.parsedValue.name;const a=null!==(r=null==o?void 0:o.form.items)&&void 0!==r?r:[];a.splice(n,1,t),null==o||o.edit({items:[...a]})}});const D=new WeakMap,H=i((e=>t=>{if(!(t instanceof o))throw new Error("unsafeHTML can only be used in text bindings");const n=D.get(t);if(void 0!==n&&a(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template");r.innerHTML=e;const i=document.importNode(r.content,!0);t.setValue(i),D.set(t,{value:e,fragment:i})}));
1
+ import"./shared-f0afd1ee.js";import"./shared-79f84a95.js";import"./shared-1fcf3749.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import"./shared-c5fa5c92.js";import"./shared-b293a928.js";import{I as e,b as t}from"./shared-edb68eb7.js";import"./foxy-template-set-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-bb43f0ad.js";import"./shared-e1b97b27.js";import"./shared-2edce408.js";import"./shared-6aa8f7ee.js";import"./shared-a42e4325.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-47962c3f.js";import{I as n}from"./shared-0c61b5ce.js";import{h as r,d as i,N as o,i as a,s}from"./shared-ba5c42c7.js";import{_ as l,B as u}from"./shared-d1195c27.js";import{a as d,R as c,w as m}from"./shared-fefaece7.js";import{i as f}from"./shared-53e42a77.js";import{e as h,d as g}from"./shared-641786b2.js";import{c as p}from"./shared-4e709717.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-bab2ea2c.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-56f7db6f.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-5fd5805c.js";import"./shared-d0aed1c1.js";import"./shared-b4b9735c.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-6524d421.js";import"./shared-4215bff2.js";import"./shared-651c44fa.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-5212ef4f.js";import"./shared-e4159eb9.js";import"./shared-b7889b37.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-5cea7ef0.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-63c32024.js";let y,_=e=>e;customElements.define("foxy-internal-experimental-add-to-cart-builder-custom-option-card",class extends n{renderBody(){var e,t;return r(y||(y=_` <div class="flex justify-between items-center h-xs"> <span class="font-medium">${0}&ZeroWidthSpace;</span> <span class="text-secondary">${0}&ZeroWidthSpace;</span> </div> `),null===(e=this.data)||void 0===e?void 0:e.name,null===(t=this.data)||void 0===t?void 0:t.value)}});let b,x=e=>e;const v=d(e,"internal-experimental-add-to-cart-builder-custom-option-form");customElements.define("foxy-internal-experimental-add-to-cart-builder-custom-option-form",class extends v{constructor(){super(...arguments),this.defaultWeightUnit=null,this.existingOptions=[],this.itemCategories=null,this.currencyCode=null}static get properties(){return l(l({},super.properties),{},{defaultWeightUnit:{attribute:"default-weight-unit"},existingOptions:{type:Array,attribute:"existing-options"},itemCategories:{attribute:"item-categories"},currencyCode:{attribute:"currency-code"}})}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.unshift("basics-group"),new u(e.join(" ").trim())}get disabledSelector(){const e=[super.disabledSelector.toString()];return!this.href&&this.existingOptions.some((e=>e.name===this.form.name))&&e.unshift("basics-group:value-configurable"),new u(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.form.value_configurable&&e.unshift("price-group","weight-group","code-group","category-group"),new u(e.join(" ").trim())}renderBody(){var e,t,n,i;return r(b||(b=x` <foxy-internal-summary-control infer="basics-group"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-text-control property="value" layout="summary-item" infer="${0}"> </foxy-internal-text-control> <foxy-internal-switch-control infer="value-configurable"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="price-group"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="price"> </foxy-internal-number-control> <foxy-internal-switch-control infer="replace-price"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="weight-group"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="weight"> </foxy-internal-number-control> <foxy-internal-switch-control infer="replace-weight"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="code-group"> <foxy-internal-text-control layout="summary-item" infer="code"> </foxy-internal-text-control> <foxy-internal-switch-control infer="replace-code"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="category-group"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> </foxy-internal-summary-control> <foxy-nucleon infer="" class="hidden" href="${0}" id="itemCategoryLoader" @update="${0}"> </foxy-nucleon> `),this.form.value_configurable?"default-value":"value",f(null!==(e=this.currencyCode)&&void 0!==e?e:void 0),f(null!==(t=this.__resolvedDefaultWeightUnit)&&void 0!==t?t:void 0),f(null!==(n=this.itemCategories)&&void 0!==n?n:void 0),f(null!==(i=this.form.item_category_uri)&&void 0!==i?i:void 0),(()=>this.requestUpdate()))}async _sendPost(e){const t=this.existingOptions.filter((t=>t.name===e.name));if(t.some((e=>e.value_configurable)))throw["error:option_exists_configurable"];if(t.some((t=>t.value===e.value)))throw["error:option_exists"];return super._sendPost(e)}get __resolvedDefaultWeightUnit(){var e,t;const n=this.renderRoot.querySelector("#itemCategoryLoader");return null!==(t=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.default_weight_unit)&&void 0!==t?t:this.defaultWeightUnit}});let $,w,E,S,j,k,C,N,L,M,R,O,P,T,A,I,q=e=>e;customElements.define("foxy-internal-experimental-add-to-cart-builder-item-control",class extends t{constructor(){super(...arguments),this.defaultItemCategory=null,this.itemCategories=null,this.currencyCode=null,this.index=0}static get properties(){return l(l({},super.properties),{},{defaultItemCategory:{type:Object,attribute:"default-item-category"},itemCategories:{attribute:"item-categories"},currencyCode:{attribute:"currency-code"},index:{type:Number}})}renderControl(){var e,t,n,i,o,a,s,l,u;const d=this.__resolvedItemCategory,c=null==d?void 0:d.item_delivery_type,m=this.nucleon,h=this.index,g=null===(e=null==m?void 0:m.form.items)||void 0===e?void 0:e[h];return r($||($=q` <div class="space-y-m"> <foxy-internal-summary-control infer="basics-group"> <foxy-internal-text-control property="items.${0}.name" layout="summary-item" infer="name"> </foxy-internal-text-control> <foxy-internal-resource-picker-control property="items.${0}.item_category_uri" layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="price-group"> <foxy-internal-number-control property="items.${0}.price" layout="summary-item" suffix="${0}" infer="${0}"> </foxy-internal-number-control> <foxy-internal-switch-control property="items.${0}.price_configurable" layout="summary-item" infer="price-configurable"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="code-group"> <foxy-internal-text-control property="items.${0}.code" layout="summary-item" infer="code"> </foxy-internal-text-control> <foxy-internal-text-control property="items.${0}.parent_code" layout="summary-item" infer="parent-code"> </foxy-internal-text-control> </foxy-internal-summary-control> ${0} <foxy-internal-summary-control infer="subscriptions-group"> <foxy-internal-switch-control property="items.${0}.sub_enabled" layout="summary-item" infer="sub-enabled"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="quantity-group" layout="details"> <foxy-internal-number-control property="items.${0}.quantity" layout="summary-item" infer="quantity" step="1" min="1"> </foxy-internal-number-control> ${0} <foxy-internal-switch-control property="items.${0}.hide_quantity" infer="hide-quantity"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="advanced-group" layout="details"> <foxy-internal-text-control property="items.${0}.discount_name" layout="summary-item" infer="discount-name"> </foxy-internal-text-control> ${0} <foxy-internal-text-control property="items.${0}.image" layout="summary-item" infer="image"> </foxy-internal-text-control> ${0} <foxy-internal-select-control property="items.${0}.expires_format" layout="summary-item" infer="expires-format" .options="${0}"> </foxy-internal-select-control> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-async-list-control layout="details" first="foxy://${0}/form/items/${0}/custom_options" infer="custom-options" form="foxy-internal-experimental-add-to-cart-builder-custom-option-form" item="foxy-internal-experimental-add-to-cart-builder-custom-option-card" alert .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="itemCategoryLoader" @update="${0}"> </foxy-nucleon> </div> `),h,h,f(null!==(t=this.itemCategories)&&void 0!==t?t:void 0),h,f(null!==(n=this.currencyCode)&&void 0!==n?n:void 0),(null==g?void 0:g.price_configurable)?"price-default":"price",h,h,h,"notshipped"===c||"downloaded"===c?"":r(w||(w=q` <foxy-internal-summary-control infer="appearance-group"> <foxy-internal-number-control placeholder="${0}" property="items.${0}.weight" layout="summary-item" suffix="${0}" infer="weight" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> `),f(null==d?void 0:d.default_weight),h,f(null==d?void 0:d.default_weight_unit)),h,(null==g?void 0:g.sub_enabled)?r(E||(E=q` <foxy-internal-frequency-control property="items.${0}.sub_frequency" layout="summary-item" infer="sub-frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-select-control property="items.${0}.sub_startdate_format" layout="summary-item" infer="sub-startdate-format" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-select-control property="items.${0}.sub_enddate_format" layout="summary-item" infer="sub-enddate-format" .options="${0}"> </foxy-internal-select-control> ${0} `),h,h,[{label:"option_none",value:"none"},{label:"option_yyyymmdd",value:"yyyymmdd"},{label:"option_dd",value:"dd"},{label:"option_duration",value:"duration"}],"yyyymmdd"===g.sub_startdate_format?r(S||(S=q` <foxy-internal-date-control property="items.${0}.sub_startdate" layout="summary-item" infer="sub-startdate-yyyymmdd"> </foxy-internal-date-control> `),h):"duration"===g.sub_startdate_format?r(j||(j=q` <foxy-internal-frequency-control property="items.${0}.sub_startdate" layout="summary-item" infer="sub-startdate-duration"> </foxy-internal-frequency-control> `),h):"dd"===g.sub_startdate_format?r(k||(k=q` <foxy-internal-number-control property="items.${0}.sub_startdate" layout="summary-item" infer="sub-startdate-dd" step="1" min="1" max="31"> </foxy-internal-number-control> `),h):"",h,[{label:"option_none",value:"none"},{label:"option_yyyymmdd",value:"yyyymmdd"},{label:"option_duration",value:"duration"}],"yyyymmdd"===g.sub_enddate_format?r(C||(C=q` <foxy-internal-date-control property="items.${0}.sub_enddate" layout="summary-item" infer="sub-enddate-yyyymmdd"> </foxy-internal-date-control> `),h):"duration"===g.sub_enddate_format?r(N||(N=q` <foxy-internal-frequency-control property="items.${0}.sub_enddate" layout="summary-item" infer="sub-enddate-duration"> </foxy-internal-frequency-control> `),h):""):"",h,"minutes"===(null==g?void 0:g.expires_format)?"":r(L||(L=q` <foxy-internal-number-control property="items.${0}.quantity_min" layout="summary-item" infer="quantity-min" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-number-control property="items.${0}.quantity_max" layout="summary-item" infer="quantity-max" step="1" min="1"> </foxy-internal-number-control> `),h,h),h,h,(null==g?void 0:g.discount_name)?r(M||(M=q` <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),{details:null!==(i=null==g?void 0:g.discount_details)&&void 0!==i?i:"",type:null!==(o=null==g?void 0:g.discount_type)&&void 0!==o?o:"amount_percentage",name:null!==(a=null==g?void 0:g.discount_name)&&void 0!==a?a:""},(e=>{this.__handleDiscountBuilderChange(e,g,h)})):"",h,(null==g?void 0:g.image)?r(R||(R=q` <foxy-internal-text-control property="items.${0}.url" layout="summary-item" infer="url"> </foxy-internal-text-control> `),h):"",h,[{label:"option_none",value:"none"},{label:"option_minutes",value:"minutes"},{label:"option_timestamp",value:"timestamp"}],"minutes"===(null==g?void 0:g.expires_format)?r(O||(O=q` <foxy-internal-number-control property="items.${0}.expires_value" layout="summary-item" suffix="min" infer="expires-value-minutes"> </foxy-internal-number-control> `),h):"timestamp"===(null==g?void 0:g.expires_format)?r(P||(P=q` <foxy-internal-date-control property="items.${0}.expires_value" layout="summary-item" format="unix" infer="expires-value-timestamp"> </foxy-internal-date-control> `),h):"","notshipped"===c||"downloaded"===c?"":r(T||(T=q` <foxy-internal-number-control property="items.${0}.length" layout="summary-item" suffix="${0}" infer="length" min="0"> </foxy-internal-number-control> <foxy-internal-number-control property="items.${0}.width" layout="summary-item" suffix="${0}" infer="width" min="0"> </foxy-internal-number-control> <foxy-internal-number-control property="items.${0}.height" layout="summary-item" suffix="${0}" infer="height" min="0"> </foxy-internal-number-control> `),h,f(null==d?void 0:d.default_length_unit),h,f(null==d?void 0:d.default_length_unit),h,f(null==d?void 0:d.default_length_unit)),null==m?void 0:m.virtualHost,h,{".defaultWeightUnit":null==d?void 0:d.default_weight_unit,".existingOptions":null!==(s=null==g?void 0:g.custom_options)&&void 0!==s?s:[],".itemCategories":this.itemCategories,".currencyCode":this.currencyCode},(null!==(u=null===(l=null==m?void 0:m.form.items)||void 0===l?void 0:l.length)&&void 0!==u?u:0)<=1?r(A||(A=q``)):r(I||(I=q` <vaadin-button theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="delete" key="caption"></foxy-i18n> </vaadin-button> `),this.disabled,(()=>this.dispatchEvent(new CustomEvent("remove")))),f(null==g?void 0:g.item_category_uri),(()=>this.requestUpdate()))}get __resolvedItemCategory(){var e,t;return null!==(t=null===(e=this.__itemCategoryLoader)||void 0===e?void 0:e.data)&&void 0!==t?t:this.defaultItemCategory}get __itemCategoryLoader(){return this.renderRoot.querySelector("#itemCategoryLoader")}__handleDiscountBuilderChange(e,t,n){var r;const i=e.currentTarget,o=this.nucleon;t.discount_details=i.parsedValue.details,t.discount_type=i.parsedValue.type,t.discount_name=i.parsedValue.name;const a=null!==(r=null==o?void 0:o.form.items)&&void 0!==r?r:[];a.splice(n,1,t),null==o||o.edit({items:[...a]})}});const D=new WeakMap,H=i((e=>t=>{if(!(t instanceof o))throw new Error("unsafeHTML can only be used in text bindings");const n=D.get(t);if(void 0!==n&&a(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template");r.innerHTML=e;const i=document.importNode(r.content,!0);t.setValue(i),D.set(t,{value:e,fragment:i})}));
2
2
  /**
3
3
  * @license
4
4
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -1 +1 @@
1
- import"./shared-79f84a95.js";import"./shared-2edce408.js";import"./shared-0564def4.js";import"./shared-6aa8f7ee.js";import"./shared-8df437b0.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-nucleon-element.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-fefaece7.js";import{T as i}from"./shared-8874ec69.js";import{i as a}from"./shared-53e42a77.js";import{h as d}from"./shared-ba5c42c7.js";import"./shared-f0afd1ee.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-4e709717.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5cea7ef0.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-05ed8288.js";import"./shared-6524d421.js";import"./shared-df76d498.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";let n,l=e=>e;const m=s(e,"gift-card-code-form");class c extends m{constructor(){super(...arguments),this.getTransactionPageHref=null,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.__cartItemGetItemUrl=(e,r)=>{var t;let o=null;try{const e=null==r?void 0:r._links["fx:transaction"].href;e&&(o=null===(t=this.getTransactionPageHref)||void 0===t?void 0:t.call(this,e))}catch(e){console.log(e)}return null!=o?o:null},this.__customerGetValue=()=>{var e,r,t;const o=null===(t=null===(r=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===r?void 0:r["fx:customer"])||void 0===t?void 0:t.href,s=this.form.customer_id;return void 0===s?o:this.getCustomerHref(s)},this.__customerSetValue=e=>{const r=o(e);this.edit({customer_id:"number"==typeof r?r:""})},this.__customerFilters=[{type:i.String,path:"id",label:"filters.id"},{type:i.String,path:"tax_id",label:"filters.tax_id"},{type:i.String,path:"email",label:"filters.email"},{type:i.String,path:"first_name",label:"filters.first_name"},{type:i.String,path:"last_name",label:"filters.last_name"},{type:i.Boolean,path:"is_anonymous",label:"filters.is_anonymous",list:[{label:"filters.is_anonymous_true",value:"true"},{label:"filters.is_anonymous_false",value:"false"}]},{type:i.Date,path:"last_login_date",label:"filters.last_login_date"},{type:i.Date,path:"date_created",label:"filters.date_created"},{type:i.Date,path:"date_modified",label:"filters.date_modified"}],this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerHref:{attribute:!1}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>!e||e.length<=50||"code:v8n_too_long",({code:e})=>!(null==e?void 0:e.includes(" "))||"code:v8n_has_spaces",({current_balance:e})=>"number"==typeof e||"current-balance:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString(),"cart-item"];return new t(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.href||e.push("customer","cart-item","logs"),new t(e.join(" ").trim())}renderBody(){var e,r,t,o,s,i,m,c;let f;try{const o=new URL(null!==(t=null===(r=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===r?void 0:r["fx:provisioned_by_transaction_detail_id"].href)&&void 0!==t?t:"");o.searchParams.set("zoom","item_options"),f=o.toString()}catch(e){f=void 0}return d(n||(n=l` ${0} <foxy-internal-summary-control infer="settings"> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="current-balance"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-resource-picker-control infer="customer" first="${0}" item="foxy-customer-card" .getValue="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control infer="cart-item" item="foxy-item-card" .getItemUrl="${0}" .getValue="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-async-list-control infer="logs" first="${0}" limit="5" item="foxy-gift-card-code-log-card"> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),a(null===(s=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===s?void 0:s._links["fx:customers"].href),this.__customerGetValue,this.__customerSetValue,this.__customerFilters,this.__cartItemGetItemUrl,(()=>f),a(null===(m=null===(i=this.data)||void 0===i?void 0:i._links)||void 0===m?void 0:m["fx:gift_card_code_logs"].href),super.renderBody(),a(null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-code-form",c);export{c as GiftCardCodeForm};
1
+ import"./shared-79f84a95.js";import"./shared-2edce408.js";import"./shared-0564def4.js";import"./shared-6aa8f7ee.js";import"./shared-a42e4325.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-nucleon-element.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-fefaece7.js";import{T as a}from"./shared-8874ec69.js";import{i}from"./shared-53e42a77.js";import{h as d}from"./shared-ba5c42c7.js";import"./shared-f0afd1ee.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-4e709717.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5cea7ef0.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-05ed8288.js";import"./shared-6524d421.js";import"./shared-df76d498.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";let n,l=e=>e;const m=s(e,"gift-card-code-form");class c extends m{constructor(){super(...arguments),this.getTransactionPageHref=null,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.__cartItemGetItemUrl=(e,r)=>{var t;let o=null;try{const e=null==r?void 0:r._links["fx:transaction"].href;e&&(o=null===(t=this.getTransactionPageHref)||void 0===t?void 0:t.call(this,e))}catch(e){console.log(e)}return null!=o?o:null},this.__customerGetValue=()=>{var e,r,t;const o=null===(t=null===(r=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===r?void 0:r["fx:customer"])||void 0===t?void 0:t.href,s=this.form.customer_id;return void 0===s?o:this.getCustomerHref(s)},this.__customerSetValue=e=>{const r=o(e);this.edit({customer_id:"number"==typeof r?r:""})},this.__customerFilters=[{type:a.String,path:"id",label:"filters.id"},{type:a.String,path:"tax_id",label:"filters.tax_id"},{type:a.String,path:"email",label:"filters.email"},{type:a.String,path:"first_name",label:"filters.first_name"},{type:a.String,path:"last_name",label:"filters.last_name"},{type:a.Boolean,path:"is_anonymous",label:"filters.is_anonymous",list:[{label:"filters.is_anonymous_true",value:"true"},{label:"filters.is_anonymous_false",value:"false"}]},{type:a.Date,path:"last_login_date",label:"filters.last_login_date"},{type:a.Date,path:"date_created",label:"filters.date_created"},{type:a.Date,path:"date_modified",label:"filters.date_modified"}],this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerHref:{attribute:!1}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>!e||e.length<=50||"code:v8n_too_long",({code:e})=>!(null==e?void 0:e.includes(" "))||"code:v8n_has_spaces",({current_balance:e})=>"number"==typeof e||"current-balance:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString(),"cart-item"];return new t(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.href||e.push("customer","cart-item","logs"),new t(e.join(" ").trim())}renderBody(){var e,r,t,o,s,a,m,c;let f;try{const o=new URL(null!==(t=null===(r=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===r?void 0:r["fx:provisioned_by_transaction_detail_id"].href)&&void 0!==t?t:"");o.searchParams.set("zoom","item_options"),f=o.toString()}catch(e){f=void 0}return d(n||(n=l` ${0} <foxy-internal-summary-control infer="settings"> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="current-balance"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-resource-picker-control infer="customer" first="${0}" item="foxy-customer-card" .getValue="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control infer="cart-item" item="foxy-item-card" .getItemUrl="${0}" .getValue="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-async-list-control infer="logs" first="${0}" limit="5" item="foxy-gift-card-code-log-card"> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),i(null===(s=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===s?void 0:s._links["fx:customers"].href),this.__customerGetValue,this.__customerSetValue,this.__customerFilters,this.__cartItemGetItemUrl,(()=>f),i(null===(m=null===(a=this.data)||void 0===a?void 0:a._links)||void 0===m?void 0:m["fx:gift_card_code_logs"].href),super.renderBody(),i(null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-code-form",c);export{c as GiftCardCodeForm};
@@ -1 +1 @@
1
- import"./shared-6660c6df.js";import"./shared-8f6400d9.js";import"./shared-1fcf3749.js";import"./shared-2edce408.js";import"./shared-e1b97b27.js";import"./shared-0564def4.js";import"./shared-c5fa5c92.js";import"./shared-70bd1896.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-gift-card-code-card.js";import"./foxy-gift-card-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{T as i}from"./shared-8874ec69.js";import{h as o}from"./shared-ba5c42c7.js";import{R as s,a}from"./shared-fefaece7.js";import{i as n}from"./shared-53e42a77.js";import"./shared-5cea7ef0.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-f0afd1ee.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-00b50480.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./shared-4e709717.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-swipe-actions.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-b15d45b1.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-47962c3f.js";import"./shared-79f84a95.js";import"./shared-8df437b0.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";import"./shared-1c6a1571.js";const d=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let l,c,f=e=>e;const m=s(a(e,"gift-card-form"));class p extends m{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.codesFilter=null,this.__provisioningMaxBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_max},this.__provisioningMaxBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:i>e?e:i,initial_balance_max:e}})},this.__provisioningMinBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_min},this.__provisioningMinBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_max)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:i<e?e:i}})},this.__provisioningToggleValueGetter=()=>{var e;return!!(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)},this.__provisioningToggleValueSetter=e=>{var r,t,i,o;e?this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:0,initial_balance_max:null!==(o=null===(i=this.form.provisioning_config)||void 0===i?void 0:i.initial_balance_max)&&void 0!==o?o:0}}):this.edit({provisioning_config:null})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:r})=>"block"===r?`-${e}`:e)).filter(((e,r,t)=>!!e&&t.indexOf(e)===r)).join(",")})},this.__currencyCodeGetValue=()=>{var e;return null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase()},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:i.String},{label:"current_balance",path:"current_balance",type:i.Number},{label:"end_date",path:"end_date",type:i.Date},{label:"date_created",path:"date_created",type:i.Date},{label:"date_modified",path:"date_modified",type:i.Date}],this.__codesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(r){e.__codesActions[0].state="busy",e.__codesActions=[...e.__codesActions];try{await navigator.clipboard.writeText(r.code),e.__codesActions[0].state="end"}catch(r){e.__codesActions[0].state="error"}finally{e.__codesActions=[...e.__codesActions],setTimeout((()=>{e.__codesActions[0].state="idle",e.__codesActions=[...e.__codesActions]}),1e3)}}}]}static get properties(){return r(r({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerHref:{attribute:!1},codesFilter:{attribute:"codes-filter"}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",e=>{var r;if(null===(r=e.provisioning_config)||void 0===r?void 0:r.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_min;return!("number"==typeof t&&t<0)||"min-balance:v8n_negative"},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_max;return!("number"==typeof t&&t<0)||"max-balance:v8n_negative"},({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long"]}get hiddenSelector(){var e;const r=[super.hiddenSelector.toString()];return this.data||r.push("codes","category-restrictions","attributes"),(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)||r.push("provisioning:sku","provisioning:min-balance","provisioning:max-balance"),new t(r.join(" ").trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeaderActions(e){return o(l||(l=f` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-gift-card-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:gift_card_codes"].href],e._links["fx:gift_card_codes"].href,[e._links["fx:gift_card_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,r,t,i,s,a,l,m,p,u,_;let h;try{const t=new URL(null!==(r=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_codes"].href)&&void 0!==r?r:"");t.searchParams.set("order","date_created desc"),h=t.toString()}catch(e){h=void 0}return o(c||(c=f` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"> </foxy-internal-text-control> <foxy-internal-select-control property="currency_code" layout="summary-item" infer="currency" .getValue="${0}" .options="${0}"> </foxy-internal-select-control> <foxy-internal-frequency-control property="expires_after" layout="summary-item" infer="expires"> </foxy-internal-frequency-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="provisioning"> <foxy-internal-switch-control infer="toggle" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="sku"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="min-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="max-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-async-list-control filter="${0}" first="${0}" limit="5" infer="codes" item="foxy-gift-card-code-card" form="foxy-gift-card-code-form" alert .actions="${0}" .filters="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="gift_card_uri" options-href="${0}" links-href="${0}" embed-key="fx:gift_card_item_categories" own-uri="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__currencyCodeGetValue,d.map((e=>({label:this.t(`general.currency.code_${e}`),value:e}))),this.__provisioningToggleValueGetter,this.__provisioningToggleValueSetter,n(null===(t=this.form.currency_code)||void 0===t?void 0:t.toUpperCase()),this.__provisioningMinBalanceValueGetter,this.__provisioningMinBalanceValueSetter,n(null===(i=this.form.currency_code)||void 0===i?void 0:i.toUpperCase()),this.__provisioningMaxBalanceValueGetter,this.__provisioningMaxBalanceValueSetter,n(null!==(s=this.codesFilter)&&void 0!==s?s:void 0),h,this.__codesActions,this.__codesFilters,{".getTransactionPageHref":this.getTransactionPageHref,".getCustomerHref":this.getCustomerHref},this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],n(null===(l=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:item_categories"].href),n(null===(m=this.data)||void 0===m?void 0:m._links["fx:gift_card_item_categories"].href),n(null===(p=this.data)||void 0===p?void 0:p._links.self.href),n(null===(u=this.data)||void 0===u?void 0:u._links["fx:attributes"].href),super.renderBody(),n(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-form",p);export{p as GiftCardForm};
1
+ import"./shared-6660c6df.js";import"./shared-8f6400d9.js";import"./shared-1fcf3749.js";import"./shared-2edce408.js";import"./shared-e1b97b27.js";import"./shared-0564def4.js";import"./shared-c5fa5c92.js";import"./shared-70bd1896.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-gift-card-code-card.js";import"./foxy-gift-card-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{T as i}from"./shared-8874ec69.js";import{h as o}from"./shared-ba5c42c7.js";import{R as s,a}from"./shared-fefaece7.js";import{i as n}from"./shared-53e42a77.js";import"./shared-5cea7ef0.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-f0afd1ee.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-00b50480.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./shared-4e709717.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-swipe-actions.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-b15d45b1.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-47962c3f.js";import"./shared-79f84a95.js";import"./shared-a42e4325.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";import"./shared-1c6a1571.js";const d=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let l,c,f=e=>e;const m=s(a(e,"gift-card-form"));class p extends m{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.codesFilter=null,this.__provisioningMaxBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_max},this.__provisioningMaxBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:i>e?e:i,initial_balance_max:e}})},this.__provisioningMinBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_min},this.__provisioningMinBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_max)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:i<e?e:i}})},this.__provisioningToggleValueGetter=()=>{var e;return!!(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)},this.__provisioningToggleValueSetter=e=>{var r,t,i,o;e?this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:0,initial_balance_max:null!==(o=null===(i=this.form.provisioning_config)||void 0===i?void 0:i.initial_balance_max)&&void 0!==o?o:0}}):this.edit({provisioning_config:null})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:r})=>"block"===r?`-${e}`:e)).filter(((e,r,t)=>!!e&&t.indexOf(e)===r)).join(",")})},this.__currencyCodeGetValue=()=>{var e;return null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase()},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:i.String},{label:"current_balance",path:"current_balance",type:i.Number},{label:"end_date",path:"end_date",type:i.Date},{label:"date_created",path:"date_created",type:i.Date},{label:"date_modified",path:"date_modified",type:i.Date}],this.__codesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(r){e.__codesActions[0].state="busy",e.__codesActions=[...e.__codesActions];try{await navigator.clipboard.writeText(r.code),e.__codesActions[0].state="end"}catch(r){e.__codesActions[0].state="error"}finally{e.__codesActions=[...e.__codesActions],setTimeout((()=>{e.__codesActions[0].state="idle",e.__codesActions=[...e.__codesActions]}),1e3)}}}]}static get properties(){return r(r({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerHref:{attribute:!1},codesFilter:{attribute:"codes-filter"}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",e=>{var r;if(null===(r=e.provisioning_config)||void 0===r?void 0:r.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_min;return!("number"==typeof t&&t<0)||"min-balance:v8n_negative"},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_max;return!("number"==typeof t&&t<0)||"max-balance:v8n_negative"},({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long"]}get hiddenSelector(){var e;const r=[super.hiddenSelector.toString()];return this.data||r.push("codes","category-restrictions","attributes"),(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)||r.push("provisioning:sku","provisioning:min-balance","provisioning:max-balance"),new t(r.join(" ").trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeaderActions(e){return o(l||(l=f` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-gift-card-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:gift_card_codes"].href],e._links["fx:gift_card_codes"].href,[e._links["fx:gift_card_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,r,t,i,s,a,l,m,p,u,_;let h;try{const t=new URL(null!==(r=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_codes"].href)&&void 0!==r?r:"");t.searchParams.set("order","date_created desc"),h=t.toString()}catch(e){h=void 0}return o(c||(c=f` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"> </foxy-internal-text-control> <foxy-internal-select-control property="currency_code" layout="summary-item" infer="currency" .getValue="${0}" .options="${0}"> </foxy-internal-select-control> <foxy-internal-frequency-control property="expires_after" layout="summary-item" infer="expires"> </foxy-internal-frequency-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="provisioning"> <foxy-internal-switch-control infer="toggle" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="sku"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="min-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="max-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-async-list-control filter="${0}" first="${0}" limit="5" infer="codes" item="foxy-gift-card-code-card" form="foxy-gift-card-code-form" alert .actions="${0}" .filters="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="gift_card_uri" options-href="${0}" links-href="${0}" embed-key="fx:gift_card_item_categories" own-uri="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__currencyCodeGetValue,d.map((e=>({label:this.t(`general.currency.code_${e}`),value:e}))),this.__provisioningToggleValueGetter,this.__provisioningToggleValueSetter,n(null===(t=this.form.currency_code)||void 0===t?void 0:t.toUpperCase()),this.__provisioningMinBalanceValueGetter,this.__provisioningMinBalanceValueSetter,n(null===(i=this.form.currency_code)||void 0===i?void 0:i.toUpperCase()),this.__provisioningMaxBalanceValueGetter,this.__provisioningMaxBalanceValueSetter,n(null!==(s=this.codesFilter)&&void 0!==s?s:void 0),h,this.__codesActions,this.__codesFilters,{".getTransactionPageHref":this.getTransactionPageHref,".getCustomerHref":this.getCustomerHref},this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],n(null===(l=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:item_categories"].href),n(null===(m=this.data)||void 0===m?void 0:m._links["fx:gift_card_item_categories"].href),n(null===(p=this.data)||void 0===p?void 0:p._links.self.href),n(null===(u=this.data)||void 0===u?void 0:u._links["fx:attributes"].href),super.renderBody(),n(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-form",p);export{p as GiftCardForm};
@@ -1 +1 @@
1
- import"./shared-79f84a95.js";import"./shared-2edce408.js";import"./shared-e1b97b27.js";import"./shared-0564def4.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import"./shared-8df437b0.js";import{I as t}from"./shared-edb68eb7.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as e,B as r}from"./shared-d1195c27.js";import{a as o}from"./shared-fefaece7.js";import{i}from"./shared-53e42a77.js";import{c as n}from"./shared-4e709717.js";import{h as s}from"./shared-ba5c42c7.js";import"./shared-f0afd1ee.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-bab2ea2c.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5cea7ef0.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-d0aed1c1.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-5212ef4f.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-63c32024.js";import"./shared-1c6a1571.js";import"./shared-b15d45b1.js";let a,l=t=>t;class m extends(o(t,"item-form")){constructor(){super(...arguments),this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.coupons=null,this.store=null,this.__itemsLink=""}static get properties(){return e(e({},super.properties),{},{customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},coupons:{},store:{}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!!t&&t.length<=255||"name:v8n_too_long",({price:t})=>"number"==typeof t&&!isNaN(t)||"price:v8n_required",({price:t})=>"number"==typeof t&&t>=0||"price:v8n_negative",({quantity:t})=>"number"==typeof t&&t>=1||"quantity:v8n_less_than_one"]}get headerSubtitleOptions(){var t;return{context:(null===(t=this.data)||void 0===t?void 0:t.is_future_line_item)?"future_line_item":"regular"}}get readonlySelector(){const t=[super.readonlySelector.toString()];return this.href&&t.unshift("subscriptions"),new r(t.join(" ").trim())}get hiddenSelector(){var t,e;const o=[super.hiddenSelector.toString()];return(null===(e=null===(t=this.__storeLoader)||void 0===t?void 0:t.data)||void 0===e?void 0:e.features_multiship)||o.unshift("general:shipto"),this.data&&!this.data.subscription_frequency&&o.unshift("subscriptions"),this.form.discount_name||o.unshift("discount:discount-builder"),this.href||o.unshift("discount-details","coupon-details","item-options","attributes"),new r(o.join(" ").trim())}renderBody(){var t,e,r,o,m,d,f;return s(a||(a=l` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="price" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="parent-code"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="shipto"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="subscriptions"> <foxy-internal-frequency-control layout="summary-item" infer="subscription-frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="subscription-start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="subscription-end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="item-options" first="${0}" form="foxy-item-option-form" item="foxy-item-option-card" alert .related="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="dimensions"> <foxy-internal-number-control layout="summary-item" infer="weight" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="length" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="width" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="height" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="meta"> <foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="image"> </foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="quantity-max" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity-min" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" infer="expires" format="unix"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="discount"> <foxy-internal-text-control layout="summary-item" infer="discount-name"> </foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" class="${0}" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="discount-details" first="${0}" item="foxy-discount-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="coupon-details" first="${0}" item="foxy-coupon-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),i(null!==(t=null==this?void 0:this.itemCategories)&&void 0!==t?t:void 0),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:item_options"].href),this.__itemOptionRelatedUrls,{"locale-codes":null!==(r=this.localeCodes)&&void 0!==r?r:""},n({hidden:this.hiddenSelector.matches("discount-builder",!0)}),this.__discountBuilderParsedValue,this.__handleDiscountBuilderChange,i(null===(o=this.data)||void 0===o?void 0:o._links["fx:discount_details"].href),i(null===(m=this.data)||void 0===m?void 0:m._links["fx:coupon_details"].href),i(null===(d=this.data)||void 0===d?void 0:d._links["fx:attributes"].href),super.renderBody(),i(null!==(f=this.store)&&void 0!==f?f:void 0),(()=>this.requestUpdate()))}async _sendGet(){const t=await super._sendGet();if(t._links["fx:subscription"]){const e=t._links["fx:subscription"].href,r=(await super._fetch(e))._links["fx:transaction_template"].href,o=await super._fetch(r);return this.__itemsLink=o._links["fx:items"].href,t}if(t._links["fx:transaction"]){const e=await super._fetch(t._links["fx:transaction"].href);return this.__itemsLink=e._links["fx:items"].href,t}if(t._links["fx:cart"]){const e=await super._fetch(t._links["fx:cart"].href);return this.__itemsLink=e._links["fx:items"].href,t}return t}get __discountBuilderParsedValue(){return{details:this.form.discount_details,type:this.form.discount_type,name:this.form.discount_name}}get __itemOptionRelatedUrls(){var t,e;const r=null!==(e=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==e?e:{},o=[];return r["fx:subscription"]&&o.push(r["fx:subscription"].href),r["fx:transaction"]&&o.push(r["fx:transaction"].href),r["fx:shipment"]&&o.push(r["fx:shipment"].href),r["fx:cart"]&&o.push(r["fx:cart"].href),this.__itemsLink&&o.push(this.__itemsLink),o}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}__handleDiscountBuilderChange(t){const e=t.currentTarget.parsedValue;this.edit({discount_details:e.details,discount_type:e.type,discount_name:e.name})}}customElements.define("foxy-item-form",m);export{m as ItemForm};
1
+ import"./shared-79f84a95.js";import"./shared-2edce408.js";import"./shared-e1b97b27.js";import"./shared-0564def4.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import"./shared-a42e4325.js";import{I as t}from"./shared-edb68eb7.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as e,B as r}from"./shared-d1195c27.js";import{a as o}from"./shared-fefaece7.js";import{i}from"./shared-53e42a77.js";import{c as n}from"./shared-4e709717.js";import{h as s}from"./shared-ba5c42c7.js";import"./shared-f0afd1ee.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-bab2ea2c.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5cea7ef0.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-d0aed1c1.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-5212ef4f.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-63c32024.js";import"./shared-1c6a1571.js";import"./shared-b15d45b1.js";let a,l=t=>t;class m extends(o(t,"item-form")){constructor(){super(...arguments),this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.coupons=null,this.store=null,this.__itemsLink=""}static get properties(){return e(e({},super.properties),{},{customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},coupons:{},store:{}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!!t&&t.length<=255||"name:v8n_too_long",({price:t})=>"number"==typeof t&&!isNaN(t)||"price:v8n_required",({price:t})=>"number"==typeof t&&t>=0||"price:v8n_negative",({quantity:t})=>"number"==typeof t&&t>=1||"quantity:v8n_less_than_one"]}get headerSubtitleOptions(){var t;return{context:(null===(t=this.data)||void 0===t?void 0:t.is_future_line_item)?"future_line_item":"regular"}}get readonlySelector(){const t=[super.readonlySelector.toString()];return this.href&&t.unshift("subscriptions"),new r(t.join(" ").trim())}get hiddenSelector(){var t,e;const o=[super.hiddenSelector.toString()];return(null===(e=null===(t=this.__storeLoader)||void 0===t?void 0:t.data)||void 0===e?void 0:e.features_multiship)||o.unshift("general:shipto"),this.data&&!this.data.subscription_frequency&&o.unshift("subscriptions"),this.form.discount_name||o.unshift("discount:discount-builder"),this.href||o.unshift("discount-details","coupon-details","item-options","attributes"),new r(o.join(" ").trim())}renderBody(){var t,e,r,o,m,d,f;return s(a||(a=l` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="price" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="parent-code"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="shipto"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="subscriptions"> <foxy-internal-frequency-control layout="summary-item" infer="subscription-frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="subscription-start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="subscription-end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="item-options" first="${0}" form="foxy-item-option-form" item="foxy-item-option-card" alert .related="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="dimensions"> <foxy-internal-number-control layout="summary-item" infer="weight" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="length" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="width" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="height" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="meta"> <foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="image"> </foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="quantity-max" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity-min" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" infer="expires" format="unix"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="discount"> <foxy-internal-text-control layout="summary-item" infer="discount-name"> </foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" class="${0}" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="discount-details" first="${0}" item="foxy-discount-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="coupon-details" first="${0}" item="foxy-coupon-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),i(null!==(t=null==this?void 0:this.itemCategories)&&void 0!==t?t:void 0),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:item_options"].href),this.__itemOptionRelatedUrls,{"locale-codes":null!==(r=this.localeCodes)&&void 0!==r?r:""},n({hidden:this.hiddenSelector.matches("discount-builder",!0)}),this.__discountBuilderParsedValue,this.__handleDiscountBuilderChange,i(null===(o=this.data)||void 0===o?void 0:o._links["fx:discount_details"].href),i(null===(m=this.data)||void 0===m?void 0:m._links["fx:coupon_details"].href),i(null===(d=this.data)||void 0===d?void 0:d._links["fx:attributes"].href),super.renderBody(),i(null!==(f=this.store)&&void 0!==f?f:void 0),(()=>this.requestUpdate()))}async _sendGet(){const t=await super._sendGet();if(t._links["fx:subscription"]){const e=t._links["fx:subscription"].href,r=(await super._fetch(e))._links["fx:transaction_template"].href,o=await super._fetch(r);return this.__itemsLink=o._links["fx:items"].href,t}if(t._links["fx:transaction"]){const e=await super._fetch(t._links["fx:transaction"].href);return this.__itemsLink=e._links["fx:items"].href,t}if(t._links["fx:cart"]){const e=await super._fetch(t._links["fx:cart"].href);return this.__itemsLink=e._links["fx:items"].href,t}return t}get __discountBuilderParsedValue(){return{details:this.form.discount_details,type:this.form.discount_type,name:this.form.discount_name}}get __itemOptionRelatedUrls(){var t,e;const r=null!==(e=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==e?e:{},o=[];return r["fx:subscription"]&&o.push(r["fx:subscription"].href),r["fx:transaction"]&&o.push(r["fx:transaction"].href),r["fx:shipment"]&&o.push(r["fx:shipment"].href),r["fx:cart"]&&o.push(r["fx:cart"].href),this.__itemsLink&&o.push(this.__itemsLink),o}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}__handleDiscountBuilderChange(t){const e=t.currentTarget.parsedValue;this.edit({discount_details:e.details,discount_type:e.type,discount_name:e.name})}}customElements.define("foxy-item-form",m);export{m as ItemForm};
@@ -1 +1 @@
1
- import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-bb43f0ad.js";import"./shared-2edce408.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import{b as e,I as t}from"./shared-edb68eb7.js";import"./shared-f0afd1ee.js";import"./shared-a208ae8c.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-ba5c42c7.js";import{N as n}from"./shared-d1dfac4d.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{g as a}from"./shared-bab2ea2c.js";import{i as d}from"./shared-53e42a77.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-fefaece7.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-b7889b37.js";import"./shared-00b50480.js";import"./shared-944dc1e2.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-1c6a1571.js";import"./shared-256fe764.js";import"./shared-00cd0e86.js";import"./shared-c3fd2e9c.js";import"./shared-b15d45b1.js";import"./shared-5fd5805c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-31b98ac2.js";import"./shared-5cea7ef0.js";import"./shared-e4159eb9.js";import"./shared-641786b2.js";import"./shared-cf613436.js";import"./shared-7ab454fb.js";import"./shared-82614ac9.js";import"./shared-4215bff2.js";import"./shared-a3f1420c.js";import"./shared-355ef444.js";import"./shared-c5fa5c92.js";import"./shared-b4b9735c.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-b293a928.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-6042ee79.js";import"./shared-79f84a95.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-e1b97b27.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-6aa8f7ee.js";import"./shared-8df437b0.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let f,p=e=>e;customElements.define("foxy-internal-transaction-post-action-control",class extends e{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return o(o({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return r(f||(f=p` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(e=>!e.detail.cancelled&&this.__submit()),t,"busy"===e||this.disabled,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),e)}async __submit(){var e;if("busy"!==this.__state)try{this.__state="busy";const t=new n.API(this),o=await t.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(e){this.__state="fail"}}});let m,h,_,y,v=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return o(o({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,i;const n=this.nucleon,c=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=c?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),l({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),d(u),d(c),this.__renderCopyAction(s(h||(h=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(a(c)):""),this.__renderCopyAction(s(_||(_=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(i=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==i?i:""))}__renderCopyAction(e,t,o,i){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return r(y||(y=v` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(i,o)),(e=>"idle"!==s&&e.stopPropagation()),(e=>"idle"!==s&&e.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),e,t,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let x,b,g,j,w,k,$,S=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var e,t,o,i,s,n,a,d,l,c,u,f;return r(x||(x=S` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} ${0} </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"",(null===(f=null===(u=this.nucleon)||void 0===u?void 0:u.data)||void 0===f?void 0:f._links["fx:receipt"])?this.__renderReceiptAction():"")}__renderSendEmailsAction(){var e,t;return r(b||(b=S` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return r(g||(g=S` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,o;return r(j||(j=S` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o;return r(w||(w=S` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const i=this.nucleon,s=null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==i?void 0:i.getSubscriptionPageHref)||void 0===o?void 0:o.call(i,s):void 0;return r(k||(k=S` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),d(n))}__renderReceiptAction(){var e,t;const o=this.nucleon;return r($||($=S` <a target="_blank" class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="receipt" key="caption"></foxy-i18n> </a> `),d(null===(t=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e._links["fx:receipt"])||void 0===t?void 0:t.href))}});let P,A,C,H,L,E,R,I,B,q,G=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,i,s,n,a,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return r(P||(P=G``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],p=null!==(s=null===(i=u._embedded)||void 0===i?void 0:i["fx:shipments"])&&void 0!==s?s:[];return r(A||(A=G` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?r(C||(C=G` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>r(H||(H=G` <span>${0}&colon;</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?r(L||(L=G` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>r(E||(E=G` <span>${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(a=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:applied_gift_card_codes"])||void 0===a?void 0:a.map((e=>{var t;return r(R||(R=G` <span>${0}&colon;</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((e=>r(I||(I=G` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,i,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===s?void 0:s.currency_code;return r(B||(B=G` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let i="";return i=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",r(q||(q=G` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),i,o)}});let T,U,Z,M=e=>e;const O=c(u(t,"transaction"));class W extends O{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const o=e.data._links["fx:send_webhooks"].href,i=new W.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>a(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{W.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!r.ok)throw new Error(await r.text())}}]}static get properties(){return o(o({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])||r.push("items","attributes","custom-fields"),new i(r.join(" ").trim())}get hiddenSelector(){var e,t,o,r;const s=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||s.unshift("subscription"),"subscription_modification"===n&&s.unshift("actions"),"updateinfo"===n&&s.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&s.unshift("not=customer,subscription,custom-fields,attributes"),(null===(r=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===r?void 0:r.use_webhook)||s.unshift("datafeed"),new i(s.join(" ").trim())}get headerSubtitleOptions(){var e,t,o,i,r;const s=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===s?"admin_changed_payment_method_with_uoe":"mit_api"===s?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===s?"admin_changed_subscription_with_uoe":"mit_api"===s?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===s?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===s?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===s&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===s?a="customer_canceled_subscription":"mit_recurring_cancellation"===s&&(a="admin_canceled_subscription"):(null===(o=this.data)||void 0===o?void 0:o._links["fx:subscription"])?(null==s?void 0:s.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===s?a="admin_subscribed_with_uoe":"mit_api"===s&&(a="integration_subscribed"):(null==s?void 0:s.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===s?a="admin_placed_order_with_uoe":"mit_api"===s&&(a="integration_placed_order"),{transaction_date:null===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(T||(T=M` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,o,i,s,n,a,l,c,u,f,p,m,h,_,y;let v,x,b;const g=this.hiddenSelector;if(this.data)try{const i=new URL(this.data._links["fx:shipments"].href),r=new URL(null!==(o=null===(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:webhooks"].href)&&void 0!==o?o:""),s=new URL(this.data._links["fx:items"].href);i.searchParams.set("zoom","items:item_category"),r.searchParams.set("event_resource","transaction"),s.searchParams.set("zoom","item_options"),v=i.toString(),x=r.toString(),b=s.toString()}catch(e){}return r(U||(U=M` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-transaction-post-action-control infer="process-webhook" href="${0}"> </foxy-internal-transaction-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(s=null===(i=this.data)||void 0===i?void 0:i.status)&&void 0!==s?s:"")?r(Z||(Z=M` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(n=this.data)||void 0===n?void 0:n.status):"",g.matches("items",!0)&&g.matches("summary",!0),d(b),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(l=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href},d(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),d(null===(f=this.data)||void 0===f?void 0:f._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},d(null===(p=this.data)||void 0===p?void 0:p._links["fx:custom_fields"].href),d(null===(m=this.data)||void 0===m?void 0:m._links["fx:attributes"].href),d(v),d(x),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(_=null===(h=this.data)||void 0===h?void 0:h._links["fx:process_webhook"])||void 0===_?void 0:_.href),d(null===(y=this.data)||void 0===y?void 0:y._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",W);export{W as Transaction};
1
+ import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-bb43f0ad.js";import"./shared-2edce408.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import{b as e,I as t}from"./shared-edb68eb7.js";import"./shared-f0afd1ee.js";import"./shared-a208ae8c.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-ba5c42c7.js";import{N as n}from"./shared-d1dfac4d.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{g as a}from"./shared-bab2ea2c.js";import{i as d}from"./shared-53e42a77.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-fefaece7.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-b7889b37.js";import"./shared-00b50480.js";import"./shared-944dc1e2.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-1c6a1571.js";import"./shared-256fe764.js";import"./shared-00cd0e86.js";import"./shared-c3fd2e9c.js";import"./shared-b15d45b1.js";import"./shared-5fd5805c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-31b98ac2.js";import"./shared-5cea7ef0.js";import"./shared-e4159eb9.js";import"./shared-641786b2.js";import"./shared-cf613436.js";import"./shared-7ab454fb.js";import"./shared-82614ac9.js";import"./shared-4215bff2.js";import"./shared-a3f1420c.js";import"./shared-355ef444.js";import"./shared-c5fa5c92.js";import"./shared-b4b9735c.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-b293a928.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-6042ee79.js";import"./shared-79f84a95.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-e1b97b27.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-6aa8f7ee.js";import"./shared-a42e4325.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let f,p=e=>e;customElements.define("foxy-internal-transaction-post-action-control",class extends e{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return o(o({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return r(f||(f=p` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(e=>!e.detail.cancelled&&this.__submit()),t,"busy"===e||this.disabled,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),e)}async __submit(){var e;if("busy"!==this.__state)try{this.__state="busy";const t=new n.API(this),o=await t.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(e){this.__state="fail"}}});let m,h,_,y,v=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return o(o({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,i;const n=this.nucleon,c=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=c?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),l({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),d(u),d(c),this.__renderCopyAction(s(h||(h=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(a(c)):""),this.__renderCopyAction(s(_||(_=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(i=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==i?i:""))}__renderCopyAction(e,t,o,i){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return r(y||(y=v` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(i,o)),(e=>"idle"!==s&&e.stopPropagation()),(e=>"idle"!==s&&e.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),e,t,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let x,b,g,j,w,k,$,S=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var e,t,o,i,s,n,a,d,l,c,u,f;return r(x||(x=S` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} ${0} </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"",(null===(f=null===(u=this.nucleon)||void 0===u?void 0:u.data)||void 0===f?void 0:f._links["fx:receipt"])?this.__renderReceiptAction():"")}__renderSendEmailsAction(){var e,t;return r(b||(b=S` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return r(g||(g=S` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,o;return r(j||(j=S` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o;return r(w||(w=S` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const i=this.nucleon,s=null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==i?void 0:i.getSubscriptionPageHref)||void 0===o?void 0:o.call(i,s):void 0;return r(k||(k=S` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),d(n))}__renderReceiptAction(){var e,t;const o=this.nucleon;return r($||($=S` <a target="_blank" class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="receipt" key="caption"></foxy-i18n> </a> `),d(null===(t=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e._links["fx:receipt"])||void 0===t?void 0:t.href))}});let P,A,C,H,L,E,R,I,B,q,G=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,i,s,n,a,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return r(P||(P=G``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],p=null!==(s=null===(i=u._embedded)||void 0===i?void 0:i["fx:shipments"])&&void 0!==s?s:[];return r(A||(A=G` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?r(C||(C=G` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>r(H||(H=G` <span>${0}&colon;</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?r(L||(L=G` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>r(E||(E=G` <span>${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(a=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:applied_gift_card_codes"])||void 0===a?void 0:a.map((e=>{var t;return r(R||(R=G` <span>${0}&colon;</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((e=>r(I||(I=G` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,i,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===s?void 0:s.currency_code;return r(B||(B=G` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let i="";return i=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",r(q||(q=G` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),i,o)}});let T,U,Z,M=e=>e;const O=c(u(t,"transaction"));class W extends O{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const o=e.data._links["fx:send_webhooks"].href,i=new W.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>a(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{W.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!r.ok)throw new Error(await r.text())}}]}static get properties(){return o(o({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])||r.push("items","attributes","custom-fields"),new i(r.join(" ").trim())}get hiddenSelector(){var e,t,o,r;const s=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||s.unshift("subscription"),"subscription_modification"===n&&s.unshift("actions"),"updateinfo"===n&&s.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&s.unshift("not=customer,subscription,custom-fields,attributes"),(null===(r=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===r?void 0:r.use_webhook)||s.unshift("datafeed"),new i(s.join(" ").trim())}get headerSubtitleOptions(){var e,t,o,i,r;const s=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===s?"admin_changed_payment_method_with_uoe":"mit_api"===s?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===s?"admin_changed_subscription_with_uoe":"mit_api"===s?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===s?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===s?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===s&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===s?a="customer_canceled_subscription":"mit_recurring_cancellation"===s&&(a="admin_canceled_subscription"):(null===(o=this.data)||void 0===o?void 0:o._links["fx:subscription"])?(null==s?void 0:s.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===s?a="admin_subscribed_with_uoe":"mit_api"===s&&(a="integration_subscribed"):(null==s?void 0:s.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===s?a="admin_placed_order_with_uoe":"mit_api"===s&&(a="integration_placed_order"),{transaction_date:null===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(T||(T=M` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,o,i,s,n,a,l,c,u,f,p,m,h,_,y;let v,x,b;const g=this.hiddenSelector;if(this.data)try{const i=new URL(this.data._links["fx:shipments"].href),r=new URL(null!==(o=null===(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:webhooks"].href)&&void 0!==o?o:""),s=new URL(this.data._links["fx:items"].href);i.searchParams.set("zoom","items:item_category"),r.searchParams.set("event_resource","transaction"),s.searchParams.set("zoom","item_options"),v=i.toString(),x=r.toString(),b=s.toString()}catch(e){}return r(U||(U=M` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-transaction-post-action-control infer="process-webhook" href="${0}"> </foxy-internal-transaction-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(s=null===(i=this.data)||void 0===i?void 0:i.status)&&void 0!==s?s:"")?r(Z||(Z=M` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(n=this.data)||void 0===n?void 0:n.status):"",g.matches("items",!0)&&g.matches("summary",!0),d(b),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(l=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href},d(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),d(null===(f=this.data)||void 0===f?void 0:f._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},d(null===(p=this.data)||void 0===p?void 0:p._links["fx:custom_fields"].href),d(null===(m=this.data)||void 0===m?void 0:m._links["fx:attributes"].href),d(v),d(x),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(_=null===(h=this.data)||void 0===h?void 0:h._links["fx:process_webhook"])||void 0===_?void 0:_.href),d(null===(y=this.data)||void 0===y?void 0:y._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",W);export{W as Transaction};
@@ -1 +1 @@
1
- import"./shared-05ed8288.js";import{a as e}from"./shared-edb68eb7.js";import{x as t}from"./shared-fefaece7.js";import{c as a,h as r}from"./shared-ba5c42c7.js";import{_ as o}from"./shared-d1195c27.js";import{s as i}from"./shared-79d0699c.js";import{p as l}from"./shared-43e2c3f6.js";import{i as s}from"./shared-53e42a77.js";let n;function m(e){return new Array(7).fill(new Date).map(((t,a)=>{for(;t.getDay()!==a;)t.setDate(t.getDate()+1);return t.toLocaleDateString(e,{weekday:"short"})}))}function h(e){return new Array(7).fill(new Date).map(((t,a)=>{for(;t.getDay()!==a;)t.setDate(t.getDate()+1);return t.toLocaleDateString(e,{weekday:"long"})}))}t("vaadin-date-picker-text-field",a(n||(n=(e=>e)`:host([theme~=summary-item])::before{display:none}:host([theme~=summary-item]) .vaadin-text-field-container{display:grid;grid-template-columns:auto 1fr;grid-template-rows:repeat(3,min-content);gap:0 var(--lumo-space-m)}:host([theme~=summary-item]) [part=label]{font:normal var(--lumo-font-size-m) var(--lumo-font-family);color:var(--lumo-body-text-color)!important;grid-row:1;-webkit-text-fill-color:var(--lumo-body-text-color)!important}:host([theme~=summary-item]) [part=helper-text]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-secondary-text-color)!important;grid-row:2}:host([theme~=summary-item]) [part=helper-text]::before{display:none}:host([theme~=summary-item]) [part=error-message]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-error-text-color);grid-row:3}:host([theme~=summary-item]) [part=error-message],:host([theme~=summary-item]) [part=helper-text],:host([theme~=summary-item]) [part=label]{line-height:var(--lumo-line-height-xs);grid-column:1;padding:0}:host([theme~=summary-item]) [part=input-field]{grid-column:2;grid-row:1;padding:0;background:0 0;align-self:start;height:1em;--lumo-icon-size-m:1rem}:host([theme~=summary-item]) [part=input-field]::after,:host([theme~=summary-item][readonly]) [part=input-field] slot[name=suffix]{display:none}:host([theme~=summary-item]) [part=value]{line-height:var(--lumo-line-height-xs);text-align:right;min-height:auto;padding:0;margin-right:var(--lumo-space-xs);-webkit-mask-image:none}:host([theme~=summary-item][readonly]) [part=value]{margin-right:0}:host([theme~=summary-item]) [part=clear-button]{transform:scale(1.5)}:host([has-value]) slot[name=suffix]{display:none}`)));let d,u=e=>e;customElements.define("foxy-internal-date-control",class extends e{constructor(){super(...arguments),this.format=null,this.layout=null}static get properties(){return o(o({},super.properties),{},{format:{},layout:{}})}renderControl(){var e,t;let a;return a="0000-00-00"!==this._value&&this._value?"unix"===this.format?i(new Date(1e3*(null!==(e=this._value)&&void 0!==e?e:0))):"iso-long"===this.format?i(new Date(this._value)):this._value:"",r(d||(d=u` <vaadin-date-picker error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" theme="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" .i18n="${0}" clear-button-visible @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),s(this._errorMessage),this.placeholder,this.helperText,this.label,null!==(t=this.layout)&&void 0!==t?t:"standalone",this.disabled,this.readonly,this._checkValidity,a,this.__pickerI18n,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{var t,a;const r=e.currentTarget;if("unix"===this.format)this._value=Math.floor((null!==(a=null===(t=l(r.value))||void 0===t?void 0:t.getTime())&&void 0!==a?a:0)/1e3);else if("iso-long"===this.format){const e=l(r.value);this._value=e?this.__toApiDate(e):null}else this._value=r.value}))}get __pickerI18n(){return{monthNames:(e=this.lang||"en",new Array(12).fill(new Date).map(((t,a)=>(t.setMonth(a),t.toLocaleDateString(e,{month:"long"}))))),weekdays:h(this.lang||"en"),weekdaysShort:m(this.lang||"en"),firstDayOfWeek:0,week:this.t("week"),calendar:this.t("calendar"),clear:this.t("clear"),today:this.t("today"),cancel:this.t("cancel"),referenceDate:"",parseDate:null,formatTitle:(e,t)=>e+" "+t,formatDate:e=>this.t("display_value",{value:new Date(e.year,e.month,e.day)})};var e}__toApiDate(e){return e.toLocaleString("en-US",{timeZone:"America/Los_Angeles",timeZoneName:"longOffset",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).replace(/(\d+)\/(\d+)\/(\d+),\s(\d+):(\d+):(\d+) GMT([+-])(\d+):(\d+)/,"$3-$1-$2T$4:$5:$6$7$8$9")}});
1
+ import"./shared-05ed8288.js";import{a as e}from"./shared-edb68eb7.js";import{x as t}from"./shared-fefaece7.js";import{c as a,h as r}from"./shared-ba5c42c7.js";import{_ as o}from"./shared-d1195c27.js";import{s as i}from"./shared-79d0699c.js";import{p as l}from"./shared-43e2c3f6.js";import{i as s}from"./shared-53e42a77.js";let n;function m(e){return new Array(7).fill(new Date).map(((t,a)=>{for(;t.getDay()!==a;)t.setDate(t.getDate()+1);return t.toLocaleDateString(e,{weekday:"short"})}))}function h(e){return new Array(7).fill(new Date).map(((t,a)=>{for(;t.getDay()!==a;)t.setDate(t.getDate()+1);return t.toLocaleDateString(e,{weekday:"long"})}))}t("vaadin-date-picker-text-field",a(n||(n=(e=>e)`:host([theme~=summary-item])::before{display:none}:host([theme~=summary-item]) .vaadin-text-field-container{display:grid;grid-template-columns:auto 1fr;grid-template-rows:repeat(3,min-content);gap:0 var(--lumo-space-m)}:host([theme~=summary-item]) [part=label]{font:normal var(--lumo-font-size-m) var(--lumo-font-family);color:var(--lumo-body-text-color)!important;grid-row:1;-webkit-text-fill-color:var(--lumo-body-text-color)!important}:host([theme~=summary-item]) [part=helper-text]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-secondary-text-color)!important;grid-row:2}:host([theme~=summary-item]) [part=helper-text]::before{display:none}:host([theme~=summary-item]) [part=error-message]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-error-text-color);grid-row:3}:host([theme~=summary-item]) [part=error-message],:host([theme~=summary-item]) [part=helper-text],:host([theme~=summary-item]) [part=label]{line-height:var(--lumo-line-height-xs);grid-column:1;padding:0}:host([theme~=summary-item]) [part=input-field]{grid-column:2;grid-row:1;padding:0;background:0 0;align-self:start;height:1em;--lumo-icon-size-m:1rem}:host([theme~=summary-item]) [part=input-field]::after,:host([theme~=summary-item][readonly]) [part=input-field] slot[name=suffix]{display:none}:host([theme~=summary-item]) [part=value]{line-height:var(--lumo-line-height-xs);text-align:right;min-height:auto;padding:0;margin-right:var(--lumo-space-xs);-webkit-mask-image:none}:host([theme~=summary-item][readonly]) [part=value]{margin-right:0}:host([theme~=summary-item]) [part=clear-button]{transform:scale(1.5)}:host([has-value]) slot[name=suffix]{display:none}`)));let u,d=e=>e;customElements.define("foxy-internal-date-control",class extends e{constructor(){super(...arguments),this.format=null,this.layout=null}static get properties(){return o(o({},super.properties),{},{format:{},layout:{}})}renderControl(){var e,t,a;let o;return o="0000-00-00"!==this._value&&this._value?"unix"===this.format?i(new Date(1e3*(null!==(e=this._value)&&void 0!==e?e:0))):"iso-long"===this.format?i(new Date(this._value)):(null!==(t=this._value)&&void 0!==t?t:"").substring(0,10):"",r(u||(u=d` <vaadin-date-picker error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" theme="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" .i18n="${0}" clear-button-visible @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),s(this._errorMessage),this.placeholder,this.helperText,this.label,null!==(a=this.layout)&&void 0!==a?a:"standalone",this.disabled,this.readonly,this._checkValidity,o,this.__pickerI18n,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{var t,a,r,o;const i=e.currentTarget;"unix"===this.format?this._value=Math.floor((null!==(a=null===(t=l(i.value))||void 0===t?void 0:t.getTime())&&void 0!==a?a:0)/1e3):"iso-long"===this.format?this._value=null!==(o=null===(r=l(i.value))||void 0===r?void 0:r.toISOString())&&void 0!==o?o:null:this._value=i.value}))}get __pickerI18n(){return{monthNames:(e=this.lang||"en",new Array(12).fill(new Date).map(((t,a)=>(t.setMonth(a),t.toLocaleDateString(e,{month:"long"}))))),weekdays:h(this.lang||"en"),weekdaysShort:m(this.lang||"en"),firstDayOfWeek:0,week:this.t("week"),calendar:this.t("calendar"),clear:this.t("clear"),today:this.t("today"),cancel:this.t("cancel"),referenceDate:"",parseDate:null,formatTitle:(e,t)=>e+" "+t,formatDate:e=>this.t("display_value",{value:new Date(e.year,e.month,e.day)})};var e}});
@@ -14,5 +14,4 @@ export declare class InternalDateControl extends InternalEditableControl {
14
14
  layout: 'summary-item' | 'standalone' | null;
15
15
  renderControl(): TemplateResult;
16
16
  private get __pickerI18n();
17
- private __toApiDate;
18
17
  }
@@ -28,7 +28,7 @@ export class InternalDateControl extends InternalEditableControl {
28
28
  };
29
29
  }
30
30
  renderControl() {
31
- var _a, _b;
31
+ var _a, _b, _c;
32
32
  let value;
33
33
  if (this._value === '0000-00-00' || !this._value) {
34
34
  value = '';
@@ -41,7 +41,7 @@ export class InternalDateControl extends InternalEditableControl {
41
41
  value = serializeDate(new Date(this._value));
42
42
  }
43
43
  else {
44
- value = this._value;
44
+ value = ((_b = this._value) !== null && _b !== void 0 ? _b : '').substring(0, 10);
45
45
  }
46
46
  }
47
47
  return html `
@@ -51,7 +51,7 @@ export class InternalDateControl extends InternalEditableControl {
51
51
  helper-text=${this.helperText}
52
52
  label=${this.label}
53
53
  class="w-full"
54
- theme=${(_b = this.layout) !== null && _b !== void 0 ? _b : 'standalone'}
54
+ theme=${(_c = this.layout) !== null && _c !== void 0 ? _c : 'standalone'}
55
55
  ?disabled=${this.disabled}
56
56
  ?readonly=${this.readonly}
57
57
  .checkValidity=${this._checkValidity}
@@ -60,14 +60,13 @@ export class InternalDateControl extends InternalEditableControl {
60
60
  clear-button-visible
61
61
  @keydown=${(evt) => { var _a; return evt.key === 'Enter' && ((_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.submit()); }}
62
62
  @change=${(evt) => {
63
- var _a, _b;
63
+ var _a, _b, _c, _d;
64
64
  const field = evt.currentTarget;
65
65
  if (this.format === 'unix') {
66
66
  this._value = Math.floor(((_b = (_a = parseDate(field.value)) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0) / 1000);
67
67
  }
68
68
  else if (this.format === 'iso-long') {
69
- const parsedDate = parseDate(field.value);
70
- this._value = parsedDate ? this.__toApiDate(parsedDate) : null;
69
+ this._value = (_d = (_c = parseDate(field.value)) === null || _c === void 0 ? void 0 : _c.toISOString()) !== null && _d !== void 0 ? _d : null;
71
70
  }
72
71
  else {
73
72
  this._value = field.value;
@@ -96,20 +95,5 @@ export class InternalDateControl extends InternalEditableControl {
96
95
  },
97
96
  };
98
97
  }
99
- __toApiDate(date) {
100
- return date
101
- .toLocaleString('en-US', {
102
- timeZone: 'America/Los_Angeles',
103
- timeZoneName: 'longOffset',
104
- year: 'numeric',
105
- month: '2-digit',
106
- day: '2-digit',
107
- hour: '2-digit',
108
- minute: '2-digit',
109
- second: '2-digit',
110
- hour12: false,
111
- })
112
- .replace(/(\d+)\/(\d+)\/(\d+),\s(\d+):(\d+):(\d+) GMT([+-])(\d+):(\d+)/, '$3-$1-$2T$4:$5:$6$7$8$9');
113
- }
114
98
  }
115
99
  //# sourceMappingURL=InternalDateControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalDateControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDateControl/InternalDateControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,SAAS,EAAE,qCAAkC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,kCAA+B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAC5D,OAAO,EAAE,aAAa,EAAE,2BAAwB;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAAhE;;QASE,kHAAkH;QAClH,WAAM,GAA+B,IAAI,CAAC;QAE1C,wEAAwE;QACxE,WAAM,GAAyC,IAAI,CAAC;IAuFtD,CAAC;IAnGC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAQD,aAAa;;QACX,IAAI,KAAa,CAAC;QAElB,IAAI,IAAI,CAAC,MAAM,KAAK,YAAY,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChD,KAAK,GAAG,EAAE,CAAC;SACZ;aAAM;YACL,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,KAAK,GAAG,aAAa,CAAC,IAAI,IAAI,CAAC,OAAE,IAAI,CAAC,MAAiB,mCAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;aACxE;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE;gBACrC,KAAK,GAAG,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAgB,CAAC,CAAC,CAAC;aACxD;iBAAM;gBACL,KAAK,GAAG,IAAI,CAAC,MAAgB,CAAC;aAC/B;SACF;QAED,OAAO,IAAI,CAAA;;wBAES,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;sBAC/B,IAAI,CAAC,WAAW;sBAChB,IAAI,CAAC,UAAU;gBACrB,IAAI,CAAC,KAAK;;gBAEV,MAAA,IAAI,CAAC,MAAM,mCAAI,YAAY;oBACvB,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,cAAc;iBAC3B,KAAK;gBACN,IAAI,CAAC,YAAY;;mBAEd,CAAC,GAAkB,EAAE,EAAE,WAAC,OAAA,GAAG,CAAC,GAAG,KAAK,OAAO,WAAI,IAAI,CAAC,OAAO,0CAAE,MAAM,GAAE,CAAA,EAAA;kBACtE,CAAC,GAAgB,EAAE,EAAE;;YAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,aAAkC,CAAC;YAErD,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,aAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,0CAAE,OAAO,qCAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;aAC3E;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE;gBACrC,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC1C,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;aAChE;iBAAM;gBACL,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;aAC3B;QACH,CAAC;;;KAGJ,CAAC;IACJ,CAAC;IAED,IAAY,YAAY;QACtB,OAAO;YACL,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;YAC5C,QAAQ,EAAE,mBAAmB,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;YAChD,aAAa,EAAE,oBAAoB,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;YACtD,cAAc,EAAE,CAAC;YACjB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;YAC5B,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;YACxB,aAAa,EAAE,EAAE;YACjB,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;YAClD,UAAU,EAAE,CAAC,CAA+C,EAAE,EAAE;gBAC9D,OAAO,IAAI,CAAC,CAAC,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC9E,CAAC;SACF,CAAC;IACJ,CAAC;IAEO,WAAW,CAAC,IAAU;QAC5B,OAAO,IAAI;aACR,cAAc,CAAC,OAAO,EAAE;YACvB,QAAQ,EAAE,qBAAqB;YAC/B,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,KAAK;SACd,CAAC;aACD,OAAO,CACN,8DAA8D,EAC9D,yBAAyB,CAC1B,CAAC;IACN,CAAC;CACF","sourcesContent":["import type { TemplateResult, PropertyDeclarations } from 'lit-element';\nimport type { DatePickerElement } from '@vaadin/vaadin-date-picker';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { parseDate } from '../../../utils/parse-date';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nimport { getWeekdayShortNames } from './getWeekdayShortNames';\nimport { getWeekdayLongNames } from './getWeekdayLongNames';\nimport { getMonthNames } from './getMonthNames';\n\n/**\n * Internal control displaying a basic date picker box.\n *\n * @since 1.17.0\n * @element foxy-internal-date-control\n */\nexport class InternalDateControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n format: {},\n layout: {},\n };\n }\n\n /** Date format. If `unix`, expects and outputs a UNIX timestamp (number), otherwise defaults to ISO 8601 date. */\n format: 'unix' | 'iso-long' | null = null;\n\n /** Use summary item layout inside `<foxy-internal-summary-control>`. */\n layout: 'summary-item' | 'standalone' | null = null;\n\n renderControl(): TemplateResult {\n let value: string;\n\n if (this._value === '0000-00-00' || !this._value) {\n value = '';\n } else {\n if (this.format === 'unix') {\n value = serializeDate(new Date(((this._value as number) ?? 0) * 1000));\n } else if (this.format === 'iso-long') {\n value = serializeDate(new Date(this._value as string));\n } else {\n value = this._value as string;\n }\n }\n\n return html`\n <vaadin-date-picker\n error-message=${ifDefined(this._errorMessage)}\n placeholder=${this.placeholder}\n helper-text=${this.helperText}\n label=${this.label}\n class=\"w-full\"\n theme=${this.layout ?? 'standalone'}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${value}\n .i18n=${this.__pickerI18n}\n clear-button-visible\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as DatePickerElement;\n\n if (this.format === 'unix') {\n this._value = Math.floor((parseDate(field.value)?.getTime() ?? 0) / 1000);\n } else if (this.format === 'iso-long') {\n const parsedDate = parseDate(field.value);\n this._value = parsedDate ? this.__toApiDate(parsedDate) : null;\n } else {\n this._value = field.value;\n }\n }}\n >\n </vaadin-date-picker>\n `;\n }\n\n private get __pickerI18n() {\n return {\n monthNames: getMonthNames(this.lang || 'en'),\n weekdays: getWeekdayLongNames(this.lang || 'en'),\n weekdaysShort: getWeekdayShortNames(this.lang || 'en'),\n firstDayOfWeek: 0,\n week: this.t('week'),\n calendar: this.t('calendar'),\n clear: this.t('clear'),\n today: this.t('today'),\n cancel: this.t('cancel'),\n referenceDate: '',\n parseDate: null,\n formatTitle: (m: string, y: string) => m + ' ' + y,\n formatDate: (d: { day: number; month: number; year: number }) => {\n return this.t('display_value', { value: new Date(d.year, d.month, d.day) });\n },\n };\n }\n\n private __toApiDate(date: Date): string {\n return date\n .toLocaleString('en-US', {\n timeZone: 'America/Los_Angeles',\n timeZoneName: 'longOffset',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: false,\n })\n .replace(\n /(\\d+)\\/(\\d+)\\/(\\d+),\\s(\\d+):(\\d+):(\\d+) GMT([+-])(\\d+):(\\d+)/,\n '$3-$1-$2T$4:$5:$6$7$8$9'\n );\n }\n}\n"]}
1
+ {"version":3,"file":"InternalDateControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDateControl/InternalDateControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,SAAS,EAAE,qCAAkC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,kCAA+B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAC5D,OAAO,EAAE,aAAa,EAAE,2BAAwB;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAAhE;;QASE,kHAAkH;QAClH,WAAM,GAA+B,IAAI,CAAC;QAE1C,wEAAwE;QACxE,WAAM,GAAyC,IAAI,CAAC;IAmEtD,CAAC;IA/EC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAQD,aAAa;;QACX,IAAI,KAAa,CAAC;QAElB,IAAI,IAAI,CAAC,MAAM,KAAK,YAAY,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChD,KAAK,GAAG,EAAE,CAAC;SACZ;aAAM;YACL,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,KAAK,GAAG,aAAa,CAAC,IAAI,IAAI,CAAC,OAAE,IAAI,CAAC,MAAiB,mCAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;aACxE;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE;gBACrC,KAAK,GAAG,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAgB,CAAC,CAAC,CAAC;aACxD;iBAAM;gBACL,KAAK,GAAG,OAAE,IAAI,CAAC,MAAwB,mCAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;aACjE;SACF;QAED,OAAO,IAAI,CAAA;;wBAES,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;sBAC/B,IAAI,CAAC,WAAW;sBAChB,IAAI,CAAC,UAAU;gBACrB,IAAI,CAAC,KAAK;;gBAEV,MAAA,IAAI,CAAC,MAAM,mCAAI,YAAY;oBACvB,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,cAAc;iBAC3B,KAAK;gBACN,IAAI,CAAC,YAAY;;mBAEd,CAAC,GAAkB,EAAE,EAAE,WAAC,OAAA,GAAG,CAAC,GAAG,KAAK,OAAO,WAAI,IAAI,CAAC,OAAO,0CAAE,MAAM,GAAE,CAAA,EAAA;kBACtE,CAAC,GAAgB,EAAE,EAAE;;YAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,aAAkC,CAAC;YAErD,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,aAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,0CAAE,OAAO,qCAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;aAC3E;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE;gBACrC,IAAI,CAAC,MAAM,eAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,0CAAE,WAAW,qCAAM,IAAI,CAAC;aAC7D;iBAAM;gBACL,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;aAC3B;QACH,CAAC;;;KAGJ,CAAC;IACJ,CAAC;IAED,IAAY,YAAY;QACtB,OAAO;YACL,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;YAC5C,QAAQ,EAAE,mBAAmB,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;YAChD,aAAa,EAAE,oBAAoB,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;YACtD,cAAc,EAAE,CAAC;YACjB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;YAC5B,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;YACxB,aAAa,EAAE,EAAE;YACjB,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;YAClD,UAAU,EAAE,CAAC,CAA+C,EAAE,EAAE;gBAC9D,OAAO,IAAI,CAAC,CAAC,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC9E,CAAC;SACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult, PropertyDeclarations } from 'lit-element';\nimport type { DatePickerElement } from '@vaadin/vaadin-date-picker';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { parseDate } from '../../../utils/parse-date';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nimport { getWeekdayShortNames } from './getWeekdayShortNames';\nimport { getWeekdayLongNames } from './getWeekdayLongNames';\nimport { getMonthNames } from './getMonthNames';\n\n/**\n * Internal control displaying a basic date picker box.\n *\n * @since 1.17.0\n * @element foxy-internal-date-control\n */\nexport class InternalDateControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n format: {},\n layout: {},\n };\n }\n\n /** Date format. If `unix`, expects and outputs a UNIX timestamp (number), otherwise defaults to ISO 8601 date. */\n format: 'unix' | 'iso-long' | null = null;\n\n /** Use summary item layout inside `<foxy-internal-summary-control>`. */\n layout: 'summary-item' | 'standalone' | null = null;\n\n renderControl(): TemplateResult {\n let value: string;\n\n if (this._value === '0000-00-00' || !this._value) {\n value = '';\n } else {\n if (this.format === 'unix') {\n value = serializeDate(new Date(((this._value as number) ?? 0) * 1000));\n } else if (this.format === 'iso-long') {\n value = serializeDate(new Date(this._value as string));\n } else {\n value = ((this._value as string | null) ?? '').substring(0, 10);\n }\n }\n\n return html`\n <vaadin-date-picker\n error-message=${ifDefined(this._errorMessage)}\n placeholder=${this.placeholder}\n helper-text=${this.helperText}\n label=${this.label}\n class=\"w-full\"\n theme=${this.layout ?? 'standalone'}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${value}\n .i18n=${this.__pickerI18n}\n clear-button-visible\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as DatePickerElement;\n\n if (this.format === 'unix') {\n this._value = Math.floor((parseDate(field.value)?.getTime() ?? 0) / 1000);\n } else if (this.format === 'iso-long') {\n this._value = parseDate(field.value)?.toISOString() ?? null;\n } else {\n this._value = field.value;\n }\n }}\n >\n </vaadin-date-picker>\n `;\n }\n\n private get __pickerI18n() {\n return {\n monthNames: getMonthNames(this.lang || 'en'),\n weekdays: getWeekdayLongNames(this.lang || 'en'),\n weekdaysShort: getWeekdayShortNames(this.lang || 'en'),\n firstDayOfWeek: 0,\n week: this.t('week'),\n calendar: this.t('calendar'),\n clear: this.t('clear'),\n today: this.t('today'),\n cancel: this.t('cancel'),\n referenceDate: '',\n parseDate: null,\n formatTitle: (m: string, y: string) => m + ' ' + y,\n formatDate: (d: { day: number; month: number; year: number }) => {\n return this.t('display_value', { value: new Date(d.year, d.month, d.day) });\n },\n };\n }\n}\n"]}
@@ -49,24 +49,17 @@ export class AdminSubscriptionForm extends Base {
49
49
  </foxy-internal-admin-subscription-form-error>
50
50
 
51
51
  <foxy-internal-summary-control infer="general">
52
- <foxy-internal-date-control format="iso-long" layout="summary-item" infer="start-date">
52
+ <foxy-internal-date-control layout="summary-item" infer="start-date">
53
53
  </foxy-internal-date-control>
54
-
55
54
  <foxy-internal-frequency-control
56
55
  layout="summary-item"
57
56
  infer="frequency"
58
57
  allow-twice-a-month
59
58
  >
60
59
  </foxy-internal-frequency-control>
61
-
62
- <foxy-internal-date-control
63
- format="iso-long"
64
- layout="summary-item"
65
- infer="next-transaction-date"
66
- >
60
+ <foxy-internal-date-control layout="summary-item" infer="next-transaction-date">
67
61
  </foxy-internal-date-control>
68
-
69
- <foxy-internal-date-control format="iso-long" layout="summary-item" infer="end-date">
62
+ <foxy-internal-date-control layout="summary-item" infer="end-date">
70
63
  </foxy-internal-date-control>
71
64
  </foxy-internal-summary-control>
72
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"AdminSubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD,MAAM,OAAO,qBAAsB,SAAQ,IAAU;IACnD,IAAI,cAAc;;QAChB,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChE,IAAI,QAAC,IAAI,CAAC,IAAI,0CAAE,aAAa,CAAA;YAAE,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACpE,IAAI,QAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAA;YAAE,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;QAC/E,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,qBAAqB;;QACvB,OAAO,EAAE,OAAO,EAAE,OAAA,IAAI,CAAC,IAAI,0CAAE,SAAS,EAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACnE,CAAC;IAED,6DAA6D;IAC7D,mBAAmB,CAAC,IAAU;QAC5B,OAAO,IAAI,CAAA;;;;;;;;KAQV,CAAC;IACJ,CAAC;IAED,UAAU;;QACR,IAAI,gBAAoC,CAAC;QAEzC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,iBAAiB,EAAE,IAAI,mCAAI,EAAE,CAAC,CAAC;YACrE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACtC,gBAAgB,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;SACnC;QAAC,WAAM;YACN,gBAAgB,GAAG,SAAS,CAAC;SAC9B;QAED,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA8BR,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAC,yBAAyB,EAAE,aAAa,CAAC;;;;;;;QAOnF,IAAI,CAAC,oBAAoB,EAAE;;;;;gBAKnB,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,0CAAG,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUpD,SAAS,CAAC,gBAAgB,CAAC;;;;;;;;;;QAUnC,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'admin-subscription-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\nexport class AdminSubscriptionForm extends Base<Data> {\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['delete', super.hiddenSelector.toString()];\n if (!this.data?.error_message) alwaysMatch.unshift('error-message');\n if (!this.data?.is_active) alwaysMatch.unshift('view-action', 'cancel-action');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { context: this.data?.is_active ? 'active' : 'inactive' };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n renderHeaderActions(data: Data): TemplateResult {\n return html`\n <foxy-internal-admin-subscription-form-load-in-cart-action infer=\"view-action\">\n </foxy-internal-admin-subscription-form-load-in-cart-action>\n <foxy-internal-admin-subscription-form-load-in-cart-action\n action=\"cancel\"\n infer=\"cancel-action\"\n >\n </foxy-internal-admin-subscription-form-load-in-cart-action>\n `;\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-admin-subscription-form-error infer=\"error-message\">\n </foxy-internal-admin-subscription-form-error>\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-date-control format=\"iso-long\" layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n\n <foxy-internal-frequency-control\n layout=\"summary-item\"\n infer=\"frequency\"\n allow-twice-a-month\n >\n </foxy-internal-frequency-control>\n\n <foxy-internal-date-control\n format=\"iso-long\"\n layout=\"summary-item\"\n infer=\"next-transaction-date\"\n >\n </foxy-internal-date-control>\n\n <foxy-internal-date-control format=\"iso-long\" layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"overdue\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n suffix=${ifDefined(this.data?._embedded['fx:transaction_template'].currency_code)}\n infer=\"past-due-amount\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links?.['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"transactions\"\n class=\"min-w-0\"\n first=${ifDefined(transactionsHref)}\n item=\"foxy-transaction-card\"\n form=\"foxy-transaction\"\n hide-create-button\n hide-delete-button\n alert\n wide\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"AdminSubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD,MAAM,OAAO,qBAAsB,SAAQ,IAAU;IACnD,IAAI,cAAc;;QAChB,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChE,IAAI,QAAC,IAAI,CAAC,IAAI,0CAAE,aAAa,CAAA;YAAE,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACpE,IAAI,QAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAA;YAAE,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;QAC/E,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,qBAAqB;;QACvB,OAAO,EAAE,OAAO,EAAE,OAAA,IAAI,CAAC,IAAI,0CAAE,SAAS,EAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACnE,CAAC;IAED,6DAA6D;IAC7D,mBAAmB,CAAC,IAAU;QAC5B,OAAO,IAAI,CAAA;;;;;;;;KAQV,CAAC;IACJ,CAAC;IAED,UAAU;;QACR,IAAI,gBAAoC,CAAC;QAEzC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,iBAAiB,EAAE,IAAI,mCAAI,EAAE,CAAC,CAAC;YACrE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACtC,gBAAgB,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;SACnC;QAAC,WAAM;YACN,gBAAgB,GAAG,SAAS,CAAC;SAC9B;QAED,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;mBAuBR,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAC,yBAAyB,EAAE,aAAa,CAAC;;;;;;;QAOnF,IAAI,CAAC,oBAAoB,EAAE;;;;;gBAKnB,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,0CAAG,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUpD,SAAS,CAAC,gBAAgB,CAAC;;;;;;;;;;QAUnC,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'admin-subscription-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\nexport class AdminSubscriptionForm extends Base<Data> {\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['delete', super.hiddenSelector.toString()];\n if (!this.data?.error_message) alwaysMatch.unshift('error-message');\n if (!this.data?.is_active) alwaysMatch.unshift('view-action', 'cancel-action');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { context: this.data?.is_active ? 'active' : 'inactive' };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n renderHeaderActions(data: Data): TemplateResult {\n return html`\n <foxy-internal-admin-subscription-form-load-in-cart-action infer=\"view-action\">\n </foxy-internal-admin-subscription-form-load-in-cart-action>\n <foxy-internal-admin-subscription-form-load-in-cart-action\n action=\"cancel\"\n infer=\"cancel-action\"\n >\n </foxy-internal-admin-subscription-form-load-in-cart-action>\n `;\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-admin-subscription-form-error infer=\"error-message\">\n </foxy-internal-admin-subscription-form-error>\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-frequency-control\n layout=\"summary-item\"\n infer=\"frequency\"\n allow-twice-a-month\n >\n </foxy-internal-frequency-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"next-transaction-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"overdue\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n suffix=${ifDefined(this.data?._embedded['fx:transaction_template'].currency_code)}\n infer=\"past-due-amount\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links?.['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"transactions\"\n class=\"min-w-0\"\n first=${ifDefined(transactionsHref)}\n item=\"foxy-transaction-card\"\n form=\"foxy-transaction\"\n hide-create-button\n hide-delete-button\n alert\n wide\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n `;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.37.0-beta.3",
4
+ "version": "1.37.0-beta.4",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",