@foxy.io/elements 1.35.0-beta.1 → 1.35.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/shared-44118acb.js +1 -0
- package/dist/cdn/translations/experimental-add-to-cart-builder/en.json +445 -432
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.d.ts +1 -1
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +3 -3
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +1 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.d.ts +6 -0
- package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js +200 -123
- package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/index.d.ts +2 -0
- package/dist/elements/public/ExperimentalAddToCartBuilder/index.js +2 -0
- package/dist/elements/public/ExperimentalAddToCartBuilder/index.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/InternalExperimentalAddToCartBuilderCustomOptionCard.js +2 -2
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/InternalExperimentalAddToCartBuilderCustomOptionCard.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/types.d.ts +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/types.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/InternalExperimentalAddToCartBuilderCustomOptionForm.d.ts +2 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/InternalExperimentalAddToCartBuilderCustomOptionForm.js +50 -49
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/InternalExperimentalAddToCartBuilderCustomOptionForm.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/types.d.ts +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/types.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.d.ts +4 -0
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js +109 -91
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/types.d.ts +30 -27
- package/dist/elements/public/ExperimentalAddToCartBuilder/types.js.map +1 -1
- package/package.json +3 -2
- package/dist/cdn/shared-19cd0786.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-51fd39fa.js";import"./shared-84761b5b.js";import"./shared-7889f2f2.js";import"./shared-2cb3cb3a.js";import{b as r,I as o}from"./shared-44fd89ce.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import"./shared-57a98543.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as a}from"./shared-9803aa7c.js";import{h as s,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-5e0b71a2.js";import"./shared-018166d0.js";import"./shared-b16829cd.js";import"./shared-525c1936.js";import"./shared-cf0ca582.js";import"./shared-ec5b614e.js";import"./shared-8af5a4f2.js";import"./shared-eb7bf7ba.js";import"./shared-6de0e9f3.js";import"./shared-8b838d83.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-9fcd36e5.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-bb3c9e23.js";import"./shared-67898669.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-27e2e59a.js";import"./shared-ffc84c84.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-c5326ab8.js";import"./shared-a585bfd3.js";import"./shared-28b0e29a.js";import"./shared-b04e9753.js";import"./shared-53caa399.js";import"./shared-68fdcf24.js";import"./shared-112e521b.js";import"./shared-c5cb7e8a.js";import"./shared-e77d8d01.js";import"./shared-651c44fa.js";import"./shared-d3a5cb85.js";import"./shared-b1fa0b61.js";import"./shared-1c4ddc9b.js";import"./shared-32440b17.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-51c4a6dd.js";import"./foxy-copy-to-clipboard.js";import"./shared-573d6e21.js";import"./shared-4c4b87c2.js";import"./shared-bab2ea2c.js";import"./shared-a7617e76.js";import"./shared-238d397f.js";import"./shared-01f85a69.js";import"./shared-b77e1a8a.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-eadddff6.js";import"./foxy-custom-field-card.js";import"./shared-31d8e958.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-fc6bcfc5.js";import"./shared-da393323.js";import"./shared-
|
|
1
|
+
import"./shared-51fd39fa.js";import"./shared-84761b5b.js";import"./shared-7889f2f2.js";import"./shared-2cb3cb3a.js";import{b as r,I as o}from"./shared-44fd89ce.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import"./shared-57a98543.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as a}from"./shared-9803aa7c.js";import{h as s,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-5e0b71a2.js";import"./shared-018166d0.js";import"./shared-b16829cd.js";import"./shared-525c1936.js";import"./shared-cf0ca582.js";import"./shared-ec5b614e.js";import"./shared-8af5a4f2.js";import"./shared-eb7bf7ba.js";import"./shared-6de0e9f3.js";import"./shared-8b838d83.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-9fcd36e5.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-bb3c9e23.js";import"./shared-67898669.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-27e2e59a.js";import"./shared-ffc84c84.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-c5326ab8.js";import"./shared-a585bfd3.js";import"./shared-28b0e29a.js";import"./shared-b04e9753.js";import"./shared-53caa399.js";import"./shared-68fdcf24.js";import"./shared-112e521b.js";import"./shared-c5cb7e8a.js";import"./shared-e77d8d01.js";import"./shared-651c44fa.js";import"./shared-d3a5cb85.js";import"./shared-b1fa0b61.js";import"./shared-1c4ddc9b.js";import"./shared-32440b17.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-51c4a6dd.js";import"./foxy-copy-to-clipboard.js";import"./shared-573d6e21.js";import"./shared-4c4b87c2.js";import"./shared-bab2ea2c.js";import"./shared-a7617e76.js";import"./shared-238d397f.js";import"./shared-01f85a69.js";import"./shared-b77e1a8a.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-eadddff6.js";import"./foxy-custom-field-card.js";import"./shared-31d8e958.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-fc6bcfc5.js";import"./shared-da393323.js";import"./shared-44118acb.js";import"./shared-80a7903f.js";import"./shared-b0d76785.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./shared-ab26c69f.js";import"./foxy-item-form.js";import"./shared-ebc72d69.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-80688cd4.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends r{constructor(){super(...arguments),this.action=null}static get properties(){return t(t({},super.properties),{},{action:{}})}renderControl(){var r,o;const t=this.nucleon;let e;try{const a=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&&a.searchParams.set("sub_cancel","true"),e=a.toString()}catch(r){e=void 0}return s(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> `),a(e))}});let c,f,l=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends r{renderControl(){var r,o;return s(c||(c=l` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),i(f||(f=l`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===o?void 0:o.error_message)}});let p,h,u=r=>r;const j=n(o,"admin-subscription-form");class y extends j{get hiddenSelector(){var r,o;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(o=this.data)||void 0===o?void 0:o.is_active)||t.unshift("view-action","cancel-action"),new e(t.join(" ").trim())}get headerSubtitleOptions(){var r;return{context:(null===(r=this.data)||void 0===r?void 0:r.is_active)?"active":"inactive"}}renderHeaderActions(r){return s(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 s(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(),a(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),this.renderTemplateOrSlot(),a(null===(i=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===i?void 0:i["fx:attributes"].href),a(n),super.renderBody())}}customElements.define("foxy-admin-subscription-form",y);export{y as AdminSubscriptionForm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-ebc72d69.js";import"./shared-51fd39fa.js";import"./shared-
|
|
1
|
+
import"./shared-ebc72d69.js";import"./shared-51fd39fa.js";import"./shared-44118acb.js";import"./shared-80688cd4.js";import"./shared-80a7903f.js";import"./shared-b0d76785.js";import{b as e,a as t,I as r}from"./shared-44fd89ce.js";import"./foxy-applied-coupon-code-card.js";import"./foxy-applied-coupon-code-form.js";import"./foxy-custom-field-card.js";import"./foxy-custom-field-form.js";import"./foxy-template-set-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-57a98543.js";import{_ as i,B as o}from"./shared-d1195c27.js";import{c as s}from"./shared-4e709717.js";import{h as n,c as a}from"./shared-dc73b9a5.js";import"./shared-8af5a4f2.js";import{R as l,a as d}from"./shared-5e0b71a2.js";import{i as c}from"./shared-9803aa7c.js";import"./foxy-update-payment-method-form.js";import{U as u}from"./shared-cd96ff03.js";import{s as m}from"./shared-99940888.js";import"./shared-a7617e76.js";import{g as p}from"./shared-bab2ea2c.js";import{T as _}from"./shared-31d8e958.js";import{T as h}from"./shared-8874ec69.js";import"./foxy-copy-to-clipboard.js";import"./shared-573d6e21.js";import"./shared-b16829cd.js";import"./shared-cf0ca582.js";import"./shared-018166d0.js";import"./shared-525c1936.js";import"./shared-4c4b87c2.js";import"./shared-9fcd36e5.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./foxy-form-dialog.js";import"./shared-27e2e59a.js";import"./shared-ffc84c84.js";import"./shared-67898669.js";import"./shared-bb3c9e23.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-ec5b614e.js";import"./shared-eb7bf7ba.js";import"./shared-6de0e9f3.js";import"./shared-8b838d83.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-a0c6a159.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-c5cb7e8a.js";import"./shared-e77d8d01.js";import"./shared-a585bfd3.js";import"./shared-651c44fa.js";import"./shared-28b0e29a.js";import"./shared-b04e9753.js";import"./shared-53caa399.js";import"./shared-d3a5cb85.js";import"./shared-b1fa0b61.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-238d397f.js";import"./shared-eadddff6.js";import"./shared-b77e1a8a.js";import"./shared-01f85a69.js";import"./shared-ab26c69f.js";import"./shared-641786b2.js";import"./shared-84761b5b.js";import"./shared-c5326ab8.js";import"./shared-68fdcf24.js";import"./shared-112e521b.js";import"./shared-7889f2f2.js";import"./shared-2cb3cb3a.js";import"./shared-1c4ddc9b.js";import"./shared-32440b17.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-payment-card-embed.js";import"./shared-70487b4c.js";import"./shared-0e156ee7.js";import"./shared-c2efc54e.js";let f,y,v=e=>e;customElements.define("foxy-internal-cart-form-create-session-action",class extends e{constructor(){super(...arguments),this.__loader=null}static get properties(){return i(i({},super.properties),{},{__loader:{attribute:!1}})}renderControl(){var e,t;const r=null===(e=this.__loader)||void 0===e?void 0:e.state,i=null===(t=this.__loader)||void 0===t?void 0:t.result;return i?n(f||(f=v` <a target="_blank" class="rounded font-medium transition-colors text-body focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="state_idle"></foxy-i18n> </a> `),i):n(y||(y=v` <div class="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </div> `),s({"transition-colors font-medium rounded":!0,"text-tertiary":"fail"!==r,"text-error":"fail"===r}),"fail"===r?"state_fail":"state_busy")}updated(e){var t;super.updated(e);const r=this.nucleon,i=null==r?void 0:r.data,o=null!==(t=null==i?void 0:i._links["fx:create_session"].href)&&void 0!==t?t:null;this.__reloadSessionHref(o)}async __reloadSessionHref(e){var t;if((null===(t=this.__loader)||void 0===t?void 0:t.href)===e)return;const r=this.nucleon;if(r)if(e){const t={result:null,state:"busy",href:e},i=new r.constructor.API(this);this.__loader=t;try{const r=await i.fetch(e,{method:"POST"});if(!r.ok)throw new Error;t.result=(await r.json()).cart_link,t.state="idle"}catch(e){t.state="fail"}finally{this.requestUpdate()}}else this.__loader=null}});let g;const x=a(g||(g=(e=>e)`
|
|
2
2
|
#dialog{
|
|
3
3
|
width:100dvw;
|
|
4
4
|
max-height:calc(100dvh - var(--lumo-space-m));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-51fd39fa.js";import"./shared-
|
|
1
|
+
import"./shared-51fd39fa.js";import"./shared-44118acb.js";import"./shared-b0d76785.js";import{I as r}from"./shared-44fd89ce.js";import"./foxy-transaction-card.js";import{_ as e,B as s}from"./shared-d1195c27.js";import{a as o}from"./shared-5e0b71a2.js";import{i as t}from"./shared-9803aa7c.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-018166d0.js";import"./shared-b16829cd.js";import"./shared-525c1936.js";import"./shared-cf0ca582.js";import"./shared-ec5b614e.js";import"./shared-8af5a4f2.js";import"./shared-eb7bf7ba.js";import"./shared-6de0e9f3.js";import"./shared-8b838d83.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-9fcd36e5.js";import"./shared-57a98543.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-bb3c9e23.js";import"./shared-67898669.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-27e2e59a.js";import"./shared-ffc84c84.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-b04e9753.js";import"./shared-53caa399.js";import"./shared-a585bfd3.js";import"./shared-28b0e29a.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./foxy-copy-to-clipboard.js";import"./shared-573d6e21.js";import"./shared-4c4b87c2.js";import"./shared-bab2ea2c.js";import"./shared-a7617e76.js";import"./shared-238d397f.js";let i,d=r=>r;const n=o(r,"coupon-code-form");class c extends n{constructor(){super(...arguments),this.getTransactionPageHref=null}static get properties(){return e(e({},super.properties),{},{getTransactionPageHref:{attribute:!1}})}static get v8n(){return[({code:r})=>!!r||"code:v8n_required",({code:r})=>!r||r.length<=50||"code:v8n_too_long",({code:r})=>!(null==r?void 0:r.includes(" "))||"code:v8n_has_spaces"]}get hiddenSelector(){const r=[super.hiddenSelector.toString()];return this.href||r.unshift("transactions"),new s(r.join(" ").trim())}renderBody(){var r,e;let s;try{const o=new URL(null!==(e=null===(r=this.data)||void 0===r?void 0:r._links["fx:coupon_code_transactions"].href)&&void 0!==e?e:"");o.searchParams.set("zoom","items"),s=o.toString()}catch(r){s=void 0}return a(i||(i=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" infer="transactions" limit="5" item="foxy-transaction-card" .getPageHref="${0}" hide-delete-button> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),t(s),this.getTransactionPageHref,super.renderBody())}}customElements.define("foxy-coupon-code-form",c);export{c as CouponCodeForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-ce055dce.js";import"./shared-2f02918d.js";import"./shared-504f3c65.js";import{a as e,I as t}from"./shared-44fd89ce.js";import{p as r,s}from"./shared-3713f047.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{O as n,T as a}from"./shared-8874ec69.js";import{h as l,c as d,s as c}from"./shared-dc73b9a5.js";import"./shared-57a98543.js";import{R as u,a as m}from"./shared-5e0b71a2.js";import{c as p}from"./shared-4e709717.js";import{r as f}from"./shared-a0c6a159.js";import"./shared-19cd0786.js";import"./shared-80688cd4.js";import"./shared-7889f2f2.js";import"./shared-b0d76785.js";import"./shared-2cb3cb3a.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-ec5b614e.js";import"./shared-018166d0.js";import"./shared-b16829cd.js";import"./shared-cf0ca582.js";import"./shared-8af5a4f2.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-525c1936.js";import"./shared-9fcd36e5.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-bb3c9e23.js";import"./shared-67898669.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"./foxy-form-dialog.js";import"./shared-27e2e59a.js";import"./shared-ffc84c84.js";import"./shared-573d6e21.js";import"./shared-4c4b87c2.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-bab2ea2c.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-c5326ab8.js";import"./shared-a585bfd3.js";import"./shared-28b0e29a.js";import"./shared-b04e9753.js";import"./shared-53caa399.js";import"./shared-1c4ddc9b.js";import"./shared-e77d8d01.js";import"./shared-6de0e9f3.js";import"./shared-32440b17.js";import"./shared-eb7bf7ba.js";import"./shared-8b838d83.js";import"./shared-d3a5cb85.js";import"./shared-b1fa0b61.js";import"./shared-43e2c3f6.js";import"./shared-68fdcf24.js";import"./shared-b77e1a8a.js";import"./shared-31d8e958.js";import"./shared-238d397f.js";import"./shared-a7617e76.js";import"./shared-51fd39fa.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-01f85a69.js";let y,_,b,x,v=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.disableZoom=!1,this.disableOr=!1,this.operators=Object.values(n)}static get properties(){return o(o({},super.properties),{},{disableZoom:{type:Boolean,attribute:"disable-zoom"},disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array}})}renderControl(){const{label:e,helperText:t,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly;return l(y||(y=v` <section class="grid gap-s leading-xs"> <div ?hidden="${0}"> ${0} ${0} </div> <div class="bg-contrast-5 rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-query-builder infer="query-builder" style="--lumo-border-radius:var(--lumo-border-radius-s);--lumo-border-radius-l:var(--lumo-border-radius-s)" .operators="${0}" .value="${0}" ?disable-zoom="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> </div> ${0} </section> `),!e&&!t,e?l(_||(_=v`<p class="text-l font-medium">${0}</p>`),e):"",t?l(b||(b=v`<p class="text-s text-secondary">${0}</p>`),t):"",this.operators,this._value,this.disableZoom,this.disableOr,(e=>{var t;const r=e.currentTarget;this._value=null!==(t=r.value)&&void 0!==t?t:""}),s?l(x||(x=v`<p class="text-s text-error">${0}</p>`),r):"")}});let g,j,$,w,C,k,A,V,R,S,q=e=>e;class O extends(u(e)){static get styles(){return[super.styles,d(g||(g=q`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}`))]}renderControl(){const e=l(j||(j=q` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20"> <foxy-i18n infer="" key="or"></foxy-i18n> </div> <div class="flex-1 border-t border-contrast-10"></div> <div class="w-m ml-s flex-shrink-0"></div> </div> `));return l($||($=q` <div class="mb-s" ?hidden="${0}"> <p class="font-medium text-body text-l" ?hidden="${0}">${0}</p> <p class="text-s text-secondary" ?hidden="${0}">${0}</p> </div> <div class="rounded bg-contrast-5" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> <p class="text-s text-error mt-s" ?hidden="${0}"> ${0} </p> `),!this.label&&!this.helperText,!this.label,this.label,!this.helperText,this.helperText,f([...Object.entries(this._value||{}),null],((e,t)=>String(t)),((t,r)=>null===t?[r>0?e:"",this.__renderRule({onChange:({key:e,items:t})=>{var r;this._value=o(o({},this._value),{},{[e]:[...null!==(r=this._value[e])&&void 0!==r?r:[],...t]})}})]:[r>0?e:"",this.__renderRule({rule:{key:t[0],items:t[1]},onChange:e=>{var r,s;const o={},i=Object.keys(this._value);for(let n=0;n<i.length;n++){const a=i[n];if(a===t[0])if(e.key===a)o[a]=e.items;else{const t=null!==(r=this._value[e.key])&&void 0!==r?r:[];n>i.indexOf(e.key)?o[e.key]=[...t,...e.items]:(o[e.key]=[...e.items,...t],i.splice(i.indexOf(e.key),1))}else o[a]=null!==(s=this._value[a])&&void 0!==s?s:[]}this._value=o},onDelete:()=>{const e=o({},this._value);delete e[t[0]],this._value=e}})])),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:{}}set _value(e){super._value=e}__renderRule({rule:e,onDelete:t,onChange:r}){var s,o;const i=null!==(s=null==e?void 0:e.items)&&void 0!==s?s:[];return l(w||(w=q` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base"> <div class="${0}"> <div aria-hidden="true"> ${0} </div> </div> </div> <div class="bg-base"> <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> </div> </div> </div> </div> <div class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent" ?hidden="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> </div> `),this.t("rule"),p({"text-tertiary":!this.readonly&&!this.disabled,"text-disabled":this.readonly||this.disabled,"w-m h-m":!0}),c(C||(C=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/></svg>`)),this.__renderInput({value:null!==(o=null==e?void 0:e.key)&&void 0!==o?o:"",label:this.t("option_name"),onChange:e=>{void 0===e?null==t||t():r({key:e,items:i})}}),p({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"cursor-default text-tertiary":!(this.disabled||this.readonly),"text-disabled cursor-default":this.disabled||this.readonly}),c(k||(k=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/><path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/></svg>`)),f(this.readonly?i:[...i,null],((e,t)=>t),((t,s)=>l(A||(A=q` <div class="bg-base"> ${0} </div> `),this.__renderInput({value:null!=t?t:"",label:t?String(s+1):this.t("add_value"),onChange:o=>{const n=[...i];o?null===t?n.push(o):n[s]=o:n.splice(s,1),e&&r({key:e.key,items:n})}})))),this.readonly||0===Object.keys(this._value).length,this.t("delete"),p({"box-content flex items-center justify-center":!0,"w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!e}),this.disabled||this.readonly||!e,(()=>null==t?void 0:t()),c(V||(V=q`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)))}__renderInput(e){return l(R||(R=q` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @change="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.label,p({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,this.disabled||this.readonly,(t=>{const r=t.currentTarget;"Backspace"!==t.key||r.value||e.onChange()}),(t=>{t.currentTarget.value||e.onChange()}),(t=>{const r=t.currentTarget;e.onChange(r.value)}),p({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly}),this.t(e.label),this.disabled||this.readonly?"":l(S||(S=q` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}}customElements.define("foxy-internal-array-map-control",O);let T,H,L,M,I,B=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_details)&&void 0!==e?e:"",o=null!==(t=null==r?void 0:r.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",i=this.helperText,n=this.__renderRulesDescription(),a=this._errorMessage;return l(T||(T=B` <section> <div class="mb-s" ?hidden="${0}"> <p class="flex items-center justify-between space-x-m"> <span class="font-medium flex-1 text-l">${0}</span> <span class="min-w-0">${0}</span> </p> <p class="text-s text-secondary">${0}</p> </div> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),!this.label&&!i&&!n,this.label,this.__renderPreset(),i,{details:s,type:o,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,r=this.nucleon;null==r||r.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),n?l(H||(H=B`<p class="text-s text-secondary mt-s">${0}</p>`),n):"",!a||this.disabled||this.readonly?"":l(L||(L=B`<p class="mt-s text-s leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",o=null!==(t=null==r?void 0:r.form.coupon_discount_details)&&void 0!==t?t:"";return o?this.t("discount_summary",{params:{details:o,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,t=null==e?void 0:e.form.coupon_discount_details,r=null==e?void 0:e.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],i=s.find((e=>e.details===t&&e.type===r));return l(M||(M=B` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),p({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),i?this.t("discount_summary",{params:o(o({},i),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,r;const o=e.currentTarget,i=s[o.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(r=null==i?void 0:i.type)&&void 0!==r?r:"quantity_amount"})}),s.map((e=>l(I||(I=B` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===i,this.t("discount_summary",{params:o(o({},e),{},{ns:this.ns})})))),!i&&!!t&&!!r,this.t("custom_discount"))}});let Z,z,P=e=>e;const D=u(m(t,"coupon-form"));class G extends D{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerAttributeRestrictionsOperators=[n.Not,n.In],this.__customerAttributeRestrictionsGetValue=()=>{var e;const t=r(null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:"").filter((e=>Array.isArray(e)||"string"==typeof e.name)).map((e=>{if(Array.isArray(e))return e.filter((({name:e})=>"string"==typeof e)).map((({name:e,operator:t,value:r})=>({path:e,operator:t,value:r})));return{operator:e.operator,value:e.value,path:e.name}}));return s(t,!0)},this.__customerAttributeRestrictionsSetValue=e=>{const t=r(e).map((e=>{if(Array.isArray(e))return e.map((({path:e,operator:t,value:r})=>({name:e,path:"attributes",operator:t,value:r})));return{operator:e.operator,value:e.value,path:"attributes",name:e.path}}));this.edit({customer_attribute_restrictions:s(t,!0)})},this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join(",")})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:a.String},{label:"used_codes",path:"number_of_uses_to_date",type:a.Number},{label:"date_created",path:"date_created",type:a.Date},{label:"date_modified",path:"date_modified",type:a.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return o(o({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),new i(e.join(" ").trim())}get headerSubtitleOptions(){return o(o({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return l(Z||(Z=P` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,s,o,i,n,a;let d;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),d=r.toString()}catch(e){d=void 0}return l(z||(z=P` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-array-map-control infer="item-option-restrictions"> </foxy-internal-array-map-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions" disable-zoom disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-summary-control infer="auto-apply"> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),d,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],this.__customerAttributeRestrictionsOperators,this.__customerAttributeRestrictionsGetValue,this.__customerAttributeRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,h(null===(r=this.data)||void 0===r?void 0:r._links.self.href),h(null===(o=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===o?void 0:o._links["fx:item_categories"].href),h(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),h(null===(n=this.data)||void 0===n?void 0:n._links["fx:attributes"].href),super.renderBody(),h(null===(a=this.data)||void 0===a?void 0:a._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",G);export{G as CouponForm};
|
|
1
|
+
import"./shared-ce055dce.js";import"./shared-2f02918d.js";import"./shared-504f3c65.js";import{a as e,I as t}from"./shared-44fd89ce.js";import{p as r,s}from"./shared-3713f047.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{O as n,T as a}from"./shared-8874ec69.js";import{h as l,c as d,s as c}from"./shared-dc73b9a5.js";import"./shared-57a98543.js";import{R as u,a as m}from"./shared-5e0b71a2.js";import{c as p}from"./shared-4e709717.js";import{r as f}from"./shared-a0c6a159.js";import"./shared-44118acb.js";import"./shared-80688cd4.js";import"./shared-7889f2f2.js";import"./shared-b0d76785.js";import"./shared-2cb3cb3a.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-ec5b614e.js";import"./shared-018166d0.js";import"./shared-b16829cd.js";import"./shared-cf0ca582.js";import"./shared-8af5a4f2.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-525c1936.js";import"./shared-9fcd36e5.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-bb3c9e23.js";import"./shared-67898669.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"./foxy-form-dialog.js";import"./shared-27e2e59a.js";import"./shared-ffc84c84.js";import"./shared-573d6e21.js";import"./shared-4c4b87c2.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-bab2ea2c.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-c5326ab8.js";import"./shared-a585bfd3.js";import"./shared-28b0e29a.js";import"./shared-b04e9753.js";import"./shared-53caa399.js";import"./shared-1c4ddc9b.js";import"./shared-e77d8d01.js";import"./shared-6de0e9f3.js";import"./shared-32440b17.js";import"./shared-eb7bf7ba.js";import"./shared-8b838d83.js";import"./shared-d3a5cb85.js";import"./shared-b1fa0b61.js";import"./shared-43e2c3f6.js";import"./shared-68fdcf24.js";import"./shared-b77e1a8a.js";import"./shared-31d8e958.js";import"./shared-238d397f.js";import"./shared-a7617e76.js";import"./shared-51fd39fa.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-01f85a69.js";let y,_,b,x,v=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.disableZoom=!1,this.disableOr=!1,this.operators=Object.values(n)}static get properties(){return o(o({},super.properties),{},{disableZoom:{type:Boolean,attribute:"disable-zoom"},disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array}})}renderControl(){const{label:e,helperText:t,_errorMessage:r}=this,s=r&&!this.disabled&&!this.readonly;return l(y||(y=v` <section class="grid gap-s leading-xs"> <div ?hidden="${0}"> ${0} ${0} </div> <div class="bg-contrast-5 rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-query-builder infer="query-builder" style="--lumo-border-radius:var(--lumo-border-radius-s);--lumo-border-radius-l:var(--lumo-border-radius-s)" .operators="${0}" .value="${0}" ?disable-zoom="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> </div> ${0} </section> `),!e&&!t,e?l(_||(_=v`<p class="text-l font-medium">${0}</p>`),e):"",t?l(b||(b=v`<p class="text-s text-secondary">${0}</p>`),t):"",this.operators,this._value,this.disableZoom,this.disableOr,(e=>{var t;const r=e.currentTarget;this._value=null!==(t=r.value)&&void 0!==t?t:""}),s?l(x||(x=v`<p class="text-s text-error">${0}</p>`),r):"")}});let g,j,$,w,C,k,A,V,R,S,q=e=>e;class O extends(u(e)){static get styles(){return[super.styles,d(g||(g=q`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}`))]}renderControl(){const e=l(j||(j=q` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20"> <foxy-i18n infer="" key="or"></foxy-i18n> </div> <div class="flex-1 border-t border-contrast-10"></div> <div class="w-m ml-s flex-shrink-0"></div> </div> `));return l($||($=q` <div class="mb-s" ?hidden="${0}"> <p class="font-medium text-body text-l" ?hidden="${0}">${0}</p> <p class="text-s text-secondary" ?hidden="${0}">${0}</p> </div> <div class="rounded bg-contrast-5" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> <p class="text-s text-error mt-s" ?hidden="${0}"> ${0} </p> `),!this.label&&!this.helperText,!this.label,this.label,!this.helperText,this.helperText,f([...Object.entries(this._value||{}),null],((e,t)=>String(t)),((t,r)=>null===t?[r>0?e:"",this.__renderRule({onChange:({key:e,items:t})=>{var r;this._value=o(o({},this._value),{},{[e]:[...null!==(r=this._value[e])&&void 0!==r?r:[],...t]})}})]:[r>0?e:"",this.__renderRule({rule:{key:t[0],items:t[1]},onChange:e=>{var r,s;const o={},i=Object.keys(this._value);for(let n=0;n<i.length;n++){const a=i[n];if(a===t[0])if(e.key===a)o[a]=e.items;else{const t=null!==(r=this._value[e.key])&&void 0!==r?r:[];n>i.indexOf(e.key)?o[e.key]=[...t,...e.items]:(o[e.key]=[...e.items,...t],i.splice(i.indexOf(e.key),1))}else o[a]=null!==(s=this._value[a])&&void 0!==s?s:[]}this._value=o},onDelete:()=>{const e=o({},this._value);delete e[t[0]],this._value=e}})])),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:{}}set _value(e){super._value=e}__renderRule({rule:e,onDelete:t,onChange:r}){var s,o;const i=null!==(s=null==e?void 0:e.items)&&void 0!==s?s:[];return l(w||(w=q` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base"> <div class="${0}"> <div aria-hidden="true"> ${0} </div> </div> </div> <div class="bg-base"> <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> </div> </div> </div> </div> <div class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent" ?hidden="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> </div> `),this.t("rule"),p({"text-tertiary":!this.readonly&&!this.disabled,"text-disabled":this.readonly||this.disabled,"w-m h-m":!0}),c(C||(C=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/></svg>`)),this.__renderInput({value:null!==(o=null==e?void 0:e.key)&&void 0!==o?o:"",label:this.t("option_name"),onChange:e=>{void 0===e?null==t||t():r({key:e,items:i})}}),p({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"cursor-default text-tertiary":!(this.disabled||this.readonly),"text-disabled cursor-default":this.disabled||this.readonly}),c(k||(k=q`<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/><path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/></svg>`)),f(this.readonly?i:[...i,null],((e,t)=>t),((t,s)=>l(A||(A=q` <div class="bg-base"> ${0} </div> `),this.__renderInput({value:null!=t?t:"",label:t?String(s+1):this.t("add_value"),onChange:o=>{const n=[...i];o?null===t?n.push(o):n[s]=o:n.splice(s,1),e&&r({key:e.key,items:n})}})))),this.readonly||0===Object.keys(this._value).length,this.t("delete"),p({"box-content flex items-center justify-center":!0,"w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!e}),this.disabled||this.readonly||!e,(()=>null==t?void 0:t()),c(V||(V=q`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)))}__renderInput(e){return l(R||(R=q` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @change="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.label,p({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,this.disabled||this.readonly,(t=>{const r=t.currentTarget;"Backspace"!==t.key||r.value||e.onChange()}),(t=>{t.currentTarget.value||e.onChange()}),(t=>{const r=t.currentTarget;e.onChange(r.value)}),p({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-secondary":this.readonly}),this.t(e.label),this.disabled||this.readonly?"":l(S||(S=q` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}}customElements.define("foxy-internal-array-map-control",O);let T,H,L,M,I,B=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_details)&&void 0!==e?e:"",o=null!==(t=null==r?void 0:r.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",i=this.helperText,n=this.__renderRulesDescription(),a=this._errorMessage;return l(T||(T=B` <section> <div class="mb-s" ?hidden="${0}"> <p class="flex items-center justify-between space-x-m"> <span class="font-medium flex-1 text-l">${0}</span> <span class="min-w-0">${0}</span> </p> <p class="text-s text-secondary">${0}</p> </div> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),!this.label&&!i&&!n,this.label,this.__renderPreset(),i,{details:s,type:o,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,r=this.nucleon;null==r||r.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),n?l(H||(H=B`<p class="text-s text-secondary mt-s">${0}</p>`),n):"",!a||this.disabled||this.readonly?"":l(L||(L=B`<p class="mt-s text-s leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const r=this.nucleon,s=null!==(e=null==r?void 0:r.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",o=null!==(t=null==r?void 0:r.form.coupon_discount_details)&&void 0!==t?t:"";return o?this.t("discount_summary",{params:{details:o,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,t=null==e?void 0:e.form.coupon_discount_details,r=null==e?void 0:e.form.coupon_discount_type,s=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],i=s.find((e=>e.details===t&&e.type===r));return l(M||(M=B` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),p({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),i?this.t("discount_summary",{params:o(o({},i),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,r;const o=e.currentTarget,i=s[o.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(r=null==i?void 0:i.type)&&void 0!==r?r:"quantity_amount"})}),s.map((e=>l(I||(I=B` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===i,this.t("discount_summary",{params:o(o({},e),{},{ns:this.ns})})))),!i&&!!t&&!!r,this.t("custom_discount"))}});let Z,z,P=e=>e;const D=u(m(t,"coupon-form"));class G extends D{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerAttributeRestrictionsOperators=[n.Not,n.In],this.__customerAttributeRestrictionsGetValue=()=>{var e;const t=r(null!==(e=this.form.customer_attribute_restrictions)&&void 0!==e?e:"").filter((e=>Array.isArray(e)||"string"==typeof e.name)).map((e=>{if(Array.isArray(e))return e.filter((({name:e})=>"string"==typeof e)).map((({name:e,operator:t,value:r})=>({path:e,operator:t,value:r})));return{operator:e.operator,value:e.value,path:e.name}}));return s(t,!0)},this.__customerAttributeRestrictionsSetValue=e=>{const t=r(e).map((e=>{if(Array.isArray(e))return e.map((({path:e,operator:t,value:r})=>({name:e,path:"attributes",operator:t,value:r})));return{operator:e.operator,value:e.value,path:"attributes",name:e.path}}));this.edit({customer_attribute_restrictions:s(t,!0)})},this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,r)=>!!e&&r.indexOf(e)===t)).join(",")})},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:a.String},{label:"used_codes",path:"number_of_uses_to_date",type:a.Number},{label:"date_created",path:"date_created",type:a.Date},{label:"date_modified",path:"date_modified",type:a.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return o(o({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),new i(e.join(" ").trim())}get headerSubtitleOptions(){return o(o({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return l(Z||(Z=P` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,r,s,o,i,n,a;let d;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");r.searchParams.set("order","date_created desc"),d=r.toString()}catch(e){d=void 0}return l(z||(z=P` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-array-map-control infer="item-option-restrictions"> </foxy-internal-array-map-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions" disable-zoom disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-summary-control infer="auto-apply"> <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="uses"> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="number-of-uses-allowed-per-code" step="1" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="timeframe"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxes"> <foxy-internal-number-control layout="summary-item" infer="inclusive-tax-rate" min="0" max="1"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="options"> <foxy-internal-switch-control infer="multiple-codes-allowed"></foxy-internal-switch-control> <foxy-internal-switch-control infer="combinable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-category-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="exclude-line-item-discounts"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control> <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),d,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],this.__customerAttributeRestrictionsOperators,this.__customerAttributeRestrictionsGetValue,this.__customerAttributeRestrictionsSetValue,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,h(null===(r=this.data)||void 0===r?void 0:r._links.self.href),h(null===(o=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===o?void 0:o._links["fx:item_categories"].href),h(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),h(null===(n=this.data)||void 0===n?void 0:n._links["fx:attributes"].href),super.renderBody(),h(null===(a=this.data)||void 0===a?void 0:a._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",G);export{G as CouponForm};
|
|
@@ -52,7 +52,7 @@ import"./foxy-customer.js";import"./shared-8af5a4f2.js";import"./shared-9fcd36e5
|
|
|
52
52
|
${0}
|
|
53
53
|
${0}
|
|
54
54
|
</div>
|
|
55
|
-
`),o.matches("default",!0)?"":null==l?void 0:l(e,t),o.matches("subscriptions",!0)?"":r(e,t),o.matches("transactions",!0)?"":s(e,t))},i(A||(A=C` <foxy-customer readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="customer" embed-url="${0}" group="${0}" href="${0}" lang="${0}" ns="${0} ${0}" id="customer" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer> `),this.readonlySelector.zoom("customer").toString(),this.disabledSelector.zoom("customer").toString(),n,u(null!==(e=this.embedUrl)&&void 0!==e?e:void 0),this.group,this.customer,this.lang,this.ns,null!==(r=null===(t=customElements.get("foxy-customer"))||void 0===t?void 0:t.defaultNS)&&void 0!==r?r:"",a,this.data,(()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.loggingOutStateResetTimeout&&clearTimeout(this.loggingOutStateResetTimeout)}get __customerElement(){return this.renderRoot.querySelector("#customer")}}),customElements.define("foxy-internal-customer-portal-logged-out-view",class extends Z{constructor(){super(...arguments),this.page="sign-in",this.__renderAccessRecoveryHeader=()=>{var e,t,r,s;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#access-recovery-form"),d=!!(null==a?void 0:a.in("busy"));return i(I||(I=Y` <div class="flex flex-col leading-s font-lumo" data-testid="access-recovery:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="recover_access_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(s=null===(r=customElements.get("foxy-access-recovery-form"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"",this.renderTemplateOrSlot("access-recovery:header:after"))},this.__renderAccessRecoveryBack=()=>{var e,t;const r=this.renderRoot.querySelector("#access-recovery-form"),s=this.disabledSelector.zoom("access-recovery");return i(F||(F=Y` <div> ${0} <vaadin-button data-testid="access-recovery:back" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="back" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:back:before"),!!(null==r?void 0:r.in("busy"))||s.matches("back",!0),(()=>this.page="sign-in"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("access-recovery:back:after"))},this.__renderAccessRecoveryForm=()=>{var e,t;const r="access-recovery:form",s=this.hiddenSelector.zoom(r);return i(L||(L=Y` <div> ${0} <foxy-access-recovery-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="access-recovery:form" parent="foxy://customer-api/recover" group="${0}" lang="${0}" ns="${0} ${0}" id="access-recovery-form" .templates="${0}" @update="${0}"> </foxy-access-recovery-form> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.readonlySelector.zoom(r).toString(),this.disabledSelector.zoom(r).toString(),s.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates(r),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${r}:after`))},this.__renderAccessRecovery=()=>{const e="access-recovery",t=this.hiddenSelector.zoom(e);return i(q||(q=Y` <div class="h-full flex" data-testid="access-recovery"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} ${0} </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderAccessRecoveryHeader(),t.matches("form",!0)?"":this.__renderAccessRecoveryForm(),t.matches("back",!0)?"":this.__renderAccessRecoveryBack(),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignInHeader=()=>{var e,t,r,s;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#sign-in-form"),d=!!(null==a?void 0:a.in("busy"));return i(P||(P=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-in:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_in" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_in_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-in:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(s=null===(r=customElements.get("foxy-sign-in-form"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"",this.renderTemplateOrSlot("sign-in:header:after"))},this.__renderSignInRecover=()=>{var e,t;const r=this.renderRoot.querySelector("#sign-in-form"),s=this.disabledSelector.zoom("sign-in");return i(B||(B=Y` <div> ${0} <vaadin-button data-testid="sign-in:recover" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:recover:before"),!!(null==r?void 0:r.in("busy"))||s.matches("recover",!0),(()=>this.page="access-recovery"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("sign-in:recover:after"))},this.__renderSignInSignUp=()=>{const e=this.renderRoot.querySelector("#sign-in-form"),t=this.disabledSelector.zoom("sign-in");return i(D||(D=Y` <div> ${0} <vaadin-button data-testid="sign-in:signup" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="sign_up" ns="${0} sign-in-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:signup:before"),!!(null==e?void 0:e.in("busy"))||t.matches("signup",!0),(()=>this.page="sign-up"),this.lang,this.ns,this.renderTemplateOrSlot("sign-in:signup:after"))},this.__renderSignInForm=()=>{var e,t;const r="sign-in:form",s=this.hiddenSelector.zoom(r);return i(G||(G=Y` <div> ${0} <foxy-sign-in-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-in:form" parent="foxy://customer-api/session" group="${0}" lang="${0}" id="sign-in-form" ns="${0} ${0}" .templates="${0}" @update="${0}"> </foxy-sign-in-form> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.readonlySelector.zoom(r).toString(),this.disabledSelector.zoom(r).toString(),s.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates("sign-in:form"),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${r}:after`))},this.__renderSignIn=()=>{var e,t;const r="sign-in",s=this.hiddenSelector.zoom(r),o=!0===(null===(t=null===(e=this.data)||void 0===e?void 0:e.sign_up)||void 0===t?void 0:t.enabled),n=s.matches("signup",!0)||!o;return i(J||(J=Y` <div class="h-full flex" data-testid="sign-in"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} <div class="flex justify-center gap-s"> ${0} ${0} </div> </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${r}:before`),s.matches("header",!0)?"":this.__renderSignInHeader(),s.matches("form",!0)?"":this.__renderSignInForm(),n?"":this.__renderSignInSignUp(),s.matches("recover",!0)?"":this.__renderSignInRecover(),this.renderTemplateOrSlot(`${r}:after`))},this.__renderSignUpHeader=()=>{const{lang:e,ns:t}=this,r=this.renderRoot.querySelector("#sign-up-form"),s=!!(null==r?void 0:r.in("busy"));return i(K||(K=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-up:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_up" ns="${0} sign-up-form"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_up_hint" ns="${0} sign-up-form"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-up:header:before"),s?"text-disabled":"text-body",e,t,s?"text-disabled":"text-secondary",e,t,this.renderTemplateOrSlot("sign-up:header:after"))},this.__renderSignUpGoBack=()=>{const e=this.renderRoot.querySelector("#sign-up-form"),t=this.disabledSelector.zoom("sign-up");return i(M||(M=Y` <div> ${0} <vaadin-button data-testid="sign-up:go-back" class="w-full" theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="go_back" ns="${0} sign-up-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-up:go-back:before"),!!(null==e?void 0:e.in("busy"))||t.matches("go-back",!0),(()=>this.page="sign-in"),this.lang,this.ns,this.renderTemplateOrSlot("sign-up:go-back:after"))},this.__renderSignUpForm=()=>{const e="sign-up:form",t=["tax-id","is-anonymous","password-old","forgot-password","timestamps","delete",this.hiddenSelector.zoom(e).toString()];return i(Q||(Q=Y` <div> ${0} <foxy-customer-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-up:form" parent="foxy://customer-api/signup" group="${0}" lang="${0}" id="sign-up-form" ns="${0} sign-up-form" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer-form> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),this.readonlySelector.zoom(e).toString(),this.disabledSelector.zoom(e).toString(),new s(t.join(" ").trim()),this.group,this.lang,this.ns,this.getNestedTemplates("sign-up:form"),this.data,(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignUp=()=>{const e="sign-up",t=this.hiddenSelector.zoom(e);return i(V||(V=Y` <div class="h-full flex" data-testid="sign-up"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} ${0} ${0} </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderSignUpHeader(),t.matches("form",!0)?"":this.__renderSignUpForm(),t.matches("go-back",!0)?"":this.__renderSignUpGoBack(),this.renderTemplateOrSlot(`${e}:after`))}}static get properties(){return r(r({},super.properties),{},{group:{type:String},page:{type:String}})}static get styles(){return[super.styles,a(W||(W=Y`.max-w-25rem{max-width:25rem}`))]}renderBody(){const{page:e,hiddenSelector:t}=this;return"access-recovery"!==e||t.matches("access-recovery",!0)?"sign-in"!==e||t.matches("sign-in",!0)?"sign-up"!==e||t.matches("sign-up",!0)?i(X||(X=Y``)):this.__renderSignUp():this.__renderSignIn():this.__renderAccessRecovery()}}),customElements.define("foxy-internal-customer-portal-subscriptions",class extends fe{constructor(){super(...arguments),this.settings=null,this.customer=null,this.group="",this.__renderFormHeaderActionsUpdate=(e,t)=>{var r;const s=!!(null===(r=t.data)||void 0===r?void 0:r.end_date)&&new Date(t.data.end_date).getTime()<=Date.now();let o="";if(!s&&t.in({idle:"snapshot"})){const e=t.data._links["fx:sub_token_url"].href,r=new URL(e);r.searchParams.set("cart","checkout"),r.searchParams.set("sub_restart","auto"),o=r.toString()}return e(re||(re=pe`
|
|
55
|
+
`),o.matches("default",!0)?"":null==l?void 0:l(e,t),o.matches("subscriptions",!0)?"":r(e,t),o.matches("transactions",!0)?"":s(e,t))},i(A||(A=C` <foxy-customer readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="customer" embed-url="${0}" group="${0}" href="${0}" lang="${0}" ns="${0} ${0}" id="customer" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer> `),this.readonlySelector.zoom("customer").toString(),this.disabledSelector.zoom("customer").toString(),n,u(null!==(e=this.embedUrl)&&void 0!==e?e:void 0),this.group,this.customer,this.lang,this.ns,null!==(r=null===(t=customElements.get("foxy-customer"))||void 0===t?void 0:t.defaultNS)&&void 0!==r?r:"",a,this.data,(()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.loggingOutStateResetTimeout&&clearTimeout(this.loggingOutStateResetTimeout)}get __customerElement(){return this.renderRoot.querySelector("#customer")}}),customElements.define("foxy-internal-customer-portal-logged-out-view",class extends Z{constructor(){super(...arguments),this.page="sign-in",this.__renderAccessRecoveryHeader=()=>{var e,t,r,s;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#access-recovery-form"),d=!!(null==a?void 0:a.in("busy"));return i(I||(I=Y` <div class="flex flex-col leading-s font-lumo" data-testid="access-recovery:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="recover_access_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(s=null===(r=customElements.get("foxy-access-recovery-form"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"",this.renderTemplateOrSlot("access-recovery:header:after"))},this.__renderAccessRecoveryBack=()=>{var e,t;const r=this.renderRoot.querySelector("#access-recovery-form"),s=this.disabledSelector.zoom("access-recovery");return i(F||(F=Y` <div> ${0} <vaadin-button data-testid="access-recovery:back" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="back" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:back:before"),!!(null==r?void 0:r.in("busy"))||s.matches("back",!0),(()=>this.page="sign-in"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("access-recovery:back:after"))},this.__renderAccessRecoveryForm=()=>{var e,t;const r="access-recovery:form",s=this.hiddenSelector.zoom(r);return i(L||(L=Y` <div> ${0} <foxy-access-recovery-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="access-recovery:form" parent="foxy://customer-api/recover" group="${0}" lang="${0}" ns="${0} ${0}" id="access-recovery-form" .templates="${0}" @update="${0}"> </foxy-access-recovery-form> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.readonlySelector.zoom(r).toString(),this.disabledSelector.zoom(r).toString(),s.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates(r),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${r}:after`))},this.__renderAccessRecovery=()=>{const e="access-recovery",t=this.hiddenSelector.zoom(e);return i(q||(q=Y` <div class="h-full flex" data-testid="access-recovery"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} ${0} </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderAccessRecoveryHeader(),t.matches("form",!0)?"":this.__renderAccessRecoveryForm(),t.matches("back",!0)?"":this.__renderAccessRecoveryBack(),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignInHeader=()=>{var e,t,r,s;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#sign-in-form"),d=!!(null==a?void 0:a.in("busy"));return i(P||(P=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-in:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_in" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_in_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-in:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(s=null===(r=customElements.get("foxy-sign-in-form"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"",this.renderTemplateOrSlot("sign-in:header:after"))},this.__renderSignInRecover=()=>{var e,t;const r=this.renderRoot.querySelector("#sign-in-form"),s=this.disabledSelector.zoom("sign-in");return i(B||(B=Y` <div> ${0} <vaadin-button data-testid="sign-in:recover" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:recover:before"),!!(null==r?void 0:r.in("busy"))||s.matches("recover",!0),(()=>this.page="access-recovery"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("sign-in:recover:after"))},this.__renderSignInSignUp=()=>{const e=this.renderRoot.querySelector("#sign-in-form"),t=this.disabledSelector.zoom("sign-in");return i(D||(D=Y` <div> ${0} <vaadin-button data-testid="sign-in:signup" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="sign_up" ns="${0} sign-in-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:signup:before"),!!(null==e?void 0:e.in("busy"))||t.matches("signup",!0),(()=>this.page="sign-up"),this.lang,this.ns,this.renderTemplateOrSlot("sign-in:signup:after"))},this.__renderSignInForm=()=>{var e,t;const r="sign-in:form",s=this.hiddenSelector.zoom(r);return i(G||(G=Y` <div> ${0} <foxy-sign-in-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-in:form" parent="foxy://customer-api/session" group="${0}" lang="${0}" id="sign-in-form" ns="${0} ${0}" .templates="${0}" @update="${0}"> </foxy-sign-in-form> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.readonlySelector.zoom(r).toString(),this.disabledSelector.zoom(r).toString(),s.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates("sign-in:form"),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${r}:after`))},this.__renderSignIn=()=>{var e,t;const r="sign-in",s=this.hiddenSelector.zoom(r),o=!0===(null===(t=null===(e=this.data)||void 0===e?void 0:e.sign_up)||void 0===t?void 0:t.enabled),n=s.matches("signup",!0)||!o;return i(J||(J=Y` <div class="h-full flex" data-testid="sign-in"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} <div class="flex justify-center gap-s"> ${0} ${0} </div> </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${r}:before`),s.matches("header",!0)?"":this.__renderSignInHeader(),s.matches("form",!0)?"":this.__renderSignInForm(),n?"":this.__renderSignInSignUp(),s.matches("recover",!0)?"":this.__renderSignInRecover(),this.renderTemplateOrSlot(`${r}:after`))},this.__renderSignUpHeader=()=>{const{lang:e,ns:t}=this,r=this.renderRoot.querySelector("#sign-up-form"),s=!!(null==r?void 0:r.in("busy"));return i(K||(K=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-up:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_up" ns="${0} sign-up-form"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_up_hint" ns="${0} sign-up-form"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-up:header:before"),s?"text-disabled":"text-body",e,t,s?"text-disabled":"text-secondary",e,t,this.renderTemplateOrSlot("sign-up:header:after"))},this.__renderSignUpGoBack=()=>{const e=this.renderRoot.querySelector("#sign-up-form"),t=this.disabledSelector.zoom("sign-up");return i(M||(M=Y` <div> ${0} <vaadin-button data-testid="sign-up:go-back" class="w-full" theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="go_back" ns="${0} sign-up-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-up:go-back:before"),!!(null==e?void 0:e.in("busy"))||t.matches("go-back",!0),(()=>this.page="sign-in"),this.lang,this.ns,this.renderTemplateOrSlot("sign-up:go-back:after"))},this.__renderSignUpForm=()=>{const e="sign-up:form",t=["header","tax-id","is-anonymous","password-old","forgot-password","timestamps","delete",this.hiddenSelector.zoom(e).toString()];return i(Q||(Q=Y` <div> ${0} <foxy-customer-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-up:form" parent="foxy://customer-api/signup" group="${0}" lang="${0}" id="sign-up-form" ns="${0} sign-up-form" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer-form> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),this.readonlySelector.zoom(e).toString(),this.disabledSelector.zoom(e).toString(),new s(t.join(" ").trim()),this.group,this.lang,this.ns,this.getNestedTemplates("sign-up:form"),this.data,(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignUp=()=>{const e="sign-up",t=this.hiddenSelector.zoom(e);return i(V||(V=Y` <div class="h-full flex" data-testid="sign-up"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} ${0} ${0} </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderSignUpHeader(),t.matches("form",!0)?"":this.__renderSignUpForm(),t.matches("go-back",!0)?"":this.__renderSignUpGoBack(),this.renderTemplateOrSlot(`${e}:after`))}}static get properties(){return r(r({},super.properties),{},{group:{type:String},page:{type:String}})}static get styles(){return[super.styles,a(W||(W=Y`.max-w-25rem{max-width:25rem}`))]}renderBody(){const{page:e,hiddenSelector:t}=this;return"access-recovery"!==e||t.matches("access-recovery",!0)?"sign-in"!==e||t.matches("sign-in",!0)?"sign-up"!==e||t.matches("sign-up",!0)?i(X||(X=Y``)):this.__renderSignUp():this.__renderSignIn():this.__renderAccessRecovery()}}),customElements.define("foxy-internal-customer-portal-subscriptions",class extends fe{constructor(){super(...arguments),this.settings=null,this.customer=null,this.group="",this.__renderFormHeaderActionsUpdate=(e,t)=>{var r;const s=!!(null===(r=t.data)||void 0===r?void 0:r.end_date)&&new Date(t.data.end_date).getTime()<=Date.now();let o="";if(!s&&t.in({idle:"snapshot"})){const e=t.data._links["fx:sub_token_url"].href,r=new URL(e);r.searchParams.set("cart","checkout"),r.searchParams.set("sub_restart","auto"),o=r.toString()}return e(re||(re=pe`
|
|
56
56
|
${0}
|
|
57
57
|
|
|
58
58
|
<foxy-internal-customer-portal-link
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-44118acb.js";import"./shared-b77e1a8a.js";import"./shared-80a7903f.js";import"./shared-80688cd4.js";import"./shared-b0d76785.js";import{b as t,I as e}from"./shared-44fd89ce.js";import"./shared-8af5a4f2.js";import"./shared-57a98543.js";import{_ as r,B as a}from"./shared-d1195c27.js";import{N as s}from"./shared-bb3c9e23.js";import{h as o}from"./shared-dc73b9a5.js";import{a as n}from"./shared-5e0b71a2.js";import{i}from"./shared-9803aa7c.js";import"./shared-a0c6a159.js";import"./shared-c5cb7e8a.js";import"./shared-018166d0.js";import"./shared-b16829cd.js";import"./shared-eb7bf7ba.js";import"./shared-6de0e9f3.js";import"./shared-525c1936.js";import"./shared-8b838d83.js";import"./shared-cf0ca582.js";import"./shared-e77d8d01.js";import"./shared-a585bfd3.js";import"./shared-651c44fa.js";import"./shared-28b0e29a.js";import"./shared-b04e9753.js";import"./shared-53caa399.js";import"./shared-d3a5cb85.js";import"./shared-b1fa0b61.js";import"./shared-4e709717.js";import"./shared-573d6e21.js";import"./shared-4c4b87c2.js";import"./shared-22ba9566.js";import"./shared-1aff7995.js";import"./shared-019348d7.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-27e2e59a.js";import"./shared-ffc84c84.js";import"./shared-67898669.js";import"./shared-343d1fd7.js";import"./foxy-copy-to-clipboard.js";import"./shared-9fcd36e5.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-fcdb896f.js";let l,c=t=>t;customElements.define("foxy-internal-email-template-form-async-action",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return r(r({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,e="fail"===t?"error":"";return o(l||(l=c` <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),`${this.theme} ${null!=e?e:""}`.trim(),"busy"===t||this.disabled,this.__submit,t)}async __submit(){var t,e;if("busy"!==this.__state)try{this.__state="busy";const r=new s.API(this),a=await r.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=a.ok?"idle":"fail",a.ok&&(null===(e=this.nucleon)||void 0===e||e.refresh())}catch(t){this.__state="fail"}}});let h,m=t=>t;const d=n(e,"email-template-form");class f extends d{constructor(){super(...arguments),this.__templateLanguageOptions=[{rawLabel:"Nunjucks",value:"nunjucks"},{rawLabel:"Handlebars",value:"handlebars"},{rawLabel:"Pug",value:"pug"},{rawLabel:"Twig",value:"twig"},{rawLabel:"EJS",value:"ejs"}],this.__toggleGetValue=()=>!!this.form.subject,this.__toggleSetValue=t=>{this.edit({subject:t?this.t("general.subject.default_value"):""})}}get readonlySelector(){const t=[super.readonlySelector.toString()],e=this.form.subject;return this.form.content_html_url&&e&&t.unshift("content-html"),this.form.content_text_url&&e&&t.unshift("content-text"),new a(t.join(" ").trim())}get disabledSelector(){const t=[super.disabledSelector.toString()];return this.in({idle:{snapshot:"clean"}})&&this.data.content_html_url&&this.data.content_text_url||t.unshift("html-source:cache","text-source:cache"),this.form.subject||t.unshift("general:template-language","html-source","text-source","content-html","content-text"),new a(t.join(" ").trim())}get hiddenSelector(){var t,e,r;const s=[super.hiddenSelector.toString()];return(null===(t=this.data)||void 0===t?void 0:t.content_html_url)||s.unshift("html-source:cache"),(null===(e=this.data)||void 0===e?void 0:e.content_text_url)||s.unshift("text-source:cache"),(null===(r=this.data)||void 0===r?void 0:r.subject)||this.form.subject||s.unshift("general:template-language","general:subject","html-source","text-source","content-html","content-text"),new a(s.join(" ").trim())}renderBody(){var t,e;return o(h||(h=m` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control infer="toggle" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="subject"> </foxy-internal-text-control> <foxy-internal-select-control layout="summary-item" infer="template-language" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> ${0} <foxy-internal-source-control infer="content-html"></foxy-internal-source-control> <foxy-internal-summary-control infer="html-source"> <foxy-internal-text-control layout="summary-item" infer="content-html-url"> </foxy-internal-text-control> <foxy-internal-email-template-form-async-action theme="tertiary-inline" infer="cache" href="${0}"> </foxy-internal-email-template-form-async-action> </foxy-internal-summary-control> <foxy-internal-source-control infer="content-text"></foxy-internal-source-control> <foxy-internal-summary-control infer="text-source"> <foxy-internal-text-control layout="summary-item" infer="content-text-url"> </foxy-internal-text-control> <foxy-internal-email-template-form-async-action theme="tertiary-inline" infer="cache" href="${0}"> </foxy-internal-email-template-form-async-action> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.__toggleGetValue,this.__toggleSetValue,this.__templateLanguageOptions,this.renderTemplateOrSlot(),i(null===(t=this.data)||void 0===t?void 0:t._links["fx:cache"].href),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href),super.renderBody())}async _sendPost(t){const e=await super._sendPost(t);if(t.content_html_url&&t.content_text_url){const t=e._links["fx:cache"].href;if(!(await new f.API(this).fetch(t,{method:"POST"})).ok)throw["error:failed_to_cache"]}return await this._fetch(e._links.self.href)}async _sendPatch(t){const e=await super._sendPatch(t);if(!t.content_html_url&&!t.content_text_url)return e;const r=e._links["fx:cache"].href;if(!(await new f.API(this).fetch(r,{method:"POST"})).ok)throw["error:failed_to_cache"];return await this._fetch(e._links.self.href)}}customElements.define("foxy-email-template-form",f);export{f as EmailTemplateForm};
|