@foxy.io/elements 1.24.0-beta.3 → 1.24.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-7995407d.js → shared-30bebd39.js} +1 -1
- package/dist/cdn/translations/error-entry-card/en.json +4 -0
- package/dist/cdn/translations/webhook-form/en.json +1 -1
- package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js +2 -1
- package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js.map +1 -1
- package/dist/elements/public/ErrorEntryCard/ErrorEntryCard.d.ts +0 -1
- package/dist/elements/public/ErrorEntryCard/ErrorEntryCard.js +34 -30
- package/dist/elements/public/ErrorEntryCard/ErrorEntryCard.js.map +1 -1
- package/dist/elements/public/ErrorEntryCard/ResourceViewer.js +9 -0
- package/dist/elements/public/ErrorEntryCard/ResourceViewer.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +3 -0
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
- package/dist/elements/public/WebhookForm/WebhookForm.d.ts +2 -0
- package/dist/elements/public/WebhookForm/WebhookForm.js +7 -0
- package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{am as e,_ as s}from"./shared-307262a1.js";import{L as
|
|
1
|
+
import{am as e,_ as s}from"./shared-307262a1.js";import{L as r,c as t,h as a}from"./shared-7f33a83a.js";import{T as i,a as n,S as o}from"./shared-09d4fbb8.js";import{c as l}from"./shared-4e709717.js";import{G as d}from"./shared-4904bca4.js";import"./foxy-nucleon-element.js";import{N as c}from"./shared-c2d3b32b.js";import{d as p}from"./shared-6f84ac3e.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-4b67d699.js";import"./shared-332f2997.js";let u,m,f,y=e=>e;class h extends(i(r)){constructor(){super(...arguments),this.data=[]}static get properties(){return{data:{type:Array}}}static get styles(){return[super.styles,t(u||(u=y`dd,dt{display:inline-block;overflow:hidden;vertical-align:top;overflow-wrap:anywhere}dt{min-width:calc(5 * var(--lumo-size-l));padding-right:.5em}dd{max-width:calc(15 * var(--lumo-size-l));min-width:calc(10 * var(--lumo-size-l))}`))]}render(){return a(m||(m=y` <dl class="space-y-s"> ${0} </dl> `),this.data.map((e=>{const s=String(e[1]).trim();return a(f||(f=y` <div> <dt class="text-secondary truncate">${0}</dt> <dd class="${0}">${0}</dd> </div> `),e[0],l({"text-tertiary":!s}),s||"–")})))}}let x,g,v=e=>e;const $=["_links","_embedded"],_=n(i(o(c)));class b extends _{static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-data-list":h}}render(){if(this.in({idle:"snapshot"})){const s=this.data,{_links:r,_embedded:t}=s,i=e(s,$);try{const e=function(e){try{const s=new URL(e).pathname.split("/").pop()||void 0;if(void 0===s)return null;const r=parseInt(s);return isNaN(r)?s:r}catch(e){return null}}(r.self.href);null!==e&&(i.id=e)}catch(e){}return a(x||(x=v` <x-data-list aria-live="polite" aria-busy="false" class="leading-s text-s" data="${0}"> </x-data-list> `),JSON.stringify(Array.from(Object.entries(i))))}const s=this.in("busy");return a(g||(g=v` <div aria-live="polite" aria-busy="${0}" data-testid="wrapper" class="flex justify-center"> <foxy-spinner data-testid="spinner" layout="horizontal" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> `),s,this.in("fail")?"error":s?"busy":"empty",this.lang,this.ns)}}let j,w,k,S,E,N,O,z,T,G,J,P=e=>e;const R=n(i(o(c)),"error-entry-card");class A extends R{constructor(){super(...arguments),this.open=!1}static get scopedElements(){return{"x-resource-viewer":b,"foxy-spinner":customElements.get("foxy-spinner"),"x-data-list":h,"iron-icon":customElements.get("iron-icon"),"foxy-i18n":customElements.get("foxy-i18n"),"x-group":d}}static get properties(){return s(s({},super.properties),{},{open:{type:Boolean,reflect:!0}})}render(){var e,s;const r=this.data,t=this.in("busy");if(r){const{hide_error:e}=r,{open:s}=this;return a(j||(j=P` <details aria-busy="${0}" aria-live="polite" class="text-body w-full" ?open="${0}" @toggle="${0}"> <summary class="rounded-s ring-offset-4 ring-offset-base ring-primary-50 focus-outline-none focus-ring-2"> <div style="padding-left:calc(var(--lumo-space-xs) + var(--lumo-space-s) - 1px)" class="${0}"> ${0} </div> </summary> ${0} </details> `),t,s,this.__handleToggle,l({"border-l-2 leading-s relative cursor-pointer":!0,"border-contrast":e&&!s,"border-primary":!e,"border-error":e&&s,"h-l":!s}),this.__renderSummary(r),s?this.__renderDetails(r):"")}return a(w||(w=P` <div aria-busy="${0}" aria-live="polite" style="padding-left:calc(var(--lumo-space-xs) + var(--lumo-space-s) - 1px)" class="flex items-center justify-center border-l-2 leading-s relative border-contrast-10 h-l"> <foxy-spinner data-testid="spinner" layout="horizontal" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> `),t,t?"busy":this.in("fail")?"error":"empty",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}__renderGetOrPostValues(e,s){const r=new URLSearchParams(p(e||s));return a(k||(k=P` <div class="relative leading-xs pt-s"> <div class="absolute font-medium right-0 text-tertiary text-xs top-0 mt-s">${0}</div> <x-data-list data="${0}"></x-data-list> </div> `),e?"GET":"POST",JSON.stringify(Array.from(r.entries())))}__renderReferrer(e){return a(S||(S=P` <span class="text-secondary">Navigated from</span> <a target="_blank" class="font-medium text-primary hover-underline" href="${0}" rel="nofollow noopener noreferrer"> ${0} </a> `),e,e)}__renderSummary(e){return a(E||(E=P` <div class="text-s absolute right-0 top-0 text-tertiary"> <iron-icon icon="icons:expand-${0}"></iron-icon> </div> <div class="text-s mb-xs ${0}"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> </div> <p class="${0} overflow-hidden font-medium"> ${0} </p> `),this.open?"less":"more",e.hide_error?"text-error":"text-primary",JSON.stringify({value:e.date_created}),this.lang,this.ns,JSON.stringify({value:e.date_created}),this.lang,this.ns,this.open?"":"truncate",e.error_message)}__renderDetails(e){return a(N||(N=P` <div class="space-y-m pt-m"> ${0} ${0} ${0} </div> `),e.referrer||e.get_values||e.post_values?a(O||(O=P` <x-group frame> <foxy-i18n slot="header" lang="${0}" key="request" ns="${0}"></foxy-i18n> <div class="mx-xs p-s text-s divide-y divide-contrast-10 space-y-s"> <p> <span class="block font-medium">${0}</span> ${0} </p> ${0} </div> </x-group> `),this.lang,this.ns,e.url,e.referrer?this.__renderReferrer(e.referrer):"",e.get_values||e.post_values?this.__renderGetOrPostValues(e.get_values,e.post_values):""):"",e.ip_address||e.ip_country||e.user_agent?a(z||(z=P` <x-group frame> <foxy-i18n slot="header" lang="${0}" key="client" ns="${0}"></foxy-i18n> <div class="text-s flex flex-col mx-xs p-s"> <span class="font-medium"> ${0} ${0} </span> ${0} </div> </x-group> `),this.lang,this.ns,e.ip_address,e.ip_country?a(T||(T=P`<span class="text-tertiary"> • </span>${0}`),e.ip_country):"",e.user_agent?a(G||(G=P`<span class="text-secondary">${0}</span>`),e.user_agent):""):"",Object.entries(e._links).map((([e,s])=>["self","fx:store","curies"].includes(e)?"":a(J||(J=P` <x-group frame> <foxy-i18n slot="header" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <x-resource-viewer class="p-s mx-xs" href="${0}" lang="${0}" ns="${0}"> </x-resource-viewer> </x-group> `),this.lang,e.substr(3),this.ns,s.href,this.lang,this.ns))))}__handleToggle(e){var s;const r=e.target;r.open&&!1===(null===(s=this.data)||void 0===s?void 0:s.hide_error)&&(this.edit({hide_error:!0}),this.submit()),this.open=r.open}}customElements.define("foxy-error-entry-card",A);export{A as ErrorEntryCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-65318cc1.js";import"./shared-51d28e6d.js";import"./shared-8474bc4a.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-discount-builder.js";import"./foxy-nucleon-element.js";import{I as t}from"./shared-0a248c0d.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-b3ac59eb.js";import{TaxCard as i}from"./foxy-tax-card.js";import{_ as n}from"./shared-307262a1.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import{a}from"./shared-09d4fbb8.js";import"./shared-88e36564.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-31651a9c.js";import"./shared-d14c2060.js";import"./shared-4674063d.js";import"./shared-e6828dbf.js";import"./shared-dfe2602a.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-77a4d8e8.js";import"./shared-4b67d699.js";import"./shared-e6997950.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./shared-c7f2f1ab.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-c2d3b32b.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-0479553e.js";import"./shared-11c2efc8.js";import"./shared-bf62a65b.js";import"./shared-a92ae606.js";let l,s=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control-item",class extends i{constructor(){super(...arguments),this.taxItemCategories=null,this.itemCategory=null,this.__resourceElementIsBusy=!1,this.__queryElementData=null}static get properties(){return n(n({},super.properties),{},{taxItemCategories:{attribute:"tax-item-categories"},itemCategory:{attribute:"item-category"}})}render(){var e,t,i,n,a;const d=null===(i=null===(t=null===(e=this.__queryElementData)||void 0===e?void 0:e._embedded)||void 0===t?void 0:t["fx:tax_item_categories"])||void 0===i?void 0:i[0];let m;try{const e=new URL(null!==(n=this.taxItemCategories)&&void 0!==n?n:""),t=new URL(this.href).pathname.split("/").pop();if(!t)throw new Error;e.searchParams.set("tax_id",t),e.searchParams.set("limit","1"),m=e.toString()}catch(e){m=void 0}return o(l||(l=s` <foxy-nucleon href="${0}" id="query" @update="${0}"> <foxy-nucleon parent="${0}" href="${0}" id="resource" @update="${0}"> </foxy-nucleon> </foxy-nucleon> <vaadin-checkbox class="px-m py-s block overflow-hidden" ?disabled="${0}" ?checked="${0}" @change="${0}"> ${0} </vaadin-checkbox> `),r(m),(e=>{const t=e.currentTarget;this.__queryElementData=t.data,this.requestUpdate()}),r(null!==(a=this.taxItemCategories)&&void 0!==a?a:void 0),r(null==d?void 0:d._links.self.href),(e=>{const t=e.currentTarget;this.__resourceElementIsBusy=!t.in("idle"),this.requestUpdate()}),!this.__queryElementData||this.__resourceElementIsBusy||this.disabled,!!d,(e=>{const t=e.currentTarget,i=this.renderRoot.querySelector("#resource");t.checked?(i.edit({tax_uri:this.data._links.self.href,item_category_uri:this.itemCategory}),i.submit()):i.delete()}),super.render())}});let d,m=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control",class extends t{constructor(){super(...arguments),this.taxes=null}static get properties(){return n(n({},super.properties),{},{taxes:{}})}renderControl(){var e,t,i,n;const r=this.nucleon;let a;try{const t=new URL(null!==(e=this.taxes)&&void 0!==e?e:"");t.searchParams.set("limit","5"),a=t.toString()}catch(e){a=null!==(t=this.taxes)&&void 0!==t?t:""}return o(d||(d=m` <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" infer="" key="title"> </foxy-i18n> <foxy-pagination first="${0}" infer="pagination"> <foxy-collection-page class="block mb-s divide-y divide-contrast-10 border border-contrast-10 rounded-t-l rounded-b-l" infer="" item="foxy-internal-item-category-form-taxes-control-item" .props="${0}"> </foxy-collection-page> </foxy-pagination> <foxy-i18n class="block text-xs text-secondary leading-xs mt-xs" infer="" key="helper_text"> </foxy-i18n> `),a,{"tax-item-categories":null!==(n=null===(i=null==r?void 0:r.form._links)||void 0===i?void 0:i["fx:tax_item_categories"].href)&&void 0!==n?n:"","item-category":null==r?void 0:r.href})}});let p,c,_,u,f,h,y,x,g,v,b,$,j=e=>e;class w extends(a(e,"item-category-form")){constructor(){super(...arguments),this.emailTemplates=null,this.templates={},this.taxes=null,this.__giftRecipientEmailTemplateLoaderId="gift-recipient-email-template-loader",this.__customerEmailTemplateLoaderId="customer-email-template-loader",this.__adminEmailTemplateLoaderId="admin-email-template-loader"}static get properties(){return n(n({},super.properties),{},{emailTemplates:{attribute:"email-templates"},taxes:{}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>e&&e.length<=50||"code:v8n_too_long",({name:e})=>!!e||"name:v8n_required",({name:e})=>e&&e.length<=50||"name:v8n_too_long",({item_delivery_type:e})=>!!e||"item-delivery-type:v8n_required",({item_delivery_type:e,max_downloads_per_customer:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-per-customer:v8n_required",({max_downloads_per_customer:e})=>"number"!=typeof e||e>=0||"max-downloads-per-customer:v8n_negative",({item_delivery_type:e,max_downloads_time_period:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-time-period:v8n_required",({max_downloads_time_period:e})=>"number"!=typeof e||e>=0||"max-downloads-time-period:v8n_negative",({customs_value:e})=>"number"!=typeof e||e>=0||"customs-value:v8n_negative",({item_delivery_type:e,default_weight:t})=>"shipped"!==e||"number"==typeof t||"default-weight:v8n_required",({default_weight:e})=>"number"!=typeof e||e>=0||"default-weight:v8n_negative",({item_delivery_type:e,default_weight_unit:t})=>"shipped"!==e||"string"==typeof t||"default-weight-unit:v8n_required",({item_delivery_type:e,default_length_unit:t})=>"shipped"!==e||"string"==typeof t||"default-length-unit:v8n_required",({item_delivery_type:e,shipping_flat_rate:t})=>"flat_rate"!==e||"number"==typeof t||"shipping-flat-rate:v8n_required",({shipping_flat_rate:e})=>"number"!=typeof e||e>=0||"shipping-flat-rate:v8n_negative",({item_delivery_type:e,shipping_flat_rate_type:t})=>"flat_rate"!==e||"string"==typeof t||"shipping-flat-rate-type:v8n_required",({handling_fee_type:e})=>!!e||"handling-fee-type:v8n_required",({handling_fee_type:e,handling_fee_minimum:t})=>"flat_percent_with_minimum"!==e||"number"==typeof t||"handling-fee-minimum:v8n_required",({handling_fee_minimum:e})=>"number"!=typeof e||e>=0||"handling-fee-minimum:v8n_negative",({handling_fee_type:e,handling_fee_percentage:t})=>"flat_percent_with_minimum"!==e&&"flat_percent"!==e||"number"==typeof t||"handling-fee-percentage:v8n_required",({handling_fee_percentage:e})=>"number"!=typeof e||e>=0||"handling-fee-percentage:v8n_negative",({send_admin_email:e,admin_email:t})=>!e||!!t||"admin-email:v8n_required"]}renderBody(){var e,t,i,n,a,l,s;const d=this.form.item_delivery_type,m=null!==(e=this.form.handling_fee_type)&&void 0!==e?e:"none";return o(p||(p=j` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="name" class="col-span-2"></foxy-internal-text-control> <foxy-internal-text-control infer="code" class="col-span-2"></foxy-internal-text-control> <foxy-internal-select-control infer="handling-fee-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-select-control infer="item-delivery-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control infer="discount-name" class="col-span-2"> </foxy-internal-text-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="admin-email-template-uri" class="${0}" .selectedItem="${0}" @change="${0}"> </foxy-internal-async-combo-box-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="customer-email-template-uri" class="col-span-2" .selectedItem="${0}" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="gift-recipient-email-template-uri" class="col-span-2" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> ${0} </div> ${0} `),r(this.form.customer_email_template_uri||void 0),this.__customerEmailTemplateLoaderId,(()=>this.requestUpdate()),r(this.form.gift_recipient_email_template_uri||void 0),this.__giftRecipientEmailTemplateLoaderId,(()=>this.requestUpdate()),r(this.form.admin_email_template_uri||void 0),this.__adminEmailTemplateLoaderId,(()=>this.requestUpdate()),w.__handlingFeeTypeOptions,"none"===m?"":o(c||(c=j` ${0} ${0} ${0} `),this.__renderHandlingFee(),m.includes("percent")?this.__renderHandlingFeePercentage():"","flat_percent_with_minimum"===m?this.__renderHandlingFeeMinimum():""),w.__itemDeliveryTypeOptions,"downloaded"===d?this.__renderDownloadDeliveryControls():"flat_rate"===d?[this.__renderFlatRateControls(),this.__renderCustomsValue()]:"shipped"===d?[this.__renderShippingControls(),this.__renderCustomsValue()]:"",this.form.discount_name?this.__renderDiscountBuilder():"",r(null!==(t=this.emailTemplates)&&void 0!==t?t:void 0),this.form.send_admin_email?"":"col-span-2",null===(i=this.__adminEmailTemplateLoader)||void 0===i?void 0:i.data,(e=>{this.edit({send_admin_email:!!e.detail,admin_email:e.detail?this.form.admin_email:""})}),this.form.send_admin_email?this.__renderAdminEmail():"",r(null!==(n=this.emailTemplates)&&void 0!==n?n:void 0),null===(a=this.__customerEmailTemplateLoader)||void 0===a?void 0:a.data,(e=>this.edit({send_customer_email:!!e.detail})),r(null!==(l=this.emailTemplates)&&void 0!==l?l:void 0),null===(s=this.__giftRecipientEmailTemplateLoader)||void 0===s?void 0:s.data,this.data?this.__renderTaxes():"",super.renderBody())}get __giftRecipientEmailTemplateLoader(){const e=this.__giftRecipientEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}get __customerEmailTemplateLoader(){const e=this.__customerEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}get __adminEmailTemplateLoader(){const e=this.__adminEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}__renderHandlingFee(){return o(_||(_=j` <foxy-internal-number-control infer="handling-fee" class="${0}"> </foxy-internal-number-control> `),"flat_percent"===this.form.handling_fee_type?"":"col-span-2")}__renderHandlingFeePercentage(){return o(u||(u=j` <foxy-internal-number-control infer="handling-fee-percentage"> </foxy-internal-number-control> `))}__renderHandlingFeeMinimum(){return o(f||(f=j` <foxy-internal-number-control infer="handling-fee-minimum"> </foxy-internal-number-control> `))}__renderDownloadDeliveryControls(){return o(h||(h=j` <foxy-internal-integer-control infer="max-downloads-per-customer"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-downloads-time-period"> </foxy-internal-integer-control> `))}__renderFlatRateControls(){return o(y||(y=j` <foxy-internal-number-control infer="shipping-flat-rate"> </foxy-internal-number-control> <foxy-internal-select-control infer="shipping-flat-rate-type" .options="${0}"> </foxy-internal-select-control> `),w.__shippingFlatRateTypeOptions)}__renderShippingControls(){return o(x||(x=j` <foxy-internal-integer-control infer="default-weight" class="col-span-2"> </foxy-internal-integer-control> <foxy-internal-select-control infer="default-weight-unit" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="default-length-unit" .options="${0}"> </foxy-internal-select-control> `),w.__defaultWeightUnitOptions,w.__defaultLengthUnitOptions)}__renderCustomsValue(){return o(g||(g=j` <foxy-internal-number-control infer="customs-value" class="col-span-2"> </foxy-internal-number-control> `))}__renderDiscountBuilder(){var e,t;const i={name:null!==(e=this.form.discount_name)&&void 0!==e?e:"",type:this.form.discount_type||"quantity_amount",details:null!==(t=this.form.discount_details)&&void 0!==t?t:""};return o(v||(v=j` <foxy-discount-builder infer="discount-builder" class="col-span-2" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),i,(e=>{const t=e.currentTarget;this.edit({discount_name:t.parsedValue.name,discount_type:t.parsedValue.type,discount_details:t.parsedValue.details})}))}__renderAdminEmail(){return o(b||(b=j`<foxy-internal-text-control infer="admin-email"> </foxy-internal-text-control>`))}__renderTaxes(){var e;return o($||($=j` <foxy-internal-item-category-form-taxes-control taxes="${0}" class="col-span-2" infer="taxes"> </foxy-internal-item-category-form-taxes-control> `),r(null!==(e=this.taxes)&&void 0!==e?e:void 0))}}w.__shippingFlatRateTypeOptions=[{label:"option_per_order",value:"per_order"},{label:"option_per_shipment",value:"per_shipment"}],w.__defaultWeightUnitOptions=[{label:"option_lbs",value:"LBS"},{label:"option_kgs",value:"KGS"}],w.__defaultLengthUnitOptions=[{label:"option_in",value:"IN"},{label:"option_cm",value:"CM"}],w.__itemDeliveryTypeOptions=[{label:"option_notshipped",value:"notshipped"},{label:"option_downloaded",value:"downloaded"},{label:"option_flat_rate",value:"flat_rate"},{label:"option_shipped",value:"shipped"},{label:"option_pickup",value:"pickup"}],w.__handlingFeeTypeOptions=[{label:"option_none",value:"none"},{label:"option_flat_per_order",value:"flat_per_order"},{label:"option_flat_per_item",value:"flat_per_item"},{label:"option_flat_percent",value:"flat_percent"},{label:"option_flat_percent_with_minimum",value:"flat_percent_with_minimum"}],customElements.define("foxy-item-category-form",w);export{w as ItemCategoryForm};
|
|
1
|
+
import"./shared-65318cc1.js";import"./shared-51d28e6d.js";import"./shared-8474bc4a.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-discount-builder.js";import"./foxy-nucleon-element.js";import{I as t}from"./shared-0a248c0d.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-b3ac59eb.js";import{TaxCard as i}from"./foxy-tax-card.js";import{_ as n}from"./shared-307262a1.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import{a}from"./shared-09d4fbb8.js";import"./shared-88e36564.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-31651a9c.js";import"./shared-d14c2060.js";import"./shared-4674063d.js";import"./shared-e6828dbf.js";import"./shared-dfe2602a.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-77a4d8e8.js";import"./shared-4b67d699.js";import"./shared-e6997950.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./shared-c7f2f1ab.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-c2d3b32b.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-0479553e.js";import"./shared-11c2efc8.js";import"./shared-bf62a65b.js";import"./shared-a92ae606.js";let l,s=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control-item",class extends i{constructor(){super(...arguments),this.taxItemCategories=null,this.itemCategory=null,this.__resourceElementIsBusy=!1,this.__queryElementData=null}static get properties(){return n(n({},super.properties),{},{taxItemCategories:{attribute:"tax-item-categories"},itemCategory:{attribute:"item-category"}})}render(){var e,t,i,n,a;const d=null===(i=null===(t=null===(e=this.__queryElementData)||void 0===e?void 0:e._embedded)||void 0===t?void 0:t["fx:tax_item_categories"])||void 0===i?void 0:i[0];let m;try{const e=new URL(null!==(n=this.taxItemCategories)&&void 0!==n?n:""),t=new URL(this.href).pathname.split("/").pop();if(!t)throw new Error;e.searchParams.set("tax_id",t),e.searchParams.set("limit","1"),m=e.toString()}catch(e){m=void 0}return o(l||(l=s` <foxy-nucleon href="${0}" id="query" @update="${0}"> <foxy-nucleon parent="${0}" href="${0}" id="resource" @update="${0}"> </foxy-nucleon> </foxy-nucleon> <vaadin-checkbox class="px-m py-s block overflow-hidden" ?disabled="${0}" ?checked="${0}" @change="${0}"> ${0} </vaadin-checkbox> `),r(m),(e=>{const t=e.currentTarget;this.__queryElementData=t.data,this.requestUpdate()}),r(null!==(a=this.taxItemCategories)&&void 0!==a?a:void 0),r(null==d?void 0:d._links.self.href),(e=>{const t=e.currentTarget;this.__resourceElementIsBusy=!t.in("idle"),this.requestUpdate()}),!this.__queryElementData||this.__resourceElementIsBusy||this.disabled,!!d,(e=>{const t=e.currentTarget,i=this.renderRoot.querySelector("#resource");t.checked?(i.edit({tax_uri:this.data._links.self.href,item_category_uri:this.itemCategory}),i.submit()):i.delete()}),super.render())}});let d,m=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control",class extends t{constructor(){super(...arguments),this.taxes=null}static get properties(){return n(n({},super.properties),{},{taxes:{}})}renderControl(){var e,t,i,n;const r=this.nucleon;let a;try{const t=new URL(null!==(e=this.taxes)&&void 0!==e?e:"");t.searchParams.set("limit","5"),a=t.toString()}catch(e){a=null!==(t=this.taxes)&&void 0!==t?t:""}return o(d||(d=m` <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" infer="" key="title"> </foxy-i18n> <foxy-pagination first="${0}" infer="pagination"> <foxy-collection-page class="block mb-s divide-y divide-contrast-10 border border-contrast-10 rounded-t-l rounded-b-l" infer="" item="foxy-internal-item-category-form-taxes-control-item" .props="${0}"> </foxy-collection-page> </foxy-pagination> <foxy-i18n class="block text-xs text-secondary leading-xs mt-xs" infer="" key="helper_text"> </foxy-i18n> `),a,{"tax-item-categories":null!==(n=null===(i=null==r?void 0:r.form._links)||void 0===i?void 0:i["fx:tax_item_categories"].href)&&void 0!==n?n:"","item-category":null==r?void 0:r.href})}});let p,c,_,u,f,h,y,x,g,v,b,$,j=e=>e;class w extends(a(e,"item-category-form")){constructor(){super(...arguments),this.emailTemplates=null,this.templates={},this.taxes=null,this.__giftRecipientEmailTemplateLoaderId="gift-recipient-email-template-loader",this.__customerEmailTemplateLoaderId="customer-email-template-loader",this.__adminEmailTemplateLoaderId="admin-email-template-loader"}static get properties(){return n(n({},super.properties),{},{emailTemplates:{attribute:"email-templates"},taxes:{}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>e&&e.length<=50||"code:v8n_too_long",({name:e})=>!!e||"name:v8n_required",({name:e})=>e&&e.length<=50||"name:v8n_too_long",({item_delivery_type:e})=>!!e||"item-delivery-type:v8n_required",({item_delivery_type:e,max_downloads_per_customer:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-per-customer:v8n_required",({max_downloads_per_customer:e})=>"number"!=typeof e||e>=0||"max-downloads-per-customer:v8n_negative",({item_delivery_type:e,max_downloads_time_period:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-time-period:v8n_required",({max_downloads_time_period:e})=>"number"!=typeof e||e>=0||"max-downloads-time-period:v8n_negative",({customs_value:e})=>"number"!=typeof e||e>=0||"customs-value:v8n_negative",({item_delivery_type:e,default_weight:t})=>"shipped"!==e||"number"==typeof t||"default-weight:v8n_required",({default_weight:e})=>"number"!=typeof e||e>=0||"default-weight:v8n_negative",({item_delivery_type:e,default_weight_unit:t})=>"shipped"!==e||"string"==typeof t||"default-weight-unit:v8n_required",({item_delivery_type:e,default_length_unit:t})=>"shipped"!==e||"string"==typeof t||"default-length-unit:v8n_required",({item_delivery_type:e,shipping_flat_rate:t})=>"flat_rate"!==e||"number"==typeof t||"shipping-flat-rate:v8n_required",({shipping_flat_rate:e})=>"number"!=typeof e||e>=0||"shipping-flat-rate:v8n_negative",({item_delivery_type:e,shipping_flat_rate_type:t})=>"flat_rate"!==e||"string"==typeof t||"shipping-flat-rate-type:v8n_required",({handling_fee_type:e})=>!!e||"handling-fee-type:v8n_required",({handling_fee_type:e,handling_fee_minimum:t})=>"flat_percent_with_minimum"!==e||"number"==typeof t||"handling-fee-minimum:v8n_required",({handling_fee_minimum:e})=>"number"!=typeof e||e>=0||"handling-fee-minimum:v8n_negative",({handling_fee_type:e,handling_fee_percentage:t})=>"flat_percent_with_minimum"!==e&&"flat_percent"!==e||"number"==typeof t||"handling-fee-percentage:v8n_required",({handling_fee_percentage:e})=>"number"!=typeof e||e>=0||"handling-fee-percentage:v8n_negative",({send_admin_email:e,admin_email:t})=>!e||!!t||"admin-email:v8n_required"]}renderBody(){var e,t,i,n,a,l,s;const d=this.form.item_delivery_type,m=null!==(e=this.form.handling_fee_type)&&void 0!==e?e:"none";return o(p||(p=j` <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> <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="name" class="col-span-2"></foxy-internal-text-control> <foxy-internal-text-control infer="code" class="col-span-2"></foxy-internal-text-control> <foxy-internal-select-control infer="handling-fee-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-select-control infer="item-delivery-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control infer="discount-name" class="col-span-2"> </foxy-internal-text-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="admin-email-template-uri" class="${0}" .selectedItem="${0}" @change="${0}"> </foxy-internal-async-combo-box-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="customer-email-template-uri" class="col-span-2" .selectedItem="${0}" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="gift-recipient-email-template-uri" class="col-span-2" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> ${0} </div> ${0} `),r(this.form.customer_email_template_uri||void 0),this.__customerEmailTemplateLoaderId,(()=>this.requestUpdate()),r(this.form.gift_recipient_email_template_uri||void 0),this.__giftRecipientEmailTemplateLoaderId,(()=>this.requestUpdate()),r(this.form.admin_email_template_uri||void 0),this.__adminEmailTemplateLoaderId,(()=>this.requestUpdate()),w.__handlingFeeTypeOptions,"none"===m?"":o(c||(c=j` ${0} ${0} ${0} `),this.__renderHandlingFee(),m.includes("percent")?this.__renderHandlingFeePercentage():"","flat_percent_with_minimum"===m?this.__renderHandlingFeeMinimum():""),w.__itemDeliveryTypeOptions,"downloaded"===d?this.__renderDownloadDeliveryControls():"flat_rate"===d?[this.__renderFlatRateControls(),this.__renderCustomsValue()]:"shipped"===d?[this.__renderShippingControls(),this.__renderCustomsValue()]:"",this.form.discount_name?this.__renderDiscountBuilder():"",r(null!==(t=this.emailTemplates)&&void 0!==t?t:void 0),this.form.send_admin_email?"":"col-span-2",null===(i=this.__adminEmailTemplateLoader)||void 0===i?void 0:i.data,(e=>{this.edit({send_admin_email:!!e.detail,admin_email:e.detail?this.form.admin_email:""})}),this.form.send_admin_email?this.__renderAdminEmail():"",r(null!==(n=this.emailTemplates)&&void 0!==n?n:void 0),null===(a=this.__customerEmailTemplateLoader)||void 0===a?void 0:a.data,(e=>this.edit({send_customer_email:!!e.detail})),r(null!==(l=this.emailTemplates)&&void 0!==l?l:void 0),null===(s=this.__giftRecipientEmailTemplateLoader)||void 0===s?void 0:s.data,this.data?this.__renderTaxes():"",super.renderBody())}get __giftRecipientEmailTemplateLoader(){const e=this.__giftRecipientEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}get __customerEmailTemplateLoader(){const e=this.__customerEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}get __adminEmailTemplateLoader(){const e=this.__adminEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}__renderHandlingFee(){return o(_||(_=j` <foxy-internal-number-control infer="handling-fee" class="${0}"> </foxy-internal-number-control> `),"flat_percent"===this.form.handling_fee_type?"":"col-span-2")}__renderHandlingFeePercentage(){return o(u||(u=j` <foxy-internal-number-control infer="handling-fee-percentage"> </foxy-internal-number-control> `))}__renderHandlingFeeMinimum(){return o(f||(f=j` <foxy-internal-number-control infer="handling-fee-minimum"> </foxy-internal-number-control> `))}__renderDownloadDeliveryControls(){return o(h||(h=j` <foxy-internal-integer-control infer="max-downloads-per-customer"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-downloads-time-period"> </foxy-internal-integer-control> `))}__renderFlatRateControls(){return o(y||(y=j` <foxy-internal-number-control infer="shipping-flat-rate"> </foxy-internal-number-control> <foxy-internal-select-control infer="shipping-flat-rate-type" .options="${0}"> </foxy-internal-select-control> `),w.__shippingFlatRateTypeOptions)}__renderShippingControls(){return o(x||(x=j` <foxy-internal-integer-control infer="default-weight" class="col-span-2"> </foxy-internal-integer-control> <foxy-internal-select-control infer="default-weight-unit" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="default-length-unit" .options="${0}"> </foxy-internal-select-control> `),w.__defaultWeightUnitOptions,w.__defaultLengthUnitOptions)}__renderCustomsValue(){return o(g||(g=j` <foxy-internal-number-control infer="customs-value" class="col-span-2"> </foxy-internal-number-control> `))}__renderDiscountBuilder(){var e,t;const i={name:null!==(e=this.form.discount_name)&&void 0!==e?e:"",type:this.form.discount_type||"quantity_amount",details:null!==(t=this.form.discount_details)&&void 0!==t?t:""};return o(v||(v=j` <foxy-discount-builder infer="discount-builder" class="col-span-2" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),i,(e=>{const t=e.currentTarget;this.edit({discount_name:t.parsedValue.name,discount_type:t.parsedValue.type,discount_details:t.parsedValue.details})}))}__renderAdminEmail(){return o(b||(b=j`<foxy-internal-text-control infer="admin-email"> </foxy-internal-text-control>`))}__renderTaxes(){var e;return o($||($=j` <foxy-internal-item-category-form-taxes-control taxes="${0}" class="col-span-2" infer="taxes"> </foxy-internal-item-category-form-taxes-control> `),r(null!==(e=this.taxes)&&void 0!==e?e:void 0))}}w.__shippingFlatRateTypeOptions=[{label:"option_per_order",value:"per_order"},{label:"option_per_shipment",value:"per_shipment"}],w.__defaultWeightUnitOptions=[{label:"option_lbs",value:"LBS"},{label:"option_kgs",value:"KGS"}],w.__defaultLengthUnitOptions=[{label:"option_in",value:"IN"},{label:"option_cm",value:"CM"}],w.__itemDeliveryTypeOptions=[{label:"option_notshipped",value:"notshipped"},{label:"option_downloaded",value:"downloaded"},{label:"option_flat_rate",value:"flat_rate"},{label:"option_shipped",value:"shipped"},{label:"option_pickup",value:"pickup"}],w.__handlingFeeTypeOptions=[{label:"option_none",value:"none"},{label:"option_flat_per_order",value:"flat_per_order"},{label:"option_flat_per_item",value:"flat_per_item"},{label:"option_flat_percent",value:"flat_percent"},{label:"option_flat_percent_with_minimum",value:"flat_percent_with_minimum"}],customElements.define("foxy-item-category-form",w);export{w as ItemCategoryForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-e6997950.js";import"./shared-bafcab47.js";import"./shared-65318cc1.js";import"./shared-db21f6db.js";import"./shared-7995407d.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-nucleon-element.js";import"./shared-77a4d8e8.js";import{_ as t,aJ as r,$ as i}from"./shared-307262a1.js";import{a as o}from"./shared-09d4fbb8.js";import{i as a}from"./shared-d3bf9ac0.js";import{c as l}from"./shared-4e709717.js";import{h as s}from"./shared-7f33a83a.js";import{h as n}from"./shared-92f27a38.js";import{s as d}from"./shared-65ba8b39.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-31651a9c.js";import"./shared-bdb51db9.js";import"./shared-4674063d.js";import"./shared-d14c2060.js";import"./shared-88e36564.js";import"./shared-e6828dbf.js";import"./shared-dfe2602a.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-c7f2f1ab.js";import"./shared-4b67d699.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-b3ac59eb.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-fe54babe.js";let c,h,p,f,u,m,_,v,y,b,g,x,$,j,k,S,V,M,w=e=>e;const L=o(e,"payments-api-payment-method-form");class P extends L{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_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.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],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"}],this.__tab=0}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),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}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 l;try{l=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){l={}}for(const e of a)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(!n(l,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderPaymentMethodConfig(this.form.type):this.__renderPaymentMethodSelector()}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])=>{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 __availablePaymentMethodsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,i=e.exec(t).groups.presetId;return new URL(`/payment_presets/${i}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}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 __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(){return s(c||(c=w` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-medium border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <section data-testid="select-method-list"> <div class="-my-s"> ${0} </div> </section> `),a(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>s(h||(h=w` <p class="w-m text-center font-medium text-tertiary py-s">${0}</p> <ul class="grid grid-cols-1"> ${0} </ul> `),e,t.map((e=>s(p||(p=w`<li>${0}</li>`),this.__renderPaymentMethodButton(e))))))))}__renderPaymentMethodConfig(e){var t,r,i,o,a,n;const d=P.defaultImageSrc;return s(f||(f=w` <figure data-testid="logo" class="relative flex flex-col gap-m p-m items-center"> <img class="relative h-xl w-xl object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="relative min-w-0 font-medium text-xl text-center"> ${0}​ </figcaption> </figure> <div class="rounded border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden" style="--lumo-border-radius:var(--lumo-border-radius-s)"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:d,(e=>e.currentTarget.src=d),null!==(o=null===(i=this.form.helper)||void 0===i?void 0:i.name)&&void 0!==o?o:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),l({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,i,o;const a=0===t?"":`-${e}`,n=0===t?this.__liveBlocks:this.__testBlocks;return s(u||(u=w` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),l({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?s(m||(m=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,a):"",(null===(i=this.form.helper)||void 0===i?void 0:i.third_party_key_description)?s(_||(_=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,a):"",(null===(o=this.form.helper)||void 0===o?void 0:o.key_description)?s(v||(v=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,a):"",n.map((e=>this.__renderBlock(e))))})),(null===(a=this.form.helper)||void 0===a?void 0:a.supports_3d_secure)?s(y||(y=w` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?s(b||(b=w` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",(null===(n=this.data)||void 0===n?void 0:n.type)?"":s(g||(g=w` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=P.defaultImageSrc;return s(x||(x=w` <button class="${0}" ?disabled="${0}" @click="${0}"> <figure class="flex items-center gap-m h-m"> <img class="relative h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> ${0} </figcaption> </figure> </button> `),l({"w-full block text-left p-s rounded -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,(e=>e.currentTarget.src=o),l({"min-w-0 flex-1 truncate leading-s":!0,"text-tertiary":!!t.conflict}),t.name,t.conflict?s($||($=w` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")}__renderBlock(e){return s(j||(j=w`${0}`),e.fields.map((t=>{var r,o,a;const l=[e.parent_id,e.id,t.id].filter((e=>!!e)),n=["additional-fields",...l].join("-").replace(/_/g,"-"),c=()=>{var e,r;try{const t=JSON.parse(null!==(e=this.form.additional_fields)&&void 0!==e?e:"{}");return null!==(r=i(t,l))&&void 0!==r?r:t.default_value}catch(e){return t.default_value}},h=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(d(r,l,e))})}catch(e){return""}},p=t.options;return s(k||(k=w` ${0} `),"checkbox"===t.type?s(S||(S=w` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",n,[{label:t.name,value:"checked"}],(()=>c()?["checked"]:[]),(e=>{h(e.includes("checked"))})):"select"===t.type?s(V||(V=w` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.name,n,p.map((({name:e,value:t})=>({label:e,value:t}))),c,h):s(M||(M=w` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(a=t.description)&&void 0!==a?a:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,n,c,h))})))}}customElements.define("foxy-payments-api-payment-method-form",P);export{P as PaymentsApiPaymentMethodForm};
|
|
1
|
+
import"./shared-e6997950.js";import"./shared-bafcab47.js";import"./shared-65318cc1.js";import"./shared-db21f6db.js";import"./shared-30bebd39.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-nucleon-element.js";import"./shared-77a4d8e8.js";import{_ as t,aJ as r,$ as i}from"./shared-307262a1.js";import{a as o}from"./shared-09d4fbb8.js";import{i as a}from"./shared-d3bf9ac0.js";import{c as l}from"./shared-4e709717.js";import{h as s}from"./shared-7f33a83a.js";import{h as n}from"./shared-92f27a38.js";import{s as d}from"./shared-65ba8b39.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-31651a9c.js";import"./shared-bdb51db9.js";import"./shared-4674063d.js";import"./shared-d14c2060.js";import"./shared-88e36564.js";import"./shared-e6828dbf.js";import"./shared-dfe2602a.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-c7f2f1ab.js";import"./shared-4b67d699.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-b3ac59eb.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-fe54babe.js";let c,h,p,f,u,m,_,v,y,b,g,x,$,j,k,S,V,M,w=e=>e;const L=o(e,"payments-api-payment-method-form");class P extends L{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_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.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],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"}],this.__tab=0}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),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}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 l;try{l=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){l={}}for(const e of a)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(!n(l,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderPaymentMethodConfig(this.form.type):this.__renderPaymentMethodSelector()}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])=>{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 __availablePaymentMethodsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,i=e.exec(t).groups.presetId;return new URL(`/payment_presets/${i}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}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 __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(){return s(c||(c=w` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-medium border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <section data-testid="select-method-list"> <div class="-my-s"> ${0} </div> </section> `),a(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>s(h||(h=w` <p class="w-m text-center font-medium text-tertiary py-s">${0}</p> <ul class="grid grid-cols-1"> ${0} </ul> `),e,t.map((e=>s(p||(p=w`<li>${0}</li>`),this.__renderPaymentMethodButton(e))))))))}__renderPaymentMethodConfig(e){var t,r,i,o,a,n;const d=P.defaultImageSrc;return s(f||(f=w` <figure data-testid="logo" class="relative flex flex-col gap-m p-m items-center"> <img class="relative h-xl w-xl object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="relative min-w-0 font-medium text-xl text-center"> ${0}​ </figcaption> </figure> <div class="rounded border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden" style="--lumo-border-radius:var(--lumo-border-radius-s)"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:d,(e=>e.currentTarget.src=d),null!==(o=null===(i=this.form.helper)||void 0===i?void 0:i.name)&&void 0!==o?o:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),l({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,i,o;const a=0===t?"":`-${e}`,n=0===t?this.__liveBlocks:this.__testBlocks;return s(u||(u=w` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),l({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?s(m||(m=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,a):"",(null===(i=this.form.helper)||void 0===i?void 0:i.third_party_key_description)?s(_||(_=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,a):"",(null===(o=this.form.helper)||void 0===o?void 0:o.key_description)?s(v||(v=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,a):"",n.map((e=>this.__renderBlock(e))))})),(null===(a=this.form.helper)||void 0===a?void 0:a.supports_3d_secure)?s(y||(y=w` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?s(b||(b=w` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",(null===(n=this.data)||void 0===n?void 0:n.type)?"":s(g||(g=w` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=P.defaultImageSrc;return s(x||(x=w` <button class="${0}" ?disabled="${0}" @click="${0}"> <figure class="flex items-center gap-m h-m"> <img class="relative h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> ${0} </figcaption> </figure> </button> `),l({"w-full block text-left p-s rounded -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,(e=>e.currentTarget.src=o),l({"min-w-0 flex-1 truncate leading-s":!0,"text-tertiary":!!t.conflict}),t.name,t.conflict?s($||($=w` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")}__renderBlock(e){return s(j||(j=w`${0}`),e.fields.map((t=>{var r,o,a;const l=[e.parent_id,e.id,t.id].filter((e=>!!e)),n=["additional-fields",...l].join("-").replace(/_/g,"-"),c=()=>{var e,r;try{const t=JSON.parse(null!==(e=this.form.additional_fields)&&void 0!==e?e:"{}");return null!==(r=i(t,l))&&void 0!==r?r:t.default_value}catch(e){return t.default_value}},h=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(d(r,l,e))})}catch(e){return""}},p=t.options;return s(k||(k=w` ${0} `),"checkbox"===t.type?s(S||(S=w` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",n,[{label:t.name,value:"checked"}],(()=>c()?["checked"]:[]),(e=>{h(e.includes("checked"))})):"select"===t.type?s(V||(V=w` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.name,n,p.map((({name:e,value:t})=>({label:e,value:t}))),c,h):s(M||(M=w` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(a=t.description)&&void 0!==a?a:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,n,c,h))})))}}customElements.define("foxy-payments-api-payment-method-form",P);export{P as PaymentsApiPaymentMethodForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-db21f6db.js";import"./shared-1d28220a.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.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 t}from"./shared-307262a1.js";import{a as r}from"./shared-09d4fbb8.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-b3ac59eb.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-e6828dbf.js";import"./shared-31651a9c.js";import"./shared-4674063d.js";import"./shared-dfe2602a.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-77a4d8e8.js";import"./shared-64657919.js";import"./shared-4b67d699.js";import"./shared-c7f2f1ab.js";import"./shared-d3bf9ac0.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-e6997950.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-ff992ead.js";import"./shared-a92ae606.js";import"./shared-51d28e6d.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-c4240bc6.js";import"./shared-88e36564.js";import"./shared-d14c2060.js";import"./foxy-nucleon-element.js";import"./shared-65ba8b39.js";import"./shared-fe54babe.js";import"./shared-92f27a38.js";import"./shared-bafcab47.js";import"./shared-bdb51db9.js";import"./shared-65318cc1.js";import"./shared-
|
|
1
|
+
import"./shared-db21f6db.js";import"./shared-1d28220a.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.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 t}from"./shared-307262a1.js";import{a as r}from"./shared-09d4fbb8.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-b3ac59eb.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-e6828dbf.js";import"./shared-31651a9c.js";import"./shared-4674063d.js";import"./shared-dfe2602a.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-77a4d8e8.js";import"./shared-64657919.js";import"./shared-4b67d699.js";import"./shared-c7f2f1ab.js";import"./shared-d3bf9ac0.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-e6997950.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-ff992ead.js";import"./shared-a92ae606.js";import"./shared-51d28e6d.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-c4240bc6.js";import"./shared-88e36564.js";import"./shared-d14c2060.js";import"./foxy-nucleon-element.js";import"./shared-65ba8b39.js";import"./shared-fe54babe.js";import"./shared-92f27a38.js";import"./shared-bafcab47.js";import"./shared-bdb51db9.js";import"./shared-65318cc1.js";import"./shared-30bebd39.js";let s,o,i,p,d,n,m=e=>e;const h=r(e,"payments-api-payment-preset-form");class c extends h{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.templates={},this.__getIsPOEnabledValue=()=>this.form.is_purchase_order_enabled?["true"]:[],this.__setIsPOEnabledValue=e=>{this.edit({is_purchase_order_enabled:e.includes("true")})},this.__getIsLiveValue=()=>this.form.is_live?["live"]:["test"],this.__setIsLiveValue=e=>{this.edit({is_live:e.includes("live")})}}static get properties(){return t(t({},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"]}renderBody(){const e=this.constructor;return a(s||(s=m` <foxy-internal-text-control infer="description"></foxy-internal-text-control> <div class="-mb-s"> <foxy-internal-checkbox-group-control infer="is-live" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="is-purchase-order-enabled" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> </div> ${0} ${0} `),this.__getIsLiveValue,this.__setIsLiveValue,e.__isLiveOptions,this.__getIsPOEnabledValue,this.__setIsPOEnabledValue,e.__isPOEnabledOptions,this.data?a(o||(o=m` <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> `),this.data._links["fx:payment_methods"].href,(e=>a(i||(i=m` <foxy-payments-api-payment-method-card parent="${0}" infer="payments-api-payment-method-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-payment-method-card> `),e.parent,e.href,this.getPaymentMethodImageSrc)),(e=>a(p||(p=m` <foxy-payments-api-payment-method-form parent="${0}" infer="payments-api-payment-method-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-payment-method-form> `),e.dialog.parent,e.dialog.href,this.getPaymentMethodImageSrc,e.handleFetch,e.handleUpdate)),this.data._links["fx:fraud_protections"].href,(e=>a(d||(d=m` <foxy-payments-api-fraud-protection-card parent="${0}" infer="payments-api-fraud-protection-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-fraud-protection-card> `),e.parent,e.href,this.getFraudProtectionImageSrc)),(e=>a(n||(n=m` <foxy-payments-api-fraud-protection-form parent="${0}" infer="payments-api-fraud-protection-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-fraud-protection-form> `),e.dialog.parent,e.dialog.href,this.getFraudProtectionImageSrc,e.handleFetch,e.handleUpdate))):"",super.renderBody())}}c.__isPOEnabledOptions=[{label:"option_true",value:"true"}],c.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",c);export{c as PaymentsApiPaymentPresetForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-e6997950.js";import"./shared-db21f6db.js";import"./shared-65318cc1.js";import"./shared-6abdfcf2.js";import"./shared-7995407d.js";import"./shared-4dc58b73.js";import"./shared-4dee79d4.js";import"./shared-51d28e6d.js";import"./shared-8474bc4a.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-nucleon-element.js";import"./shared-77a4d8e8.js";import{_ as t}from"./shared-307262a1.js";import{R as o,a as i}from"./shared-09d4fbb8.js";import{i as r}from"./shared-d3bf9ac0.js";import{c as s}from"./shared-4e709717.js";import{h as n}from"./shared-7f33a83a.js";import{c as a}from"./shared-53061389.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-b3ac59eb.js";import"./shared-e6828dbf.js";import"./shared-31651a9c.js";import"./shared-4674063d.js";import"./shared-dfe2602a.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-c7f2f1ab.js";import"./shared-4b67d699.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-88e36564.js";import"./shared-d14c2060.js";import"./shared-d519a301.js";import"./shared-f3b35364.js";import"./shared-11c2efc8.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-64f98a0f.js";import"./shared-e8e92fe3.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-fe54babe.js";let l,c,d,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w,q=e=>e;const O=o(i(e,"store-form"));class C extends O{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.templates={},this.__singleCheckboxGroupOptions=[{label:"option_checked",value:"checked"}],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.__getBccOnReceiptEmailValue=()=>this.form.bcc_on_receipt_email?["checked"]:[],this.__setBccOnReceiptEmailValue=e=>{this.edit({bcc_on_receipt_email:e.includes("checked")})},this.__getUseEmailDnsValue=()=>this.form.use_email_dns?["checked"]:[],this.__setUseEmailDnsValue=e=>{this.edit({use_email_dns:e.includes("checked")})},this.__getUseSmtpConfigValue=()=>this.form.smtp_config?["checked"]:[],this.__setUseSmtpConfigValue=e=>{e.includes("checked")?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getFeaturesMultishipValue=()=>this.form.features_multiship?["checked"]:[],this.__setFeaturesMultishipValue=e=>{this.edit({features_multiship:e.includes("checked")})},this.__getRequireSignedShippingRatesValue=()=>this.form.require_signed_shipping_rates?["checked"]:[],this.__setRequireSignedShippingRatesValue=e=>{this.edit({require_signed_shipping_rates:e.includes("checked")})},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.__getProductsRequireExpiresPropertyValue=()=>this.form.products_require_expires_property?["checked"]:[],this.__setProductsRequireExpiresPropertyValue=e=>{this.edit({products_require_expires_property:e.includes("checked")})},this.__getUseCartValidationValue=()=>this.form.use_cart_validation?["checked"]:[],this.__setUseCartValidationValue=e=>{this.edit({use_cart_validation:e.includes("checked")})},this.__getSingleSignOnUrlValue=()=>{var e;return this.form.use_single_sign_on&&null!==(e=this.form.single_sign_on_url)&&void 0!==e?e:""},this.__setSingleSignOnUrlValue=e=>{this.edit({use_single_sign_on:!!e,single_sign_on_url:e})},this.__getWebhookUrlValue=()=>{var e;return this.form.use_webhook&&null!==(e=this.form.webhook_url)&&void 0!==e?e:""},this.__setWebhookUrlValue=e=>{this.edit({use_webhook:!!e,webhook_url:e})},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(".")})}}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},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<=50||"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<=100||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!!e||"webhook-url:v8n_required",({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<=100||"custom-display-id-config-enabled:v8n_too_long"]}renderBody(){var e,t,o,i,s,a,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w;const O=this.form.use_email_dns&&!(null===(e=this.data)||void 0===e?void 0:e.use_email_dns)&&!this.hiddenSelector.matches("use-email-dns",!0),C=this.form.require_signed_shipping_rates&&!(null===(t=this.data)||void 0===t?void 0:t.require_signed_shipping_rates)&&!this.hiddenSelector.matches("require-signed-shipping-rates",!0),U=this.form.products_require_expires_property&&!(null===(o=this.data)||void 0===o?void 0:o.products_require_expires_property)&&!this.hiddenSelector.matches("products-require-expires-property",!0),N=this.form.use_cart_validation&&!(null===(i=this.data)||void 0===i?void 0:i.use_cart_validation)&&!this.hiddenSelector.matches("use-cart-validation",!0),R=this.t(this.form.use_remote_domain&&!(null===(s=this.data)||void 0===s?void 0:s.use_remote_domain)?"store-domain.custom_domain_note":"store-domain.helper_text"),E=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",J=this.__renderLoader(1),M=this.__renderLoader(2),T=this.__renderLoader(3),P=this.__renderLoader(4),D=this.__renderLoader(5),L=this.__renderLoader(6),W=this.__renderLoader(7),A=this.__renderLoader(8),B=this.__renderLoader(9),G=Object.entries(null!==(u=null===(a=null==M?void 0:M.data)||void 0===a?void 0:a.values)&&void 0!==u?u:{}),I=null==P?void 0:P.data,z=null==D?void 0:D.data,F=null==L?void 0:L.data,H=null!==(p=null===(_=null==W?void 0:W.data)||void 0===_?void 0:_.values.timezone)&&void 0!==p?p:[],K=Object.values(null!==(m=null===(h=null==A?void 0:A.data)||void 0===h?void 0:h.values)&&void 0!==m?m:{}),Q=Object.values(null!==(g=null===(f=null==B?void 0:B.data)||void 0===f?void 0:f.values)&&void 0!==g?g:{}),X=Object.entries(null!==(x=null===(y=null==J?void 0:J.data)||void 0===y?void 0:y.values)&&void 0!==x?x:{}),Y=Object.entries(null!==(v=null===(b=null==T?void 0:T.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),Z=Object.entries(null!==($=null==z?void 0:z.values)&&void 0!==$?$:{}),ee=Object.entries(null!==(V=null==F?void 0:F.values)&&void 0!==V?V:{}),te=X.map((e=>({label:e[1].description,value:e[0]}))),oe=G.map((([e,t])=>({label:t,value:e}))),ie=Y.map((([e,t])=>({label:t,value:e}))),re=Z.map((([e,t])=>({value:e,label:t}))),se=ee.map((([e,t])=>({value:e,label:t}))),ne=H.map((e=>({label:e.description,value:e.timezone}))),ae=K.map((e=>({label:e.default,value:e.cc2}))),le=Q.map((e=>({label:e.default,value:e.code})));let ce;try{const e=new URL(null!==(k=this.regions)&&void 0!==k?k:""),t=this.form.country;t&&e.searchParams.set("country_code",t),ce=e.toString()}catch(e){ce=void 0}return n(l||(l=q` ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div class="grid gap-m grid-cols-1 sm-grid-cols-2"> <foxy-internal-text-control infer="store-name"></foxy-internal-text-control> <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="store-url"></foxy-internal-text-control> <foxy-internal-editable-list-control infer="store-email" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-select-control infer="timezone" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="version" item-value-path="_links.self.href" infer="store-version-uri" first="${0}" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="from-email" class="sm-col-span-2" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-checkbox-group-control infer="bcc-on-receipt-email" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="use-email-dns" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-smtp-config" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control> <foxy-internal-select-control infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-checkbox-group-control infer="features-multiship" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="require-signed-shipping-rates" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="locale-code" .options="${0}"> </foxy-internal-select-control> ${0} ${0} <foxy-internal-text-control class="sm-col-span-2" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-frequency-control class="sm-col-span-2" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-checkbox-group-control infer="products-require-expires-property" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-cart-validation" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="checkout-type" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-password-control infer="unified-order-entry-password"> </foxy-internal-password-control> <foxy-internal-text-control infer="single-sign-on-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webhook-url" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} ${0} </div> ${0} `),J.render(this.customerPasswordHashTypes),M.render(this.shippingAddressTypes),T.render(this.checkoutTypes),P.render(this.form.store_version_uri),D.render(this.localeCodes),W.render(this.timezones),A.render(this.countries),L.render(this.languages),B.render(ce),R,E,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,ne,r(null!==(j=this.storeVersions)&&void 0!==j?j:void 0),I,null!==(w=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==w?w:this.t("from-email.placeholder"),this.__getBccOnReceiptEmailValue,this.__setBccOnReceiptEmailValue,this.__singleCheckboxGroupOptions,this.__getUseEmailDnsValue,this.__setUseEmailDnsValue,this.__singleCheckboxGroupOptions,O?this.__renderWarning("use_email_dns_helper_text",{href:"https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc",caption:"How Emails Are Sent (SPF, DKIM, DMARC, etc.)"}):"",this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.__singleCheckboxGroupOptions,this.form.smtp_config&&!this.hiddenSelector.matches("smtp-config",!0)?this.__renderSmtpConfig():"",ae,le,oe,this.__getFeaturesMultishipValue,this.__setFeaturesMultishipValue,this.__singleCheckboxGroupOptions,this.__getRequireSignedShippingRatesValue,this.__setRequireSignedShippingRatesValue,this.__singleCheckboxGroupOptions,C?this.__renderWarning("require_signed_shipping_rates_helper_text"):"",se,re,this.hiddenSelector.matches("currency-style",!0)?"":this.__renderCurrencyStyleSelector(),this.hiddenSelector.matches("custom-display-id-config",!0)?"":this.__renderCustomIDSettings(),this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__getProductsRequireExpiresPropertyValue,this.__setProductsRequireExpiresPropertyValue,this.__singleCheckboxGroupOptions,U?this.__renderWarning("products_require_expires_property_helper_text"):"",this.__getUseCartValidationValue,this.__setUseCartValidationValue,this.__singleCheckboxGroupOptions,N?this.__renderWarning("use_cart_validation_helper_text",{href:"https://wiki.foxycart.com/v/2.0/hmac_validation",caption:"HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms"}):"",ie,te,(e=>{var t;const o=X.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?n(c||(c=q` <foxy-internal-number-control infer="customer-password-hash-config"> </foxy-internal-number-control> `)):n(d||(d=q` <foxy-internal-text-control infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.__getSingleSignOnUrlValue,this.__setSingleSignOnUrlValue,this.__getWebhookUrlValue,this.__setWebhookUrlValue,this.__renderWebhookKey(),this.data&&!this.hiddenSelector.matches("is-maintenance-mode",!0)?this.__renderMaintenanceModeSwitch():"",super.renderBody())}__renderWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const i=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:i,xml_datafeed:i,api_legacy:i,sso:i}}return Object.keys(o).map((e=>n(u||(u=q` <foxy-internal-password-control infer="webhook-key-${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),e.replace("_","-"),(()=>o[e]),(t=>{o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}))))}__renderMaintenanceModeSwitch(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.is_maintenance_mode),o=(t?"disable":"enable")+"_maintenance_mode",i=`maintenance_mode_${t?"on":"off"}_explainer`;return n(_||(_=q` <div data-testid="is-maintenance-mode" class="${0}"> <foxy-i18n infer="" class="block mb-s" key="${0}"></foxy-i18n> <vaadin-button theme="tertiary small ${0}" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-button> </div> `),s({"rounded leading-s text-s sm-col-span-2":!0,"text-tertiary":!t,"text-error":t}),i,t?"contrast":"",this.disabledSelector.matches("is-maintenance-mode",!0),(()=>{this.edit({is_maintenance_mode:!this.form.is_maintenance_mode}),this.submit()}),o)}__renderCurrencyStyleSelector(){const e={101:0,100:0,"001":1,"000":2,111:3,110:3,"011":4,"010":5},t=[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join(""),o=e[t],i=this.disabledSelector.matches("currency-style",!0),r=this.readonlySelector.matches("currency-style",!0);return n(p||(p=q` <div data-testid="currency-style" class="sm-col-span-2"> ${0} <div class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"> <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"></foxy-i18n> <div class="grid grid-cols-3 bg-contrast-10 rounded" style="gap:1px;padding:1px"> ${0} </div> <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("currency-style:before"),["12.34","USD 12.34","$12.34","12","USD 12","$12"].map(((t,a)=>n(h||(h=q` <label style="--lumo-border-radius:calc(var(--lumo-border-radius-m) - 1px)" class="${0}"> <span class="font-medium font-tnum">${0}</span> <input class="sr-only" value="${0}" type="radio" name="currency-style" ?checked="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </label> `),s({"relative z-0 px-s h-m flex items-center transition-colors":!0,"hover-cursor-pointer":!0,"focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50":!0,"bg-base text-body hover-bg-transparent":a!==o,"bg-primary text-primary-contrast":a===o,"rounded-tl":0===a,"rounded-tr":2===a,"rounded-bl":3===a,"rounded-br":5===a}),t,a,a===o,i,r,(()=>{const t=Object.entries(e).find((e=>e[1]===a))[0];this.edit({hide_currency_symbol:Boolean(Number(t[0])),hide_decimal_characters:Boolean(Number(t[1])),use_international_currency_symbol:Boolean(Number(t[2]))})})))),this.renderTemplateOrSlot("currency-style:after"))}__renderCustomIDSettings(){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=a(t)}const i=parseInt(o.start||"0"),r=parseInt(o.length||"0")-o.prefix.length-o.suffix.length,s=Math.min(i+Math.floor(Math.random()*Math.pow(10,r)),Math.pow(10,r)-1),l=`${o.prefix}${s.toString().padStart(r,"0")}${o.suffix}`,c=Math.floor(1e3*Math.random()),d=String(c).padStart(3,"0");return n(m||(m=q` <foxy-internal-checkbox-group-control infer="custom-display-id-config-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>o.enabled?["checked"]:[]),(e=>{o.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.enabled?n(f||(f=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-integer-control infer="custom-display-id-config-start" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="custom-display-id-config-length" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-text-control infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> <foxy-internal-checkbox-group-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>parseInt(o.start||"0")),(e=>{o.start=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>parseInt(o.length||"0")),(e=>{o.length=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.prefix),(e=>{o.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.suffix),(e=>{o.suffix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(g||(g=q` <table data-testid="custom-display-id-config-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-first-example"> </foxy-i18n> </td> <td> ${0}${0}${0} </td> </tr> <tr style="width:1%"> <td> <foxy-i18n infer="" key="custom-display-id-config-random-example"> </foxy-i18n> </td> <td>${0}</td> </tr> </tbody> </table> `),o.prefix,i.toString().padStart(r,"0"),o.suffix,l):"",(()=>o.transaction_journal_entries.enabled?["checked"]:[]),(e=>{o.transaction_journal_entries.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.transaction_journal_entries.enabled?n(y||(y=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control 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 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 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 infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> `),(()=>o.transaction_journal_entries.transaction_separator),(e=>{o.transaction_journal_entries.transaction_separator=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(x||(x=q` <table data-testid="custom-display-id-config-transaction-journal-entries-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> </tbody> </table> `),l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix,d):""):""):"")}__renderSmtpConfig(){return n(b||(b=q` <div class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"> ${0} </div> `),["host","port","username","password","security"].map((e=>{const t=()=>JSON.parse(this.form.smtp_config||"{}")[e],o=t=>{var o,i,r,s,n;const a=JSON.parse(this.form.smtp_config||"{}");this.edit({smtp_config:JSON.stringify({username:null!==(o=a.username)&&void 0!==o?o:"",password:null!==(i=a.password)&&void 0!==i?i:"",security:null!==(r=a.security)&&void 0!==r?r:"",host:null!==(s=a.host)&&void 0!==s?s:"",port:null!==(n=a.port)&&void 0!==n?n:"",[e]:t})})},i=`smtp-config-${e}`;return"password"===e?n(v||(v=q` <foxy-internal-password-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),i,t,o):"port"===e?n($||($=q` <foxy-internal-integer-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> `),i,t,o):"security"===e?n(V||(V=q` <foxy-internal-radio-group-control infer="${0}" class="-mt-xs -mx-xs -mb-m col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),i,t,o,[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}]):n(k||(k=q` <foxy-internal-text-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),i,t,o)})))}__renderWarning(e,t){return n(j||(j=q` <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2"> <foxy-i18n infer="" key="${0}"></foxy-i18n> ${0} </div> `),e,t?n(S||(S=q` <a target="_blank" class="font-medium hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary" href="${0}" lang="en"> ${0} <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon> </a> `),t.href,t.caption):"")}__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=>n(w||(w=q` <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",C);export{C as StoreForm};
|
|
1
|
+
import"./shared-e6997950.js";import"./shared-db21f6db.js";import"./shared-65318cc1.js";import"./shared-6abdfcf2.js";import"./shared-30bebd39.js";import"./shared-4dc58b73.js";import"./shared-4dee79d4.js";import"./shared-51d28e6d.js";import"./shared-8474bc4a.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-nucleon-element.js";import"./shared-77a4d8e8.js";import{_ as t}from"./shared-307262a1.js";import{R as o,a as i}from"./shared-09d4fbb8.js";import{i as r}from"./shared-d3bf9ac0.js";import{c as s}from"./shared-4e709717.js";import{h as n}from"./shared-7f33a83a.js";import{c as a}from"./shared-53061389.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-b3ac59eb.js";import"./shared-e6828dbf.js";import"./shared-31651a9c.js";import"./shared-4674063d.js";import"./shared-dfe2602a.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-c7f2f1ab.js";import"./shared-4b67d699.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-88e36564.js";import"./shared-d14c2060.js";import"./shared-d519a301.js";import"./shared-f3b35364.js";import"./shared-11c2efc8.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-64f98a0f.js";import"./shared-e8e92fe3.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-fe54babe.js";let l,c,d,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w,q=e=>e;const O=o(i(e,"store-form"));class C extends O{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.templates={},this.__singleCheckboxGroupOptions=[{label:"option_checked",value:"checked"}],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.__getBccOnReceiptEmailValue=()=>this.form.bcc_on_receipt_email?["checked"]:[],this.__setBccOnReceiptEmailValue=e=>{this.edit({bcc_on_receipt_email:e.includes("checked")})},this.__getUseEmailDnsValue=()=>this.form.use_email_dns?["checked"]:[],this.__setUseEmailDnsValue=e=>{this.edit({use_email_dns:e.includes("checked")})},this.__getUseSmtpConfigValue=()=>this.form.smtp_config?["checked"]:[],this.__setUseSmtpConfigValue=e=>{e.includes("checked")?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getFeaturesMultishipValue=()=>this.form.features_multiship?["checked"]:[],this.__setFeaturesMultishipValue=e=>{this.edit({features_multiship:e.includes("checked")})},this.__getRequireSignedShippingRatesValue=()=>this.form.require_signed_shipping_rates?["checked"]:[],this.__setRequireSignedShippingRatesValue=e=>{this.edit({require_signed_shipping_rates:e.includes("checked")})},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.__getProductsRequireExpiresPropertyValue=()=>this.form.products_require_expires_property?["checked"]:[],this.__setProductsRequireExpiresPropertyValue=e=>{this.edit({products_require_expires_property:e.includes("checked")})},this.__getUseCartValidationValue=()=>this.form.use_cart_validation?["checked"]:[],this.__setUseCartValidationValue=e=>{this.edit({use_cart_validation:e.includes("checked")})},this.__getSingleSignOnUrlValue=()=>{var e;return this.form.use_single_sign_on&&null!==(e=this.form.single_sign_on_url)&&void 0!==e?e:""},this.__setSingleSignOnUrlValue=e=>{this.edit({use_single_sign_on:!!e,single_sign_on_url:e})},this.__getWebhookUrlValue=()=>{var e;return this.form.use_webhook&&null!==(e=this.form.webhook_url)&&void 0!==e?e:""},this.__setWebhookUrlValue=e=>{this.edit({use_webhook:!!e,webhook_url:e})},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(".")})}}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},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<=50||"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<=100||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!!e||"webhook-url:v8n_required",({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<=100||"custom-display-id-config-enabled:v8n_too_long"]}renderBody(){var e,t,o,i,s,a,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w;const O=this.form.use_email_dns&&!(null===(e=this.data)||void 0===e?void 0:e.use_email_dns)&&!this.hiddenSelector.matches("use-email-dns",!0),C=this.form.require_signed_shipping_rates&&!(null===(t=this.data)||void 0===t?void 0:t.require_signed_shipping_rates)&&!this.hiddenSelector.matches("require-signed-shipping-rates",!0),U=this.form.products_require_expires_property&&!(null===(o=this.data)||void 0===o?void 0:o.products_require_expires_property)&&!this.hiddenSelector.matches("products-require-expires-property",!0),N=this.form.use_cart_validation&&!(null===(i=this.data)||void 0===i?void 0:i.use_cart_validation)&&!this.hiddenSelector.matches("use-cart-validation",!0),R=this.t(this.form.use_remote_domain&&!(null===(s=this.data)||void 0===s?void 0:s.use_remote_domain)?"store-domain.custom_domain_note":"store-domain.helper_text"),E=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",J=this.__renderLoader(1),M=this.__renderLoader(2),T=this.__renderLoader(3),P=this.__renderLoader(4),D=this.__renderLoader(5),L=this.__renderLoader(6),W=this.__renderLoader(7),A=this.__renderLoader(8),B=this.__renderLoader(9),G=Object.entries(null!==(u=null===(a=null==M?void 0:M.data)||void 0===a?void 0:a.values)&&void 0!==u?u:{}),I=null==P?void 0:P.data,z=null==D?void 0:D.data,F=null==L?void 0:L.data,H=null!==(p=null===(_=null==W?void 0:W.data)||void 0===_?void 0:_.values.timezone)&&void 0!==p?p:[],K=Object.values(null!==(m=null===(h=null==A?void 0:A.data)||void 0===h?void 0:h.values)&&void 0!==m?m:{}),Q=Object.values(null!==(g=null===(f=null==B?void 0:B.data)||void 0===f?void 0:f.values)&&void 0!==g?g:{}),X=Object.entries(null!==(x=null===(y=null==J?void 0:J.data)||void 0===y?void 0:y.values)&&void 0!==x?x:{}),Y=Object.entries(null!==(v=null===(b=null==T?void 0:T.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),Z=Object.entries(null!==($=null==z?void 0:z.values)&&void 0!==$?$:{}),ee=Object.entries(null!==(V=null==F?void 0:F.values)&&void 0!==V?V:{}),te=X.map((e=>({label:e[1].description,value:e[0]}))),oe=G.map((([e,t])=>({label:t,value:e}))),ie=Y.map((([e,t])=>({label:t,value:e}))),re=Z.map((([e,t])=>({value:e,label:t}))),se=ee.map((([e,t])=>({value:e,label:t}))),ne=H.map((e=>({label:e.description,value:e.timezone}))),ae=K.map((e=>({label:e.default,value:e.cc2}))),le=Q.map((e=>({label:e.default,value:e.code})));let ce;try{const e=new URL(null!==(k=this.regions)&&void 0!==k?k:""),t=this.form.country;t&&e.searchParams.set("country_code",t),ce=e.toString()}catch(e){ce=void 0}return n(l||(l=q` ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div class="grid gap-m grid-cols-1 sm-grid-cols-2"> <foxy-internal-text-control infer="store-name"></foxy-internal-text-control> <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="store-url"></foxy-internal-text-control> <foxy-internal-editable-list-control infer="store-email" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-select-control infer="timezone" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="version" item-value-path="_links.self.href" infer="store-version-uri" first="${0}" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="from-email" class="sm-col-span-2" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-checkbox-group-control infer="bcc-on-receipt-email" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="use-email-dns" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-smtp-config" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control> <foxy-internal-select-control infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-checkbox-group-control infer="features-multiship" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="require-signed-shipping-rates" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="locale-code" .options="${0}"> </foxy-internal-select-control> ${0} ${0} <foxy-internal-text-control class="sm-col-span-2" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-frequency-control class="sm-col-span-2" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-checkbox-group-control infer="products-require-expires-property" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-cart-validation" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="checkout-type" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-password-control infer="unified-order-entry-password"> </foxy-internal-password-control> <foxy-internal-text-control infer="single-sign-on-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webhook-url" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} ${0} </div> ${0} `),J.render(this.customerPasswordHashTypes),M.render(this.shippingAddressTypes),T.render(this.checkoutTypes),P.render(this.form.store_version_uri),D.render(this.localeCodes),W.render(this.timezones),A.render(this.countries),L.render(this.languages),B.render(ce),R,E,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,ne,r(null!==(j=this.storeVersions)&&void 0!==j?j:void 0),I,null!==(w=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==w?w:this.t("from-email.placeholder"),this.__getBccOnReceiptEmailValue,this.__setBccOnReceiptEmailValue,this.__singleCheckboxGroupOptions,this.__getUseEmailDnsValue,this.__setUseEmailDnsValue,this.__singleCheckboxGroupOptions,O?this.__renderWarning("use_email_dns_helper_text",{href:"https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc",caption:"How Emails Are Sent (SPF, DKIM, DMARC, etc.)"}):"",this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.__singleCheckboxGroupOptions,this.form.smtp_config&&!this.hiddenSelector.matches("smtp-config",!0)?this.__renderSmtpConfig():"",ae,le,oe,this.__getFeaturesMultishipValue,this.__setFeaturesMultishipValue,this.__singleCheckboxGroupOptions,this.__getRequireSignedShippingRatesValue,this.__setRequireSignedShippingRatesValue,this.__singleCheckboxGroupOptions,C?this.__renderWarning("require_signed_shipping_rates_helper_text"):"",se,re,this.hiddenSelector.matches("currency-style",!0)?"":this.__renderCurrencyStyleSelector(),this.hiddenSelector.matches("custom-display-id-config",!0)?"":this.__renderCustomIDSettings(),this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__getProductsRequireExpiresPropertyValue,this.__setProductsRequireExpiresPropertyValue,this.__singleCheckboxGroupOptions,U?this.__renderWarning("products_require_expires_property_helper_text"):"",this.__getUseCartValidationValue,this.__setUseCartValidationValue,this.__singleCheckboxGroupOptions,N?this.__renderWarning("use_cart_validation_helper_text",{href:"https://wiki.foxycart.com/v/2.0/hmac_validation",caption:"HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms"}):"",ie,te,(e=>{var t;const o=X.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?n(c||(c=q` <foxy-internal-number-control infer="customer-password-hash-config"> </foxy-internal-number-control> `)):n(d||(d=q` <foxy-internal-text-control infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.__getSingleSignOnUrlValue,this.__setSingleSignOnUrlValue,this.__getWebhookUrlValue,this.__setWebhookUrlValue,this.__renderWebhookKey(),this.data&&!this.hiddenSelector.matches("is-maintenance-mode",!0)?this.__renderMaintenanceModeSwitch():"",super.renderBody())}__renderWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const i=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:i,xml_datafeed:i,api_legacy:i,sso:i}}return Object.keys(o).map((e=>n(u||(u=q` <foxy-internal-password-control infer="webhook-key-${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),e.replace("_","-"),(()=>o[e]),(t=>{o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}))))}__renderMaintenanceModeSwitch(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.is_maintenance_mode),o=(t?"disable":"enable")+"_maintenance_mode",i=`maintenance_mode_${t?"on":"off"}_explainer`;return n(_||(_=q` <div data-testid="is-maintenance-mode" class="${0}"> <foxy-i18n infer="" class="block mb-s" key="${0}"></foxy-i18n> <vaadin-button theme="tertiary small ${0}" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-button> </div> `),s({"rounded leading-s text-s sm-col-span-2":!0,"text-tertiary":!t,"text-error":t}),i,t?"contrast":"",this.disabledSelector.matches("is-maintenance-mode",!0),(()=>{this.edit({is_maintenance_mode:!this.form.is_maintenance_mode}),this.submit()}),o)}__renderCurrencyStyleSelector(){const e={101:0,100:0,"001":1,"000":2,111:3,110:3,"011":4,"010":5},t=[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join(""),o=e[t],i=this.disabledSelector.matches("currency-style",!0),r=this.readonlySelector.matches("currency-style",!0);return n(p||(p=q` <div data-testid="currency-style" class="sm-col-span-2"> ${0} <div class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"> <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"></foxy-i18n> <div class="grid grid-cols-3 bg-contrast-10 rounded" style="gap:1px;padding:1px"> ${0} </div> <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("currency-style:before"),["12.34","USD 12.34","$12.34","12","USD 12","$12"].map(((t,a)=>n(h||(h=q` <label style="--lumo-border-radius:calc(var(--lumo-border-radius-m) - 1px)" class="${0}"> <span class="font-medium font-tnum">${0}</span> <input class="sr-only" value="${0}" type="radio" name="currency-style" ?checked="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </label> `),s({"relative z-0 px-s h-m flex items-center transition-colors":!0,"hover-cursor-pointer":!0,"focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50":!0,"bg-base text-body hover-bg-transparent":a!==o,"bg-primary text-primary-contrast":a===o,"rounded-tl":0===a,"rounded-tr":2===a,"rounded-bl":3===a,"rounded-br":5===a}),t,a,a===o,i,r,(()=>{const t=Object.entries(e).find((e=>e[1]===a))[0];this.edit({hide_currency_symbol:Boolean(Number(t[0])),hide_decimal_characters:Boolean(Number(t[1])),use_international_currency_symbol:Boolean(Number(t[2]))})})))),this.renderTemplateOrSlot("currency-style:after"))}__renderCustomIDSettings(){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=a(t)}const i=parseInt(o.start||"0"),r=parseInt(o.length||"0")-o.prefix.length-o.suffix.length,s=Math.min(i+Math.floor(Math.random()*Math.pow(10,r)),Math.pow(10,r)-1),l=`${o.prefix}${s.toString().padStart(r,"0")}${o.suffix}`,c=Math.floor(1e3*Math.random()),d=String(c).padStart(3,"0");return n(m||(m=q` <foxy-internal-checkbox-group-control infer="custom-display-id-config-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>o.enabled?["checked"]:[]),(e=>{o.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.enabled?n(f||(f=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-integer-control infer="custom-display-id-config-start" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="custom-display-id-config-length" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-text-control infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> <foxy-internal-checkbox-group-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>parseInt(o.start||"0")),(e=>{o.start=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>parseInt(o.length||"0")),(e=>{o.length=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.prefix),(e=>{o.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.suffix),(e=>{o.suffix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(g||(g=q` <table data-testid="custom-display-id-config-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-first-example"> </foxy-i18n> </td> <td> ${0}${0}${0} </td> </tr> <tr style="width:1%"> <td> <foxy-i18n infer="" key="custom-display-id-config-random-example"> </foxy-i18n> </td> <td>${0}</td> </tr> </tbody> </table> `),o.prefix,i.toString().padStart(r,"0"),o.suffix,l):"",(()=>o.transaction_journal_entries.enabled?["checked"]:[]),(e=>{o.transaction_journal_entries.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.transaction_journal_entries.enabled?n(y||(y=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control 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 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 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 infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> `),(()=>o.transaction_journal_entries.transaction_separator),(e=>{o.transaction_journal_entries.transaction_separator=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(x||(x=q` <table data-testid="custom-display-id-config-transaction-journal-entries-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> </tbody> </table> `),l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix,d):""):""):"")}__renderSmtpConfig(){return n(b||(b=q` <div class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"> ${0} </div> `),["host","port","username","password","security"].map((e=>{const t=()=>JSON.parse(this.form.smtp_config||"{}")[e],o=t=>{var o,i,r,s,n;const a=JSON.parse(this.form.smtp_config||"{}");this.edit({smtp_config:JSON.stringify({username:null!==(o=a.username)&&void 0!==o?o:"",password:null!==(i=a.password)&&void 0!==i?i:"",security:null!==(r=a.security)&&void 0!==r?r:"",host:null!==(s=a.host)&&void 0!==s?s:"",port:null!==(n=a.port)&&void 0!==n?n:"",[e]:t})})},i=`smtp-config-${e}`;return"password"===e?n(v||(v=q` <foxy-internal-password-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),i,t,o):"port"===e?n($||($=q` <foxy-internal-integer-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> `),i,t,o):"security"===e?n(V||(V=q` <foxy-internal-radio-group-control infer="${0}" class="-mt-xs -mx-xs -mb-m col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),i,t,o,[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}]):n(k||(k=q` <foxy-internal-text-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),i,t,o)})))}__renderWarning(e,t){return n(j||(j=q` <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2"> <foxy-i18n infer="" key="${0}"></foxy-i18n> ${0} </div> `),e,t?n(S||(S=q` <a target="_blank" class="font-medium hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary" href="${0}" lang="en"> ${0} <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon> </a> `),t.href,t.caption):"")}__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=>n(w||(w=q` <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",C);export{C as StoreForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-db21f6db.js";import"./shared-6abdfcf2.js";import"./shared-7995407d.js";import"./shared-51d28e6d.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import{I as t}from"./shared-dfe2602a.js";import"./shared-77a4d8e8.js";import{c as s,h as a}from"./shared-7f33a83a.js";import{y as i,a as r}from"./shared-09d4fbb8.js";import"./shared-b3ac59eb.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-e6828dbf.js";import"./shared-31651a9c.js";import"./shared-4674063d.js";import"./shared-307262a1.js";import"./shared-d3bf9ac0.js";import"./shared-4e709717.js";import"./shared-d519a301.js";import"./shared-f3b35364.js";import"./shared-11c2efc8.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-c7f2f1ab.js";import"./shared-4b67d699.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-e6997950.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";let o,n,l,p=e=>e;let u,d,m=e=>e;const c=s(u||(u=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{padding-bottom:var(--lumo-space-xs)}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=group-field]{display:flex;border:thin solid var(--lumo-contrast-10pct);border-radius:var(--lumo-border-radius);transition:border-color .15s ease}:host(.foxy-internal-subscription-settings-form-reattempt-bypass:not([disabled]):not([readonly]):hover) [part=group-field]{border-color:var(--lumo-contrast-20pct)}`)),_=s(d||(d=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{display:flex}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=label]{flex:1}`));customElements.define("foxy-internal-subscription-settings-form-reattempt-bypass",class extends t{constructor(){super(...arguments),this.nucleon=null,this.__getReattemptBypassStringsValue=()=>{var e,t,s;return(null!==(s=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.reattempt_bypass_strings)||void 0===t?void 0:t.split(","))&&void 0!==s?s:[]).map((e=>e.trim())).filter(((e,t,s)=>e&&s.indexOf(e)===t)).map((e=>({value:e})))},this.__setReattemptBypassStringsValue=e=>{var t,s;const a=this.renderRoot.querySelector("vaadin-radio-group"),i=null!==(t=null==a?void 0:a.value)&&void 0!==t?t:"reattempt_if_exists";null===(s=this.nucleon)||void 0===s||s.edit({reattempt_bypass_strings:e.map((({value:e})=>e)).join(),reattempt_bypass_logic:i})}}static get styles(){return[super.styles,s(o||(o=p`.visible-if-checked{display:none}[checked] .visible-if-checked{display:block}`))]}renderControl(){const e=a(n||(n=p` <foxy-internal-editable-list-control infer="reattempt-bypass-strings" class="w-full visible-if-checked" .getValue="${0}" .setValue="${0}" @mousedown="${0}" @mouseup="${0}" @keydown="${0}" @click="${0}"> </foxy-internal-editable-list-control> `),this.__getReattemptBypassStringsValue,this.__setReattemptBypassStringsValue,(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>(e.preventDefault(),e.stopPropagation())));let t;const s=this.nucleon,i=null==s?void 0:s.form.reattempt_bypass_logic;return(null==s?void 0:s.form.reattempt_bypass_strings)?t=i:"reattempt_if_exists"===i?t="never_reattempt":"skip_if_exists"===i&&(t="always_reattempt"),a(l||(l=p` <vaadin-radio-group helper-text="${0}" label="${0}" class="foxy-internal-subscription-settings-form-reattempt-bypass w-full divide-y divide-contrast-10 group" theme="vertical" ?disabled="${0}" ?readonly="${0}" .value="${0}" @value-changed="${0}"> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="reattempt_if_exists"> <foxy-i18n infer="" key="option_reattempt_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="skip_if_exists"> <foxy-i18n infer="" key="option_skip_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="always_reattempt"> <foxy-i18n infer="" key="option_always_reattempt"></foxy-i18n> </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="never_reattempt"> <foxy-i18n infer="" key="option_never_reattempt"></foxy-i18n> </vaadin-radio-button> </vaadin-radio-group> `),this.helperText,this.label,this.disabled,this.readonly,t,this.__handleGroupValueChanged,e,e)}__handleGroupValueChanged(e){const t=e.currentTarget.value,s=this.nucleon;"never_reattempt"!==t&&"always_reattempt"!==t||("never_reattempt"===t?"reattempt_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"reattempt_if_exists"})):"skip_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"skip_if_exists"})),(null==s?void 0:s.form.reattempt_bypass_strings)&&(null==s||s.edit({reattempt_bypass_strings:""})))}}),i("vaadin-radio-group",c),i("vaadin-radio-button",_);let h,f,y=e=>e;const g=r(e,"subscription-settings-form");class b extends g{constructor(){super(...arguments),this.templates={},this.__sendEmailReceiptsForAutomatedBillingOptions=[{label:"option_checked",value:"checked"}],this.__automaticallyChargePastDueAmountOptions=[{label:"option_checked",value:"checked"}],this.__clearPastDueAmountsOnSuccessOptions=[{label:"option_checked",value:"checked"}],this.__resetNextDateOnMakeUpPaymentOptions=[{label:"option_checked",value:"checked"}],this.__pastDueAmountHandlingOptions=[{label:"option_increment",value:"increment"},{label:"option_replace",value:"replace"},{label:"option_ignore",value:"ignore"}],this.__positiveIntegerInputParams={type:"number",step:"1",min:"0"},this.__sendEmailReceiptsForAutomatedBillingGetValue=()=>this.form.send_email_receipts_for_automated_billing?["checked"]:[],this.__sendEmailReceiptsForAutomatedBillingSetValue=e=>{this.edit({send_email_receipts_for_automated_billing:e.includes("checked")})},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,s)=>!isNaN(e)&&s.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.__automaticallyChargePastDueAmountGetValue=()=>this.form.automatically_charge_past_due_amount?["checked"]:[],this.__automaticallyChargePastDueAmountSetValue=e=>{const t=e.includes("checked");this.edit({automatically_charge_past_due_amount:t,clear_past_due_amounts_on_success:!t&&void 0,reset_nextdate_on_makeup_payment:!t&&void 0})},this.__clearPastDueAmountsOnSuccessGetValue=()=>this.form.clear_past_due_amounts_on_success?["checked"]:[],this.__clearPastDueAmountsOnSuccessSetValue=e=>{this.edit({clear_past_due_amounts_on_success:e.includes("checked")})},this.__resetNextDateOnMakeUpPaymentGetValue=()=>this.form.reset_nextdate_on_makeup_payment?["checked"]:[],this.__resetNextDateOnMakeUpPaymentSetValue=e=>{this.edit({reset_nextdate_on_makeup_payment:e.includes("checked")})},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,s)=>!isNaN(e)&&s.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,s)=>!isNaN(e)&&s.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()})}}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"]}renderBody(){return a(h||(h=y` <foxy-internal-radio-group-control infer="past-due-amount-handling" theme="vertical list" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="automatically-charge-past-due-amount" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-subscription-settings-form-reattempt-bypass infer="reattempt-bypass"> </foxy-internal-subscription-settings-form-reattempt-bypass> <foxy-internal-editable-list-control infer="reattempt-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="reminder-email-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="expiring-soon-payment-reminder-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="send-email-receipts-for-automated-billing" class="-mt-xs -mb-m" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-integer-control suffix="${0}" infer="cancellation-schedule" min="1"> </foxy-internal-integer-control> <foxy-internal-text-control infer="modification-url"></foxy-internal-text-control> ${0} `),this.__pastDueAmountHandlingOptions,this.__automaticallyChargePastDueAmountGetValue,this.__automaticallyChargePastDueAmountSetValue,this.__automaticallyChargePastDueAmountOptions,this.form.automatically_charge_past_due_amount?"":a(f||(f=y` <foxy-internal-checkbox-group-control infer="clear-past-due-amounts-on-success" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="reset-nextdate-on-makeup-payment" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__clearPastDueAmountsOnSuccessGetValue,this.__clearPastDueAmountsOnSuccessSetValue,this.__clearPastDueAmountsOnSuccessOptions,this.__resetNextDateOnMakeUpPaymentGetValue,this.__resetNextDateOnMakeUpPaymentSetValue,this.__resetNextDateOnMakeUpPaymentOptions),this.__positiveIntegerInputParams,this.__reattemptScheduleGetValue,this.__reattemptScheduleSetValue,this.__positiveIntegerInputParams,this.__reminderEmailScheduleGetValue,this.__reminderEmailScheduleSetValue,this.__positiveIntegerInputParams,this.__expiringSoonPaymentReminderScheduleGetValue,this.__expiringSoonPaymentReminderScheduleSetValue,this.__sendEmailReceiptsForAutomatedBillingOptions,this.__sendEmailReceiptsForAutomatedBillingGetValue,this.__sendEmailReceiptsForAutomatedBillingSetValue,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",b);export{b as SubscriptionSettingsForm};
|
|
1
|
+
import"./shared-db21f6db.js";import"./shared-6abdfcf2.js";import"./shared-30bebd39.js";import"./shared-51d28e6d.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import{I as t}from"./shared-dfe2602a.js";import"./shared-77a4d8e8.js";import{c as s,h as a}from"./shared-7f33a83a.js";import{y as i,a as r}from"./shared-09d4fbb8.js";import"./shared-b3ac59eb.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-e6828dbf.js";import"./shared-31651a9c.js";import"./shared-4674063d.js";import"./shared-307262a1.js";import"./shared-d3bf9ac0.js";import"./shared-4e709717.js";import"./shared-d519a301.js";import"./shared-f3b35364.js";import"./shared-11c2efc8.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-c7f2f1ab.js";import"./shared-4b67d699.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-e6997950.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";let o,n,l,p=e=>e;let u,d,m=e=>e;const c=s(u||(u=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{padding-bottom:var(--lumo-space-xs)}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=group-field]{display:flex;border:thin solid var(--lumo-contrast-10pct);border-radius:var(--lumo-border-radius);transition:border-color .15s ease}:host(.foxy-internal-subscription-settings-form-reattempt-bypass:not([disabled]):not([readonly]):hover) [part=group-field]{border-color:var(--lumo-contrast-20pct)}`)),_=s(d||(d=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{display:flex}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=label]{flex:1}`));customElements.define("foxy-internal-subscription-settings-form-reattempt-bypass",class extends t{constructor(){super(...arguments),this.nucleon=null,this.__getReattemptBypassStringsValue=()=>{var e,t,s;return(null!==(s=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.reattempt_bypass_strings)||void 0===t?void 0:t.split(","))&&void 0!==s?s:[]).map((e=>e.trim())).filter(((e,t,s)=>e&&s.indexOf(e)===t)).map((e=>({value:e})))},this.__setReattemptBypassStringsValue=e=>{var t,s;const a=this.renderRoot.querySelector("vaadin-radio-group"),i=null!==(t=null==a?void 0:a.value)&&void 0!==t?t:"reattempt_if_exists";null===(s=this.nucleon)||void 0===s||s.edit({reattempt_bypass_strings:e.map((({value:e})=>e)).join(),reattempt_bypass_logic:i})}}static get styles(){return[super.styles,s(o||(o=p`.visible-if-checked{display:none}[checked] .visible-if-checked{display:block}`))]}renderControl(){const e=a(n||(n=p` <foxy-internal-editable-list-control infer="reattempt-bypass-strings" class="w-full visible-if-checked" .getValue="${0}" .setValue="${0}" @mousedown="${0}" @mouseup="${0}" @keydown="${0}" @click="${0}"> </foxy-internal-editable-list-control> `),this.__getReattemptBypassStringsValue,this.__setReattemptBypassStringsValue,(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>(e.preventDefault(),e.stopPropagation())));let t;const s=this.nucleon,i=null==s?void 0:s.form.reattempt_bypass_logic;return(null==s?void 0:s.form.reattempt_bypass_strings)?t=i:"reattempt_if_exists"===i?t="never_reattempt":"skip_if_exists"===i&&(t="always_reattempt"),a(l||(l=p` <vaadin-radio-group helper-text="${0}" label="${0}" class="foxy-internal-subscription-settings-form-reattempt-bypass w-full divide-y divide-contrast-10 group" theme="vertical" ?disabled="${0}" ?readonly="${0}" .value="${0}" @value-changed="${0}"> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="reattempt_if_exists"> <foxy-i18n infer="" key="option_reattempt_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="skip_if_exists"> <foxy-i18n infer="" key="option_skip_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="always_reattempt"> <foxy-i18n infer="" key="option_always_reattempt"></foxy-i18n> </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="never_reattempt"> <foxy-i18n infer="" key="option_never_reattempt"></foxy-i18n> </vaadin-radio-button> </vaadin-radio-group> `),this.helperText,this.label,this.disabled,this.readonly,t,this.__handleGroupValueChanged,e,e)}__handleGroupValueChanged(e){const t=e.currentTarget.value,s=this.nucleon;"never_reattempt"!==t&&"always_reattempt"!==t||("never_reattempt"===t?"reattempt_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"reattempt_if_exists"})):"skip_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"skip_if_exists"})),(null==s?void 0:s.form.reattempt_bypass_strings)&&(null==s||s.edit({reattempt_bypass_strings:""})))}}),i("vaadin-radio-group",c),i("vaadin-radio-button",_);let h,f,y=e=>e;const g=r(e,"subscription-settings-form");class b extends g{constructor(){super(...arguments),this.templates={},this.__sendEmailReceiptsForAutomatedBillingOptions=[{label:"option_checked",value:"checked"}],this.__automaticallyChargePastDueAmountOptions=[{label:"option_checked",value:"checked"}],this.__clearPastDueAmountsOnSuccessOptions=[{label:"option_checked",value:"checked"}],this.__resetNextDateOnMakeUpPaymentOptions=[{label:"option_checked",value:"checked"}],this.__pastDueAmountHandlingOptions=[{label:"option_increment",value:"increment"},{label:"option_replace",value:"replace"},{label:"option_ignore",value:"ignore"}],this.__positiveIntegerInputParams={type:"number",step:"1",min:"0"},this.__sendEmailReceiptsForAutomatedBillingGetValue=()=>this.form.send_email_receipts_for_automated_billing?["checked"]:[],this.__sendEmailReceiptsForAutomatedBillingSetValue=e=>{this.edit({send_email_receipts_for_automated_billing:e.includes("checked")})},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,s)=>!isNaN(e)&&s.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.__automaticallyChargePastDueAmountGetValue=()=>this.form.automatically_charge_past_due_amount?["checked"]:[],this.__automaticallyChargePastDueAmountSetValue=e=>{const t=e.includes("checked");this.edit({automatically_charge_past_due_amount:t,clear_past_due_amounts_on_success:!t&&void 0,reset_nextdate_on_makeup_payment:!t&&void 0})},this.__clearPastDueAmountsOnSuccessGetValue=()=>this.form.clear_past_due_amounts_on_success?["checked"]:[],this.__clearPastDueAmountsOnSuccessSetValue=e=>{this.edit({clear_past_due_amounts_on_success:e.includes("checked")})},this.__resetNextDateOnMakeUpPaymentGetValue=()=>this.form.reset_nextdate_on_makeup_payment?["checked"]:[],this.__resetNextDateOnMakeUpPaymentSetValue=e=>{this.edit({reset_nextdate_on_makeup_payment:e.includes("checked")})},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,s)=>!isNaN(e)&&s.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,s)=>!isNaN(e)&&s.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()})}}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"]}renderBody(){return a(h||(h=y` <foxy-internal-radio-group-control infer="past-due-amount-handling" theme="vertical list" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="automatically-charge-past-due-amount" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-subscription-settings-form-reattempt-bypass infer="reattempt-bypass"> </foxy-internal-subscription-settings-form-reattempt-bypass> <foxy-internal-editable-list-control infer="reattempt-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="reminder-email-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="expiring-soon-payment-reminder-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="send-email-receipts-for-automated-billing" class="-mt-xs -mb-m" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-integer-control suffix="${0}" infer="cancellation-schedule" min="1"> </foxy-internal-integer-control> <foxy-internal-text-control infer="modification-url"></foxy-internal-text-control> ${0} `),this.__pastDueAmountHandlingOptions,this.__automaticallyChargePastDueAmountGetValue,this.__automaticallyChargePastDueAmountSetValue,this.__automaticallyChargePastDueAmountOptions,this.form.automatically_charge_past_due_amount?"":a(f||(f=y` <foxy-internal-checkbox-group-control infer="clear-past-due-amounts-on-success" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="reset-nextdate-on-makeup-payment" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__clearPastDueAmountsOnSuccessGetValue,this.__clearPastDueAmountsOnSuccessSetValue,this.__clearPastDueAmountsOnSuccessOptions,this.__resetNextDateOnMakeUpPaymentGetValue,this.__resetNextDateOnMakeUpPaymentSetValue,this.__resetNextDateOnMakeUpPaymentOptions),this.__positiveIntegerInputParams,this.__reattemptScheduleGetValue,this.__reattemptScheduleSetValue,this.__positiveIntegerInputParams,this.__reminderEmailScheduleGetValue,this.__reminderEmailScheduleSetValue,this.__positiveIntegerInputParams,this.__expiringSoonPaymentReminderScheduleGetValue,this.__expiringSoonPaymentReminderScheduleSetValue,this.__sendEmailReceiptsForAutomatedBillingOptions,this.__sendEmailReceiptsForAutomatedBillingGetValue,this.__sendEmailReceiptsForAutomatedBillingSetValue,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",b);export{b as SubscriptionSettingsForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-ba658670.js";import"./shared-
|
|
1
|
+
import"./shared-ba658670.js";import"./shared-30bebd39.js";import"./shared-a3c73e91.js";import{I as r}from"./shared-25f64060.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import{a as e}from"./shared-09d4fbb8.js";import{B as o}from"./shared-307262a1.js";import{h as t}from"./shared-7f33a83a.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-4674063d.js";import"./shared-59042137.js";import"./shared-c6c6ba69.js";import"./shared-77a4d8e8.js";import"./shared-64657919.js";import"./shared-4b67d699.js";import"./shared-c7f2f1ab.js";import"./shared-d3bf9ac0.js";import"./shared-c2d3b32b.js";import"./shared-1d08a5ad.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-form-dialog.js";import"./shared-6dc64a17.js";import"./shared-e6997950.js";import"./shared-17d0db7f.js";import"./shared-36725fe3.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-0a248c0d.js";import"./shared-0479553e.js";import"./shared-e6828dbf.js";import"./shared-31651a9c.js";import"./shared-dfe2602a.js";import"./shared-bf62a65b.js";import"./shared-a92ae606.js";let s,a,n=r=>r;class i extends(e(r,"webhook-form")){constructor(){super(...arguments),this.__formats=[{value:"json",label:"JSON"},{value:"webflow",label:"Webflow"},{value:"zapier",label:"Zapier"}],this.__eventResources=[{value:"subscription",label:"event_resource_subscription"},{value:"transaction",label:"event_resource_transaction"},{value:"customer",label:"event_resource_customer"}]}static get v8n(){return[({name:r})=>!!r||"name:v8n_required",({name:r})=>!!r&&r.length<=255||"name:v8n_too_long",({version:r})=>!!r||"version:v8n_required",({format:r})=>!!r||"format:v8n_required",({url:r})=>!r||r.length<=1e3||"url:v8n_too_long",({query:r})=>!r||r.length<=1e3||"query:v8n_too_long",({encryption_key:r})=>!r||r.length<=1e3||"encryption-key:v8n_too_long"]}get readonlySelector(){const r=[];return this.data&&r.push("event-resource"),new o(`${super.readonlySelector} ${r.join(" ")}`.trim())}renderBody(){return t(s||(s=n` <foxy-internal-text-control infer="name"></foxy-internal-text-control> <foxy-internal-radio-group-control infer="event-resource" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="query"></foxy-internal-text-control> <foxy-internal-text-control infer="url"></foxy-internal-text-control> <foxy-internal-radio-group-control infer="format" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="encryption-key"></foxy-internal-text-control> <foxy-internal-text-control infer="version"></foxy-internal-text-control> ${0} ${0} `),this.__eventResources,this.__formats,this.data?t(a||(a=n` <foxy-internal-async-details-control first="${0}" infer="statuses" limit="10" item="foxy-webhook-status-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control first="${0}" infer="logs" limit="5" item="foxy-webhook-log-card"> </foxy-internal-async-details-control> `),this.data._links["fx:statuses"].href,this.data._links["fx:logs"].href):"",super.renderBody())}}customElements.define("foxy-webhook-form",i);export{i as WebhookForm};
|
|
@@ -315,4 +315,4 @@ class f extends(r(o(a))){static get template(){return i`
|
|
|
315
315
|
|
|
316
316
|
<div part="error-message" id="[[_errorId]]" aria-live="assertive" aria-hidden\$="[[_getErrorMessageAriaHidden(invalid, errorMessage, _errorId)]]">[[errorMessage]]</div>
|
|
317
317
|
</div>
|
|
318
|
-
`}static get is(){return"vaadin-radio-group"}static get properties(){return{disabled:{type:Boolean,reflectToAttribute:!0,observer:"_disabledChanged"},readonly:{type:Boolean,reflectToAttribute:!0,observer:"_readonlyChanged"},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},required:{type:Boolean,reflectToAttribute:!0},errorMessage:{type:String,value:"",observer:"_errorMessageChanged"},_errorId:{type:String},_helperTextId:{type:String},_hasSlottedHelper:Boolean,_checkedButton:{type:Object},label:{type:String,value:"",observer:"_labelChanged"},helperText:{type:String,value:"",observer:"_helperTextChanged"},value:{type:String,notify:!0,observer:"_valueChanged"}}}ready(){super.ready(),this._addListeners(),this._observer=new l(this,(e=>{const t=e=>{e.target.checked&&this._changeSelectedButton(e.target)};this._filterRadioButtons(e.addedNodes).reverse().forEach((e=>{e.addEventListener("checked-changed",t),this.disabled&&(e.disabled=!0),e.checked&&this._changeSelectedButton(e)})),this._filterRadioButtons(e.removedNodes).forEach((e=>{e.removeEventListener("checked-changed",t),e==this._checkedButton&&(this.value=void 0)})),this._setOrToggleHasHelperAttribute()})),this._radioButtons.length&&this._setFocusable(0),this.setAttribute("role","radiogroup");const e=f._uniqueId=1+f._uniqueId||0;this._errorId=`${this.constructor.is}-error-${e}`,this._helperTextId=`${this.constructor.is}-helper-${e}`}get _radioButtons(){return this._filterRadioButtons(this.querySelectorAll("*"))}_setFocused(e){e?this.setAttribute("focused",""):this.removeAttribute("focused")}_filterRadioButtons(e){return Array.from(e).filter((e=>e instanceof v))}_disabledChanged(e){this.setAttribute("aria-disabled",e),this._updateDisableButtons()}_updateDisableButtons(){this._radioButtons.forEach((e=>{this.disabled?e.disabled=!0:this.readonly?e.disabled=e!==this._checkedButton&&this.readonly:e.disabled=!1}))}_readonlyChanged(e,t){(e||t)&&this._updateDisableButtons()}_addListeners(){this.addEventListener("keydown",(e=>{var t=e.target==this?this._checkedButton:e.target;const r="rtl"===this.getAttribute("dir")&&"vertical"!==this.theme;37!==e.keyCode&&38!==e.keyCode||(e.preventDefault(),this._selectIncButton(r,t)),39!==e.keyCode&&40!==e.keyCode||(e.preventDefault(),this._selectIncButton(!r,t))})),this.addEventListener("focusin",(()=>this._setFocused(this._containsFocus()))),this.addEventListener("focusout",(e=>{e.composed&&this.validate(),this._setFocused(!1)}))}_selectIncButton(e,t){e?this._selectNextButton(t):this._selectPreviousButton(t)}_selectButton(e,t){this._containsFocus()&&(e.focus(),t&&e.setAttribute("focus-ring","")),this._changeSelectedButton(e,t)}_containsFocus(){const e=this.getRootNode(),t=void 0!==e._activeElement?e._activeElement:e.activeElement;return this.contains(t)}_hasEnabledButtons(){return!this._radioButtons.every((e=>e.disabled))}_selectNextButton(e){if(this._hasEnabledButtons()){var t=e.nextElementSibling||this.firstElementChild;t.disabled?this._selectNextButton(t):this._selectButton(t,!0)}}_selectPreviousButton(e){if(this._hasEnabledButtons()){var t=e.previousElementSibling||this.lastElementChild;t.disabled?this._selectPreviousButton(t):this._selectButton(t,!0)}}_changeSelectedButton(e,t){this._checkedButton!==e&&(this._checkedButton=e,this._checkedButton&&(this.value=this._checkedButton.value),this._radioButtons.forEach((e=>{e===this._checkedButton?t?e.click():e.checked=!0:e.checked=!1})),this.validate(),this.readonly&&this._updateDisableButtons(),e&&this._setFocusable(this._radioButtons.indexOf(e)))}_valueChanged(e,t){if(t&&(""===e||null==e))return this._changeSelectedButton(null),void this.removeAttribute("has-value");if(!this._checkedButton||e!=this._checkedButton.value){const t=this._radioButtons.filter((t=>t.value==e))[0];this._selectButton(t)}this._checkedButton?this.setAttribute("has-value",""):console.warn(`No <vaadin-radio-button> with value ${e} found.`)}validate(){return!(this.invalid=!this.checkValidity())}checkValidity(){return!this.required||!!this.value}_setFocusable(e){const t=this._radioButtons;t.forEach((r=>r.tabindex=r===t[e]?0:-1))}_labelChanged(e){this._setOrToggleAttribute("has-label",!!e)}_errorMessageChanged(e){this._setOrToggleAttribute("has-error-message",!!e)}_helperTextChanged(e){this._setOrToggleAttribute("has-helper",!!e)}_setOrToggleAttribute(e,t){e&&(t?this.setAttribute(e,"boolean"==typeof t?"":t):this.removeAttribute(e))}_setOrToggleHasHelperAttribute(){const e=this.shadowRoot.querySelector('[name="helper"]').assignedNodes();this._hasSlottedHelper=e.filter((e=>3!==e.nodeType)).length>0,this._setOrToggleAttribute("has-helper",this._hasSlottedHelper?"slotted":!!this.helperText)}_getActiveErrorId(e,t,r){return t&&e?r:void 0}_getErrorMessageAriaHidden(e,t,r){return(!this._getActiveErrorId(e,t,r)).toString()}_getHelperTextAriaHidden(e,t,r){return(!(e||r)).toString()}}customElements.define(f.is,f);let _,
|
|
318
|
+
`}static get is(){return"vaadin-radio-group"}static get properties(){return{disabled:{type:Boolean,reflectToAttribute:!0,observer:"_disabledChanged"},readonly:{type:Boolean,reflectToAttribute:!0,observer:"_readonlyChanged"},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},required:{type:Boolean,reflectToAttribute:!0},errorMessage:{type:String,value:"",observer:"_errorMessageChanged"},_errorId:{type:String},_helperTextId:{type:String},_hasSlottedHelper:Boolean,_checkedButton:{type:Object},label:{type:String,value:"",observer:"_labelChanged"},helperText:{type:String,value:"",observer:"_helperTextChanged"},value:{type:String,notify:!0,observer:"_valueChanged"}}}ready(){super.ready(),this._addListeners(),this._observer=new l(this,(e=>{const t=e=>{e.target.checked&&this._changeSelectedButton(e.target)};this._filterRadioButtons(e.addedNodes).reverse().forEach((e=>{e.addEventListener("checked-changed",t),this.disabled&&(e.disabled=!0),e.checked&&this._changeSelectedButton(e)})),this._filterRadioButtons(e.removedNodes).forEach((e=>{e.removeEventListener("checked-changed",t),e==this._checkedButton&&(this.value=void 0)})),this._setOrToggleHasHelperAttribute()})),this._radioButtons.length&&this._setFocusable(0),this.setAttribute("role","radiogroup");const e=f._uniqueId=1+f._uniqueId||0;this._errorId=`${this.constructor.is}-error-${e}`,this._helperTextId=`${this.constructor.is}-helper-${e}`}get _radioButtons(){return this._filterRadioButtons(this.querySelectorAll("*"))}_setFocused(e){e?this.setAttribute("focused",""):this.removeAttribute("focused")}_filterRadioButtons(e){return Array.from(e).filter((e=>e instanceof v))}_disabledChanged(e){this.setAttribute("aria-disabled",e),this._updateDisableButtons()}_updateDisableButtons(){this._radioButtons.forEach((e=>{this.disabled?e.disabled=!0:this.readonly?e.disabled=e!==this._checkedButton&&this.readonly:e.disabled=!1}))}_readonlyChanged(e,t){(e||t)&&this._updateDisableButtons()}_addListeners(){this.addEventListener("keydown",(e=>{var t=e.target==this?this._checkedButton:e.target;const r="rtl"===this.getAttribute("dir")&&"vertical"!==this.theme;37!==e.keyCode&&38!==e.keyCode||(e.preventDefault(),this._selectIncButton(r,t)),39!==e.keyCode&&40!==e.keyCode||(e.preventDefault(),this._selectIncButton(!r,t))})),this.addEventListener("focusin",(()=>this._setFocused(this._containsFocus()))),this.addEventListener("focusout",(e=>{e.composed&&this.validate(),this._setFocused(!1)}))}_selectIncButton(e,t){e?this._selectNextButton(t):this._selectPreviousButton(t)}_selectButton(e,t){this._containsFocus()&&(e.focus(),t&&e.setAttribute("focus-ring","")),this._changeSelectedButton(e,t)}_containsFocus(){const e=this.getRootNode(),t=void 0!==e._activeElement?e._activeElement:e.activeElement;return this.contains(t)}_hasEnabledButtons(){return!this._radioButtons.every((e=>e.disabled))}_selectNextButton(e){if(this._hasEnabledButtons()){var t=e.nextElementSibling||this.firstElementChild;t.disabled?this._selectNextButton(t):this._selectButton(t,!0)}}_selectPreviousButton(e){if(this._hasEnabledButtons()){var t=e.previousElementSibling||this.lastElementChild;t.disabled?this._selectPreviousButton(t):this._selectButton(t,!0)}}_changeSelectedButton(e,t){this._checkedButton!==e&&(this._checkedButton=e,this._checkedButton&&(this.value=this._checkedButton.value),this._radioButtons.forEach((e=>{e===this._checkedButton?t?e.click():e.checked=!0:e.checked=!1})),this.validate(),this.readonly&&this._updateDisableButtons(),e&&this._setFocusable(this._radioButtons.indexOf(e)))}_valueChanged(e,t){if(t&&(""===e||null==e))return this._changeSelectedButton(null),void this.removeAttribute("has-value");if(!this._checkedButton||e!=this._checkedButton.value){const t=this._radioButtons.filter((t=>t.value==e))[0];this._selectButton(t)}this._checkedButton?this.setAttribute("has-value",""):console.warn(`No <vaadin-radio-button> with value ${e} found.`)}validate(){return!(this.invalid=!this.checkValidity())}checkValidity(){return!this.required||!!this.value}_setFocusable(e){const t=this._radioButtons;t.forEach((r=>r.tabindex=r===t[e]?0:-1))}_labelChanged(e){this._setOrToggleAttribute("has-label",!!e)}_errorMessageChanged(e){this._setOrToggleAttribute("has-error-message",!!e)}_helperTextChanged(e){this._setOrToggleAttribute("has-helper",!!e)}_setOrToggleAttribute(e,t){e&&(t?this.setAttribute(e,"boolean"==typeof t?"":t):this.removeAttribute(e))}_setOrToggleHasHelperAttribute(){const e=this.shadowRoot.querySelector('[name="helper"]').assignedNodes();this._hasSlottedHelper=e.filter((e=>3!==e.nodeType)).length>0,this._setOrToggleAttribute("has-helper",this._hasSlottedHelper?"slotted":!!this.helperText)}_getActiveErrorId(e,t,r){return t&&e?r:void 0}_getErrorMessageAriaHidden(e,t,r){return(!this._getActiveErrorId(e,t,r)).toString()}_getHelperTextAriaHidden(e,t,r){return(!(e||r)).toString()}}customElements.define(f.is,f);let y,_,k,x=e=>e;b("vaadin-radio-group",c(y||(y=x`:host([theme~=list]) label{padding-bottom:var(--lumo-space-xs)}:host([theme~=list]) [part=group-field]{display:flex;border:thin solid var(--lumo-contrast-10pct);border-radius:var(--lumo-border-radius);transition:border-color .15s ease}:host([theme~=list]:not([disabled]):not([readonly]):hover) [part=group-field]{border-color:var(--lumo-contrast-20pct)}`)));customElements.define("foxy-internal-radio-group-control",class extends n{constructor(){super(...arguments),this.options=[],this.theme=null}static get properties(){return d(d({},super.properties),{},{options:{type:Array},theme:{type:String}})}renderControl(){var e,t;const r=!!(null===(e=this.theme)||void 0===e?void 0:e.includes("list"));return u(_||(_=x` <vaadin-radio-group error-message="${0}" helper-text="${0}" label="${0}" class="${0}" theme="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @change="${0}"> ${0} </vaadin-radio-group> `),h(this._errorMessage),this.helperText,this.label,p({"w-full":!0,"group divide-y divide-contrast-10":r}),h(null!==(t=this.theme)&&void 0!==t?t:void 0),this.disabled,this.readonly,this._checkValidity,this._value,(e=>{const t=e.currentTarget;this._value=t.value}),this.options.map((e=>u(k||(k=x` <vaadin-radio-button value="${0}" class="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-radio-button> `),e.value,p({"block p-s transition-colors":r,"group-hover-divide-contrast-20":r&&!this.disabled&&!this.readonly}),e.label))))}});
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"event-resource": {
|
|
39
39
|
"label": "Resource",
|
|
40
|
-
"helper_text": "Changes in selected resource type will trigger this webhook.",
|
|
40
|
+
"helper_text": "Changes in selected resource type will trigger this webhook. Resource type cannot be changed after the webhook has been created.",
|
|
41
41
|
"event_resource_subscription": "Subscription",
|
|
42
42
|
"event_resource_transaction": "Transaction",
|
|
43
43
|
"event_resource_customer": "Customer"
|
|
@@ -53,7 +53,8 @@ export class InternalRadioGroupControl extends InternalEditableControl {
|
|
|
53
53
|
'group divide-y divide-contrast-10': isList,
|
|
54
54
|
})}
|
|
55
55
|
theme=${ifDefined((_b = this.theme) !== null && _b !== void 0 ? _b : undefined)}
|
|
56
|
-
?disabled=${this.disabled
|
|
56
|
+
?disabled=${this.disabled}
|
|
57
|
+
?readonly=${this.readonly}
|
|
57
58
|
.checkValidity=${this._checkValidity}
|
|
58
59
|
.value=${this._value}
|
|
59
60
|
@change=${(evt) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalRadioGroupControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,cAAc,CACZ,oBAAoB,EACpB,GAAG;;;;;;;;;;;;;;GAeF,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAAtE;;QASE,uCAAuC;QACvC,YAAO,GAAa,EAAE,CAAC;QAEvB,sEAAsE;QACtE,UAAK,GAAkB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalRadioGroupControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EA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G,KAAK,CAAC,KAAK,CAAC;QAC5B,CAAC;;UAEC,IAAI,CAAC,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAA;;sBAEF,MAAM,CAAC,KAAK;sBACZ,QAAQ,CAAC;YACf,6BAA6B,EAAE,MAAM;YACrC,gCAAgC,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ;SAC7E,CAAC;;wCAEwB,MAAM,CAAC,KAAK;;WAEzC,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { RadioGroupElement } from '@vaadin/vaadin-radio-button/vaadin-radio-group';\nimport type { Option } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\nimport { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles';\nimport { css } from 'lit-element';\n\nregisterStyles(\n 'vaadin-radio-group',\n css`\n :host([theme~='list']) label {\n padding-bottom: var(--lumo-space-xs);\n }\n\n :host([theme~='list']) [part='group-field'] {\n display: flex;\n border: thin solid var(--lumo-contrast-10pct);\n border-radius: var(--lumo-border-radius);\n transition: border-color 0.15s ease;\n }\n\n :host([theme~='list']:not([disabled]):not([readonly]):hover) [part='group-field'] {\n border-color: var(--lumo-contrast-20pct);\n }\n `\n);\n\n/**\n * Internal control wrapper for `vaadin-radio-group` element.\n *\n * @since 1.17.0\n * @element foxy-internal-radio-group-control\n */\nexport class InternalRadioGroupControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n options: { type: Array },\n theme: { type: String },\n };\n }\n\n /** List of radio buttons to render. */\n options: Option[] = [];\n\n /** Same as the \"theme\" attribute/property of `vaadin-radio-group`. */\n theme: string | null = null;\n\n renderControl(): TemplateResult {\n const isList = !!this.theme?.includes('list');\n\n return html`\n <vaadin-radio-group\n error-message=${ifDefined(this._errorMessage)}\n helper-text=${this.helperText}\n label=${this.label}\n class=${classMap({\n 'w-full': true,\n 'group divide-y divide-contrast-10': isList,\n })}\n theme=${ifDefined(this.theme ?? undefined)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${this._value as string | null}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as RadioGroupElement;\n this._value = field.value;\n }}\n >\n ${this.options.map(\n option => html`\n <vaadin-radio-button\n value=${option.value}\n class=${classMap({\n 'block p-s transition-colors': isList,\n 'group-hover-divide-contrast-20': isList && !this.disabled && !this.readonly,\n })}\n >\n <foxy-i18n infer=\"\" key=${option.label}></foxy-i18n>\n </vaadin-radio-button>\n `\n )}\n </vaadin-radio-group>\n `;\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
|
7
7
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
8
8
|
import { classMap } from "../../../utils/class-map.js";
|
|
9
9
|
import { html } from 'lit-html';
|
|
10
|
+
import { decode } from 'html-entities';
|
|
10
11
|
const NS = 'error-entry-card';
|
|
11
12
|
const Base = TranslatableMixin(ThemeableMixin(ScopedElementsMixin(NucleonElement)), NS);
|
|
12
13
|
/**
|
|
@@ -97,7 +98,7 @@ export class ErrorEntryCard extends Base {
|
|
|
97
98
|
}
|
|
98
99
|
__renderGetOrPostValues(getValues, postValues) {
|
|
99
100
|
const values = getValues || postValues;
|
|
100
|
-
const params = new URLSearchParams(
|
|
101
|
+
const params = new URLSearchParams(decode(values));
|
|
101
102
|
const method = getValues ? 'GET' : 'POST';
|
|
102
103
|
return html `
|
|
103
104
|
<div class="relative leading-xs pt-s">
|
|
@@ -151,36 +152,44 @@ export class ErrorEntryCard extends Base {
|
|
|
151
152
|
__renderDetails(data) {
|
|
152
153
|
return html `
|
|
153
154
|
<div class="space-y-m pt-m">
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
${data.referrer || data.get_values || data.post_values
|
|
156
|
+
? html `
|
|
157
|
+
<x-group frame>
|
|
158
|
+
<foxy-i18n slot="header" lang=${this.lang} key="request" ns=${this.ns}></foxy-i18n>
|
|
156
159
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
<div class="mx-xs p-s text-s divide-y divide-contrast-10 space-y-s">
|
|
161
|
+
<p>
|
|
162
|
+
<span class="block font-medium">${data.url}</span>
|
|
163
|
+
${data.referrer ? this.__renderReferrer(data.referrer) : ''}
|
|
164
|
+
</p>
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
${data.get_values || data.post_values
|
|
167
|
+
? this.__renderGetOrPostValues(data.get_values, data.post_values)
|
|
168
|
+
: ''}
|
|
169
|
+
</div>
|
|
170
|
+
</x-group>
|
|
171
|
+
`
|
|
165
172
|
: ''}
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
${data.ip_address || data.ip_country || data.user_agent
|
|
174
|
+
? html `
|
|
175
|
+
<x-group frame>
|
|
176
|
+
<foxy-i18n slot="header" lang=${this.lang} key="client" ns=${this.ns}></foxy-i18n>
|
|
168
177
|
|
|
169
|
-
|
|
170
|
-
|
|
178
|
+
<div class="text-s flex flex-col mx-xs p-s">
|
|
179
|
+
<span class="font-medium">
|
|
180
|
+
${data.ip_address}
|
|
181
|
+
${data.ip_country
|
|
182
|
+
? html `<span class="text-tertiary"> • </span>${data.ip_country}`
|
|
183
|
+
: ''}
|
|
184
|
+
</span>
|
|
171
185
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
${data.user_agent
|
|
187
|
+
? html `<span class="text-secondary">${data.user_agent}</span>`
|
|
188
|
+
: ''}
|
|
189
|
+
</div>
|
|
190
|
+
</x-group>
|
|
191
|
+
`
|
|
177
192
|
: ''}
|
|
178
|
-
</span>
|
|
179
|
-
|
|
180
|
-
${data.user_agent ? html `<span class="text-secondary">${data.user_agent}</span>` : ''}
|
|
181
|
-
</div>
|
|
182
|
-
</x-group>
|
|
183
|
-
|
|
184
193
|
${Object.entries(data._links).map(([curie, link]) => {
|
|
185
194
|
if (['self', 'fx:store', 'curies'].includes(curie))
|
|
186
195
|
return '';
|
|
@@ -211,10 +220,5 @@ export class ErrorEntryCard extends Base {
|
|
|
211
220
|
}
|
|
212
221
|
this.open = details.open;
|
|
213
222
|
}
|
|
214
|
-
__decodeHtml(html) {
|
|
215
|
-
const areaElement = document.createElement('textarea');
|
|
216
|
-
areaElement.innerHTML = html;
|
|
217
|
-
return areaElement.value;
|
|
218
|
-
}
|
|
219
223
|
}
|
|
220
224
|
//# sourceMappingURL=ErrorEntryCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorEntryCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ErrorEntryCard/ErrorEntryCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,sBAAmB;AACtC,OAAO,EAAE,KAAK,EAAE,qCAAkC;AAClD,OAAO,EAAE,cAAc,EAAE,mCAAgC;AACzD,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAClD,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,kBAAkB,CAAC;AAC9B,MAAM,IAAI,GAAG,iBAAiB,CAAC,cAAc,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAExF;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,IAAU;IAA9C;;Q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AA;;8CAEyB,IAAI,CAAC,IAAI,QAAQ,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE;;;;;uBAKrE,IAAI,CAAC,IAAI;uBACT,IAAI,CAAC,IAAI;qBACX,IAAI,CAAC,EAAE;;;;WAIjB,CAAC;QACJ,CAAC,CAAC;;KAEL,CAAC;IACJ,CAAC;IAEO,cAAc,CAAC,KAAY;;QACjC,MAAM,OAAO,GAAG,KAAK,CAAC,MAA4B,CAAC;QAEnD,IAAI,OAAO,CAAC,IAAI,IAAI,OAAA,IAAI,CAAC,IAAI,0CAAE,UAAU,MAAK,KAAK,EAAE;YACnD,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;YAChC,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;QAED,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAEO,YAAY,CAAC,IAAY;QAC/B,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACvD,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC;QAC7B,OAAO,WAAW,CAAC,KAAK,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { Data } from './types';\nimport { DataList } from './DataList';\nimport { Group } from '../../private/Group/Group';\nimport { NucleonElement } from '../NucleonElement/index';\nimport { ResourceViewer } from './ResourceViewer';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\nconst NS = 'error-entry-card';\nconst Base = TranslatableMixin(ThemeableMixin(ScopedElementsMixin(NucleonElement)), NS);\n\n/**\n * Displays an ErrorEntry from the Log of FoxyAPI.\n *\n * @element foxy-error-entry-card\n */\nexport class ErrorEntryCard extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'x-resource-viewer': ResourceViewer,\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'x-data-list': DataList,\n 'iron-icon': customElements.get('iron-icon'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n open: { type: Boolean, reflect: true },\n };\n }\n\n /**\n * If true, displays the error details.\n * Additionally, sets `form.hide_error` to `true` and submits changes on first view.\n */\n open = false;\n\n render(): TemplateResult {\n const data = this.data;\n const isBusy = this.in('busy');\n\n if (data) {\n const { hide_error } = data;\n const { open } = this;\n\n return html`\n <details\n aria-busy=${isBusy}\n aria-live=\"polite\"\n class=\"text-body w-full\"\n ?open=${open}\n @toggle=${this.__handleToggle}\n >\n <summary\n class=\"rounded-s ring-offset-4 ring-offset-base ring-primary-50 focus-outline-none focus-ring-2\"\n >\n <div\n style=\"padding-left: calc(var(--lumo-space-xs) + var(--lumo-space-s) - 1px)\"\n class=${classMap({\n 'border-l-2 leading-s relative cursor-pointer': true,\n 'border-contrast': hide_error && !open,\n 'border-primary': !hide_error,\n 'border-error': hide_error && open,\n 'h-l': !open,\n })}\n >\n ${this.__renderSummary(data)}\n </div>\n </summary>\n\n ${open ? this.__renderDetails(data) : ''}\n </details>\n `;\n } else {\n return html`\n <div\n aria-busy=${isBusy}\n aria-live=\"polite\"\n style=\"padding-left: calc(var(--lumo-space-xs) + var(--lumo-space-s) - 1px)\"\n class=\"flex items-center justify-center border-l-2 leading-s relative border-contrast-10 h-l\"\n >\n <foxy-spinner\n data-testid=\"spinner\"\n layout=\"horizontal\"\n state=${isBusy ? 'busy' : this.in('fail') ? 'error' : 'empty'}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n `;\n }\n }\n\n private __renderGetOrPostValues(getValues: string, postValues: string) {\n const values = getValues || postValues;\n const params = new URLSearchParams(this.__decodeHtml(values));\n const method = getValues ? 'GET' : 'POST';\n\n return html`\n <div class=\"relative leading-xs pt-s\">\n <div class=\"absolute font-medium right-0 text-tertiary text-xs top-0 mt-s\">${method}</div>\n <x-data-list data=${JSON.stringify(Array.from(params.entries()))}></x-data-list>\n </div>\n `;\n }\n\n private __renderReferrer(referrer: string) {\n return html`\n <span class=\"text-secondary\">Navigated from</span>\n <a\n target=\"_blank\"\n class=\"font-medium text-primary hover-underline\"\n href=${referrer}\n rel=\"nofollow noopener noreferrer\"\n >\n ${referrer}\n </a>\n `;\n }\n\n private __renderSummary(data: Data) {\n return html`\n <div class=\"text-s absolute right-0 top-0 text-tertiary\">\n <iron-icon icon=\"icons:expand-${this.open ? 'less' : 'more'}\"></iron-icon>\n </div>\n\n <div class=\"text-s mb-xs ${data.hide_error ? 'text-error' : 'text-primary'}\">\n <foxy-i18n\n options=${JSON.stringify({ value: data.date_created })}\n lang=${this.lang}\n key=\"date\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <foxy-i18n\n options=${JSON.stringify({ value: data.date_created })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n\n <p class=\"${this.open ? '' : 'truncate'} overflow-hidden font-medium\">\n ${data.error_message}\n </p>\n `;\n }\n\n private __renderDetails(data: Data) {\n return html`\n <div class=\"space-y-m pt-m\">\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${this.lang} key=\"request\" ns=${this.ns}></foxy-i18n>\n\n <div class=\"mx-xs p-s text-s divide-y divide-contrast-10 space-y-s\">\n <p>\n <span class=\"block font-medium\">${data.url}</span>\n ${data.referrer ? this.__renderReferrer(data.referrer) : ''}\n </p>\n\n ${data.get_values || data.post_values\n ? this.__renderGetOrPostValues(data.get_values, data.post_values)\n : ''}\n </div>\n </x-group>\n\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${this.lang} key=\"client\" ns=${this.ns}></foxy-i18n>\n\n <div class=\"text-s flex flex-col mx-xs p-s\">\n <span class=\"font-medium\">\n ${data.ip_address}\n ${data.ip_country\n ? html`<span class=\"text-tertiary\"> • </span>${data.ip_country}`\n : ''}\n </span>\n\n ${data.user_agent ? html`<span class=\"text-secondary\">${data.user_agent}</span>` : ''}\n </div>\n </x-group>\n\n ${Object.entries(data._links).map(([curie, link]) => {\n if (['self', 'fx:store', 'curies'].includes(curie)) return '';\n\n return html`\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${this.lang} key=${curie.substr(3)} ns=${this.ns}>\n </foxy-i18n>\n\n <x-resource-viewer\n class=\"p-s mx-xs\"\n href=${link.href}\n lang=${this.lang}\n ns=${this.ns}\n >\n </x-resource-viewer>\n </x-group>\n `;\n })}\n </div>\n `;\n }\n\n private __handleToggle(event: Event) {\n const details = event.target as HTMLDetailsElement;\n\n if (details.open && this.data?.hide_error === false) {\n this.edit({ hide_error: true });\n this.submit();\n }\n\n this.open = details.open;\n }\n\n private __decodeHtml(html: string) {\n const areaElement = document.createElement('textarea');\n areaElement.innerHTML = html;\n return areaElement.value;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ErrorEntryCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ErrorEntryCard/ErrorEntryCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,sBAAmB;AACtC,OAAO,EAAE,KAAK,EAAE,qCAAkC;AAClD,OAAO,EAAE,cAAc,EAAE,mCAAgC;AACzD,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAClD,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAA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I,CAAA,yCAAyC,IAAI,CAAC,UAAU,EAAE;gBAChE,CAAC,CAAC,EAAE;;;oBAGN,IAAI,CAAC,UAAU;gBACf,CAAC,CAAC,IAAI,CAAA,gCAAgC,IAAI,CAAC,UAAU,SAAS;gBAC9D,CAAC,CAAC,EAAE;;;aAGX;YACH,CAAC,CAAC,EAAE;UACJ,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;YAClD,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;YAE9D,OAAO,IAAI,CAAA;;8CAEyB,IAAI,CAAC,IAAI,QAAQ,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE;;;;;uBAKrE,IAAI,CAAC,IAAI;uBACT,IAAI,CAAC,IAAI;qBACX,IAAI,CAAC,EAAE;;;;WAIjB,CAAC;QACJ,CAAC,CAAC;;KAEL,CAAC;IACJ,CAAC;IAEO,cAAc,CAAC,KAAY;;QACjC,MAAM,OAAO,GAAG,KAAK,CAAC,MAA4B,CAAC;QAEnD,IAAI,OAAO,CAAC,IAAI,IAAI,OAAA,IAAI,CAAC,IAAI,0CAAE,UAAU,MAAK,KAAK,EAAE;YACnD,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;YAChC,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;QAED,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { Data } from './types';\nimport { DataList } from './DataList';\nimport { Group } from '../../private/Group/Group';\nimport { NucleonElement } from '../NucleonElement/index';\nimport { ResourceViewer } from './ResourceViewer';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\nimport { decode } from 'html-entities';\n\nconst NS = 'error-entry-card';\nconst Base = TranslatableMixin(ThemeableMixin(ScopedElementsMixin(NucleonElement)), NS);\n\n/**\n * Displays an ErrorEntry from the Log of FoxyAPI.\n *\n * @element foxy-error-entry-card\n */\nexport class ErrorEntryCard extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'x-resource-viewer': ResourceViewer,\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'x-data-list': DataList,\n 'iron-icon': customElements.get('iron-icon'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n open: { type: Boolean, reflect: true },\n };\n }\n\n /**\n * If true, displays the error details.\n * Additionally, sets `form.hide_error` to `true` and submits changes on first view.\n */\n open = false;\n\n render(): TemplateResult {\n const data = this.data;\n const isBusy = this.in('busy');\n\n if (data) {\n const { hide_error } = data;\n const { open } = this;\n\n return html`\n <details\n aria-busy=${isBusy}\n aria-live=\"polite\"\n class=\"text-body w-full\"\n ?open=${open}\n @toggle=${this.__handleToggle}\n >\n <summary\n class=\"rounded-s ring-offset-4 ring-offset-base ring-primary-50 focus-outline-none focus-ring-2\"\n >\n <div\n style=\"padding-left: calc(var(--lumo-space-xs) + var(--lumo-space-s) - 1px)\"\n class=${classMap({\n 'border-l-2 leading-s relative cursor-pointer': true,\n 'border-contrast': hide_error && !open,\n 'border-primary': !hide_error,\n 'border-error': hide_error && open,\n 'h-l': !open,\n })}\n >\n ${this.__renderSummary(data)}\n </div>\n </summary>\n\n ${open ? this.__renderDetails(data) : ''}\n </details>\n `;\n } else {\n return html`\n <div\n aria-busy=${isBusy}\n aria-live=\"polite\"\n style=\"padding-left: calc(var(--lumo-space-xs) + var(--lumo-space-s) - 1px)\"\n class=\"flex items-center justify-center border-l-2 leading-s relative border-contrast-10 h-l\"\n >\n <foxy-spinner\n data-testid=\"spinner\"\n layout=\"horizontal\"\n state=${isBusy ? 'busy' : this.in('fail') ? 'error' : 'empty'}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n `;\n }\n }\n\n private __renderGetOrPostValues(getValues: string, postValues: string) {\n const values = getValues || postValues;\n const params = new URLSearchParams(decode(values));\n const method = getValues ? 'GET' : 'POST';\n\n return html`\n <div class=\"relative leading-xs pt-s\">\n <div class=\"absolute font-medium right-0 text-tertiary text-xs top-0 mt-s\">${method}</div>\n <x-data-list data=${JSON.stringify(Array.from(params.entries()))}></x-data-list>\n </div>\n `;\n }\n\n private __renderReferrer(referrer: string) {\n return html`\n <span class=\"text-secondary\">Navigated from</span>\n <a\n target=\"_blank\"\n class=\"font-medium text-primary hover-underline\"\n href=${referrer}\n rel=\"nofollow noopener noreferrer\"\n >\n ${referrer}\n </a>\n `;\n }\n\n private __renderSummary(data: Data) {\n return html`\n <div class=\"text-s absolute right-0 top-0 text-tertiary\">\n <iron-icon icon=\"icons:expand-${this.open ? 'less' : 'more'}\"></iron-icon>\n </div>\n\n <div class=\"text-s mb-xs ${data.hide_error ? 'text-error' : 'text-primary'}\">\n <foxy-i18n\n options=${JSON.stringify({ value: data.date_created })}\n lang=${this.lang}\n key=\"date\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <foxy-i18n\n options=${JSON.stringify({ value: data.date_created })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n\n <p class=\"${this.open ? '' : 'truncate'} overflow-hidden font-medium\">\n ${data.error_message}\n </p>\n `;\n }\n\n private __renderDetails(data: Data) {\n return html`\n <div class=\"space-y-m pt-m\">\n ${data.referrer || data.get_values || data.post_values\n ? html`\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${this.lang} key=\"request\" ns=${this.ns}></foxy-i18n>\n\n <div class=\"mx-xs p-s text-s divide-y divide-contrast-10 space-y-s\">\n <p>\n <span class=\"block font-medium\">${data.url}</span>\n ${data.referrer ? this.__renderReferrer(data.referrer) : ''}\n </p>\n\n ${data.get_values || data.post_values\n ? this.__renderGetOrPostValues(data.get_values, data.post_values)\n : ''}\n </div>\n </x-group>\n `\n : ''}\n ${data.ip_address || data.ip_country || data.user_agent\n ? html`\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${this.lang} key=\"client\" ns=${this.ns}></foxy-i18n>\n\n <div class=\"text-s flex flex-col mx-xs p-s\">\n <span class=\"font-medium\">\n ${data.ip_address}\n ${data.ip_country\n ? html`<span class=\"text-tertiary\"> • </span>${data.ip_country}`\n : ''}\n </span>\n\n ${data.user_agent\n ? html`<span class=\"text-secondary\">${data.user_agent}</span>`\n : ''}\n </div>\n </x-group>\n `\n : ''}\n ${Object.entries(data._links).map(([curie, link]) => {\n if (['self', 'fx:store', 'curies'].includes(curie)) return '';\n\n return html`\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${this.lang} key=${curie.substr(3)} ns=${this.ns}>\n </foxy-i18n>\n\n <x-resource-viewer\n class=\"p-s mx-xs\"\n href=${link.href}\n lang=${this.lang}\n ns=${this.ns}\n >\n </x-resource-viewer>\n </x-group>\n `;\n })}\n </div>\n `;\n }\n\n private __handleToggle(event: Event) {\n const details = event.target as HTMLDetailsElement;\n\n if (details.open && this.data?.hide_error === false) {\n this.edit({ hide_error: true });\n this.submit();\n }\n\n this.open = details.open;\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
2
2
|
import { DataList } from "./DataList.js";
|
|
3
3
|
import { NucleonElement } from "../NucleonElement/index.js";
|
|
4
|
+
import { getResourceId } from '@foxy.io/sdk/core';
|
|
4
5
|
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
5
6
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
6
7
|
import { html } from 'lit-html';
|
|
@@ -16,6 +17,14 @@ export class ResourceViewer extends Base {
|
|
|
16
17
|
if (this.in({ idle: 'snapshot' })) {
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18
19
|
const { _links, _embedded, ...data } = this.data;
|
|
20
|
+
try {
|
|
21
|
+
const id = getResourceId(_links.self.href);
|
|
22
|
+
if (id !== null)
|
|
23
|
+
data.id = id;
|
|
24
|
+
}
|
|
25
|
+
catch (_a) {
|
|
26
|
+
// ignore
|
|
27
|
+
}
|
|
19
28
|
return html `
|
|
20
29
|
<x-data-list
|
|
21
30
|
aria-live="polite"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceViewer.js","sourceRoot":"","sources":["../../../../src/elements/public/ErrorEntryCard/ResourceViewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAAE,QAAQ,EAAE,sBAAmB;AACtC,OAAO,EAAE,cAAc,EAAE,mCAAgC;
|
|
1
|
+
{"version":3,"file":"ResourceViewer.js","sourceRoot":"","sources":["../../../../src/elements/public/ErrorEntryCard/ResourceViewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAAE,QAAQ,EAAE,sBAAmB;AACtC,OAAO,EAAE,cAAc,EAAE,mCAAgC;AACzD,OAAO,EAAE,aAAa,EAAY,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAQhC,MAAM,IAAI,GAAG,iBAAiB,CAAC,cAAc,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAEpF,MAAM,OAAO,cAAe,SAAQ,IAAmB;IACrD,MAAM,KAAK,cAAc;QACvB,OAAO;YACL,cAAc,EAAE,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC;YAClD,aAAa,EAAE,QAAQ;SACxB,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE;YACjC,6DAA6D;YAC7D,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;YAEjD,IAAI;gBACF,MAAM,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC3C,IAAI,EAAE,KAAK,IAAI;oBAAE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;aAC/B;YAAC,WAAM;gBACN,SAAS;aACV;YAED,OAAO,IAAI,CAAA;;;;;iBAKA,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;;;OAG1D,CAAC;SACH;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAE/B,OAAO,IAAI,CAAA;0CAC2B,MAAM;;;;kBAI9B,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;iBACtD,IAAI,CAAC,IAAI;eACX,IAAI,CAAC,EAAE;;;;KAIjB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { DataList } from './DataList';\nimport { NucleonElement } from '../NucleonElement/index';\nimport { getResourceId, Resource } from '@foxy.io/sdk/core';\nimport { TemplateResult } from 'lit-element';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { html } from 'lit-html';\n\ntype Rel = {\n links: { self: Rel };\n zooms: Record<string, any>;\n props: Record<string, unknown>;\n};\n\nconst Base = TranslatableMixin(ThemeableMixin(ScopedElementsMixin(NucleonElement)));\n\nexport class ResourceViewer extends Base<Resource<Rel>> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'x-data-list': DataList,\n };\n }\n\n render(): TemplateResult {\n if (this.in({ idle: 'snapshot' })) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { _links, _embedded, ...data } = this.data;\n\n try {\n const id = getResourceId(_links.self.href);\n if (id !== null) data.id = id;\n } catch {\n // ignore\n }\n\n return html`\n <x-data-list\n aria-live=\"polite\"\n aria-busy=\"false\"\n class=\"leading-s text-s\"\n data=${JSON.stringify(Array.from(Object.entries(data)))}\n >\n </x-data-list>\n `;\n }\n\n const isBusy = this.in('busy');\n\n return html`\n <div aria-live=\"polite\" aria-busy=${isBusy} data-testid=\"wrapper\" class=\"flex justify-center\">\n <foxy-spinner\n data-testid=\"spinner\"\n layout=\"horizontal\"\n state=${this.in('fail') ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -172,6 +172,7 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
172
172
|
const handlingFeeType = (_a = this.form.handling_fee_type) !== null && _a !== void 0 ? _a : 'none';
|
|
173
173
|
return html `
|
|
174
174
|
<foxy-nucleon
|
|
175
|
+
class="hidden"
|
|
175
176
|
infer=""
|
|
176
177
|
href=${ifDefined(this.form.customer_email_template_uri || undefined)}
|
|
177
178
|
id=${this.__customerEmailTemplateLoaderId}
|
|
@@ -180,6 +181,7 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
180
181
|
</foxy-nucleon>
|
|
181
182
|
|
|
182
183
|
<foxy-nucleon
|
|
184
|
+
class="hidden"
|
|
183
185
|
infer=""
|
|
184
186
|
href=${ifDefined(this.form.gift_recipient_email_template_uri || undefined)}
|
|
185
187
|
id=${this.__giftRecipientEmailTemplateLoaderId}
|
|
@@ -188,6 +190,7 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
188
190
|
</foxy-nucleon>
|
|
189
191
|
|
|
190
192
|
<foxy-nucleon
|
|
193
|
+
class="hidden"
|
|
191
194
|
infer=""
|
|
192
195
|
href=${ifDefined(this.form.admin_email_template_uri || undefined)}
|
|
193
196
|
id=${this.__adminEmailTemplateLoaderId}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemCategoryForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCategoryForm/ItemCategoryForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB,CAAC,YAAY,EAAE,oBAAoB,CAAO;IAAjG;;QA+GE,8DAA8D;QAC9D,mBAAc,GAAkB,IAAI,CAAC;QAErC,sDAAsD;QACtD,cAAS,GAAc,EAAE,CAAC;QAE1B,oDAAoD;QACpD,UAAK,GAAkB,IAAI,CAAC;QAiCX,yCAAoC,GAAG,sCAAsC,CAAC;QAE9E,oCAA+B,GAAG,gCAAgC,CAAC;QAEnE,iCAA4B,GAAG,6BAA6B,CAAC;IAsPhF,CAAC;IAhZC,MAAM,KAAK,UAAU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AE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE;CAC5C,CAAC;AAEa,yCAAwB,GAAG;IACxC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE;IACvC,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,gBAAgB,EAAE;IAC3D,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,eAAe,EAAE;IACzD,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,cAAc,EAAE;IACvD,EAAE,KAAK,EAAE,kCAAkC,EAAE,KAAK,EAAE,2BAA2B,EAAE;CAClF,CAAC","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { DiscountBuilder } from '../DiscountBuilder/DiscountBuilder';\nimport type { Templates, Data } from './types';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { ParsedValue } from '../DiscountBuilder/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\n/**\n * Form element for item categories (`fx:item_category`).\n *\n * @slot name:before\n * @slot name:after\n *\n * @slot code:before\n * @slot code:after\n *\n * @slot handling-fee-type:before\n * @slot handling-fee-type:after\n *\n * @slot handling-fee:before\n * @slot handling-fee:after\n *\n * @slot handling-fee-percentage:before\n * @slot handling-fee-percentage:after\n *\n * @slot handling-fee-minimum:before\n * @slot handling-fee-minimum:after\n *\n * @slot item-delivery-type:before\n * @slot item-delivery-type:after\n *\n * @slot max-downloads-per-customer:before\n * @slot max-downloads-per-customer:after\n *\n * @slot max-downloads-time-period:before\n * @slot max-downloads-time-period:after\n *\n * @slot shipping-flat-rate:before\n * @slot shipping-flat-rate:after\n *\n * @slot shipping-flat-rate-type:before\n * @slot shipping-flat-rate-type:after\n *\n * @slot default-weight:before\n * @slot default-weight:after\n *\n * @slot default-weight-unit:before\n * @slot default-weight-unit:after\n *\n * @slot default-length-unit:before\n * @slot default-length-unit:after\n *\n * @slot customs-value:before\n * @slot customs-value:after\n *\n * @slot discount-name:before\n * @slot discount-name:after\n *\n * @slot discount-builder:before\n * @slot discount-builder:after\n *\n * @slot admin-email-template-uri:before\n * @slot admin-email-template-uri:after\n *\n * @slot customer-email-template-uri:before\n * @slot customer-email-template-uri:after\n *\n * @slot gift-recipient-email-template-uri:before\n * @slot gift-recipient-email-template-uri:after\n *\n * @slot taxes:before\n * @slot taxes:after\n *\n * @slot timestamps:before\n * @slot timestamps:after\n *\n * @slot create:before\n * @slot create:after\n *\n * @slot delete:before\n * @slot delete:after\n *\n *\n * @since 1.21.0\n * @element foxy-item-category-form\n */\nexport class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-category-form')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n emailTemplates: { attribute: 'email-templates' },\n taxes: {},\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ code: v }) => !!v || 'code:v8n_required',\n ({ code: v }) => (v && v.length <= 50) || 'code:v8n_too_long',\n\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (v && v.length <= 50) || 'name:v8n_too_long',\n\n ({ item_delivery_type: v }) => !!v || 'item-delivery-type:v8n_required',\n\n ({ item_delivery_type: t, max_downloads_per_customer: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-per-customer:v8n_required'\n );\n },\n\n ({ max_downloads_per_customer: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-per-customer:v8n_negative';\n },\n\n ({ item_delivery_type: t, max_downloads_time_period: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-time-period:v8n_required'\n );\n },\n\n ({ max_downloads_time_period: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-time-period:v8n_negative';\n },\n\n ({ customs_value: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'customs-value:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight: v }) => {\n return (t === 'shipped' ? typeof v === 'number' : true) || 'default-weight:v8n_required';\n },\n\n ({ default_weight: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'default-weight:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-weight-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, default_length_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-length-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, shipping_flat_rate: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'number' : true) || 'shipping-flat-rate:v8n_required'\n );\n },\n\n ({ shipping_flat_rate: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'shipping-flat-rate:v8n_negative';\n },\n\n ({ item_delivery_type: t, shipping_flat_rate_type: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'string' : true) ||\n 'shipping-flat-rate-type:v8n_required'\n );\n },\n\n ({ handling_fee_type: v }) => !!v || 'handling-fee-type:v8n_required',\n\n ({ handling_fee_type: t, handling_fee_minimum: v }) => {\n return (\n (t === 'flat_percent_with_minimum' ? typeof v === 'number' : true) ||\n 'handling-fee-minimum:v8n_required'\n );\n },\n\n ({ handling_fee_minimum: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-minimum:v8n_negative';\n },\n\n ({ handling_fee_type: t, handling_fee_percentage: v }) => {\n return (\n (t === 'flat_percent_with_minimum' || t === 'flat_percent'\n ? typeof v === 'number'\n : true) || 'handling-fee-percentage:v8n_required'\n );\n },\n\n ({ handling_fee_percentage: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-percentage:v8n_negative';\n },\n\n ({ send_admin_email: s, admin_email: v }) => (s ? !!v : true) || 'admin-email:v8n_required',\n ];\n }\n\n /** URL of the `fx:email_templates` collection for a store. */\n emailTemplates: string | null = null;\n\n /** Template render functions mapped to their name. */\n templates: Templates = {};\n\n /** URL of the `fx:taxes` collection for a store. */\n taxes: string | null = null;\n\n private static __shippingFlatRateTypeOptions = [\n { label: 'option_per_order', value: 'per_order' },\n { label: 'option_per_shipment', value: 'per_shipment' },\n ];\n\n private static __defaultWeightUnitOptions = [\n { label: 'option_lbs', value: 'LBS' },\n { label: 'option_kgs', value: 'KGS' },\n ];\n\n private static __defaultLengthUnitOptions = [\n { label: 'option_in', value: 'IN' },\n { label: 'option_cm', value: 'CM' },\n ];\n\n private static __itemDeliveryTypeOptions = [\n { label: 'option_notshipped', value: 'notshipped' },\n { label: 'option_downloaded', value: 'downloaded' },\n { label: 'option_flat_rate', value: 'flat_rate' },\n { label: 'option_shipped', value: 'shipped' },\n { label: 'option_pickup', value: 'pickup' },\n ];\n\n private static __handlingFeeTypeOptions = [\n { label: 'option_none', value: 'none' },\n { label: 'option_flat_per_order', value: 'flat_per_order' },\n { label: 'option_flat_per_item', value: 'flat_per_item' },\n { label: 'option_flat_percent', value: 'flat_percent' },\n { label: 'option_flat_percent_with_minimum', value: 'flat_percent_with_minimum' },\n ];\n\n private readonly __giftRecipientEmailTemplateLoaderId = 'gift-recipient-email-template-loader';\n\n private readonly __customerEmailTemplateLoaderId = 'customer-email-template-loader';\n\n private readonly __adminEmailTemplateLoaderId = 'admin-email-template-loader';\n\n renderBody(): TemplateResult {\n const itemDeliveryType = this.form.item_delivery_type;\n const handlingFeeType = this.form.handling_fee_type ?? 'none';\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.form.customer_email_template_uri || undefined)}\n id=${this.__customerEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.form.gift_recipient_email_template_uri || undefined)}\n id=${this.__giftRecipientEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.form.admin_email_template_uri || undefined)}\n id=${this.__adminEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"grid grid-cols-2 gap-m\">\n <foxy-internal-text-control infer=\"name\" class=\"col-span-2\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"code\" class=\"col-span-2\"></foxy-internal-text-control>\n\n <foxy-internal-select-control\n infer=\"handling-fee-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__handlingFeeTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${handlingFeeType === 'none'\n ? ''\n : html`\n ${this.__renderHandlingFee()}\n ${handlingFeeType.includes('percent') ? this.__renderHandlingFeePercentage() : ''}\n ${handlingFeeType === 'flat_percent_with_minimum'\n ? this.__renderHandlingFeeMinimum()\n : ''}\n `}\n\n <foxy-internal-select-control\n infer=\"item-delivery-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__itemDeliveryTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${itemDeliveryType === 'downloaded'\n ? this.__renderDownloadDeliveryControls()\n : itemDeliveryType === 'flat_rate'\n ? [this.__renderFlatRateControls(), this.__renderCustomsValue()]\n : itemDeliveryType === 'shipped'\n ? [this.__renderShippingControls(), this.__renderCustomsValue()]\n : ''}\n\n <foxy-internal-text-control infer=\"discount-name\" class=\"col-span-2\">\n </foxy-internal-text-control>\n\n ${this.form.discount_name ? this.__renderDiscountBuilder() : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"admin-email-template-uri\"\n class=${this.form.send_admin_email ? '' : 'col-span-2'}\n .selectedItem=${this.__adminEmailTemplateLoader?.data}\n @change=${(evt: CustomEvent) => {\n this.edit({\n send_admin_email: !!evt.detail,\n admin_email: evt.detail ? this.form.admin_email : '',\n });\n }}\n >\n </foxy-internal-async-combo-box-control>\n\n ${this.form.send_admin_email ? this.__renderAdminEmail() : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"customer-email-template-uri\"\n class=\"col-span-2\"\n .selectedItem=${this.__customerEmailTemplateLoader?.data}\n @change=${(evt: CustomEvent) => this.edit({ send_customer_email: !!evt.detail })}\n >\n </foxy-internal-async-combo-box-control>\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"gift-recipient-email-template-uri\"\n class=\"col-span-2\"\n .selectedItem=${this.__giftRecipientEmailTemplateLoader?.data}\n >\n </foxy-internal-async-combo-box-control>\n\n ${this.data ? this.__renderTaxes() : ''}\n </div>\n\n ${super.renderBody()}\n `;\n }\n\n private get __giftRecipientEmailTemplateLoader() {\n const id = this.__giftRecipientEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private get __customerEmailTemplateLoader() {\n const id = this.__customerEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private get __adminEmailTemplateLoader() {\n const id = this.__adminEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private __renderHandlingFee() {\n return html`\n <foxy-internal-number-control\n infer=\"handling-fee\"\n class=${this.form.handling_fee_type === 'flat_percent' ? '' : 'col-span-2'}\n >\n </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeePercentage() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-percentage\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeeMinimum() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-minimum\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderDownloadDeliveryControls() {\n return html`\n <foxy-internal-integer-control infer=\"max-downloads-per-customer\">\n </foxy-internal-integer-control>\n\n <foxy-internal-integer-control infer=\"max-downloads-time-period\">\n </foxy-internal-integer-control>\n `;\n }\n\n private __renderFlatRateControls() {\n return html`\n <foxy-internal-number-control infer=\"shipping-flat-rate\"> </foxy-internal-number-control>\n\n <foxy-internal-select-control\n infer=\"shipping-flat-rate-type\"\n .options=${ItemCategoryForm.__shippingFlatRateTypeOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderShippingControls() {\n return html`\n <foxy-internal-integer-control infer=\"default-weight\" class=\"col-span-2\">\n </foxy-internal-integer-control>\n\n <foxy-internal-select-control\n infer=\"default-weight-unit\"\n .options=${ItemCategoryForm.__defaultWeightUnitOptions}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n infer=\"default-length-unit\"\n .options=${ItemCategoryForm.__defaultLengthUnitOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderCustomsValue() {\n return html`\n <foxy-internal-number-control infer=\"customs-value\" class=\"col-span-2\">\n </foxy-internal-number-control>\n `;\n }\n\n private __renderDiscountBuilder() {\n const parsedValue: ParsedValue = {\n name: this.form.discount_name ?? '',\n type: this.form.discount_type || 'quantity_amount',\n details: this.form.discount_details ?? '',\n };\n\n return html`\n <foxy-discount-builder\n infer=\"discount-builder\"\n class=\"col-span-2\"\n .parsedValue=${parsedValue}\n @change=${(evt: CustomEvent) => {\n const builder = evt.currentTarget as DiscountBuilder;\n\n this.edit({\n discount_name: builder.parsedValue.name,\n discount_type: builder.parsedValue.type,\n discount_details: builder.parsedValue.details,\n });\n }}\n >\n </foxy-discount-builder>\n `;\n }\n\n private __renderAdminEmail() {\n return html`<foxy-internal-text-control infer=\"admin-email\"> </foxy-internal-text-control>`;\n }\n\n private __renderTaxes() {\n return html`\n <foxy-internal-item-category-form-taxes-control\n taxes=${ifDefined(this.taxes ?? undefined)}\n class=\"col-span-2\"\n infer=\"taxes\"\n >\n </foxy-internal-item-category-form-taxes-control>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ItemCategoryForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCategoryForm/ItemCategoryForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB,CAAC,YAAY,EAAE,oBAAoB,CAAO;IAAjG;;QA+GE,8DAA8D;QAC9D,mBAAc,GAAkB,IAAI,CAAC;QAErC,sDAAsD;QACtD,cAAS,GAAc,EAAE,CAAC;QAE1B,oDAAoD;QACpD,UAAK,GAAkB,IAAI,CAAC;QAiCX,yCAAoC,GAAG,sCAAsC,CAAC;QAE9E,oCAA+B,GAAG,gCAAgC,CAAC;QAEnE,iCAA4B,GAAG,6BAA6B,CAAC;IAyPhF,CAAC;IAnZC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,cAAc,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAChD,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,OAAO;YACL,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC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EAAE,KAAK,EAAE,eAAe,EAAE;IACzD,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,cAAc,EAAE;IACvD,EAAE,KAAK,EAAE,kCAAkC,EAAE,KAAK,EAAE,2BAA2B,EAAE;CAClF,CAAC","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { DiscountBuilder } from '../DiscountBuilder/DiscountBuilder';\nimport type { Templates, Data } from './types';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { ParsedValue } from '../DiscountBuilder/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\n/**\n * Form element for item categories (`fx:item_category`).\n *\n * @slot name:before\n * @slot name:after\n *\n * @slot code:before\n * @slot code:after\n *\n * @slot handling-fee-type:before\n * @slot handling-fee-type:after\n *\n * @slot handling-fee:before\n * @slot handling-fee:after\n *\n * @slot handling-fee-percentage:before\n * @slot handling-fee-percentage:after\n *\n * @slot handling-fee-minimum:before\n * @slot handling-fee-minimum:after\n *\n * @slot item-delivery-type:before\n * @slot item-delivery-type:after\n *\n * @slot max-downloads-per-customer:before\n * @slot max-downloads-per-customer:after\n *\n * @slot max-downloads-time-period:before\n * @slot max-downloads-time-period:after\n *\n * @slot shipping-flat-rate:before\n * @slot shipping-flat-rate:after\n *\n * @slot shipping-flat-rate-type:before\n * @slot shipping-flat-rate-type:after\n *\n * @slot default-weight:before\n * @slot default-weight:after\n *\n * @slot default-weight-unit:before\n * @slot default-weight-unit:after\n *\n * @slot default-length-unit:before\n * @slot default-length-unit:after\n *\n * @slot customs-value:before\n * @slot customs-value:after\n *\n * @slot discount-name:before\n * @slot discount-name:after\n *\n * @slot discount-builder:before\n * @slot discount-builder:after\n *\n * @slot admin-email-template-uri:before\n * @slot admin-email-template-uri:after\n *\n * @slot customer-email-template-uri:before\n * @slot customer-email-template-uri:after\n *\n * @slot gift-recipient-email-template-uri:before\n * @slot gift-recipient-email-template-uri:after\n *\n * @slot taxes:before\n * @slot taxes:after\n *\n * @slot timestamps:before\n * @slot timestamps:after\n *\n * @slot create:before\n * @slot create:after\n *\n * @slot delete:before\n * @slot delete:after\n *\n *\n * @since 1.21.0\n * @element foxy-item-category-form\n */\nexport class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-category-form')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n emailTemplates: { attribute: 'email-templates' },\n taxes: {},\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ code: v }) => !!v || 'code:v8n_required',\n ({ code: v }) => (v && v.length <= 50) || 'code:v8n_too_long',\n\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (v && v.length <= 50) || 'name:v8n_too_long',\n\n ({ item_delivery_type: v }) => !!v || 'item-delivery-type:v8n_required',\n\n ({ item_delivery_type: t, max_downloads_per_customer: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-per-customer:v8n_required'\n );\n },\n\n ({ max_downloads_per_customer: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-per-customer:v8n_negative';\n },\n\n ({ item_delivery_type: t, max_downloads_time_period: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-time-period:v8n_required'\n );\n },\n\n ({ max_downloads_time_period: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-time-period:v8n_negative';\n },\n\n ({ customs_value: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'customs-value:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight: v }) => {\n return (t === 'shipped' ? typeof v === 'number' : true) || 'default-weight:v8n_required';\n },\n\n ({ default_weight: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'default-weight:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-weight-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, default_length_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-length-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, shipping_flat_rate: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'number' : true) || 'shipping-flat-rate:v8n_required'\n );\n },\n\n ({ shipping_flat_rate: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'shipping-flat-rate:v8n_negative';\n },\n\n ({ item_delivery_type: t, shipping_flat_rate_type: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'string' : true) ||\n 'shipping-flat-rate-type:v8n_required'\n );\n },\n\n ({ handling_fee_type: v }) => !!v || 'handling-fee-type:v8n_required',\n\n ({ handling_fee_type: t, handling_fee_minimum: v }) => {\n return (\n (t === 'flat_percent_with_minimum' ? typeof v === 'number' : true) ||\n 'handling-fee-minimum:v8n_required'\n );\n },\n\n ({ handling_fee_minimum: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-minimum:v8n_negative';\n },\n\n ({ handling_fee_type: t, handling_fee_percentage: v }) => {\n return (\n (t === 'flat_percent_with_minimum' || t === 'flat_percent'\n ? typeof v === 'number'\n : true) || 'handling-fee-percentage:v8n_required'\n );\n },\n\n ({ handling_fee_percentage: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-percentage:v8n_negative';\n },\n\n ({ send_admin_email: s, admin_email: v }) => (s ? !!v : true) || 'admin-email:v8n_required',\n ];\n }\n\n /** URL of the `fx:email_templates` collection for a store. */\n emailTemplates: string | null = null;\n\n /** Template render functions mapped to their name. */\n templates: Templates = {};\n\n /** URL of the `fx:taxes` collection for a store. */\n taxes: string | null = null;\n\n private static __shippingFlatRateTypeOptions = [\n { label: 'option_per_order', value: 'per_order' },\n { label: 'option_per_shipment', value: 'per_shipment' },\n ];\n\n private static __defaultWeightUnitOptions = [\n { label: 'option_lbs', value: 'LBS' },\n { label: 'option_kgs', value: 'KGS' },\n ];\n\n private static __defaultLengthUnitOptions = [\n { label: 'option_in', value: 'IN' },\n { label: 'option_cm', value: 'CM' },\n ];\n\n private static __itemDeliveryTypeOptions = [\n { label: 'option_notshipped', value: 'notshipped' },\n { label: 'option_downloaded', value: 'downloaded' },\n { label: 'option_flat_rate', value: 'flat_rate' },\n { label: 'option_shipped', value: 'shipped' },\n { label: 'option_pickup', value: 'pickup' },\n ];\n\n private static __handlingFeeTypeOptions = [\n { label: 'option_none', value: 'none' },\n { label: 'option_flat_per_order', value: 'flat_per_order' },\n { label: 'option_flat_per_item', value: 'flat_per_item' },\n { label: 'option_flat_percent', value: 'flat_percent' },\n { label: 'option_flat_percent_with_minimum', value: 'flat_percent_with_minimum' },\n ];\n\n private readonly __giftRecipientEmailTemplateLoaderId = 'gift-recipient-email-template-loader';\n\n private readonly __customerEmailTemplateLoaderId = 'customer-email-template-loader';\n\n private readonly __adminEmailTemplateLoaderId = 'admin-email-template-loader';\n\n renderBody(): TemplateResult {\n const itemDeliveryType = this.form.item_delivery_type;\n const handlingFeeType = this.form.handling_fee_type ?? 'none';\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.form.customer_email_template_uri || undefined)}\n id=${this.__customerEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.form.gift_recipient_email_template_uri || undefined)}\n id=${this.__giftRecipientEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.form.admin_email_template_uri || undefined)}\n id=${this.__adminEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"grid grid-cols-2 gap-m\">\n <foxy-internal-text-control infer=\"name\" class=\"col-span-2\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"code\" class=\"col-span-2\"></foxy-internal-text-control>\n\n <foxy-internal-select-control\n infer=\"handling-fee-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__handlingFeeTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${handlingFeeType === 'none'\n ? ''\n : html`\n ${this.__renderHandlingFee()}\n ${handlingFeeType.includes('percent') ? this.__renderHandlingFeePercentage() : ''}\n ${handlingFeeType === 'flat_percent_with_minimum'\n ? this.__renderHandlingFeeMinimum()\n : ''}\n `}\n\n <foxy-internal-select-control\n infer=\"item-delivery-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__itemDeliveryTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${itemDeliveryType === 'downloaded'\n ? this.__renderDownloadDeliveryControls()\n : itemDeliveryType === 'flat_rate'\n ? [this.__renderFlatRateControls(), this.__renderCustomsValue()]\n : itemDeliveryType === 'shipped'\n ? [this.__renderShippingControls(), this.__renderCustomsValue()]\n : ''}\n\n <foxy-internal-text-control infer=\"discount-name\" class=\"col-span-2\">\n </foxy-internal-text-control>\n\n ${this.form.discount_name ? this.__renderDiscountBuilder() : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"admin-email-template-uri\"\n class=${this.form.send_admin_email ? '' : 'col-span-2'}\n .selectedItem=${this.__adminEmailTemplateLoader?.data}\n @change=${(evt: CustomEvent) => {\n this.edit({\n send_admin_email: !!evt.detail,\n admin_email: evt.detail ? this.form.admin_email : '',\n });\n }}\n >\n </foxy-internal-async-combo-box-control>\n\n ${this.form.send_admin_email ? this.__renderAdminEmail() : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"customer-email-template-uri\"\n class=\"col-span-2\"\n .selectedItem=${this.__customerEmailTemplateLoader?.data}\n @change=${(evt: CustomEvent) => this.edit({ send_customer_email: !!evt.detail })}\n >\n </foxy-internal-async-combo-box-control>\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"gift-recipient-email-template-uri\"\n class=\"col-span-2\"\n .selectedItem=${this.__giftRecipientEmailTemplateLoader?.data}\n >\n </foxy-internal-async-combo-box-control>\n\n ${this.data ? this.__renderTaxes() : ''}\n </div>\n\n ${super.renderBody()}\n `;\n }\n\n private get __giftRecipientEmailTemplateLoader() {\n const id = this.__giftRecipientEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private get __customerEmailTemplateLoader() {\n const id = this.__customerEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private get __adminEmailTemplateLoader() {\n const id = this.__adminEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private __renderHandlingFee() {\n return html`\n <foxy-internal-number-control\n infer=\"handling-fee\"\n class=${this.form.handling_fee_type === 'flat_percent' ? '' : 'col-span-2'}\n >\n </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeePercentage() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-percentage\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeeMinimum() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-minimum\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderDownloadDeliveryControls() {\n return html`\n <foxy-internal-integer-control infer=\"max-downloads-per-customer\">\n </foxy-internal-integer-control>\n\n <foxy-internal-integer-control infer=\"max-downloads-time-period\">\n </foxy-internal-integer-control>\n `;\n }\n\n private __renderFlatRateControls() {\n return html`\n <foxy-internal-number-control infer=\"shipping-flat-rate\"> </foxy-internal-number-control>\n\n <foxy-internal-select-control\n infer=\"shipping-flat-rate-type\"\n .options=${ItemCategoryForm.__shippingFlatRateTypeOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderShippingControls() {\n return html`\n <foxy-internal-integer-control infer=\"default-weight\" class=\"col-span-2\">\n </foxy-internal-integer-control>\n\n <foxy-internal-select-control\n infer=\"default-weight-unit\"\n .options=${ItemCategoryForm.__defaultWeightUnitOptions}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n infer=\"default-length-unit\"\n .options=${ItemCategoryForm.__defaultLengthUnitOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderCustomsValue() {\n return html`\n <foxy-internal-number-control infer=\"customs-value\" class=\"col-span-2\">\n </foxy-internal-number-control>\n `;\n }\n\n private __renderDiscountBuilder() {\n const parsedValue: ParsedValue = {\n name: this.form.discount_name ?? '',\n type: this.form.discount_type || 'quantity_amount',\n details: this.form.discount_details ?? '',\n };\n\n return html`\n <foxy-discount-builder\n infer=\"discount-builder\"\n class=\"col-span-2\"\n .parsedValue=${parsedValue}\n @change=${(evt: CustomEvent) => {\n const builder = evt.currentTarget as DiscountBuilder;\n\n this.edit({\n discount_name: builder.parsedValue.name,\n discount_type: builder.parsedValue.type,\n discount_details: builder.parsedValue.details,\n });\n }}\n >\n </foxy-discount-builder>\n `;\n }\n\n private __renderAdminEmail() {\n return html`<foxy-internal-text-control infer=\"admin-email\"> </foxy-internal-text-control>`;\n }\n\n private __renderTaxes() {\n return html`\n <foxy-internal-item-category-form-taxes-control\n taxes=${ifDefined(this.taxes ?? undefined)}\n class=\"col-span-2\"\n infer=\"taxes\"\n >\n </foxy-internal-item-category-form-taxes-control>\n `;\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TemplateResult } from 'lit-html';
|
|
2
2
|
import type { NucleonV8N } from '../NucleonElement/types';
|
|
3
3
|
import type { Data } from './types';
|
|
4
|
+
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
4
5
|
import { InternalForm } from '../../internal/InternalForm/InternalForm';
|
|
5
6
|
declare const WebhookForm_base: typeof InternalForm & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
6
7
|
defaultNS: string;
|
|
@@ -42,6 +43,7 @@ export declare class WebhookForm extends WebhookForm_base<Data> {
|
|
|
42
43
|
static get v8n(): NucleonV8N<Data>;
|
|
43
44
|
private __formats;
|
|
44
45
|
private __eventResources;
|
|
46
|
+
get readonlySelector(): BooleanSelector;
|
|
45
47
|
renderBody(): TemplateResult;
|
|
46
48
|
}
|
|
47
49
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
2
|
+
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
2
3
|
import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
|
|
3
4
|
import { html } from 'lit-html';
|
|
4
5
|
/**
|
|
@@ -59,6 +60,12 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
|
|
|
59
60
|
({ encryption_key: v }) => !v || v.length <= 1000 || 'encryption-key:v8n_too_long',
|
|
60
61
|
];
|
|
61
62
|
}
|
|
63
|
+
get readonlySelector() {
|
|
64
|
+
const alwaysMatch = [];
|
|
65
|
+
if (this.data)
|
|
66
|
+
alwaysMatch.push('event-resource');
|
|
67
|
+
return new BooleanSelector(`${super.readonlySelector} ${alwaysMatch.join(' ')}`.trim());
|
|
68
|
+
}
|
|
62
69
|
renderBody() {
|
|
63
70
|
return html `
|
|
64
71
|
<foxy-internal-text-control infer="name"></foxy-internal-text-control>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookForm.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/WebhookForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAO;IAAtF;;QAaU,cAAS,GAAG;YAClB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAChC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACtC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;SACrC,CAAC;QAEM,qBAAgB,GAAG;YACzB,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,6BAA6B,EAAE;YAC/D,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,4BAA4B,EAAE;YAC7D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,EAAE;SACxD,CAAC;
|
|
1
|
+
{"version":3,"file":"WebhookForm.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/WebhookForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAO;IAAtF;;QAaU,cAAS,GAAG;YAClB,EAAE,KAAK,EAAE,MAAM,EAAE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C;IACJ,CAAC;IAcD,IAAI,gBAAgB;QAClB,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,IAAI,IAAI,CAAC,IAAI;YAAE,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClD,OAAO,IAAI,eAAe,CAAC,GAAG,KAAK,CAAC,gBAAgB,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAA;;;2EAG4D,IAAI,CAAC,gBAAgB;;;;;;mEAM7B,IAAI,CAAC,SAAS;;;;;;QAMzE,IAAI,CAAC,IAAI;YACT,CAAC,CAAC,IAAI,CAAA;;sBAEQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI;;;;;;;;sBAQpC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI;;;;;;WAM3C;YACH,CAAC,CAAC,EAAE;QACJ,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { html } from 'lit-html';\n\n/**\n * Form element for creating or editing webhooks (`fx:webhook`).\n *\n * @slot name:before\n * @slot name:after\n *\n * @slot event-resource:before\n * @slot event-resource:after\n *\n * @slot query:before\n * @slot query:after\n *\n * @slot url:before\n * @slot url:after\n *\n * @slot format:before\n * @slot format:after\n *\n * @slot encryption-key:before\n * @slot encryption-key:after\n *\n * @slot version:before\n * @slot version:after\n *\n * @slot statuses:before\n * @slot statuses:after\n *\n * @slot logs:before\n * @slot logs:after\n *\n * @element foxy-webhook-form\n * @since 1.17.0\n */\nexport class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')<Data> {\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (!!v && v.length <= 255) || 'name:v8n_too_long',\n ({ version: v }) => !!v || 'version:v8n_required',\n ({ format: v }) => !!v || 'format:v8n_required',\n ({ url: v }) => !v || v.length <= 1000 || 'url:v8n_too_long',\n ({ query: v }) => !v || v.length <= 1000 || 'query:v8n_too_long',\n ({ encryption_key: v }) => !v || v.length <= 1000 || 'encryption-key:v8n_too_long',\n ];\n }\n\n private __formats = [\n { value: 'json', label: 'JSON' },\n { value: 'webflow', label: 'Webflow' },\n { value: 'zapier', label: 'Zapier' },\n ];\n\n private __eventResources = [\n { value: 'subscription', label: 'event_resource_subscription' },\n { value: 'transaction', label: 'event_resource_transaction' },\n { value: 'customer', label: 'event_resource_customer' },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch: string[] = [];\n if (this.data) alwaysMatch.push('event-resource');\n return new BooleanSelector(`${super.readonlySelector} ${alwaysMatch.join(' ')}`.trim());\n }\n\n renderBody(): TemplateResult {\n return html`\n <foxy-internal-text-control infer=\"name\"></foxy-internal-text-control>\n\n <foxy-internal-radio-group-control infer=\"event-resource\" .options=${this.__eventResources}>\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control infer=\"query\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"url\"></foxy-internal-text-control>\n\n <foxy-internal-radio-group-control infer=\"format\" .options=${this.__formats}>\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control infer=\"encryption-key\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"version\"></foxy-internal-text-control>\n\n ${this.data\n ? html`\n <foxy-internal-async-details-control\n first=${this.data._links['fx:statuses'].href}\n infer=\"statuses\"\n limit=\"10\"\n item=\"foxy-webhook-status-card\"\n >\n </foxy-internal-async-details-control>\n\n <foxy-internal-async-details-control\n first=${this.data._links['fx:logs'].href}\n infer=\"logs\"\n limit=\"5\"\n item=\"foxy-webhook-log-card\"\n >\n </foxy-internal-async-details-control>\n `\n : ''}\n ${super.renderBody()}\n `;\n }\n}\n"]}
|