@foxy.io/elements 1.25.0-beta.5 → 1.26.0-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-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +3 -3
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/translations/cart-card/en.json +1 -3
- package/dist/cdn/translations/store-form/en.json +1 -1
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.d.ts +3 -0
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +36 -3
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -1
- package/dist/elements/public/AdminSubscriptionCard/types.d.ts +5 -3
- package/dist/elements/public/AdminSubscriptionCard/types.js.map +1 -1
- package/dist/elements/public/CartCard/CartCard.d.ts +0 -1
- package/dist/elements/public/CartCard/CartCard.js +13 -10
- package/dist/elements/public/CartCard/CartCard.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +0 -4
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
- package/dist/elements/public/PaymentsApi/api/composers/available_fraud_protections.js +1 -1
- package/dist/elements/public/PaymentsApi/api/composers/available_fraud_protections.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +5 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +13 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/types.d.ts +2 -0
- package/dist/elements/public/TemplateConfigForm/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-30d00b64.js";import"./shared-ff9791cf.js";import"./shared-c9ba1b64.js";import"./shared-7deff07c.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-029816d7.js";import{_ as e}from"./shared-1522d76f.js";import{l as t}from"./shared-d7be11de.js";import{C as s,a as i}from"./shared-e39807f8.js";import{h as o}from"./shared-7f33a83a.js";import{C as n}from"./shared-b1b8ea67.js";import{C as a}from"./shared-b23c903e.js";import{N as r}from"./shared-6a7f96c4.js";import{T as l,a as d,S as c,R as u}from"./shared-5fa697c4.js";import{c as h}from"./shared-4e709717.js";import{i as g}from"./shared-d3bf9ac0.js";import{G as p}from"./shared-a8dc23f1.js";import{l as f}from"./shared-f3b35364.js";import"./shared-43f449bb.js";import"./shared-f9a3d1ff.js";import"./shared-b509bc2c.js";import"./shared-61ade33e.js";import"./shared-bed7aae1.js";import"./shared-fc15a882.js";import"./shared-30cbf0a6.js";import"./shared-d519a301.js";import"./shared-343d1fd7.js";import"./shared-9c08cfab.js";import"./shared-ea527e98.js";import"./shared-99c0ae04.js";import"./shared-9df8f842.js";import"./shared-ad34b6db.js";import"./shared-4e59fd48.js";import"./shared-2c8c4b43.js";import"./shared-11c2efc8.js";import"./shared-eb116b3e.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";let y,_,x,b,m,$=e=>e;const v=a(l(d(r)));class k extends v{constructor(){super(...arguments),this.regions=[],this.name="",this.code="",this.__newRegion=""}static get properties(){return e(e({},super.properties),{},{__newRegion:{attribute:!1},regions:{type:Array},name:{type:String},code:{type:String}})}render(){var e,t;return o(y||(y=$` <div class="${0}"> <div data-testid="country" class="h-m flex justify-between items-center border-b border-contrast-10"> <div class="ml-m"> <span>${0}</span> ${0} </div> <button aria-label="${0}" class="${0}" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon> </button> </div> <div data-testid="regions" class="flex flex-wrap p-xs"> ${0} <div data-testid="new-region" style="border-radius:var(--lumo-size-s)" class="${0}"> <input placeholder="${0}" class="bg-transparent appearance-none h-s text-s px-s focus-outline-none" style="width:8rem" list="list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <button style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> <datalist id="list"> ${0} </datalist> </div> </div> `),h({"border border-contrast-10 rounded text-s":!0,"text-disabled":this.disabled}),this.name||this.code,this.name?o(_||(_=$`<span class="text-secondary">${0}</span>`),this.code):"",this.t("delete"),h({"mr-xs items-center justify-center rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!this.disabled,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!this.disabled,"cursor-default":this.disabled,flex:!this.readonly,hidden:this.readonly}),this.disabled,(()=>this.dispatchEvent(new CustomEvent("delete"))),this.regions.map((e=>{var t,s;const i=null===(s=null===(t=this.data)||void 0===t?void 0:t.values[e])||void 0===s?void 0:s.default;return o(x||(x=$` <div class="flex items-center border border-contrast-10 h-s m-xs" style="border-radius:var(--lumo-size-s)"> <span class="mx-s"> <span>${0}</span> ${0} </span> <button aria-label="${0}" class="${0}" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon> </button> </div> `),i||e,i?o(b||(b=$`<span class="text-secondary">${0}</span>`),e):"",this.t("delete"),h({"items-center justify-center rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!this.disabled,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!this.disabled,"cursor-default":this.disabled,flex:!this.readonly,hidden:this.readonly}),this.disabled,(()=>{this.regions=this.regions.filter((t=>t!==e)),this.dispatchEvent(new CustomEvent("update:regions"))}))})),h({"h-s m-xs items-center transition-colors border border-contrast-10":!0,"hover-border-contrast-40":!this.disabled,"focus-within-ring-1 ring-primary-50 focus-within-border-primary-50":!this.disabled,flex:!this.readonly,hidden:this.readonly}),this.t("add_region"),this.__newRegion,this.disabled,this.readonly,(e=>{"Enter"===e.key&&this.__newRegion&&this.__addRegion()}),(e=>{const t=e.currentTarget;this.__newRegion=t.value}),h({"flex-shrink-0":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":!this.__newRegion,"bg-success-10 text-success cursor-pointer":!!this.__newRegion,"hover-bg-success hover-text-success-contrast":!!this.__newRegion,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.__newRegion}),this.disabled||!this.__newRegion,this.__addRegion,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>o(m||(m=$`<option value="${0}">${0}</option>`),e.code,e.default))))}__addRegion(){this.regions=[...new Set([...this.regions,this.__newRegion])],this.__newRegion="",this.dispatchEvent(new CustomEvent("update:regions"))}}let w,S,j,O=e=>e;const q=c(a(l(d(r))));class T extends q{constructor(){super(...arguments),this.countries={},this.regions="",this.__newCountry=""}static get scopedElements(){return{"x-country-card":k,"iron-icon":customElements.get("iron-icon")}}static get properties(){return e(e({},super.properties),{},{__newCountry:{attribute:!1},countries:{type:Object},regions:{type:String}})}render(){var t,s;return o(w||(w=O` <div> <div class="space-y-s" data-testid="countries"> ${0} <div data-testid="new-country" class="${0}"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m text-s px-m focus-outline-none" list="list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <button aria-label="${0}" class="${0}" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> </div> <datalist id="list"> ${0} </datalist> </div> `),Object.entries(this.countries).map((([t,s])=>{var i,n;let a;try{const e=new URL(this.regions);e.searchParams.set("country_code",t),a=e.toString()}catch(e){a=""}return o(S||(S=O` <x-country-card regions="${0}" code="${0}" name="${0}" href="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" @update:regions="${0}" @delete="${0}"> </x-country-card> `),JSON.stringify("*"===s?[]:s),t,g(null===(n=null===(i=this.data)||void 0===i?void 0:i.values[t])||void 0===n?void 0:n.default),a,this.lang,this.ns,this.disabled,this.readonly,(s=>{const i=e({},this.countries),o=s.currentTarget.regions;i[t]=o.length?o:"*",this.countries=i,this.dispatchEvent(new CustomEvent("update:countries"))}),(()=>{const s=e({},this.countries);delete s[t],this.countries=s,this.dispatchEvent(new CustomEvent("update:countries"))}))})),h({"h-m flex items-center rounded transition-colors":!0,"border border-contrast-10 ring-primary-50":!0,"hover-border-contrast-40":!this.disabled,"focus-within-ring-1 focus-within-border-primary-50":!this.disabled,flex:!this.readonly,hidden:this.readonly}),this.t("add_country"),this.__newCountry,this.disabled,this.readonly,(e=>{"Enter"===e.key&&this.__newCountry&&this.__addCountry()}),(e=>{const t=e.currentTarget;this.__newCountry=t.value}),this.t("create"),h({"mr-xs flex-shrink-0":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":!this.__newCountry,"bg-success-10 text-success cursor-pointer":!!this.__newCountry,"hover-bg-success hover-text-success-contrast":!!this.__newCountry,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.__newCountry}),!this.__newCountry||this.disabled,this.__addCountry,Object.entries(null!==(s=null===(t=this.data)||void 0===t?void 0:t.values)&&void 0!==s?s:{}).map((([e,t])=>o(j||(j=O`<option value="${0}">${0}</option>`),e,t.default))))}__addCountry(){this.countries=e(e({},this.countries),{},{[this.__newCountry]:"*"}),this.__newCountry="",this.dispatchEvent(new CustomEvent("update:countries"))}}let J,N,C,E,F,V,R,H,I,z,A,D,G,L,U,B,P,M,W,K,Q,X,Y,Z=e=>e;const ee=c(u(a(l(d(r,"template-config-form")))));class te extends ee{constructor(){super(...arguments),this.templates={},this.countries="",this.regions="",this.__addHiddenFieldInputValue=""}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-source-control":customElements.get("foxy-internal-source-control"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-countries-list":T,"x-checkbox":n,"x-choice":s,"x-group":p}}static get properties(){return e(e({},super.properties),{},{__addHiddenFieldInputValue:{attribute:!1},countries:{type:String},regions:{type:String}})}render(){var e,t;const s=this.hiddenSelector,i=this.form.json?JSON.parse(this.form.json):{cart_type:"default",checkout_type:"default_account",csc_requirements:"all_cards",tos_checkbox_settings:{usage:"none",initial_state:"unchecked",is_hidden:!1,url:""},eu_secure_data_transfer_consent:{usage:"required"},newsletter_subscribe:{usage:"none"},analytics_config:{usage:"none",google_analytics:{usage:"none",account_id:"",include_on_site:!1},google_tag:{usage:"none",send_to:"",account_id:""}},colors:{usage:"none",primary:"4D4D4D",secondary:"FFFFFF",tertiary:"FFFFFF"},use_checkout_confirmation_window:{usage:"none"},supported_payment_cards:["visa","mastercard","discover","amex"],custom_checkout_field_requirements:{cart_controls:"enabled",coupon_entry:"enabled",billing_first_name:"required",billing_last_name:"required",billing_company:"optional",billing_tax_id:"hidden",billing_phone:"optional",billing_address1:"required",billing_address2:"optional",billing_city:"required",billing_region:"default",billing_postal_code:"required",billing_country:"required"},cart_display_config:{usage:"none",show_product_weight:!0,show_product_category:!0,show_product_code:!0,show_product_options:!0,show_sub_frequency:!0,show_sub_startdate:!0,show_sub_nextdate:!0,show_sub_enddate:!0,hidden_product_options:[]},foxycomplete:{usage:"required",show_combobox:!0,combobox_open:"\\u25bc",combobox_close:"\\u25b2",show_flags:!0},custom_script_values:{header:"",footer:"",checkout_fields:"",multiship_checkout_fields:""},http_receipt:!1,custom_config:"",debug:{usage:"none"},location_filtering:{usage:"none",shipping_filter_type:"blacklist",billing_filter_type:"blacklist",shipping_filter_values:{},billing_filter_values:{}},postal_code_lookup:{usage:"enabled"}};return o(J||(J=Z` <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="space-y-l"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-source-control data-testid="custom-config" helper-text="${0}" placeholder='{ "key": "value" }' label="${0}" infer="custom-config" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> <foxy-internal-source-control data-testid="header" placeholder="<style>h1 { color: red }</style>" helper-text="${0}" label="${0}" infer="header" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> <foxy-internal-source-control data-testid="custom-fields" placeholder='<label>Comment: <input name="comment"></label>' helper-text="${0}" label="${0}" infer="custom-fields" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> <foxy-internal-source-control data-testid="footer" placeholder='<script src="https://example.com/code.js"></script>' helper-text="${0}" label="${0}" infer="footer" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> </div> <div class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),s.matches("cart-type",!0)?"":this.__renderCartType(i),s.matches("foxycomplete",!0)?"":this.__renderFoxycomplete(i),s.matches("locations",!0)?"":this.__renderLocations(i),s.matches("hidden-fields",!0)?"":this.__renderHiddenFields(i),s.matches("cards",!0)?"":this.__renderCards(i),s.matches("checkout-type",!0)?"":this.__renderCheckoutType(i),s.matches("consent",!0)?"":this.__renderConsent(i),s.matches("fields",!0)?"":this.__renderFields(i),s.matches("google-analytics",!0)?"":this.__renderGoogleAnalytics(i),s.matches("google-tag",!0)?"":this.__renderGoogleTag(i),s.matches("troubleshooting",!0)?"":this.__renderTroubleshooting(i),this.t("custom_config_helper_text"),this.t("custom_config"),(()=>"string"==typeof i.custom_config?i.custom_config:JSON.stringify(i.custom_config,null,2)),(e=>{try{i.custom_config=JSON.parse(e)}catch(t){i.custom_config=e}this.edit({json:JSON.stringify(i)})}),this.t("custom_header_helper_text"),this.t("custom_header"),(()=>i.custom_script_values.header),(e=>{i.custom_script_values.header=e,this.edit({json:JSON.stringify(i)})}),this.t("custom_fields_helper_text"),this.t("custom_fields"),(()=>i.custom_script_values.checkout_fields),(e=>{i.custom_script_values.checkout_fields=e,this.edit({json:JSON.stringify(i)})}),this.t("custom_footer_helper_text"),this.t("custom_footer"),(()=>i.custom_script_values.footer),(e=>{i.custom_script_values.footer=e,this.edit({json:JSON.stringify(i)})}),h({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":"busy",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}__renderCartType(t){const{lang:s,ns:i}=this,n=["default","fullpage","custom"],a=!this.in("idle")||this.disabledSelector.matches("cart-type",!0);return o(N||(N=Z` <div data-testid="cart-type"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="cart_type" ns="${0}"> </foxy-i18n> <x-choice data-testid="cart-type-choice" .value="${0}" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("cart-type:before"),a?"text-disabled":"",s,i,t.cart_type,n,a,this.readonlySelector.matches("cart-type",!0),(s=>{this.edit({json:JSON.stringify(e(e({},t),{},{cart_type:s.detail}))})}),n.map((e=>o(C||(C=Z` <div slot="${0}-label" class="grid leading-s py-s"> <foxy-i18n lang="${0}" key="cart_type_${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs ${0}" lang="${0}" key="cart_type_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,s,e,i,a?"text-disabled":"text-secondary",s,e,i))),this.renderTemplateOrSlot("cart-type:after"))}__renderFoxycomplete(e){const{lang:t,ns:s}=this,n=!this.in("idle")||this.disabledSelector.matches("foxycomplete",!0),a=this.readonlySelector.matches("foxycomplete",!0),r=e.foxycomplete,l=["combobox","search","disabled"],d="none"===r.usage?"disabled":r.show_combobox?"combobox":"search",c=o(E||(E=Z` <x-checkbox data-testid="foxycomplete-flags-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_country_flags" ns="${0}"></foxy-i18n> </x-checkbox> `),n,a,r.show_flags,(t=>{r.show_flags=t.detail,this.edit({json:JSON.stringify(e)})}),t,s);return o(F||(F=Z` <div data-testid="foxycomplete"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="foxycomplete" ns="${0}"> </foxy-i18n> <x-choice data-testid="foxycomplete-choice" .value="${0}" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} <div slot="combobox" class="space-y-m pb-s" ?hidden="${0}"> <div class="grid grid-cols-2 gap-m" style="max-width:16rem"> ${0} </div> ${0} </div> <div slot="search" class="pb-s" ?hidden="${0}">${0}</div> </x-choice> <div class="border-t border-contrast-10 p-m"> <x-checkbox data-testid="foxycomplete-lookup-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="enable_postcode_lookup" ns="${0}"></foxy-i18n> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("foxycomplete:before"),n?"text-disabled":"",t,s,d,l,n,a,(t=>{t instanceof i&&(r.usage="disabled"===t.detail?"none":"required",r.show_combobox="combobox"===t.detail,this.edit({json:JSON.stringify(e)}))}),l.map((e=>o(V||(V=Z` <div slot="${0}-label" class="grid leading-s py-s"> <foxy-i18n lang="${0}" key="foxycomplete_${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs ${0}" lang="${0}" key="foxycomplete_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,t,e,s,n?"text-disabled":"text-secondary",t,e,s))),"combobox"!==d,["open","close"].map((t=>{const s="open"===t?"combobox_open":"combobox_close";return o(R||(R=Z` <vaadin-text-field data-testid="foxycomplete-${0}-icon" style="--lumo-border-radius:var(--lumo-border-radius-s)" label="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> `),t,this.t(`${t}_icon`),r[s],n,a,(e=>"Enter"===e.key&&this.submit()),(t=>{r[s]=t.currentTarget.value,this.edit({json:JSON.stringify(e)})}))})),c,"search"!==d,c,n,a,"enabled"===e.postal_code_lookup.usage,(t=>{e.postal_code_lookup.usage=t.detail?"enabled":"none",this.edit({json:JSON.stringify(e)})}),t,s,this.renderTemplateOrSlot("foxycomplete:after"))}__renderLocations(e){const{lang:t,ns:s}=this,i=e.location_filtering,n=!this.in("idle")||this.disabledSelector.matches("locations",!0),a=this.readonlySelector.matches("locations",!0),r="blacklist"===i.shipping_filter_type?"block":"allow",l="both"===i.usage?"copy":"blacklist"===i.billing_filter_type?"block":"allow",d=()=>{if("both"===i.usage)i.billing_filter_type=i.shipping_filter_type,i.billing_filter_values=i.shipping_filter_values;else{const e=Object.keys(i.billing_filter_values).length>0,t=Object.keys(i.shipping_filter_values).length>0;i.usage=e||t?e&&!t?"billing":t&&!e?"shipping":"independent":"none"}};return o(H||(H=Z` <div data-testid="locations"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="location_plural" ns="${0}"> </foxy-i18n> <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap:1px"> <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="shipping" ns="${0}"> </foxy-i18n> <x-choice data-testid="locations-shipping-choice" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="allow-label" lang="${0}" key="allowlist" ns="${0}"></foxy-i18n> <foxy-i18n slot="block-label" lang="${0}" key="blocklist" ns="${0}"></foxy-i18n> <x-countries-list data-testid="locations-shipping-list" countries="${0}" regions="${0}" class="mb-m" href="${0}" slot="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" @update:countries="${0}"> </x-countries-list> </x-choice> </x-group> <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="billing" ns="${0}"> </foxy-i18n> <x-choice data-testid="locations-billing-choice" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="allow-label" lang="${0}" key="allowlist" ns="${0}"></foxy-i18n> <foxy-i18n slot="block-label" lang="${0}" key="blocklist" ns="${0}"></foxy-i18n> <foxy-i18n slot="copy-label" lang="${0}" key="same_as_shipping" ns="${0}"> </foxy-i18n> <x-countries-list data-testid="locations-billing-list" countries="${0}" regions="${0}" class="mb-m" href="${0}" slot="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" ?hidden="${0}" @update:countries="${0}"> </x-countries-list> </x-choice> </x-group> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("locations:before"),n?"text-disabled":"",t,s,n?"text-disabled":"text-tertiary",t,s,["allow","block"],r,n,a,(t=>{"both"!==i.usage&&(i.usage="independent"),i.shipping_filter_type="block"===t.detail?"blacklist":"whitelist",d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,JSON.stringify(i.shipping_filter_values),this.regions,this.countries,r,t,s,n,a,(t=>{i.shipping_filter_values=t.currentTarget.countries,d(),this.edit({json:JSON.stringify(e)})}),n?"text-disabled":"text-tertiary",t,s,["allow","block","copy"],l,n,a,(t=>{"copy"===t.detail?i.usage="both":(i.usage="independent",i.billing_filter_type="block"===t.detail?"blacklist":"whitelist"),d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,t,s,JSON.stringify(i.billing_filter_values),this.regions,this.countries,l,t,s,n,a,"copy"===l,(t=>{i.billing_filter_values=t.currentTarget.countries,d(),this.edit({json:JSON.stringify(e)})}),this.renderTemplateOrSlot("locations:after"))}__renderHiddenFields(e){const{lang:t,ns:s}=this,i=[],n=[],a=e.cart_display_config,r=!this.in("idle")||this.disabledSelector.matches("hidden-fields",!0),l=this.readonlySelector.matches("hidden-fields",!0);for(const e in a){if(!e.startsWith("show_"))continue;const t=e.substring(5);i.push(t),"required"!==a.usage||a[e]||n.push(t)}"required"===a.usage&&n.push(...a.hidden_product_options);const d=()=>{a.usage="required",i.includes(this.__addHiddenFieldInputValue)?a[`show_${this.__addHiddenFieldInputValue}`]=!1:a.hidden_product_options.includes(this.__addHiddenFieldInputValue)||a.hidden_product_options.push(this.__addHiddenFieldInputValue),this.edit({json:JSON.stringify(e)}),this.__addHiddenFieldInputValue=""},c="calc(var(--lumo-border-radius-l) / 1.2)",u=0===n.length?[c]:["0","0",c,c],g=r||!this.__addHiddenFieldInputValue;return o(I||(I=Z` <div data-testid="hidden-fields"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="hidden_fields" ns="${0}"> </foxy-i18n> <div class="divide-y divide-contrast-10" data-testid="hidden-fields-list"> ${0} </div> <div data-testid="hidden-fields-new" style="border-radius:${0}" class="${0}"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m px-m focus-outline-none" list="hidden-fields-list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <datalist id="hidden-fields-list"> ${0} </datalist> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("hidden-fields:before"),r?"text-disabled":"",t,s,n.map((n=>o(z||(z=Z` <div class="${0}"> ${0} <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m m-auto"></iron-icon> </button> </div> `),h({"h-m ml-m pr-xs flex items-center justify-between":!0,"text-secondary":l,"text-disabled":r}),i.includes(n)?o(A||(A=Z`<foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n>`),t,n,s):o(D||(D=Z`<span>${0}</span>`),n),this.t("delete"),h({"w-xs h-xs rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!r,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!r,"cursor-default":r,flex:!l,hidden:l}),r,(()=>{"boolean"==typeof a[`show_${n}`]?a[`show_${n}`]=!0:a.hidden_product_options=a.hidden_product_options.filter((e=>e!==n)),this.edit({json:JSON.stringify(e)})})))),u.join(" "),h({"h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2":!0,"border-t border-contrast-10":n.length>0,flex:!l,hidden:l}),this.t("add_field"),f(this.__addHiddenFieldInputValue),r,l,(e=>"Enter"===e.key&&d()),(e=>{this.__addHiddenFieldInputValue=e.currentTarget.value}),i.filter((e=>!n.includes(e))).map((e=>o(G||(G=Z`<option value="${0}">${0}</option>`),e,this.t(e)))),this.t("add_field"),h({"w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":g,"bg-success-10 text-success cursor-pointer":!g,"hover-bg-success hover-text-success-contrast":!g,"focus-outline-none focus-ring-2":!g}),g,d,this.renderTemplateOrSlot("hidden-fields:after"))}__renderCards(e){const{lang:s,ns:i}=this,n=!this.in("idle")||this.disabledSelector.matches("cards",!0),a=this.readonlySelector.matches("cards",!0),r=e.supported_payment_cards;let l,d;"all_cards"===e.csc_requirements?(l=!1,d=!1):"sso_only"===e.csc_requirements?(l=!0,d=!1):(l=!0,d=!0);const c={amex:"American Express",diners:"Diners Club",discover:"Discover",jcb:"JCB",maestro:"Maestro",mastercard:"Mastercard",unionpay:"UnionPay",visa:"Visa"};return o(L||(L=Z` <div data-testid="cards"> ${0} <div class="space-y-xs"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="supported_cards" ns="${0}"> </foxy-i18n> <div class="flex flex-wrap m-xs p-s"> ${0} </div> <div class="flex flex-wrap p-s border-t border-contrast-10"> <x-checkbox data-testid="cards-saved-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="skip_csc_for_saved" ns="${0}"> </foxy-i18n> </x-checkbox> <x-checkbox data-testid="cards-sso-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="skip_csc_for_sso" ns="${0}"> </foxy-i18n> </x-checkbox> </div> </x-group> <foxy-i18n class="text-xs leading-s block ${0}" lang="${0}" key="supported_cards_disclaimer" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("cards:before"),n?"text-disabled":"",s,i,Object.entries(t).map((([t,s])=>{if(!c[t])return;const i=r.includes(t);return o(U||(U=Z` <div class="${0}"> <label class="${0}"> <div class="h-s">${0}</div> <div class="text-s font-medium mx-s my-auto leading-none"> ${0} </div> <input type="checkbox" class="sr-only" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> </label> </div> `),h({"m-xs rounded":!0,"opacity-50 cursor-default":n,"cursor-pointer ring-primary-50 focus-within-ring-2":!n}),h({"overflow-hidden transition-colors flex rounded-s border":!0,"border-primary bg-primary-10 text-primary":i&&!a,"border-contrast bg-contrast-5 text-secondary":i&&a,"hover-text-body":i&&!n&&!a,"border-contrast-10":!i,"hover-border-primary":!i&&!n&&!a,"hover-text-primary":!i&&!n&&!a}),s,c[t],n,a,i,(s=>{if(a)return s.preventDefault();s.stopPropagation(),s.currentTarget.checked?r.push(t):r.splice(r.indexOf(t),1),this.edit({json:JSON.stringify(e)})}))})),n||"new_cards_only"===e.csc_requirements,a,l,(t=>{e.csc_requirements=t.detail?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),s,i,n,a,d,(t=>{e.csc_requirements=t.detail?"new_cards_only":l?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),s,i,n?"text-disabled":"text-secondary",s,i,this.renderTemplateOrSlot("cards:after"))}__renderCheckoutType(e){const{lang:t,ns:s}=this,i=!this.in("idle")||this.disabledSelector.matches("checkout-type",!0),n=this.readonlySelector.matches("checkout-type",!0);return o(B||(B=Z` <div data-testid="checkout-type"> ${0} <div class="space-y-xs"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="checkout_type" ns="${0}"> </foxy-i18n> <x-choice data-testid="checkout-type-choice" ?disabled="${0}" ?readonly="${0}" .items="${0}" .value="${0}" .getText="${0}" @change="${0}"> </x-choice> </x-group> <foxy-i18n class="text-xs leading-s block ${0}" lang="${0}" key="checkout_type_helper_text" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("checkout-type:before"),i?"text-disabled":"",t,s,i,n,["default_account","default_guest","guest_only","account_only"],e.checkout_type,(e=>this.t(`checkout_type_${e}`)),(t=>{e.checkout_type=t.detail,this.edit({json:JSON.stringify(e)})}),i?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("checkout-type:after"))}__renderConsent(e){const{lang:t,ns:s}=this,i=e.tos_checkbox_settings,n=e.newsletter_subscribe,a=e.eu_secure_data_transfer_consent,r=!this.in("idle")||this.disabledSelector.matches("consent",!0),l=this.readonlySelector.matches("consent",!0),d="margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))";return o(P||(P=Z` <div data-testid="consent"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="consent" ns="${0}"> </foxy-i18n> <x-checkbox data-testid="consent-tos-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="display_tos_link" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="display_tos_link_explainer" ns="${0}"> </foxy-i18n> </div> <div slot="content" ?hidden="${0}"> <vaadin-text-field data-testid="consent-tos-field" label="${0}" class="w-full mt-m" placeholder="https://example.com/path/to/tos" clear-button-visible ?disabled="${0}" ?readonly="${0}" .value="${0}" @input="${0}"> </vaadin-text-field> <div class="flex flex-wrap -mx-s -mb-s mt-s"> <x-checkbox data-testid="consent-tos-require-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="require_consent" ns="${0}"> </foxy-i18n> </x-checkbox> <x-checkbox data-testid="consent-tos-state-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="checked_by_default" ns="${0}"> </foxy-i18n> </x-checkbox> </div> </div> </x-checkbox> <div style="${0}" class="border-b border-contrast-10"></div> <x-checkbox data-testid="consent-mail-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="newsletter_subscribe" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="newsletter_subscribe_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> <div style="${0}" class="border-b border-contrast-10"></div> <x-checkbox data-testid="consent-sdta-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="display_sdta" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="display_sdta_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </x-group> ${0} </div> `),this.renderTemplateOrSlot("consent:before"),r?"text-disabled":"",t,s,r,l,"required"===i.usage||"optional"===i.usage,(t=>{i.initial_state=t.detail?i.initial_state:"unchecked",i.is_hidden=!1,i.usage=t.detail?"required":"none",i.url=t.detail?i.url:"",this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,"none"===i.usage,this.t("location_url"),r,l,i.url,(t=>{i.url=t.currentTarget.value,this.edit({json:JSON.stringify(e)})}),r,l,"required"===i.usage,(t=>{i.usage=t.detail?"required":"optional",this.edit({json:JSON.stringify(e)})}),t,s,r,l,"checked"===i.initial_state,(t=>{i.initial_state=t.detail?"checked":"unchecked",this.edit({json:JSON.stringify(e)})}),t,s,d,r,l,"required"===n.usage,(t=>{n.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,d,r,l,"required"===a.usage,(t=>{a.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("consent:after"))}__renderFields(e){const{lang:t,ns:s}=this,i=!this.in("idle")||this.disabledSelector.matches("fields",!0),n=this.readonlySelector.matches("fields",!0),a=e.custom_checkout_field_requirements;return o(M||(M=Z` <div data-testid="fields"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="field_plural" ns="${0}"> </foxy-i18n> <div class="bg-contrast-10 grid grid-cols-1 sm-grid-cols-2" style="gap:1px"> ${0} <div class="bg-base hidden sm-block"></div> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("fields:before"),i?"text-disabled":"",t,s,Object.entries({cart_controls:["enabled","disabled"],coupon_entry:["enabled","disabled"],billing_first_name:["default","optional","required","hidden"],billing_last_name:["default","optional","required","hidden"],billing_company:["default","optional","required","hidden"],billing_tax_id:["default","optional","required","hidden"],billing_phone:["default","optional","required","hidden"],billing_address1:["default","optional","required","hidden"],billing_address2:["default","optional","required","hidden"],billing_city:["default","optional","required","hidden"],billing_region:["default","optional","required","hidden"],billing_postal_code:["default","optional","required","hidden"],billing_country:["default","optional","required","hidden"]}).map((([r,l])=>o(W||(W=Z` <label class="${0}"> <foxy-i18n class="flex-1" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <div class="${0}"> ${0} </div> <div class="${0}"> <select data-testid="fields-${0}" class="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </select> <iron-icon class="pointer-events-none icon-inline text-xl" icon="icons:expand-more"> </iron-icon> </div> </label> `),h({"flex items-center pl-m bg-base":!0,"text-secondary":n,"text-disabled":i}),t,r.replace("billing_",""),s,h({"flex items-center text-right font-medium h-s px-s m-xs":n,hidden:!n}),this.t(l.find((e=>a[r]===e))),h({"px-s m-xs flex items-center rounded leading-none":!0,"ring-primary-50 ring-inset focus-within-ring-2":!i,"hover-text-primary":!i,"cursor-pointer":!i,"cursor-default":i,flex:!n,hidden:n}),r,h({"h-s mr-xs text-right appearance-none bg-transparent font-medium":!0,"focus-outline-none cursor-pointer":!i,"cursor-default":i}),i,n,(t=>{const s=t.currentTarget,i=s.options[s.options.selectedIndex].value;a[r]=i,this.edit({json:JSON.stringify(e)})}),l.map((e=>o(K||(K=Z` <option value="${0}" ?selected="${0}"> ${0} </option> `),e,a[r]===e,this.t(e))))))),this.renderTemplateOrSlot("fields:after"))}__renderGoogleAnalytics(e){const{lang:t,ns:s}=this,i=e.analytics_config,n=i.google_tag,a=i.google_analytics,r=!this.in("idle")||this.disabledSelector.matches("google-analytics",!0),l=this.readonlySelector.matches("google-analytics",!0);return o(Q||(Q=Z` <div data-testid="google-analytics"> ${0} <x-group frame> <span class="${0}" slot="header">Google Analytics</span> <foxy-i18n class="block bg-error-10 text-error font-medium rounded-t p-m" infer="" key="ga_deprecation_notice"> </foxy-i18n> <div class="p-m space-y-m"> <vaadin-text-field data-testid="google-analytics-field" style="--lumo-border-radius:var(--lumo-border-radius-s)" class="w-full" label="${0}" placeholder="UA-1234567-1" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> <x-checkbox data-testid="google-analytics-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="ga_include_on_site" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="ga_include_on_site_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("google-analytics:before"),r?"text-disabled":"",this.t("ga_account_id"),this.t("ga_account_id_explainer"),f(a.account_id),r,l,(e=>"Enter"===e.key&&this.submit()),(t=>{a.account_id=t.currentTarget.value,a.usage=a.account_id?"required":"none",i.usage=a.account_id||n.account_id?"required":"none",this.edit({json:JSON.stringify(e)})}),r,l,a.include_on_site,(t=>{a.include_on_site=t.detail,this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("google-analytics:after"))}__renderGoogleTag(e){const t=e.analytics_config,s=t.google_tag,i=t.google_analytics,n=!this.in("idle")||this.disabledSelector.matches("google-tag",!0),a=this.readonlySelector.matches("google-tag",!0);return o(X||(X=Z` <div data-testid="google-tag"> ${0} <x-group frame> <span class="${0}" slot="header">Google Tag</span> <div class="p-m space-y-m"> <vaadin-text-field data-testid="google-tag-account-id" style="--lumo-border-radius:var(--lumo-border-radius-s)" class="w-full" label="${0}" placeholder="G-123456789" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> <vaadin-text-field data-testid="google-tag-send-to" style="--lumo-border-radius:var(--lumo-border-radius-s)" class="w-full" label="${0}" placeholder="AW-123456789/sABDCLqU3K2BEJb8cxDE" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> <p class="text-xs text-secondary"> <foxy-i18n infer="" key="gt_usage_notice"></foxy-i18n> <a target="_blank" class="cursor-pointer group text-primary rounded-s font-medium focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://wiki.foxycart.com/v/2.0/analytics#google_tag_ga4_google_ads" rel="nofollow noreferrer noopener"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="gt_docs_link"> </foxy-i18n> </a> </p> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("google-tag:before"),n?"text-disabled":"",this.t("gt_account_id"),this.t("gt_account_id_explainer"),f(s.account_id),n,a,(e=>"Enter"===e.key&&this.submit()),(o=>{s.account_id=o.currentTarget.value,s.usage=s.account_id?"required":"none",t.usage=s.account_id||i.account_id?"required":"none",this.edit({json:JSON.stringify(e)})}),this.t("gt_send_to"),this.t("gt_send_to_explainer"),f(s.send_to),n,a,(e=>"Enter"===e.key&&this.submit()),(o=>{s.send_to=o.currentTarget.value,s.usage=s.account_id?"required":"none",t.usage=s.account_id||i.account_id?"required":"none",this.edit({json:JSON.stringify(e)})}),this.renderTemplateOrSlot("google-tag:after"))}__renderTroubleshooting(e){const{lang:t,ns:s}=this,i=e.debug,n=!this.in("idle")||this.disabledSelector.matches("troubleshooting",!0),a=this.readonlySelector.matches("troubleshooting",!0);return o(Y||(Y=Z` <div data-testid="troubleshooting"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="troubleshooting" ns="${0}"> </foxy-i18n> <div class="p-m space-y-m"> <x-checkbox data-testid="troubleshooting-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="troubleshooting_debug" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="troubleshooting_debug_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("troubleshooting:before"),n?"text-disabled":"",t,s,n,a,"required"===i.usage,(t=>{i.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,n?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("troubleshooting:after"))}}customElements.define("foxy-template-config-form",te);export{te as TemplateConfigForm};
|
|
1
|
+
import"./shared-30d00b64.js";import"./shared-ff9791cf.js";import"./shared-c9ba1b64.js";import"./shared-7deff07c.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-029816d7.js";import{_ as e,B as t}from"./shared-1522d76f.js";import{l as s}from"./shared-d7be11de.js";import{C as i,a as o}from"./shared-e39807f8.js";import{h as n}from"./shared-7f33a83a.js";import{C as a}from"./shared-b1b8ea67.js";import{C as r}from"./shared-b23c903e.js";import{N as l}from"./shared-6a7f96c4.js";import{T as d,a as c,S as u,R as h}from"./shared-5fa697c4.js";import{c as g}from"./shared-4e709717.js";import{i as p}from"./shared-d3bf9ac0.js";import{G as f}from"./shared-a8dc23f1.js";import{l as y}from"./shared-f3b35364.js";import"./shared-43f449bb.js";import"./shared-f9a3d1ff.js";import"./shared-b509bc2c.js";import"./shared-61ade33e.js";import"./shared-bed7aae1.js";import"./shared-fc15a882.js";import"./shared-30cbf0a6.js";import"./shared-d519a301.js";import"./shared-343d1fd7.js";import"./shared-9c08cfab.js";import"./shared-ea527e98.js";import"./shared-99c0ae04.js";import"./shared-9df8f842.js";import"./shared-ad34b6db.js";import"./shared-4e59fd48.js";import"./shared-2c8c4b43.js";import"./shared-11c2efc8.js";import"./shared-eb116b3e.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";let _,x,b,m,$,v=e=>e;const k=r(d(c(l)));class w extends k{constructor(){super(...arguments),this.regions=[],this.name="",this.code="",this.__newRegion=""}static get properties(){return e(e({},super.properties),{},{__newRegion:{attribute:!1},regions:{type:Array},name:{type:String},code:{type:String}})}render(){var e,t;return n(_||(_=v` <div class="${0}"> <div data-testid="country" class="h-m flex justify-between items-center border-b border-contrast-10"> <div class="ml-m"> <span>${0}</span> ${0} </div> <button aria-label="${0}" class="${0}" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon> </button> </div> <div data-testid="regions" class="flex flex-wrap p-xs"> ${0} <div data-testid="new-region" style="border-radius:var(--lumo-size-s)" class="${0}"> <input placeholder="${0}" class="bg-transparent appearance-none h-s text-s px-s focus-outline-none" style="width:8rem" list="list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <button style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> <datalist id="list"> ${0} </datalist> </div> </div> `),g({"border border-contrast-10 rounded text-s":!0,"text-disabled":this.disabled}),this.name||this.code,this.name?n(x||(x=v`<span class="text-secondary">${0}</span>`),this.code):"",this.t("delete"),g({"mr-xs items-center justify-center rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!this.disabled,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!this.disabled,"cursor-default":this.disabled,flex:!this.readonly,hidden:this.readonly}),this.disabled,(()=>this.dispatchEvent(new CustomEvent("delete"))),this.regions.map((e=>{var t,s;const i=null===(s=null===(t=this.data)||void 0===t?void 0:t.values[e])||void 0===s?void 0:s.default;return n(b||(b=v` <div class="flex items-center border border-contrast-10 h-s m-xs" style="border-radius:var(--lumo-size-s)"> <span class="mx-s"> <span>${0}</span> ${0} </span> <button aria-label="${0}" class="${0}" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon> </button> </div> `),i||e,i?n(m||(m=v`<span class="text-secondary">${0}</span>`),e):"",this.t("delete"),g({"items-center justify-center rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!this.disabled,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!this.disabled,"cursor-default":this.disabled,flex:!this.readonly,hidden:this.readonly}),this.disabled,(()=>{this.regions=this.regions.filter((t=>t!==e)),this.dispatchEvent(new CustomEvent("update:regions"))}))})),g({"h-s m-xs items-center transition-colors border border-contrast-10":!0,"hover-border-contrast-40":!this.disabled,"focus-within-ring-1 ring-primary-50 focus-within-border-primary-50":!this.disabled,flex:!this.readonly,hidden:this.readonly}),this.t("add_region"),this.__newRegion,this.disabled,this.readonly,(e=>{"Enter"===e.key&&this.__newRegion&&this.__addRegion()}),(e=>{const t=e.currentTarget;this.__newRegion=t.value}),g({"flex-shrink-0":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":!this.__newRegion,"bg-success-10 text-success cursor-pointer":!!this.__newRegion,"hover-bg-success hover-text-success-contrast":!!this.__newRegion,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.__newRegion}),this.disabled||!this.__newRegion,this.__addRegion,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>n($||($=v`<option value="${0}">${0}</option>`),e.code,e.default))))}__addRegion(){this.regions=[...new Set([...this.regions,this.__newRegion])],this.__newRegion="",this.dispatchEvent(new CustomEvent("update:regions"))}}let S,j,O,q=e=>e;const T=u(r(d(c(l))));class J extends T{constructor(){super(...arguments),this.countries={},this.regions="",this.__newCountry=""}static get scopedElements(){return{"x-country-card":w,"iron-icon":customElements.get("iron-icon")}}static get properties(){return e(e({},super.properties),{},{__newCountry:{attribute:!1},countries:{type:Object},regions:{type:String}})}render(){var t,s;return n(S||(S=q` <div> <div class="space-y-s" data-testid="countries"> ${0} <div data-testid="new-country" class="${0}"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m text-s px-m focus-outline-none" list="list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <button aria-label="${0}" class="${0}" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> </div> <datalist id="list"> ${0} </datalist> </div> `),Object.entries(this.countries).map((([t,s])=>{var i,o;let a;try{const e=new URL(this.regions);e.searchParams.set("country_code",t),a=e.toString()}catch(e){a=""}return n(j||(j=q` <x-country-card regions="${0}" code="${0}" name="${0}" href="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" @update:regions="${0}" @delete="${0}"> </x-country-card> `),JSON.stringify("*"===s?[]:s),t,p(null===(o=null===(i=this.data)||void 0===i?void 0:i.values[t])||void 0===o?void 0:o.default),a,this.lang,this.ns,this.disabled,this.readonly,(s=>{const i=e({},this.countries),o=s.currentTarget.regions;i[t]=o.length?o:"*",this.countries=i,this.dispatchEvent(new CustomEvent("update:countries"))}),(()=>{const s=e({},this.countries);delete s[t],this.countries=s,this.dispatchEvent(new CustomEvent("update:countries"))}))})),g({"h-m flex items-center rounded transition-colors":!0,"border border-contrast-10 ring-primary-50":!0,"hover-border-contrast-40":!this.disabled,"focus-within-ring-1 focus-within-border-primary-50":!this.disabled,flex:!this.readonly,hidden:this.readonly}),this.t("add_country"),this.__newCountry,this.disabled,this.readonly,(e=>{"Enter"===e.key&&this.__newCountry&&this.__addCountry()}),(e=>{const t=e.currentTarget;this.__newCountry=t.value}),this.t("create"),g({"mr-xs flex-shrink-0":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":!this.__newCountry,"bg-success-10 text-success cursor-pointer":!!this.__newCountry,"hover-bg-success hover-text-success-contrast":!!this.__newCountry,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.__newCountry}),!this.__newCountry||this.disabled,this.__addCountry,Object.entries(null!==(s=null===(t=this.data)||void 0===t?void 0:t.values)&&void 0!==s?s:{}).map((([e,t])=>n(O||(O=q`<option value="${0}">${0}</option>`),e,t.default))))}__addCountry(){this.countries=e(e({},this.countries),{},{[this.__newCountry]:"*"}),this.__newCountry="",this.dispatchEvent(new CustomEvent("update:countries"))}}let N,C,E,F,V,R,H,I,z,A,D,G,B,L,U,P,M,W,K,Q,X,Y,Z,ee=e=>e;const te=u(h(r(d(c(l,"template-config-form")))));class se extends te{constructor(){super(...arguments),this.templates={},this.countries="",this.regions="",this.__addHiddenFieldInputValue=""}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-source-control":customElements.get("foxy-internal-source-control"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-countries-list":J,"x-checkbox":a,"x-choice":i,"x-group":f}}static get properties(){return e(e({},super.properties),{},{__addHiddenFieldInputValue:{attribute:!1},countries:{type:String},regions:{type:String}})}render(){var e,t;const s=this.hiddenSelector,i=this.form.json?JSON.parse(this.form.json):{cart_type:"default",checkout_type:"default_account",csc_requirements:"all_cards",tos_checkbox_settings:{usage:"none",initial_state:"unchecked",is_hidden:!1,url:""},eu_secure_data_transfer_consent:{usage:"required"},newsletter_subscribe:{usage:"none"},analytics_config:{usage:"none",google_analytics:{usage:"none",account_id:"",include_on_site:!1},google_tag:{usage:"none",send_to:"",account_id:""}},colors:{usage:"none",primary:"4D4D4D",secondary:"FFFFFF",tertiary:"FFFFFF"},use_checkout_confirmation_window:{usage:"none"},supported_payment_cards:["visa","mastercard","discover","amex"],custom_checkout_field_requirements:{cart_controls:"enabled",coupon_entry:"enabled",billing_first_name:"required",billing_last_name:"required",billing_company:"optional",billing_tax_id:"hidden",billing_phone:"optional",billing_address1:"required",billing_address2:"optional",billing_city:"required",billing_region:"default",billing_postal_code:"required",billing_country:"required"},cart_display_config:{usage:"none",show_product_weight:!0,show_product_category:!0,show_product_code:!0,show_product_options:!0,show_sub_frequency:!0,show_sub_startdate:!0,show_sub_nextdate:!0,show_sub_enddate:!0,hidden_product_options:[]},foxycomplete:{usage:"required",show_combobox:!0,combobox_open:"\\u25bc",combobox_close:"\\u25b2",show_flags:!0},custom_script_values:{header:"",footer:"",checkout_fields:"",multiship_checkout_fields:""},http_receipt:!1,custom_config:"",debug:{usage:"none"},location_filtering:{usage:"none",shipping_filter_type:"blacklist",billing_filter_type:"blacklist",shipping_filter_values:{},billing_filter_values:{}},postal_code_lookup:{usage:"enabled"}};return n(N||(N=ee` <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="space-y-l"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-source-control data-testid="custom-config" helper-text="${0}" placeholder='{ "key": "value" }' label="${0}" infer="custom-config" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> <foxy-internal-source-control data-testid="header" placeholder="<style>h1 { color: red }</style>" helper-text="${0}" label="${0}" infer="header" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> <foxy-internal-source-control data-testid="custom-fields" placeholder='<label>Comment: <input name="comment"></label>' helper-text="${0}" label="${0}" infer="custom-fields" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> <foxy-internal-source-control data-testid="footer" placeholder='<script src="https://example.com/code.js"></script>' helper-text="${0}" label="${0}" infer="footer" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> </div> <div class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),s.matches("cart-type",!0)?"":this.__renderCartType(i),s.matches("foxycomplete",!0)?"":this.__renderFoxycomplete(i),s.matches("locations",!0)?"":this.__renderLocations(i),s.matches("hidden-fields",!0)?"":this.__renderHiddenFields(i),s.matches("cards",!0)?"":this.__renderCards(i),s.matches("checkout-type",!0)?"":this.__renderCheckoutType(i),s.matches("consent",!0)?"":this.__renderConsent(i),s.matches("fields",!0)?"":this.__renderFields(i),s.matches("google-analytics",!0)?"":this.__renderGoogleAnalytics(i),s.matches("google-tag",!0)?"":this.__renderGoogleTag(i),s.matches("troubleshooting",!0)?"":this.__renderTroubleshooting(i),this.t("custom_config_helper_text"),this.t("custom_config"),(()=>"string"==typeof i.custom_config?i.custom_config:JSON.stringify(i.custom_config,null,2)),(e=>{try{i.custom_config=JSON.parse(e)}catch(t){i.custom_config=e}this.edit({json:JSON.stringify(i)})}),this.t("custom_header_helper_text"),this.t("custom_header"),(()=>i.custom_script_values.header),(e=>{i.custom_script_values.header=e,this.edit({json:JSON.stringify(i)})}),this.t("custom_fields_helper_text"),this.t("custom_fields"),(()=>i.custom_script_values.checkout_fields),(e=>{i.custom_script_values.checkout_fields=e,this.edit({json:JSON.stringify(i)})}),this.t("custom_footer_helper_text"),this.t("custom_footer"),(()=>i.custom_script_values.footer),(e=>{i.custom_script_values.footer=e,this.edit({json:JSON.stringify(i)})}),g({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":"busy",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}get hiddenSelector(){var e;const s=[super.hiddenSelector.toString()],i=(null===(e=this.data)||void 0===e?void 0:e.json)?JSON.parse(this.data.json):null;return i&&"none"!==i.analytics_config.google_analytics.usage||s.push("google-analytics"),new t(s.join(" ").trim())}__renderCartType(t){const{lang:s,ns:i}=this,o=["default","fullpage","custom"],a=!this.in("idle")||this.disabledSelector.matches("cart-type",!0);return n(C||(C=ee` <div data-testid="cart-type"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="cart_type" ns="${0}"> </foxy-i18n> <x-choice data-testid="cart-type-choice" .value="${0}" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("cart-type:before"),a?"text-disabled":"",s,i,t.cart_type,o,a,this.readonlySelector.matches("cart-type",!0),(s=>{this.edit({json:JSON.stringify(e(e({},t),{},{cart_type:s.detail}))})}),o.map((e=>n(E||(E=ee` <div slot="${0}-label" class="grid leading-s py-s"> <foxy-i18n lang="${0}" key="cart_type_${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs ${0}" lang="${0}" key="cart_type_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,s,e,i,a?"text-disabled":"text-secondary",s,e,i))),this.renderTemplateOrSlot("cart-type:after"))}__renderFoxycomplete(e){const{lang:t,ns:s}=this,i=!this.in("idle")||this.disabledSelector.matches("foxycomplete",!0),a=this.readonlySelector.matches("foxycomplete",!0),r=e.foxycomplete,l=["combobox","search","disabled"],d="none"===r.usage?"disabled":r.show_combobox?"combobox":"search",c=n(F||(F=ee` <x-checkbox data-testid="foxycomplete-flags-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_country_flags" ns="${0}"></foxy-i18n> </x-checkbox> `),i,a,r.show_flags,(t=>{r.show_flags=t.detail,this.edit({json:JSON.stringify(e)})}),t,s);return n(V||(V=ee` <div data-testid="foxycomplete"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="foxycomplete" ns="${0}"> </foxy-i18n> <x-choice data-testid="foxycomplete-choice" .value="${0}" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} <div slot="combobox" class="space-y-m pb-s" ?hidden="${0}"> <div class="grid grid-cols-2 gap-m" style="max-width:16rem"> ${0} </div> ${0} </div> <div slot="search" class="pb-s" ?hidden="${0}">${0}</div> </x-choice> <div class="border-t border-contrast-10 p-m"> <x-checkbox data-testid="foxycomplete-lookup-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="enable_postcode_lookup" ns="${0}"></foxy-i18n> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("foxycomplete:before"),i?"text-disabled":"",t,s,d,l,i,a,(t=>{t instanceof o&&(r.usage="disabled"===t.detail?"none":"required",r.show_combobox="combobox"===t.detail,this.edit({json:JSON.stringify(e)}))}),l.map((e=>n(R||(R=ee` <div slot="${0}-label" class="grid leading-s py-s"> <foxy-i18n lang="${0}" key="foxycomplete_${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs ${0}" lang="${0}" key="foxycomplete_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,t,e,s,i?"text-disabled":"text-secondary",t,e,s))),"combobox"!==d,["open","close"].map((t=>{const s="open"===t?"combobox_open":"combobox_close";return n(H||(H=ee` <vaadin-text-field data-testid="foxycomplete-${0}-icon" style="--lumo-border-radius:var(--lumo-border-radius-s)" label="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> `),t,this.t(`${t}_icon`),r[s],i,a,(e=>"Enter"===e.key&&this.submit()),(t=>{r[s]=t.currentTarget.value,this.edit({json:JSON.stringify(e)})}))})),c,"search"!==d,c,i,a,"enabled"===e.postal_code_lookup.usage,(t=>{e.postal_code_lookup.usage=t.detail?"enabled":"none",this.edit({json:JSON.stringify(e)})}),t,s,this.renderTemplateOrSlot("foxycomplete:after"))}__renderLocations(e){const{lang:t,ns:s}=this,i=e.location_filtering,o=!this.in("idle")||this.disabledSelector.matches("locations",!0),a=this.readonlySelector.matches("locations",!0),r="blacklist"===i.shipping_filter_type?"block":"allow",l="both"===i.usage?"copy":"blacklist"===i.billing_filter_type?"block":"allow",d=()=>{if("both"===i.usage)i.billing_filter_type=i.shipping_filter_type,i.billing_filter_values=i.shipping_filter_values;else{const e=Object.keys(i.billing_filter_values).length>0,t=Object.keys(i.shipping_filter_values).length>0;i.usage=e||t?e&&!t?"billing":t&&!e?"shipping":"independent":"none"}};return n(I||(I=ee` <div data-testid="locations"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="location_plural" ns="${0}"> </foxy-i18n> <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap:1px"> <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="shipping" ns="${0}"> </foxy-i18n> <x-choice data-testid="locations-shipping-choice" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="allow-label" lang="${0}" key="allowlist" ns="${0}"></foxy-i18n> <foxy-i18n slot="block-label" lang="${0}" key="blocklist" ns="${0}"></foxy-i18n> <x-countries-list data-testid="locations-shipping-list" countries="${0}" regions="${0}" class="mb-m" href="${0}" slot="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" @update:countries="${0}"> </x-countries-list> </x-choice> </x-group> <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="billing" ns="${0}"> </foxy-i18n> <x-choice data-testid="locations-billing-choice" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="allow-label" lang="${0}" key="allowlist" ns="${0}"></foxy-i18n> <foxy-i18n slot="block-label" lang="${0}" key="blocklist" ns="${0}"></foxy-i18n> <foxy-i18n slot="copy-label" lang="${0}" key="same_as_shipping" ns="${0}"> </foxy-i18n> <x-countries-list data-testid="locations-billing-list" countries="${0}" regions="${0}" class="mb-m" href="${0}" slot="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" ?hidden="${0}" @update:countries="${0}"> </x-countries-list> </x-choice> </x-group> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("locations:before"),o?"text-disabled":"",t,s,o?"text-disabled":"text-tertiary",t,s,["allow","block"],r,o,a,(t=>{"both"!==i.usage&&(i.usage="independent"),i.shipping_filter_type="block"===t.detail?"blacklist":"whitelist",d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,JSON.stringify(i.shipping_filter_values),this.regions,this.countries,r,t,s,o,a,(t=>{i.shipping_filter_values=t.currentTarget.countries,d(),this.edit({json:JSON.stringify(e)})}),o?"text-disabled":"text-tertiary",t,s,["allow","block","copy"],l,o,a,(t=>{"copy"===t.detail?i.usage="both":(i.usage="independent",i.billing_filter_type="block"===t.detail?"blacklist":"whitelist"),d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,t,s,JSON.stringify(i.billing_filter_values),this.regions,this.countries,l,t,s,o,a,"copy"===l,(t=>{i.billing_filter_values=t.currentTarget.countries,d(),this.edit({json:JSON.stringify(e)})}),this.renderTemplateOrSlot("locations:after"))}__renderHiddenFields(e){const{lang:t,ns:s}=this,i=[],o=[],a=e.cart_display_config,r=!this.in("idle")||this.disabledSelector.matches("hidden-fields",!0),l=this.readonlySelector.matches("hidden-fields",!0);for(const e in a){if(!e.startsWith("show_"))continue;const t=e.substring(5);i.push(t),"required"!==a.usage||a[e]||o.push(t)}"required"===a.usage&&o.push(...a.hidden_product_options);const d=()=>{a.usage="required",i.includes(this.__addHiddenFieldInputValue)?a[`show_${this.__addHiddenFieldInputValue}`]=!1:a.hidden_product_options.includes(this.__addHiddenFieldInputValue)||a.hidden_product_options.push(this.__addHiddenFieldInputValue),this.edit({json:JSON.stringify(e)}),this.__addHiddenFieldInputValue=""},c="calc(var(--lumo-border-radius-l) / 1.2)",u=0===o.length?[c]:["0","0",c,c],h=r||!this.__addHiddenFieldInputValue;return n(z||(z=ee` <div data-testid="hidden-fields"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="hidden_fields" ns="${0}"> </foxy-i18n> <div class="divide-y divide-contrast-10" data-testid="hidden-fields-list"> ${0} </div> <div data-testid="hidden-fields-new" style="border-radius:${0}" class="${0}"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m px-m focus-outline-none" list="hidden-fields-list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <datalist id="hidden-fields-list"> ${0} </datalist> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("hidden-fields:before"),r?"text-disabled":"",t,s,o.map((o=>n(A||(A=ee` <div class="${0}"> ${0} <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m m-auto"></iron-icon> </button> </div> `),g({"h-m ml-m pr-xs flex items-center justify-between":!0,"text-secondary":l,"text-disabled":r}),i.includes(o)?n(D||(D=ee`<foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n>`),t,o,s):n(G||(G=ee`<span>${0}</span>`),o),this.t("delete"),g({"w-xs h-xs rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!r,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!r,"cursor-default":r,flex:!l,hidden:l}),r,(()=>{"boolean"==typeof a[`show_${o}`]?a[`show_${o}`]=!0:a.hidden_product_options=a.hidden_product_options.filter((e=>e!==o)),this.edit({json:JSON.stringify(e)})})))),u.join(" "),g({"h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2":!0,"border-t border-contrast-10":o.length>0,flex:!l,hidden:l}),this.t("add_field"),y(this.__addHiddenFieldInputValue),r,l,(e=>"Enter"===e.key&&d()),(e=>{this.__addHiddenFieldInputValue=e.currentTarget.value}),i.filter((e=>!o.includes(e))).map((e=>n(B||(B=ee`<option value="${0}">${0}</option>`),e,this.t(e)))),this.t("add_field"),g({"w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":h,"bg-success-10 text-success cursor-pointer":!h,"hover-bg-success hover-text-success-contrast":!h,"focus-outline-none focus-ring-2":!h}),h,d,this.renderTemplateOrSlot("hidden-fields:after"))}__renderCards(e){const{lang:t,ns:i}=this,o=!this.in("idle")||this.disabledSelector.matches("cards",!0),a=this.readonlySelector.matches("cards",!0),r=e.supported_payment_cards;let l,d;"all_cards"===e.csc_requirements?(l=!1,d=!1):"sso_only"===e.csc_requirements?(l=!0,d=!1):(l=!0,d=!0);const c={amex:"American Express",diners:"Diners Club",discover:"Discover",jcb:"JCB",maestro:"Maestro",mastercard:"Mastercard",unionpay:"UnionPay",visa:"Visa"};return n(L||(L=ee` <div data-testid="cards"> ${0} <div class="space-y-xs"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="supported_cards" ns="${0}"> </foxy-i18n> <div class="flex flex-wrap m-xs p-s"> ${0} </div> <div class="flex flex-wrap p-s border-t border-contrast-10"> <x-checkbox data-testid="cards-saved-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="skip_csc_for_saved" ns="${0}"> </foxy-i18n> </x-checkbox> <x-checkbox data-testid="cards-sso-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="skip_csc_for_sso" ns="${0}"> </foxy-i18n> </x-checkbox> </div> </x-group> <foxy-i18n class="text-xs leading-s block ${0}" lang="${0}" key="supported_cards_disclaimer" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("cards:before"),o?"text-disabled":"",t,i,Object.entries(s).map((([t,s])=>{if(!c[t])return;const i=r.includes(t);return n(U||(U=ee` <div class="${0}"> <label class="${0}"> <div class="h-s">${0}</div> <div class="text-s font-medium mx-s my-auto leading-none"> ${0} </div> <input type="checkbox" class="sr-only" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> </label> </div> `),g({"m-xs rounded":!0,"opacity-50 cursor-default":o,"cursor-pointer ring-primary-50 focus-within-ring-2":!o}),g({"overflow-hidden transition-colors flex rounded-s border":!0,"border-primary bg-primary-10 text-primary":i&&!a,"border-contrast bg-contrast-5 text-secondary":i&&a,"hover-text-body":i&&!o&&!a,"border-contrast-10":!i,"hover-border-primary":!i&&!o&&!a,"hover-text-primary":!i&&!o&&!a}),s,c[t],o,a,i,(s=>{if(a)return s.preventDefault();s.stopPropagation(),s.currentTarget.checked?r.push(t):r.splice(r.indexOf(t),1),this.edit({json:JSON.stringify(e)})}))})),o||"new_cards_only"===e.csc_requirements,a,l,(t=>{e.csc_requirements=t.detail?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),t,i,o,a,d,(t=>{e.csc_requirements=t.detail?"new_cards_only":l?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),t,i,o?"text-disabled":"text-secondary",t,i,this.renderTemplateOrSlot("cards:after"))}__renderCheckoutType(e){const{lang:t,ns:s}=this,i=!this.in("idle")||this.disabledSelector.matches("checkout-type",!0),o=this.readonlySelector.matches("checkout-type",!0);return n(P||(P=ee` <div data-testid="checkout-type"> ${0} <div class="space-y-xs"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="checkout_type" ns="${0}"> </foxy-i18n> <x-choice data-testid="checkout-type-choice" ?disabled="${0}" ?readonly="${0}" .items="${0}" .value="${0}" .getText="${0}" @change="${0}"> </x-choice> </x-group> <foxy-i18n class="text-xs leading-s block ${0}" lang="${0}" key="checkout_type_helper_text" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("checkout-type:before"),i?"text-disabled":"",t,s,i,o,["default_account","default_guest","guest_only","account_only"],e.checkout_type,(e=>this.t(`checkout_type_${e}`)),(t=>{e.checkout_type=t.detail,this.edit({json:JSON.stringify(e)})}),i?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("checkout-type:after"))}__renderConsent(e){const{lang:t,ns:s}=this,i=e.tos_checkbox_settings,o=e.newsletter_subscribe,a=e.eu_secure_data_transfer_consent,r=!this.in("idle")||this.disabledSelector.matches("consent",!0),l=this.readonlySelector.matches("consent",!0),d="margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))";return n(M||(M=ee` <div data-testid="consent"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="consent" ns="${0}"> </foxy-i18n> <x-checkbox data-testid="consent-tos-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="display_tos_link" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="display_tos_link_explainer" ns="${0}"> </foxy-i18n> </div> <div slot="content" ?hidden="${0}"> <vaadin-text-field data-testid="consent-tos-field" label="${0}" class="w-full mt-m" placeholder="https://example.com/path/to/tos" clear-button-visible ?disabled="${0}" ?readonly="${0}" .value="${0}" @input="${0}"> </vaadin-text-field> <div class="flex flex-wrap -mx-s -mb-s mt-s"> <x-checkbox data-testid="consent-tos-require-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="require_consent" ns="${0}"> </foxy-i18n> </x-checkbox> <x-checkbox data-testid="consent-tos-state-check" class="m-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="checked_by_default" ns="${0}"> </foxy-i18n> </x-checkbox> </div> </div> </x-checkbox> <div style="${0}" class="border-b border-contrast-10"></div> <x-checkbox data-testid="consent-mail-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="newsletter_subscribe" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="newsletter_subscribe_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> <div style="${0}" class="border-b border-contrast-10"></div> <x-checkbox data-testid="consent-sdta-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" class="m-m" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="display_sdta" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="display_sdta_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </x-group> ${0} </div> `),this.renderTemplateOrSlot("consent:before"),r?"text-disabled":"",t,s,r,l,"required"===i.usage||"optional"===i.usage,(t=>{i.initial_state=t.detail?i.initial_state:"unchecked",i.is_hidden=!1,i.usage=t.detail?"required":"none",i.url=t.detail?i.url:"",this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,"none"===i.usage,this.t("location_url"),r,l,i.url,(t=>{i.url=t.currentTarget.value,this.edit({json:JSON.stringify(e)})}),r,l,"required"===i.usage,(t=>{i.usage=t.detail?"required":"optional",this.edit({json:JSON.stringify(e)})}),t,s,r,l,"checked"===i.initial_state,(t=>{i.initial_state=t.detail?"checked":"unchecked",this.edit({json:JSON.stringify(e)})}),t,s,d,r,l,"required"===o.usage,(t=>{o.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,d,r,l,"required"===a.usage,(t=>{a.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("consent:after"))}__renderFields(e){const{lang:t,ns:s}=this,i=!this.in("idle")||this.disabledSelector.matches("fields",!0),o=this.readonlySelector.matches("fields",!0),a=e.custom_checkout_field_requirements;return n(W||(W=ee` <div data-testid="fields"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="field_plural" ns="${0}"> </foxy-i18n> <div class="bg-contrast-10 grid grid-cols-1 sm-grid-cols-2" style="gap:1px"> ${0} <div class="bg-base hidden sm-block"></div> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("fields:before"),i?"text-disabled":"",t,s,Object.entries({cart_controls:["enabled","disabled"],coupon_entry:["enabled","disabled"],billing_first_name:["default","optional","required","hidden"],billing_last_name:["default","optional","required","hidden"],billing_company:["default","optional","required","hidden"],billing_tax_id:["default","optional","required","hidden"],billing_phone:["default","optional","required","hidden"],billing_address1:["default","optional","required","hidden"],billing_address2:["default","optional","required","hidden"],billing_city:["default","optional","required","hidden"],billing_region:["default","optional","required","hidden"],billing_postal_code:["default","optional","required","hidden"],billing_country:["default","optional","required","hidden"]}).map((([r,l])=>n(K||(K=ee` <label class="${0}"> <foxy-i18n class="flex-1" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <div class="${0}"> ${0} </div> <div class="${0}"> <select data-testid="fields-${0}" class="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </select> <iron-icon class="pointer-events-none icon-inline text-xl" icon="icons:expand-more"> </iron-icon> </div> </label> `),g({"flex items-center pl-m bg-base":!0,"text-secondary":o,"text-disabled":i}),t,r.replace("billing_",""),s,g({"flex items-center text-right font-medium h-s px-s m-xs":o,hidden:!o}),this.t(l.find((e=>a[r]===e))),g({"px-s m-xs flex items-center rounded leading-none":!0,"ring-primary-50 ring-inset focus-within-ring-2":!i,"hover-text-primary":!i,"cursor-pointer":!i,"cursor-default":i,flex:!o,hidden:o}),r,g({"h-s mr-xs text-right appearance-none bg-transparent font-medium":!0,"focus-outline-none cursor-pointer":!i,"cursor-default":i}),i,o,(t=>{const s=t.currentTarget,i=s.options[s.options.selectedIndex].value;a[r]=i,this.edit({json:JSON.stringify(e)})}),l.map((e=>n(Q||(Q=ee` <option value="${0}" ?selected="${0}"> ${0} </option> `),e,a[r]===e,this.t(e))))))),this.renderTemplateOrSlot("fields:after"))}__renderGoogleAnalytics(e){const{lang:t,ns:s}=this,i=e.analytics_config,o=i.google_tag,a=i.google_analytics,r=!this.in("idle")||this.disabledSelector.matches("google-analytics",!0),l=this.readonlySelector.matches("google-analytics",!0);return n(X||(X=ee` <div data-testid="google-analytics"> ${0} <x-group frame> <span class="${0}" slot="header">Google Analytics</span> <foxy-i18n class="block bg-error-10 text-error font-medium rounded-t p-m" infer="" key="ga_deprecation_notice"> </foxy-i18n> <div class="p-m space-y-m"> <vaadin-text-field data-testid="google-analytics-field" style="--lumo-border-radius:var(--lumo-border-radius-s)" class="w-full" label="${0}" placeholder="UA-1234567-1" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> <x-checkbox data-testid="google-analytics-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="ga_include_on_site" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="ga_include_on_site_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("google-analytics:before"),r?"text-disabled":"",this.t("ga_account_id"),this.t("ga_account_id_explainer"),y(a.account_id),r,l,(e=>"Enter"===e.key&&this.submit()),(t=>{a.account_id=t.currentTarget.value,a.usage=a.account_id?"required":"none",i.usage=a.account_id||o.account_id?"required":"none",this.edit({json:JSON.stringify(e)})}),r,l,a.include_on_site,(t=>{a.include_on_site=t.detail,this.edit({json:JSON.stringify(e)})}),t,s,r?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("google-analytics:after"))}__renderGoogleTag(e){const t=e.analytics_config,s=t.google_tag,i=t.google_analytics,o=!this.in("idle")||this.disabledSelector.matches("google-tag",!0),a=this.readonlySelector.matches("google-tag",!0);return n(Y||(Y=ee` <div data-testid="google-tag"> ${0} <x-group frame> <span class="${0}" slot="header">Google Tag</span> <div class="p-m space-y-m"> <vaadin-text-field data-testid="google-tag-account-id" style="--lumo-border-radius:var(--lumo-border-radius-s)" class="w-full" label="${0}" placeholder="G-123456789" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> <vaadin-text-field data-testid="google-tag-send-to" style="--lumo-border-radius:var(--lumo-border-radius-s)" class="w-full" label="${0}" placeholder="AW-123456789/sABDCLqU3K2BEJb8cxDE" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> <p class="text-xs text-secondary"> <foxy-i18n infer="" key="gt_usage_notice"></foxy-i18n> <a target="_blank" class="cursor-pointer group text-primary rounded-s font-medium focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://wiki.foxycart.com/v/2.0/analytics#google_tag_ga4_google_ads" rel="nofollow noreferrer noopener"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="gt_docs_link"> </foxy-i18n> </a> </p> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("google-tag:before"),o?"text-disabled":"",this.t("gt_account_id"),this.t("gt_account_id_explainer"),y(s.account_id),o,a,(e=>"Enter"===e.key&&this.submit()),(o=>{s.account_id=o.currentTarget.value,s.usage=s.account_id?"required":"none",t.usage=s.account_id||i.account_id?"required":"none",this.edit({json:JSON.stringify(e)})}),this.t("gt_send_to"),this.t("gt_send_to_explainer"),y(s.send_to),o,a,(e=>"Enter"===e.key&&this.submit()),(o=>{s.send_to=o.currentTarget.value,s.usage=s.account_id?"required":"none",t.usage=s.account_id||i.account_id?"required":"none",this.edit({json:JSON.stringify(e)})}),this.renderTemplateOrSlot("google-tag:after"))}__renderTroubleshooting(e){const{lang:t,ns:s}=this,i=e.debug,o=!this.in("idle")||this.disabledSelector.matches("troubleshooting",!0),a=this.readonlySelector.matches("troubleshooting",!0);return n(Z||(Z=ee` <div data-testid="troubleshooting"> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="troubleshooting" ns="${0}"> </foxy-i18n> <div class="p-m space-y-m"> <x-checkbox data-testid="troubleshooting-check" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="troubleshooting_debug" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s ${0}" lang="${0}" key="troubleshooting_debug_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("troubleshooting:before"),o?"text-disabled":"",t,s,o,a,"required"===i.usage,(t=>{i.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,o?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("troubleshooting:after"))}}customElements.define("foxy-template-config-form",se);export{se as TemplateConfigForm};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"line_1": "{{
|
|
3
|
-
"line_1_plural": "{{ count }} items • {{ amount, price }}",
|
|
4
|
-
"line_1_approximate": "At least 20 items • {{ amount, price }}",
|
|
2
|
+
"line_1": "ID {{ id }} • {{ amount, price }}",
|
|
5
3
|
"line_2_one": "{{ name }}",
|
|
6
4
|
"line_2_many": "{{ name }} + more",
|
|
7
5
|
"line_2_empty": "Empty cart",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"receipt-continue-url": {
|
|
147
147
|
"label": "Return URL",
|
|
148
148
|
"placeholder": "https://example.com/thank-you",
|
|
149
|
-
"helper_text": "By default,
|
|
149
|
+
"helper_text": "By default, the continue button on the receipt sends the customer to the store domain after completing a purchase. Instead, you can set a specific URL here.",
|
|
150
150
|
"v8n_too_long": "Please use a URL that is 300 characters or less"
|
|
151
151
|
},
|
|
152
152
|
"app-session-time": {
|
|
@@ -24,6 +24,7 @@ export declare class AdminSubscriptionCard extends Base<Data> {
|
|
|
24
24
|
private readonly __defaultTemplateSetLoaderId;
|
|
25
25
|
private readonly __localeCodesHelperLoaderId;
|
|
26
26
|
private readonly __templateSetLoaderId;
|
|
27
|
+
private readonly __customerLoaderId;
|
|
27
28
|
private readonly __itemsLoaderId;
|
|
28
29
|
private readonly __storeLoaderId;
|
|
29
30
|
renderBody(): TemplateResult;
|
|
@@ -32,12 +33,14 @@ export declare class AdminSubscriptionCard extends Base<Data> {
|
|
|
32
33
|
private get __defaultTemplateSetHref();
|
|
33
34
|
private get __localeCodesHelperHref();
|
|
34
35
|
private get __templateSetHref();
|
|
36
|
+
private get __customerHref();
|
|
35
37
|
private get __itemsHref();
|
|
36
38
|
private get __storeHref();
|
|
37
39
|
private get __transactionTemplate();
|
|
38
40
|
private get __defaultTemplateSet();
|
|
39
41
|
private get __localeCodesHelper();
|
|
40
42
|
private get __templateSet();
|
|
43
|
+
private get __customer();
|
|
41
44
|
private get __items();
|
|
42
45
|
private get __store();
|
|
43
46
|
private get __currencyDisplay();
|
|
@@ -26,6 +26,7 @@ export class AdminSubscriptionCard extends Base {
|
|
|
26
26
|
this.__defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';
|
|
27
27
|
this.__localeCodesHelperLoaderId = 'localeCodesLoader';
|
|
28
28
|
this.__templateSetLoaderId = 'templateSetLoader';
|
|
29
|
+
this.__customerLoaderId = 'customerLoader';
|
|
29
30
|
this.__itemsLoaderId = 'itemsLoader';
|
|
30
31
|
this.__storeLoaderId = 'storeLoader';
|
|
31
32
|
}
|
|
@@ -38,6 +39,7 @@ export class AdminSubscriptionCard extends Base {
|
|
|
38
39
|
renderBody() {
|
|
39
40
|
var _a;
|
|
40
41
|
const isFailed = !!((_a = this.data) === null || _a === void 0 ? void 0 : _a.first_failed_transaction_date);
|
|
42
|
+
const customer = this.__customer;
|
|
41
43
|
const cart = this.__transactionTemplate;
|
|
42
44
|
const priceKey = this.__priceKey;
|
|
43
45
|
const priceOptions = this.__priceOptions;
|
|
@@ -82,6 +84,15 @@ export class AdminSubscriptionCard extends Base {
|
|
|
82
84
|
>
|
|
83
85
|
</foxy-nucleon>
|
|
84
86
|
|
|
87
|
+
<foxy-nucleon
|
|
88
|
+
class="hidden"
|
|
89
|
+
infer=""
|
|
90
|
+
href=${ifDefined(this.__customerHref)}
|
|
91
|
+
id=${this.__customerLoaderId}
|
|
92
|
+
@update=${() => this.requestUpdate()}
|
|
93
|
+
>
|
|
94
|
+
</foxy-nucleon>
|
|
95
|
+
|
|
85
96
|
<foxy-nucleon
|
|
86
97
|
class="hidden"
|
|
87
98
|
infer=""
|
|
@@ -120,13 +131,18 @@ export class AdminSubscriptionCard extends Base {
|
|
|
120
131
|
: html `​`}
|
|
121
132
|
</div>
|
|
122
133
|
|
|
123
|
-
<div class="text-tertiary truncate text-s"
|
|
134
|
+
<div class="text-tertiary truncate text-s">
|
|
135
|
+
${customer === null || customer === void 0 ? void 0 : customer.first_name} ${customer === null || customer === void 0 ? void 0 : customer.last_name} (${cart === null || cart === void 0 ? void 0 : cart.customer_email})
|
|
136
|
+
</div>
|
|
124
137
|
</div>
|
|
125
138
|
`;
|
|
126
139
|
}
|
|
127
140
|
get isBodyReady() {
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
return (super.isBodyReady &&
|
|
142
|
+
!!this.__items &&
|
|
143
|
+
!!this.__currencyCode &&
|
|
144
|
+
!!this.__currencyDisplay &&
|
|
145
|
+
!!this.__customer);
|
|
130
146
|
}
|
|
131
147
|
get __transactionTemplateHref() {
|
|
132
148
|
var _a, _b;
|
|
@@ -164,6 +180,12 @@ export class AdminSubscriptionCard extends Base {
|
|
|
164
180
|
if (!(cart === null || cart === void 0 ? void 0 : cart.currency_code))
|
|
165
181
|
return (cart === null || cart === void 0 ? void 0 : cart.template_set_uri) || void 0;
|
|
166
182
|
}
|
|
183
|
+
get __customerHref() {
|
|
184
|
+
var _a, _b, _c, _d;
|
|
185
|
+
if ('fx:customer' in ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._embedded) !== null && _b !== void 0 ? _b : {}))
|
|
186
|
+
return;
|
|
187
|
+
return (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c._links['fx:customer']) === null || _d === void 0 ? void 0 : _d.href;
|
|
188
|
+
}
|
|
167
189
|
get __itemsHref() {
|
|
168
190
|
const cart = this.__transactionTemplate;
|
|
169
191
|
if (!cart)
|
|
@@ -205,6 +227,17 @@ export class AdminSubscriptionCard extends Base {
|
|
|
205
227
|
const selector = `#${this.__templateSetLoaderId}`;
|
|
206
228
|
return (_b = (_a = this.renderRoot.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : null;
|
|
207
229
|
}
|
|
230
|
+
get __customer() {
|
|
231
|
+
var _a, _b;
|
|
232
|
+
const data = this.data;
|
|
233
|
+
if (data && '_embedded' in data && 'fx:customer' in data._embedded) {
|
|
234
|
+
return data._embedded['fx:customer'];
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
const selector = `#${this.__customerLoaderId}`;
|
|
238
|
+
return (_b = (_a = this.renderRoot.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : null;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
208
241
|
get __items() {
|
|
209
242
|
const cart = this.__transactionTemplate;
|
|
210
243
|
if (cart && '_embedded' in cart && 'fx:items' in cart._embedded) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminSubscriptionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,IAAU;IAArD;;QAQE;;;;WAIG;QACH,gBAAW,GAAkB,IAAI,CAAC;QAEjB,kCAA6B,GAAG,2BAA2B,CAAC;QAE5D,iCAA4B,GAAG,0BAA0B,CAAC;QAE1D,gCAA2B,GAAG,mBAAmB,CAAC;QAElD,0BAAqB,GAAG,mBAAmB,CAAC;QAE5C,oBAAe,GAAG,aAAa,CAAC;QAEhC,oBAAe,GAAG,aAAa,CAAC;IA0SnD,CAAC;IAlUC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE;SAC3C,CAAC;IACJ,CAAC;IAqBD,UAAU;;QACR,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,6BAA6B,CAAA,CAAC;QAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,CAAC;QAExC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC;QAC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I,SAAS;YAAE,OAAO,SAAS,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACvF,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'admin-subscription-card';\nconst Base = ConfigurableMixin(TranslatableMixin(InternalCard, NS));\n\n/**\n * Card element representing a subscription (`fx:subscription`).\n * Admin-only.\n *\n * @element foxy-admin-subscription-card\n * @since 1.21.0\n */\nexport class AdminSubscriptionCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /**\n * URL of the `fx:locale_codes` property helper.\n * This will be used to determine the currency code for subscriptions that link to a\n * transaction template without the code.\n */\n localeCodes: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __itemsLoaderId = 'itemsLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n renderBody(): TemplateResult {\n const isFailed = !!this.data?.first_failed_transaction_date;\n const cart = this.__transactionTemplate;\n\n const priceKey = this.__priceKey;\n const priceOptions = this.__priceOptions;\n const summaryOptions = this.__summaryOptions;\n const summaryKey = this.__summaryKey;\n const statusKey = this.__statusKey;\n const statusOptions = this.__statusOptions;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__itemsHref)}\n id=${this.__itemsLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"text-left leading-s text-tertiary\">\n <div class=\"flex items-center space-x-s\">\n <span class=\"block flex-1 font-medium text-body truncate\">\n ${summaryOptions && summaryKey\n ? html`<foxy-i18n infer=\"\" key=${summaryKey} .options=${summaryOptions}></foxy-i18n>`\n : html`​`}\n </span>\n <span class=\"text-s\">\n ${priceOptions && priceKey\n ? html`<foxy-i18n infer=\"\" key=${priceKey} .options=${priceOptions}></foxy-i18n>`\n : html`​`}\n </span>\n </div>\n\n <div class=\"truncate text-s ${isFailed ? 'text-error' : 'text-secondary'}\">\n ${statusOptions && statusKey\n ? html`<foxy-i18n infer=\"\" key=${statusKey} .options=${statusOptions}></foxy-i18n>`\n : html`​`}\n </div>\n\n <div class=\"text-tertiary truncate text-s\">${cart?.customer_email}​</div>\n </div>\n `;\n }\n\n get isBodyReady(): boolean {\n const isLoaded = !!this.__items && !!this.__currencyCode && !!this.__currencyDisplay;\n return super.isBodyReady && isLoaded;\n }\n\n private get __transactionTemplateHref() {\n const data = this.data;\n\n if (!data) return;\n if ('_embedded' in data && 'fx:transaction_template' in data._embedded) return;\n\n const url = new URL(this.data?._links['fx:transaction_template'].href ?? '');\n url.searchParams.set('zoom', 'items');\n return url.toString();\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = this.__transactionTemplate?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __templateSetHref() {\n const cart = this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __itemsHref() {\n const cart = this.__transactionTemplate;\n\n if (!cart) return;\n if ('_embedded' in cart && 'fx:items' in cart._embedded) return;\n\n const url = new URL(cart._links['fx:items'].href);\n url.searchParams.set('limit', '1');\n return url.toString();\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __transactionTemplate() {\n const data = this.data;\n\n if (data && '_embedded' in data && 'fx:transaction_template' in data._embedded) {\n type Cart = Resource<Rels.TransactionTemplate>;\n type CartWithItems = Resource<Rels.TransactionTemplate, { zoom: 'items' }>;\n return data._embedded['fx:transaction_template'] as Cart | CartWithItems;\n } else {\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate, { zoom: 'items' }>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __items() {\n type Cart = Resource<Rels.TransactionTemplate>;\n type CartWithItems = Resource<Rels.TransactionTemplate, { zoom: 'items' }>;\n\n const cart = this.__transactionTemplate as Cart | CartWithItems | null;\n\n if (cart && '_embedded' in cart && 'fx:items' in cart._embedded) {\n const items = cart._embedded['fx:items'];\n\n return {\n array: items,\n count: items.length,\n isApproximateCount: items.length === 20,\n };\n }\n\n type Loader = NucleonElement<Resource<Rels.Items>>;\n const loader = this.renderRoot.querySelector<Loader>(`#${this.__itemsLoaderId}`);\n if (!loader?.data) return null;\n\n return {\n array: loader.data._embedded['fx:items'],\n count: loader.data.total_items,\n isApproximateCount: false,\n };\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __currencyDisplay() {\n const useCode = this.__store?.use_international_currency_symbol;\n\n if (useCode === true) return 'code';\n if (useCode === false) return 'symbol';\n }\n\n private get __summaryOptions() {\n const { array, count } = this.__items ?? {};\n if (array && count) return { firstItem: array[0], count, countMinus1: count - 1 };\n }\n\n private get __summaryKey() {\n const items = this.__items;\n if (items) return items.isApproximateCount ? 'summary_approximate' : 'summary';\n }\n\n private get __statusOptions() {\n const data = this.data;\n\n if (data === null) return;\n if (data.first_failed_transaction_date) return { date: data.first_failed_transaction_date };\n if (data.end_date) return { date: data.end_date };\n if (data.is_active === false) return {};\n if (new Date(data.start_date) > new Date()) return { date: data.start_date };\n\n return { date: data.next_transaction_date };\n }\n\n private get __currencyCode() {\n const cart = this.__transactionTemplate;\n\n if (cart?.currency_code) {\n return cart.currency_code as string;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1];\n }\n }\n\n private get __priceOptions() {\n const currencyDisplay = this.__currencyDisplay;\n if (currencyDisplay === undefined) return;\n\n const currencyCode = this.__currencyCode;\n if (currencyCode === undefined) return;\n\n const totalOrder = this.__transactionTemplate?.total_order;\n if (totalOrder === undefined) return;\n\n const frequency = this.data?.frequency;\n if (frequency === undefined) return;\n\n return {\n ...parseFrequency(frequency),\n amount: `${totalOrder} ${currencyCode}`,\n currencyDisplay,\n };\n }\n\n private get __statusKey() {\n const data = this.data;\n\n if (data === null) return;\n if (data.first_failed_transaction_date) return 'subscription_failed';\n if (data.end_date) {\n const hasEnded = new Date(data.end_date).getTime() > Date.now();\n return hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n }\n\n if (data.is_active === false) return 'subscription_inactive';\n if (new Date(data.start_date) > new Date()) return 'subscription_will_be_active';\n\n return 'subscription_active';\n }\n\n private get __priceKey() {\n const frequency = this.data?.frequency;\n if (frequency) return `price_${frequency === '.5m' ? 'twice_a_month' : 'recurring'}`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AdminSubscriptionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,c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rB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO;QAC1B,IAAI,IAAI,CAAC,6BAA6B;YAAE,OAAO,qBAAqB,CAAC;QACrE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAChE,OAAO,QAAQ,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,wBAAwB,CAAC;SAC/E;QAED,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK;YAAE,OAAO,uBAAuB,CAAC;QAC7D,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,IAAI,EAAE;YAAE,OAAO,6BAA6B,CAAC;QAEjF,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED,IAAY,UAAU;;QACpB,MAAM,SAAS,SAAG,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAC;QACvC,IAAI,SAAS;YAAE,OAAO,SAAS,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACvF,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'admin-subscription-card';\nconst Base = ConfigurableMixin(TranslatableMixin(InternalCard, NS));\n\n/**\n * Card element representing a subscription (`fx:subscription`).\n * Admin-only.\n *\n * @element foxy-admin-subscription-card\n * @since 1.21.0\n */\nexport class AdminSubscriptionCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /**\n * URL of the `fx:locale_codes` property helper.\n * This will be used to determine the currency code for subscriptions that link to a\n * transaction template without the code.\n */\n localeCodes: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __customerLoaderId = 'customerLoader';\n\n private readonly __itemsLoaderId = 'itemsLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n renderBody(): TemplateResult {\n const isFailed = !!this.data?.first_failed_transaction_date;\n const customer = this.__customer;\n const cart = this.__transactionTemplate;\n\n const priceKey = this.__priceKey;\n const priceOptions = this.__priceOptions;\n const summaryOptions = this.__summaryOptions;\n const summaryKey = this.__summaryKey;\n const statusKey = this.__statusKey;\n const statusOptions = this.__statusOptions;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__customerHref)}\n id=${this.__customerLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__itemsHref)}\n id=${this.__itemsLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"text-left leading-s text-tertiary\">\n <div class=\"flex items-center space-x-s\">\n <span class=\"block flex-1 font-medium text-body truncate\">\n ${summaryOptions && summaryKey\n ? html`<foxy-i18n infer=\"\" key=${summaryKey} .options=${summaryOptions}></foxy-i18n>`\n : html`​`}\n </span>\n <span class=\"text-s\">\n ${priceOptions && priceKey\n ? html`<foxy-i18n infer=\"\" key=${priceKey} .options=${priceOptions}></foxy-i18n>`\n : html`​`}\n </span>\n </div>\n\n <div class=\"truncate text-s ${isFailed ? 'text-error' : 'text-secondary'}\">\n ${statusOptions && statusKey\n ? html`<foxy-i18n infer=\"\" key=${statusKey} .options=${statusOptions}></foxy-i18n>`\n : html`​`}\n </div>\n\n <div class=\"text-tertiary truncate text-s\">\n ${customer?.first_name} ${customer?.last_name} (${cart?.customer_email})\n </div>\n </div>\n `;\n }\n\n get isBodyReady(): boolean {\n return (\n super.isBodyReady &&\n !!this.__items &&\n !!this.__currencyCode &&\n !!this.__currencyDisplay &&\n !!this.__customer\n );\n }\n\n private get __transactionTemplateHref() {\n const data = this.data;\n\n if (!data) return;\n if ('_embedded' in data && 'fx:transaction_template' in data._embedded) return;\n\n const url = new URL(this.data?._links['fx:transaction_template'].href ?? '');\n url.searchParams.set('zoom', 'items');\n return url.toString();\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = this.__transactionTemplate?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __templateSetHref() {\n const cart = this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __customerHref() {\n if ('fx:customer' in (this.data?._embedded ?? {})) return;\n return this.data?._links['fx:customer']?.href;\n }\n\n private get __itemsHref() {\n const cart = this.__transactionTemplate;\n\n if (!cart) return;\n if ('_embedded' in cart && 'fx:items' in cart._embedded) return;\n\n const url = new URL(cart._links['fx:items'].href);\n url.searchParams.set('limit', '1');\n return url.toString();\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __transactionTemplate() {\n const data = this.data;\n\n if (data && '_embedded' in data && 'fx:transaction_template' in data._embedded) {\n type Cart = Resource<Rels.TransactionTemplate>;\n type CartWithItems = Resource<Rels.TransactionTemplate, { zoom: 'items' }>;\n return data._embedded['fx:transaction_template'] as Cart | CartWithItems;\n } else {\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate, { zoom: 'items' }>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __customer() {\n const data = this.data;\n\n if (data && '_embedded' in data && 'fx:customer' in data._embedded) {\n return data._embedded['fx:customer'] as Resource<Rels.Customer>;\n } else {\n type Loader = NucleonElement<Resource<Rels.Customer>>;\n const selector = `#${this.__customerLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n }\n\n private get __items() {\n type Cart = Resource<Rels.TransactionTemplate>;\n type CartWithItems = Resource<Rels.TransactionTemplate, { zoom: 'items' }>;\n\n const cart = this.__transactionTemplate as Cart | CartWithItems | null;\n\n if (cart && '_embedded' in cart && 'fx:items' in cart._embedded) {\n const items = cart._embedded['fx:items'];\n\n return {\n array: items,\n count: items.length,\n isApproximateCount: items.length === 20,\n };\n }\n\n type Loader = NucleonElement<Resource<Rels.Items>>;\n const loader = this.renderRoot.querySelector<Loader>(`#${this.__itemsLoaderId}`);\n if (!loader?.data) return null;\n\n return {\n array: loader.data._embedded['fx:items'],\n count: loader.data.total_items,\n isApproximateCount: false,\n };\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __currencyDisplay() {\n const useCode = this.__store?.use_international_currency_symbol;\n\n if (useCode === true) return 'code';\n if (useCode === false) return 'symbol';\n }\n\n private get __summaryOptions() {\n const { array, count } = this.__items ?? {};\n if (array && count) return { firstItem: array[0], count, countMinus1: count - 1 };\n }\n\n private get __summaryKey() {\n const items = this.__items;\n if (items) return items.isApproximateCount ? 'summary_approximate' : 'summary';\n }\n\n private get __statusOptions() {\n const data = this.data;\n\n if (data === null) return;\n if (data.first_failed_transaction_date) return { date: data.first_failed_transaction_date };\n if (data.end_date) return { date: data.end_date };\n if (data.is_active === false) return {};\n if (new Date(data.start_date) > new Date()) return { date: data.start_date };\n\n return { date: data.next_transaction_date };\n }\n\n private get __currencyCode() {\n const cart = this.__transactionTemplate;\n\n if (cart?.currency_code) {\n return cart.currency_code as string;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1];\n }\n }\n\n private get __priceOptions() {\n const currencyDisplay = this.__currencyDisplay;\n if (currencyDisplay === undefined) return;\n\n const currencyCode = this.__currencyCode;\n if (currencyCode === undefined) return;\n\n const totalOrder = this.__transactionTemplate?.total_order;\n if (totalOrder === undefined) return;\n\n const frequency = this.data?.frequency;\n if (frequency === undefined) return;\n\n return {\n ...parseFrequency(frequency),\n amount: `${totalOrder} ${currencyCode}`,\n currencyDisplay,\n };\n }\n\n private get __statusKey() {\n const data = this.data;\n\n if (data === null) return;\n if (data.first_failed_transaction_date) return 'subscription_failed';\n if (data.end_date) {\n const hasEnded = new Date(data.end_date).getTime() > Date.now();\n return hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n }\n\n if (data.is_active === false) return 'subscription_inactive';\n if (new Date(data.start_date) > new Date()) return 'subscription_will_be_active';\n\n return 'subscription_active';\n }\n\n private get __priceKey() {\n const frequency = this.data?.frequency;\n if (frequency) return `price_${frequency === '.5m' ? 'twice_a_month' : 'recurring'}`;\n }\n}\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Resource } from '@foxy.io/sdk/core';
|
|
2
2
|
import type { Rels } from '@foxy.io/sdk/backend';
|
|
3
3
|
export declare type Data = Resource<Rels.Subscription> | Resource<Rels.Subscription, {
|
|
4
|
-
zoom: '
|
|
4
|
+
zoom: ['customer'];
|
|
5
5
|
}> | Resource<Rels.Subscription, {
|
|
6
|
-
zoom:
|
|
6
|
+
zoom: ['transaction_template', 'customer'];
|
|
7
|
+
}> | Resource<Rels.Subscription, {
|
|
8
|
+
zoom: [{
|
|
7
9
|
transaction_template: 'items';
|
|
8
|
-
};
|
|
10
|
+
}, 'customer'];
|
|
9
11
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data =\n | Resource<Rels.Subscription>\n | Resource<Rels.Subscription, { zoom: 'transaction_template' }>\n | Resource<Rels.Subscription, { zoom: { transaction_template: 'items' } }>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data =\n | Resource<Rels.Subscription>\n | Resource<Rels.Subscription, { zoom: ['customer'] }>\n | Resource<Rels.Subscription, { zoom: ['transaction_template', 'customer'] }>\n | Resource<Rels.Subscription, { zoom: [{ transaction_template: 'items' }, 'customer'] }>;\n"]}
|
|
@@ -39,7 +39,6 @@ export declare class CartCard extends Base<Data> {
|
|
|
39
39
|
private get __currencyDisplay();
|
|
40
40
|
private get __currencyCode();
|
|
41
41
|
private get __line1Options();
|
|
42
|
-
private get __line1Key();
|
|
43
42
|
private get __line2Options();
|
|
44
43
|
private get __line2Key();
|
|
45
44
|
private get __statusOptions();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getResourceId } from '@foxy.io/sdk/core';
|
|
1
2
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
2
3
|
import { ConfigurableMixin } from "../../../mixins/configurable.js";
|
|
3
4
|
import { InternalCard } from "../../internal/InternalCard/InternalCard.js";
|
|
@@ -35,7 +36,6 @@ export class CartCard extends Base {
|
|
|
35
36
|
renderBody() {
|
|
36
37
|
const statusOptions = this.__statusOptions;
|
|
37
38
|
const line1Options = this.__line1Options;
|
|
38
|
-
const line1Key = this.__line1Key;
|
|
39
39
|
const line2Options = this.__line2Options;
|
|
40
40
|
const line2Key = this.__line2Key;
|
|
41
41
|
const data = this.data;
|
|
@@ -88,8 +88,8 @@ export class CartCard extends Base {
|
|
|
88
88
|
<div class="text-left leading-s">
|
|
89
89
|
<div class="flex items-center space-x-s">
|
|
90
90
|
<span class="flex-1 font-medium text-body truncate">
|
|
91
|
-
${line1Options
|
|
92
|
-
? html `<foxy-i18n infer="" key
|
|
91
|
+
${line1Options
|
|
92
|
+
? html `<foxy-i18n infer="" key="line_1" .options=${line1Options}></foxy-i18n>`
|
|
93
93
|
: html `​`}
|
|
94
94
|
</span>
|
|
95
95
|
<span class="text-s text-tertiary">
|
|
@@ -222,7 +222,7 @@ export class CartCard extends Base {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
get __line1Options() {
|
|
225
|
-
var _a, _b;
|
|
225
|
+
var _a, _b, _c;
|
|
226
226
|
const totalOrder = (_a = this.data) === null || _a === void 0 ? void 0 : _a.total_order;
|
|
227
227
|
if (totalOrder === undefined)
|
|
228
228
|
return;
|
|
@@ -235,12 +235,15 @@ export class CartCard extends Base {
|
|
|
235
235
|
const count = (_b = this.__items) === null || _b === void 0 ? void 0 : _b.count;
|
|
236
236
|
if (count === undefined)
|
|
237
237
|
return;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
const href = (_c = this.data) === null || _c === void 0 ? void 0 : _c._links['self'].href;
|
|
239
|
+
if (href === undefined)
|
|
240
|
+
return;
|
|
241
|
+
return {
|
|
242
|
+
currencyDisplay,
|
|
243
|
+
amount: `${totalOrder} ${currencyCode}`,
|
|
244
|
+
count,
|
|
245
|
+
id: getResourceId(href),
|
|
246
|
+
};
|
|
244
247
|
}
|
|
245
248
|
get __line2Options() {
|
|
246
249
|
var _a;
|