@foxy.io/elements 1.32.0-beta.2 → 1.32.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  2. package/dist/cdn/foxy-coupon-form.js +1 -1
  3. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  4. package/dist/cdn/foxy-query-builder.js +1 -64
  5. package/dist/cdn/foxy-transaction.js +1 -1
  6. package/dist/cdn/shared-f1b29592.js +64 -0
  7. package/dist/cdn/translations/coupon-form/en.json +8 -52
  8. package/dist/elements/internal/InternalArrayMapControl/InternalArrayMapControl.d.ts +12 -0
  9. package/dist/elements/internal/InternalArrayMapControl/InternalArrayMapControl.js +277 -0
  10. package/dist/elements/internal/InternalArrayMapControl/InternalArrayMapControl.js.map +1 -0
  11. package/dist/elements/internal/InternalArrayMapControl/index.d.ts +4 -0
  12. package/dist/elements/internal/InternalArrayMapControl/index.js +6 -0
  13. package/dist/elements/internal/InternalArrayMapControl/index.js.map +1 -0
  14. package/dist/elements/public/CouponForm/CouponForm.d.ts +2 -3
  15. package/dist/elements/public/CouponForm/CouponForm.js +51 -25
  16. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  17. package/dist/elements/public/CouponForm/index.d.ts +1 -0
  18. package/dist/elements/public/CouponForm/index.js +1 -0
  19. package/dist/elements/public/CouponForm/index.js.map +1 -1
  20. package/dist/elements/public/QueryBuilder/utils/parse.js +3 -1
  21. package/dist/elements/public/QueryBuilder/utils/parse.js.map +1 -1
  22. package/dist/elements/public/QueryBuilder/utils/stringify.js +10 -3
  23. package/dist/elements/public/QueryBuilder/utils/stringify.js.map +1 -1
  24. package/dist/elements/public/Transaction/index.d.ts +1 -0
  25. package/dist/elements/public/Transaction/index.js +1 -0
  26. package/dist/elements/public/Transaction/index.js.map +1 -1
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- import"./shared-3a066450.js";import"./shared-85989cf3.js";import"./shared-ac6e1790.js";import"./shared-57cc81b4.js";import{I as r}from"./shared-a4b0ccf4.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import{a as o}from"./shared-55bc51c8.js";import"./shared-51bb937b.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as s}from"./shared-9803aa7c.js";import{h as a,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-4efc6bb8.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-e1850e5f.js";import"./shared-8a8bfd72.js";import"./shared-0a24f318.js";import"./shared-61ade33e.js";import"./shared-34c84b9f.js";import"./shared-f97ed2ff.js";import"./shared-c7ffb9f2.js";import"./shared-c9f3f8d3.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-64d9ac2a.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-045bd59c.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-9e94c56d.js";import"./shared-de45ad84.js";import"./shared-9411a937.js";import"./shared-be093279.js";import"./shared-f0d70be1.js";import"./shared-906fe068.js";import"./shared-651c44fa.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-537d2efe.js";import"./shared-c6b69d4e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-copy-to-clipboard.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-97e1f413.js";import"./shared-9ef03974.js";import"./shared-3491d10e.js";import"./shared-91560256.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-0e44bfff.js";import"./foxy-custom-field-card.js";import"./shared-0f261023.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-641786b2.js";import"./foxy-payment-card.js";import"./shared-2bf89a21.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-787e52c4.js";import"./shared-1cd2db2d.js";import"./shared-838cc86b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-item-card.js";import"./shared-73c1d31e.js";import"./foxy-item-form.js";import"./shared-620dccaa.js";import"./shared-25324930.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-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./shared-b74187e9.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends o{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 o{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(r,"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" format="iso-long" 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" format="iso-long" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" format="iso-long" 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-3a066450.js";import"./shared-85989cf3.js";import"./shared-ac6e1790.js";import"./shared-57cc81b4.js";import{I as r}from"./shared-a4b0ccf4.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import{a as o}from"./shared-55bc51c8.js";import"./shared-51bb937b.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as s}from"./shared-9803aa7c.js";import{h as a,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-4efc6bb8.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-e1850e5f.js";import"./shared-8a8bfd72.js";import"./shared-0a24f318.js";import"./shared-61ade33e.js";import"./shared-34c84b9f.js";import"./shared-f97ed2ff.js";import"./shared-c7ffb9f2.js";import"./shared-c9f3f8d3.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-64d9ac2a.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-045bd59c.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-9e94c56d.js";import"./shared-de45ad84.js";import"./shared-9411a937.js";import"./shared-be093279.js";import"./shared-f0d70be1.js";import"./shared-906fe068.js";import"./shared-651c44fa.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-537d2efe.js";import"./shared-c6b69d4e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-copy-to-clipboard.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-97e1f413.js";import"./shared-9ef03974.js";import"./shared-3491d10e.js";import"./shared-91560256.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-0e44bfff.js";import"./foxy-custom-field-card.js";import"./shared-0f261023.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-641786b2.js";import"./foxy-payment-card.js";import"./shared-2bf89a21.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-787e52c4.js";import"./shared-1cd2db2d.js";import"./shared-838cc86b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./shared-1c169878.js";import"./foxy-item-card.js";import"./shared-73c1d31e.js";import"./foxy-item-form.js";import"./shared-620dccaa.js";import"./shared-25324930.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-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./shared-b74187e9.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends o{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 o{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,j=r=>r;const u=n(r,"admin-subscription-form");class y extends u{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=j` <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=j` ${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" format="iso-long" 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" format="iso-long" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" format="iso-long" 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 +1 @@
1
- import"./shared-56d1eae5.js";import"./shared-c40a4b0c.js";import"./shared-ed9c9bab.js";import{I as t}from"./shared-55bc51c8.js";import"./foxy-query-builder.js";import{_ as e,B as o}from"./shared-d1195c27.js";import{O as r,T as s}from"./shared-8874ec69.js";import{c as i}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import"./shared-25324930.js";import"./shared-b74187e9.js";import"./shared-ac6e1790.js";import"./shared-838cc86b.js";import"./shared-57cc81b4.js";import{I as a}from"./shared-a4b0ccf4.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./shared-51bb937b.js";import{R as l,a as c}from"./shared-4efc6bb8.js";import{i as d}from"./shared-9803aa7c.js";import"./shared-0a24f318.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-e1850e5f.js";import"./shared-64d9ac2a.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-c9f3f8d3.js";import"./foxy-form-dialog.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-045bd59c.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-9e94c56d.js";import"./shared-de45ad84.js";import"./shared-537d2efe.js";import"./shared-906fe068.js";import"./shared-f97ed2ff.js";import"./shared-c6b69d4e.js";import"./shared-34c84b9f.js";import"./shared-c7ffb9f2.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-43e2c3f6.js";import"./shared-bab2ea2c.js";import"./shared-9411a937.js";import"./shared-91560256.js";import"./shared-0f261023.js";import"./shared-9ef03974.js";import"./shared-97e1f413.js";import"./shared-3a066450.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-3491d10e.js";let u,m,p,f,y,_=t=>t;customElements.define("foxy-internal-query-builder-control",class extends t{constructor(){super(...arguments),this.operators=Object.values(r),this.disableOr=!1,this.layout=null}static get properties(){return e(e({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"},layout:{}})}renderControl(){var t;const{label:e,helperText:o,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly,a=null!==(t=this.layout)&&void 0!==t?t:"standalone",l=n(u||(u=_` <foxy-query-builder infer="query-builder" class="${0}" style="${0}" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> `),i({"mt-xs":"summary-item"===a}),"summary-item"===a?"--lumo-border-radius: var(--lumo-border-radius-s)":"",this.operators,this._value,this.disableOr,(t=>{var e;const o=t.currentTarget;this._value=null!==(e=o.value)&&void 0!==e?e:""}));return n(m||(m=_` <section class="${0}"> ${0} ${0} ${0} ${0} ${0} </section> `),i({"grid gap-xs leading-xs transition-colors text-secondary":!0,"hover-text-body":"standalone"===a&&!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),e?n(p||(p=_` <p class="${0}"> ${0} </p> `),i({"text-s font-medium":"standalone"===a,"text-m text-body":"summary-item"===a,hidden:!e}),e):"","standalone"===a?l:"",o?n(f||(f=_`<p class="text-xs">${0}</p>`),o):"",s?n(y||(y=_`<p class="text-xs text-error">${0}</p>`),r):"","summary-item"===a?l:"")}});let h,x,b,j,v,g=t=>t;customElements.define("foxy-internal-coupon-form-rules-control",class extends t{renderControl(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_details)&&void 0!==t?t:"",s=null!==(e=null==o?void 0:o.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",a=this.helperText,l=this.__renderRulesDescription(),c=this._errorMessage;return n(h||(h=g` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),i({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:r,type:s,name:"Rules"},(t=>{const e=t.currentTarget.parsedValue,o=this.nucleon;null==o||o.edit({coupon_discount_details:e.details,coupon_discount_type:e.type})}),a||l?n(x||(x=g` <p class="${0}"> ${0} </p> `),i({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),l||a):"",!c||this.disabled||this.readonly?"":n(b||(b=g`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var t,e;const o=this.nucleon,r=null!==(t=null==o?void 0:o.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",s=null!==(e=null==o?void 0:o.form.coupon_discount_details)&&void 0!==e?e:"";return s?this.t("discount_summary",{params:{details:s,type:r,ns:this.ns}}):null}__renderPreset(){const t=this.nucleon,o=null==t?void 0:t.form.coupon_discount_details,r=null==t?void 0:t.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],a=s.find((t=>t.details===o&&t.type===r));return n(j||(j=g` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),i({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),a?this.t("discount_summary",{params:e(e({},a),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(t=>{var e,o;const r=t.currentTarget,i=s[r.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(e=null==i?void 0:i.details)&&void 0!==e?e:"",coupon_discount_type:null!==(o=null==i?void 0:i.type)&&void 0!==o?o:"quantity_amount"})}),s.map((t=>n(v||(v=g` <option value="${0}" ?selected="${0}"> ${0} </option> `),t.details,t===a,this.t("discount_summary",{params:e(e({},t),{},{ns:this.ns})})))),!a&&!!o&&!!r,this.t("custom_discount"))}});let $,w,k=t=>t;const q=l(c(a,"coupon-form"));class R extends q{constructor(){var t;super(...arguments),t=this,this.getTransactionPageHref=null,this.__customerSubscriptionRestrictionsGetValue=()=>{var t;const e=null===(t=this.form.customer_subscription_restrictions)||void 0===t?void 0:t.split(",").map((t=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).map((t=>({value:t})));return null!=e?e:[]},this.__customerSubscriptionRestrictionsSetValue=t=>{this.edit({customer_subscription_restrictions:t.map((({value:t})=>t.trim())).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var t;return null===(t=this.form.product_code_restrictions)||void 0===t?void 0:t.split(",").filter((t=>!!t.trim())).map((t=>({value:t,label:t.startsWith("-")?this.t("product-code-restrictions.label_block",{value:t.substring(1)}):this.t("product-code-restrictions.label_allow",{value:t})})))},this.__productCodeRestrictionsSetValue=t=>{this.edit({product_code_restrictions:t.map((({value:t,unit:e})=>"block"===e?`-${t}`:t)).filter(((t,e,o)=>!!t&&o.indexOf(t)===e)).join(",")})},this.__itemOptionRestrictionsOperators=[r.In],this.__itemOptionRestrictionsGetValue=()=>{var t;const e=new URLSearchParams,o=null!==(t=this.form.item_option_restrictions)&&void 0!==t?t:{};for(const t in o)e.set(`${t}:in`,o[t].join(","));return e.toString()},this.__itemOptionRestrictionsSetValue=t=>{const e=Object.fromEntries(Array.from(new URLSearchParams(t).entries()).map((([t,e])=>[t.replace(":in",""),e.split(",").filter((t=>!!t.trim()))])));this.edit({item_option_restrictions:e})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:s.String},{label:"used_codes",path:"number_of_uses_to_date",type:s.Number},{label:"date_created",path:"date_created",type:s.Date},{label:"date_modified",path:"date_modified",type:s.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(e){t.__couponCodesActions[0].state="busy",t.__couponCodesActions=[...t.__couponCodesActions];try{await navigator.clipboard.writeText(e.code),t.__couponCodesActions[0].state="end"}catch(e){t.__couponCodesActions[0].state="error"}finally{t.__couponCodesActions=[...t.__couponCodesActions],setTimeout((()=>{t.__couponCodesActions[0].state="idle",t.__couponCodesActions=[...t.__couponCodesActions]}),1e3)}}}]}static get properties(){return e(e({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!t||t.length<=50||"name:v8n_too_long",({inclusive_tax_rate:t})=>!t||t>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:t})=>!t||t<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:t})=>!t||t>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:t})=>!!t||"rules:v8n_required",({coupon_discount_details:t})=>!t||t.length<=200||"rules:v8n_too_long",({item_option_restrictions:t})=>!t||JSON.stringify(t).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:t})=>!t||t.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:t})=>!t||t.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:t})=>!t||t>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:t})=>!t||t.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:t})=>!t||t>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const t=[super.hiddenSelector.toString()];return this.data||t.push("coupon-codes","category-restrictions","attributes"),new o(t.join(" ").trim())}get headerSubtitleOptions(){return e(e({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(t){return n($||($=k` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),t._links["fx:generate_codes"].href,[t._links["fx:coupon_codes"].href],t._links["fx:coupon_codes"].href,[t._links["fx:coupon_codes"].href],super.renderHeaderActions(t))}renderBody(){var t,e,o,r,s,i,a,l;let c;try{const o=new URL(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:coupon_codes"].href)&&void 0!==e?e:"");o.searchParams.set("order","date_created desc"),c=o.toString()}catch(t){c=void 0}return n(w||(w=k` ${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-query-builder-control infer="item-option-restrictions" disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-summary-control infer="customer-restrictions"> <foxy-internal-query-builder-control layout="summary-item" infer="customer-attribute-restrictions"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control layout="summary-item" infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),c,{".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.__itemOptionRestrictionsOperators,this.__itemOptionRestrictionsGetValue,this.__itemOptionRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,d(null===(o=this.data)||void 0===o?void 0:o._links.self.href),d(null===(s=null===(r=this.__storeLoader)||void 0===r?void 0:r.data)||void 0===s?void 0:s._links["fx:item_categories"].href),d(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),d(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),d(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",R);export{R as CouponForm};
1
+ import"./shared-56d1eae5.js";import"./shared-c40a4b0c.js";import"./shared-ed9c9bab.js";import{I as e}from"./shared-55bc51c8.js";import{s as t,p as r}from"./shared-f1b29592.js";import{_ as s,B as o}from"./shared-d1195c27.js";import{O as i,T as n}from"./shared-8874ec69.js";import{c as a}from"./shared-4e709717.js";import{h as l,c as d,s as c}from"./shared-dc73b9a5.js";import"./shared-51bb937b.js";import{R as u,a as m}from"./shared-4efc6bb8.js";import{r as p}from"./shared-a0c6a159.js";import"./shared-25324930.js";import"./shared-b74187e9.js";import"./shared-ac6e1790.js";import"./shared-838cc86b.js";import"./shared-57cc81b4.js";import{I as f}from"./shared-a4b0ccf4.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import{i as h}from"./shared-9803aa7c.js";import"./shared-0a24f318.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-e1850e5f.js";import"./shared-64d9ac2a.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-c9f3f8d3.js";import"./foxy-form-dialog.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-045bd59c.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-9e94c56d.js";import"./shared-de45ad84.js";import"./shared-537d2efe.js";import"./shared-906fe068.js";import"./shared-f97ed2ff.js";import"./shared-c6b69d4e.js";import"./shared-34c84b9f.js";import"./shared-c7ffb9f2.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-43e2c3f6.js";import"./shared-bab2ea2c.js";import"./shared-9411a937.js";import"./shared-91560256.js";import"./shared-0f261023.js";import"./shared-9ef03974.js";import"./shared-97e1f413.js";import"./shared-3a066450.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-3491d10e.js";let y,_,x,b,v,g=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.operators=Object.values(i),this.disableOr=!1,this.layout=null}static get properties(){return s(s({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"},layout:{}})}renderControl(){var e;const{label:t,helperText:r,_errorMessage:s}=this,o=s&&!this.disabled&&!this.readonly,i=null!==(e=this.layout)&&void 0!==e?e:"standalone",n=l(y||(y=g` <foxy-query-builder infer="query-builder" class="${0}" style="${0}" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> `),a({"mt-xs":"summary-item"===i}),"summary-item"===i?"--lumo-border-radius: var(--lumo-border-radius-s)":"",this.operators,this._value,this.disableOr,(e=>{var t;const r=e.currentTarget;this._value=null!==(t=r.value)&&void 0!==t?t:""}));return l(_||(_=g` <section class="${0}"> ${0} ${0} ${0} ${0} ${0} </section> `),a({"grid gap-xs leading-xs transition-colors text-secondary":!0,"hover-text-body":"standalone"===i&&!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),t?l(x||(x=g` <p class="${0}"> ${0} </p> `),a({"text-s font-medium":"standalone"===i,"text-m text-body":"summary-item"===i,hidden:!t}),t):"","standalone"===i?n:"",r?l(b||(b=g`<p class="text-xs">${0}</p>`),r):"",o?l(v||(v=g`<p class="text-xs text-error">${0}</p>`),s):"","summary-item"===i?n:"")}});let j,$,w,C,k,A,S,V,R,q,T=e=>e;class H extends(u(e)){static get styles(){return[super.styles,d(j||(j=T`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}`))]}renderControl(){const e=l($||($=T` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20"> <foxy-i18n infer="" key="or"></foxy-i18n> </div> <div class="flex-1 border-t border-contrast-10"></div> <div class="w-m ml-s flex-shrink-0"></div> </div> `));return l(w||(w=T` <div class="mb-s" ?hidden="${0}"> <p class="font-medium text-body text-l" ?hidden="${0}">${0}</p> <p class="text-s text-secondary" ?hidden="${0}">${0}</p> </div> <div class="rounded bg-contrast-5" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> <p class="text-s text-error mt-s" ?hidden="${0}"> ${0} </p> `),!this.label&&!this.helperText,!this.label,this.label,!this.helperText,this.helperText,p([...Object.entries(this._value||{}),null],((e,t)=>String(t)),((t,r)=>null===t?[r>0?e:"",this.__renderRule({onChange:({key:e,items:t})=>{var r;this._value=s(s({},this._value),{},{[e]:[...null!==(r=this._value[e])&&void 0!==r?r:[],...t]})}})]:[r>0?e:"",this.__renderRule({rule:{key:t[0],items:t[1]},onChange:e=>{var r,s;const o={},i=Object.keys(this._value);for(let n=0;n<i.length;n++){const a=i[n];if(a===t[0])if(e.key===a)o[a]=e.items;else{const t=null!==(r=this._value[e.key])&&void 0!==r?r:[];n>i.indexOf(e.key)?o[e.key]=[...t,...e.items]:(o[e.key]=[...e.items,...t],i.splice(i.indexOf(e.key),1))}else o[a]=null!==(s=this._value[a])&&void 0!==s?s:[]}this._value=o},onDelete:()=>{const e=s({},this._value);delete e[t[0]],this._value=e}})])),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:{}}set _value(e){super._value=e}__renderRule({rule:e,onDelete:t,onChange:r}){var s,o;const i=null!==(s=null==e?void 0:e.items)&&void 0!==s?s:[];return l(C||(C=T` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base"> <div class="${0}"> <div aria-hidden="true"> ${0} </div> </div> </div> <div class="bg-base"> <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> </div> </div> </div> </div> <div class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent" ?hidden="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> </div> `),this.t("rule"),a({"text-tertiary":!this.readonly&&!this.disabled,"text-disabled":this.readonly||this.disabled,"w-m h-m":!0}),c(k||(k=T`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/></svg>`)),this.__renderInput({value:null!==(o=null==e?void 0:e.key)&&void 0!==o?o:"",label:this.t("option_name"),onChange:e=>{void 0===e?null==t||t():r({key:e,items:i})}}),a({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"cursor-default text-tertiary":!(this.disabled||this.readonly),"text-disabled cursor-default":this.disabled||this.readonly}),c(A||(A=T`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/><path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/></svg>`)),p(this.readonly?i:[...i,null],((e,t)=>t),((t,s)=>l(S||(S=T` <div class="bg-base"> ${0} </div> `),this.__renderInput({value:null!=t?t:"",label:t?String(s+1):this.t("add_value"),onChange:o=>{const n=[...i];o?null===t?n.push(o):n[s]=o:n.splice(s,1),e&&r({key:e.key,items:n})}})))),this.readonly||0===Object.keys(this._value).length,this.t("delete"),a({"box-content flex items-center justify-center":!0,"w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!e}),this.disabled||this.readonly||!e,(()=>null==t?void 0:t()),c(V||(V=T`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)))}__renderInput(e){return l(R||(R=T` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @change="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.label,a({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,this.disabled||this.readonly,(t=>{const r=t.currentTarget;"Backspace"!==t.key||r.value||e.onChange()}),(t=>{t.currentTarget.value||e.onChange()}),(t=>{const r=t.currentTarget;e.onChange(r.value)}),a({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly}),this.t(e.label),this.disabled||this.readonly?"":l(q||(q=T` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}}customElements.define("foxy-internal-array-map-control",H);let O,L,M,I,P,B=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_details)&&void 0!==e?e:"",o=null!==(t=null==r?void 0:r.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",i=this.helperText,n=this.__renderRulesDescription(),d=this._errorMessage;return l(O||(O=B` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),a({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:s,type:o,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,r=this.nucleon;null==r||r.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),i||n?l(L||(L=B` <p class="${0}"> ${0} </p> `),a({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),n||i):"",!d||this.disabled||this.readonly?"":l(M||(M=B`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",o=null!==(t=null==r?void 0:r.form.coupon_discount_details)&&void 0!==t?t:"";return o?this.t("discount_summary",{params:{details:o,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,t=null==e?void 0:e.form.coupon_discount_details,r=null==e?void 0:e.form.coupon_discount_type,o=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],i=o.find((e=>e.details===t&&e.type===r));return l(I||(I=B` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),a({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),i?this.t("discount_summary",{params:s(s({},i),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,r;const s=e.currentTarget,i=o[s.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(r=null==i?void 0:i.type)&&void 0!==r?r:"quantity_amount"})}),o.map((e=>l(P||(P=B` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===i,this.t("discount_summary",{params:s(s({},e),{},{ns:this.ns})})))),!i&&!!t&&!!r,this.t("custom_discount"))}});let z,D,G=e=>e;const Z=u(m(f,"coupon-form"));class E extends Z{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerAttributeRestrictionsGetValue=()=>{var e;const s=new URLSearchParams(t(r(null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:"").filter((e=>Array.isArray(e)||"string"==typeof e.name)).map((e=>{if(Array.isArray(e))return e.filter((({name:e})=>"string"==typeof e)).map((({name:e,operator:t,value:r})=>({path:e,operator:t,value:r})));return{operator:e.operator,value:e.value,path:e.name}}))));return s.delete("zoom"),s.toString()},this.__customerAttributeRestrictionsSetValue=e=>{const s=new URLSearchParams(t(r(e).map((e=>{if(Array.isArray(e))return e.map((({path:e,operator:t,value:r})=>({name:e,path:"attributes",operator:t,value:r})));return{operator:e.operator,value:e.value,path:"attributes",name:e.path}}))));s.delete("zoom"),this.edit({customer_attribute_restrictions:s.toString()})},this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join(",")})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:n.String},{label:"used_codes",path:"number_of_uses_to_date",type:n.Number},{label:"date_created",path:"date_created",type:n.Date},{label:"date_modified",path:"date_modified",type:n.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return s(s({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),new o(e.join(" ").trim())}get headerSubtitleOptions(){return s(s({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return l(z||(z=G` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,s,o,i,n,a;let d;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),d=r.toString()}catch(e){d=void 0}return l(D||(D=G` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-array-map-control infer="item-option-restrictions"> </foxy-internal-array-map-control> <foxy-internal-summary-control infer="customer-restrictions"> <foxy-internal-query-builder-control layout="summary-item" infer="customer-attribute-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control layout="summary-item" infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),d,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],this.__customerAttributeRestrictionsGetValue,this.__customerAttributeRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,h(null===(r=this.data)||void 0===r?void 0:r._links.self.href),h(null===(o=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===o?void 0:o._links["fx:item_categories"].href),h(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),h(null===(n=this.data)||void 0===n?void 0:n._links["fx:attributes"].href),super.renderBody(),h(null===(a=this.data)||void 0===a?void 0:a._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",E);export{E as CouponForm};
@@ -1 +1 @@
1
- import{a as e}from"./shared-55bc51c8.js";import"./shared-c9f3f8d3.js";import"./shared-51bb937b.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-838cc86b.js";import{I as r}from"./shared-a4b0ccf4.js";import"./foxy-query-builder.js";import{_ as s,B as a}from"./shared-d1195c27.js";import{a as i}from"./shared-4efc6bb8.js";import{d as o,e as d}from"./shared-641786b2.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-17a61265.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./shared-9e94c56d.js";import"./shared-de45ad84.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./foxy-copy-to-clipboard.js";import"./shared-24c7c37f.js";import"./shared-e1850e5f.js";import"./shared-4e1b5fa3.js";import"./shared-64d9ac2a.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-8874ec69.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-a0c6a159.js";let n,l,m=e=>e;customElements.define("foxy-internal-filter-attribute-form-action-control",class extends e{renderControl(){const e=this.nucleon,r=null==e?void 0:e.in({idle:{snapshot:"dirty"}}),s=!!(null==e?void 0:e.data);return t(n||(n=m` <div class="grid grid-cols-2 gap-m"> ${0} <vaadin-button theme="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </vaadin-button> </div> `),s&&r?t(l||(l=m` <vaadin-button theme="contrast" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="reset"></foxy-i18n> </vaadin-button> `),this.disabled,(()=>null==e?void 0:e.undo())):"",s?r?"secondary":"error":"success",s&&r?"":"col-span-2",this.disabled,(()=>!s||r?null==e?void 0:e.submit():null==e?void 0:e.delete()),s?r?"update":"delete":"create")}});let c,h=e=>e;const u=i(r,"filter-attribute-form");class p extends u{constructor(){super(...arguments),this.pathname=null,this.options=[],this.__filterNameGetValue=()=>{const e=this.constructor;return this.__getValueParam(e.filterNameKey)},this.__filterNameSetValue=e=>{const t=this.constructor;this.__setValueParam(t.filterNameKey,e)}}static get properties(){return s(s({},super.properties),{},{pathname:{},options:{type:Array}})}get hiddenSelector(){const e=[],t=this.constructor,r=this.__getValueParam(t.filterQueryKey),s=!!this.data;return s||e.push("filter-name"),r||s||e.push("action"),new a(`${e.join(" ")} ${super.hiddenSelector}`.trim())}renderBody(){const e=this.constructor;return t(c||(c=h` <foxy-query-builder infer="filter-query" .options="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-internal-text-control infer="filter-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-filter-attribute-form-action-control infer="action"> </foxy-internal-filter-attribute-form-action-control> `),this.options,this.__getValueParam(e.filterQueryKey),this.__handleFilterQueryChange,this.__filterNameGetValue,this.__filterNameSetValue)}updated(e){var t;if(super.updated(e),"string"==typeof this.form.value){const e=new URL(o(this.form.value),"https://example.com");e.pathname=null!==(t=this.pathname)&&void 0!==t?t:"";const r=d(e.toString().substring(e.origin.length));r!==this.form.value&&this.edit({value:r})}}submit(){const e=this.constructor;this.edit({visibility:e.attributeVisibility,name:e.attributeName}),super.submit()}__getValueParam(e){var t,r;try{return null!==(r=new URL(o(null!==(t=this.form.value)&&void 0!==t?t:""),"https://example.com").searchParams.get(e))&&void 0!==r?r:""}catch(e){return""}}__setValueParam(e,t){var r;try{const s=new URL(o(null!==(r=this.form.value)&&void 0!==r?r:""),"https://example.com");s.searchParams.set(e,t),this.edit({value:d(s.toString().substring(s.origin.length))})}catch(e){}}__handleFilterQueryChange(e){var t;const r=this.constructor,s=e.currentTarget;this.__setValueParam(r.filterQueryKey,null!==(t=s.value)&&void 0!==t?t:"")}}p.attributeVisibility="restricted",p.filterQueryKey="filter_query",p.attributeName="foxy-admin-bookmark",p.filterNameKey="filter_name",customElements.define("foxy-filter-attribute-form",p);export{p as FilterAttributeForm};
1
+ import{a as t}from"./shared-55bc51c8.js";import"./shared-c9f3f8d3.js";import"./shared-51bb937b.js";import{h as e}from"./shared-dc73b9a5.js";import"./shared-838cc86b.js";import{I as r}from"./shared-a4b0ccf4.js";import"./shared-f1b29592.js";import{_ as s,B as a}from"./shared-d1195c27.js";import{a as i}from"./shared-4efc6bb8.js";import{d as o,e as d}from"./shared-641786b2.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-17a61265.js";import"./shared-2ad18636.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-1cfea4b6.js";import"./shared-4d543043.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./shared-9e94c56d.js";import"./shared-de45ad84.js";import"./shared-011d6240.js";import"./shared-d8cd61ed.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-c89f7ad5.js";import"./shared-783f6e58.js";import"./foxy-copy-to-clipboard.js";import"./shared-24c7c37f.js";import"./shared-e1850e5f.js";import"./shared-4e1b5fa3.js";import"./shared-64d9ac2a.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-8874ec69.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-a0c6a159.js";let n,l,m=t=>t;customElements.define("foxy-internal-filter-attribute-form-action-control",class extends t{renderControl(){const t=this.nucleon,r=null==t?void 0:t.in({idle:{snapshot:"dirty"}}),s=!!(null==t?void 0:t.data);return e(n||(n=m` <div class="grid grid-cols-2 gap-m"> ${0} <vaadin-button theme="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </vaadin-button> </div> `),s&&r?e(l||(l=m` <vaadin-button theme="contrast" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="reset"></foxy-i18n> </vaadin-button> `),this.disabled,(()=>null==t?void 0:t.undo())):"",s?r?"secondary":"error":"success",s&&r?"":"col-span-2",this.disabled,(()=>!s||r?null==t?void 0:t.submit():null==t?void 0:t.delete()),s?r?"update":"delete":"create")}});let c,h=t=>t;const u=i(r,"filter-attribute-form");class p extends u{constructor(){super(...arguments),this.pathname=null,this.options=[],this.__filterNameGetValue=()=>{const t=this.constructor;return this.__getValueParam(t.filterNameKey)},this.__filterNameSetValue=t=>{const e=this.constructor;this.__setValueParam(e.filterNameKey,t)}}static get properties(){return s(s({},super.properties),{},{pathname:{},options:{type:Array}})}get hiddenSelector(){const t=[],e=this.constructor,r=this.__getValueParam(e.filterQueryKey),s=!!this.data;return s||t.push("filter-name"),r||s||t.push("action"),new a(`${t.join(" ")} ${super.hiddenSelector}`.trim())}renderBody(){const t=this.constructor;return e(c||(c=h` <foxy-query-builder infer="filter-query" .options="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-internal-text-control infer="filter-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-filter-attribute-form-action-control infer="action"> </foxy-internal-filter-attribute-form-action-control> `),this.options,this.__getValueParam(t.filterQueryKey),this.__handleFilterQueryChange,this.__filterNameGetValue,this.__filterNameSetValue)}updated(t){var e;if(super.updated(t),"string"==typeof this.form.value){const t=new URL(o(this.form.value),"https://example.com");t.pathname=null!==(e=this.pathname)&&void 0!==e?e:"";const r=d(t.toString().substring(t.origin.length));r!==this.form.value&&this.edit({value:r})}}submit(){const t=this.constructor;this.edit({visibility:t.attributeVisibility,name:t.attributeName}),super.submit()}__getValueParam(t){var e,r;try{return null!==(r=new URL(o(null!==(e=this.form.value)&&void 0!==e?e:""),"https://example.com").searchParams.get(t))&&void 0!==r?r:""}catch(t){return""}}__setValueParam(t,e){var r;try{const s=new URL(o(null!==(r=this.form.value)&&void 0!==r?r:""),"https://example.com");s.searchParams.set(t,e),this.edit({value:d(s.toString().substring(s.origin.length))})}catch(t){}}__handleFilterQueryChange(t){var e;const r=this.constructor,s=t.currentTarget;this.__setValueParam(r.filterQueryKey,null!==(e=s.value)&&void 0!==e?e:"")}}p.attributeVisibility="restricted",p.filterQueryKey="filter_query",p.attributeName="foxy-admin-bookmark",p.filterNameKey="filter_name",customElements.define("foxy-filter-attribute-form",p);export{p as FilterAttributeForm};
@@ -1,64 +1 @@
1
- import"./shared-64d9ac2a.js";import"./shared-e1850e5f.js";import{_ as e}from"./shared-d1195c27.js";import{s as l,h as t,c as a,L as s}from"./shared-dc73b9a5.js";import{T as n,O as r}from"./shared-8874ec69.js";import{o}from"./shared-8438d4ca.js";import{c as i}from"./shared-4e709717.js";import{i as d}from"./shared-9803aa7c.js";import{a as u}from"./shared-79d0699c.js";import{r as c}from"./shared-a0c6a159.js";import{R as v,T as p,a as b}from"./shared-4efc6bb8.js";import{I as h}from"./shared-17a61265.js";import{C as f}from"./shared-d1cb97c6.js";import"./shared-4d543043.js";let g;const m=l(g||(g=(e=>e)`
2
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
3
- <path d="M26.4 14.7399C26.4 15.2922 25.9523 15.7399 25.4 15.7399H10.6C10.0477 15.7399 9.60001 15.2922 9.60001 14.7399V14.2C9.60001 13.6477 10.0477 13.2 10.6 13.2H25.4C25.9523 13.2 26.4 13.6477 26.4 14.2V14.7399ZM26.4 21.8C26.4 22.3523 25.9523 22.8 25.4 22.8H10.6C10.0477 22.8 9.60001 22.3523 9.60001 21.8V21.2601C9.60001 20.7078 10.0477 20.2601 10.6 20.2601H25.4C25.9523 20.2601 26.4 20.7078 26.4 21.2601V21.8Z" class="fill-current"/>
4
- </svg>
5
- `));let C;const y=l(C||(C=(e=>e)`
6
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
7
- <path d="M12.8656 14.6695C12.3425 14.4581 12 13.9503 12 13.386C12 12.3748 13.0489 11.7048 13.9663 12.1299L23.8937 16.7295C24.5323 17.0254 24.941 17.6652 24.941 18.369C24.941 19.0735 24.5316 19.7137 23.8921 20.0092L13.971 24.5938C13.0509 25.019 12 24.347 12 23.3334C12 22.7709 12.3394 22.264 12.8594 22.0496L21.341 18.3046L12.8656 14.6695Z" class="fill-current"/>
8
- </svg>
9
- `));let x;const w=l(x||(x=(e=>e)`
10
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
11
- <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"/>
12
- <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"/>
13
- </svg>
14
- `));let V;const $=l(V||(V=(e=>e)`
15
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
16
- <path fill-rule="evenodd" clip-rule="evenodd" d="M20.05 23.58L20.04 23.59L17.64 21.19L18.7 20.13L20.05 21.48L22.54 19L23.6 20.06L20.06 23.6L20.05 23.58ZM18 8C12.5 8 8 12.5 8 18C8 23.5 12.5 28 18 28C23.5 28 28 23.5 28 18C28 12.5 23.5 8 18 8ZM13.34 12.28L14.75 13.69L16.16 12.28L17.22 13.34L15.81 14.75L17.22 16.16L16.16 17.22L14.75 15.81L13.34 17.22L12.28 16.16L13.69 14.75L12.28 13.34L13.34 12.28ZM18 26C15.8 26 13.8 25.1 12.3 23.7L23.7 12.3C25.1 13.8 26 15.8 26 18C26 22.4 22.4 26 18 26Z" class="fill-current"/>
17
- </svg>
18
- `));let H;const L=l(H||(H=(e=>e)`
19
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
20
- <path d="M22.8754 22.054C23.3985 22.2655 23.741 22.7733 23.741 23.3375C23.741 24.3487 22.6922 25.0187 21.7747 24.5936L11.8473 19.994C11.2087 19.6981 10.8 19.0583 10.8 18.3545C10.8 17.65 11.2094 17.0098 11.8489 16.7143L21.7701 12.1297C22.6902 11.7045 23.741 12.3765 23.741 13.3902C23.741 13.9526 23.4017 14.4596 22.8816 14.6739L14.4 18.4189L22.8754 22.054Z" class="fill-current"/>
21
- </svg>
22
- `));let M;const Z=l(M||(M=(e=>e)`
23
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
24
- <path d="M22.8754 19.654C23.3985 19.8655 23.741 20.3733 23.741 20.9375C23.741 21.9487 22.6922 22.6187 21.7747 22.1936L11.8473 17.594C11.2087 17.2981 10.8 16.6584 10.8 15.9545C10.8 15.25 11.2094 14.6098 11.8489 14.3143L21.7701 9.72971C22.6902 9.30453 23.741 9.97655 23.741 10.9902C23.741 11.5527 23.4017 12.0596 22.8816 12.2739L14.4 16.0189L22.8754 19.654Z" class="fill-current"/>
25
- <path fill-rule="evenodd" clip-rule="evenodd" d="M10.9169 20.9941C11.2134 20.3281 11.9937 20.0286 12.6597 20.3251L22.8548 24.8643C23.5208 25.1608 23.8203 25.9411 23.5238 26.6071C23.2273 27.2731 22.447 27.5726 21.781 27.2761L11.5859 22.7369C10.9199 22.4404 10.6204 21.6601 10.9169 20.9941Z" class="fill-current"/>
26
- </svg>
27
- `));let O;const j=l(O||(O=(e=>e)`
28
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
29
- <path fill-rule="evenodd" clip-rule="evenodd" d="M24.0049 7.11C24.6649 7.49107 24.8911 8.33507 24.51 8.99511L13.1621 28.6503C12.781 29.3103 11.937 29.5365 11.277 29.1554C10.6169 28.7743 10.3908 27.9303 10.7719 27.2703L22.1198 7.61511C22.5009 6.95507 23.3448 6.72892 24.0049 7.11Z" class="fill-current"/>
30
- <path d="M17.5097 13.2H10.8C10.1373 13.2 9.60001 13.7373 9.60001 14.4V14.5399C9.60001 15.2026 10.1373 15.7399 10.8 15.7399H16.0433L17.5097 13.2Z" class="fill-current"/>
31
- <path d="M13.4336 20.2601H10.8C10.1373 20.2601 9.60001 20.7973 9.60001 21.4601V21.6C9.60001 22.2627 10.1373 22.8 10.8 22.8H11.9671L13.4336 20.2601Z" class="fill-current"/>
32
- <path d="M17.9254 22.8H25.2C25.8627 22.8 26.4 22.2627 26.4 21.6V21.4601C26.4 20.7973 25.8627 20.2601 25.2 20.2601H19.3918L17.9254 22.8Z" class="fill-current"/>
33
- <path d="M22.0015 15.7399H25.2C25.8627 15.7399 26.4 15.2026 26.4 14.5399V14.4C26.4 13.7373 25.8627 13.2 25.2 13.2H23.468L22.0015 15.7399Z" class="fill-current"/>
34
- </svg>
35
- `));let N;const I=l(N||(N=(e=>e)`
36
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
37
- <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"/>
38
- <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"/>
39
- </svg>
40
- `));let A;const B=l(A||(A=(e=>e)`
41
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
42
- <path d="M10 13V15C10 15.55 9.55 16 9 16H8V20H9C9.55 20 10 20.45 10 21V23C10 24.65 11.35 26 13 26H16V24H13C12.45 24 12 23.55 12 23V21C12 19.7 11.16 18.58 10 18.17V17.83C11.16 17.42 12 16.3 12 15V13C12 12.45 12.45 12 13 12H16V10H13C11.35 10 10 11.35 10 13Z" class="fill-current"/>
43
- <path d="M27 16C26.45 16 26 15.55 26 15V13C26 11.35 24.65 10 23 10H20V12H23C23.55 12 24 12.45 24 13V15C24 16.3 24.84 17.42 26 17.83V18.17C24.84 18.58 24 19.69 24 21V23C24 23.55 23.55 24 23 24H20V26H23C24.65 26 26 24.65 26 23V21C26 20.45 26.45 20 27 20H28V16H27Z" class="fill-current"/>
44
- </svg>
45
- `));let T;const _=l(T||(T=(e=>e)`
46
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
47
- <path d="M23.8333 17.0588H22.0833V11.7647H20.3333V10H23.8333V17.0588Z" class="fill-current"/>
48
- <path d="M15.6667 10H12.1667C11.525 10 11 10.5294 11 11.1765V15.8824C11 16.5294 11.525 17.0588 12.1667 17.0588H15.6667C16.3083 17.0588 16.8333 16.5294 16.8333 15.8824V11.1765C16.8333 10.5294 16.3083 10 15.6667 10ZM15.0833 15.2941H12.75V11.7647H15.0833V15.2941Z" class="fill-current"/>
49
- <path d="M15.6667 26.4706H13.9167V21.1765H12.1667V19.4118H15.6667V26.4706Z" class="fill-current"/>
50
- <path d="M23.8333 19.4118H20.3333C19.6917 19.4118 19.1667 19.9412 19.1667 20.5882V25.2941C19.1667 25.9412 19.6917 26.4706 20.3333 26.4706H23.8333C24.475 26.4706 25 25.9412 25 25.2941V20.5882C25 19.9412 24.475 19.4118 23.8333 19.4118ZM23.25 24.7059H20.9167V21.1765H23.25V24.7059Z" class="fill-current"/>
51
- </svg>
52
- `));let D;const S=l(D||(D=(e=>e)`
53
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
54
- <path d="M25 10H24V8H22V10H14V8H12V10H11C9.89 10 9.01 10.9 9.01 12L9 26C9 27.1 9.89 28 11 28H25C26.1 28 27 27.1 27 26V12C27 10.9 26.1 10 25 10ZM25 26H11V16H25V26ZM25 14H11V12H25V14ZM23 19H18V24H23V19Z" class="fill-current"/>
55
- </svg>
56
- `));let k;const z=l(k||(k=(e=>e)`
57
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
58
- <path d="M26.5 16L27 14H23L24 10H22L21 14H17L18 10H16L15 14H11L10.5 16H14.5L13.5 20H9.5L9 22H13L12 26H14L15 22H19L18 26H20L21 22H25L25.5 20H21.5L22.5 16H26.5ZM19.5 20H15.5L16.5 16H20.5L19.5 20Z" class="fill-current"/>
59
- </svg>
60
- `));let E;const q=l(E||(E=(e=>e)`
61
- <svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
62
- <path d="M11 11V14H16.5V26H19.5V14H25V11H11Z" class="fill-current"/>
63
- </svg>
64
- `));let R,U,G,W,F,J=e=>e;function K(e){var l,a,s;const n=null===(a=null===(l=e.list)||void 0===l?void 0:l.every((l=>l.value!==e.value)))||void 0===a||a;return t(R||(R=J` <label class="${0}"> <div class="relative flex-1 min-w-0 overflow-hidden"> <select class="${0}" ?disabled="${0}" @change="${0}"> ${0} ${0} </select> </div> ${0} </label> `),i({"flex items-center transition-colors group text-tertiary":!0,"cursor-pointer hover-bg-contrast-5":!e.disabled&&!e.readonly,"cursor-default":e.disabled||e.readonly}),i({"bg-transparent relative appearance-none flex h-m px-s":!0,"font-medium w-full max-w-full whitespace-nowrap focus-outline-none":!0,"text-tertiary":n&&!e.disabled,"text-body":!n&&!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":!n&&e.readonly,"cursor-pointer":!e.disabled&&!e.readonly,"cursor-default":e.disabled||e.readonly}),e.disabled||e.readonly,(l=>{const t=l.currentTarget,a=t.options[t.options.selectedIndex].value;e.onChange(a)}),n?t(U||(U=J` <option value="" disabled="disabled" ?selected="${0}">${0}</option> `),n,e.t(e.label)):"",null===(s=e.list)||void 0===s?void 0:s.map((({label:l,value:a})=>t(G||(G=J` <option value="${0}" ?selected="${0}"> ${0} </option> `),a,a===e.value,e.t(l)))),n?"":t(W||(W=J` <span class="${0}"> ${0} </span> ${0} `),i({"font-tnum text-xs font-medium border mr-s px-xs rounded-s border-current inline-block":!0,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.label),e.clearable&&!e.readonly?t(F||(F=J` <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="icon-inline text-l" icon="icons:remove-circle-outline"> </iron-icon> </button> `),e.t("delete"),i({"w-s h-s mr-xs flex items-center justify-center transition-colors rounded-full":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"hover-bg-contrast-5 hover-text-error text-body":!e.disabled,"text-disabled":e.disabled}),e.disabled,(()=>e.onChange(""))):""))}let P,Q,X,Y,ee,le=e=>e;function te(e){var l;const a=`${null!==(l=e.id)&&void 0!==l?l:String(Math.floor(Math.random()*Math.pow(10,8)))}-list`,s=!!e.displayValue;let n=e.value;if("date"===e.type){const l=new Date(e.value);n=isNaN(l.getTime())?"":u(l)}return t(P||(P=le` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> ${0} <input placeholder="${0}" class="${0}" list="${0}" type="${0}" max="${0}" .value="${0}" ?disabled="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} ${0} </label> `),s?t(Q||(Q=le` <div aria-hidden="true" class="${0}"> <div class="truncate">${0}</div> </div> `),i({"absolute inset-0 h-m px-s font-medium flex items-center":!0,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.displayValue)):"",n||"date"===e.type?"":e.t(e.label),i({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0,"opacity-0 focus-opacity-100":s}),d(e.list?a:void 0),"date"===e.type?"datetime-local":e.type,d("date"===e.type?"9999-12-31T23:59":""),n,e.disabled||e.readonly,(l=>{const t=l.currentTarget;let a=t.value;try{if("date"===e.type){const e=new Date(t.value);isNaN(e.getTime())||(a=e.toISOString())}}catch(e){}e.onChange(a)}),i({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!n||"date"===e.type,"sr-only":!n&&"date"!==e.type,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.label),e.list?t(X||(X=le` <datalist id="${0}"> ${0} </datalist> `),a,e.list.map((({label:l,value:a})=>t(Y||(Y=le`<option value="${0}">${0}</option>`),a,e.t(l))))):"",e.disabled||e.readonly?"":t(ee||(ee=le` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}let ae,se,ne=e=>e;let re,oe=e=>e;function ie({parsedValue:l,disabled:t,readonly:a,options:s,option:n,t:r,onChange:o}){return te({displayValue:null==n?void 0:n.label,disabled:t,readonly:a,value:l.path,label:"field",list:s.map((l=>e(e({},l),{},{value:l.path}))),type:"text",id:"path",t:r,onChange:e=>o({operator:null,value:"",path:e})})}let de,ue=e=>e;let ce,ve,pe=e=>e;function be(l){var a,s;const{parsedValue:d,isFullSize:u,isNested:v,readonly:p,disabled:b,options:h,t:f,onConvert:g,onDelete:C,onChange:x}=l,V=null!==(a=h.find((e=>e.path===d.path)))&&void 0!==a?a:null,H=null!==(s=null==V?void 0:V.type)&&void 0!==s?s:n.Any,M=d.operator,O={parsedValue:d,operators:l.operators,disabled:b,readonly:p,options:h,option:V,t:f,onChange:x},N={[n.Attribute]:B,[n.Boolean]:_,[n.Number]:z,[n.String]:q,[n.Date]:S,[n.Any]:I};return t(ce||(ce=pe` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="${0}"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base" title="${0}"> <div class="${0}" aria-hidden="true"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base">${0}</div> <div class="bg-base"> ${0} </div> </div> </div> </div> <div class="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="m-auto icon-inline text-xl" icon="icons:remove-circle-outline"> </iron-icon> </button> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="m-auto icon-inline text-xl" icon="icons:add-circle-outline"> </iron-icon> </button> </div> </div> `),f("query_builder_rule"),i({"flex-1 bg-base rounded overflow-hidden border":!0,"border-contrast-10":!v&&!p,"border-contrast-50":!!v||p,"border-dashed":p,"border-solid":!p}),f(`type_${H}`),i({"w-m h-m":!0,"text-tertiary":!p&&!b,"text-disabled":p||b}),V?N[H]:I,d.path&&(H===n.Attribute||d.name)?t(ve||(ve=pe` <div class="bg-contrast-10 grid gap-1px grid-cols-1 sm-grid-cols-2"> <div class="bg-base">${0}</div> <div class="bg-base">${0}</div> </div> `),ie(O),function(l){var t;return te({disabled:l.disabled,readonly:l.readonly,value:null!==(t=l.parsedValue.name)&&void 0!==t?t:"",label:"name",type:"text",t:l.t,onChange:t=>l.onChange(e(e({},l.parsedValue),{},{name:t}))})}(O)):ie(O),function(l){const a=l.parsedValue.operator,s={[r.GreaterThan]:y,[r.GreaterThanOrEqual]:o,[r.In]:w,[r.IsDefined]:$,[r.LessThan]:L,[r.LessThanOrEqual]:Z,[r.Not]:j},d={[n.Attribute]:[r.In,r.Not,r.IsDefined],[n.Boolean]:[],[n.String]:[r.In,r.Not],[n.Number]:[r.In,r.Not,r.GreaterThan,r.LessThan,r.GreaterThanOrEqual,r.LessThanOrEqual],[n.Date]:[r.In,r.Not],[n.Any]:Object.values(r)},u=(l.option?d[l.option.type]:l.parsedValue.name?Object.values(r):Object.values(r).filter((e=>e!==r.IsDefined))).filter((e=>l.operators.includes(e))),c=l.disabled||l.readonly||0===u.length||!l.parsedValue.path;return t(re||(re=oe` <button title="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <div aria-hidden="true">${0}</div> </button> `),l.t(`operator_${null!=a?a:"equal"}`),i({"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,"text-body hover-bg-contrast-5":!c&&u.length>1,"cursor-default text-tertiary":!c&&u.length<=1,"text-disabled cursor-default":c}),c||u.length<=1,(()=>{var t;const s=a?u.indexOf(a):-1,n=null!==(t=u[s+1])&&void 0!==t?t:null;l.onChange(e(e({},l.parsedValue),{},{operator:n,value:l.parsedValue.value}))}),a?s[a]:m)}(O),M===r.In?function(l){var a,s,r,o;const i=(null===(a=l.option)||void 0===a?void 0:a.list)?K:te,d=l.parsedValue.value.split(","),u=null!==(r=null===(s=l.option)||void 0===s?void 0:s.type)&&void 0!==r?r:n.Any,v=u===n.Number?"number":u===n.Date?"date":"text",p=null===(o=l.option)||void 0===o?void 0:o.list,b=[...d.filter((e=>!!e))];return l.readonly||b.push(null),t(ae||(ae=ne` <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> `),c(b,((e,l)=>l),((a,s)=>{var n;return t(se||(se=ne` <div class="bg-base"> ${0} </div> `),i({type:v,list:p,t:l.t,value:null!=a?a:"",label:a?String(s+1):"add_value",disabled:l.disabled,readonly:l.readonly,clearable:!0,displayValue:null===(n=null==p?void 0:p.find((e=>e.value===a)))||void 0===n?void 0:n.label,onChange:t=>{t?d[s]=t:d.splice(s,1),l.onChange(e(e({},l.parsedValue),{},{value:d.join(",")}))}}))})))}(O):M===r.IsDefined?function(l){return K({readonly:l.readonly,disabled:l.disabled,value:l.parsedValue.value,label:"value",list:[{label:"is_defined_true",value:"true"},{label:"is_defined_false",value:"false"}],t:l.t,onChange:t=>l.onChange(e(e({},l.parsedValue),{},{value:t}))})}(O):H===n.Boolean?function(l){var t,a,s,n,r,o;const{parsedValue:i,option:d,readonly:u,disabled:c,t:v,onChange:p}=l,b=null!==(s=null===(a=null===(t=null==d?void 0:d.list)||void 0===t?void 0:t.find((e=>"false"===e.value)))||void 0===a?void 0:a.label)&&void 0!==s?s:"false",h=[{label:null!==(o=null===(r=null===(n=null==d?void 0:d.list)||void 0===n?void 0:n.find((e=>"true"===e.value)))||void 0===r?void 0:r.label)&&void 0!==o?o:"true",value:"true"},{label:b,value:"false"}];return K({disabled:c,readonly:u,value:i.value,label:"value",list:h,t:v,onChange:l=>p(e(e({},i),{},{value:l}))})}(O):null===M&&[n.Number,n.Date].includes(H)?function(l){var a,s,r;const{t:o,parsedValue:i,option:d,readonly:u,disabled:c,onChange:v}=l,p=i.value.split(".."),b=p.length>=1?p[0]:"",h=p.length>=2?p[1]:"",f=(null==d?void 0:d.list)?K:te,g=null!==(a=null==d?void 0:d.type)&&void 0!==a?a:n.Any,m=g===n.Number?"number":g===n.Date?"date":"text",C=null==d?void 0:d.list;return t(de||(de=ue` <div class="grid bg-contrast-10 gap-1px grid-cols-1 grid-rows-2 sm-grid-cols-2 sm-grid-rows-1"> <div class="bg-base"> ${0} </div> <div class="bg-base"> ${0} </div> </div> `),f({displayValue:null===(s=null==C?void 0:C.find((e=>e.value===b)))||void 0===s?void 0:s.label,readonly:u,disabled:c,value:b,label:"range_from",type:m,list:C,t:o,onChange:l=>v(e(e({},i),{},{value:`${l}..${h}`}))}),f({displayValue:null===(r=null==C?void 0:C.find((e=>e.value===h)))||void 0===r?void 0:r.label,readonly:u,disabled:c,label:"range_to",value:h,type:m,list:C,t:o,onChange:l=>v(e(e({},i),{},{value:`${b}..${l}`}))}))}(O):function(l){var t,a,s,r;const{t:o,option:i,parsedValue:d,readonly:u,disabled:c,onChange:v}=l,p=(null==i?void 0:i.list)?K:te,b=null!==(t=null==i?void 0:i.type)&&void 0!==t?t:n.Any;return p({displayValue:null===(s=null===(a=null==i?void 0:i.list)||void 0===a?void 0:a.find((e=>e.value===d.value)))||void 0===s?void 0:s.label,readonly:u,disabled:c||!d.path,value:null!==(r=d.value)&&void 0!==r?r:"",label:"value",type:b===n.Number?"number":b===n.Date?"date":"text",list:null==i?void 0:i.list,t:o,onChange:l=>v(e(e({},d),{},{value:l}))})}(O),i({"-mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center":!0,"border-t border-b border-transparent divide-y divide-transparent":!0,hidden:!!u||p,flex:!u}),f("delete"),i({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!b,"cursor-default text-disabled":b,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0":!d.path}),b||p||!d.path,C,f("add_or_clause"),i({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-success hover-bg-contrast-5":!b,"cursor-default text-disabled":b,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0":!d.path||!!v||l.disableOr}),b||p||!d.path,g)}let he,fe,ge,me,Ce=e=>e;function ye(l){const a=l.parsedValues.some((e=>Array.isArray(e))),s=t(he||(he=Ce`<div class="${0}"></div>`),a?"h-xs":"mt-s"),n=t(fe||(fe=Ce` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-30"> ${0} </div> <div class="flex-1 border-t border-contrast-20"></div> <div class="w-m ml-s flex-shrink-0"></div> <div class="hidden sm-block w-m flex-shrink-0"></div> </div> `),l.t("or"));return t(ge||(ge=Ce` <div aria-label="${0}"> ${0} </div> `),l.t("query_builder_group"),c([...l.parsedValues,null],((e,l)=>String(l)),((a,r)=>{const o=r>0?l.isNested?n:s:"";return null===a?[o,be({operators:l.operators,disableOr:l.disableOr,isFullSize:!l.isNested&&0===l.parsedValues.length,isNested:l.isNested,disabled:l.disabled,readonly:l.readonly,options:l.options,parsedValue:{path:"",operator:null,value:""},t:l.t,onChange:e=>l.onChange([...l.parsedValues,e])})]:Array.isArray(a)?[o,t(me||(me=Ce` <div class="bg-contrast-10 rounded-t-l rounded-b-l p-s -m-s"> ${0} </div> `),ye({parsedValues:a,disableOr:l.disableOr,operators:l.operators,isNested:!0,disabled:l.disabled,readonly:l.readonly,options:l.options,t:l.t,onChange:e=>{const t=[...l.parsedValues],a=e;t[r]=e.length>1?a:a[0],l.onChange(t)}}))]:[o,be({parsedValue:a,disableOr:l.disableOr,operators:l.operators,isNested:l.isNested,disabled:l.disabled,readonly:l.readonly,options:l.options,t:l.t,onChange:e=>{const t=[...l.parsedValues];t[r]=e,l.onChange(t)},onDelete:()=>{const e=l.parsedValues.filter(((e,l)=>l!==r));l.onChange(e)},onConvert:()=>{const t=[...l.parsedValues];t[r]=[a,e(e({},a),{},{operator:null,value:""})],l.onChange(t)}})]})))}function xe(e){var l;const[t,a]=e.split("=").map(decodeURIComponent),s=null!==(l=Object.values(r).find((e=>t.endsWith(`:${e}`))))&&void 0!==l?l:null;let n,o=t.substring(0,s?t.lastIndexOf(":"):void 0);const i=t.lastIndexOf("[");return o.endsWith("]")&&-1!==i&&(n=o.substring(i+1,o.length-1),o=o.substring(0,i),o.endsWith(":name")&&(o=o.substring(0,o.length-5))),{name:n,path:o,value:a,operator:s}}function we(e){let l=e.path;return e.name&&(l+=`:name[${e.name}]`),e.operator&&(l+=`:${e.operator}`),l=`${encodeURIComponent(l)}=${encodeURIComponent(e.value)}`,"="===l?"":l}function Ve(e){const l=e.reduce(((e,l)=>{if(Array.isArray(l)){const t=[l[0].value,l.slice(1).map((e=>we(e)))].join("|");e.push(`${l[0].path}=${encodeURIComponent(t)}`)}else"zoom"!==l.path&&e.push(we(l));return e}),[]),t=$e(e).join(",");return t&&l.push(`zoom=${encodeURIComponent(t)}`),l.join("&")}function $e(e){return e.map((e=>{if(Array.isArray(e))return $e(e);if(e.name)return[e.path];const l=e.path.split(":");return l.slice(0,l.length-1)})).flat().sort(((e,l)=>l.length-e.length)).filter(((e,l,t)=>t.every(((t,a)=>(a>=l||t!==e)&&!t.startsWith(`${e}:`)))))}let He;const Le=a(He||(He=(e=>e)`.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}`)),Me=f(v(p(b(h(s),"query-builder"))));class Ze extends Me{constructor(){super(...arguments),this.operators=Object.values(r),this.disableOr=!1,this.options=null,this.value=null}static get properties(){return e(e({},super.properties),{},{disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array},options:{type:Array},value:{type:String}})}static get styles(){return[super.styles,Le]}render(){var e,l,t;const a=new Set(["zoom","limit","offset","order","fields"]),s=[],n=[];var r;return(r=null!==(e=this.value)&&void 0!==e?e:"",r.split("&").filter((e=>!!e)).map((e=>{const[l,t]=e.split("=").map(decodeURIComponent);return(null==t?void 0:t.includes("|"))?`${encodeURIComponent(l)}=${t}`.split("|").map((e=>xe(e))):xe(e)}))).forEach((e=>{Array.isArray(e)||!a.has(e.path)?n.push(e):s.push(e)})),ye({parsedValues:n,disableOr:this.disableOr,operators:null!==(l=this.operators)&&void 0!==l?l:[],disabled:this.disabled,readonly:this.readonly,options:null!==(t=this.options)&&void 0!==t?t:[],t:this.t.bind(this),onChange:e=>{this.value=Ve([...e,...s]),this.dispatchEvent(new Ze.ChangeEvent("change"))}})}}Ze.ChangeEvent=class extends CustomEvent{},Ze.Operator=r,Ze.Type=n,customElements.define("foxy-query-builder",Ze);export{Ze as QueryBuilder};
1
+ import"./shared-64d9ac2a.js";import"./shared-e1850e5f.js";export{Q as QueryBuilder}from"./shared-f1b29592.js";import"./shared-4d543043.js";import"./shared-4efc6bb8.js";import"./shared-d1195c27.js";import"./shared-dc73b9a5.js";import"./shared-8874ec69.js";import"./shared-8438d4ca.js";import"./shared-4e709717.js";import"./shared-9803aa7c.js";import"./shared-79d0699c.js";import"./shared-a0c6a159.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";
@@ -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-item-card.js";import"./foxy-item-form.js";import"./shared-51bb937b.js";import"./shared-3a066450.js";import"./shared-25324930.js";import"./shared-b74187e9.js";import{I as t}from"./shared-a4b0ccf4.js";import"./shared-c9f3f8d3.js";import"./shared-c89f7ad5.js";import{a as e}from"./shared-55bc51c8.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-dc73b9a5.js";import{N as n}from"./shared-2ad18636.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-9803aa7c.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-4efc6bb8.js";import"./shared-97e1f413.js";import"./shared-9ef03974.js";import"./shared-64d9ac2a.js";import"./shared-e1850e5f.js";import"./shared-4d543043.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-3491d10e.js";import"./shared-1cfea4b6.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./shared-de45ad84.js";import"./shared-91560256.js";import"./shared-a0c6a159.js";import"./shared-783f6e58.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-0e44bfff.js";import"./shared-0a24f318.js";import"./shared-0f261023.js";import"./shared-641786b2.js";import"./shared-2bf89a21.js";import"./shared-787e52c4.js";import"./shared-1cd2db2d.js";import"./shared-011d6240.js";import"./shared-9e94c56d.js";import"./shared-d8cd61ed.js";import"./shared-838cc86b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-73c1d31e.js";import"./shared-620dccaa.js";import"./foxy-form-dialog.js";import"./shared-99940888.js";import"./shared-85989cf3.js";import"./shared-045bd59c.js";import"./shared-9411a937.js";import"./shared-be093279.js";import"./shared-f0d70be1.js";import"./shared-34c84b9f.js";import"./shared-f97ed2ff.js";import"./shared-c7ffb9f2.js";import"./shared-906fe068.js";import"./shared-651c44fa.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-ac6e1790.js";import"./shared-57cc81b4.js";import"./shared-537d2efe.js";import"./shared-c6b69d4e.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-8438d4ca.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=t=>t;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 t=this.__state,e="fail"===t?"error":"idle"===t?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> `),(t=>!t.detail.cancelled&&this.__submit()),e,"busy"===t||this.disabled,(t=>{this.renderRoot.querySelector("#confirm").show(t.currentTarget)}),t)}async __submit(){var t;if("busy"!==this.__state)try{this.__state="busy";const e=new n.API(this),o=await e.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let m,h,_,y,v=t=>t;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 t,e,o,i;const n=this.nucleon,c=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t._links["fx:customer"].href,u=c?null===(e=null==n?void 0:n.getCustomerPageHref)||void 0===e?void 0:e.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-s font-medium leading-xs mb-xs" 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":!0,"ring-1 ring-contrast-10":!u,"cursor-pointer bg-contrast-5 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(t,e,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)),(t=>"idle"!==s&&t.stopPropagation()),(t=>"idle"!==s&&t.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),t,e,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(t,e){this[e]="busy";try{await navigator.clipboard.writeText(t),this[e]="done"}catch(t){this[e]="fail"}setTimeout((()=>this[e]="idle"),3e3)}});let x,b,g,j,w,$,k=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var t,e,o,i,s,n,a,d,l,c;return r(x||(x=k` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} </div> `),(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._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():"")}__renderSendEmailsAction(){var t,e;return r(b||(b=k` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,e;return r(g||(g=k` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,e,o;return r(j||(j=k` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,e,o;return r(w||(w=k` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderSubscriptionAction(){var t,e,o;const i=this.nucleon,s=null===(e=null===(t=null==i?void 0:i.data)||void 0===t?void 0:t._links["fx:subscription"])||void 0===e?void 0:e.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` <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))}});let S,P,A,C,H,L,E,I,R,B,q=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var t,e,o,i,s,n,a,l,c;const u=null===(t=this.nucleon)||void 0===t?void 0:t.data;if(!u)return r(S||(S=q``));const f=null!==(o=null===(e=null==u?void 0:u._embedded)||void 0===e?void 0:e["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(P||(P=q` <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(A||(A=q` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((t=>r(C||(C=q` <span>${0}&colon;</span> <span>${0}</span> `),t.shipping_service_description,this.__renderPrice(t.total_shipping,!0)))),0===f.length||0===u.total_tax?r(H||(H=q` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((t=>r(L||(L=q` <span>${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.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((t=>{var e;return r(E||(E=q` <span>${0}&colon;</span> <span>${0}</span> `),t._embedded["fx:gift_card"].name,this.__renderPrice(null!==(e=t.balance_adjustment)&&void 0!==e?e: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((t=>r(I||(I=q` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var t,e,o;return null===(o=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var t,e;const o=`#${this.__storeLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(o))||void 0===t?void 0:t.data)&&void 0!==e?e:null}__renderPrice(t,e=!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(R||(R=q` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),e&&0!==t?t>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:e?"exceptZero":"auto",amount:`${t} ${a}`})}__renderStatus(){var t,e;const o=(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e.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(B||(B=q` <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 G,T,U,Z=t=>t;const M=c(u(t,"transaction"));class O extends M{constructor(){var t;super(...arguments),t=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(e){if(!t.data)return;const o=t.data._links["fx:send_webhooks"].href,i=new O.API(t),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:e.map((t=>a(t._links.self.href))),event:"refeed"})});if(e.forEach((t=>{O.Rumour("").share({related:[...e.map((t=>t._links["fx:logs"].href)),...e.map((t=>t._links["fx:statuses"].href))],source:t._links.self.href,data:t})})),!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 t,e,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==e?e: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 t,e,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===(t=this.data)||void 0===t?void 0:t.type;return(null===(e=this.data)||void 0===e?void 0:e._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 t,e,o,i,r;const s=null===(t=this.data)||void 0===t?void 0:t.source,n=null===(e=this.data)||void 0===e?void 0:e.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 t,e,o;return null!==(o=null===(e=null===(t=this.data)||void 0===t?void 0:t.display_id)||void 0===e?void 0:e.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(G||(G=Z` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var t,e,o,i,s,n,a,l,c,u,f,p,m,h,_;let y,v,x;const b=this.hiddenSelector;if(this.data)try{const o=new URL(this.data._links["fx:shipments"].href),i=new URL(null!==(e=null===(t=this.__storeLoader)||void 0===t?void 0:t.data._links["fx:webhooks"].href)&&void 0!==e?e:""),r=new URL(this.data._links["fx:items"].href);o.searchParams.set("zoom","items:item_category"),i.searchParams.set("event_resource","transaction"),r.searchParams.set("zoom","item_options"),y=o.toString(),v=i.toString(),x=r.toString()}catch(t){}return r(T||(T=Z` ${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> <div class="grid gap-m sm-grid-cols-2" ?hidden="${0}"> <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> </div> <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!==(i=null===(o=this.data)||void 0===o?void 0:o.status)&&void 0!==i?i:"")?r(U||(U=Z` <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===(s=this.data)||void 0===s?void 0:s.status):"",b.matches("items",!0)&&b.matches("summary",!0),d(x),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(a=null===(n=this.__storeLoader)||void 0===n?void 0:n.data)||void 0===a?void 0:a._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href},d(null===(c=this.data)||void 0===c?void 0:c._links["fx:billing_addresses"].href),d(null===(u=this.data)||void 0===u?void 0:u._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},b.matches("custom-fields",!0)&&b.matches("attributes",!0),d(null===(f=this.data)||void 0===f?void 0:f._links["fx:custom_fields"].href),d(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),d(y),d(v),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(h=null===(m=this.data)||void 0===m?void 0:m._links["fx:process_webhook"])||void 0===h?void 0:h.href),d(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",O);export{O 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-51bb937b.js";import"./shared-3a066450.js";import"./shared-25324930.js";import"./shared-b74187e9.js";import{I as t}from"./shared-a4b0ccf4.js";import"./shared-c9f3f8d3.js";import"./shared-c89f7ad5.js";import{a as e}from"./shared-55bc51c8.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-dc73b9a5.js";import{N as n}from"./shared-2ad18636.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-9803aa7c.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-4efc6bb8.js";import"./shared-97e1f413.js";import"./shared-9ef03974.js";import"./shared-64d9ac2a.js";import"./shared-e1850e5f.js";import"./shared-4d543043.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-3491d10e.js";import"./shared-1cfea4b6.js";import"./shared-8a8bfd72.js";import"./shared-61ade33e.js";import"./shared-de45ad84.js";import"./shared-91560256.js";import"./shared-a0c6a159.js";import"./shared-783f6e58.js";import"./shared-24c7c37f.js";import"./shared-4e1b5fa3.js";import"./shared-0e44bfff.js";import"./shared-0a24f318.js";import"./shared-0f261023.js";import"./shared-641786b2.js";import"./shared-2bf89a21.js";import"./shared-787e52c4.js";import"./shared-1cd2db2d.js";import"./shared-011d6240.js";import"./shared-9e94c56d.js";import"./shared-d8cd61ed.js";import"./shared-838cc86b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-1c169878.js";import"./shared-f0d70be1.js";import"./shared-34c84b9f.js";import"./shared-f97ed2ff.js";import"./shared-c7ffb9f2.js";import"./shared-906fe068.js";import"./shared-651c44fa.js";import"./shared-08e42e78.js";import"./shared-9de0a899.js";import"./shared-73c1d31e.js";import"./shared-620dccaa.js";import"./foxy-form-dialog.js";import"./shared-99940888.js";import"./shared-85989cf3.js";import"./shared-045bd59c.js";import"./shared-9411a937.js";import"./shared-be093279.js";import"./shared-ac6e1790.js";import"./shared-57cc81b4.js";import"./shared-537d2efe.js";import"./shared-c6b69d4e.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-8438d4ca.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=t=>t;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 t=this.__state,e="fail"===t?"error":"idle"===t?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> `),(t=>!t.detail.cancelled&&this.__submit()),e,"busy"===t||this.disabled,(t=>{this.renderRoot.querySelector("#confirm").show(t.currentTarget)}),t)}async __submit(){var t;if("busy"!==this.__state)try{this.__state="busy";const e=new n.API(this),o=await e.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let m,h,_,y,v=t=>t;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 t,e,o,i;const n=this.nucleon,c=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t._links["fx:customer"].href,u=c?null===(e=null==n?void 0:n.getCustomerPageHref)||void 0===e?void 0:e.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-s font-medium leading-xs mb-xs" 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":!0,"ring-1 ring-contrast-10":!u,"cursor-pointer bg-contrast-5 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(t,e,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)),(t=>"idle"!==s&&t.stopPropagation()),(t=>"idle"!==s&&t.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),t,e,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(t,e){this[e]="busy";try{await navigator.clipboard.writeText(t),this[e]="done"}catch(t){this[e]="fail"}setTimeout((()=>this[e]="idle"),3e3)}});let x,b,g,j,w,$,k=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var t,e,o,i,s,n,a,d,l,c;return r(x||(x=k` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} </div> `),(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._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():"")}__renderSendEmailsAction(){var t,e;return r(b||(b=k` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,e;return r(g||(g=k` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,e,o;return r(j||(j=k` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,e,o;return r(w||(w=k` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderSubscriptionAction(){var t,e,o;const i=this.nucleon,s=null===(e=null===(t=null==i?void 0:i.data)||void 0===t?void 0:t._links["fx:subscription"])||void 0===e?void 0:e.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` <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))}});let S,P,A,C,H,L,E,I,R,B,q=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var t,e,o,i,s,n,a,l,c;const u=null===(t=this.nucleon)||void 0===t?void 0:t.data;if(!u)return r(S||(S=q``));const f=null!==(o=null===(e=null==u?void 0:u._embedded)||void 0===e?void 0:e["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(P||(P=q` <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(A||(A=q` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((t=>r(C||(C=q` <span>${0}&colon;</span> <span>${0}</span> `),t.shipping_service_description,this.__renderPrice(t.total_shipping,!0)))),0===f.length||0===u.total_tax?r(H||(H=q` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((t=>r(L||(L=q` <span>${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.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((t=>{var e;return r(E||(E=q` <span>${0}&colon;</span> <span>${0}</span> `),t._embedded["fx:gift_card"].name,this.__renderPrice(null!==(e=t.balance_adjustment)&&void 0!==e?e: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((t=>r(I||(I=q` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var t,e,o;return null===(o=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var t,e;const o=`#${this.__storeLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(o))||void 0===t?void 0:t.data)&&void 0!==e?e:null}__renderPrice(t,e=!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(R||(R=q` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),e&&0!==t?t>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:e?"exceptZero":"auto",amount:`${t} ${a}`})}__renderStatus(){var t,e;const o=(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e.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(B||(B=q` <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 G,T,U,Z=t=>t;const M=c(u(t,"transaction"));class O extends M{constructor(){var t;super(...arguments),t=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(e){if(!t.data)return;const o=t.data._links["fx:send_webhooks"].href,i=new O.API(t),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:e.map((t=>a(t._links.self.href))),event:"refeed"})});if(e.forEach((t=>{O.Rumour("").share({related:[...e.map((t=>t._links["fx:logs"].href)),...e.map((t=>t._links["fx:statuses"].href))],source:t._links.self.href,data:t})})),!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 t,e,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==e?e: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 t,e,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===(t=this.data)||void 0===t?void 0:t.type;return(null===(e=this.data)||void 0===e?void 0:e._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 t,e,o,i,r;const s=null===(t=this.data)||void 0===t?void 0:t.source,n=null===(e=this.data)||void 0===e?void 0:e.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 t,e,o;return null!==(o=null===(e=null===(t=this.data)||void 0===t?void 0:t.display_id)||void 0===e?void 0:e.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(G||(G=Z` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var t,e,o,i,s,n,a,l,c,u,f,p,m,h,_;let y,v,x;const b=this.hiddenSelector;if(this.data)try{const o=new URL(this.data._links["fx:shipments"].href),i=new URL(null!==(e=null===(t=this.__storeLoader)||void 0===t?void 0:t.data._links["fx:webhooks"].href)&&void 0!==e?e:""),r=new URL(this.data._links["fx:items"].href);o.searchParams.set("zoom","items:item_category"),i.searchParams.set("event_resource","transaction"),r.searchParams.set("zoom","item_options"),y=o.toString(),v=i.toString(),x=r.toString()}catch(t){}return r(T||(T=Z` ${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> <div class="grid gap-m sm-grid-cols-2" ?hidden="${0}"> <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> </div> <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!==(i=null===(o=this.data)||void 0===o?void 0:o.status)&&void 0!==i?i:"")?r(U||(U=Z` <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===(s=this.data)||void 0===s?void 0:s.status):"",b.matches("items",!0)&&b.matches("summary",!0),d(x),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(a=null===(n=this.__storeLoader)||void 0===n?void 0:n.data)||void 0===a?void 0:a._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href},d(null===(c=this.data)||void 0===c?void 0:c._links["fx:billing_addresses"].href),d(null===(u=this.data)||void 0===u?void 0:u._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},b.matches("custom-fields",!0)&&b.matches("attributes",!0),d(null===(f=this.data)||void 0===f?void 0:f._links["fx:custom_fields"].href),d(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),d(y),d(v),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(h=null===(m=this.data)||void 0===m?void 0:m._links["fx:process_webhook"])||void 0===h?void 0:h.href),d(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",O);export{O as Transaction};