@foxy.io/elements 1.14.0-beta.8 → 1.14.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import"./shared-60126eee.js";import"./shared-46ee137f.js";import"./shared-bb824ab4.js";import{C as e,a as t}from"./shared-31d03530.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{_ as s,h as i}from"./shared-63eaded9.js";import{l as n}from"./shared-218ba06e.js";import{C as o}from"./shared-007c4e34.js";import{C as r}from"./shared-593f7e2c.js";import{N as a}from"./shared-44cfc617.js";import{T as l,a as d,S as c,R as u}from"./shared-d01035c5.js";import{c as h}from"./shared-4e709717.js";import{i as p}from"./shared-6d45a07b.js";import{G as g}from"./shared-da787055.js";import{l as f}from"./shared-07134f93.js";import"./shared-ff79f3f9.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-ec861f31.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let y,x,_,b,m,$=e=>e;const v=r(l(d(a)));class k extends v{constructor(){super(...arguments),this.disabled=!1,this.readonly=!1,this.regions=[],this.region="",this.name="",this.code=""}static get properties(){return s(s({},super.properties),{},{disabled:{type:Boolean},readonly:{type:Boolean},regions:{type:Array},region:{type:String},name:{type:String},code:{type:String}})}render(){var e,t;return i(y||(y=$` <div class="${0}"> <div class="h-m flex justify-between items-center border-b border-contrast-10"> <div class="ml-m"> <span>${0}</span> ${0} </div> <button 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 class="flex flex-wrap p-xs"> ${0} <div 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}" @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?i(x||(x=$`<span class="text-secondary">${0}</span>`),this.code):"",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 n=null===(s=null===(t=this.data)||void 0===t?void 0:t.values[e])||void 0===s?void 0:s.default;return i(_||(_=$` <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 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> `),n||e,n?i(b||(b=$`<span class="text-secondary">${0}</span>`),e):"",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.region,this.disabled,(e=>{"Enter"===e.key&&this.region&&this.__addRegion()}),(e=>{const t=e.currentTarget;this.region=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.region,"bg-success-10 text-success cursor-pointer":!!this.region,"hover-bg-success hover-text-success-contrast":!!this.region,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.region}),!this.region,this.__addRegion,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>i(m||(m=$`<option value="${0}">${0}</option>`),e.code,e.default))))}__addRegion(){this.regions=[...new Set([...this.regions,this.region])],this.region="",this.dispatchEvent(new CustomEvent("update:regions"))}}let S,w,j,O=e=>e;const T=c(l(d(a)));class q extends T{constructor(){super(...arguments),this.countries={},this.disabled=!1,this.readonly=!1,this.regions="",this.country=""}static get scopedElements(){return{"x-country-card":k,"iron-icon":customElements.get("iron-icon")}}static get properties(){return s(s({},super.properties),{},{countries:{type:Object},disabled:{type:Boolean},readonly:{type:Boolean},regions:{type:String},country:{type:String}})}render(){var e,t;return i(S||(S=O` <div> <div class="space-y-s"> ${0} <div 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 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((([e,t])=>{var n,o;let r;try{const t=new URL(this.regions);t.searchParams.set("country_code",e),r=t.toString()}catch(e){r=""}return i(w||(w=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("*"===t?[]:t),e,p(null===(o=null===(n=this.data)||void 0===n?void 0:n.values[e])||void 0===o?void 0:o.default),r,this.lang,this.ns,this.disabled,this.readonly,(t=>{const i=s({},this.countries),n=t.currentTarget.regions;i[e]=n.length?n:"*",this.countries=i,this.dispatchEvent(new CustomEvent("update:countries"))}),(()=>{const t=s({},this.countries);delete t[e],this.countries=t,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.country,this.disabled,this.readonly,(e=>{"Enter"===e.key&&this.country&&this.__addCountry()}),(e=>{const t=e.currentTarget;this.country=t.value}),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.country,"bg-success-10 text-success cursor-pointer":!!this.country,"hover-bg-success hover-text-success-contrast":!!this.country,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.country}),!this.country||this.disabled,this.__addCountry,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>i(j||(j=O`<option value="${0}">${0}</option>`),e.cc2,e.default))))}__addCountry(){this.countries=s(s({},this.countries),{},{[this.country]:"*"}),this.country="",this.dispatchEvent(new CustomEvent("update:countries"))}}let F,N,J,E,C,H,I,V,z,A,D,R,B,G,L,M,P,U,W,Y,K,Q,X,Z,ee,te,se,ie=e=>e;const ne=c(u(r(l(d(a,"template-config-form")))));class oe extends ne{constructor(){super(...arguments),this.templates={},this.countries="",this.regions="",this.__addHiddenFieldInputValue=""}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-countries-list":q,"x-checkbox":o,"x-choice":e,"x-group":g}}static get properties(){return s(s({},super.properties),{},{__addHiddenFieldInputValue:{attribute:!1},countries:{type:String},regions:{type:String}})}render(){var e,t;const s=this.hiddenControls,n=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},segment_io:{usage:"none",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 i(F||(F=ie` <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="${0}"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </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"),h({"space-y-l transition-opacity":!0,"opacity-50":!this.in("idle")}),s.matches("cart-type",!0)?"":this.__renderCartType(n),s.matches("foxycomplete",!0)?"":this.__renderFoxycomplete(n),s.matches("locations",!0)?"":this.__renderLocations(n),s.matches("hidden-fields",!0)?"":this.__renderHiddenFields(n),s.matches("cards",!0)?"":this.__renderCards(n),s.matches("checkout-type",!0)?"":this.__renderCheckoutType(n),s.matches("consent",!0)?"":this.__renderConsent(n),s.matches("fields",!0)?"":this.__renderFields(n),s.matches("google-analytics",!0)?"":this.__renderGoogleAnalytics(n),s.matches("segment-io",!0)?"":this.__renderSegmentIo(n),s.matches("troubleshooting",!0)?"":this.__renderTroubleshooting(n),s.matches("custom-config",!0)?"":this.__renderCustomConfig(n),s.matches("header",!0)?"":this.__renderHeader(n),s.matches("custom-fields",!0)?"":this.__renderCustomFields(n),s.matches("footer",!0)?"":this.__renderFooter(n),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(e){const{lang:t,ns:n}=this,o=["default","fullpage","custom"],r=this.disabledSelector.matches("cart-type",!0);return i(N||(N=ie` <div> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="cart_type" ns="${0}"> </foxy-i18n> <x-choice .value="${0}" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("cart-type:before"),r?"text-disabled":"",t,n,e.cart_type,o,r,this.readonlySelector.matches("cart-type",!0),(t=>{this.edit({json:JSON.stringify(s(s({},e),{},{cart_type:t.detail}))})}),o.map((e=>i(J||(J=ie` <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,t,e,n,r?"text-disabled":"text-secondary",t,e,n))),this.renderTemplateOrSlot("cart-type:after"))}__renderFoxycomplete(e){const{lang:n,ns:o}=this,r=this.disabledSelector.matches("foxycomplete",!0),a=this.readonlySelector.matches("foxycomplete",!0),l=["combobox","search","disabled"],d="none"===e.foxycomplete.usage?"disabled":e.foxycomplete.show_combobox?"combobox":"search",c=()=>i(E||(E=ie` <x-checkbox ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_country_flags" ns="${0}"></foxy-i18n> </x-checkbox> `),r,a,e.foxycomplete.show_flags,(t=>{const i=s(s({},e.foxycomplete),{},{show_flags:t.detail});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:i}))})}),n,o);return i(C||(C=ie` <div> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="foxycomplete" ns="${0}"> </foxy-i18n> <x-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 ?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"),r?"text-disabled":"",n,o,d,l,r,a,(i=>{if(!(i instanceof t))return;const n=s(s({},e.foxycomplete),{},{usage:"disabled"===i.detail?"none":"required",show_combobox:"combobox"===i.detail});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:n}))})}),l.map((e=>i(H||(H=ie` <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,n,e,o,r?"text-disabled":"text-secondary",n,e,o))),"combobox"!==d,["open","close"].map((t=>{const n="open"===t?"combobox_open":"combobox_close";return i(I||(I=ie` <vaadin-text-field label="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-field> `),this.t(`${t}_icon`),e.foxycomplete[n],r,a,(t=>{const i=t.currentTarget,o=s(s({},e.foxycomplete),{},{[n]:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:o}))})}))})),c(),"search"!==d,c(),r,a,"enabled"===e.postal_code_lookup.usage,(t=>{const i={usage:t.detail?"enabled":"none"};this.edit({json:JSON.stringify(s(s({},e),{},{postal_code_lookup:i}))})}),n,o,this.renderTemplateOrSlot("foxycomplete:after"))}__renderLocations(e){const{lang:t,ns:s}=this,n=e.location_filtering,o=this.disabledSelector.matches("locations",!0),r=this.readonlySelector.matches("locations",!0),a="blacklist"===n.shipping_filter_type?"block":"allow",l="both"===n.usage?"copy":"blacklist"===n.billing_filter_type?"block":"allow",d=()=>{if("both"===n.usage)n.billing_filter_type=n.shipping_filter_type,n.billing_filter_values=n.shipping_filter_values;else{const e=Object.keys(n.billing_filter_values).length>0,t=Object.keys(n.shipping_filter_values).length>0;n.usage=e||t?e&&!t?"billing":t&&!e?"shipping":"independent":"none"}};return i(V||(V=ie` ${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 .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 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 .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 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} `),this.renderTemplateOrSlot("locations:before"),o?"text-disabled":"",t,s,o?"text-disabled":"text-tertiary",t,s,["allow","block"],a,o,r,(t=>{"both"!==n.usage&&(n.usage="independent"),n.shipping_filter_type="block"===t.detail?"blacklist":"whitelist",d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,JSON.stringify(n.shipping_filter_values),this.regions,this.countries,a,t,s,o,r,(t=>{n.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,r,(t=>{"copy"===t.detail?n.usage="both":(n.usage="independent",n.billing_filter_type="block"===t.detail?"blacklist":"whitelist"),d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,t,s,JSON.stringify(n.billing_filter_values),this.regions,this.countries,l,t,s,o,r,"copy"===l,(t=>{n.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,n=[],o=[],r=e.cart_display_config,a=this.disabledSelector.matches("hidden-fields",!0),l=this.readonlySelector.matches("hidden-fields",!0);for(const e in r){if(!e.startsWith("show_"))continue;const t=e.substring(5);n.push(t),"required"!==r.usage||r[e]||o.push(t)}"required"===r.usage&&o.push(...r.hidden_product_options);const d=()=>{r.usage="required",n.includes(this.__addHiddenFieldInputValue)?r[`show_${this.__addHiddenFieldInputValue}`]=!1:r.hidden_product_options.includes(this.__addHiddenFieldInputValue)||r.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];return i(z||(z=ie` <div> ${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"> ${0} </div> <div 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}" @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"),a?"text-disabled":"",t,s,o.map((o=>i(A||(A=ie` <div class="${0}"> ${0} <button 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":a}),n.includes(o)?i(D||(D=ie`<foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n>`),t,o,s):i(R||(R=ie`<span>${0}</span>`),o),h({"w-xs h-xs rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!a,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!a,"cursor-default":a,flex:!l,hidden:l}),a,(()=>{"boolean"==typeof r[`show_${o}`]?r[`show_${o}`]=!0:r.hidden_product_options=r.hidden_product_options.filter((e=>e!==o)),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":o.length>0,flex:!l,hidden:l}),this.t("add_field"),f(this.__addHiddenFieldInputValue),a,(e=>"Enter"===e.key&&d()),(e=>{this.__addHiddenFieldInputValue=e.currentTarget.value}),n.filter((e=>!o.includes(e))).map((e=>i(B||(B=ie`<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":!this.__addHiddenFieldInputValue,"bg-success-10 text-success cursor-pointer":!!this.__addHiddenFieldInputValue,"hover-bg-success hover-text-success-contrast":!!this.__addHiddenFieldInputValue,"focus-outline-none focus-ring-2":!!this.__addHiddenFieldInputValue}),!this.__addHiddenFieldInputValue,d,this.renderTemplateOrSlot("hidden-fields:after"))}__renderCards(e){const{lang:t,ns:s}=this,o=this.disabledSelector.matches("cards",!0),r=this.readonlySelector.matches("cards",!0),a=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 i(G||(G=ie` <div> ${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 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 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,s,Object.entries(n).map((([t,s])=>{if(!c[t])return;const n=a.includes(t);return i(L||(L=ie` <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}" ?checked="${0}" @change="${0}"> </label> </div> `),h({"m-xs rounded":!0,"opacity-50 cursor-default":o,"cursor-pointer ring-primary-50 focus-within-ring-2":!o}),h({"overflow-hidden transition-colors flex rounded border":!0,"border-primary bg-primary-10 text-primary":n&&!r,"border-contrast bg-contrast-5 text-secondary":n&&r,"hover-text-body":n&&!o&&!r,"border-contrast-10":!n,"hover-border-primary":!n&&!o&&!r,"hover-text-primary":!n&&!o&&!r}),s,c[t],o,n,(s=>{if(r)return s.preventDefault();s.stopPropagation(),n?a.splice(a.indexOf(t),1):a.push(t),this.edit({json:JSON.stringify(e)})}))})),o||"new_cards_only"===e.csc_requirements,r,l,(t=>{e.csc_requirements=t.detail?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),t,s,o,r,d,(t=>{e.csc_requirements=t.detail?"new_cards_only":l?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),t,s,o?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("cards:after"))}__renderCheckoutType(e){const{lang:t,ns:s}=this,n=this.disabledSelector.matches("checkout-type",!0),o=this.readonlySelector.matches("checkout-type",!0);return i(M||(M=ie` <div> ${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 ?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"),n?"text-disabled":"",t,s,n,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)})}),n?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("checkout-type:after"))}__renderConsent(e){const{lang:t,ns:s}=this,n=e.tos_checkbox_settings,o=e.newsletter_subscribe,r=e.eu_secure_data_transfer_consent,a=this.disabledSelector.matches("consent",!0),l=this.readonlySelector.matches("consent",!0),d="margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))";return i(P||(P=ie` <div> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="consent" ns="${0}"> </foxy-i18n> <x-checkbox ?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 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 class="m-s" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="require_consent" ns="${0}"> </foxy-i18n> </x-checkbox> <x-checkbox class="m-s" ?disabled="${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 ?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 ?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"),a?"text-disabled":"",t,s,a,l,"required"===n.usage||"optional"===n.usage,(t=>{n.initial_state=t.detail?n.initial_state:"unchecked",n.is_hidden=!1,n.usage=t.detail?"required":"none",n.url=t.detail?n.url:"",this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,"none"===n.usage,this.t("location_url"),a,l,n.url,(t=>{n.url=t.currentTarget.value,this.edit({json:JSON.stringify(e)})}),a,"required"===n.usage,(t=>{n.usage=t.detail?"required":"optional",this.edit({json:JSON.stringify(e)})}),t,s,a,"checked"===n.initial_state,(t=>{n.initial_state=t.detail?"checked":"unchecked",this.edit({json:JSON.stringify(e)})}),t,s,d,a,l,"required"===o.usage,(t=>{o.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,d,a,l,"required"===r.usage,(t=>{r.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("consent:before"))}__renderFields(e){const{lang:t,ns:s}=this,n=this.disabledSelector.matches("fields",!0),o=this.readonlySelector.matches("fields",!0),r=e.custom_checkout_field_requirements;return i(U||(U=ie` <div> ${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 md-grid-cols-2" style="gap:1px"> ${0} <div class="bg-base hidden md-block"></div> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("fields:before"),n?"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((([a,l])=>i(W||(W=ie` <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 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":o,"text-disabled":n}),t,a.replace("billing_",""),s,h({"flex items-center text-right font-medium h-s px-s m-xs":o,hidden:!o}),this.t(l.find((e=>r[a]===e))),h({"px-s m-xs flex items-center rounded leading-none":!0,"ring-primary-50 ring-inset focus-within-ring-2":!n,"hover-text-primary":!n,"cursor-pointer":!n,"cursor-default":n,flex:!o,hidden:o}),h({"h-s mr-xs text-right appearance-none bg-transparent font-medium":!0,"focus-outline-none cursor-pointer":!n,"cursor-default":n}),n,o,(t=>{const s=t.currentTarget,i=s.options[s.options.selectedIndex].value;r[a]=i,this.edit({json:JSON.stringify(e)})}),l.map((e=>i(Y||(Y=ie` <option value="${0}" ?selected="${0}"> ${0} </option> `),e,r[a]===e,this.t(e))))))),this.renderTemplateOrSlot("fields:after"))}__renderGoogleAnalytics(e){const{lang:t,ns:s}=this,n=e.analytics_config,o=n.segment_io,r=n.google_analytics,a=this.disabledSelector.matches("google-analytics",!0),l=this.readonlySelector.matches("google-analytics",!0);return i(K||(K=ie` <div> ${0} <x-group frame> <span class="${0}" slot="header">Google Analytics</span> <div class="p-m space-y-m"> <vaadin-text-field 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 ?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"),a?"text-disabled":"",this.t("ga_account_id"),this.t("ga_account_id_explainer"),f(r.account_id),a,l,(e=>"Enter"===e.key&&this.submit()),(e=>{r.account_id=e.currentTarget.value,r.usage=r.account_id?"required":"none",n.usage=r.account_id||o.account_id?"required":"none"}),a,l,r.include_on_site,(t=>{r.include_on_site=t.detail,this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("google-analytics:after"))}__renderSegmentIo(e){const t=e.analytics_config,s=t.segment_io,n=t.google_analytics,o=this.disabledSelector.matches("segment-io",!0),r=this.readonlySelector.matches("segment-io",!0);return i(Q||(Q=ie` <div> ${0} <x-group frame> <span class="${0}" slot="header">Segment.io</span> <div class="p-m"> <vaadin-text-field class="w-full" label="${0}" placeholder="MY-WRITE-KEY" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("segment-io:before"),o?"text-disabled":"",this.t("sio_account_id"),this.t("sio_account_id_explainer"),f(s.account_id),o,r,(e=>"Enter"===e.key&&this.submit()),(e=>{s.account_id=e.currentTarget.value,s.usage=s.account_id?"required":"none",t.usage=n.account_id||s.account_id?"required":"none"}),this.renderTemplateOrSlot("segment-io:after"))}__renderTroubleshooting(e){const{lang:t,ns:s}=this,n=e.debug,o=this.disabledSelector.matches("troubleshooting",!0),r=this.readonlySelector.matches("troubleshooting",!0);return i(X||(X=ie` <div> ${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 ?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,r,"required"===n.usage,(t=>{n.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,o?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("troubleshooting:after"))}__renderCustomConfig(e){return i(Z||(Z=ie` <div> ${0} <vaadin-text-area class="w-full" label="${0}" placeholder='{ "key": "value" }' helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("custom-config:before"),this.t("custom_config"),this.t("custom_config_helper_text"),e.custom_config?JSON.stringify(e.custom_config,null,2):"",this.disabledSelector.matches("custom-config",!0),this.readonlySelector.matches("custom-config",!0),(t=>{const s=t.currentTarget;try{e.custom_config=s.value?JSON.parse(s.value):"",this.edit({json:JSON.stringify(e)}),s.invalid=!1}catch(e){s.invalid=!0}}),this.renderTemplateOrSlot("custom-config:after"))}__renderHeader(e){return i(ee||(ee=ie` <div> ${0} <vaadin-text-area class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.t("custom_header"),this.t("custom_header_helper_text"),e.custom_script_values.header,this.disabledSelector.matches("header",!0),this.readonlySelector.matches("header",!0),(t=>{const i=t.currentTarget,n=s(s({},e.custom_script_values),{},{header:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{custom_script_values:n}))})}),this.renderTemplateOrSlot("header:after"))}__renderCustomFields(e){return i(te||(te=ie` <div> ${0} <vaadin-text-area class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("custom-fields:before"),this.t("custom_fields"),this.t("custom_fields_helper_text"),e.custom_script_values.header,this.disabledSelector.matches("header",!0),this.readonlySelector.matches("header",!0),(t=>{const s=t.currentTarget.value;e.custom_script_values.checkout_fields=s,this.edit({json:JSON.stringify(e)})}),this.renderTemplateOrSlot("custom-fields:after"))}__renderFooter(e){return i(se||(se=ie` <div> ${0} <vaadin-text-area class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("footer:before"),this.t("custom_footer"),this.t("custom_footer_helper_text"),e.custom_script_values.footer,this.disabledSelector.matches("footer",!0),this.readonlySelector.matches("footer",!0),(t=>{const i=t.currentTarget,n=s(s({},e.custom_script_values),{},{footer:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{custom_script_values:n}))})}),this.renderTemplateOrSlot("footer:after"))}}customElements.define("foxy-template-config-form",oe);export{oe as TemplateConfigForm};
1
+ import"./shared-60126eee.js";import"./shared-46ee137f.js";import"./shared-bb824ab4.js";import{C as e,a as t}from"./shared-31d03530.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{_ as s,h as i}from"./shared-63eaded9.js";import{l as n}from"./shared-218ba06e.js";import{C as o}from"./shared-007c4e34.js";import{C as r}from"./shared-593f7e2c.js";import{N as a}from"./shared-44cfc617.js";import{T as l,a as d,S as c,R as u}from"./shared-d01035c5.js";import{c as h}from"./shared-4e709717.js";import{i as p}from"./shared-6d45a07b.js";import{G as g}from"./shared-da787055.js";import{l as f}from"./shared-07134f93.js";import"./shared-ff79f3f9.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-ec861f31.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let y,x,_,b,m,$=e=>e;const v=r(l(d(a)));class k extends v{constructor(){super(...arguments),this.disabled=!1,this.readonly=!1,this.regions=[],this.region="",this.name="",this.code=""}static get properties(){return s(s({},super.properties),{},{disabled:{type:Boolean},readonly:{type:Boolean},regions:{type:Array},region:{type:String},name:{type:String},code:{type:String}})}render(){var e,t;return i(y||(y=$` <div class="${0}"> <div class="h-m flex justify-between items-center border-b border-contrast-10"> <div class="ml-m"> <span>${0}</span> ${0} </div> <button 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 class="flex flex-wrap p-xs"> ${0} <div 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}" @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?i(x||(x=$`<span class="text-secondary">${0}</span>`),this.code):"",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 n=null===(s=null===(t=this.data)||void 0===t?void 0:t.values[e])||void 0===s?void 0:s.default;return i(_||(_=$` <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 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> `),n||e,n?i(b||(b=$`<span class="text-secondary">${0}</span>`),e):"",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.region,this.disabled,(e=>{"Enter"===e.key&&this.region&&this.__addRegion()}),(e=>{const t=e.currentTarget;this.region=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.region,"bg-success-10 text-success cursor-pointer":!!this.region,"hover-bg-success hover-text-success-contrast":!!this.region,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.region}),!this.region,this.__addRegion,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>i(m||(m=$`<option value="${0}">${0}</option>`),e.code,e.default))))}__addRegion(){this.regions=[...new Set([...this.regions,this.region])],this.region="",this.dispatchEvent(new CustomEvent("update:regions"))}}let S,w,j,O=e=>e;const T=c(l(d(a)));class q extends T{constructor(){super(...arguments),this.countries={},this.disabled=!1,this.readonly=!1,this.regions="",this.country=""}static get scopedElements(){return{"x-country-card":k,"iron-icon":customElements.get("iron-icon")}}static get properties(){return s(s({},super.properties),{},{countries:{type:Object},disabled:{type:Boolean},readonly:{type:Boolean},regions:{type:String},country:{type:String}})}render(){var e,t;return i(S||(S=O` <div> <div class="space-y-s"> ${0} <div 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 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((([e,t])=>{var n,o;let r;try{const t=new URL(this.regions);t.searchParams.set("country_code",e),r=t.toString()}catch(e){r=""}return i(w||(w=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("*"===t?[]:t),e,p(null===(o=null===(n=this.data)||void 0===n?void 0:n.values[e])||void 0===o?void 0:o.default),r,this.lang,this.ns,this.disabled,this.readonly,(t=>{const i=s({},this.countries),n=t.currentTarget.regions;i[e]=n.length?n:"*",this.countries=i,this.dispatchEvent(new CustomEvent("update:countries"))}),(()=>{const t=s({},this.countries);delete t[e],this.countries=t,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.country,this.disabled,this.readonly,(e=>{"Enter"===e.key&&this.country&&this.__addCountry()}),(e=>{const t=e.currentTarget;this.country=t.value}),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.country,"bg-success-10 text-success cursor-pointer":!!this.country,"hover-bg-success hover-text-success-contrast":!!this.country,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.country}),!this.country||this.disabled,this.__addCountry,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>i(j||(j=O`<option value="${0}">${0}</option>`),e.cc2,e.default))))}__addCountry(){this.countries=s(s({},this.countries),{},{[this.country]:"*"}),this.country="",this.dispatchEvent(new CustomEvent("update:countries"))}}let F,N,J,E,C,H,I,V,z,A,D,R,B,G,L,M,P,U,W,Y,K,Q,X,Z,ee,te,se,ie=e=>e;const ne=c(u(r(l(d(a,"template-config-form")))));class oe extends ne{constructor(){super(...arguments),this.templates={},this.countries="",this.regions="",this.__addHiddenFieldInputValue=""}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-countries-list":q,"x-checkbox":o,"x-choice":e,"x-group":g}}static get properties(){return s(s({},super.properties),{},{__addHiddenFieldInputValue:{attribute:!1},countries:{type:String},regions:{type:String}})}render(){var e,t;const s=this.hiddenSelector,n=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},segment_io:{usage:"none",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 i(F||(F=ie` <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="${0}"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </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"),h({"space-y-l transition-opacity":!0,"opacity-50":!this.in("idle")}),s.matches("cart-type",!0)?"":this.__renderCartType(n),s.matches("foxycomplete",!0)?"":this.__renderFoxycomplete(n),s.matches("locations",!0)?"":this.__renderLocations(n),s.matches("hidden-fields",!0)?"":this.__renderHiddenFields(n),s.matches("cards",!0)?"":this.__renderCards(n),s.matches("checkout-type",!0)?"":this.__renderCheckoutType(n),s.matches("consent",!0)?"":this.__renderConsent(n),s.matches("fields",!0)?"":this.__renderFields(n),s.matches("google-analytics",!0)?"":this.__renderGoogleAnalytics(n),s.matches("segment-io",!0)?"":this.__renderSegmentIo(n),s.matches("troubleshooting",!0)?"":this.__renderTroubleshooting(n),s.matches("custom-config",!0)?"":this.__renderCustomConfig(n),s.matches("header",!0)?"":this.__renderHeader(n),s.matches("custom-fields",!0)?"":this.__renderCustomFields(n),s.matches("footer",!0)?"":this.__renderFooter(n),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(e){const{lang:t,ns:n}=this,o=["default","fullpage","custom"],r=!this.in("idle")||this.disabledSelector.matches("cart-type",!0);return i(N||(N=ie` <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"),r?"text-disabled":"",t,n,e.cart_type,o,r,this.readonlySelector.matches("cart-type",!0),(t=>{this.edit({json:JSON.stringify(s(s({},e),{},{cart_type:t.detail}))})}),o.map((e=>i(J||(J=ie` <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,t,e,n,r?"text-disabled":"text-secondary",t,e,n))),this.renderTemplateOrSlot("cart-type:after"))}__renderFoxycomplete(e){const{lang:n,ns:o}=this,r=this.disabledSelector.matches("foxycomplete",!0),a=this.readonlySelector.matches("foxycomplete",!0),l=["combobox","search","disabled"],d="none"===e.foxycomplete.usage?"disabled":e.foxycomplete.show_combobox?"combobox":"search",c=()=>i(E||(E=ie` <x-checkbox ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_country_flags" ns="${0}"></foxy-i18n> </x-checkbox> `),r,a,e.foxycomplete.show_flags,(t=>{const i=s(s({},e.foxycomplete),{},{show_flags:t.detail});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:i}))})}),n,o);return i(C||(C=ie` <div> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="foxycomplete" ns="${0}"> </foxy-i18n> <x-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 ?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"),r?"text-disabled":"",n,o,d,l,r,a,(i=>{if(!(i instanceof t))return;const n=s(s({},e.foxycomplete),{},{usage:"disabled"===i.detail?"none":"required",show_combobox:"combobox"===i.detail});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:n}))})}),l.map((e=>i(H||(H=ie` <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,n,e,o,r?"text-disabled":"text-secondary",n,e,o))),"combobox"!==d,["open","close"].map((t=>{const n="open"===t?"combobox_open":"combobox_close";return i(I||(I=ie` <vaadin-text-field label="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-field> `),this.t(`${t}_icon`),e.foxycomplete[n],r,a,(t=>{const i=t.currentTarget,o=s(s({},e.foxycomplete),{},{[n]:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:o}))})}))})),c(),"search"!==d,c(),r,a,"enabled"===e.postal_code_lookup.usage,(t=>{const i={usage:t.detail?"enabled":"none"};this.edit({json:JSON.stringify(s(s({},e),{},{postal_code_lookup:i}))})}),n,o,this.renderTemplateOrSlot("foxycomplete:after"))}__renderLocations(e){const{lang:t,ns:s}=this,n=e.location_filtering,o=this.disabledSelector.matches("locations",!0),r=this.readonlySelector.matches("locations",!0),a="blacklist"===n.shipping_filter_type?"block":"allow",l="both"===n.usage?"copy":"blacklist"===n.billing_filter_type?"block":"allow",d=()=>{if("both"===n.usage)n.billing_filter_type=n.shipping_filter_type,n.billing_filter_values=n.shipping_filter_values;else{const e=Object.keys(n.billing_filter_values).length>0,t=Object.keys(n.shipping_filter_values).length>0;n.usage=e||t?e&&!t?"billing":t&&!e?"shipping":"independent":"none"}};return i(V||(V=ie` ${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 .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 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 .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 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} `),this.renderTemplateOrSlot("locations:before"),o?"text-disabled":"",t,s,o?"text-disabled":"text-tertiary",t,s,["allow","block"],a,o,r,(t=>{"both"!==n.usage&&(n.usage="independent"),n.shipping_filter_type="block"===t.detail?"blacklist":"whitelist",d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,JSON.stringify(n.shipping_filter_values),this.regions,this.countries,a,t,s,o,r,(t=>{n.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,r,(t=>{"copy"===t.detail?n.usage="both":(n.usage="independent",n.billing_filter_type="block"===t.detail?"blacklist":"whitelist"),d(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,t,s,JSON.stringify(n.billing_filter_values),this.regions,this.countries,l,t,s,o,r,"copy"===l,(t=>{n.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,n=[],o=[],r=e.cart_display_config,a=this.disabledSelector.matches("hidden-fields",!0),l=this.readonlySelector.matches("hidden-fields",!0);for(const e in r){if(!e.startsWith("show_"))continue;const t=e.substring(5);n.push(t),"required"!==r.usage||r[e]||o.push(t)}"required"===r.usage&&o.push(...r.hidden_product_options);const d=()=>{r.usage="required",n.includes(this.__addHiddenFieldInputValue)?r[`show_${this.__addHiddenFieldInputValue}`]=!1:r.hidden_product_options.includes(this.__addHiddenFieldInputValue)||r.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];return i(z||(z=ie` <div> ${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"> ${0} </div> <div 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}" @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"),a?"text-disabled":"",t,s,o.map((o=>i(A||(A=ie` <div class="${0}"> ${0} <button 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":a}),n.includes(o)?i(D||(D=ie`<foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n>`),t,o,s):i(R||(R=ie`<span>${0}</span>`),o),h({"w-xs h-xs rounded-full transition-colors":!0,"hover-bg-error-10 hover-text-error":!a,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!a,"cursor-default":a,flex:!l,hidden:l}),a,(()=>{"boolean"==typeof r[`show_${o}`]?r[`show_${o}`]=!0:r.hidden_product_options=r.hidden_product_options.filter((e=>e!==o)),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":o.length>0,flex:!l,hidden:l}),this.t("add_field"),f(this.__addHiddenFieldInputValue),a,(e=>"Enter"===e.key&&d()),(e=>{this.__addHiddenFieldInputValue=e.currentTarget.value}),n.filter((e=>!o.includes(e))).map((e=>i(B||(B=ie`<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":!this.__addHiddenFieldInputValue,"bg-success-10 text-success cursor-pointer":!!this.__addHiddenFieldInputValue,"hover-bg-success hover-text-success-contrast":!!this.__addHiddenFieldInputValue,"focus-outline-none focus-ring-2":!!this.__addHiddenFieldInputValue}),!this.__addHiddenFieldInputValue,d,this.renderTemplateOrSlot("hidden-fields:after"))}__renderCards(e){const{lang:t,ns:s}=this,o=this.disabledSelector.matches("cards",!0),r=this.readonlySelector.matches("cards",!0),a=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 i(G||(G=ie` <div> ${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 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 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,s,Object.entries(n).map((([t,s])=>{if(!c[t])return;const n=a.includes(t);return i(L||(L=ie` <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}" ?checked="${0}" @change="${0}"> </label> </div> `),h({"m-xs rounded":!0,"opacity-50 cursor-default":o,"cursor-pointer ring-primary-50 focus-within-ring-2":!o}),h({"overflow-hidden transition-colors flex rounded border":!0,"border-primary bg-primary-10 text-primary":n&&!r,"border-contrast bg-contrast-5 text-secondary":n&&r,"hover-text-body":n&&!o&&!r,"border-contrast-10":!n,"hover-border-primary":!n&&!o&&!r,"hover-text-primary":!n&&!o&&!r}),s,c[t],o,n,(s=>{if(r)return s.preventDefault();s.stopPropagation(),n?a.splice(a.indexOf(t),1):a.push(t),this.edit({json:JSON.stringify(e)})}))})),o||"new_cards_only"===e.csc_requirements,r,l,(t=>{e.csc_requirements=t.detail?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),t,s,o,r,d,(t=>{e.csc_requirements=t.detail?"new_cards_only":l?"sso_only":"all_cards",this.edit({json:JSON.stringify(e)})}),t,s,o?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("cards:after"))}__renderCheckoutType(e){const{lang:t,ns:s}=this,n=!this.in("idle")||this.disabledSelector.matches("checkout-type",!0),o=this.readonlySelector.matches("checkout-type",!0);return i(M||(M=ie` <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"),n?"text-disabled":"",t,s,n,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)})}),n?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("checkout-type:after"))}__renderConsent(e){const{lang:t,ns:s}=this,n=e.tos_checkbox_settings,o=e.newsletter_subscribe,r=e.eu_secure_data_transfer_consent,a=this.disabledSelector.matches("consent",!0),l=this.readonlySelector.matches("consent",!0),d="margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))";return i(P||(P=ie` <div> ${0} <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="consent" ns="${0}"> </foxy-i18n> <x-checkbox ?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 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 class="m-s" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="leading-s block" lang="${0}" key="require_consent" ns="${0}"> </foxy-i18n> </x-checkbox> <x-checkbox class="m-s" ?disabled="${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 ?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 ?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"),a?"text-disabled":"",t,s,a,l,"required"===n.usage||"optional"===n.usage,(t=>{n.initial_state=t.detail?n.initial_state:"unchecked",n.is_hidden=!1,n.usage=t.detail?"required":"none",n.url=t.detail?n.url:"",this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,"none"===n.usage,this.t("location_url"),a,l,n.url,(t=>{n.url=t.currentTarget.value,this.edit({json:JSON.stringify(e)})}),a,"required"===n.usage,(t=>{n.usage=t.detail?"required":"optional",this.edit({json:JSON.stringify(e)})}),t,s,a,"checked"===n.initial_state,(t=>{n.initial_state=t.detail?"checked":"unchecked",this.edit({json:JSON.stringify(e)})}),t,s,d,a,l,"required"===o.usage,(t=>{o.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,d,a,l,"required"===r.usage,(t=>{r.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("consent:before"))}__renderFields(e){const{lang:t,ns:s}=this,n=this.disabledSelector.matches("fields",!0),o=this.readonlySelector.matches("fields",!0),r=e.custom_checkout_field_requirements;return i(U||(U=ie` <div> ${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 md-grid-cols-2" style="gap:1px"> ${0} <div class="bg-base hidden md-block"></div> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("fields:before"),n?"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((([a,l])=>i(W||(W=ie` <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 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":o,"text-disabled":n}),t,a.replace("billing_",""),s,h({"flex items-center text-right font-medium h-s px-s m-xs":o,hidden:!o}),this.t(l.find((e=>r[a]===e))),h({"px-s m-xs flex items-center rounded leading-none":!0,"ring-primary-50 ring-inset focus-within-ring-2":!n,"hover-text-primary":!n,"cursor-pointer":!n,"cursor-default":n,flex:!o,hidden:o}),h({"h-s mr-xs text-right appearance-none bg-transparent font-medium":!0,"focus-outline-none cursor-pointer":!n,"cursor-default":n}),n,o,(t=>{const s=t.currentTarget,i=s.options[s.options.selectedIndex].value;r[a]=i,this.edit({json:JSON.stringify(e)})}),l.map((e=>i(Y||(Y=ie` <option value="${0}" ?selected="${0}"> ${0} </option> `),e,r[a]===e,this.t(e))))))),this.renderTemplateOrSlot("fields:after"))}__renderGoogleAnalytics(e){const{lang:t,ns:s}=this,n=e.analytics_config,o=n.segment_io,r=n.google_analytics,a=this.disabledSelector.matches("google-analytics",!0),l=this.readonlySelector.matches("google-analytics",!0);return i(K||(K=ie` <div> ${0} <x-group frame> <span class="${0}" slot="header">Google Analytics</span> <div class="p-m space-y-m"> <vaadin-text-field 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 ?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"),a?"text-disabled":"",this.t("ga_account_id"),this.t("ga_account_id_explainer"),f(r.account_id),a,l,(e=>"Enter"===e.key&&this.submit()),(e=>{r.account_id=e.currentTarget.value,r.usage=r.account_id?"required":"none",n.usage=r.account_id||o.account_id?"required":"none"}),a,l,r.include_on_site,(t=>{r.include_on_site=t.detail,this.edit({json:JSON.stringify(e)})}),t,s,a?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("google-analytics:after"))}__renderSegmentIo(e){const t=e.analytics_config,s=t.segment_io,n=t.google_analytics,o=this.disabledSelector.matches("segment-io",!0),r=this.readonlySelector.matches("segment-io",!0);return i(Q||(Q=ie` <div> ${0} <x-group frame> <span class="${0}" slot="header">Segment.io</span> <div class="p-m"> <vaadin-text-field class="w-full" label="${0}" placeholder="MY-WRITE-KEY" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("segment-io:before"),o?"text-disabled":"",this.t("sio_account_id"),this.t("sio_account_id_explainer"),f(s.account_id),o,r,(e=>"Enter"===e.key&&this.submit()),(e=>{s.account_id=e.currentTarget.value,s.usage=s.account_id?"required":"none",t.usage=n.account_id||s.account_id?"required":"none"}),this.renderTemplateOrSlot("segment-io:after"))}__renderTroubleshooting(e){const{lang:t,ns:s}=this,n=e.debug,o=this.disabledSelector.matches("troubleshooting",!0),r=this.readonlySelector.matches("troubleshooting",!0);return i(X||(X=ie` <div> ${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 ?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,r,"required"===n.usage,(t=>{n.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,o?"text-disabled":"text-secondary",t,s,this.renderTemplateOrSlot("troubleshooting:after"))}__renderCustomConfig(e){return i(Z||(Z=ie` <div data-testid="custom-config"> ${0} <vaadin-text-area data-testid="custom-config-field" class="w-full" label="${0}" placeholder='{ "key": "value" }' helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("custom-config:before"),this.t("custom_config"),this.t("custom_config_helper_text"),e.custom_config?JSON.stringify(e.custom_config,null,2):"",!this.in("idle")||this.disabledSelector.matches("custom-config",!0),this.readonlySelector.matches("custom-config",!0),(t=>{const s=t.currentTarget;try{e.custom_config=s.value?JSON.parse(s.value):"",this.edit({json:JSON.stringify(e)}),s.invalid=!1}catch(e){s.invalid=!0}}),this.renderTemplateOrSlot("custom-config:after"))}__renderHeader(e){return i(ee||(ee=ie` <div data-testid="header"> ${0} <vaadin-text-area data-testid="header-field" class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.t("custom_header"),this.t("custom_header_helper_text"),e.custom_script_values.header,!this.in("idle")||this.disabledSelector.matches("header",!0),this.readonlySelector.matches("header",!0),(t=>{const i=t.currentTarget,n=s(s({},e.custom_script_values),{},{header:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{custom_script_values:n}))})}),this.renderTemplateOrSlot("header:after"))}__renderCustomFields(e){return i(te||(te=ie` <div data-testid="custom-fields"> ${0} <vaadin-text-area data-testid="custom-fields-field" class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("custom-fields:before"),this.t("custom_fields"),this.t("custom_fields_helper_text"),e.custom_script_values.checkout_fields,!this.in("idle")||this.disabledSelector.matches("custom-fields",!0),this.readonlySelector.matches("custom-fields",!0),(t=>{const s=t.currentTarget.value;e.custom_script_values.checkout_fields=s,this.edit({json:JSON.stringify(e)})}),this.renderTemplateOrSlot("custom-fields:after"))}__renderFooter(e){return i(se||(se=ie` <div data-testid="footer"> ${0} <vaadin-text-area data-testid="footer-field" class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("footer:before"),this.t("custom_footer"),this.t("custom_footer_helper_text"),e.custom_script_values.footer,!this.in("idle")||this.disabledSelector.matches("footer",!0),this.readonlySelector.matches("footer",!0),(t=>{const i=t.currentTarget,n=s(s({},e.custom_script_values),{},{footer:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{custom_script_values:n}))})}),this.renderTemplateOrSlot("footer:after"))}}customElements.define("foxy-template-config-form",oe);export{oe as TemplateConfigForm};
@@ -7,6 +7,27 @@ declare const Base: typeof NucleonElement & import("lit-element").Constructor<im
7
7
  } & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost> & {
8
8
  styles: CSSResultArray;
9
9
  } & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost>;
10
+ /**
11
+ * Form element for creating or editing email templates (`fx:email_template`).
12
+ *
13
+ * @slot description:before
14
+ * @slot description:after
15
+ *
16
+ * @slot content:before
17
+ * @slot content:after
18
+ *
19
+ * @slot timestamps:before
20
+ * @slot timestamps:after
21
+ *
22
+ * @slot create:before
23
+ * @slot create:after
24
+ *
25
+ * @slot delete:before
26
+ * @slot delete:after
27
+ *
28
+ * @element foxy-email-template-form
29
+ * @since 1.14.0
30
+ */
10
31
  export declare class EmailTemplateForm extends Base<Data> {
11
32
  static get properties(): PropertyDeclarations;
12
33
  static get styles(): CSSResultArray;
@@ -10,6 +10,27 @@ import { classMap } from "../../../utils/class-map.js";
10
10
  import { ifDefined } from 'lit-html/directives/if-defined';
11
11
  const NS = 'email-template-form';
12
12
  const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS))));
13
+ /**
14
+ * Form element for creating or editing email templates (`fx:email_template`).
15
+ *
16
+ * @slot description:before
17
+ * @slot description:after
18
+ *
19
+ * @slot content:before
20
+ * @slot content:after
21
+ *
22
+ * @slot timestamps:before
23
+ * @slot timestamps:after
24
+ *
25
+ * @slot create:before
26
+ * @slot create:after
27
+ *
28
+ * @slot delete:before
29
+ * @slot delete:after
30
+ *
31
+ * @element foxy-email-template-form
32
+ * @since 1.14.0
33
+ */
13
34
  export class EmailTemplateForm extends Base {
14
35
  constructor() {
15
36
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailTemplateForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,+BAA4B;AAEnE,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,gCAA6B;AACzD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,mBAAmB,CAC9B,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CACzE,CAAC;AAEF,MAAM,OAAO,iBAAkB,SAAQ,IAAU;IAAjD;;QAmCE,cAAS,GAAc,EAAE,CAAC;QAElB,iBAAY,GAA6B,MAAM,CAAC;QAEhD,oBAAe,GAAoC,SAAS,CAAC;IAkSvE,CAAC;IAxUC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAA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YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'email-template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\nexport class EmailTemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n templates: Templates = {};\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n const scope = 'description';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n data-testid=${scope}\n class=\"w-full mb-s\"\n label=${this.t(scope)}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}\n ?readonly=${this.readonlySelector.matches(scope)}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderContent() {\n return html`\n <div data-testid=\"content\">\n ${this.renderTemplateOrSlot('content:before')}\n\n <div class=\"space-y-l\">\n ${this.__renderContentVariant('content_text_url', 'content_text', 'text_template')}\n ${this.__renderContentVariant('content_html_url', 'content_html', 'html_template')}\n </div>\n\n ${this.renderTemplateOrSlot('content:after')}\n </div>\n `;\n }\n\n private __renderContentVariant(\n urlPath: 'content_text_url' | 'content_html_url',\n textPath: 'content_text' | 'content_html',\n header: string\n ) {\n const isDisabled = !this.in('idle') || this.disabledSelector.matches('content', true);\n const isReadonly = this.readonlySelector.matches('content', true);\n const contentChoice = this.form[urlPath]\n ? 'url'\n : this.form[textPath]\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <x-group frame>\n <foxy-i18n\n class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}\n lang=${this.lang}\n slot=\"header\"\n key=${header}\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"${textPath.replace('_', '-')}-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ [textPath]: '', [urlPath]: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"${textPath.replace('_', '-')}-url\"\n value=${ifDefined(this.form[urlPath])}\n class=\"mr-s flex-grow\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ [textPath]: '', [urlPath]: value });\n }}\n >\n </vaadin-text-field>\n\n <vaadin-button\n data-testid=\"${textPath.replace('_', '-')}-cache\"\n class=\"relative\"\n ?disabled=${isDisabled || this.__cacheState === 'busy'}\n ?hidden=${isReadonly || this.form[urlPath] !== this.data?.[urlPath]}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n data-testid=\"${textPath.replace('_', '-')}-clipboard\"\n id=\"cached-content\"\n class=\"w-full mb-m\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${this.form[textPath]}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ [textPath]: value, [urlPath]: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n `;\n }\n\n private __renderTimestamps() {\n const scope = 'timestamps';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailTemplateForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,GAAG,EAAE,IAA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C,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;wBACxD,MAAM;sBACR,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU;mBAC5D,WAAW;;0BAEJ,EAAE,QAAQ,MAAM,SAAS,IAAI;;;UAG7C,IAAI,CAAC,oBAAoB,CAAC,GAAG,MAAM,QAAQ,CAAC;;KAEjD,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO;;QACnB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAE3B,IAAI;YACF,MAAM,GAAG,eAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,mCAAI,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAEtF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SACnD;QAAC,WAAM;YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'email-template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Form element for creating or editing email templates (`fx:email_template`).\n *\n * @slot description:before\n * @slot description:after\n *\n * @slot content:before\n * @slot content:after\n *\n * @slot timestamps:before\n * @slot timestamps:after\n *\n * @slot create:before\n * @slot create:after\n *\n * @slot delete:before\n * @slot delete:after\n *\n * @element foxy-email-template-form\n * @since 1.14.0\n */\nexport class EmailTemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n templates: Templates = {};\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n const scope = 'description';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n data-testid=${scope}\n class=\"w-full mb-s\"\n label=${this.t(scope)}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}\n ?readonly=${this.readonlySelector.matches(scope)}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderContent() {\n return html`\n <div data-testid=\"content\">\n ${this.renderTemplateOrSlot('content:before')}\n\n <div class=\"space-y-l\">\n ${this.__renderContentVariant('content_text_url', 'content_text', 'text_template')}\n ${this.__renderContentVariant('content_html_url', 'content_html', 'html_template')}\n </div>\n\n ${this.renderTemplateOrSlot('content:after')}\n </div>\n `;\n }\n\n private __renderContentVariant(\n urlPath: 'content_text_url' | 'content_html_url',\n textPath: 'content_text' | 'content_html',\n header: string\n ) {\n const isDisabled = !this.in('idle') || this.disabledSelector.matches('content', true);\n const isReadonly = this.readonlySelector.matches('content', true);\n const contentChoice = this.form[urlPath]\n ? 'url'\n : this.form[textPath]\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <x-group frame>\n <foxy-i18n\n class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}\n lang=${this.lang}\n slot=\"header\"\n key=${header}\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"${textPath.replace('_', '-')}-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ [textPath]: '', [urlPath]: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"${textPath.replace('_', '-')}-url\"\n value=${ifDefined(this.form[urlPath])}\n class=\"mr-s flex-grow\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ [textPath]: '', [urlPath]: value });\n }}\n >\n </vaadin-text-field>\n\n <vaadin-button\n data-testid=\"${textPath.replace('_', '-')}-cache\"\n class=\"relative\"\n ?disabled=${isDisabled || this.__cacheState === 'busy'}\n ?hidden=${isReadonly || this.form[urlPath] !== this.data?.[urlPath]}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n data-testid=\"${textPath.replace('_', '-')}-clipboard\"\n id=\"cached-content\"\n class=\"w-full mb-m\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${this.form[textPath]}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ [textPath]: value, [urlPath]: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n `;\n }\n\n private __renderTimestamps() {\n const scope = 'timestamps';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
@@ -101,7 +101,7 @@ export class TemplateConfigForm extends Base {
101
101
  }
102
102
  render() {
103
103
  var _a, _b;
104
- const hidden = this.hiddenControls;
104
+ const hidden = this.hiddenSelector;
105
105
  const json = this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();
106
106
  return html `
107
107
  <div class="relative" aria-busy=${this.in('busy')} aria-live="polite">
@@ -149,9 +149,9 @@ export class TemplateConfigForm extends Base {
149
149
  __renderCartType(json) {
150
150
  const { lang, ns } = this;
151
151
  const items = ['default', 'fullpage', 'custom'];
152
- const isDisabled = this.disabledSelector.matches('cart-type', true);
152
+ const isDisabled = !this.in('idle') || this.disabledSelector.matches('cart-type', true);
153
153
  return html `
154
- <div>
154
+ <div data-testid="cart-type">
155
155
  ${this.renderTemplateOrSlot('cart-type:before')}
156
156
 
157
157
  <x-group frame>
@@ -165,6 +165,7 @@ export class TemplateConfigForm extends Base {
165
165
  </foxy-i18n>
166
166
 
167
167
  <x-choice
168
+ data-testid="cart-type-choice"
168
169
  .value=${json.cart_type}
169
170
  .items=${items}
170
171
  ?disabled=${isDisabled}
@@ -751,10 +752,10 @@ export class TemplateConfigForm extends Base {
751
752
  }
752
753
  __renderCheckoutType(json) {
753
754
  const { lang, ns } = this;
754
- const isDisabled = this.disabledSelector.matches('checkout-type', true);
755
+ const isDisabled = !this.in('idle') || this.disabledSelector.matches('checkout-type', true);
755
756
  const isReadonly = this.readonlySelector.matches('checkout-type', true);
756
757
  return html `
757
- <div>
758
+ <div data-testid="checkout-type">
758
759
  ${this.renderTemplateOrSlot('checkout-type:before')}
759
760
 
760
761
  <div class="space-y-xs">
@@ -769,6 +770,7 @@ export class TemplateConfigForm extends Base {
769
770
  </foxy-i18n>
770
771
 
771
772
  <x-choice
773
+ data-testid="checkout-type-choice"
772
774
  ?disabled=${isDisabled}
773
775
  ?readonly=${isReadonly}
774
776
  .items=${['default_account', 'default_guest', 'guest_only', 'account_only']}
@@ -1204,16 +1206,17 @@ export class TemplateConfigForm extends Base {
1204
1206
  }
1205
1207
  __renderCustomConfig(json) {
1206
1208
  return html `
1207
- <div>
1209
+ <div data-testid="custom-config">
1208
1210
  ${this.renderTemplateOrSlot('custom-config:before')}
1209
1211
 
1210
1212
  <vaadin-text-area
1213
+ data-testid="custom-config-field"
1211
1214
  class="w-full"
1212
1215
  label=${this.t('custom_config')}
1213
1216
  placeholder='{ "key": "value" }'
1214
1217
  helper-text=${this.t('custom_config_helper_text')}
1215
1218
  .value=${json.custom_config ? JSON.stringify(json.custom_config, null, 2) : ''}
1216
- ?disabled=${this.disabledSelector.matches('custom-config', true)}
1219
+ ?disabled=${!this.in('idle') || this.disabledSelector.matches('custom-config', true)}
1217
1220
  ?readonly=${this.readonlySelector.matches('custom-config', true)}
1218
1221
  @input=${(evt) => {
1219
1222
  const input = evt.currentTarget;
@@ -1235,15 +1238,16 @@ export class TemplateConfigForm extends Base {
1235
1238
  }
1236
1239
  __renderHeader(json) {
1237
1240
  return html `
1238
- <div>
1241
+ <div data-testid="header">
1239
1242
  ${this.renderTemplateOrSlot('header:before')}
1240
1243
 
1241
1244
  <vaadin-text-area
1245
+ data-testid="header-field"
1242
1246
  class="w-full"
1243
1247
  label=${this.t('custom_header')}
1244
1248
  helper-text=${this.t('custom_header_helper_text')}
1245
1249
  .value=${json.custom_script_values.header}
1246
- ?disabled=${this.disabledSelector.matches('header', true)}
1250
+ ?disabled=${!this.in('idle') || this.disabledSelector.matches('header', true)}
1247
1251
  ?readonly=${this.readonlySelector.matches('header', true)}
1248
1252
  @input=${(evt) => {
1249
1253
  const target = evt.currentTarget;
@@ -1262,16 +1266,17 @@ export class TemplateConfigForm extends Base {
1262
1266
  }
1263
1267
  __renderCustomFields(json) {
1264
1268
  return html `
1265
- <div>
1269
+ <div data-testid="custom-fields">
1266
1270
  ${this.renderTemplateOrSlot('custom-fields:before')}
1267
1271
 
1268
1272
  <vaadin-text-area
1273
+ data-testid="custom-fields-field"
1269
1274
  class="w-full"
1270
1275
  label=${this.t('custom_fields')}
1271
1276
  helper-text=${this.t('custom_fields_helper_text')}
1272
- .value=${json.custom_script_values.header}
1273
- ?disabled=${this.disabledSelector.matches('header', true)}
1274
- ?readonly=${this.readonlySelector.matches('header', true)}
1277
+ .value=${json.custom_script_values.checkout_fields}
1278
+ ?disabled=${!this.in('idle') || this.disabledSelector.matches('custom-fields', true)}
1279
+ ?readonly=${this.readonlySelector.matches('custom-fields', true)}
1275
1280
  @input=${(evt) => {
1276
1281
  const newValue = evt.currentTarget.value;
1277
1282
  json.custom_script_values.checkout_fields = newValue;
@@ -1286,15 +1291,16 @@ export class TemplateConfigForm extends Base {
1286
1291
  }
1287
1292
  __renderFooter(json) {
1288
1293
  return html `
1289
- <div>
1294
+ <div data-testid="footer">
1290
1295
  ${this.renderTemplateOrSlot('footer:before')}
1291
1296
 
1292
1297
  <vaadin-text-area
1298
+ data-testid="footer-field"
1293
1299
  class="w-full"
1294
1300
  label=${this.t('custom_footer')}
1295
1301
  helper-text=${this.t('custom_footer_helper_text')}
1296
1302
  .value=${json.custom_script_values.footer}
1297
- ?disabled=${this.disabledSelector.matches('footer', true)}
1303
+ ?disabled=${!this.in('idle') || this.disabledSelector.matches('footer', true)}
1298
1304
  ?readonly=${this.readonlySelector.matches('footer', true)}
1299
1305
  @input=${(evt) => {
1300
1306
  const target = evt.currentTarget;
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateConfigForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/TemplateConfigForm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,sCAAmC;AAEpD,OAAO,EAAuB,iBAAiB,EAAE,gCAA6B;AAE9E,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,2CAAwC;AAC3D,OAAO,EAAE,MAAM,EAAE,uCAAoC;AACrD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,aAAa,EAAE,2BAAwB;AAChD,OAAO,EAAE,KAAK,EAAE,qCAAkC;AAClD,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAElE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAG7D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,cAAc,EAAE,sBAAm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AAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import * as logos from '../PaymentMethodCard/logos';\n\nimport { CheckboxChangeEvent, ChoiceChangeEvent } from '../../private/events';\nimport { Data, TemplateConfigJSON, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { Checkbox } from '../../private/Checkbox/Checkbox';\nimport { Choice } from '../../private/Choice/Choice';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { CountriesList } from './CountriesList';\nimport { Group } from '../../private/Group/Group';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { getDefaultJSON } from './defaults';\nimport { live } from 'lit-html/directives/live';\n\nconst NS = 'template-config-form';\nconst Base = ScopedElementsMixin(\n ResponsiveMixin(ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS))))\n);\n\n/**\n * Form element for creating or editing template configs (`fx:template_config`).\n *\n * @slot cart-type:before\n * @slot cart-type:after\n *\n * @slot foxycomplete:before\n * @slot foxycomplete:after\n *\n * @slot locations:before\n * @slot locations:after\n *\n * @slot hidden-fields:before\n * @slot hidden-fields:after\n *\n * @slot cards:before\n * @slot cards:after\n *\n * @slot checkout-type:before\n * @slot checkout-type:after\n *\n * @slot consent:before\n * @slot consent:after\n *\n * @slot fields:before\n * @slot fields:after\n *\n * @slot google-analytics:before\n * @slot google-analytics:after\n *\n * @slot segment-io:before\n * @slot segment-io:after\n *\n * @slot troubleshooting:before\n * @slot troubleshooting:after\n *\n * @slot custom-config:before\n * @slot custom-config:after\n *\n * @slot header:before\n * @slot header:after\n *\n * @slot custom-fields:before\n * @slot custom-fields:after\n *\n * @slot footer:before\n * @slot footer:after\n *\n * @element foxy-template-config-form\n * @since 1.14.0\n */\nexport class TemplateConfigForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'iron-icon': customElements.get('iron-icon'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'x-countries-list': CountriesList,\n 'x-checkbox': Checkbox,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __addHiddenFieldInputValue: { attribute: false },\n countries: { type: String },\n regions: { type: String },\n };\n }\n\n templates: Templates = {};\n\n /** URI of the `fx:countries` hAPI resource. */\n countries = '';\n\n /** URI of the `fx:regions` hAPI resource. */\n regions = '';\n\n private __addHiddenFieldInputValue = '';\n\n render(): TemplateResult {\n const hidden = this.hiddenControls;\n const json: TemplateConfigJSON = this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();\n\n return html`\n <div class=\"relative\" aria-busy=${this.in('busy')} aria-live=\"polite\">\n <div\n class=${classMap({\n 'space-y-l transition-opacity': true,\n 'opacity-50': !this.in('idle'),\n })}\n >\n ${hidden.matches('cart-type', true) ? '' : this.__renderCartType(json)}\n ${hidden.matches('foxycomplete', true) ? '' : this.__renderFoxycomplete(json)}\n ${hidden.matches('locations', true) ? '' : this.__renderLocations(json)}\n ${hidden.matches('hidden-fields', true) ? '' : this.__renderHiddenFields(json)}\n ${hidden.matches('cards', true) ? '' : this.__renderCards(json)}\n ${hidden.matches('checkout-type', true) ? '' : this.__renderCheckoutType(json)}\n ${hidden.matches('consent', true) ? '' : this.__renderConsent(json)}\n ${hidden.matches('fields', true) ? '' : this.__renderFields(json)}\n ${hidden.matches('google-analytics', true) ? '' : this.__renderGoogleAnalytics(json)}\n ${hidden.matches('segment-io', true) ? '' : this.__renderSegmentIo(json)}\n ${hidden.matches('troubleshooting', true) ? '' : this.__renderTroubleshooting(json)}\n ${hidden.matches('custom-config', true) ? '' : this.__renderCustomConfig(json)}\n ${hidden.matches('header', true) ? '' : this.__renderHeader(json)}\n ${hidden.matches('custom-fields', true) ? '' : this.__renderCustomFields(json)}\n ${hidden.matches('footer', true) ? '' : this.__renderFooter(json)}\n </div>\n\n <div\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': this.in('idle'),\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${this.in('fail') ? 'error' : 'busy'}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderCartType(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const items = ['default', 'fullpage', 'custom'];\n const isDisabled = this.disabledSelector.matches('cart-type', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('cart-type:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"cart_type\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n .value=${json.cart_type}\n .items=${items}\n ?disabled=${isDisabled}\n ?readonly=${this.readonlySelector.matches('cart-type', true)}\n @change=${(evt: ChoiceChangeEvent) => {\n this.edit({ json: JSON.stringify({ ...json, cart_type: evt.detail }) });\n }}\n >\n ${items.map(item => {\n return html`\n <div slot=\"${item}-label\" class=\"grid leading-s py-s\">\n <foxy-i18n lang=${lang} key=\"cart_type_${item}\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"cart_type_${item}_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n </x-choice>\n </x-group>\n\n ${this.renderTemplateOrSlot('cart-type:after')}\n </div>\n `;\n }\n\n private __renderFoxycomplete(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('foxycomplete', true);\n const isReadonly = this.readonlySelector.matches('foxycomplete', true);\n const items = ['combobox', 'search', 'disabled'];\n const value =\n json.foxycomplete.usage === 'none'\n ? 'disabled'\n : json.foxycomplete.show_combobox\n ? 'combobox'\n : 'search';\n\n const renderFlagsCheckbox = () => html`\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${json.foxycomplete.show_flags}\n @change=${(evt: CheckboxChangeEvent) => {\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n show_flags: evt.detail,\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n <foxy-i18n lang=${lang} key=\"show_country_flags\" ns=${ns}></foxy-i18n>\n </x-checkbox>\n `;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('foxycomplete:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"foxycomplete\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n .value=${value}\n .items=${items}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: Event) => {\n if (!(evt instanceof ChoiceChangeEvent)) return;\n\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n usage: evt.detail === 'disabled' ? 'none' : 'required',\n show_combobox: evt.detail === 'combobox',\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n ${items.map(item => {\n return html`\n <div slot=\"${item}-label\" class=\"grid leading-s py-s\">\n <foxy-i18n lang=${lang} key=\"foxycomplete_${item}\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"foxycomplete_${item}_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"combobox\" class=\"space-y-m pb-s\" ?hidden=${value !== 'combobox'}>\n <div class=\"grid grid-cols-2 gap-m\" style=\"max-width: 16rem\">\n ${['open', 'close'].map(action => {\n const field = action === 'open' ? 'combobox_open' : 'combobox_close';\n\n return html`\n <vaadin-text-field\n label=${this.t(`${action}_icon`)}\n .value=${json.foxycomplete[field]}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextFieldElement;\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n [field]: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n </vaadin-text-field>\n `;\n })}\n </div>\n\n ${renderFlagsCheckbox()}\n </div>\n\n <div slot=\"search\" class=\"pb-s\" ?hidden=${value !== 'search'}>\n ${renderFlagsCheckbox()}\n </div>\n </x-choice>\n\n <div class=\"border-t border-contrast-10 p-m\">\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${json.postal_code_lookup.usage === 'enabled'}\n @change=${(evt: CheckboxChangeEvent) => {\n const newConfig: TemplateConfigJSON['postal_code_lookup'] = {\n usage: evt.detail ? 'enabled' : 'none',\n };\n\n this.edit({ json: JSON.stringify({ ...json, postal_code_lookup: newConfig }) });\n }}\n >\n <foxy-i18n lang=${lang} key=\"enable_postcode_lookup\" ns=${ns}></foxy-i18n>\n </x-checkbox>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('foxycomplete:after')}\n </div>\n `;\n }\n\n private __renderLocations(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const config = json.location_filtering;\n const isDisabled = this.disabledSelector.matches('locations', true);\n const isReadonly = this.readonlySelector.matches('locations', true);\n\n const shippingChoice = config.shipping_filter_type === 'blacklist' ? 'block' : 'allow';\n const billingChoice =\n config.usage === 'both'\n ? 'copy'\n : config.billing_filter_type === 'blacklist'\n ? 'block'\n : 'allow';\n\n const normalize = () => {\n if (config.usage === 'both') {\n config.billing_filter_type = config.shipping_filter_type;\n config.billing_filter_values = config.shipping_filter_values;\n } else {\n const hasBillingFilters = Object.keys(config.billing_filter_values).length > 0;\n const hasShippingFilters = Object.keys(config.shipping_filter_values).length > 0;\n\n if (!hasBillingFilters && !hasShippingFilters) {\n config.usage = 'none';\n } else if (hasBillingFilters && !hasShippingFilters) {\n config.usage = 'billing';\n } else if (hasShippingFilters && !hasBillingFilters) {\n config.usage = 'shipping';\n } else {\n config.usage = 'independent';\n }\n }\n };\n\n return html`\n ${this.renderTemplateOrSlot('locations:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"location_plural\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"grid sm-grid-cols-2 bg-contrast-10\" style=\"gap: 1px\">\n <x-group class=\"bg-base pt-m\">\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : 'text-tertiary'}\n slot=\"header\"\n lang=${lang}\n key=\"shipping\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n .items=${['allow', 'block']}\n .value=${shippingChoice}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: ChoiceChangeEvent) => {\n if (config.usage !== 'both') config.usage = 'independent';\n config.shipping_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n slot=\"allow-label\" lang=${lang} key=\"allowlist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"block-label\" lang=${lang} key=\"blocklist\" ns=${ns}></foxy-i18n>\n\n <x-countries-list\n countries=${JSON.stringify(config.shipping_filter_values)}\n regions=${this.regions}\n class=\"mb-m\"\n href=${this.countries}\n slot=${shippingChoice}\n lang=${lang}\n ns=${ns}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @update:countries=${(evt: CustomEvent) => {\n config.shipping_filter_values = (evt.currentTarget as CountriesList).countries;\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-countries-list>\n </x-choice>\n </x-group>\n\n <x-group class=\"bg-base pt-m\">\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : 'text-tertiary'}\n slot=\"header\"\n lang=${lang}\n key=\"billing\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n .items=${['allow', 'block', 'copy']}\n .value=${billingChoice}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: ChoiceChangeEvent) => {\n if (evt.detail === 'copy') {\n config.usage = 'both';\n } else {\n config.usage = 'independent';\n config.billing_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';\n }\n\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n slot=\"allow-label\" lang=${lang} key=\"allowlist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"block-label\" lang=${lang} key=\"blocklist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"copy-label\" lang=${lang} key=\"same_as_shipping\" ns=${ns}></foxy-i18n>\n\n <x-countries-list\n countries=${JSON.stringify(config.billing_filter_values)}\n regions=${this.regions}\n class=\"mb-m\"\n href=${this.countries}\n slot=${billingChoice}\n lang=${lang}\n ns=${ns}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?hidden=${billingChoice === 'copy'}\n @update:countries=${(evt: CustomEvent) => {\n config.billing_filter_values = (evt.currentTarget as CountriesList).countries;\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-countries-list>\n </x-choice>\n </x-group>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('locations:after')}\n `;\n }\n\n private __renderHiddenFields(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const suggestions = [] as string[];\n const fields = [] as string[];\n const config = json.cart_display_config;\n const isDisabled = this.disabledSelector.matches('hidden-fields', true);\n const isReadonly = this.readonlySelector.matches('hidden-fields', true);\n\n type FieldName = keyof Omit<\n TemplateConfigJSON['cart_display_config'],\n 'hidden_product_options' | 'usage'\n >;\n\n for (const key in config) {\n if (!key.startsWith('show_')) continue;\n const field = key.substring(5);\n suggestions.push(field);\n if (config.usage === 'required' && !config[key as FieldName]) fields.push(field);\n }\n\n if (config.usage === 'required') {\n fields.push(...config.hidden_product_options);\n }\n\n const addField = () => {\n config.usage = 'required';\n\n if (suggestions.includes(this.__addHiddenFieldInputValue)) {\n config[`show_${this.__addHiddenFieldInputValue}` as FieldName] = false;\n } else if (!config.hidden_product_options.includes(this.__addHiddenFieldInputValue)) {\n config.hidden_product_options.push(this.__addHiddenFieldInputValue);\n }\n\n this.edit({ json: JSON.stringify(json) });\n this.__addHiddenFieldInputValue = '';\n };\n\n const radius = 'calc(var(--lumo-border-radius-l) / 1.2)';\n const inputRadius = fields.length === 0 ? [radius] : ['0', '0', radius, radius];\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('hidden-fields:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"hidden_fields\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"divide-y divide-contrast-10\">\n ${fields.map(field => {\n return html`\n <div\n class=${classMap({\n 'h-m ml-m pr-xs flex items-center justify-between': true,\n 'text-secondary': isReadonly,\n 'text-disabled': isDisabled,\n })}\n >\n ${suggestions.includes(field)\n ? html`<foxy-i18n lang=${lang} key=${field} ns=${ns}></foxy-i18n>`\n : html`<span>${field}</span>`}\n\n <button\n class=${classMap({\n 'w-xs h-xs rounded-full transition-colors': true,\n 'hover-bg-error-10 hover-text-error': !isDisabled,\n 'focus-outline-none focus-ring-2 ring-inset ring-error-50': !isDisabled,\n 'cursor-default': isDisabled,\n 'flex': !isReadonly,\n 'hidden': isReadonly,\n })}\n ?disabled=${isDisabled}\n @click=${() => {\n if (typeof config[`show_${field}` as FieldName] === 'boolean') {\n config[`show_${field}` as FieldName] = true;\n } else {\n config.hidden_product_options = config.hidden_product_options.filter(\n option => option !== field\n );\n }\n\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <iron-icon icon=\"icons:close\" class=\"icon-inline text-m m-auto\"></iron-icon>\n </button>\n </div>\n `;\n })}\n </div>\n\n <div\n style=\"border-radius: ${inputRadius.join(' ')}\"\n class=${classMap({\n 'h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2': true,\n 'border-t border-contrast-10': fields.length > 0,\n 'flex': !isReadonly,\n 'hidden': isReadonly,\n })}\n >\n <input\n placeholder=${this.t('add_field')}\n class=\"w-full bg-transparent appearance-none h-m px-m focus-outline-none\"\n list=\"hidden-fields-list\"\n .value=${live(this.__addHiddenFieldInputValue)}\n ?disabled=${isDisabled}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addField()}\n @input=${(evt: InputEvent) => {\n this.__addHiddenFieldInputValue = (evt.currentTarget as HTMLInputElement).value;\n }}\n />\n\n <datalist id=\"hidden-fields-list\">\n ${suggestions\n .filter(suggestion => !fields.includes(suggestion))\n .map(\n suggestion => html`<option value=${suggestion}>${this.t(suggestion)}</option>`\n )}\n </datalist>\n\n <button\n aria-label=${this.t('add_field')}\n class=${classMap({\n 'w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50': true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': !this.__addHiddenFieldInputValue,\n 'bg-success-10 text-success cursor-pointer': !!this.__addHiddenFieldInputValue,\n 'hover-bg-success hover-text-success-contrast': !!this.__addHiddenFieldInputValue,\n 'focus-outline-none focus-ring-2': !!this.__addHiddenFieldInputValue,\n })}\n ?disabled=${!this.__addHiddenFieldInputValue}\n @click=${addField}\n >\n <iron-icon icon=\"icons:add\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('hidden-fields:after')}\n </div>\n `;\n }\n\n private __renderCards(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('cards', true);\n const isReadonly = this.readonlySelector.matches('cards', true);\n const config = json.supported_payment_cards as string[];\n\n let skipForSaved: boolean;\n let skipForSSO: boolean;\n\n if (json.csc_requirements === 'all_cards') {\n skipForSaved = false;\n skipForSSO = false;\n } else if (json.csc_requirements === 'sso_only') {\n skipForSaved = true;\n skipForSSO = false;\n } else {\n skipForSaved = true;\n skipForSSO = true;\n }\n\n const typeToName: Record<string, string> = {\n amex: 'American Express',\n diners: 'Diners Club',\n discover: 'Discover',\n jcb: 'JCB',\n maestro: 'Maestro',\n mastercard: 'Mastercard',\n unionpay: 'UnionPay',\n visa: 'Visa',\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('cards:before')}\n\n <div class=\"space-y-xs\">\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"supported_cards\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"flex flex-wrap m-xs p-s\">\n ${Object.entries(logos).map(([type, logo]) => {\n if (!typeToName[type]) return;\n const isChecked = config.includes(type);\n\n return html`\n <div\n class=${classMap({\n 'm-xs rounded': true,\n 'opacity-50 cursor-default': isDisabled,\n 'cursor-pointer ring-primary-50 focus-within-ring-2': !isDisabled,\n })}\n >\n <label\n class=${classMap({\n 'overflow-hidden transition-colors flex rounded border': true,\n 'border-primary bg-primary-10 text-primary': isChecked && !isReadonly,\n 'border-contrast bg-contrast-5 text-secondary': isChecked && isReadonly,\n 'hover-text-body': isChecked && !isDisabled && !isReadonly,\n 'border-contrast-10': !isChecked,\n 'hover-border-primary': !isChecked && !isDisabled && !isReadonly,\n 'hover-text-primary': !isChecked && !isDisabled && !isReadonly,\n })}\n >\n <div class=\"h-s\">${logo}</div>\n\n <div class=\"text-s font-medium mx-s my-auto leading-none\">\n ${typeToName[type]}\n </div>\n\n <input\n type=\"checkbox\"\n class=\"sr-only\"\n ?disabled=${isDisabled}\n ?checked=${isChecked}\n @change=${(evt: Event) => {\n if (isReadonly) return evt.preventDefault();\n evt.stopPropagation();\n\n if (isChecked) {\n config.splice(config.indexOf(type), 1);\n } else {\n config.push(type);\n }\n\n this.edit({ json: JSON.stringify(json) });\n }}\n />\n </label>\n </div>\n `;\n })}\n </div>\n\n <div class=\"flex flex-wrap p-s border-t border-contrast-10\">\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled || json.csc_requirements === 'new_cards_only'}\n ?readonly=${isReadonly}\n ?checked=${skipForSaved}\n @change=${(evt: CheckboxChangeEvent) => {\n json.csc_requirements = evt.detail ? 'sso_only' : 'all_cards';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"skip_csc_for_saved\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${skipForSSO}\n @change=${(evt: CheckboxChangeEvent) => {\n json.csc_requirements = evt.detail\n ? 'new_cards_only'\n : skipForSaved\n ? 'sso_only'\n : 'all_cards';\n\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"skip_csc_for_sso\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n </div>\n </x-group>\n\n <foxy-i18n\n class=\"text-xs leading-s block ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"supported_cards_disclaimer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n\n ${this.renderTemplateOrSlot('cards:after')}\n </div>\n `;\n }\n\n private __renderCheckoutType(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('checkout-type', true);\n const isReadonly = this.readonlySelector.matches('checkout-type', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('checkout-type:before')}\n\n <div class=\"space-y-xs\">\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"checkout_type\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n .items=${['default_account', 'default_guest', 'guest_only', 'account_only']}\n .value=${json.checkout_type}\n .getText=${(item: string) => this.t(`checkout_type_${item}`)}\n @change=${(evt: ChoiceChangeEvent) => {\n json.checkout_type = evt.detail as TemplateConfigJSON['checkout_type'];\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-choice>\n </x-group>\n\n <foxy-i18n\n class=\"text-xs leading-s block ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"checkout_type_helper_text\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n\n ${this.renderTemplateOrSlot('checkout-type:after')}\n </div>\n `;\n }\n\n private __renderConsent(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const tosConfig = json.tos_checkbox_settings;\n const mailConfig = json.newsletter_subscribe;\n const sdtaConfig = json.eu_secure_data_transfer_consent;\n const isDisabled = this.disabledSelector.matches('consent', true);\n const isReadonly = this.readonlySelector.matches('consent', true);\n const dividerStyle = 'margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('consent:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"consent\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${tosConfig.usage === 'required' || tosConfig.usage === 'optional'}\n class=\"m-m\"\n @change=${(evt: CheckboxChangeEvent) => {\n tosConfig.initial_state = evt.detail ? tosConfig.initial_state : 'unchecked';\n tosConfig.is_hidden = false;\n tosConfig.usage = evt.detail ? 'required' : 'none';\n tosConfig.url = evt.detail ? tosConfig.url : '';\n\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"display_tos_link\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"display_tos_link_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n\n <div slot=\"content\" ?hidden=${tosConfig.usage === 'none'}>\n <vaadin-text-field\n label=${this.t('location_url')}\n class=\"w-full mt-m\"\n placeholder=\"https://example.com/path/to/tos\"\n clear-button-visible\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n .value=${tosConfig.url}\n @input=${(evt: CustomEvent) => {\n tosConfig.url = (evt.currentTarget as TextFieldElement).value;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </vaadin-text-field>\n\n <div class=\"flex flex-wrap -mx-s -mb-s mt-s\">\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled}\n ?checked=${tosConfig.usage === 'required'}\n @change=${(evt: CheckboxChangeEvent) => {\n tosConfig.usage = evt.detail ? 'required' : 'optional';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"require_consent\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled}\n ?checked=${tosConfig.initial_state === 'checked'}\n @change=${(evt: CheckboxChangeEvent) => {\n tosConfig.initial_state = evt.detail ? 'checked' : 'unchecked';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"checked_by_default\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n </div>\n </div>\n </x-checkbox>\n\n <div style=${dividerStyle} class=\"border-b border-contrast-10\"></div>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${mailConfig.usage === 'required'}\n class=\"m-m\"\n @change=${(evt: CheckboxChangeEvent) => {\n mailConfig.usage = evt.detail ? 'required' : 'none';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"newsletter_subscribe\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"newsletter_subscribe_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n\n <div style=${dividerStyle} class=\"border-b border-contrast-10\"></div>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${sdtaConfig.usage === 'required'}\n class=\"m-m\"\n @change=${(evt: CheckboxChangeEvent) => {\n sdtaConfig.usage = evt.detail ? 'required' : 'none';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"display_sdta\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"display_sdta_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n </x-group>\n\n ${this.renderTemplateOrSlot('consent:before')}\n </div>\n `;\n }\n\n private __renderFields(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('fields', true);\n const isReadonly = this.readonlySelector.matches('fields', true);\n const config = json.custom_checkout_field_requirements;\n const options = {\n cart_controls: ['enabled', 'disabled'],\n coupon_entry: ['enabled', 'disabled'],\n billing_first_name: ['default', 'optional', 'required', 'hidden'],\n billing_last_name: ['default', 'optional', 'required', 'hidden'],\n billing_company: ['default', 'optional', 'required', 'hidden'],\n billing_tax_id: ['default', 'optional', 'required', 'hidden'],\n billing_phone: ['default', 'optional', 'required', 'hidden'],\n billing_address1: ['default', 'optional', 'required', 'hidden'],\n billing_address2: ['default', 'optional', 'required', 'hidden'],\n billing_city: ['default', 'optional', 'required', 'hidden'],\n billing_region: ['default', 'optional', 'required', 'hidden'],\n billing_postal_code: ['default', 'optional', 'required', 'hidden'],\n billing_country: ['default', 'optional', 'required', 'hidden'],\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('fields:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"field_plural\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"bg-contrast-10 grid grid-cols-1 md-grid-cols-2\" style=\"gap: 1px\">\n ${Object.entries(options).map(([property, values]) => {\n return html`\n <label\n class=${classMap({\n 'flex items-center pl-m bg-base': true,\n 'text-secondary': isReadonly,\n 'text-disabled': isDisabled,\n })}\n >\n <foxy-i18n\n class=\"flex-1\"\n lang=${lang}\n key=${property.replace('billing_', '')}\n ns=${ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'flex items-center text-right font-medium h-s px-s m-xs': isReadonly,\n 'hidden': !isReadonly,\n })}\n >\n ${this.t(\n values.find(\n value => (config as Record<string, string>)[property] === value\n ) as string\n )}\n </div>\n\n <div\n class=${classMap({\n 'px-s m-xs flex items-center rounded leading-none': true,\n 'ring-primary-50 ring-inset focus-within-ring-2': !isDisabled,\n 'hover-text-primary': !isDisabled,\n 'cursor-pointer': !isDisabled,\n 'cursor-default': isDisabled,\n 'flex': !isReadonly,\n 'hidden': isReadonly,\n })}\n >\n <select\n class=${classMap({\n 'h-s mr-xs text-right appearance-none bg-transparent font-medium': true,\n 'focus-outline-none cursor-pointer': !isDisabled,\n 'cursor-default': isDisabled,\n })}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: Event) => {\n const select = evt.currentTarget as HTMLSelectElement;\n const value = select.options[select.options.selectedIndex].value;\n (config as Record<string, string>)[property] = value;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n ${values.map(value => {\n return html`\n <option\n value=${value}\n ?selected=${(config as Record<string, string>)[property] === value}\n >\n ${this.t(value)}\n </option>\n `;\n })}\n </select>\n\n <iron-icon\n class=\"pointer-events-none icon-inline text-xl\"\n icon=\"icons:expand-more\"\n >\n </iron-icon>\n </div>\n </label>\n `;\n })}\n\n <div class=\"bg-base hidden md-block\"></div>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('fields:after')}\n </div>\n `;\n }\n\n private __renderGoogleAnalytics(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const config = json.analytics_config;\n const sioConfig = config.segment_io;\n const gaConfig = config.google_analytics;\n const isDisabled = this.disabledSelector.matches('google-analytics', true);\n const isReadonly = this.readonlySelector.matches('google-analytics', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('google-analytics:before')}\n\n <x-group frame>\n <span class=${isDisabled ? 'text-disabled' : ''} slot=\"header\">Google Analytics</span>\n\n <div class=\"p-m space-y-m\">\n <vaadin-text-field\n class=\"w-full\"\n label=${this.t('ga_account_id')}\n placeholder=\"UA-1234567-1\"\n helper-text=${this.t('ga_account_id_explainer')}\n .value=${live(gaConfig.account_id)}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n clear-button-visible\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n gaConfig.account_id = (evt.currentTarget as TextFieldElement).value;\n gaConfig.usage = gaConfig.account_id ? 'required' : 'none';\n config.usage = gaConfig.account_id || sioConfig.account_id ? 'required' : 'none';\n }}\n >\n </vaadin-text-field>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${gaConfig.include_on_site}\n @change=${(evt: CheckboxChangeEvent) => {\n gaConfig.include_on_site = evt.detail;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"ga_include_on_site\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"ga_include_on_site_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('google-analytics:after')}\n </div>\n `;\n }\n\n private __renderSegmentIo(json: TemplateConfigJSON) {\n const config = json.analytics_config;\n const sioConfig = config.segment_io;\n const gaConfig = config.google_analytics;\n const isDisabled = this.disabledSelector.matches('segment-io', true);\n const isReadonly = this.readonlySelector.matches('segment-io', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('segment-io:before')}\n\n <x-group frame>\n <span class=${isDisabled ? 'text-disabled' : ''} slot=\"header\">Segment.io</span>\n\n <div class=\"p-m\">\n <vaadin-text-field\n class=\"w-full\"\n label=${this.t('sio_account_id')}\n placeholder=\"MY-WRITE-KEY\"\n helper-text=${this.t('sio_account_id_explainer')}\n .value=${live(sioConfig.account_id)}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n clear-button-visible\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n sioConfig.account_id = (evt.currentTarget as TextFieldElement).value;\n sioConfig.usage = sioConfig.account_id ? 'required' : 'none';\n config.usage = gaConfig.account_id || sioConfig.account_id ? 'required' : 'none';\n }}\n >\n </vaadin-text-field>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('segment-io:after')}\n </div>\n `;\n }\n\n private __renderTroubleshooting(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const config = json.debug;\n const isDisabled = this.disabledSelector.matches('troubleshooting', true);\n const isReadonly = this.readonlySelector.matches('troubleshooting', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('troubleshooting:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"troubleshooting\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"p-m space-y-m\">\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${config.usage === 'required'}\n @change=${(evt: CheckboxChangeEvent) => {\n config.usage = evt.detail ? 'required' : 'none';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"troubleshooting_debug\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"troubleshooting_debug_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('troubleshooting:after')}\n </div>\n `;\n }\n\n private __renderCustomConfig(json: TemplateConfigJSON) {\n return html`\n <div>\n ${this.renderTemplateOrSlot('custom-config:before')}\n\n <vaadin-text-area\n class=\"w-full\"\n label=${this.t('custom_config')}\n placeholder='{ \"key\": \"value\" }'\n helper-text=${this.t('custom_config_helper_text')}\n .value=${json.custom_config ? JSON.stringify(json.custom_config, null, 2) : ''}\n ?disabled=${this.disabledSelector.matches('custom-config', true)}\n ?readonly=${this.readonlySelector.matches('custom-config', true)}\n @input=${(evt: CustomEvent) => {\n const input = evt.currentTarget as TextAreaElement;\n\n try {\n json.custom_config = input.value ? JSON.parse(input.value) : '';\n this.edit({ json: JSON.stringify(json) });\n input.invalid = false;\n } catch {\n input.invalid = true;\n }\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('custom-config:after')}\n </div>\n `;\n }\n\n private __renderHeader(json: TemplateConfigJSON) {\n return html`\n <div>\n ${this.renderTemplateOrSlot('header:before')}\n\n <vaadin-text-area\n class=\"w-full\"\n label=${this.t('custom_header')}\n helper-text=${this.t('custom_header_helper_text')}\n .value=${json.custom_script_values.header}\n ?disabled=${this.disabledSelector.matches('header', true)}\n ?readonly=${this.readonlySelector.matches('header', true)}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextAreaElement;\n const newConfig: TemplateConfigJSON['custom_script_values'] = {\n ...json.custom_script_values,\n header: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n }\n\n private __renderCustomFields(json: TemplateConfigJSON) {\n return html`\n <div>\n ${this.renderTemplateOrSlot('custom-fields:before')}\n\n <vaadin-text-area\n class=\"w-full\"\n label=${this.t('custom_fields')}\n helper-text=${this.t('custom_fields_helper_text')}\n .value=${json.custom_script_values.header}\n ?disabled=${this.disabledSelector.matches('header', true)}\n ?readonly=${this.readonlySelector.matches('header', true)}\n @input=${(evt: CustomEvent) => {\n const newValue = (evt.currentTarget as TextAreaElement).value;\n json.custom_script_values.checkout_fields = newValue;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('custom-fields:after')}\n </div>\n `;\n }\n\n private __renderFooter(json: TemplateConfigJSON) {\n return html`\n <div>\n ${this.renderTemplateOrSlot('footer:before')}\n\n <vaadin-text-area\n class=\"w-full\"\n label=${this.t('custom_footer')}\n helper-text=${this.t('custom_footer_helper_text')}\n .value=${json.custom_script_values.footer}\n ?disabled=${this.disabledSelector.matches('footer', true)}\n ?readonly=${this.readonlySelector.matches('footer', true)}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextAreaElement;\n const newConfig: TemplateConfigJSON['custom_script_values'] = {\n ...json.custom_script_values,\n footer: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('footer:after')}\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"TemplateConfigForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/TemplateConfigForm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,sCAAmC;AAEpD,OAAO,EAAuB,iBAAiB,EAAE,gCAA6B;AAE9E,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,2CAAwC;AAC3D,OAAO,EAAE,MAAM,EAAE,uCAAoC;AACrD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,aAAa,EAAE,2BAAwB;AAChD,OAAO,EAAE,KAAK,EAAE,qCAAkC;AAClD,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAElE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAG7D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,cAAc,EAAE,sBAAmB;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,mBAAmB,CAC9B,eAAe,CAAC,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1F,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU;IAAlD;;QAyBE,cAAS,GAAc,EAAE,CAAC;QAE1B,+CAA+C;QAC/C,cAAS,GAAG,EAAE,CAAC;QAEf,6CAA6C;QAC7C,YAAO,GAAG,EAAE,C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AAC,oBAAoB,CAAC,eAAe,GAAG,QAAQ,CAAC;YACrD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5C,CAAC;;;;UAID,IAAI,CAAC,oBAAoB,CAAC,qBAAqB,CAAC;;KAErD,CAAC;IACJ,CAAC;IAEO,cAAc,CAAC,IAAwB;QAC7C,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC;;;;;kBAKlC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC;wBACjB,IAAI,CAAC,CAAC,CAAC,2BAA2B,CAAC;mBACxC,IAAI,CAAC,oBAAoB,CAAC,MAAM;sBAC7B,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;sBACjE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;mBAChD,CAAC,GAAgB,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,aAAgC,CAAC;YACpD,MAAM,SAAS,GAA+C;gBAC5D,GAAG,IAAI,CAAC,oBAAoB;gBAC5B,MAAM,EAAE,MAAM,CAAC,KAAK;aACrB,CAAC;YAEF,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,oBAAoB,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;;;;UAID,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import * as logos from '../PaymentMethodCard/logos';\n\nimport { CheckboxChangeEvent, ChoiceChangeEvent } from '../../private/events';\nimport { Data, TemplateConfigJSON, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { Checkbox } from '../../private/Checkbox/Checkbox';\nimport { Choice } from '../../private/Choice/Choice';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { CountriesList } from './CountriesList';\nimport { Group } from '../../private/Group/Group';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { getDefaultJSON } from './defaults';\nimport { live } from 'lit-html/directives/live';\n\nconst NS = 'template-config-form';\nconst Base = ScopedElementsMixin(\n ResponsiveMixin(ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS))))\n);\n\n/**\n * Form element for creating or editing template configs (`fx:template_config`).\n *\n * @slot cart-type:before\n * @slot cart-type:after\n *\n * @slot foxycomplete:before\n * @slot foxycomplete:after\n *\n * @slot locations:before\n * @slot locations:after\n *\n * @slot hidden-fields:before\n * @slot hidden-fields:after\n *\n * @slot cards:before\n * @slot cards:after\n *\n * @slot checkout-type:before\n * @slot checkout-type:after\n *\n * @slot consent:before\n * @slot consent:after\n *\n * @slot fields:before\n * @slot fields:after\n *\n * @slot google-analytics:before\n * @slot google-analytics:after\n *\n * @slot segment-io:before\n * @slot segment-io:after\n *\n * @slot troubleshooting:before\n * @slot troubleshooting:after\n *\n * @slot custom-config:before\n * @slot custom-config:after\n *\n * @slot header:before\n * @slot header:after\n *\n * @slot custom-fields:before\n * @slot custom-fields:after\n *\n * @slot footer:before\n * @slot footer:after\n *\n * @element foxy-template-config-form\n * @since 1.14.0\n */\nexport class TemplateConfigForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'iron-icon': customElements.get('iron-icon'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'x-countries-list': CountriesList,\n 'x-checkbox': Checkbox,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __addHiddenFieldInputValue: { attribute: false },\n countries: { type: String },\n regions: { type: String },\n };\n }\n\n templates: Templates = {};\n\n /** URI of the `fx:countries` hAPI resource. */\n countries = '';\n\n /** URI of the `fx:regions` hAPI resource. */\n regions = '';\n\n private __addHiddenFieldInputValue = '';\n\n render(): TemplateResult {\n const hidden = this.hiddenSelector;\n const json: TemplateConfigJSON = this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();\n\n return html`\n <div class=\"relative\" aria-busy=${this.in('busy')} aria-live=\"polite\">\n <div\n class=${classMap({\n 'space-y-l transition-opacity': true,\n 'opacity-50': !this.in('idle'),\n })}\n >\n ${hidden.matches('cart-type', true) ? '' : this.__renderCartType(json)}\n ${hidden.matches('foxycomplete', true) ? '' : this.__renderFoxycomplete(json)}\n ${hidden.matches('locations', true) ? '' : this.__renderLocations(json)}\n ${hidden.matches('hidden-fields', true) ? '' : this.__renderHiddenFields(json)}\n ${hidden.matches('cards', true) ? '' : this.__renderCards(json)}\n ${hidden.matches('checkout-type', true) ? '' : this.__renderCheckoutType(json)}\n ${hidden.matches('consent', true) ? '' : this.__renderConsent(json)}\n ${hidden.matches('fields', true) ? '' : this.__renderFields(json)}\n ${hidden.matches('google-analytics', true) ? '' : this.__renderGoogleAnalytics(json)}\n ${hidden.matches('segment-io', true) ? '' : this.__renderSegmentIo(json)}\n ${hidden.matches('troubleshooting', true) ? '' : this.__renderTroubleshooting(json)}\n ${hidden.matches('custom-config', true) ? '' : this.__renderCustomConfig(json)}\n ${hidden.matches('header', true) ? '' : this.__renderHeader(json)}\n ${hidden.matches('custom-fields', true) ? '' : this.__renderCustomFields(json)}\n ${hidden.matches('footer', true) ? '' : this.__renderFooter(json)}\n </div>\n\n <div\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': this.in('idle'),\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${this.in('fail') ? 'error' : 'busy'}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderCartType(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const items = ['default', 'fullpage', 'custom'];\n const isDisabled = !this.in('idle') || this.disabledSelector.matches('cart-type', true);\n\n return html`\n <div data-testid=\"cart-type\">\n ${this.renderTemplateOrSlot('cart-type:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"cart_type\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"cart-type-choice\"\n .value=${json.cart_type}\n .items=${items}\n ?disabled=${isDisabled}\n ?readonly=${this.readonlySelector.matches('cart-type', true)}\n @change=${(evt: ChoiceChangeEvent) => {\n this.edit({ json: JSON.stringify({ ...json, cart_type: evt.detail }) });\n }}\n >\n ${items.map(item => {\n return html`\n <div slot=\"${item}-label\" class=\"grid leading-s py-s\">\n <foxy-i18n lang=${lang} key=\"cart_type_${item}\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"cart_type_${item}_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n </x-choice>\n </x-group>\n\n ${this.renderTemplateOrSlot('cart-type:after')}\n </div>\n `;\n }\n\n private __renderFoxycomplete(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('foxycomplete', true);\n const isReadonly = this.readonlySelector.matches('foxycomplete', true);\n const items = ['combobox', 'search', 'disabled'];\n const value =\n json.foxycomplete.usage === 'none'\n ? 'disabled'\n : json.foxycomplete.show_combobox\n ? 'combobox'\n : 'search';\n\n const renderFlagsCheckbox = () => html`\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${json.foxycomplete.show_flags}\n @change=${(evt: CheckboxChangeEvent) => {\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n show_flags: evt.detail,\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n <foxy-i18n lang=${lang} key=\"show_country_flags\" ns=${ns}></foxy-i18n>\n </x-checkbox>\n `;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('foxycomplete:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"foxycomplete\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n .value=${value}\n .items=${items}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: Event) => {\n if (!(evt instanceof ChoiceChangeEvent)) return;\n\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n usage: evt.detail === 'disabled' ? 'none' : 'required',\n show_combobox: evt.detail === 'combobox',\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n ${items.map(item => {\n return html`\n <div slot=\"${item}-label\" class=\"grid leading-s py-s\">\n <foxy-i18n lang=${lang} key=\"foxycomplete_${item}\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"foxycomplete_${item}_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"combobox\" class=\"space-y-m pb-s\" ?hidden=${value !== 'combobox'}>\n <div class=\"grid grid-cols-2 gap-m\" style=\"max-width: 16rem\">\n ${['open', 'close'].map(action => {\n const field = action === 'open' ? 'combobox_open' : 'combobox_close';\n\n return html`\n <vaadin-text-field\n label=${this.t(`${action}_icon`)}\n .value=${json.foxycomplete[field]}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextFieldElement;\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n [field]: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n </vaadin-text-field>\n `;\n })}\n </div>\n\n ${renderFlagsCheckbox()}\n </div>\n\n <div slot=\"search\" class=\"pb-s\" ?hidden=${value !== 'search'}>\n ${renderFlagsCheckbox()}\n </div>\n </x-choice>\n\n <div class=\"border-t border-contrast-10 p-m\">\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${json.postal_code_lookup.usage === 'enabled'}\n @change=${(evt: CheckboxChangeEvent) => {\n const newConfig: TemplateConfigJSON['postal_code_lookup'] = {\n usage: evt.detail ? 'enabled' : 'none',\n };\n\n this.edit({ json: JSON.stringify({ ...json, postal_code_lookup: newConfig }) });\n }}\n >\n <foxy-i18n lang=${lang} key=\"enable_postcode_lookup\" ns=${ns}></foxy-i18n>\n </x-checkbox>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('foxycomplete:after')}\n </div>\n `;\n }\n\n private __renderLocations(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const config = json.location_filtering;\n const isDisabled = this.disabledSelector.matches('locations', true);\n const isReadonly = this.readonlySelector.matches('locations', true);\n\n const shippingChoice = config.shipping_filter_type === 'blacklist' ? 'block' : 'allow';\n const billingChoice =\n config.usage === 'both'\n ? 'copy'\n : config.billing_filter_type === 'blacklist'\n ? 'block'\n : 'allow';\n\n const normalize = () => {\n if (config.usage === 'both') {\n config.billing_filter_type = config.shipping_filter_type;\n config.billing_filter_values = config.shipping_filter_values;\n } else {\n const hasBillingFilters = Object.keys(config.billing_filter_values).length > 0;\n const hasShippingFilters = Object.keys(config.shipping_filter_values).length > 0;\n\n if (!hasBillingFilters && !hasShippingFilters) {\n config.usage = 'none';\n } else if (hasBillingFilters && !hasShippingFilters) {\n config.usage = 'billing';\n } else if (hasShippingFilters && !hasBillingFilters) {\n config.usage = 'shipping';\n } else {\n config.usage = 'independent';\n }\n }\n };\n\n return html`\n ${this.renderTemplateOrSlot('locations:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"location_plural\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"grid sm-grid-cols-2 bg-contrast-10\" style=\"gap: 1px\">\n <x-group class=\"bg-base pt-m\">\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : 'text-tertiary'}\n slot=\"header\"\n lang=${lang}\n key=\"shipping\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n .items=${['allow', 'block']}\n .value=${shippingChoice}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: ChoiceChangeEvent) => {\n if (config.usage !== 'both') config.usage = 'independent';\n config.shipping_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n slot=\"allow-label\" lang=${lang} key=\"allowlist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"block-label\" lang=${lang} key=\"blocklist\" ns=${ns}></foxy-i18n>\n\n <x-countries-list\n countries=${JSON.stringify(config.shipping_filter_values)}\n regions=${this.regions}\n class=\"mb-m\"\n href=${this.countries}\n slot=${shippingChoice}\n lang=${lang}\n ns=${ns}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @update:countries=${(evt: CustomEvent) => {\n config.shipping_filter_values = (evt.currentTarget as CountriesList).countries;\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-countries-list>\n </x-choice>\n </x-group>\n\n <x-group class=\"bg-base pt-m\">\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : 'text-tertiary'}\n slot=\"header\"\n lang=${lang}\n key=\"billing\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n .items=${['allow', 'block', 'copy']}\n .value=${billingChoice}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: ChoiceChangeEvent) => {\n if (evt.detail === 'copy') {\n config.usage = 'both';\n } else {\n config.usage = 'independent';\n config.billing_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';\n }\n\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n slot=\"allow-label\" lang=${lang} key=\"allowlist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"block-label\" lang=${lang} key=\"blocklist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"copy-label\" lang=${lang} key=\"same_as_shipping\" ns=${ns}></foxy-i18n>\n\n <x-countries-list\n countries=${JSON.stringify(config.billing_filter_values)}\n regions=${this.regions}\n class=\"mb-m\"\n href=${this.countries}\n slot=${billingChoice}\n lang=${lang}\n ns=${ns}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?hidden=${billingChoice === 'copy'}\n @update:countries=${(evt: CustomEvent) => {\n config.billing_filter_values = (evt.currentTarget as CountriesList).countries;\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-countries-list>\n </x-choice>\n </x-group>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('locations:after')}\n `;\n }\n\n private __renderHiddenFields(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const suggestions = [] as string[];\n const fields = [] as string[];\n const config = json.cart_display_config;\n const isDisabled = this.disabledSelector.matches('hidden-fields', true);\n const isReadonly = this.readonlySelector.matches('hidden-fields', true);\n\n type FieldName = keyof Omit<\n TemplateConfigJSON['cart_display_config'],\n 'hidden_product_options' | 'usage'\n >;\n\n for (const key in config) {\n if (!key.startsWith('show_')) continue;\n const field = key.substring(5);\n suggestions.push(field);\n if (config.usage === 'required' && !config[key as FieldName]) fields.push(field);\n }\n\n if (config.usage === 'required') {\n fields.push(...config.hidden_product_options);\n }\n\n const addField = () => {\n config.usage = 'required';\n\n if (suggestions.includes(this.__addHiddenFieldInputValue)) {\n config[`show_${this.__addHiddenFieldInputValue}` as FieldName] = false;\n } else if (!config.hidden_product_options.includes(this.__addHiddenFieldInputValue)) {\n config.hidden_product_options.push(this.__addHiddenFieldInputValue);\n }\n\n this.edit({ json: JSON.stringify(json) });\n this.__addHiddenFieldInputValue = '';\n };\n\n const radius = 'calc(var(--lumo-border-radius-l) / 1.2)';\n const inputRadius = fields.length === 0 ? [radius] : ['0', '0', radius, radius];\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('hidden-fields:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"hidden_fields\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"divide-y divide-contrast-10\">\n ${fields.map(field => {\n return html`\n <div\n class=${classMap({\n 'h-m ml-m pr-xs flex items-center justify-between': true,\n 'text-secondary': isReadonly,\n 'text-disabled': isDisabled,\n })}\n >\n ${suggestions.includes(field)\n ? html`<foxy-i18n lang=${lang} key=${field} ns=${ns}></foxy-i18n>`\n : html`<span>${field}</span>`}\n\n <button\n class=${classMap({\n 'w-xs h-xs rounded-full transition-colors': true,\n 'hover-bg-error-10 hover-text-error': !isDisabled,\n 'focus-outline-none focus-ring-2 ring-inset ring-error-50': !isDisabled,\n 'cursor-default': isDisabled,\n 'flex': !isReadonly,\n 'hidden': isReadonly,\n })}\n ?disabled=${isDisabled}\n @click=${() => {\n if (typeof config[`show_${field}` as FieldName] === 'boolean') {\n config[`show_${field}` as FieldName] = true;\n } else {\n config.hidden_product_options = config.hidden_product_options.filter(\n option => option !== field\n );\n }\n\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <iron-icon icon=\"icons:close\" class=\"icon-inline text-m m-auto\"></iron-icon>\n </button>\n </div>\n `;\n })}\n </div>\n\n <div\n style=\"border-radius: ${inputRadius.join(' ')}\"\n class=${classMap({\n 'h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2': true,\n 'border-t border-contrast-10': fields.length > 0,\n 'flex': !isReadonly,\n 'hidden': isReadonly,\n })}\n >\n <input\n placeholder=${this.t('add_field')}\n class=\"w-full bg-transparent appearance-none h-m px-m focus-outline-none\"\n list=\"hidden-fields-list\"\n .value=${live(this.__addHiddenFieldInputValue)}\n ?disabled=${isDisabled}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addField()}\n @input=${(evt: InputEvent) => {\n this.__addHiddenFieldInputValue = (evt.currentTarget as HTMLInputElement).value;\n }}\n />\n\n <datalist id=\"hidden-fields-list\">\n ${suggestions\n .filter(suggestion => !fields.includes(suggestion))\n .map(\n suggestion => html`<option value=${suggestion}>${this.t(suggestion)}</option>`\n )}\n </datalist>\n\n <button\n aria-label=${this.t('add_field')}\n class=${classMap({\n 'w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50': true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': !this.__addHiddenFieldInputValue,\n 'bg-success-10 text-success cursor-pointer': !!this.__addHiddenFieldInputValue,\n 'hover-bg-success hover-text-success-contrast': !!this.__addHiddenFieldInputValue,\n 'focus-outline-none focus-ring-2': !!this.__addHiddenFieldInputValue,\n })}\n ?disabled=${!this.__addHiddenFieldInputValue}\n @click=${addField}\n >\n <iron-icon icon=\"icons:add\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('hidden-fields:after')}\n </div>\n `;\n }\n\n private __renderCards(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('cards', true);\n const isReadonly = this.readonlySelector.matches('cards', true);\n const config = json.supported_payment_cards as string[];\n\n let skipForSaved: boolean;\n let skipForSSO: boolean;\n\n if (json.csc_requirements === 'all_cards') {\n skipForSaved = false;\n skipForSSO = false;\n } else if (json.csc_requirements === 'sso_only') {\n skipForSaved = true;\n skipForSSO = false;\n } else {\n skipForSaved = true;\n skipForSSO = true;\n }\n\n const typeToName: Record<string, string> = {\n amex: 'American Express',\n diners: 'Diners Club',\n discover: 'Discover',\n jcb: 'JCB',\n maestro: 'Maestro',\n mastercard: 'Mastercard',\n unionpay: 'UnionPay',\n visa: 'Visa',\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('cards:before')}\n\n <div class=\"space-y-xs\">\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"supported_cards\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"flex flex-wrap m-xs p-s\">\n ${Object.entries(logos).map(([type, logo]) => {\n if (!typeToName[type]) return;\n const isChecked = config.includes(type);\n\n return html`\n <div\n class=${classMap({\n 'm-xs rounded': true,\n 'opacity-50 cursor-default': isDisabled,\n 'cursor-pointer ring-primary-50 focus-within-ring-2': !isDisabled,\n })}\n >\n <label\n class=${classMap({\n 'overflow-hidden transition-colors flex rounded border': true,\n 'border-primary bg-primary-10 text-primary': isChecked && !isReadonly,\n 'border-contrast bg-contrast-5 text-secondary': isChecked && isReadonly,\n 'hover-text-body': isChecked && !isDisabled && !isReadonly,\n 'border-contrast-10': !isChecked,\n 'hover-border-primary': !isChecked && !isDisabled && !isReadonly,\n 'hover-text-primary': !isChecked && !isDisabled && !isReadonly,\n })}\n >\n <div class=\"h-s\">${logo}</div>\n\n <div class=\"text-s font-medium mx-s my-auto leading-none\">\n ${typeToName[type]}\n </div>\n\n <input\n type=\"checkbox\"\n class=\"sr-only\"\n ?disabled=${isDisabled}\n ?checked=${isChecked}\n @change=${(evt: Event) => {\n if (isReadonly) return evt.preventDefault();\n evt.stopPropagation();\n\n if (isChecked) {\n config.splice(config.indexOf(type), 1);\n } else {\n config.push(type);\n }\n\n this.edit({ json: JSON.stringify(json) });\n }}\n />\n </label>\n </div>\n `;\n })}\n </div>\n\n <div class=\"flex flex-wrap p-s border-t border-contrast-10\">\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled || json.csc_requirements === 'new_cards_only'}\n ?readonly=${isReadonly}\n ?checked=${skipForSaved}\n @change=${(evt: CheckboxChangeEvent) => {\n json.csc_requirements = evt.detail ? 'sso_only' : 'all_cards';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"skip_csc_for_saved\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${skipForSSO}\n @change=${(evt: CheckboxChangeEvent) => {\n json.csc_requirements = evt.detail\n ? 'new_cards_only'\n : skipForSaved\n ? 'sso_only'\n : 'all_cards';\n\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"skip_csc_for_sso\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n </div>\n </x-group>\n\n <foxy-i18n\n class=\"text-xs leading-s block ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"supported_cards_disclaimer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n\n ${this.renderTemplateOrSlot('cards:after')}\n </div>\n `;\n }\n\n private __renderCheckoutType(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = !this.in('idle') || this.disabledSelector.matches('checkout-type', true);\n const isReadonly = this.readonlySelector.matches('checkout-type', true);\n\n return html`\n <div data-testid=\"checkout-type\">\n ${this.renderTemplateOrSlot('checkout-type:before')}\n\n <div class=\"space-y-xs\">\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"checkout_type\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"checkout-type-choice\"\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n .items=${['default_account', 'default_guest', 'guest_only', 'account_only']}\n .value=${json.checkout_type}\n .getText=${(item: string) => this.t(`checkout_type_${item}`)}\n @change=${(evt: ChoiceChangeEvent) => {\n json.checkout_type = evt.detail as TemplateConfigJSON['checkout_type'];\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-choice>\n </x-group>\n\n <foxy-i18n\n class=\"text-xs leading-s block ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"checkout_type_helper_text\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n\n ${this.renderTemplateOrSlot('checkout-type:after')}\n </div>\n `;\n }\n\n private __renderConsent(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const tosConfig = json.tos_checkbox_settings;\n const mailConfig = json.newsletter_subscribe;\n const sdtaConfig = json.eu_secure_data_transfer_consent;\n const isDisabled = this.disabledSelector.matches('consent', true);\n const isReadonly = this.readonlySelector.matches('consent', true);\n const dividerStyle = 'margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('consent:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"consent\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${tosConfig.usage === 'required' || tosConfig.usage === 'optional'}\n class=\"m-m\"\n @change=${(evt: CheckboxChangeEvent) => {\n tosConfig.initial_state = evt.detail ? tosConfig.initial_state : 'unchecked';\n tosConfig.is_hidden = false;\n tosConfig.usage = evt.detail ? 'required' : 'none';\n tosConfig.url = evt.detail ? tosConfig.url : '';\n\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"display_tos_link\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"display_tos_link_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n\n <div slot=\"content\" ?hidden=${tosConfig.usage === 'none'}>\n <vaadin-text-field\n label=${this.t('location_url')}\n class=\"w-full mt-m\"\n placeholder=\"https://example.com/path/to/tos\"\n clear-button-visible\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n .value=${tosConfig.url}\n @input=${(evt: CustomEvent) => {\n tosConfig.url = (evt.currentTarget as TextFieldElement).value;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </vaadin-text-field>\n\n <div class=\"flex flex-wrap -mx-s -mb-s mt-s\">\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled}\n ?checked=${tosConfig.usage === 'required'}\n @change=${(evt: CheckboxChangeEvent) => {\n tosConfig.usage = evt.detail ? 'required' : 'optional';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"require_consent\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n\n <x-checkbox\n class=\"m-s\"\n ?disabled=${isDisabled}\n ?checked=${tosConfig.initial_state === 'checked'}\n @change=${(evt: CheckboxChangeEvent) => {\n tosConfig.initial_state = evt.detail ? 'checked' : 'unchecked';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n class=\"leading-s block\" lang=${lang} key=\"checked_by_default\" ns=${ns}>\n </foxy-i18n>\n </x-checkbox>\n </div>\n </div>\n </x-checkbox>\n\n <div style=${dividerStyle} class=\"border-b border-contrast-10\"></div>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${mailConfig.usage === 'required'}\n class=\"m-m\"\n @change=${(evt: CheckboxChangeEvent) => {\n mailConfig.usage = evt.detail ? 'required' : 'none';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"newsletter_subscribe\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"newsletter_subscribe_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n\n <div style=${dividerStyle} class=\"border-b border-contrast-10\"></div>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${sdtaConfig.usage === 'required'}\n class=\"m-m\"\n @change=${(evt: CheckboxChangeEvent) => {\n sdtaConfig.usage = evt.detail ? 'required' : 'none';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"display_sdta\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"display_sdta_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n </x-group>\n\n ${this.renderTemplateOrSlot('consent:before')}\n </div>\n `;\n }\n\n private __renderFields(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('fields', true);\n const isReadonly = this.readonlySelector.matches('fields', true);\n const config = json.custom_checkout_field_requirements;\n const options = {\n cart_controls: ['enabled', 'disabled'],\n coupon_entry: ['enabled', 'disabled'],\n billing_first_name: ['default', 'optional', 'required', 'hidden'],\n billing_last_name: ['default', 'optional', 'required', 'hidden'],\n billing_company: ['default', 'optional', 'required', 'hidden'],\n billing_tax_id: ['default', 'optional', 'required', 'hidden'],\n billing_phone: ['default', 'optional', 'required', 'hidden'],\n billing_address1: ['default', 'optional', 'required', 'hidden'],\n billing_address2: ['default', 'optional', 'required', 'hidden'],\n billing_city: ['default', 'optional', 'required', 'hidden'],\n billing_region: ['default', 'optional', 'required', 'hidden'],\n billing_postal_code: ['default', 'optional', 'required', 'hidden'],\n billing_country: ['default', 'optional', 'required', 'hidden'],\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('fields:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"field_plural\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"bg-contrast-10 grid grid-cols-1 md-grid-cols-2\" style=\"gap: 1px\">\n ${Object.entries(options).map(([property, values]) => {\n return html`\n <label\n class=${classMap({\n 'flex items-center pl-m bg-base': true,\n 'text-secondary': isReadonly,\n 'text-disabled': isDisabled,\n })}\n >\n <foxy-i18n\n class=\"flex-1\"\n lang=${lang}\n key=${property.replace('billing_', '')}\n ns=${ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'flex items-center text-right font-medium h-s px-s m-xs': isReadonly,\n 'hidden': !isReadonly,\n })}\n >\n ${this.t(\n values.find(\n value => (config as Record<string, string>)[property] === value\n ) as string\n )}\n </div>\n\n <div\n class=${classMap({\n 'px-s m-xs flex items-center rounded leading-none': true,\n 'ring-primary-50 ring-inset focus-within-ring-2': !isDisabled,\n 'hover-text-primary': !isDisabled,\n 'cursor-pointer': !isDisabled,\n 'cursor-default': isDisabled,\n 'flex': !isReadonly,\n 'hidden': isReadonly,\n })}\n >\n <select\n class=${classMap({\n 'h-s mr-xs text-right appearance-none bg-transparent font-medium': true,\n 'focus-outline-none cursor-pointer': !isDisabled,\n 'cursor-default': isDisabled,\n })}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: Event) => {\n const select = evt.currentTarget as HTMLSelectElement;\n const value = select.options[select.options.selectedIndex].value;\n (config as Record<string, string>)[property] = value;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n ${values.map(value => {\n return html`\n <option\n value=${value}\n ?selected=${(config as Record<string, string>)[property] === value}\n >\n ${this.t(value)}\n </option>\n `;\n })}\n </select>\n\n <iron-icon\n class=\"pointer-events-none icon-inline text-xl\"\n icon=\"icons:expand-more\"\n >\n </iron-icon>\n </div>\n </label>\n `;\n })}\n\n <div class=\"bg-base hidden md-block\"></div>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('fields:after')}\n </div>\n `;\n }\n\n private __renderGoogleAnalytics(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const config = json.analytics_config;\n const sioConfig = config.segment_io;\n const gaConfig = config.google_analytics;\n const isDisabled = this.disabledSelector.matches('google-analytics', true);\n const isReadonly = this.readonlySelector.matches('google-analytics', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('google-analytics:before')}\n\n <x-group frame>\n <span class=${isDisabled ? 'text-disabled' : ''} slot=\"header\">Google Analytics</span>\n\n <div class=\"p-m space-y-m\">\n <vaadin-text-field\n class=\"w-full\"\n label=${this.t('ga_account_id')}\n placeholder=\"UA-1234567-1\"\n helper-text=${this.t('ga_account_id_explainer')}\n .value=${live(gaConfig.account_id)}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n clear-button-visible\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n gaConfig.account_id = (evt.currentTarget as TextFieldElement).value;\n gaConfig.usage = gaConfig.account_id ? 'required' : 'none';\n config.usage = gaConfig.account_id || sioConfig.account_id ? 'required' : 'none';\n }}\n >\n </vaadin-text-field>\n\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${gaConfig.include_on_site}\n @change=${(evt: CheckboxChangeEvent) => {\n gaConfig.include_on_site = evt.detail;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"ga_include_on_site\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"ga_include_on_site_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('google-analytics:after')}\n </div>\n `;\n }\n\n private __renderSegmentIo(json: TemplateConfigJSON) {\n const config = json.analytics_config;\n const sioConfig = config.segment_io;\n const gaConfig = config.google_analytics;\n const isDisabled = this.disabledSelector.matches('segment-io', true);\n const isReadonly = this.readonlySelector.matches('segment-io', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('segment-io:before')}\n\n <x-group frame>\n <span class=${isDisabled ? 'text-disabled' : ''} slot=\"header\">Segment.io</span>\n\n <div class=\"p-m\">\n <vaadin-text-field\n class=\"w-full\"\n label=${this.t('sio_account_id')}\n placeholder=\"MY-WRITE-KEY\"\n helper-text=${this.t('sio_account_id_explainer')}\n .value=${live(sioConfig.account_id)}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n clear-button-visible\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n sioConfig.account_id = (evt.currentTarget as TextFieldElement).value;\n sioConfig.usage = sioConfig.account_id ? 'required' : 'none';\n config.usage = gaConfig.account_id || sioConfig.account_id ? 'required' : 'none';\n }}\n >\n </vaadin-text-field>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('segment-io:after')}\n </div>\n `;\n }\n\n private __renderTroubleshooting(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const config = json.debug;\n const isDisabled = this.disabledSelector.matches('troubleshooting', true);\n const isReadonly = this.readonlySelector.matches('troubleshooting', true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('troubleshooting:before')}\n\n <x-group frame>\n <foxy-i18n\n class=${isDisabled ? 'text-disabled' : ''}\n slot=\"header\"\n lang=${lang}\n key=\"troubleshooting\"\n ns=${ns}\n >\n </foxy-i18n>\n\n <div class=\"p-m space-y-m\">\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${config.usage === 'required'}\n @change=${(evt: CheckboxChangeEvent) => {\n config.usage = evt.detail ? 'required' : 'none';\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <div class=\"flex flex-col\">\n <foxy-i18n lang=${lang} key=\"troubleshooting_debug\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"troubleshooting_debug_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n </x-checkbox>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('troubleshooting:after')}\n </div>\n `;\n }\n\n private __renderCustomConfig(json: TemplateConfigJSON) {\n return html`\n <div data-testid=\"custom-config\">\n ${this.renderTemplateOrSlot('custom-config:before')}\n\n <vaadin-text-area\n data-testid=\"custom-config-field\"\n class=\"w-full\"\n label=${this.t('custom_config')}\n placeholder='{ \"key\": \"value\" }'\n helper-text=${this.t('custom_config_helper_text')}\n .value=${json.custom_config ? JSON.stringify(json.custom_config, null, 2) : ''}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches('custom-config', true)}\n ?readonly=${this.readonlySelector.matches('custom-config', true)}\n @input=${(evt: CustomEvent) => {\n const input = evt.currentTarget as TextAreaElement;\n\n try {\n json.custom_config = input.value ? JSON.parse(input.value) : '';\n this.edit({ json: JSON.stringify(json) });\n input.invalid = false;\n } catch {\n input.invalid = true;\n }\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('custom-config:after')}\n </div>\n `;\n }\n\n private __renderHeader(json: TemplateConfigJSON) {\n return html`\n <div data-testid=\"header\">\n ${this.renderTemplateOrSlot('header:before')}\n\n <vaadin-text-area\n data-testid=\"header-field\"\n class=\"w-full\"\n label=${this.t('custom_header')}\n helper-text=${this.t('custom_header_helper_text')}\n .value=${json.custom_script_values.header}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches('header', true)}\n ?readonly=${this.readonlySelector.matches('header', true)}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextAreaElement;\n const newConfig: TemplateConfigJSON['custom_script_values'] = {\n ...json.custom_script_values,\n header: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n }\n\n private __renderCustomFields(json: TemplateConfigJSON) {\n return html`\n <div data-testid=\"custom-fields\">\n ${this.renderTemplateOrSlot('custom-fields:before')}\n\n <vaadin-text-area\n data-testid=\"custom-fields-field\"\n class=\"w-full\"\n label=${this.t('custom_fields')}\n helper-text=${this.t('custom_fields_helper_text')}\n .value=${json.custom_script_values.checkout_fields}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches('custom-fields', true)}\n ?readonly=${this.readonlySelector.matches('custom-fields', true)}\n @input=${(evt: CustomEvent) => {\n const newValue = (evt.currentTarget as TextAreaElement).value;\n json.custom_script_values.checkout_fields = newValue;\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('custom-fields:after')}\n </div>\n `;\n }\n\n private __renderFooter(json: TemplateConfigJSON) {\n return html`\n <div data-testid=\"footer\">\n ${this.renderTemplateOrSlot('footer:before')}\n\n <vaadin-text-area\n data-testid=\"footer-field\"\n class=\"w-full\"\n label=${this.t('custom_footer')}\n helper-text=${this.t('custom_footer_helper_text')}\n .value=${json.custom_script_values.footer}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches('footer', true)}\n ?readonly=${this.readonlySelector.matches('footer', true)}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextAreaElement;\n const newConfig: TemplateConfigJSON['custom_script_values'] = {\n ...json.custom_script_values,\n footer: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('footer:after')}\n </div>\n `;\n }\n}\n"]}
@@ -7,6 +7,27 @@ declare const Base: typeof NucleonElement & import("lit-element").Constructor<im
7
7
  } & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost> & {
8
8
  styles: CSSResultArray;
9
9
  } & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost>;
10
+ /**
11
+ * Form element for creating or editing templates (`fx:cart_include_template`, `fx:checkout_template`, `fx:cart_template`).
12
+ *
13
+ * @slot description:before
14
+ * @slot description:after
15
+ *
16
+ * @slot content:before
17
+ * @slot content:after
18
+ *
19
+ * @slot timestamps:before
20
+ * @slot timestamps:after
21
+ *
22
+ * @slot create:before
23
+ * @slot create:after
24
+ *
25
+ * @slot delete:before
26
+ * @slot delete:after
27
+ *
28
+ * @element foxy-template-form
29
+ * @since 1.14.0
30
+ */
10
31
  export declare class TemplateForm extends Base<Data> {
11
32
  static get properties(): PropertyDeclarations;
12
33
  static get styles(): CSSResultArray;
@@ -10,6 +10,27 @@ import { classMap } from "../../../utils/class-map.js";
10
10
  import { live } from 'lit-html/directives/live';
11
11
  const NS = 'template-form';
12
12
  const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS))));
13
+ /**
14
+ * Form element for creating or editing templates (`fx:cart_include_template`, `fx:checkout_template`, `fx:cart_template`).
15
+ *
16
+ * @slot description:before
17
+ * @slot description:after
18
+ *
19
+ * @slot content:before
20
+ * @slot content:after
21
+ *
22
+ * @slot timestamps:before
23
+ * @slot timestamps:after
24
+ *
25
+ * @slot create:before
26
+ * @slot create:after
27
+ *
28
+ * @slot delete:before
29
+ * @slot delete:after
30
+ *
31
+ * @element foxy-template-form
32
+ * @since 1.14.0
33
+ */
13
34
  export class TemplateForm extends Base {
14
35
  constructor() {
15
36
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateForm/TemplateForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,+BAA4B;AAEnE,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,gCAA6B;AACzD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,EAAE,GAAG,eAAe,CAAC;AAC3B,MAAM,IAAI,GAAG,mBAAmB,CAC9B,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CACzE,CAAC;AAEF,MAAM,OAAO,YAAa,SAAQ,IAAU;IAA5C;;QAmCE,cAAS,GAAc,EAAE,CAAC;QAElB,iBAAY,GAA6B,MAAM,CAAC;QAEhD,oBAAe,GAAoC,SAAS,CAAC;IAsRvE,CAAC;IA5TC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,YAAY,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAClC,eAAe,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SACtC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,GAAG,KAAK,CAAC,MAAM;YACf,GAAG;;;OAIF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,cAA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CAAC,YAAY,GAAG,MAAM,CAAC;QAE3B,IAAI;YACF,MAAM,GAAG,eAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,mCAAI,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAEjF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SACnD;QAAC,WAAM;YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { live } from 'lit-html/directives/live';\n\nconst NS = 'template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\nexport class TemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n templates: Templates = {};\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n const scope = 'description';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n data-testid=${scope}\n class=\"w-full mb-s\"\n label=${this.t(scope)}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}\n ?readonly=${this.readonlySelector.matches(scope)}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderContent() {\n const scope = 'content';\n const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope);\n const isReadonly = this.readonlySelector.matches(scope);\n const contentChoice = this.form.content_url\n ? 'url'\n : this.form.content\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <div data-testid=\"content\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-group frame>\n <foxy-i18n\n class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}\n lang=${this.lang}\n slot=\"header\"\n key=\"template\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"content-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ content: '', content_url: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"content-url\"\n class=\"mr-s flex-grow\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${this.form.content_url}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ content: '', content_url: value });\n }}\n >\n </vaadin-text-field>\n\n <vaadin-button\n data-testid=\"cache\"\n class=\"relative\"\n ?hidden=${isReadonly || this.form.content_url !== this.data?.content_url}\n ?disabled=${isDisabled || this.__cacheState === 'busy'}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n id=\"cached-content\"\n data-testid=\"content-clipboard\"\n class=\"w-full mb-m\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${live(this.form.content)}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ content: value, content_url: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderTimestamps() {\n const scope = 'timestamps';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new TemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"TemplateForm.js","sourceRo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;QAE3B,IAAI;YACF,MAAM,GAAG,eAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,mCAAI,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAEjF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SACnD;QAAC,WAAM;YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { live } from 'lit-html/directives/live';\n\nconst NS = 'template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Form element for creating or editing templates (`fx:cart_include_template`, `fx:checkout_template`, `fx:cart_template`).\n *\n * @slot description:before\n * @slot description:after\n *\n * @slot content:before\n * @slot content:after\n *\n * @slot timestamps:before\n * @slot timestamps:after\n *\n * @slot create:before\n * @slot create:after\n *\n * @slot delete:before\n * @slot delete:after\n *\n * @element foxy-template-form\n * @since 1.14.0\n */\nexport class TemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n templates: Templates = {};\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n const scope = 'description';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n data-testid=${scope}\n class=\"w-full mb-s\"\n label=${this.t(scope)}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}\n ?readonly=${this.readonlySelector.matches(scope)}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderContent() {\n const scope = 'content';\n const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope);\n const isReadonly = this.readonlySelector.matches(scope);\n const contentChoice = this.form.content_url\n ? 'url'\n : this.form.content\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <div data-testid=\"content\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-group frame>\n <foxy-i18n\n class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}\n lang=${this.lang}\n slot=\"header\"\n key=\"template\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"content-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ content: '', content_url: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"content-url\"\n class=\"mr-s flex-grow\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${this.form.content_url}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ content: '', content_url: value });\n }}\n >\n </vaadin-text-field>\n\n <vaadin-button\n data-testid=\"cache\"\n class=\"relative\"\n ?hidden=${isReadonly || this.form.content_url !== this.data?.content_url}\n ?disabled=${isDisabled || this.__cacheState === 'busy'}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n id=\"cached-content\"\n data-testid=\"content-clipboard\"\n class=\"w-full mb-m\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${live(this.form.content)}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ content: value, content_url: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderTimestamps() {\n const scope = 'timestamps';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new TemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.14.0-beta.8",
4
+ "version": "1.14.0-beta.9",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",