@foxy.io/elements 1.33.0-beta.1 → 1.33.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import"./shared-935adc3b.js";import"./shared-a84befbf.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-nucleon-element.js";import"./shared-3bfbd5af.js";import{_ as t,B as r,aM as o,l as a}from"./shared-d1195c27.js";import{a as i}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-dc73b9a5.js";import{s as d}from"./shared-1aff7995.js";import{h as c}from"./shared-56ba2d28.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let p,h,f,u,m,v,b,j,y,_,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,a;const i=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(p||(p=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(h||(h=P``)):l(f||(f=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(b||(b=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(j||(j=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(y||(y=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(_||(_=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=r=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(d(a,i,r))})},c=t.options,p=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,p,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,p,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,p,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};
1
+ import"./shared-935adc3b.js";import"./shared-d367ea04.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-nucleon-element.js";import"./shared-3bfbd5af.js";import{_ as t,B as r,aM as o,l as a}from"./shared-d1195c27.js";import{a as i}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-dc73b9a5.js";import{s as d}from"./shared-1aff7995.js";import{h as c}from"./shared-56ba2d28.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let p,h,f,u,m,v,b,j,y,_,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,a;const i=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(p||(p=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(h||(h=P``)):l(f||(f=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(b||(b=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(j||(j=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(y||(y=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(_||(_=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=r=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(d(a,i,r))})},c=t.options,p=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,p,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,p,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,p,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};
@@ -1 +1 @@
1
- import"./shared-935adc3b.js";import"./shared-a84befbf.js";import"./shared-6a8ccf0c.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-3bfbd5af.js";import{_ as t,B as r,l as i}from"./shared-d1195c27.js";import{g as o}from"./shared-bab2ea2c.js";import{a}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{h as l,s as n}from"./shared-dc73b9a5.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-56ba2d28.js";import{s as h}from"./shared-1aff7995.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-ad3eea80.js";import"./shared-651c44fa.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";let u,m,p,f,_,v,y,g,x,b,$,j,L,S,k,w,P,V,M,I,B,C,q,Z,H,D,O,R=e=>e;const T=a(e,"payments-api-payment-method-form");class W extends T{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}]}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const a=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let s;try{s=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=R` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(m||(m=R``)):l(p||(p=R` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=o(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=o(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=R` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=R`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,a=e.find((e=>e.name===o));return a?a.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=R` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=R` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=R`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=R` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l(b||(b=R` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n($||($=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=R` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_3d_secure)?l(L||(L=R` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=R` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,i,o,a,d,c,h,u,m,p,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=R``));if("live"===e&&!(null===(o=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===o?void 0:o.is_active))return l(w||(w=R` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(P||(P=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(m=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===m?void 0:m.is_live));return l(V||(V=R` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?l(M||(M=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(I||(I=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(B||(B=R` <foxy-internal-text-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=W.defaultImageSrc,a=null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,s=e=>e.currentTarget.src=o;return l(C||(C=R` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(q||(q=R`${0}`),e.fields.map((e=>{var t,r,o;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const o=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(o,e.id))&&void 0!==r?r:o.default_value}catch(t){return e.default_value}},n=t=>{var r;let i={};try{i=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(i,e.id,t))})},d=e.options;return l(Z||(Z=R` ${0} `),"checkbox"===e.type?l(H||(H=R` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(D||(D=R` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(O||(O=R` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(o=e.description)&&void 0!==o?o:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",W);export{W as PaymentsApiPaymentMethodForm};
1
+ import"./shared-935adc3b.js";import"./shared-d367ea04.js";import"./shared-6a8ccf0c.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-3bfbd5af.js";import{_ as t,B as r,l as i}from"./shared-d1195c27.js";import{g as o}from"./shared-bab2ea2c.js";import{a}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{h as l,s as n}from"./shared-dc73b9a5.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-56ba2d28.js";import{s as h}from"./shared-1aff7995.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-ad3eea80.js";import"./shared-651c44fa.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";let u,m,p,f,_,v,y,g,x,$,b,j,L,S,k,w,P,V,M,I,B,C,q,Z,H,D,O,R=e=>e;const T=a(e,"payments-api-payment-method-form");class W extends T{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}]}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const a=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let s;try{s=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=R` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(m||(m=R``)):l(p||(p=R` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=o(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=o(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=R` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=R`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,a=e.find((e=>e.name===o));return a?a.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=R` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=R` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=R`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=R` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l($||($=R` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n(b||(b=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=R` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_3d_secure)?l(L||(L=R` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=R` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,i,o,a,d,c,h,u,m,p,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=R``));if("live"===e&&!(null===(o=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===o?void 0:o.is_active))return l(w||(w=R` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(P||(P=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(m=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===m?void 0:m.is_live));return l(V||(V=R` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?l(M||(M=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(I||(I=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(B||(B=R` <foxy-internal-text-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=W.defaultImageSrc,a=null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,s=e=>e.currentTarget.src=o;return l(C||(C=R` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(q||(q=R`${0}`),e.fields.map((e=>{var t,r,o;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const o=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(o,e.id))&&void 0!==r?r:o.default_value}catch(t){return e.default_value}},n=t=>{var r;let i={};try{i=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(i,e.id,t))})},d=e.options;return l(Z||(Z=R` ${0} `),"checkbox"===e.type?l(H||(H=R` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(D||(D=R` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(O||(O=R` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(o=e.description)&&void 0!==o?o:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",W);export{W as PaymentsApiPaymentMethodForm};
@@ -1 +1 @@
1
- import"./shared-b3d36746.js";import"./shared-a84befbf.js";import"./shared-6a8ccf0c.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{a as o}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{h as i}from"./shared-dc73b9a5.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-5452fdfe.js";import"./shared-359793d4.js";import"./shared-7448fda4.js";import"./shared-61ade33e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-935adc3b.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-bb9f0d8b.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-91500a0f.js";import"./shared-838bd79c.js";import"./shared-53443b27.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./foxy-nucleon-element.js";import"./shared-56ba2d28.js";let a,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e;const r=["header:copy-json",super.hiddenSelector.toString()],o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data;return this.data||r.unshift("payment-methods","fraud-protections"),o||r.unshift("general:is-live","general:is-purchase-order-enabled"),new t(r.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return i(a||(a=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};
1
+ import"./shared-b3d36746.js";import"./shared-d367ea04.js";import"./shared-6a8ccf0c.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{a as o}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{h as i}from"./shared-dc73b9a5.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-5452fdfe.js";import"./shared-359793d4.js";import"./shared-7448fda4.js";import"./shared-61ade33e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-935adc3b.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-bb9f0d8b.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-91500a0f.js";import"./shared-838bd79c.js";import"./shared-53443b27.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./foxy-nucleon-element.js";import"./shared-56ba2d28.js";let a,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e;const r=["header:copy-json",super.hiddenSelector.toString()],o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data;return this.data||r.unshift("payment-methods","fraud-protections"),o||r.unshift("general:is-live","general:is-purchase-order-enabled"),new t(r.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return i(a||(a=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};
@@ -1 +1 @@
1
- import"./shared-a6b2bd14.js";import"./shared-4beb6fef.js";import"./shared-3ca58fb9.js";import"./shared-c671d5c7.js";import"./shared-a84befbf.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-nucleon-element.js";import"./shared-3bfbd5af.js";import{_ as t}from"./shared-d1195c27.js";import{R as o,a as n}from"./shared-6d7c1a2f.js";import{i as r}from"./shared-9803aa7c.js";import{h as s}from"./shared-dc73b9a5.js";import{a as i}from"./shared-9cf15285.js";import"./shared-dbe8536b.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-08be5c32.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-cacd4407.js";import"./shared-1024aa20.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-b14bf56d.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let a,l,u,c,m,f,h,p,_,y,d,g,x=e=>e;const b=o(n(e,"store-form"));class v extends b{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.hCaptchaSiteKey=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.__currencyStyleOptions=[{rawLabel:"12.34",value:"101"},{rawLabel:"USD 12.34",value:"001"},{rawLabel:"$12.34",value:"000"},{rawLabel:"12",value:"111"},{rawLabel:"USD 12",value:"011"},{rawLabel:"$12",value:"010"}],this.__currencyStyleGetValue=()=>({101:"101",100:"101","001":"001","000":"000",111:"111",110:"111","011":"011","010":"010"}[[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join("")]),this.__currencyStyleSetValue=e=>{this.edit({hide_currency_symbol:Boolean(Number(e[0])),hide_decimal_characters:Boolean(Number(e[1])),use_international_currency_symbol:Boolean(Number(e[2]))})},this.__appSessionTimeOptions=[{value:"s",label:"second"},{value:"m",label:"minute"},{value:"h",label:"hour"},{value:"d",label:"day"}],this.__getStoreEmailValue=()=>{var e;return(null!==(e=this.form.store_email)&&void 0!==e?e:"").split(",").map((e=>({value:e.trim()}))).filter((({value:e})=>e.length>0))},this.__setStoreEmailValue=e=>{this.edit({store_email:e.map((e=>e.value)).join(",")})},this.__getUseSmtpConfigValue=()=>!!this.form.smtp_config,this.__setUseSmtpConfigValue=e=>{e?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getAppSessionTimeValue=()=>{const e=this.form.app_session_time||43200;return e%86400==0?e/86400+"d":e%3600==0?e/3600+"h":e%60==0?e/60+"m":`${e}s`},this.__setAppSessionTimeValue=e=>{const t=e[e.length-1],o=parseInt(e.substring(0,e.length-1));this.edit({app_session_time:{d:86400,h:3600,m:60,s:1}[t]*o})},this.__setStoreDomainValue=e=>{if(e.endsWith(".foxycart.com")){const t=e.substring(0,e.length-13);this.edit({store_domain:t,use_remote_domain:t.includes(".")})}else this.edit({store_domain:e,use_remote_domain:e.includes(".")})},this.__smtpConfigHostGetValue=()=>this.__getSmtpConfig().host,this.__smtpConfigHostSetValue=e=>{this.__setSmtpConfig("host",e)},this.__smtpConfigPortGetValue=()=>{const e=parseInt(this.__getSmtpConfig().port);return isNaN(e)?void 0:e},this.__smtpConfigPortSetValue=e=>{this.__setSmtpConfig("port",String(e))},this.__smtpConfigUsernameGetValue=()=>this.__getSmtpConfig().username,this.__smtpConfigUsernameSetValue=e=>{this.__setSmtpConfig("username",e)},this.__smtpConfigPasswordGetValue=()=>this.__getSmtpConfig().password,this.__smtpConfigPasswordSetValue=e=>{this.__setSmtpConfig("password",e)},this.__smtpConfigSecurityGetValue=()=>this.__getSmtpConfig().security,this.__smtpConfigSecuritySetValue=e=>{this.__setSmtpConfig("security",e)},this.__smtpConfigSecurityOptions=[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}],this.__webhookKeyGeneratorOptions={length:32,separator:""},this.__webhookKeyApiLegacyGetValue=()=>this.__getWebhookKey().api_legacy,this.__webhookKeyApiLegacySetValue=e=>{this.__setWebhookKey("api_legacy",e)},this.__webhookKeyCartSigningGetValue=()=>this.__getWebhookKey().cart_signing,this.__webhookKeyCartSigningSetValue=e=>{this.__setWebhookKey("cart_signing",e)},this.__webhookKeyXmlDatafeedGetValue=()=>this.__getWebhookKey().xml_datafeed,this.__webhookKeyXmlDatafeedSetValue=e=>{this.__setWebhookKey("xml_datafeed",e)},this.__webhookKeySsoGetValue=()=>this.__getWebhookKey().sso,this.__webhookKeySsoSetValue=e=>{this.__setWebhookKey("sso",e)},this.__hCaptchaToken=null}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},hCaptchaSiteKey:{attribute:"h-captcha-site-key"},storeVersions:{attribute:"store-versions"},checkoutTypes:{attribute:"checkout-types"},localeCodes:{attribute:"locale-codes"},languages:{},timezones:{},countries:{},regions:{}})}static get v8n(){return[({store_name:e})=>!!e||"store-name:v8n_required",({store_name:e})=>e&&e.length<=50||"store-name:v8n_too_long",({store_domain:e})=>!!e||"store-domain:v8n_required",({store_domain:e})=>e&&e.length<=100||"store-domain:v8n_too_long",({store_url:e})=>!!e||"store-url:v8n_required",({store_url:e})=>e&&e.length<=300||"store-url:v8n_too_long",({receipt_continue_url:e})=>!e||e.length<=300||"receipt-continue-url:v8n_too_long",({store_email:e})=>!!e||"store-email:v8n_required",({store_email:e})=>e&&e.length<=300||"store-email:v8n_too_long",({from_email:e})=>!e||e.length<=100||"from-email:v8n_too_long",({smtp_config:e})=>!e||e.length<=1e3||"use-smtp-config:v8n_too_long",({postal_code:e})=>!!e||"postal-code:v8n_required",({postal_code:e})=>e&&e.length<=50||"postal-code:v8n_too_long",({region:e})=>!!e||"region:v8n_required",({region:e})=>e&&e.length<=100||"region:v8n_too_long",({country:e})=>!!e||"country:v8n_required",({logo_url:e})=>!e||e.length<=200||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!e||e.length<=300||"webhook-url:v8n_too_long",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!!e||"webhook-key:v8n_required",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!e||e.length<=200||"webhook-key:v8n_too_long",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!!e||"single-sign-on-url:v8n_required",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!e||e.length<=300||"single-sign-on-url:v8n_too_long",({customer_password_hash_config:e})=>!e||String(e).length<=100||"customer-password-hash-config:v8n_too_long",({unified_order_entry_password:e})=>!e||String(e).length<=100||"unified-order-entry-password:v8n_too_long",({custom_display_id_config:e})=>!e||String(e).length<=500||"custom-display-id-config-enabled:v8n_too_long"]}get headerSubtitleOptions(){var e;return{context:(null===(e=this.data)||void 0===e?void 0:e.is_active)?"active":"inactive"}}renderBody(){var e,t,o,n,r,i,g,b,v,w,$,V,S,C;const j=this.t(this.form.use_remote_domain&&!(null===(e=this.data)||void 0===e?void 0:e.use_remote_domain)?"essentials.store-domain.custom_domain_note":"essentials.store-domain.helper_text"),k=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",K=this.__renderLoader(1),q=this.__renderLoader(2),T=this.__renderLoader(7),I=this.__renderLoader(8),O=this.__renderLoader(9),G=Object.entries(null!==(o=null===(t=null==q?void 0:q.data)||void 0===t?void 0:t.values)&&void 0!==o?o:{}),D=null!==(r=null===(n=null==T?void 0:T.data)||void 0===n?void 0:n.values.timezone)&&void 0!==r?r:[],L=Object.values(null!==(g=null===(i=null==I?void 0:I.data)||void 0===i?void 0:i.values)&&void 0!==g?g:{}),E=Object.values(null!==(v=null===(b=null==O?void 0:O.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),J=Object.entries(null!==($=null===(w=null==K?void 0:K.data)||void 0===w?void 0:w.values)&&void 0!==$?$:{}),P=J.map((e=>({rawLabel:e[1].description,value:e[0]}))),W=G.map((([e,t])=>({rawLabel:t,value:e}))),A=D.map((e=>({rawLabel:e.description,value:e.timezone}))),N=L.map((e=>({rawLabel:e.default,value:e.cc2}))),M=E.map((e=>({rawLabel:e.default,value:e.code})));let U;try{const e=new URL(null!==(V=this.regions)&&void 0!==V?V:""),t=this.form.country;t&&e.searchParams.set("country_code",t),U=e.toString()}catch(e){U=void 0}const H=this.__getCustomDisplayIdConfig(),z=H.transaction_journal_entries,B=z.log_detail_request_types,R=this.__displayIdExamples,X=this.__journalIdExamples;return s(a||(a=x` ${0} <foxy-internal-summary-control infer="essentials"> <foxy-internal-text-control layout="summary-item" infer="store-name"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="logo-url"> </foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" layout="summary-item" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="store-url"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="essentials" label="" helper-text=""> <foxy-internal-switch-control infer="is-maintenance-mode"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="essentials" label="" helper-text=""> <foxy-internal-editable-list-control layout="summary-item" infer="store-email" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="essentials" label="" helper-text=""> <foxy-internal-select-control layout="summary-item" infer="timezone" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control layout="summary-item" infer="country" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control layout="summary-item" infer="postal-code"> </foxy-internal-text-control> <foxy-internal-select-control layout="summary-item" infer="currency-style" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="legacy-api"> <foxy-internal-password-control layout="summary-item" infer="webhook-key-api-legacy" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="emails"> <foxy-internal-text-control layout="summary-item" infer="from-email" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-switch-control infer="use-email-dns" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="use-smtp-config" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="shipping"> <foxy-internal-select-control layout="summary-item" infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-switch-control infer="features-multiship" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="require-signed-shipping-rates" helper-text-as-tooltip> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="cart"> <foxy-internal-frequency-control layout="summary-item" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-switch-control infer="products-require-expires-property" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="use-cart-validation" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-password-control layout="summary-item" infer="webhook-key-cart-signing" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="checkout"> <foxy-internal-select-control layout="summary-item" infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="checkout" label="" helper-text=""> <foxy-internal-password-control layout="summary-item" infer="unified-order-entry-password" show-generator> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="checkout" label="" helper-text=""> <foxy-internal-switch-control infer="use-single-sign-on"></foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="receipt"> <foxy-internal-text-control layout="summary-item" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-switch-control infer="bcc-on-receipt-email"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="custom-display-id-config"> <foxy-internal-switch-control infer="custom-display-id-config-enabled" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control helper-text="" label="" infer="custom-display-id-config"> <foxy-internal-switch-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="xml-datafeed"> <foxy-internal-switch-control infer="use-webhook"></foxy-internal-switch-control> ${0} </foxy-internal-summary-control> ${0} ${0} ${0} ${0} ${0} ${0} ${0} `),this.renderHeader(),j,k,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,A,N,M.length>0?s(l||(l=x` <foxy-internal-select-control layout="summary-item" infer="region" .options="${0}"> </foxy-internal-select-control> `),M):s(u||(u=x` <foxy-internal-text-control layout="summary-item" infer="region"> </foxy-internal-text-control> `)),this.__currencyStyleOptions,this.__currencyStyleGetValue,this.__currencyStyleSetValue,this.__webhookKeyGeneratorOptions,this.__webhookKeyApiLegacyGetValue,this.__webhookKeyApiLegacySetValue,null!==(C=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==C?C:this.t("emails.from-email.placeholder"),this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.form.smtp_config?s(c||(c=x` <foxy-internal-text-control layout="summary-item" infer="smtp-config-host" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="smtp-config-port" step="1" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-text-control layout="summary-item" infer="smtp-config-username" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="smtp-config-password" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-select-control layout="summary-item" infer="smtp-config-security" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> `),this.__smtpConfigHostGetValue,this.__smtpConfigHostSetValue,this.__smtpConfigPortGetValue,this.__smtpConfigPortSetValue,this.__smtpConfigUsernameGetValue,this.__smtpConfigUsernameSetValue,this.__smtpConfigPasswordGetValue,this.__smtpConfigPasswordSetValue,this.__smtpConfigSecurityGetValue,this.__smtpConfigSecuritySetValue,this.__smtpConfigSecurityOptions):"",W,this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__webhookKeyGeneratorOptions,this.__webhookKeyCartSigningGetValue,this.__webhookKeyCartSigningSetValue,P,(e=>{var t;const o=J.find((([t])=>t===e));this.edit({customer_password_hash_type:e,customer_password_hash_config:null!==(t=null==o?void 0:o[1].config)&&void 0!==t?t:""})}),"number"==typeof this.form.customer_password_hash_config?s(m||(m=x` <foxy-internal-number-control layout="summary-item" infer="customer-password-hash-config"> </foxy-internal-number-control> `)):s(f||(f=x` <foxy-internal-text-control layout="summary-item" infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.form.use_single_sign_on?s(h||(h=x` <foxy-internal-text-control layout="summary-item" infer="single-sign-on-url"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="webhook-key-sso" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__webhookKeyGeneratorOptions,this.__webhookKeySsoGetValue,this.__webhookKeySsoSetValue):"",(()=>H.enabled),(e=>{this.__setCustomDisplayIdConfig("enabled",e)}),H.enabled?s(p||(p=x` <foxy-internal-number-control layout="summary-item" infer="custom-display-id-config-start" step="1" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="custom-display-id-config-length" step="1" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <div class="text-right text-secondary"> <p class="flex justify-end"> <foxy-i18n infer="" key="custom-display-id-config-first-example"></foxy-i18n> <span style="font-family:monospace">&nbsp;${0}</span> </p> <p class="flex justify-end"> <foxy-i18n infer="" key="custom-display-id-config-random-example"></foxy-i18n> <span style="font-family:monospace">&nbsp;${0}</span> </p> </div> `),(()=>parseInt(H.start||"0")),(e=>{this.__setCustomDisplayIdConfig("start",String(e))}),(()=>parseInt(H.length||"0")),(e=>{this.__setCustomDisplayIdConfig("length",String(e))}),(()=>H.prefix),(e=>{this.__setCustomDisplayIdConfig("prefix",e)}),(()=>H.suffix),(e=>{this.__setCustomDisplayIdConfig("suffix",e)}),null==R?void 0:R.first,null==R?void 0:R.random):"",(()=>z.enabled),(e=>{this.__setTransactionJournalEntriesConfig("enabled",e)}),z.enabled?s(_||(_=x` <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-authcapture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-capture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-void-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <div class="sm-col-span-2 leading-s text-right text-secondary"> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> <span style="font-family:monospace"> ${0} </span> </p> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> <span style="font-family:monospace">${0}</span> </p> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> <span style="font-family:monospace">${0}</span> </p> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> <span style="font-family:monospace">${0}</span> </p> </div> `),(()=>B.transaction_authcapture.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_authcapture",e)}),(()=>B.transaction_capture.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_capture",e)}),(()=>B.transaction_void.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_void",e)}),(()=>B.transaction_refund.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_refund",e)}),(()=>z.transaction_separator),(e=>{this.__setTransactionJournalEntriesConfig("transaction_separator",e)}),null==X?void 0:X.authcapture,null==X?void 0:X.capture,null==X?void 0:X.void,null==X?void 0:X.refund):"",this.form.use_webhook?s(y||(y=x` <foxy-internal-text-control layout="summary-item" infer="webhook-url"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="webhook-key-xml-datafeed" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__webhookKeyGeneratorOptions,this.__webhookKeyXmlDatafeedGetValue,this.__webhookKeyXmlDatafeedSetValue):"",this.href||!this.hCaptchaSiteKey?"":s(d||(d=x` <div class="text-xs text-tertiary"> <foxy-i18n infer="hcaptcha" key="disclaimer"></foxy-i18n> <br> <a target="_blank" class="transition-colors hover-text-body rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://www.hcaptcha.com/privacy" rel="noopener noreferrer"> <foxy-i18n class="underline" infer="hcaptcha" key="privacy_policy"></foxy-i18n> </a> <span>&bull;</span> <a target="_blank" class="transition-colors hover-text-body rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://www.hcaptcha.com/terms" rel="noopener noreferrer"> <foxy-i18n class="underline" infer="hcaptcha" key="terms_of_service"></foxy-i18n> </a> <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> </div> `),this.hCaptchaSiteKey,this.lang,(({token:e})=>{this.__hCaptchaToken=e,super.submit()})),super.renderBody(),K.render(this.customerPasswordHashTypes),q.render(this.shippingAddressTypes),T.render(this.timezones),I.render(this.countries),O.render(U))}submit(){var e,t;!this.href&&this.hCaptchaSiteKey?(null===(e=this.__hCaptcha)||void 0===e||e.reset(),null===(t=this.__hCaptcha)||void 0===t||t.execute()):super.submit()}async _fetch(...e){const t=new v.API.WHATWGRequest(...e);return this.__hCaptchaToken&&t.headers.set("h-captcha-code",this.__hCaptchaToken),super._fetch(t)}get __displayIdExamples(){const e=this.__getCustomDisplayIdConfig(),t=parseInt(e.start||"0"),o=parseInt(e.length||"0")-e.prefix.length-e.suffix.length,n=Math.min(t+Math.floor(Math.random()*Math.pow(10,o)),Math.pow(10,o)-1);if(e.start&&e.length&&t/10<=o)return{first:`${e.prefix}${t.toString().padStart(o,"0")}${e.suffix}`,random:`${e.prefix}${n.toString().padStart(o,"0")}${e.suffix}`}}get __journalIdExamples(){const e=this.__getCustomDisplayIdConfig(),t=e.transaction_journal_entries,o=parseInt(e.start||"0"),n=parseInt(e.length||"0")-e.prefix.length-e.suffix.length,r=Math.min(o+Math.floor(Math.random()*Math.pow(10,n)),Math.pow(10,n)-1),s=`${e.prefix}${r.toString().padStart(n,"0")}${e.suffix}`,i=Math.floor(1e3*Math.random()),a=String(i).padStart(3,"0");if(e.start&&e.length&&o/10<=n)return{authcapture:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_authcapture.prefix}${a}`,capture:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_capture.prefix}${a}`,refund:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_refund.prefix}${a}`,void:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_void.prefix}${a}`}}get __hCaptcha(){return this.renderRoot.querySelector("h-captcha")}__getWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const n=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:n,xml_datafeed:n,api_legacy:n,sso:n}}return o}__setWebhookKey(e,t){const o=this.__getWebhookKey();o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}__getCustomDisplayIdConfig(){var e;const t={enabled:!1,start:"0",length:"0",prefix:"",suffix:"",transaction_journal_entries:{enabled:!1,transaction_separator:"",log_detail_request_types:{transaction_authcapture:{prefix:""},transaction_capture:{prefix:""},transaction_refund:{prefix:""},transaction_void:{prefix:""}}}};let o;try{o=JSON.parse(null!==(e=this.form.custom_display_id_config)&&void 0!==e?e:"")}catch(e){o=i(t)}return o}__setCustomDisplayIdConfig(e,t){const o=this.__getCustomDisplayIdConfig();o[e]=t,this.edit({custom_display_id_config:JSON.stringify(o)})}__getTransactionJournalEntriesConfig(){return this.__getCustomDisplayIdConfig().transaction_journal_entries}__setTransactionJournalEntriesConfig(e,t){const o=this.__getCustomDisplayIdConfig().transaction_journal_entries;o[e]=t,this.__setCustomDisplayIdConfig("transaction_journal_entries",o)}__setTransactionJournalEntriesPrefix(e,t){const o=this.__getTransactionJournalEntriesConfig();o.log_detail_request_types[e].prefix=t,this.__setTransactionJournalEntriesConfig("log_detail_request_types",o.log_detail_request_types)}__getSmtpConfig(){var e;let t;try{t=JSON.parse(null!==(e=this.form.smtp_config)&&void 0!==e?e:"")}catch(e){t={username:"",password:"",security:"",host:"",port:""}}return t}__setSmtpConfig(e,t){const o=this.__getSmtpConfig();o[e]=t,this.edit({smtp_config:JSON.stringify(o)})}__renderLoader(e){var t;const o=`loader-${e}`;return{data:null===(t=this.renderRoot.querySelector(`#${o}`))||void 0===t?void 0:t.data,render:e=>s(g||(g=x` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),r(null!=e?e:void 0),o,(()=>this.requestUpdate()))}}}customElements.define("foxy-store-form",v);export{v as StoreForm};
1
+ import"./shared-a6b2bd14.js";import"./shared-4beb6fef.js";import"./shared-3ca58fb9.js";import"./shared-c671d5c7.js";import"./shared-d367ea04.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-nucleon-element.js";import"./shared-3bfbd5af.js";import{_ as t}from"./shared-d1195c27.js";import{R as o,a as n}from"./shared-6d7c1a2f.js";import{i as r}from"./shared-9803aa7c.js";import{h as s}from"./shared-dc73b9a5.js";import{a as i}from"./shared-9cf15285.js";import"./shared-dbe8536b.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-08be5c32.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-cacd4407.js";import"./shared-1024aa20.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-b14bf56d.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let a,l,u,c,m,f,h,p,_,y,d,g,x=e=>e;const b=o(n(e,"store-form"));class v extends b{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.hCaptchaSiteKey=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.__currencyStyleOptions=[{rawLabel:"12.34",value:"101"},{rawLabel:"USD 12.34",value:"001"},{rawLabel:"$12.34",value:"000"},{rawLabel:"12",value:"111"},{rawLabel:"USD 12",value:"011"},{rawLabel:"$12",value:"010"}],this.__currencyStyleGetValue=()=>({101:"101",100:"101","001":"001","000":"000",111:"111",110:"111","011":"011","010":"010"}[[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join("")]),this.__currencyStyleSetValue=e=>{this.edit({hide_currency_symbol:Boolean(Number(e[0])),hide_decimal_characters:Boolean(Number(e[1])),use_international_currency_symbol:Boolean(Number(e[2]))})},this.__appSessionTimeOptions=[{value:"s",label:"second"},{value:"m",label:"minute"},{value:"h",label:"hour"},{value:"d",label:"day"}],this.__getStoreEmailValue=()=>{var e;return(null!==(e=this.form.store_email)&&void 0!==e?e:"").split(",").map((e=>({value:e.trim()}))).filter((({value:e})=>e.length>0))},this.__setStoreEmailValue=e=>{this.edit({store_email:e.map((e=>e.value)).join(",")})},this.__getUseSmtpConfigValue=()=>!!this.form.smtp_config,this.__setUseSmtpConfigValue=e=>{e?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getAppSessionTimeValue=()=>{const e=this.form.app_session_time||43200;return e%86400==0?e/86400+"d":e%3600==0?e/3600+"h":e%60==0?e/60+"m":`${e}s`},this.__setAppSessionTimeValue=e=>{const t=e[e.length-1],o=parseInt(e.substring(0,e.length-1));this.edit({app_session_time:{d:86400,h:3600,m:60,s:1}[t]*o})},this.__setStoreDomainValue=e=>{if(e.endsWith(".foxycart.com")){const t=e.substring(0,e.length-13);this.edit({store_domain:t,use_remote_domain:t.includes(".")})}else this.edit({store_domain:e,use_remote_domain:e.includes(".")})},this.__smtpConfigHostGetValue=()=>this.__getSmtpConfig().host,this.__smtpConfigHostSetValue=e=>{this.__setSmtpConfig("host",e)},this.__smtpConfigPortGetValue=()=>{const e=parseInt(this.__getSmtpConfig().port);return isNaN(e)?void 0:e},this.__smtpConfigPortSetValue=e=>{this.__setSmtpConfig("port",String(e))},this.__smtpConfigUsernameGetValue=()=>this.__getSmtpConfig().username,this.__smtpConfigUsernameSetValue=e=>{this.__setSmtpConfig("username",e)},this.__smtpConfigPasswordGetValue=()=>this.__getSmtpConfig().password,this.__smtpConfigPasswordSetValue=e=>{this.__setSmtpConfig("password",e)},this.__smtpConfigSecurityGetValue=()=>this.__getSmtpConfig().security,this.__smtpConfigSecuritySetValue=e=>{this.__setSmtpConfig("security",e)},this.__smtpConfigSecurityOptions=[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}],this.__webhookKeyGeneratorOptions={length:32,separator:""},this.__webhookKeyApiLegacyGetValue=()=>this.__getWebhookKey().api_legacy,this.__webhookKeyApiLegacySetValue=e=>{this.__setWebhookKey("api_legacy",e)},this.__webhookKeyCartSigningGetValue=()=>this.__getWebhookKey().cart_signing,this.__webhookKeyCartSigningSetValue=e=>{this.__setWebhookKey("cart_signing",e)},this.__webhookKeyXmlDatafeedGetValue=()=>this.__getWebhookKey().xml_datafeed,this.__webhookKeyXmlDatafeedSetValue=e=>{this.__setWebhookKey("xml_datafeed",e)},this.__webhookKeySsoGetValue=()=>this.__getWebhookKey().sso,this.__webhookKeySsoSetValue=e=>{this.__setWebhookKey("sso",e)},this.__hCaptchaToken=null}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},hCaptchaSiteKey:{attribute:"h-captcha-site-key"},storeVersions:{attribute:"store-versions"},checkoutTypes:{attribute:"checkout-types"},localeCodes:{attribute:"locale-codes"},languages:{},timezones:{},countries:{},regions:{}})}static get v8n(){return[({store_name:e})=>!!e||"store-name:v8n_required",({store_name:e})=>e&&e.length<=50||"store-name:v8n_too_long",({store_domain:e})=>!!e||"store-domain:v8n_required",({store_domain:e})=>e&&e.length<=100||"store-domain:v8n_too_long",({store_url:e})=>!!e||"store-url:v8n_required",({store_url:e})=>e&&e.length<=300||"store-url:v8n_too_long",({receipt_continue_url:e})=>!e||e.length<=300||"receipt-continue-url:v8n_too_long",({store_email:e})=>!!e||"store-email:v8n_required",({store_email:e})=>e&&e.length<=300||"store-email:v8n_too_long",({from_email:e})=>!e||e.length<=100||"from-email:v8n_too_long",({smtp_config:e})=>!e||e.length<=1e3||"use-smtp-config:v8n_too_long",({postal_code:e})=>!!e||"postal-code:v8n_required",({postal_code:e})=>e&&e.length<=50||"postal-code:v8n_too_long",({region:e})=>!!e||"region:v8n_required",({region:e})=>e&&e.length<=100||"region:v8n_too_long",({country:e})=>!!e||"country:v8n_required",({logo_url:e})=>!e||e.length<=200||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!e||e.length<=300||"webhook-url:v8n_too_long",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!!e||"webhook-key:v8n_required",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!e||e.length<=200||"webhook-key:v8n_too_long",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!!e||"single-sign-on-url:v8n_required",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!e||e.length<=300||"single-sign-on-url:v8n_too_long",({customer_password_hash_config:e})=>!e||String(e).length<=100||"customer-password-hash-config:v8n_too_long",({unified_order_entry_password:e})=>!e||String(e).length<=100||"unified-order-entry-password:v8n_too_long",({custom_display_id_config:e})=>!e||String(e).length<=500||"custom-display-id-config-enabled:v8n_too_long"]}get headerSubtitleOptions(){var e;return{context:(null===(e=this.data)||void 0===e?void 0:e.is_active)?"active":"inactive"}}renderBody(){var e,t,o,n,r,i,g,b,v,w,$,V,S,C;const j=this.t(this.form.use_remote_domain&&!(null===(e=this.data)||void 0===e?void 0:e.use_remote_domain)?"essentials.store-domain.custom_domain_note":"essentials.store-domain.helper_text"),k=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",K=this.__renderLoader(1),q=this.__renderLoader(2),T=this.__renderLoader(7),I=this.__renderLoader(8),O=this.__renderLoader(9),G=Object.entries(null!==(o=null===(t=null==q?void 0:q.data)||void 0===t?void 0:t.values)&&void 0!==o?o:{}),D=null!==(r=null===(n=null==T?void 0:T.data)||void 0===n?void 0:n.values.timezone)&&void 0!==r?r:[],L=Object.values(null!==(g=null===(i=null==I?void 0:I.data)||void 0===i?void 0:i.values)&&void 0!==g?g:{}),E=Object.values(null!==(v=null===(b=null==O?void 0:O.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),J=Object.entries(null!==($=null===(w=null==K?void 0:K.data)||void 0===w?void 0:w.values)&&void 0!==$?$:{}),P=J.map((e=>({rawLabel:e[1].description,value:e[0]}))),W=G.map((([e,t])=>({rawLabel:t,value:e}))),A=D.map((e=>({rawLabel:e.description,value:e.timezone}))),N=L.map((e=>({rawLabel:e.default,value:e.cc2}))),M=E.map((e=>({rawLabel:e.default,value:e.code})));let U;try{const e=new URL(null!==(V=this.regions)&&void 0!==V?V:""),t=this.form.country;t&&e.searchParams.set("country_code",t),U=e.toString()}catch(e){U=void 0}const H=this.__getCustomDisplayIdConfig(),z=H.transaction_journal_entries,B=z.log_detail_request_types,R=this.__displayIdExamples,X=this.__journalIdExamples;return s(a||(a=x` ${0} <foxy-internal-summary-control infer="essentials"> <foxy-internal-text-control layout="summary-item" infer="store-name"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="logo-url"> </foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" layout="summary-item" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="store-url"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="essentials" label="" helper-text=""> <foxy-internal-switch-control infer="is-maintenance-mode"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="essentials" label="" helper-text=""> <foxy-internal-editable-list-control layout="summary-item" infer="store-email" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="essentials" label="" helper-text=""> <foxy-internal-select-control layout="summary-item" infer="timezone" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control layout="summary-item" infer="country" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control layout="summary-item" infer="postal-code"> </foxy-internal-text-control> <foxy-internal-select-control layout="summary-item" infer="currency-style" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="legacy-api"> <foxy-internal-password-control layout="summary-item" infer="webhook-key-api-legacy" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="emails"> <foxy-internal-text-control layout="summary-item" infer="from-email" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-switch-control infer="use-email-dns" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="use-smtp-config" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="shipping"> <foxy-internal-select-control layout="summary-item" infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-switch-control infer="features-multiship" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="require-signed-shipping-rates" helper-text-as-tooltip> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="cart"> <foxy-internal-frequency-control layout="summary-item" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-switch-control infer="products-require-expires-property" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="use-cart-validation" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-password-control layout="summary-item" infer="webhook-key-cart-signing" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="checkout"> <foxy-internal-select-control layout="summary-item" infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="checkout" label="" helper-text=""> <foxy-internal-password-control layout="summary-item" infer="unified-order-entry-password" show-generator> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="checkout" label="" helper-text=""> <foxy-internal-switch-control infer="use-single-sign-on"></foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="receipt"> <foxy-internal-text-control layout="summary-item" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-switch-control infer="bcc-on-receipt-email"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="custom-display-id-config"> <foxy-internal-switch-control infer="custom-display-id-config-enabled" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control helper-text="" label="" infer="custom-display-id-config"> <foxy-internal-switch-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="xml-datafeed"> <foxy-internal-switch-control infer="use-webhook"></foxy-internal-switch-control> ${0} </foxy-internal-summary-control> ${0} ${0} ${0} ${0} ${0} ${0} ${0} `),this.renderHeader(),j,k,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,A,N,M.length>0?s(l||(l=x` <foxy-internal-select-control layout="summary-item" infer="region" .options="${0}"> </foxy-internal-select-control> `),M):s(u||(u=x` <foxy-internal-text-control layout="summary-item" infer="region"> </foxy-internal-text-control> `)),this.__currencyStyleOptions,this.__currencyStyleGetValue,this.__currencyStyleSetValue,this.__webhookKeyGeneratorOptions,this.__webhookKeyApiLegacyGetValue,this.__webhookKeyApiLegacySetValue,null!==(C=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==C?C:this.t("emails.from-email.placeholder"),this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.form.smtp_config?s(c||(c=x` <foxy-internal-text-control layout="summary-item" infer="smtp-config-host" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="smtp-config-port" step="1" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-text-control layout="summary-item" infer="smtp-config-username" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="smtp-config-password" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-select-control layout="summary-item" infer="smtp-config-security" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> `),this.__smtpConfigHostGetValue,this.__smtpConfigHostSetValue,this.__smtpConfigPortGetValue,this.__smtpConfigPortSetValue,this.__smtpConfigUsernameGetValue,this.__smtpConfigUsernameSetValue,this.__smtpConfigPasswordGetValue,this.__smtpConfigPasswordSetValue,this.__smtpConfigSecurityGetValue,this.__smtpConfigSecuritySetValue,this.__smtpConfigSecurityOptions):"",W,this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__webhookKeyGeneratorOptions,this.__webhookKeyCartSigningGetValue,this.__webhookKeyCartSigningSetValue,P,(e=>{var t;const o=J.find((([t])=>t===e));this.edit({customer_password_hash_type:e,customer_password_hash_config:null!==(t=null==o?void 0:o[1].config)&&void 0!==t?t:""})}),"number"==typeof this.form.customer_password_hash_config?s(m||(m=x` <foxy-internal-number-control layout="summary-item" infer="customer-password-hash-config"> </foxy-internal-number-control> `)):s(f||(f=x` <foxy-internal-text-control layout="summary-item" infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.form.use_single_sign_on?s(h||(h=x` <foxy-internal-text-control layout="summary-item" infer="single-sign-on-url"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="webhook-key-sso" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__webhookKeyGeneratorOptions,this.__webhookKeySsoGetValue,this.__webhookKeySsoSetValue):"",(()=>H.enabled),(e=>{this.__setCustomDisplayIdConfig("enabled",e)}),H.enabled?s(p||(p=x` <foxy-internal-number-control layout="summary-item" infer="custom-display-id-config-start" step="1" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="custom-display-id-config-length" step="1" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <div class="text-right text-secondary"> <p class="flex justify-end"> <foxy-i18n infer="" key="custom-display-id-config-first-example"></foxy-i18n> <span style="font-family:monospace">&nbsp;${0}</span> </p> <p class="flex justify-end"> <foxy-i18n infer="" key="custom-display-id-config-random-example"></foxy-i18n> <span style="font-family:monospace">&nbsp;${0}</span> </p> </div> `),(()=>parseInt(H.start||"0")),(e=>{this.__setCustomDisplayIdConfig("start",String(e))}),(()=>parseInt(H.length||"0")),(e=>{this.__setCustomDisplayIdConfig("length",String(e))}),(()=>H.prefix),(e=>{this.__setCustomDisplayIdConfig("prefix",e)}),(()=>H.suffix),(e=>{this.__setCustomDisplayIdConfig("suffix",e)}),null==R?void 0:R.first,null==R?void 0:R.random):"",(()=>z.enabled),(e=>{this.__setTransactionJournalEntriesConfig("enabled",e)}),z.enabled?s(_||(_=x` <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-authcapture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-capture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-void-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <div class="sm-col-span-2 leading-s text-right text-secondary"> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> <span style="font-family:monospace"> ${0} </span> </p> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> <span style="font-family:monospace">${0}</span> </p> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> <span style="font-family:monospace">${0}</span> </p> <p> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> <span style="font-family:monospace">${0}</span> </p> </div> `),(()=>B.transaction_authcapture.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_authcapture",e)}),(()=>B.transaction_capture.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_capture",e)}),(()=>B.transaction_void.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_void",e)}),(()=>B.transaction_refund.prefix),(e=>{this.__setTransactionJournalEntriesPrefix("transaction_refund",e)}),(()=>z.transaction_separator),(e=>{this.__setTransactionJournalEntriesConfig("transaction_separator",e)}),null==X?void 0:X.authcapture,null==X?void 0:X.capture,null==X?void 0:X.void,null==X?void 0:X.refund):"",this.form.use_webhook?s(y||(y=x` <foxy-internal-text-control layout="summary-item" infer="webhook-url"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="webhook-key-xml-datafeed" show-generator .generatorOptions="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__webhookKeyGeneratorOptions,this.__webhookKeyXmlDatafeedGetValue,this.__webhookKeyXmlDatafeedSetValue):"",this.href||!this.hCaptchaSiteKey?"":s(d||(d=x` <div class="text-xs text-tertiary"> <foxy-i18n infer="hcaptcha" key="disclaimer"></foxy-i18n> <br> <a target="_blank" class="transition-colors hover-text-body rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://www.hcaptcha.com/privacy" rel="noopener noreferrer"> <foxy-i18n class="underline" infer="hcaptcha" key="privacy_policy"></foxy-i18n> </a> <span>&bull;</span> <a target="_blank" class="transition-colors hover-text-body rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://www.hcaptcha.com/terms" rel="noopener noreferrer"> <foxy-i18n class="underline" infer="hcaptcha" key="terms_of_service"></foxy-i18n> </a> <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> </div> `),this.hCaptchaSiteKey,this.lang,(({token:e})=>{this.__hCaptchaToken=e,super.submit()})),super.renderBody(),K.render(this.customerPasswordHashTypes),q.render(this.shippingAddressTypes),T.render(this.timezones),I.render(this.countries),O.render(U))}submit(){var e,t;!this.href&&this.hCaptchaSiteKey?(null===(e=this.__hCaptcha)||void 0===e||e.reset(),null===(t=this.__hCaptcha)||void 0===t||t.execute()):super.submit()}async _fetch(...e){const t=new v.API.WHATWGRequest(...e);return this.__hCaptchaToken&&t.headers.set("h-captcha-code",this.__hCaptchaToken),super._fetch(t)}get __displayIdExamples(){const e=this.__getCustomDisplayIdConfig(),t=parseInt(e.start||"0"),o=parseInt(e.length||"0")-e.prefix.length-e.suffix.length,n=Math.min(t+Math.floor(Math.random()*Math.pow(10,o)),Math.pow(10,o)-1);if(e.start&&e.length&&t/10<=o)return{first:`${e.prefix}${t.toString().padStart(o,"0")}${e.suffix}`,random:`${e.prefix}${n.toString().padStart(o,"0")}${e.suffix}`}}get __journalIdExamples(){const e=this.__getCustomDisplayIdConfig(),t=e.transaction_journal_entries,o=parseInt(e.start||"0"),n=parseInt(e.length||"0")-e.prefix.length-e.suffix.length,r=Math.min(o+Math.floor(Math.random()*Math.pow(10,n)),Math.pow(10,n)-1),s=`${e.prefix}${r.toString().padStart(n,"0")}${e.suffix}`,i=Math.floor(1e3*Math.random()),a=String(i).padStart(3,"0");if(e.start&&e.length&&o/10<=n)return{authcapture:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_authcapture.prefix}${a}`,capture:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_capture.prefix}${a}`,refund:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_refund.prefix}${a}`,void:`${s}${t.transaction_separator}${t.log_detail_request_types.transaction_void.prefix}${a}`}}get __hCaptcha(){return this.renderRoot.querySelector("h-captcha")}__getWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const n=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:n,xml_datafeed:n,api_legacy:n,sso:n}}return o}__setWebhookKey(e,t){const o=this.__getWebhookKey();o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}__getCustomDisplayIdConfig(){var e;const t={enabled:!1,start:"0",length:"0",prefix:"",suffix:"",transaction_journal_entries:{enabled:!1,transaction_separator:"",log_detail_request_types:{transaction_authcapture:{prefix:""},transaction_capture:{prefix:""},transaction_refund:{prefix:""},transaction_void:{prefix:""}}}};let o;try{o=JSON.parse(null!==(e=this.form.custom_display_id_config)&&void 0!==e?e:"")}catch(e){o=i(t)}return o}__setCustomDisplayIdConfig(e,t){const o=this.__getCustomDisplayIdConfig();o[e]=t,this.edit({custom_display_id_config:JSON.stringify(o)})}__getTransactionJournalEntriesConfig(){return this.__getCustomDisplayIdConfig().transaction_journal_entries}__setTransactionJournalEntriesConfig(e,t){const o=this.__getCustomDisplayIdConfig().transaction_journal_entries;o[e]=t,this.__setCustomDisplayIdConfig("transaction_journal_entries",o)}__setTransactionJournalEntriesPrefix(e,t){const o=this.__getTransactionJournalEntriesConfig();o.log_detail_request_types[e].prefix=t,this.__setTransactionJournalEntriesConfig("log_detail_request_types",o.log_detail_request_types)}__getSmtpConfig(){var e;let t;try{t=JSON.parse(null!==(e=this.form.smtp_config)&&void 0!==e?e:"")}catch(e){t={username:"",password:"",security:"",host:"",port:""}}return t}__setSmtpConfig(e,t){const o=this.__getSmtpConfig();o[e]=t,this.edit({smtp_config:JSON.stringify(o)})}__renderLoader(e){var t;const o=`loader-${e}`;return{data:null===(t=this.renderRoot.querySelector(`#${o}`))||void 0===t?void 0:t.data,render:e=>s(g||(g=x` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),r(null!=e?e:void 0),o,(()=>this.requestUpdate()))}}}customElements.define("foxy-store-form",v);export{v as StoreForm};
@@ -1 +1 @@
1
- import"./shared-81bf4ca2.js";import"./shared-14179b23.js";import"./shared-c671d5c7.js";import"./shared-a84befbf.js";import"./shared-529f2b48.js";import"./shared-6a8ccf0c.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-shipping-container-card.js";import"./foxy-shipping-drop-type-card.js";import"./foxy-shipping-service-card.js";import"./foxy-shipping-method-card.js";import"./foxy-nucleon-element.js";import{_ as t,B as r}from"./shared-d1195c27.js";import{a as o}from"./shared-6d7c1a2f.js";import{i}from"./shared-9803aa7c.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-935adc3b.js";import"./shared-4e709717.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-b3d36746.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-bab2ea2c.js";import"./shared-b14bf56d.js";import"./shared-ad3eea80.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-78bfc71e.js";import"./shared-22ba9566.js";import"./shared-0e83a899.js";import"./shared-fd1adc35.js";import"./shared-b384e653.js";let n,a=e=>e;const d=o(e,"store-shipping-method-form");class c extends d{constructor(){super(...arguments),this.shippingMethods=null,this.__shippingMethodLoaderId="shippingMethodLoader",this.__shippingMethodUriSetValue=e=>{this.undo(),this.edit({shipping_method_uri:e})},this.__useCustomAccount=!1,this.__useCustomAccountGetValue=()=>Boolean(this.__useCustomAccount||this.form.authentication_key||this.form.meter_number||this.form.accountid||this.form.password),this.__useCustomAccountSetValue=e=>{e||this.edit({authentication_key:"",meter_number:"",accountid:"",password:""}),this.__useCustomAccount=e}}static get properties(){return t(t({},super.properties),{},{shippingMethods:{attribute:"shipping-methods"},__useCustomAccount:{attribute:!1}})}static get v8n(){return[({shipping_method_uri:e})=>e&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(e)||"shipping-method-uri:v8n_required",({accountid:e})=>!e||e.length<=50||"accountid:v8n_too_long",({password:e})=>!e||e.length<=50||"password:v8n_too_long",({meter_number:e})=>!e||e.length<=50||"meter-number:v8n_too_long",({authentication_key:e})=>!e||e.length<=50||"authentication-key:v8n_too_long",({custom_code:e})=>!e||new Blob([e]).size/1024<=64||"custom-code:v8n_too_long"]}get hiddenSelector(){var e;const t=!!this.data,o=null===(e=this.__shippingMethod)||void 0===e?void 0:e.code;let i="general:shipping-container-uri general:shipping-drop-type-uri destinations account endpoint custom-code";if(o){const e={"CUSTOM-ENDPOINT-POST":"general destinations account custom-code","CUSTOM-CODE":"general destinations account endpoint",CUSTOM:"general account endpoint custom-code",FedEx:"endpoint custom-code",USPS:"account endpoint custom-code",UPS:"endpoint custom-code"};e[o]&&(i=e[o])}return t&&!(null==o?void 0:o.startsWith("CUSTOM-"))||(i+=" services"),t&&(i=`general:shipping-method-uri ${i}`),this.__useCustomAccountGetValue()||(i+=" account:accountid account:password account:authentication-key account:meter-number"),new r(`${i} ${super.hiddenSelector}`.trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}get headerTitleOptions(){var e;return t(t({},super.headerTitleOptions),{},{provider:null===(e=this.__shippingMethod)||void 0===e?void 0:e.name})}renderBody(){var e,t,r,o;const d=this.__shippingMethod;return s(n||(n=a` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-resource-picker-control layout="summary-item" infer="shipping-method-uri" first="${0}" item="foxy-shipping-method-card" .setValue="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control layout="summary-item" infer="shipping-container-uri" first="${0}" item="foxy-shipping-container-card"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control layout="summary-item" infer="shipping-drop-type-uri" first="${0}" item="foxy-shipping-drop-type-card"> </foxy-internal-resource-picker-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="destinations"> <foxy-internal-switch-control infer="use-for-domestic"></foxy-internal-switch-control> <foxy-internal-switch-control infer="use-for-international"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="account"> <foxy-internal-switch-control infer="use-custom-account" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="authentication-key"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="meter-number"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="accountid"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="password"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-text-control infer="endpoint" property="accountid"> </foxy-internal-text-control> <foxy-internal-source-control infer="custom-code"></foxy-internal-source-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="shipping_service_uri" foreign-key-for-id="shipping_service_id" own-key-for-uri="shipping_method_uri" own-uri="${0}" embed-key="fx:store_shipping_services" options-href="${0}" links-href="${0}" infer="services" limit="200" item="foxy-shipping-service-card"> </foxy-internal-async-resource-link-list-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> ${0} `),this.renderHeader(),i(null!==(e=this.shippingMethods)&&void 0!==e?e:null===(t=this.form._links)||void 0===t?void 0:t["fx:shipping_methods"].href),this.__shippingMethodUriSetValue,i(null==d?void 0:d._links["fx:shipping_containers"].href),i(null==d?void 0:d._links["fx:shipping_drop_types"].href),this.__useCustomAccountGetValue,this.__useCustomAccountSetValue,i(null===(r=this.data)||void 0===r?void 0:r._links.self.href),i(null==d?void 0:d._links["fx:shipping_services"].href),i(null===(o=this.data)||void 0===o?void 0:o._links["fx:store_shipping_services"].href),i(this.form.shipping_method_uri||void 0),this.__shippingMethodLoaderId,(()=>this.requestUpdate()),super.renderBody())}updated(e){super.updated(e),e.has("href")&&(this.__useCustomAccount=!1)}async _fetch(...e){try{return await super._fetch(...e)}catch(e){const t=[];try{for(const r of(await e.json())._embedded["fx:errors"])r.message.startsWith("shipping_container_id must be")?t.push("shipping-container-uri:v8n_required"):r.message.startsWith("shipping_drop_type_id must be")&&t.push("shipping-drop-type-uri:v8n_required")}catch(e){}throw t.length>0?t:e}}get __shippingMethodLoader(){return this.renderRoot.querySelector(`#${this.__shippingMethodLoaderId}`)}get __shippingMethod(){var e;return null===(e=this.__shippingMethodLoader)||void 0===e?void 0:e.data}}customElements.define("foxy-store-shipping-method-form",c);export{c as StoreShippingMethodForm};
1
+ import"./shared-81bf4ca2.js";import"./shared-14179b23.js";import"./shared-c671d5c7.js";import"./shared-d367ea04.js";import"./shared-529f2b48.js";import"./shared-6a8ccf0c.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-shipping-container-card.js";import"./foxy-shipping-drop-type-card.js";import"./foxy-shipping-service-card.js";import"./foxy-shipping-method-card.js";import"./foxy-nucleon-element.js";import{_ as t,B as r}from"./shared-d1195c27.js";import{a as o}from"./shared-6d7c1a2f.js";import{i}from"./shared-9803aa7c.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-935adc3b.js";import"./shared-4e709717.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-b3d36746.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-bab2ea2c.js";import"./shared-b14bf56d.js";import"./shared-ad3eea80.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-78bfc71e.js";import"./shared-22ba9566.js";import"./shared-0e83a899.js";import"./shared-fd1adc35.js";import"./shared-b384e653.js";let n,a=e=>e;const d=o(e,"store-shipping-method-form");class c extends d{constructor(){super(...arguments),this.shippingMethods=null,this.__shippingMethodLoaderId="shippingMethodLoader",this.__shippingMethodUriSetValue=e=>{this.undo(),this.edit({shipping_method_uri:e})},this.__useCustomAccount=!1,this.__useCustomAccountGetValue=()=>Boolean(this.__useCustomAccount||this.form.authentication_key||this.form.meter_number||this.form.accountid||this.form.password),this.__useCustomAccountSetValue=e=>{e||this.edit({authentication_key:"",meter_number:"",accountid:"",password:""}),this.__useCustomAccount=e}}static get properties(){return t(t({},super.properties),{},{shippingMethods:{attribute:"shipping-methods"},__useCustomAccount:{attribute:!1}})}static get v8n(){return[({shipping_method_uri:e})=>e&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(e)||"shipping-method-uri:v8n_required",({accountid:e})=>!e||e.length<=50||"accountid:v8n_too_long",({password:e})=>!e||e.length<=50||"password:v8n_too_long",({meter_number:e})=>!e||e.length<=50||"meter-number:v8n_too_long",({authentication_key:e})=>!e||e.length<=50||"authentication-key:v8n_too_long",({custom_code:e})=>!e||new Blob([e]).size/1024<=64||"custom-code:v8n_too_long"]}get hiddenSelector(){var e;const t=!!this.data,o=null===(e=this.__shippingMethod)||void 0===e?void 0:e.code;let i="general:shipping-container-uri general:shipping-drop-type-uri destinations account endpoint custom-code";if(o){const e={"CUSTOM-ENDPOINT-POST":"general destinations account custom-code","CUSTOM-CODE":"general destinations account endpoint",CUSTOM:"general account endpoint custom-code",FedEx:"endpoint custom-code",USPS:"account endpoint custom-code",UPS:"endpoint custom-code"};e[o]&&(i=e[o])}return t&&!(null==o?void 0:o.startsWith("CUSTOM-"))||(i+=" services"),t&&(i=`general:shipping-method-uri ${i}`),this.__useCustomAccountGetValue()||(i+=" account:accountid account:password account:authentication-key account:meter-number"),new r(`${i} ${super.hiddenSelector}`.trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}get headerTitleOptions(){var e;return t(t({},super.headerTitleOptions),{},{provider:null===(e=this.__shippingMethod)||void 0===e?void 0:e.name})}renderBody(){var e,t,r;const o=this.__shippingMethod;return s(n||(n=a` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-resource-picker-control layout="summary-item" infer="shipping-method-uri" first="${0}" item="foxy-shipping-method-card" .setValue="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control layout="summary-item" infer="shipping-container-uri" first="${0}" item="foxy-shipping-container-card"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control layout="summary-item" infer="shipping-drop-type-uri" first="${0}" item="foxy-shipping-drop-type-card"> </foxy-internal-resource-picker-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="destinations"> <foxy-internal-switch-control infer="use-for-domestic"></foxy-internal-switch-control> <foxy-internal-switch-control infer="use-for-international"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="account"> <foxy-internal-switch-control infer="use-custom-account" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="authentication-key"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="meter-number"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="accountid"> </foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="password"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-text-control infer="endpoint" property="accountid"> </foxy-internal-text-control> <foxy-internal-source-control infer="custom-code"></foxy-internal-source-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="shipping_service_uri" foreign-key-for-id="shipping_service_id" own-key-for-uri="shipping_method_uri" own-uri="${0}" embed-key="fx:store_shipping_services" options-href="${0}" links-href="${0}" infer="services" limit="200" item="foxy-shipping-service-card"> </foxy-internal-async-resource-link-list-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> ${0} `),this.renderHeader(),i(null!==(e=this.shippingMethods)&&void 0!==e?e:null===(t=this.form._links)||void 0===t?void 0:t["fx:shipping_methods"].href),this.__shippingMethodUriSetValue,i(null==o?void 0:o._links["fx:shipping_containers"].href),i(null==o?void 0:o._links["fx:shipping_drop_types"].href),this.__useCustomAccountGetValue,this.__useCustomAccountSetValue,i(null==o?void 0:o._links.self.href),i(null==o?void 0:o._links["fx:shipping_services"].href),i(null===(r=this.data)||void 0===r?void 0:r._links["fx:store_shipping_services"].href),i(this.form.shipping_method_uri||void 0),this.__shippingMethodLoaderId,(()=>this.requestUpdate()),super.renderBody())}updated(e){super.updated(e),e.has("href")&&(this.__useCustomAccount=!1)}async _fetch(...e){try{return await super._fetch(...e)}catch(e){const t=[];try{for(const r of(await e.json())._embedded["fx:errors"])r.message.startsWith("shipping_container_id must be")?t.push("shipping-container-uri:v8n_required"):r.message.startsWith("shipping_drop_type_id must be")&&t.push("shipping-drop-type-uri:v8n_required")}catch(e){}throw t.length>0?t:e}}get __shippingMethodLoader(){return this.renderRoot.querySelector(`#${this.__shippingMethodLoaderId}`)}get __shippingMethod(){var e;return null===(e=this.__shippingMethodLoader)||void 0===e?void 0:e.data}}customElements.define("foxy-store-shipping-method-form",c);export{c as StoreShippingMethodForm};
@@ -1 +1 @@
1
- import"./shared-4beb6fef.js";import"./shared-a84befbf.js";import"./shared-6a8ccf0c.js";import"./shared-53443b27.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import{a as t}from"./shared-6d7c1a2f.js";import{B as r}from"./shared-d1195c27.js";import{h as i}from"./shared-dc73b9a5.js";import"./shared-dbe8536b.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-08be5c32.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-ad3eea80.js";import"./shared-651c44fa.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-838bd79c.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let s,a=e=>e;const o=t(e,"subscription-settings-form");class n extends o{constructor(){super(...arguments),this.__pastDueAmountHandlingOptions=[{label:"option_increment",value:"increment"},{label:"option_replace",value:"replace"}],this.__positiveIntegerInputParams={type:"number",step:"1",min:"0"},this.__expiringSoonPaymentReminderScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.expiring_soon_payment_reminder_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>t-e)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__expiringSoonPaymentReminderScheduleSetValue=e=>{this.edit({expiring_soon_payment_reminder_schedule:e.map((({value:e})=>e)).join()})},this.__reminderEmailScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reminder_email_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reminderEmailScheduleSetValue=e=>{this.edit({reminder_email_schedule:e.map((({value:e})=>e)).join()})},this.__reattemptScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reattemptScheduleSetValue=e=>{this.edit({reattempt_schedule:e.map((({value:e})=>e)).join()})},this.__getReattemptBypassStringsValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_bypass_strings)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>e.trim())).filter(((e,t,r)=>e&&r.indexOf(e)===t)).map((e=>({value:e})))},this.__setReattemptBypassStringsValue=e=>{this.edit({reattempt_bypass_strings:e.map((({value:e})=>e)).join()})},this.__reattemptBypassLogicOptions=[{value:"",label:"option_always_reattempt"},{value:"skip_if_exists",label:"option_skip_if_exists"},{value:"reattempt_if_exists",label:"option_reattempt_if_exists"}]}static get v8n(){return[({expiring_soon_payment_reminder_schedule:e})=>!e||e.length<=100||"expiring-soon-payment-reminder-schedule:v8n_too_long",({reattempt_bypass_strings:e})=>!e||e.length<=400||"reattempt-bypass-strings:v8n_too_long",({reminder_email_schedule:e})=>!e||e.length<=100||"reminder-email-schedule:v8n_too_long",({reattempt_schedule:e})=>!e||e.length<=100||"reattempt-schedule:v8n_too_long"]}get hiddenSelector(){const e=["header:copy-id",super.hiddenSelector.toString()];return this.form.reattempt_bypass_logic||e.push("reattempts-group:reattempt-bypass-strings"),new r(e.join(" ").trim())}renderBody(){return i(s||(s=a` ${0} <foxy-internal-summary-control infer="past-due-amount-group"> <foxy-internal-select-control layout="summary-item" infer="past-due-amount-handling" .options="${0}"> </foxy-internal-select-control> <foxy-internal-switch-control infer="automatically-charge-past-due-amount" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="reset-nextdate-on-makeup-payment" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="send-email-receipts-for-automated-billing" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="prevent-customer-cancel-with-past-due" helper-text-as-tooltip> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="reattempts-group"> <foxy-internal-select-control layout="summary-item" infer="reattempt-bypass-logic" .options="${0}"> </foxy-internal-select-control> <foxy-internal-editable-list-control layout="summary-item" infer="reattempt-bypass-strings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control layout="summary-item" infer="reattempt-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="emails-group"> <foxy-internal-editable-list-control layout="summary-item" infer="reminder-email-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control layout="summary-item" infer="expiring-soon-payment-reminder-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="modification-group"> <foxy-internal-text-control layout="summary-item" infer="modification-url"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="cancellation-group"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="cancellation-schedule" step="1" min="1"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.__pastDueAmountHandlingOptions,this.__reattemptBypassLogicOptions,this.__getReattemptBypassStringsValue,this.__setReattemptBypassStringsValue,this.__positiveIntegerInputParams,this.__reattemptScheduleGetValue,this.__reattemptScheduleSetValue,this.__positiveIntegerInputParams,this.__reminderEmailScheduleGetValue,this.__reminderEmailScheduleSetValue,this.__positiveIntegerInputParams,this.__expiringSoonPaymentReminderScheduleGetValue,this.__expiringSoonPaymentReminderScheduleSetValue,this.__cancellationScheduleSuffix,super.renderBody())}get __cancellationScheduleSuffix(){const e=this.form.cancellation_schedule;return e?this.t("day_suffix",{count:e}):""}}customElements.define("foxy-subscription-settings-form",n);export{n as SubscriptionSettingsForm};
1
+ import"./shared-4beb6fef.js";import"./shared-d367ea04.js";import"./shared-6a8ccf0c.js";import"./shared-53443b27.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import{a as t}from"./shared-6d7c1a2f.js";import{B as r}from"./shared-d1195c27.js";import{h as i}from"./shared-dc73b9a5.js";import"./shared-dbe8536b.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-08be5c32.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-ad3eea80.js";import"./shared-651c44fa.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-838bd79c.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let s,a=e=>e;const o=t(e,"subscription-settings-form");class n extends o{constructor(){super(...arguments),this.__pastDueAmountHandlingOptions=[{label:"option_increment",value:"increment"},{label:"option_replace",value:"replace"}],this.__positiveIntegerInputParams={type:"number",step:"1",min:"0"},this.__expiringSoonPaymentReminderScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.expiring_soon_payment_reminder_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>t-e)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__expiringSoonPaymentReminderScheduleSetValue=e=>{this.edit({expiring_soon_payment_reminder_schedule:e.map((({value:e})=>e)).join()})},this.__reminderEmailScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reminder_email_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reminderEmailScheduleSetValue=e=>{this.edit({reminder_email_schedule:e.map((({value:e})=>e)).join()})},this.__reattemptScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,r)=>!isNaN(e)&&r.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reattemptScheduleSetValue=e=>{this.edit({reattempt_schedule:e.map((({value:e})=>e)).join()})},this.__getReattemptBypassStringsValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_bypass_strings)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>e.trim())).filter(((e,t,r)=>e&&r.indexOf(e)===t)).map((e=>({value:e})))},this.__setReattemptBypassStringsValue=e=>{this.edit({reattempt_bypass_strings:e.map((({value:e})=>e)).join()})},this.__reattemptBypassLogicOptions=[{value:"",label:"option_always_reattempt"},{value:"skip_if_exists",label:"option_skip_if_exists"},{value:"reattempt_if_exists",label:"option_reattempt_if_exists"}]}static get v8n(){return[({expiring_soon_payment_reminder_schedule:e})=>!e||e.length<=100||"expiring-soon-payment-reminder-schedule:v8n_too_long",({reattempt_bypass_strings:e})=>!e||e.length<=400||"reattempt-bypass-strings:v8n_too_long",({reminder_email_schedule:e})=>!e||e.length<=100||"reminder-email-schedule:v8n_too_long",({reattempt_schedule:e})=>!e||e.length<=100||"reattempt-schedule:v8n_too_long"]}get hiddenSelector(){const e=["header:copy-id",super.hiddenSelector.toString()];return this.form.reattempt_bypass_logic||e.push("reattempts-group:reattempt-bypass-strings"),new r(e.join(" ").trim())}renderBody(){return i(s||(s=a` ${0} <foxy-internal-summary-control infer="past-due-amount-group"> <foxy-internal-select-control layout="summary-item" infer="past-due-amount-handling" .options="${0}"> </foxy-internal-select-control> <foxy-internal-switch-control infer="automatically-charge-past-due-amount" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="reset-nextdate-on-makeup-payment" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="send-email-receipts-for-automated-billing" helper-text-as-tooltip> </foxy-internal-switch-control> <foxy-internal-switch-control infer="prevent-customer-cancel-with-past-due" helper-text-as-tooltip> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="reattempts-group"> <foxy-internal-select-control layout="summary-item" infer="reattempt-bypass-logic" .options="${0}"> </foxy-internal-select-control> <foxy-internal-editable-list-control layout="summary-item" infer="reattempt-bypass-strings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control layout="summary-item" infer="reattempt-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="emails-group"> <foxy-internal-editable-list-control layout="summary-item" infer="reminder-email-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control layout="summary-item" infer="expiring-soon-payment-reminder-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="modification-group"> <foxy-internal-text-control layout="summary-item" infer="modification-url"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="cancellation-group"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="cancellation-schedule" step="1" min="1"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.__pastDueAmountHandlingOptions,this.__reattemptBypassLogicOptions,this.__getReattemptBypassStringsValue,this.__setReattemptBypassStringsValue,this.__positiveIntegerInputParams,this.__reattemptScheduleGetValue,this.__reattemptScheduleSetValue,this.__positiveIntegerInputParams,this.__reminderEmailScheduleGetValue,this.__reminderEmailScheduleSetValue,this.__positiveIntegerInputParams,this.__expiringSoonPaymentReminderScheduleGetValue,this.__expiringSoonPaymentReminderScheduleSetValue,this.__cancellationScheduleSuffix,super.renderBody())}get __cancellationScheduleSuffix(){const e=this.form.cancellation_schedule;return e?this.t("day_suffix",{count:e}):""}}customElements.define("foxy-subscription-settings-form",n);export{n as SubscriptionSettingsForm};
@@ -1 +1 @@
1
- import"./shared-a84befbf.js";import"./shared-529f2b48.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./shared-935adc3b.js";import{a as t}from"./shared-2dd497e5.js";import"./shared-3bfbd5af.js";import{_ as r,B as s}from"./shared-d1195c27.js";import{N as o}from"./shared-e8b8c8d0.js";import{h as a}from"./shared-dc73b9a5.js";import{a as i}from"./shared-6d7c1a2f.js";import{i as n}from"./shared-9803aa7c.js";import"./shared-a0c6a159.js";import"./shared-377e3168.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-61ade33e.js";import"./shared-359793d4.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";let d,c=e=>e;customElements.define("foxy-internal-template-form-async-action",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return r(r({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"";return a(d||(d=c` <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),`${this.theme} ${null!=t?t:""}`.trim(),"busy"===e||this.disabled,this.__submit,e)}async __submit(){var e,t;if("busy"!==this.__state)try{this.__state="busy";const r=new o.API(this),s=await r.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=s.ok?"idle":"fail",s.ok&&(null===(t=this.nucleon)||void 0===t||t.refresh())}catch(e){this.__state="fail"}}});let h,f=e=>e;const m=i(e,"template-form");class l extends m{get readonlySelector(){const e=[super.readonlySelector.toString()];return this.form.content_url&&e.unshift("content"),new s(e.join(" ").trim())}get disabledSelector(){const e=[super.disabledSelector.toString()];return this.in({idle:{snapshot:"clean"}})&&this.data.content_url||e.unshift("source:cache"),new s(e.join(" ").trim())}get hiddenSelector(){var e;const t=[super.hiddenSelector.toString()];return(null===(e=this.data)||void 0===e?void 0:e.content_url)||t.unshift("source:cache"),new s(t.join(" ").trim())}renderBody(){var e;return a(h||(h=f` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> ${0} <foxy-internal-source-control infer="content"></foxy-internal-source-control> <foxy-internal-summary-control infer="source"> <foxy-internal-text-control layout="summary-item" infer="content-url"> </foxy-internal-text-control> <foxy-internal-template-form-async-action theme="tertiary-inline" infer="cache" href="${0}"> </foxy-internal-template-form-async-action> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.renderTemplateOrSlot(),n(null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href),super.renderBody())}async _sendPost(e){const t=await super._sendPost(e);if(e.content_url){const e=t._links["fx:cache"].href;if(!(await new l.API(this).fetch(e,{method:"POST"})).ok)throw["error:failed_to_cache"]}return await this._fetch(t._links.self.href)}async _sendPatch(e){const t=await super._sendPatch(e);if(!e.content_url)return t;const r=t._links["fx:cache"].href;if(!(await new l.API(this).fetch(r,{method:"POST"})).ok)throw["error:failed_to_cache"];return await this._fetch(t._links.self.href)}}customElements.define("foxy-template-form",l);export{l as TemplateForm};
1
+ import"./shared-d367ea04.js";import"./shared-529f2b48.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./shared-935adc3b.js";import{a as t}from"./shared-2dd497e5.js";import"./shared-3bfbd5af.js";import{_ as r,B as s}from"./shared-d1195c27.js";import{N as o}from"./shared-e8b8c8d0.js";import{h as a}from"./shared-dc73b9a5.js";import{a as i}from"./shared-6d7c1a2f.js";import{i as n}from"./shared-9803aa7c.js";import"./shared-a0c6a159.js";import"./shared-377e3168.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-61ade33e.js";import"./shared-359793d4.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";let d,c=e=>e;customElements.define("foxy-internal-template-form-async-action",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return r(r({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"";return a(d||(d=c` <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),`${this.theme} ${null!=t?t:""}`.trim(),"busy"===e||this.disabled,this.__submit,e)}async __submit(){var e,t;if("busy"!==this.__state)try{this.__state="busy";const r=new o.API(this),s=await r.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=s.ok?"idle":"fail",s.ok&&(null===(t=this.nucleon)||void 0===t||t.refresh())}catch(e){this.__state="fail"}}});let h,f=e=>e;const m=i(e,"template-form");class l extends m{get readonlySelector(){const e=[super.readonlySelector.toString()];return this.form.content_url&&e.unshift("content"),new s(e.join(" ").trim())}get disabledSelector(){const e=[super.disabledSelector.toString()];return this.in({idle:{snapshot:"clean"}})&&this.data.content_url||e.unshift("source:cache"),new s(e.join(" ").trim())}get hiddenSelector(){var e;const t=[super.hiddenSelector.toString()];return(null===(e=this.data)||void 0===e?void 0:e.content_url)||t.unshift("source:cache"),new s(t.join(" ").trim())}renderBody(){var e;return a(h||(h=f` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> ${0} <foxy-internal-source-control infer="content"></foxy-internal-source-control> <foxy-internal-summary-control infer="source"> <foxy-internal-text-control layout="summary-item" infer="content-url"> </foxy-internal-text-control> <foxy-internal-template-form-async-action theme="tertiary-inline" infer="cache" href="${0}"> </foxy-internal-template-form-async-action> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.renderTemplateOrSlot(),n(null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href),super.renderBody())}async _sendPost(e){const t=await super._sendPost(e);if(e.content_url){const e=t._links["fx:cache"].href;if(!(await new l.API(this).fetch(e,{method:"POST"})).ok)throw["error:failed_to_cache"]}return await this._fetch(t._links.self.href)}async _sendPatch(e){const t=await super._sendPatch(e);if(!e.content_url)return t;const r=t._links["fx:cache"].href;if(!(await new l.API(this).fetch(r,{method:"POST"})).ok)throw["error:failed_to_cache"];return await this._fetch(t._links.self.href)}}customElements.define("foxy-template-form",l);export{l as TemplateForm};