@foxy.io/elements 1.46.0-beta.2 → 1.46.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-admin-transaction-card.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.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-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-store-transaction-folder-card.js +1 -1
- package/dist/cdn/foxy-store-transaction-folder-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-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-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-4498a367.js → shared-01ce5dcd.js} +1 -1
- package/dist/cdn/{shared-84e97597.js → shared-19dbc85c.js} +1 -1
- package/dist/cdn/{shared-a449033a.js → shared-1bbac55e.js} +1 -1
- package/dist/cdn/{shared-16776ac6.js → shared-29a04835.js} +1 -1
- package/dist/cdn/{shared-57e94234.js → shared-407080a4.js} +1 -1
- package/dist/cdn/{shared-8df4ab18.js → shared-52367e6b.js} +1 -1
- package/dist/cdn/{shared-6740e365.js → shared-542c8ef1.js} +1 -1
- package/dist/cdn/{shared-5c8931a0.js → shared-56226850.js} +1 -1
- package/dist/cdn/{shared-0e5484c2.js → shared-5b0c7c73.js} +1 -1
- package/dist/cdn/{shared-4158f91e.js → shared-5b8b7c5f.js} +1 -1
- package/dist/cdn/{shared-4eb52fc7.js → shared-65112811.js} +1 -1
- package/dist/cdn/{shared-15a75e70.js → shared-69d417c2.js} +1 -1
- package/dist/cdn/{shared-742640c2.js → shared-6e92b5fc.js} +1 -1
- package/dist/cdn/{shared-e41960a0.js → shared-7329b19c.js} +1 -1
- package/dist/cdn/{shared-97fac71c.js → shared-783f37d3.js} +1 -1
- package/dist/cdn/shared-8464351f.js +1 -0
- package/dist/cdn/{shared-730acf1d.js → shared-a7150987.js} +1 -1
- package/dist/cdn/{shared-28ceb7f7.js → shared-adbdfff2.js} +1 -1
- package/dist/cdn/{shared-a08e5a5f.js → shared-af6e4823.js} +1 -1
- package/dist/cdn/{shared-6f90d987.js → shared-b06c67fa.js} +1 -1
- package/dist/cdn/{shared-fc155659.js → shared-c9061102.js} +1 -1
- package/dist/cdn/{shared-59128d82.js → shared-d640517d.js} +1 -1
- package/dist/cdn/{shared-64231b81.js → shared-dedec962.js} +1 -1
- package/dist/cdn/{shared-d46230dc.js → shared-e039657e.js} +1 -1
- package/dist/cdn/{shared-2df3c589.js → shared-eba46861.js} +1 -1
- package/dist/cdn/{shared-0b8768db.js → shared-ecbd0750.js} +1 -1
- package/dist/cdn/{shared-9b138652.js → shared-fd8b44e3.js} +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +10 -15
- package/dist/cdn/translations/transaction/en.json +10 -15
- package/dist/elements/public/NucleonElement/NucleonElement.js +11 -9
- package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
- package/package.json +2 -2
- package/dist/cdn/shared-e2d5673b.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-adbdfff2.js";import"./shared-dedec962.js";import"./shared-56226850.js";import{I as e}from"./shared-c9061102.js";import{I as r}from"./shared-ecbd0750.js";import{_ as t}from"./shared-8f9014ff.js";import{c as o}from"./shared-4e709717.js";import{h as s,s as a}from"./shared-ba5c42c7.js";import{a as i}from"./shared-47f3f5f5.js";import"./shared-3d353eb8.js";import"./shared-930e68b7.js";import"./shared-34a87829.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-6bf89411.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-bf8d95b9.js";import"./shared-b3fe8c63.js";import"./shared-e55c8dc4.js";import"./shared-27c16d99.js";import"./shared-0e25ac65.js";import"./shared-360196ad.js";import"./shared-53e42a77.js";import"./shared-d0aed1c1.js";import"./shared-1c985317.js";import"./shared-58add5b4.js";import"./shared-69c98b7b.js";import"./shared-41c9c53f.js";import"./foxy-copy-to-clipboard.js";import"./shared-b2cbe727.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-fd8b44e3.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-5212ef4f.js";let l,n,d,c=e=>e;customElements.define("foxy-internal-store-transaction-folder-color-control",class extends r{constructor(){super(...arguments),this.colors={}}static get properties(){return t(t({},super.properties),{},{colors:{type:Object}})}renderControl(){const e=this._value in this.colors?this._value:"";return s(l||(l=c` <div class="flex gap-s"> <div class="mr-auto">${0}</div> <div class="flex flex-wrap justify-end items-center gap-s"> ${0} </div> </div> `),this.label,Object.entries(this.colors).map((([r,t])=>{const a=r===e;return s(n||(n=c` <div class="${0}"> <div style="width:1em;height:1em;padding:2px" class="${0}"> <div class="${0}"></div> </div> ${0} </div> `),o({"relative p-s -m-s rounded-s flex-shrink-0":!0,"group transform transition-transform":!0,"focus-within-ring-2 focus-within-ring-primary-50":!0,"cursor-pointer hover-scale-150":!a&&!this.disabled&&!this.readonly}),o({"relative rounded-full transition-all":!0,"ring-1 ring-contrast-10":!a,"ring-2 ring-contrast-80":a&&!this.disabled,"ring-2 ring-contrast-10":a&&this.disabled}),o({"w-full h-full rounded-full transition-opacity":!0,"opacity-25":this.disabled,[t]:!0}),this.readonly?"":s(d||(d=c` <input aria-label="${0}" class="${0}" value="${0}" name="color" type="radio" ?disabled="${0}" ?checked="${0}" @change="${0}"> `),this.t(`color_${r||"none"}`),o({"absolute inset-0 block w-full h-full opacity-0":!0,"cursor-pointer":!a&&!this.disabled&&!this.readonly}),r,this.disabled,a,(()=>this._value=r)))})))}});let m,h,f=e=>e;const p=i(e,"store-transaction-folder-form");class u extends p{renderBody(){var e;const r={red:"bg-folder-red text-white",red_pale:"bg-folder-red-pale text-black",green:"bg-folder-green text-white",green_pale:"bg-folder-green-pale text-black",blue:"bg-folder-blue text-white",blue_pale:"bg-folder-blue-pale text-black",orange:"bg-folder-orange text-white",orange_pale:"bg-folder-orange-pale text-black",violet:"bg-folder-violet text-white",violet_pale:"bg-folder-violet-pale text-black","":"bg-contrast-5 text-body"},t=this.form.color&&this.form.color in r?this.form.color:"";return s(m||(m=f` <foxy-internal-summary-control infer="" label="" helper-text=""> <div class="flex flex-col items-center justify-center gap-m bg-transparent"> <div class="flex items-center p-m rounded-full ${0}"> ${0} </div> <p class="text-xl font-medium"> ${0} </p> </div> </foxy-internal-summary-control> <foxy-internal-summary-control infer="group-one"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-store-transaction-folder-color-control infer="color" .colors="${0}"> </foxy-internal-store-transaction-folder-color-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="group-two"> <foxy-internal-switch-control infer="is-default" .trueAlias="${0}" .falseAlias="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> ${0} `),r[t],a(h||(h=f`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 2em; height: 2em;"><path d="M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z" /></svg>`)),(null===(e=this.form.name)||void 0===e?void 0:e.trim())||this.t("group-one.name.placeholder"),r,1,0,super.renderBody())}submit(){var e;(null===(e=this.form.name)||void 0===e?void 0:e.trim())||this.edit({name:this.t("group-one.name.placeholder")}),super.submit()}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let r;try{r=(await e.json())._embedded["fx:errors"][0].message}catch(r){throw e}throw r.includes("it has transactions in it")?["error:folder_not_empty"]:e}}}customElements.define("foxy-store-transaction-folder-form",u);export{u as StoreTransactionFolderForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-34a87829.js";import"./shared-b2cbe727.js";import"./shared-d4b77609.js";import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-3d353eb8.js";import{_ as s}from"./shared-8f9014ff.js";import{h as t}from"./shared-ba5c42c7.js";import{C as e}from"./shared-41c9c53f.js";import{N as i}from"./shared-
|
|
1
|
+
import"./shared-34a87829.js";import"./shared-b2cbe727.js";import"./shared-d4b77609.js";import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-3d353eb8.js";import{_ as s}from"./shared-8f9014ff.js";import{h as t}from"./shared-ba5c42c7.js";import{C as e}from"./shared-41c9c53f.js";import{N as i}from"./shared-fd8b44e3.js";import{R as n,T as r,a}from"./shared-47f3f5f5.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-8498f274.js";import{a as l,g as m}from"./shared-96e4f603.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-6bf89411.js";import"./shared-bf8d95b9.js";import"./shared-eb49be2e.js";import"./shared-930e68b7.js";import"./shared-53e42a77.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";let c,f=s=>s;const p=e(n(r(a(i,"subscription-card"))));class h extends p{constructor(){super(...arguments),this.settings=null}static get properties(){return s(s({},super.properties),{},{settings:{type:Object}})}render(){var s,e,i,n,r;const a=this.settings?l(this.data,this.settings):m(this.data),d="failed"===a,p=(null==a?void 0:a.startsWith("next_payment"))||!!(null==a?void 0:a.startsWith("will_end")),h=!p&&!d;return t(c||(c=f` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-medium origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> ​ </div> <div class="${0}"> <foxy-i18n data-testid="status" lang="${0}" key="status_${0}" ns="${0}" .options="${0}"> </foxy-i18n> ​ </div> </div> <div class="flex-1 leading-xs mb-xs sm-mb-0 sm-text-right order-0 sm-order-1"> <foxy-i18n data-testid="price" options="${0}" class="text-xxs sm-text-l font-tnum tracking-wide sm-tracking-normal uppercase sm-normal-case font-medium text-secondary sm-text-body sm-block" lang="${0}" key="price${0}" ns="${0}"> </foxy-i18n> <span class="text-secondary font-medium sm-font-normal sm-block text-xxs sm-text-s"> <span class="sm-hidden">(</span> <span class="hidden sm-inline">*</span> <foxy-i18n infer="" key="fees_hint"></foxy-i18n> <span class="sm-hidden">)</span> <iron-icon id="hint" icon="icons:info-outline" class="icon-inline"></iron-icon> <vcf-tooltip position="bottom" style="--lumo-base-color:black" theme="light" for="hint"> <foxy-i18n infer="" class="text-s whitespace-nowrap" style="color:#fff" key="fees_explainer"> </foxy-i18n> </vcf-tooltip> </span> ​ </div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":p,"text-body bg-contrast-5":h,"text-error bg-error-10":d}),d?"error-outline":p?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":h,"text-success":p,"text-error":d}),this.lang,a,this.ns,this.data,JSON.stringify(this.__getPriceOptions()),this.lang,null===(e=null===(s=this.settings)||void 0===s?void 0:s.cart_display_config.show_sub_frequency)||void 0===e||e?"_"+(".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring"):"",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(r=null===(n=customElements.get("foxy-spinner"))||void 0===n?void 0:n.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(null===this.data)return{};const s=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{count_minus_one:s.length-1,first_item:s[0],count:s.length}}__getPriceOptions(){if(null===this.data)return{};const t=this.data._embedded["fx:transaction_template"],e=`${t.total_order} ${t.currency_code}`;return s(s({},d(this.data.frequency)),{},{amount:e})}}customElements.define("foxy-subscription-card",h);export{h as SubscriptionCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-34a87829.js";import"./shared-fb859ece.js";import"./shared-360196ad.js";import"./shared-b2cbe727.js";import"./shared-d4b77609.js";import{I as e}from"./shared-fc155659.js";import"./shared-4eb52fc7.js";import"./shared-742640c2.js";import"./shared-845f968f.js";import"./shared-5212ef4f.js";import"./foxy-transaction-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"./shared-3d353eb8.js";import{_ as t,B as s}from"./shared-8f9014ff.js";import"./shared-6bf89411.js";import"./shared-bf8d95b9.js";import{h as a}from"./shared-ba5c42c7.js";import{S as i,R as r,a as n}from"./shared-47f3f5f5.js";import{c as o}from"./shared-4e709717.js";import{S as l,C as d}from"./shared-2111aa44.js";import"./shared-58add5b4.js";import{G as c}from"./shared-14cc889b.js";import"./shared-0e25ac65.js";import"./shared-4194ffe7.js";import"./shared-e55c8dc4.js";import"./shared-18dc7a8a.js";import"./shared-27c16d99.js";import{p as u}from"./shared-8498f274.js";import{s as m}from"./shared-2061be9a.js";import{i as h}from"./shared-53e42a77.js";import{a as f,g as _}from"./shared-96e4f603.js";import{p}from"./shared-7f7d6ceb.js";import{j as y}from"./shared-11de7969.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-32b2d003.js";import"./shared-eb49be2e.js";import"./shared-b3fe8c63.js";import"./shared-0b8768db.js";import"./shared-41c9c53f.js";import"./shared-930e68b7.js";import"./shared-9b138652.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-1c985317.js";import"./foxy-copy-to-clipboard.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-9e0b104a.js";import"./shared-28ceb7f7.js";import"./foxy-collection-page.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-59128d82.js";import"./shared-be2ce0e6.js";import"./shared-f0fa0a88.js";import"./shared-e2d5673b.js";import"./shared-6740e365.js";import"./shared-15a75e70.js";import"./shared-57e94234.js";import"./shared-c84333db.js";import"./shared-d9378323.js";import"./shared-0557539b.js";import"./shared-c5a44ef2.js";import"./shared-a6ddec3d.js";import"./shared-b01c3b62.js";function v(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(y(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}class g extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function x(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const a=parseInt(e.substring(0,e.length-1));if(isNaN(a))throw new g(e);if(e.endsWith("y"))return 31536e6*a;if(e.endsWith("m"))return a*s;if(e.endsWith("w"))return 6048e5*a;if(e.endsWith("d"))return a*t;throw new g(e)}function b(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(y(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,a,i,r,n;if(t.min){const s=e.min?x(e.min):1/0;x(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?x(e.max):-1/0;x(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(a=e.allowedDaysOfWeek)&&void 0!==a?a:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(i=t.allowedDays)||void 0===i?void 0:i.type)){const s=[...null!==(r=e.allowedDaysOfMonth)&&void 0!==r?r:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(n=e.disallowedDates)&&void 0!==n?n:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function $(e){const[t,s,a]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,a)}function j(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const a=$(e.value),i=a.getTime(),r=b(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof r)return r;if(!1===(null===(t=r.allowedDaysOfMonth)||void 0===t?void 0:t.includes(a.getDate())))return!1;if(!1===(null===(s=r.allowedDaysOfWeek)||void 0===s?void 0:s.includes(a.getDay())))return!1;if(r.disallowedDates&&r.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>$(e).getTime()));return i===t||void 0!==s&&i>=t&&i<=s})))return!1;if(r.min){const e=p(r.min);if(null!==e&&Date.now()+e>=i)return!1}if(r.max){const e=p(r.max);if(null!==e&&Date.now()+e<=i)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}let S,w,D,T,q,E,k,H,C,L,A,I=e=>e;const O=i(r(n(e,"subscription-form")));class N extends O{constructor(){super(...arguments),this.getTransactionPageHref=(e,t)=>null==t?void 0:t._links["fx:receipt"].href,this.getCustomerPageHref=null,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderItemsActions=()=>a(S||(S=I` <div class="flex items-center gap-s text-m" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1 text-l font-medium text-body leading-m" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItems=()=>{var e;let t;try{const s=this.__transactionTemplate,a=new URL(null!==(e=null==s?void 0:s._links["fx:items"].href)&&void 0!==e?e:"");a.searchParams.set("zoom","item_options"),t=a.toString()}catch(e){t=void 0}return a(w||(w=I` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" infer="items" item="foxy-item-card" .itemProps="${0}"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),h(t),{"locale-codes":this.localeCodes,".settings":this.settings})},this.__renderEndDate=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(D||(D=I` <div data-testid="end-date"> ${0} <x-group frame> <foxy-i18n key="end_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),i,s,h(null===(e=null==t?void 0:t.end_date)||void 0===e?void 0:e.substr(0,10)),h(null==t?void 0:t.end_date),s,!this.__isEndDateEditable,this.disabledSelector.matches("end-date",!0),this.__checkEndDateAvailability,(e=>{const t=e.target;this.edit({end_date:t.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return j({value:m(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__checkStartDateAvailability=e=>e.getTime()>=Date.now(),this.__checkEndDateAvailability=e=>{const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),e.getTime()>=t.getTime()},this.__renderStartDate=()=>{const{data:e,lang:t,ns:s}=this;return a(T||(T=I` <div data-testid="start-date"> ${0} <x-group frame> <foxy-i18n key="start_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("start-date:before"),s,t,h(null==e?void 0:e.start_date.substr(0,10)),h(null==e?void 0:e.start_date),t,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(e=>{const t=e.target;this.edit({start_date:t.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return a(q||(q=I` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,h(null==e?void 0:e.next_transaction_date.substr(0,10)),h(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",u(e)),value:e})));return a(E||(E=I` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),h(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(k||(k=I` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,i,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>a(H||(H=I` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>a(C||(C=I` <div class="sm-col-span-2"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__renderCustomer=()=>{var e,t;const s=null===(e=this.data)||void 0===e?void 0:e._links["fx:customer"].href,i=s?null===(t=this.getCustomerPageHref)||void 0===t?void 0:t.call(this,s):void 0;return a(L||(L=I` <div data-testid="customer" class="sm-col-span-2"> ${0} <foxy-i18n infer="customer" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="customer" href="${0}"></foxy-customer-card> </a> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),o({"block rounded transition-colors":!0,"ring-1 ring-contrast-10":!i,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!i,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!i}),h(i),h(s),this.renderTemplateOrSlot("customer:after"))}}static get scopedElements(){return{"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-async-list-control":customElements.get("foxy-internal-async-list-control"),"foxy-internal-number-control":customElements.get("foxy-internal-number-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-customer-card":customElements.get("foxy-customer-card"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":l,"x-choice":d,"x-group":c}}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new s(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}get headerTitleOptions(){var e,s;if(this.data&&this.__currencyCode){const a=u(this.data.frequency),i=this.__transactionTemplate,r=`${null==i?void 0:i.total_order} ${this.__currencyCode}`,n=this.__currencyDisplay,o=null===(s=null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_frequency)||void 0===s||s,l=this.__currencyCode&&o?".5m"===this.data.frequency?"twice_a_month":"recurring":"existing";return t(t({},a),{},{amount:r,currencyDisplay:n,context:l})}return{}}get headerSubtitleKey(){const e=this.settings?f(this.data,this.settings):_(this.data);return e?`subtitle_${e}`:super.headerSubtitleKey}renderBody(){var e,t,s,i,r;let n;try{const s=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");s.searchParams.set("order","transaction_date desc"),s.searchParams.set("zoom","items"),n=s.toString()}catch(e){n=void 0}return a(A||(A=I` ${0} <div class="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-number-control suffix="${0}" infer="past-due-amount" class="sm-col-span-2" min="0"> </foxy-internal-number-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="attributes" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="transactions" limit="5" item="foxy-transaction-card" hide-delete-button .getPageHref="${0}"> </foxy-internal-async-list-control> <foxy-internal-timestamps-control infer="timestamps" class="sm-col-span-2"> </foxy-internal-timestamps-control> </div> `),this.renderHeader(),h(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),h(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),h(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),h(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),h(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("customer",!0)?"":this.__renderCustomer(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isEndDateVisible?this.__renderEndDate():"",h(null!==(s=this.__currencyCode)&&void 0!==s?s:void 0),h(null===(r=null===(i=this.data)||void 0===i?void 0:i._links["fx:attributes"])||void 0===r?void 0:r.href),h(n),this.getTransactionPageHref)}get __transactionTemplateHref(){var e;const t=this.data;return(null===(e=null==t?void 0:t._embedded)||void 0===e?void 0:e["fx:transaction_template"])||null==t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var e,t,s;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(s=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==s?s:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){const e=this.__transactionTemplate;if(!(null==e?void 0:e.currency_code))return(null==e?void 0:e.template_set_uri)||void 0}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __transactionTemplate(){var e,t,s;const a=this.data,i=null===(e=null==a?void 0:a._embedded)||void 0===e?void 0:e["fx:transaction_template"],r=`#${this.__transactionTemplateLoaderId}`;return null!==(s=null!=i?i:null===(t=this.renderRoot.querySelector(r))||void 0===t?void 0:t.data)&&void 0!==s?s:null}get __defaultTemplateSet(){var e,t;const s=`#${this.__defaultTemplateSetLoaderId}`,a=this.renderRoot.querySelector(s);return null!==(t=null===(e=null==a?void 0:a.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const s=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const s=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __store(){var e,t;const s=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __isNextTransactionDateVisible(){var e;if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(!1===(null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_nextdate))return!1;if(null===this.settings)return!0;const t=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),b(e,s)}(this.data,t)}get __isStartDateVisible(){var e;return!this.hiddenSelector.matches("start-date",!0)&&(!1!==(null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_startdate)&&this.__isNextTransactionDateVisible)}get __isEndDateVisible(){return!this.hiddenSelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())&&(!1!==this.data.is_active&&!this.settings)))}get __isStartDateEditable(){return!this.readonlySelector.matches("start-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&(!(this.data.start_date&&new Date(this.data.start_date)<=new Date)&&null===this.settings))))}get __isEndDateEditable(){return!this.readonlySelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&null===this.settings)))}get __isFrequencyVisible(){var e;if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(!1===(null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_frequency))return!1;if(null===this.settings)return!0;return!v({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=v({subscription:this.data,settings:this.settings});return Array.from(e)}get __currencyCode(){var e,t,s,a;const i=this.__transactionTemplate;if(null==i?void 0:i.currency_code)return i.currency_code;const r=this.__localeCodesHelper,n=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,o=n?null==r?void 0:r.values[n]:void 0;return o&&null!==(a=null===(s=/Currency: ([A-Z]{3})/g.exec(o))||void 0===s?void 0:s[1])&&void 0!==a?a:null}get __currencyDisplay(){var e;return(null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol)?"code":"symbol"}}customElements.define("foxy-subscription-form",N);export{N as SubscriptionForm};
|
|
1
|
+
import"./shared-34a87829.js";import"./shared-fb859ece.js";import"./shared-360196ad.js";import"./shared-b2cbe727.js";import"./shared-d4b77609.js";import{I as e}from"./shared-c9061102.js";import"./shared-65112811.js";import"./shared-6e92b5fc.js";import"./shared-845f968f.js";import"./shared-5212ef4f.js";import"./foxy-transaction-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"./shared-3d353eb8.js";import{_ as t,B as s}from"./shared-8f9014ff.js";import"./shared-6bf89411.js";import"./shared-bf8d95b9.js";import{h as a}from"./shared-ba5c42c7.js";import{S as i,R as r,a as n}from"./shared-47f3f5f5.js";import{c as o}from"./shared-4e709717.js";import{S as l,C as d}from"./shared-2111aa44.js";import"./shared-58add5b4.js";import{G as c}from"./shared-14cc889b.js";import"./shared-0e25ac65.js";import"./shared-4194ffe7.js";import"./shared-e55c8dc4.js";import"./shared-18dc7a8a.js";import"./shared-27c16d99.js";import{p as u}from"./shared-8498f274.js";import{s as m}from"./shared-2061be9a.js";import{i as h}from"./shared-53e42a77.js";import{a as f,g as _}from"./shared-96e4f603.js";import{p}from"./shared-7f7d6ceb.js";import{j as y}from"./shared-11de7969.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-32b2d003.js";import"./shared-eb49be2e.js";import"./shared-b3fe8c63.js";import"./shared-ecbd0750.js";import"./shared-41c9c53f.js";import"./shared-930e68b7.js";import"./shared-fd8b44e3.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-1c985317.js";import"./foxy-copy-to-clipboard.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-9e0b104a.js";import"./shared-adbdfff2.js";import"./foxy-collection-page.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-d640517d.js";import"./shared-be2ce0e6.js";import"./shared-f0fa0a88.js";import"./shared-8464351f.js";import"./shared-542c8ef1.js";import"./shared-69d417c2.js";import"./shared-407080a4.js";import"./shared-c84333db.js";import"./shared-d9378323.js";import"./shared-0557539b.js";import"./shared-c5a44ef2.js";import"./shared-a6ddec3d.js";import"./shared-b01c3b62.js";function v(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(y(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}class g extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function x(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const a=parseInt(e.substring(0,e.length-1));if(isNaN(a))throw new g(e);if(e.endsWith("y"))return 31536e6*a;if(e.endsWith("m"))return a*s;if(e.endsWith("w"))return 6048e5*a;if(e.endsWith("d"))return a*t;throw new g(e)}function b(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(y(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,a,i,r,n;if(t.min){const s=e.min?x(e.min):1/0;x(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?x(e.max):-1/0;x(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(a=e.allowedDaysOfWeek)&&void 0!==a?a:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(i=t.allowedDays)||void 0===i?void 0:i.type)){const s=[...null!==(r=e.allowedDaysOfMonth)&&void 0!==r?r:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(n=e.disallowedDates)&&void 0!==n?n:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function $(e){const[t,s,a]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,a)}function j(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const a=$(e.value),i=a.getTime(),r=b(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof r)return r;if(!1===(null===(t=r.allowedDaysOfMonth)||void 0===t?void 0:t.includes(a.getDate())))return!1;if(!1===(null===(s=r.allowedDaysOfWeek)||void 0===s?void 0:s.includes(a.getDay())))return!1;if(r.disallowedDates&&r.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>$(e).getTime()));return i===t||void 0!==s&&i>=t&&i<=s})))return!1;if(r.min){const e=p(r.min);if(null!==e&&Date.now()+e>=i)return!1}if(r.max){const e=p(r.max);if(null!==e&&Date.now()+e<=i)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}let S,w,D,T,q,E,k,H,C,L,A,I=e=>e;const O=i(r(n(e,"subscription-form")));class N extends O{constructor(){super(...arguments),this.getTransactionPageHref=(e,t)=>null==t?void 0:t._links["fx:receipt"].href,this.getCustomerPageHref=null,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderItemsActions=()=>a(S||(S=I` <div class="flex items-center gap-s text-m" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1 text-l font-medium text-body leading-m" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItems=()=>{var e;let t;try{const s=this.__transactionTemplate,a=new URL(null!==(e=null==s?void 0:s._links["fx:items"].href)&&void 0!==e?e:"");a.searchParams.set("zoom","item_options"),t=a.toString()}catch(e){t=void 0}return a(w||(w=I` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" infer="items" item="foxy-item-card" .itemProps="${0}"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),h(t),{"locale-codes":this.localeCodes,".settings":this.settings})},this.__renderEndDate=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(D||(D=I` <div data-testid="end-date"> ${0} <x-group frame> <foxy-i18n key="end_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),i,s,h(null===(e=null==t?void 0:t.end_date)||void 0===e?void 0:e.substr(0,10)),h(null==t?void 0:t.end_date),s,!this.__isEndDateEditable,this.disabledSelector.matches("end-date",!0),this.__checkEndDateAvailability,(e=>{const t=e.target;this.edit({end_date:t.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return j({value:m(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__checkStartDateAvailability=e=>e.getTime()>=Date.now(),this.__checkEndDateAvailability=e=>{const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),e.getTime()>=t.getTime()},this.__renderStartDate=()=>{const{data:e,lang:t,ns:s}=this;return a(T||(T=I` <div data-testid="start-date"> ${0} <x-group frame> <foxy-i18n key="start_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("start-date:before"),s,t,h(null==e?void 0:e.start_date.substr(0,10)),h(null==e?void 0:e.start_date),t,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(e=>{const t=e.target;this.edit({start_date:t.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return a(q||(q=I` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,h(null==e?void 0:e.next_transaction_date.substr(0,10)),h(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",u(e)),value:e})));return a(E||(E=I` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),h(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(k||(k=I` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,i,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>a(H||(H=I` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>a(C||(C=I` <div class="sm-col-span-2"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__renderCustomer=()=>{var e,t;const s=null===(e=this.data)||void 0===e?void 0:e._links["fx:customer"].href,i=s?null===(t=this.getCustomerPageHref)||void 0===t?void 0:t.call(this,s):void 0;return a(L||(L=I` <div data-testid="customer" class="sm-col-span-2"> ${0} <foxy-i18n infer="customer" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="customer" href="${0}"></foxy-customer-card> </a> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),o({"block rounded transition-colors":!0,"ring-1 ring-contrast-10":!i,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!i,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!i}),h(i),h(s),this.renderTemplateOrSlot("customer:after"))}}static get scopedElements(){return{"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-async-list-control":customElements.get("foxy-internal-async-list-control"),"foxy-internal-number-control":customElements.get("foxy-internal-number-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-customer-card":customElements.get("foxy-customer-card"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":l,"x-choice":d,"x-group":c}}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new s(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}get headerTitleOptions(){var e,s;if(this.data&&this.__currencyCode){const a=u(this.data.frequency),i=this.__transactionTemplate,r=`${null==i?void 0:i.total_order} ${this.__currencyCode}`,n=this.__currencyDisplay,o=null===(s=null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_frequency)||void 0===s||s,l=this.__currencyCode&&o?".5m"===this.data.frequency?"twice_a_month":"recurring":"existing";return t(t({},a),{},{amount:r,currencyDisplay:n,context:l})}return{}}get headerSubtitleKey(){const e=this.settings?f(this.data,this.settings):_(this.data);return e?`subtitle_${e}`:super.headerSubtitleKey}renderBody(){var e,t,s,i,r;let n;try{const s=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");s.searchParams.set("order","transaction_date desc"),s.searchParams.set("zoom","items"),n=s.toString()}catch(e){n=void 0}return a(A||(A=I` ${0} <div class="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-number-control suffix="${0}" infer="past-due-amount" class="sm-col-span-2" min="0"> </foxy-internal-number-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="attributes" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="transactions" limit="5" item="foxy-transaction-card" hide-delete-button .getPageHref="${0}"> </foxy-internal-async-list-control> <foxy-internal-timestamps-control infer="timestamps" class="sm-col-span-2"> </foxy-internal-timestamps-control> </div> `),this.renderHeader(),h(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),h(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),h(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),h(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),h(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("customer",!0)?"":this.__renderCustomer(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isEndDateVisible?this.__renderEndDate():"",h(null!==(s=this.__currencyCode)&&void 0!==s?s:void 0),h(null===(r=null===(i=this.data)||void 0===i?void 0:i._links["fx:attributes"])||void 0===r?void 0:r.href),h(n),this.getTransactionPageHref)}get __transactionTemplateHref(){var e;const t=this.data;return(null===(e=null==t?void 0:t._embedded)||void 0===e?void 0:e["fx:transaction_template"])||null==t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var e,t,s;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(s=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==s?s:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){const e=this.__transactionTemplate;if(!(null==e?void 0:e.currency_code))return(null==e?void 0:e.template_set_uri)||void 0}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __transactionTemplate(){var e,t,s;const a=this.data,i=null===(e=null==a?void 0:a._embedded)||void 0===e?void 0:e["fx:transaction_template"],r=`#${this.__transactionTemplateLoaderId}`;return null!==(s=null!=i?i:null===(t=this.renderRoot.querySelector(r))||void 0===t?void 0:t.data)&&void 0!==s?s:null}get __defaultTemplateSet(){var e,t;const s=`#${this.__defaultTemplateSetLoaderId}`,a=this.renderRoot.querySelector(s);return null!==(t=null===(e=null==a?void 0:a.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const s=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const s=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __store(){var e,t;const s=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __isNextTransactionDateVisible(){var e;if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(!1===(null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_nextdate))return!1;if(null===this.settings)return!0;const t=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),b(e,s)}(this.data,t)}get __isStartDateVisible(){var e;return!this.hiddenSelector.matches("start-date",!0)&&(!1!==(null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_startdate)&&this.__isNextTransactionDateVisible)}get __isEndDateVisible(){return!this.hiddenSelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())&&(!1!==this.data.is_active&&!this.settings)))}get __isStartDateEditable(){return!this.readonlySelector.matches("start-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&(!(this.data.start_date&&new Date(this.data.start_date)<=new Date)&&null===this.settings))))}get __isEndDateEditable(){return!this.readonlySelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&null===this.settings)))}get __isFrequencyVisible(){var e;if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(!1===(null===(e=this.settings)||void 0===e?void 0:e.cart_display_config.show_sub_frequency))return!1;if(null===this.settings)return!0;return!v({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=v({subscription:this.data,settings:this.settings});return Array.from(e)}get __currencyCode(){var e,t,s,a;const i=this.__transactionTemplate;if(null==i?void 0:i.currency_code)return i.currency_code;const r=this.__localeCodesHelper,n=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,o=n?null==r?void 0:r.values[n]:void 0;return o&&null!==(a=null===(s=/Currency: ([A-Z]{3})/g.exec(o))||void 0===s?void 0:s[1])&&void 0!==a?a:null}get __currencyDisplay(){var e;return(null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol)?"code":"symbol"}}customElements.define("foxy-subscription-form",N);export{N as SubscriptionForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-52367e6b.js";import"./shared-adbdfff2.js";import"./shared-dedec962.js";import"./shared-d640517d.js";import"./shared-6e92b5fc.js";import"./shared-56226850.js";import{I as e}from"./shared-c9061102.js";import{a as t}from"./shared-47f3f5f5.js";import{B as r}from"./shared-8f9014ff.js";import{h as i}from"./shared-ba5c42c7.js";import"./shared-34a87829.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-6bf89411.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-bf8d95b9.js";import"./shared-ecbd0750.js";import"./shared-5212ef4f.js";import"./shared-3d353eb8.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-53e42a77.js";import"./shared-fd8b44e3.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-4e709717.js";import"./shared-5fd5805c.js";import"./shared-d0aed1c1.js";import"./shared-53e476fd.js";import"./shared-fb859ece.js";import"./shared-4194ffe7.js";import"./shared-27c16d99.js";import"./shared-32b2d003.js";import"./shared-0e25ac65.js";import"./shared-b3fe8c63.js";import"./shared-e55c8dc4.js";import"./shared-360196ad.js";import"./shared-be2ce0e6.js";import"./shared-1c985317.js";import"./shared-58add5b4.js";import"./foxy-copy-to-clipboard.js";import"./shared-b2cbe727.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let s,a=e=>e;const o=t(e,"subscription-settings-form");class n extends o{constructor(){super(...arguments),this.__pastDueAmountHandlingOptions=[{label:"option_increment",value:"increment"},{label:"option_replace",value:"replace"}],this.__positiveIntegerInputParams={type:"number",step:"1",min:"0"},this.__expiringSoonPaymentReminderScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.expiring_soon_payment_reminder_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>t-e)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__expiringSoonPaymentReminderScheduleSetValue=e=>{this.edit({expiring_soon_payment_reminder_schedule:e.map((({value:e})=>e)).join()})},this.__reminderEmailScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reminder_email_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reminderEmailScheduleSetValue=e=>{this.edit({reminder_email_schedule:e.map((({value:e})=>e)).join()})},this.__reattemptScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reattemptScheduleSetValue=e=>{this.edit({reattempt_schedule:e.map((({value:e})=>e)).join()})},this.__getReattemptBypassStringsValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_bypass_strings)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>e.trim())).filter(((e,t,r)=>e&&r.indexOf(e)===t)).map((e=>({value:e})))},this.__setReattemptBypassStringsValue=e=>{this.edit({reattempt_bypass_strings:e.map((({value:e})=>e)).join()})},this.__reattemptBypassLogicOptions=[{value:"",label:"option_always_reattempt"},{value:"skip_if_exists",label:"option_skip_if_exists"},{value:"reattempt_if_exists",label:"option_reattempt_if_exists"}]}static get v8n(){return[({expiring_soon_payment_reminder_schedule:e})=>!e||e.length<=100||"expiring-soon-payment-reminder-schedule:v8n_too_long",({reattempt_bypass_strings:e})=>!e||e.length<=400||"reattempt-bypass-strings:v8n_too_long",({reminder_email_schedule:e})=>!e||e.length<=100||"reminder-email-schedule:v8n_too_long",({reattempt_schedule:e})=>!e||e.length<=100||"reattempt-schedule:v8n_too_long"]}get hiddenSelector(){const e=["header:copy-id",super.hiddenSelector.toString()];return this.form.reattempt_bypass_logic||e.push("reattempts-group:reattempt-bypass-strings"),new r(e.join(" ").trim())}renderBody(){return i(s||(s=a` ${0} <foxy-internal-summary-control infer="past-due-amount-group"> <foxy-internal-select-control layout="summary-item" infer="past-due-amount-handling" .options="${0}"> </foxy-internal-select-control> <foxy-internal-switch-control infer="automatically-charge-past-due-amount" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="reset-nextdate-on-makeup-payment" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="send-email-receipts-for-automated-billing" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="prevent-customer-cancel-with-past-due" helper-text-as-tooltip> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="reattempts-group"> <foxy-internal-select-control layout="summary-item" infer="reattempt-bypass-logic" .options="${0}"> </foxy-internal-select-control> <foxy-internal-editable-list-control layout="summary-item" infer="reattempt-bypass-strings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control layout="summary-item" infer="reattempt-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="emails-group"> <foxy-internal-editable-list-control layout="summary-item" infer="reminder-email-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control layout="summary-item" infer="expiring-soon-payment-reminder-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="modification-group"> <foxy-internal-text-control layout="summary-item" infer="modification-url"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="cancellation-group"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="cancellation-schedule" step="1" min="1"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.__pastDueAmountHandlingOptions,this.__reattemptBypassLogicOptions,this.__getReattemptBypassStringsValue,this.__setReattemptBypassStringsValue,this.__positiveIntegerInputParams,this.__reattemptScheduleGetValue,this.__reattemptScheduleSetValue,this.__positiveIntegerInputParams,this.__reminderEmailScheduleGetValue,this.__reminderEmailScheduleSetValue,this.__positiveIntegerInputParams,this.__expiringSoonPaymentReminderScheduleGetValue,this.__expiringSoonPaymentReminderScheduleSetValue,this.__cancellationScheduleSuffix,super.renderBody())}get __cancellationScheduleSuffix(){const e=this.form.cancellation_schedule;return e?this.t("day_suffix",{count:e}):""}}customElements.define("foxy-subscription-settings-form",n);export{n as SubscriptionSettingsForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./foxy-spinner.js";import"./shared-3d353eb8.js";import{S as s}from"./shared-
|
|
1
|
+
import"./foxy-spinner.js";import"./shared-3d353eb8.js";import{S as s}from"./shared-af6e4823.js";export{S as SubscriptionsTable}from"./shared-af6e4823.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-5a469962.js";import"./shared-47f3f5f5.js";import"./shared-8f9014ff.js";import"./shared-ba5c42c7.js";import"./shared-b2cbe727.js";import"./shared-930e68b7.js";import"./shared-01ce5dcd.js";import"./shared-41c9c53f.js";import"./shared-53e42a77.js";import"./foxy-nucleon-element.js";import"./shared-fd8b44e3.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-4e709717.js";import"./shared-8498f274.js";import"./shared-96e4f603.js";customElements.define("foxy-subscriptions-table",s);
|
package/dist/cdn/foxy-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import{T as s}from"./shared-
|
|
1
|
+
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import{T as s}from"./shared-01ce5dcd.js";export{T as Table}from"./shared-01ce5dcd.js";import"./shared-ba5c42c7.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-5a469962.js";import"./shared-47f3f5f5.js";import"./shared-8f9014ff.js";import"./shared-b2cbe727.js";import"./shared-3d353eb8.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-53e42a77.js";import"./foxy-nucleon-element.js";import"./shared-fd8b44e3.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-4e709717.js";customElements.define("foxy-table",s);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-8464351f.js";import"./foxy-nucleon-element.js";import{a as t}from"./shared-47f3f5f5.js";import{I as e}from"./shared-542c8ef1.js";import{i as a}from"./shared-53e42a77.js";import{h as s}from"./shared-ba5c42c7.js";import"./foxy-spinner.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-5a469962.js";import"./shared-b2cbe727.js";import"./shared-3d353eb8.js";import"./shared-8f9014ff.js";import"./shared-930e68b7.js";import"./shared-fd8b44e3.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-4e709717.js";let r,i,o=t=>t;class d extends(t(e,"tax-card")){renderBody(){var t,e,d,n;let l;try{const a=new URL(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:tax_item_categories"].href)&&void 0!==e?e:"");a.searchParams.set("limit","1"),l=a.toString()}catch(t){l=void 0}const m=null===(d=this.__taxItemCategoriesLoader)||void 0===d?void 0:d.data;return s(r||(r=o` <div class="leading-xs"> <p class="flex items-center gap-m" data-testid="title"> <span class="font-medium flex-1">${0}​</span> ${0} </p> <p class="text-s text-secondary" data-testid="subtitle"> ${0} • ${0} </p> </div> <foxy-nucleon class="hidden" infer="" href="${0}" id="taxItemCategoriesLoader" @update="${0}"> </foxy-nucleon> `),null===(n=this.data)||void 0===n?void 0:n.name,m?s(i||(i=o` <foxy-i18n options="${0}" class="text-xs text-tertiary" infer="" key="tax_item_categories"> </foxy-i18n> `),JSON.stringify({context:m.total_items>0?"":"empty",count:m.total_items})):"",this.data?this.__getTypeLabel(this.data):"",this.data?this.__getRateLabel(this.data):"",a(l),(()=>this.requestUpdate()))}get __taxItemCategoriesLoader(){return this.renderRoot.querySelector("#taxItemCategoriesLoader")}__getTypeLabel({type:t,country:e,region:a,city:s}){return"global"===t?this.t("tax_global"):"union"===t?this.t("tax_union"):"country"===t?e:"region"===t?`${e}, ${a}`:"local"===t?`${e}, ${a}, ${s}`:"custom_tax_endpoint"===t?this.t("tax_custom_tax"):void 0}__getRateLabel({is_live:t,rate:e}){var a;if(!t)return this.t("percent",{fraction:e/100});const s=null===(a=this.data)||void 0===a?void 0:a.service_provider;return"onesource"===s?"Thomson Reuters ONESOURCE":"avalara"===s?"Avalara AvaTax 15":"taxjar"===s?"TaxJar":"custom_tax"===s?this.t("tax_rate_provider_custom"):this.t("tax_rate_provider_default")}}customElements.define("foxy-tax-card",d);export{d as TaxCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-2df3c589.js";import"./shared-4eb52fc7.js";import"./shared-28ceb7f7.js";import"./shared-59128d82.js";import"./shared-64231b81.js";import"./shared-742640c2.js";import"./shared-5c8931a0.js";import{I as e}from"./shared-fc155659.js";import"./foxy-native-integration-card.js";import"./foxy-item-category-card.js";import"./foxy-nucleon-element.js";import{_ as t,B as r}from"./shared-8f9014ff.js";import{a as i}from"./shared-47f3f5f5.js";import{i as o}from"./shared-53e42a77.js";import{h as n}from"./shared-ba5c42c7.js";import"./shared-9e0b104a.js";import"./shared-6bf89411.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-360196ad.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-b2cbe727.js";import"./shared-3d353eb8.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-9b138652.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./shared-0b8768db.js";import"./shared-5212ef4f.js";import"./shared-be2ce0e6.js";import"./shared-27c16d99.js";import"./shared-0e25ac65.js";import"./shared-b3fe8c63.js";import"./shared-e55c8dc4.js";import"./shared-4e709717.js";import"./shared-fb859ece.js";import"./shared-4194ffe7.js";import"./shared-32b2d003.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-1c985317.js";import"./shared-58add5b4.js";import"./shared-34a87829.js";import"./shared-bf8d95b9.js";import"./shared-d0aed1c1.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-e2d5673b.js";import"./shared-6740e365.js";import"./shared-730acf1d.js";let s,a=e=>e;const l=i(e,"tax-form"),u=["US","CA","AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IM","IT","LT","LU","LV","MC","MT","NL","PL","PT","RO","SE","SI","SK"],c=[...u,"AU"];class d extends l{constructor(){super(...arguments),this.nativeIntegrations=null,this.itemCategories=null,this.countries=null,this.regions=null,this.__countrySetValue=e=>{this.edit({country:e,region:"",city:""}),this.edit({apply_to_shipping:this.__isApplyToShippingHidden})},this.__regionSetValue=e=>{this.edit({region:e,city:""})},this.__typeSetValue=e=>{this.edit({type:e,country:"",region:"",city:"",service_provider:"custom_tax_endpoint"===e?"custom_tax":"",apply_to_shipping:!1,use_origin_rates:!1,exempt_all_customer_tax_ids:!1,is_live:!1,rate:0})},this.__typeOptions=JSON.stringify([{label:"option_custom_tax_endpoint",value:"custom_tax_endpoint"},{label:"option_global",value:"global"},{label:"option_union",value:"union"},{label:"option_country",value:"country"},{label:"option_region",value:"region"},{label:"option_local",value:"local"}])}static get properties(){return t(t({},super.properties),{},{nativeIntegrations:{attribute:"native-integrations"},itemCategories:{attribute:"item-categories"},countries:{},regions:{}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=30||"name:v8n_too_long",({country:e,type:t})=>"country"!==t||!!e||"country:v8n_required",({country:e,type:t})=>"region"!==t||!!e||"country:v8n_required",({country:e,use_origin_rates:t})=>!t||!!e||"country:v8n_required",({region:e,type:t})=>"region"!=t||!!e||"region:v8n_required",({region:e})=>!e||e.length<=20||"region:v8n_too_long",({city:e})=>!e||e.length<=50||"city:v8n_too_long",({city:e,type:t})=>"local"!=t||!!e||"city:v8n_required",({rate:e,type:t,is_live:r})=>void 0===e||e>0||"custom_tax_endpoint"===t||void 0===t||r||"rate:v8n_invalid"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return e.unshift("native-integrations"),new r(e.join(" ").trim())}get hiddenSelector(){var e,t,i;const o=[super.hiddenSelector.toString()],n=this.form.type;"global"===n||"custom_tax_endpoint"===n?(o.unshift("group-one:is-live","group-one:service-provider"),"custom_tax_endpoint"===n&&o.unshift("group-one:rate")):this.form.is_live?o.unshift("group-one:rate"):o.unshift("group-one:service-provider"),void 0===this.__nativeIntegrationsUrl&&o.unshift("native-integrations"),this.__isCountryHidden&&o.unshift("group-three:country"),this.__isRegionHidden&&o.unshift("group-three:region-select","group-three:region-input"),this.__isCityHidden&&o.unshift("group-three:city"),this.__isApplyToShippingHidden&&o.unshift("group-two:apply-to-shipping"),this.__isUseOriginRatesHidden&&o.unshift("group-two:use-origin-rates"),this.__isExemptAllCustomerTaxIdsHidden&&o.unshift("group-two:exempt-all-customer-tax-ids");const s=Object.values(null!==(i=null===(t=null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==i?i:{});return o.unshift("group-three:region-"+(s.length?"input":"select")),this.data&&this.itemCategories||o.unshift("item-categories"),new r(o.join(" ").trim())}renderBody(){var e,t,r,i,l,u,c,d,p,m;const h=Object.values(null!==(r=null===(t=null===(e=this.__countriesLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.cc2}))),f=Object.values(null!==(u=null===(l=null===(i=this.__regionsLoader)||void 0===i?void 0:i.data)||void 0===l?void 0:l.values)&&void 0!==u?u:{}).map((e=>({rawLabel:e.default,value:e.code})));return n(s||(s=a` ${0} <foxy-internal-summary-control infer="group-one"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-select-control options="${0}" layout="summary-item" infer="type" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-switch-control infer="is-live"></foxy-internal-switch-control> <foxy-internal-select-control options="${0}" layout="summary-item" infer="service-provider"> </foxy-internal-select-control> <foxy-internal-number-control layout="summary-item" suffix="%" infer="rate" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="native-integrations" first="${0}" item="foxy-native-integration-card"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="group-two"> <foxy-internal-switch-control infer="exempt-all-customer-tax-ids"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="apply-to-shipping"></foxy-internal-switch-control> <foxy-internal-switch-control infer="use-origin-rates"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="group-three"> <foxy-internal-select-control options="${0}" layout="summary-item" infer="country" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-select-control property="region" options="${0}" layout="summary-item" infer="region-select" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-text-control property="region" layout="summary-item" infer="region-input" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="city"></foxy-internal-text-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="tax_uri" own-uri="${0}" options-href="${0}" links-href="${0}" embed-key="fx:tax_item_categories" infer="item-categories" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="countriesLoader" @update="${0}"> </foxy-nucleon> <foxy-nucleon infer="" class="hidden" href="${0}" id="regionsLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__typeOptions,this.__typeSetValue,JSON.stringify(this.__serviceProviderOptions),o(this.__nativeIntegrationsUrl),JSON.stringify(h),this.__countrySetValue,JSON.stringify(f),this.__regionSetValue,this.__regionSetValue,o(null===(c=this.data)||void 0===c?void 0:c._links.self.href),o(null!==(d=this.itemCategories)&&void 0!==d?d:void 0),o(null===(p=this.data)||void 0===p?void 0:p._links["fx:tax_item_categories"].href),super.renderBody(),o(null!==(m=this.countries)&&void 0!==m?m:void 0),(()=>this.requestUpdate()),o(this.__regionsUrl),(()=>this.requestUpdate()))}get __serviceProviderOptions(){const e=[{label:"option_avalara",value:"avalara"},{label:"option_onesource",value:"onesource"}];return"union"!==this.form.type&&this.form.country&&!u.includes(this.form.country)||e.unshift({label:"option_default",value:""}),"union"!==this.form.type&&this.form.country&&!c.includes(this.form.country)||e.push({label:"option_taxjar",value:"taxjar"}),e}get __nativeIntegrationsUrl(){var e;try{const t=new URL(null!==(e=this.nativeIntegrations)&&void 0!==e?e:""),r=this.form.service_provider;if(r)return t.searchParams.set("provider",r),t.toString()}catch(e){}}get __regionsUrl(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),r=this.form.country;return r&&t.searchParams.set("country_code",r),t.toString()}catch(e){}}get __countriesLoader(){return this.renderRoot.querySelector("#countriesLoader")}get __regionsLoader(){return this.renderRoot.querySelector("#regionsLoader")}get __isExemptAllCustomerTaxIdsHidden(){const e=this.form.service_provider,t=this.form.type;return"custom_tax_endpoint"===t||("country"===t||"region"===t||"local"===t||"union"===t)&&(!!this.form.is_live&&("onesource"===e||"avalara"===e))}get __isApplyToShippingHidden(){const e=this.form.type;return!e||"custom_tax_endpoint"===e||"union"!==e&&(!("country"!==e||!this.form.is_live)||(!("region"!==e||!this.form.is_live)||!!this.form.is_live&&u.includes(this.form.country)))}get __isUseOriginRatesHidden(){return"union"!==this.form.type||!this.form.is_live||!!this.form.service_provider}get __isCountryHidden(){return"union"===this.form.type?(!this.form.service_provider||this.form.is_live)&&!this.form.use_origin_rates:!["country","region","local"].includes(this.form.type)}get __isRegionHidden(){return"local"!==this.form.type&&"region"!==this.form.type}get __isCityHidden(){return"local"!==this.form.type}}customElements.define("foxy-tax-form",d);export{d as TaxForm};
|
|
1
|
+
import"./shared-eba46861.js";import"./shared-65112811.js";import"./shared-adbdfff2.js";import"./shared-d640517d.js";import"./shared-dedec962.js";import"./shared-6e92b5fc.js";import"./shared-56226850.js";import{I as e}from"./shared-c9061102.js";import"./foxy-native-integration-card.js";import"./foxy-item-category-card.js";import"./foxy-nucleon-element.js";import{_ as t,B as r}from"./shared-8f9014ff.js";import{a as i}from"./shared-47f3f5f5.js";import{i as o}from"./shared-53e42a77.js";import{h as n}from"./shared-ba5c42c7.js";import"./shared-9e0b104a.js";import"./shared-6bf89411.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-360196ad.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-b2cbe727.js";import"./shared-3d353eb8.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-fd8b44e3.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./shared-ecbd0750.js";import"./shared-5212ef4f.js";import"./shared-be2ce0e6.js";import"./shared-27c16d99.js";import"./shared-0e25ac65.js";import"./shared-b3fe8c63.js";import"./shared-e55c8dc4.js";import"./shared-4e709717.js";import"./shared-fb859ece.js";import"./shared-4194ffe7.js";import"./shared-32b2d003.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-1c985317.js";import"./shared-58add5b4.js";import"./shared-34a87829.js";import"./shared-bf8d95b9.js";import"./shared-d0aed1c1.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-8464351f.js";import"./shared-542c8ef1.js";import"./shared-a7150987.js";let s,a=e=>e;const l=i(e,"tax-form"),u=["US","CA","AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IM","IT","LT","LU","LV","MC","MT","NL","PL","PT","RO","SE","SI","SK"],d=[...u,"AU"];class c extends l{constructor(){super(...arguments),this.nativeIntegrations=null,this.itemCategories=null,this.countries=null,this.regions=null,this.__countrySetValue=e=>{this.edit({country:e,region:"",city:""}),this.edit({apply_to_shipping:this.__isApplyToShippingHidden})},this.__regionSetValue=e=>{this.edit({region:e,city:""})},this.__typeSetValue=e=>{this.edit({type:e,country:"",region:"",city:"",service_provider:"custom_tax_endpoint"===e?"custom_tax":"",apply_to_shipping:!1,use_origin_rates:!1,exempt_all_customer_tax_ids:!1,is_live:!1,rate:0})},this.__typeOptions=JSON.stringify([{label:"option_custom_tax_endpoint",value:"custom_tax_endpoint"},{label:"option_global",value:"global"},{label:"option_union",value:"union"},{label:"option_country",value:"country"},{label:"option_region",value:"region"},{label:"option_local",value:"local"}])}static get properties(){return t(t({},super.properties),{},{nativeIntegrations:{attribute:"native-integrations"},itemCategories:{attribute:"item-categories"},countries:{},regions:{}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=30||"name:v8n_too_long",({country:e,type:t})=>"country"!==t||!!e||"country:v8n_required",({country:e,type:t})=>"region"!==t||!!e||"country:v8n_required",({country:e,use_origin_rates:t})=>!t||!!e||"country:v8n_required",({region:e,type:t})=>"region"!=t||!!e||"region:v8n_required",({region:e})=>!e||e.length<=20||"region:v8n_too_long",({city:e})=>!e||e.length<=50||"city:v8n_too_long",({city:e,type:t})=>"local"!=t||!!e||"city:v8n_required",({rate:e,type:t,is_live:r})=>void 0===e||e>0||"custom_tax_endpoint"===t||void 0===t||r||"rate:v8n_invalid"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return e.unshift("native-integrations"),new r(e.join(" ").trim())}get hiddenSelector(){var e,t,i;const o=[super.hiddenSelector.toString()],n=this.form.type;"global"===n||"custom_tax_endpoint"===n?(o.unshift("group-one:is-live","group-one:service-provider"),"custom_tax_endpoint"===n&&o.unshift("group-one:rate")):this.form.is_live?o.unshift("group-one:rate"):o.unshift("group-one:service-provider"),void 0===this.__nativeIntegrationsUrl&&o.unshift("native-integrations"),this.__isCountryHidden&&o.unshift("group-three:country"),this.__isRegionHidden&&o.unshift("group-three:region-select","group-three:region-input"),this.__isCityHidden&&o.unshift("group-three:city"),this.__isApplyToShippingHidden&&o.unshift("group-two:apply-to-shipping"),this.__isUseOriginRatesHidden&&o.unshift("group-two:use-origin-rates"),this.__isExemptAllCustomerTaxIdsHidden&&o.unshift("group-two:exempt-all-customer-tax-ids");const s=Object.values(null!==(i=null===(t=null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==i?i:{});return o.unshift("group-three:region-"+(s.length?"input":"select")),this.data&&this.itemCategories||o.unshift("item-categories"),new r(o.join(" ").trim())}renderBody(){var e,t,r,i,l,u,d,c,p,m;const h=Object.values(null!==(r=null===(t=null===(e=this.__countriesLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.cc2}))),f=Object.values(null!==(u=null===(l=null===(i=this.__regionsLoader)||void 0===i?void 0:i.data)||void 0===l?void 0:l.values)&&void 0!==u?u:{}).map((e=>({rawLabel:e.default,value:e.code})));return n(s||(s=a` ${0} <foxy-internal-summary-control infer="group-one"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-select-control options="${0}" layout="summary-item" infer="type" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-switch-control infer="is-live"></foxy-internal-switch-control> <foxy-internal-select-control options="${0}" layout="summary-item" infer="service-provider"> </foxy-internal-select-control> <foxy-internal-number-control layout="summary-item" suffix="%" infer="rate" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="native-integrations" first="${0}" item="foxy-native-integration-card"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="group-two"> <foxy-internal-switch-control infer="exempt-all-customer-tax-ids"> </foxy-internal-switch-control> <foxy-internal-switch-control infer="apply-to-shipping"></foxy-internal-switch-control> <foxy-internal-switch-control infer="use-origin-rates"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="group-three"> <foxy-internal-select-control options="${0}" layout="summary-item" infer="country" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-select-control property="region" options="${0}" layout="summary-item" infer="region-select" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-text-control property="region" layout="summary-item" infer="region-input" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="city"></foxy-internal-text-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="tax_uri" own-uri="${0}" options-href="${0}" links-href="${0}" embed-key="fx:tax_item_categories" infer="item-categories" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="countriesLoader" @update="${0}"> </foxy-nucleon> <foxy-nucleon infer="" class="hidden" href="${0}" id="regionsLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__typeOptions,this.__typeSetValue,JSON.stringify(this.__serviceProviderOptions),o(this.__nativeIntegrationsUrl),JSON.stringify(h),this.__countrySetValue,JSON.stringify(f),this.__regionSetValue,this.__regionSetValue,o(null===(d=this.data)||void 0===d?void 0:d._links.self.href),o(null!==(c=this.itemCategories)&&void 0!==c?c:void 0),o(null===(p=this.data)||void 0===p?void 0:p._links["fx:tax_item_categories"].href),super.renderBody(),o(null!==(m=this.countries)&&void 0!==m?m:void 0),(()=>this.requestUpdate()),o(this.__regionsUrl),(()=>this.requestUpdate()))}get __serviceProviderOptions(){const e=[{label:"option_avalara",value:"avalara"},{label:"option_onesource",value:"onesource"}];return"union"!==this.form.type&&this.form.country&&!u.includes(this.form.country)||e.unshift({label:"option_default",value:""}),"union"!==this.form.type&&this.form.country&&!d.includes(this.form.country)||e.push({label:"option_taxjar",value:"taxjar"}),e}get __nativeIntegrationsUrl(){var e;try{const t=new URL(null!==(e=this.nativeIntegrations)&&void 0!==e?e:""),r=this.form.service_provider;if(r)return t.searchParams.set("provider",r),t.toString()}catch(e){}}get __regionsUrl(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),r=this.form.country;return r&&t.searchParams.set("country_code",r),t.toString()}catch(e){}}get __countriesLoader(){return this.renderRoot.querySelector("#countriesLoader")}get __regionsLoader(){return this.renderRoot.querySelector("#regionsLoader")}get __isExemptAllCustomerTaxIdsHidden(){const e=this.form.service_provider,t=this.form.type;return"custom_tax_endpoint"===t||("country"===t||"region"===t||"local"===t||"union"===t)&&(!!this.form.is_live&&("onesource"===e||"avalara"===e))}get __isApplyToShippingHidden(){const e=this.form.type;return!e||"custom_tax_endpoint"===e||"union"!==e&&(!("country"!==e||!this.form.is_live)||(!("region"!==e||!this.form.is_live)||!!this.form.is_live&&u.includes(this.form.country)))}get __isUseOriginRatesHidden(){return"union"!==this.form.type||!this.form.is_live||!!this.form.service_provider}get __isCountryHidden(){return"union"===this.form.type?(!this.form.service_provider||this.form.is_live)&&!this.form.use_origin_rates:!["country","region","local"].includes(this.form.type)}get __isRegionHidden(){return"local"!==this.form.type&&"region"!==this.form.type}get __isCityHidden(){return"local"!==this.form.type}}customElements.define("foxy-tax-form",c);export{c as TaxForm};
|