@foxy.io/elements 1.46.1-beta.1 → 1.47.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import"./shared-adbdfff2.js";import{I as e}from"./shared-c9061102.js";import"./shared-56226850.js";import"./shared-360196ad.js";import{a as t}from"./shared-ecbd0750.js";import"./shared-3d353eb8.js";import{_ as a,B as r,aT as i,aU as s}from"./shared-8f9014ff.js";import{N as l}from"./shared-fd8b44e3.js";import{i as o}from"./shared-53e42a77.js";import{h as n,c as d,s as c}from"./shared-ba5c42c7.js";import{a as m}from"./shared-47f3f5f5.js";import{a as h,g as f}from"./shared-37bdd118.js";import{c as v}from"./shared-4e709717.js";import"./shared-1c985317.js";import"./shared-58add5b4.js";import"./shared-69c98b7b.js";import"./shared-41c9c53f.js";import"./shared-930e68b7.js";import"./foxy-copy-to-clipboard.js";import"./shared-34a87829.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-6bf89411.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-bf8d95b9.js";import"./shared-b2cbe727.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-b3fe8c63.js";import"./shared-e55c8dc4.js";import"./shared-27c16d99.js";import"./shared-0e25ac65.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-791b4510.js";import"./shared-9496e995.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-0e19bda5.js";let u,p=e=>e;customElements.define("foxy-internal-user-invitation-form-async-action",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return a(a({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return n(u||(u=p` <vaadin-button theme="${0}" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),o(null!=t?t:void 0),"busy"===e||this.disabled,this.__submit,e)}async __submit(){var e,t;if("busy"!==this.__state)try{this.__state="busy";const a=new l.API(this);(await a.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"})).ok?(null===(t=this.nucleon)||void 0===t||t.refresh(),this.__state="idle"):this.__state="fail"}catch(e){this.__state="fail"}}});let y,x,g,_,b,Z,j,w,S,$,k,M,C,L,B=e=>e;const H=m(e,"user-invitation-form");class P extends H{constructor(){super(...arguments),this.getStorePageHref=null,this.defaultDomain=null,this.layout=null,this.__storeDomainGetValue=()=>{var e;const t=this.defaultDomain,a=null===(e=this.data)||void 0===e?void 0:e.store_domain;return(null==a?void 0:a.includes("."))||!t?a:`${a}.${t}`}}static get properties(){return a(a({},super.properties),{},{getStorePageHref:{attribute:!1},defaultDomain:{attribute:"default-domain"},layout:{}})}static get styles(){return[...super.styles,d(y||(y=B`.inner-curve{--r:var(--lumo-border-radius-l);--s:3rem;--a:12deg;--m:0/calc(2 * var(--r)) var(--r) no-repeat radial-gradient(50% 100% at bottom, #000 calc(100% - 1px), #0000);--d:(var(--s) + var(--r)) * cos(var(--a));border-radius:var(--r);width:100%;mask:calc(50% + var(--d)) var(--m),calc(50% - var(--d)) var(--m),radial-gradient(var(--s) at 50% calc(-1 * sin(var(--a)) * var(--s)),#0000 100%,#000 calc(100% + 1px)) 0 calc(var(--r) * (1 - sin(var(--a)))) no-repeat,linear-gradient(90deg,#000 calc(50% - var(--d)),#0000 0 calc(50% + var(--d)),#000 0)}`))]}static get v8n(){return[({email:e})=>!!e||"email:v8n_required"]}get readonlySelector(){const e=["store",super.readonlySelector.toString()];return new r(e.join(" ").trim())}get hiddenSelector(){var e,t;const a=["timestamps","submit","undo",super.hiddenSelector.toString()],i=null===(e=this.data)||void 0===e?void 0:e.status,s=null!==(t=this.layout)&&void 0!==t?t:"user";return"accepted"!==i&&"sent"!==i&&a.unshift("revoke"),"accepted"!==i&&a.unshift("leave"),"sent"!==i&&a.unshift("accept","reject"),"rejected"===i&&"user"===s||"expired"===i&&"admin"===s||"revoked"===i&&"admin"===s||a.unshift("delete"),"sent"===i&&"admin"===s||a.unshift("resend"),new r(a.join(" ").trim())}renderBody(){const{layout:e,data:t}=this;return"admin"===e?t?this.__renderAdminSnapshotState(t):this.__renderAdminTemplateState():t?this.__renderUserSnapshotState(t):this.__renderUserTemplateState()}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t;try{t=(await e.json())._embedded["fx:errors"][0].message}catch(t){throw e}throw t.includes("already been created for this email and store")?["error:invitation_exists"]:t.includes("already has access to this store")?["error:already_has_access"]:e}}__getGravatar(e){return i((function*(){yield n(x||(x=B` <div style="height:5rem;width:5rem;left:calc(50% - 2.5rem);top:-2.8rem" class="rounded-full absolute top-0 bg-contrast-5"></div> `)),e&&(yield n(g||(g=B` <img data-testid="gravatar" style="height:5rem;width:5rem;left:calc(50% - 2.5rem);top:-2.8rem" class="rounded-full absolute top-0 bg-contrast-5 shadow-xs" src="${0}" alt=""> `),yield s(f(e))))}))()}__renderAdminTemplateState(){return n(_||(_=B` ${0} <foxy-internal-text-control infer="email"></foxy-internal-text-control> ${0} `),this.renderHeader(),super.renderBody())}__renderUserTemplateState(){return n(b||(b=B` <div class="p-xl flex items-center justify-center"> <foxy-spinner layout="vertical" infer="unavailable" state="empty"></foxy-spinner> </div> `))}__renderAdminSnapshotState({first_name:e,last_name:t}){var a,r,i,s,l,d,m;const f=(null==e?void 0:e.trim())||(null==t?void 0:t.trim()),u={first_name:e,last_name:t,context:f?"":"empty"},p=null===(a=this.data)||void 0===a?void 0:a.status,y=this.hiddenSelector;return n(Z||(Z=B` <div style="padding-top:3.5rem"> <div class="relative"> <div class="inner-curve bg-contrast-5 absolute inset-0"></div> ${0} <div class="relative pb-m px-m leading-xs grid gap-m" style="padding-top:calc(2.5rem + var(--lumo-space-m))"> <div> <foxy-i18n class="block text-xl font-medium text-center" infer="" key="full_name" .options="${0}"> </foxy-i18n> <div class="text-m text-center text-secondary">${0}</div> </div> <div style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" class="${0}"> <p class="font-medium flex items-center gap-s"> ${0} <foxy-i18n infer="" key="admin_status_title" .options="${0}"> </foxy-i18n> </p> <p class="text-body" style="padding-left:calc((1.25 * var(--lumo-font-size-m)) + var(--lumo-space-s))"> <foxy-i18n infer="" key="admin_status_text" .options="${0}"> </foxy-i18n> </p> </div> <div class="flex gap-m" ?hidden="${0}"> <foxy-internal-user-invitation-form-async-action infer="revoke" class="flex-1" theme="error" href="${0}"> </foxy-internal-user-invitation-form-async-action> <foxy-internal-user-invitation-form-async-action infer="resend" class="flex-1" href="${0}"> </foxy-internal-user-invitation-form-async-action> <foxy-internal-delete-control infer="delete" class="flex-1"> </foxy-internal-delete-control> </div> </div> </div> </div> `),h(this.__getGravatar(null===(r=this.data)||void 0===r?void 0:r.email)),u,null===(i=this.data)||void 0===i?void 0:i.email,v({"border rounded":!0,"border-contrast text-contrast":"revoked"===p||"expired"===p,"border-success text-success":"accepted"===p,"border-primary text-primary":"sent"===p,"border-error text-error":"rejected"===p}),"revoked"===p?c(j||(j=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm3 10.5a.75.75 0 0 0 0-1.5H9a.75.75 0 0 0 0 1.5h6Z" clip-rule="evenodd" /></svg>`)):"sent"===p?c(w||(w=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z" clip-rule="evenodd" /></svg>`)):"rejected"===p?c(S||(S=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z" clip-rule="evenodd" /></svg>`)):"accepted"===p?c($||($=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z" clip-rule="evenodd" /></svg>`)):"expired"===p?c(k||(k=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path d="M3.375 3C2.339 3 1.5 3.84 1.5 4.875v.75c0 1.036.84 1.875 1.875 1.875h17.25c1.035 0 1.875-.84 1.875-1.875v-.75C22.5 3.839 21.66 3 20.625 3H3.375Z" /><path fill-rule="evenodd" d="m3.087 9 .54 9.176A3 3 0 0 0 6.62 21h10.757a3 3 0 0 0 2.995-2.824L20.913 9H3.087Zm6.133 2.845a.75.75 0 0 1 1.06 0l1.72 1.72 1.72-1.72a.75.75 0 1 1 1.06 1.06l-1.72 1.72 1.72 1.72a.75.75 0 1 1-1.06 1.06L12 15.685l-1.72 1.72a.75.75 0 1 1-1.06-1.06l1.72-1.72-1.72-1.72a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" /></svg>`)):"",{context:p},{context:p},y.matches("revoke",!0)&&y.matches("resend",!0)&&y.matches("delete",!0),o(null===(l=null===(s=this.data)||void 0===s?void 0:s._links["fx:revoke"])||void 0===l?void 0:l.href),o(null===(m=null===(d=this.data)||void 0===d?void 0:d._links["fx:resend"])||void 0===m?void 0:m.href))}__renderUserSnapshotState({status:e,store_name:t}){var r,i,s,l,d,m;const h=this.hiddenSelector,f={"text-primary":"sent"===e,"text-success":"accepted"===e,"text-error":"rejected"===e};return n(M||(M=B` <div class="${0}"> <div class="border-t flex-1"></div> ${0} <div class="border-t flex-1"></div> </div> <foxy-i18n infer="" class="${0}" key="user_status_title" .options="${0}"> </foxy-i18n> <foxy-internal-summary-control infer="store"> <foxy-internal-text-control layout="summary-item" infer="store-domain" .getValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="store-url"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="store-email"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> <foxy-i18n class="block text-secondary text-center" infer="" key="user_status_text" .options="${0}"> </foxy-i18n> <foxy-internal-user-invitation-form-async-action theme="error" class="flex-1" infer="leave" href="${0}"> </foxy-internal-user-invitation-form-async-action> <div class="grid grid-cols-2 gap-m" ?hidden="${0}"> <foxy-internal-user-invitation-form-async-action theme="error primary" infer="reject" href="${0}"> </foxy-internal-user-invitation-form-async-action> <foxy-internal-user-invitation-form-async-action theme="success primary" infer="accept" href="${0}"> </foxy-internal-user-invitation-form-async-action> </div> <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> `),v(a({"flex items-center gap-m":!0},f)),c(C||(C=B`<svg style="height: 5rem; width: 5rem" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 256 256"><path fill="currentColor" fill-rule="evenodd" d="M128 250c67.38 0 122-54.62 122-122S195.38 6 128 6 6 60.62 6 128s54.62 122 122 122Zm0 6c70.7 0 128-57.3 128-128S198.7 0 128 0 0 57.3 0 128s57.3 128 128 128Z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M128.5 218a89.5 89.5 0 1 0 0-179 89.5 89.5 0 0 0 0 179Zm23.8-46.25-5.13-3.08-54.48-32.91a3.6 3.6 0 0 1-1.69-3.12V78l5.07 3.02c1.06.6 1.78 1.8 1.78 3.15v46.4l52.75 31.87a3.63 3.63 0 0 1 1.72 3.17l-.01 6.14ZM166 180l-5.17-3.11a3.62 3.62 0 0 1-1.7-3.1v-46.47l-47.64-28.8v25.92l-.02 6.14-5.09-3.09a3.5 3.5 0 0 1-1.71-3.05V92.38a3.6 3.6 0 0 1 1.71-3.09 3.3 3.3 0 0 1 3.44.01l54.47 32.9a3.62 3.62 0 0 1 1.7 3.11v48.47L166 180Zm-46.1-44.34c.53.34 5.2 3.17 5.2 3.17s.04-4.24.04-6.22v-15.57c0-1.32-.68-2.48-1.7-3.1-.5-.31-5.14-3.06-5.14-3.06v21.73c0 1.29.64 2.41 1.6 3.05Zm18.86 11.42-5.17-3.14a3.62 3.62 0 0 1-1.66-3.08v-21.77l5.1 3.07a3.62 3.62 0 0 1 1.75 3.13v15.57l-.02 6.22Zm8.46 5.1 5.15 3.12v-21.78a3.6 3.6 0 0 0-1.8-3.16c-.48-.28-5.06-3.08-5.06-3.08v21.8c0 1.33.7 2.48 1.71 3.1Z" clip-rule="evenodd"/><path fill="currentColor" d="M132.57 222a2.96 2.96 0 0 1 2.96 2.96v15.86a3 3 0 0 1-3 3h-9.95a2.39 2.39 0 1 1 0-4.78h5.15a1.88 1.88 0 0 0 0-3.75h-4.22a2.39 2.39 0 1 1 0-4.77h3.1a3 3 0 0 0 3-3v-2.56a2.96 2.96 0 0 1 2.96-2.96Zm-37.07 6.3c.5-2.37 1.39-4.28 2.66-5.71a9.51 9.51 0 0 1 4.52-2.9c1.75-.5 3.59-.55 5.52-.14a11.1 11.1 0 0 1 5 2.38 9.6 9.6 0 0 1 2.95 4.5c.57 1.83.6 3.93.1 6.29a12.33 12.33 0 0 1-2.65 5.7 9.44 9.44 0 0 1-4.52 2.91c-1.75.51-3.6.56-5.54.14a11.2 11.2 0 0 1-4.98-2.37 9.42 9.42 0 0 1-2.96-4.5 12.25 12.25 0 0 1-.1-6.3Zm5.95 1.27a9.13 9.13 0 0 0-.17 3.34c.14.95.5 1.73 1.06 2.32.56.6 1.31 1 2.27 1.2.96.2 1.82.15 2.58-.17a4.27 4.27 0 0 0 1.91-1.69 9.2 9.2 0 0 0 1.19-3.12c.27-1.28.33-2.4.19-3.35a4.33 4.33 0 0 0-1.07-2.31 4.28 4.28 0 0 0-2.28-1.2 4.24 4.24 0 0 0-2.56.17c-.76.31-1.4.88-1.92 1.68a9.23 9.23 0 0 0-1.2 3.13Zm-15.5 6.41a2.84 2.84 0 0 1-1.67-2.33l-.52-5.52c0-.05-.04-.1-.09-.12a.14.14 0 0 0-.15.02l-4.5 3.3a2.82 2.82 0 1 1-3.29-4.57l4.84-3.4a3 3 0 0 0 1.24-2.87l-.8-5.83a2.85 2.85 0 1 1 5.65-.68l.58 5.7c0 .05.04.1.09.12.05.02.1.01.14-.02l4.63-3.38a2.85 2.85 0 1 1 3.29 4.64l-4.87 3.34a3 3 0 0 0-1.28 2.83l.69 5.84a2.84 2.84 0 0 1-3.98 2.93Zm-16.33-12.59a2.87 2.87 0 1 1-5.67-.91l1.42-7.81a.14.14 0 0 0-.2-.15l-6.99 3.77a2.87 2.87 0 1 1-2.61-5.11l10.27-4.98a3 3 0 0 0 1.12-.94l1.86-2.56a2.94 2.94 0 1 1 4.76 3.46l-1.86 2.56a3 3 0 0 0-.55 1.36l-1.55 11.3Zm-11.39-33.1a2.93 2.93 0 0 1-.22 4.21c-.6.55-1.3.8-2.12.75a2.93 2.93 0 0 1-2.06-1 2.89 2.89 0 0 1-.74-2.11 2.8 2.8 0 0 1 2.35-2.76 3.2 3.2 0 0 1 1.52.09c.5.16.92.43 1.27.82ZM34.2 187.3a2.39 2.39 0 1 1-4.14 2.39l-4.37-7.57a2.39 2.39 0 1 1 4.13-2.38l4.37 7.56Zm14.75-8.52a2.39 2.39 0 0 1-4.13 2.38l-4.37-7.56a2.39 2.39 0 1 1 4.13-2.39l4.37 7.57Zm-21.08 7.13a2.96 2.96 0 0 1 1.09-4.05l13.76-7.95a2.96 2.96 0 0 1 2.96 5.13L31.92 187a2.96 2.96 0 0 1-4.05-1.09Zm-2.9-36.06c2.3-.75 4.4-.94 6.28-.56a9.51 9.51 0 0 1 4.78 2.47 11.27 11.27 0 0 1 2.88 4.71c.61 1.9.76 3.74.44 5.53a9.6 9.6 0 0 1-2.43 4.8c-1.3 1.4-3.1 2.48-5.4 3.23-2.3.75-4.4.94-6.26.56a9.44 9.44 0 0 1-4.78-2.46 11.24 11.24 0 0 1-2.9-4.73 11.2 11.2 0 0 1-.43-5.5 9.42 9.42 0 0 1 2.42-4.81 12.26 12.26 0 0 1 5.4-3.24Zm1.88 5.8c-1.24.4-2.23.9-2.98 1.5a4.2 4.2 0 0 0-1.47 2.09 4.2 4.2 0 0 0 .1 2.57c.3.93.77 1.64 1.43 2.14.64.5 1.45.77 2.41.82.96.05 2.06-.13 3.3-.54 1.25-.4 2.24-.9 3-1.5a4.34 4.34 0 0 0 1.47-2.09 4.3 4.3 0 0 0-.1-2.57 4.24 4.24 0 0 0-1.43-2.14 4.24 4.24 0 0 0-2.42-.82 9.24 9.24 0 0 0-3.3.53Zm3.91-38.41a4.55 4.55 0 0 1-.87 2.28 4.9 4.9 0 0 1-1.87 1.52c-.75.34-1.55.46-2.4.37a4.52 4.52 0 0 1-2.28-.87 4.81 4.81 0 0 1-1.9-4.28 4.72 4.72 0 0 1 5.15-4.17 4.8 4.8 0 0 1 3.8 2.74c.34.75.46 1.55.37 2.41ZM44.58 84.8a2.96 2.96 0 0 1-4.05 1.09L26.8 77.96a3 3 0 0 1-1.1-4.1l4.98-8.62a2.39 2.39 0 1 1 4.13 2.39l-2.58 4.46a1.88 1.88 0 0 0 3.25 1.88l2.1-3.66a2.39 2.39 0 1 1 4.14 2.39l-1.54 2.68a3 3 0 0 0 1.1 4.1l2.21 1.28a2.96 2.96 0 0 1 1.09 4.04Zm13.07-35.26a12.31 12.31 0 0 1 3.62 5.17c.6 1.81.69 3.6.25 5.37a11.27 11.27 0 0 1-2.64 4.85 11.24 11.24 0 0 1-4.56 3.14c-1.72.6-3.5.7-5.37.3a12.34 12.34 0 0 1-5.5-3.06 12.33 12.33 0 0 1-3.62-5.15 9.46 9.46 0 0 1-.25-5.36c.43-1.77 1.31-3.4 2.64-4.87a11.2 11.2 0 0 1 4.56-3.13 9.4 9.4 0 0 1 5.37-.31c1.86.4 3.7 1.43 5.5 3.05Zm-4.07 4.53a9.15 9.15 0 0 0-2.8-1.82 4.18 4.18 0 0 0-2.55-.24 4.2 4.2 0 0 0-2.17 1.37 4.24 4.24 0 0 0-1.14 2.31c-.1.8.06 1.64.5 2.5a9.33 9.33 0 0 0 2.11 2.6c.97.87 1.9 1.48 2.8 1.83.9.34 1.75.42 2.54.24a4.3 4.3 0 0 0 2.18-1.38 4.24 4.24 0 0 0 1.14-2.3c.1-.82-.06-1.65-.5-2.5a9.24 9.24 0 0 0-2.11-2.61Zm2.2-16.63c.83-.6 1.92-.7 2.85-.28l5.04 2.3a.15.15 0 0 0 .2-.15l-.6-5.55a2.82 2.82 0 1 1 5.6-.56l.53 5.89a3 3 0 0 0 1.86 2.5l5.45 2.23a2.85 2.85 0 1 1-2.24 5.24l-5.22-2.35a.15.15 0 0 0-.2.15l.61 5.7a2.85 2.85 0 1 1-5.66.52l-.46-5.88a3 3 0 0 0-1.8-2.52l-5.42-2.33a2.84 2.84 0 0 1-.54-4.9Zm19.07-7.84a2.87 2.87 0 1 1 3.62-4.47l6.06 5.14a.14.14 0 0 0 .22-.1l.23-7.93a2.87 2.87 0 1 1 5.74.29l-.83 11.38a3 3 0 0 0 .25 1.44l1.29 2.9a2.94 2.94 0 1 1-5.37 2.39l-1.3-2.9a3 3 0 0 0-.9-1.14l-9.01-7Zm34.35 6.68a2.93 2.93 0 0 1-3.53-2.3 2.78 2.78 0 0 1 .41-2.2 2.93 2.93 0 0 1 1.9-1.3 2.9 2.9 0 0 1 2.2.42 2.8 2.8 0 0 1 1.21 3.41c-.18.5-.46.93-.84 1.28-.38.35-.83.58-1.34.7Zm14.61-19.33a2.39 2.39 0 0 1 0-4.77h8.74a2.39 2.39 0 0 1 0 4.77h-8.74Zm0 17.05a2.39 2.39 0 0 1 0-4.77h8.74a2.39 2.39 0 0 1 0 4.77h-8.74Zm4.37-21.82a2.96 2.96 0 0 1 2.97 2.96v15.9a2.96 2.96 0 0 1-5.93 0v-15.9a2.96 2.96 0 0 1 2.96-2.96Zm32.68 15.52a12.24 12.24 0 0 1-2.66 5.71 9.5 9.5 0 0 1-4.53 2.9c-1.74.5-3.58.55-5.52.14a11.24 11.24 0 0 1-5-2.38 9.6 9.6 0 0 1-2.94-4.5 12.4 12.4 0 0 1-.1-6.29c.5-2.37 1.38-4.28 2.65-5.7a9.44 9.44 0 0 1 4.51-2.91c1.75-.51 3.6-.56 5.54-.14 1.94.4 3.6 1.2 4.99 2.37a9.42 9.42 0 0 1 2.95 4.5c.58 1.82.62 3.92.11 6.3Zm-5.96-1.27c.27-1.28.33-2.4.18-3.34a4.18 4.18 0 0 0-1.07-2.32 4.2 4.2 0 0 0-2.27-1.2 4.24 4.24 0 0 0-2.57.17c-.75.31-1.39.88-1.92 1.69a9.2 9.2 0 0 0-1.18 3.12 9.4 9.4 0 0 0-.2 3.35 4.4 4.4 0 0 0 1.07 2.31c.57.6 1.33 1 2.29 1.2.96.2 1.8.15 2.56-.17.75-.31 1.4-.88 1.91-1.68.53-.81.93-1.85 1.2-3.13Zm31.3 22.59a4.54 4.54 0 0 1-1.53-1.9 4.9 4.9 0 0 1-.38-2.38 4.5 4.5 0 0 1 .88-2.27c.5-.7 1.14-1.21 1.89-1.54a4.81 4.81 0 0 1 4.65.5 4.72 4.72 0 0 1 1.04 6.55 4.8 4.8 0 0 1-4.27 1.91 4.51 4.51 0 0 1-2.28-.87Zm21.19 28.18a2.96 2.96 0 0 1 1.08-4.05l13.73-7.93a3 3 0 0 1 4.1 1.1l4.98 8.62a2.39 2.39 0 0 1-4.13 2.39l-2.58-4.47a1.87 1.87 0 1 0-3.25 1.88l2.11 3.65a2.39 2.39 0 1 1-4.13 2.39l-1.55-2.68a3 3 0 0 0-4.1-1.1l-2.22 1.28a2.96 2.96 0 0 1-4.04-1.08Zm24 28.95c-2.31.75-4.4.94-6.29.56a9.5 9.5 0 0 1-4.78-2.47 11.26 11.26 0 0 1-2.87-4.71c-.61-1.9-.76-3.74-.44-5.53a9.6 9.6 0 0 1 2.43-4.8 12.5 12.5 0 0 1 5.39-3.23c2.31-.75 4.4-.94 6.27-.56a9.44 9.44 0 0 1 4.78 2.46 11.23 11.23 0 0 1 2.89 4.73c.6 1.88.75 3.71.43 5.5a9.43 9.43 0 0 1-2.41 4.81 12.26 12.26 0 0 1-5.4 3.24Zm-1.89-5.8c1.25-.4 2.24-.9 2.98-1.5a4.17 4.17 0 0 0 1.48-2.09 4.2 4.2 0 0 0-.1-2.57 4.25 4.25 0 0 0-1.43-2.14 4.27 4.27 0 0 0-2.42-.82 9.32 9.32 0 0 0-3.3.54c-1.24.4-2.24.9-2.99 1.5a4.34 4.34 0 0 0-1.47 2.09 4.3 4.3 0 0 0 .1 2.57c.3.93.78 1.65 1.43 2.14.65.5 1.46.77 2.41.82.97.05 2.07-.13 3.31-.53Zm13.3 10.23a2.84 2.84 0 0 1-1.18 2.61l-4.52 3.21a.15.15 0 0 0-.06.14c.01.05.04.1.1.12l5.1 2.24a2.82 2.82 0 1 1-2.31 5.14l-5.37-2.48a3 3 0 0 0-3.1.35l-4.65 3.61a2.85 2.85 0 1 1-3.41-4.56l4.64-3.35a.15.15 0 0 0 .06-.13c0-.06-.04-.1-.08-.12l-5.25-2.31a2.84 2.84 0 1 1 2.38-5.17l5.32 2.54a3 3 0 0 0 3.1-.3l4.71-3.52a2.84 2.84 0 0 1 4.52 1.98Zm-2.74 20.44a2.87 2.87 0 1 1 2.06 5.36l-7.48 2.68a.13.13 0 0 0-.1.11c0 .06.03.1.07.13l6.76 4.17a2.87 2.87 0 1 1-3.12 4.83l-9.45-6.42a3 3 0 0 0-1.37-.5l-3.15-.33a2.94 2.94 0 0 1 .62-5.85l3.14.33a3 3 0 0 0 1.45-.2l10.57-4.31Zm-22.96 26.41a2.93 2.93 0 0 1 3.75-1.92 2.8 2.8 0 0 1 1.71 1.47c.37.74.42 1.5.17 2.28-.24.74-.73 1.3-1.46 1.7a2.8 2.8 0 0 1-3.56-.66c-.34-.4-.57-.85-.7-1.36-.1-.5-.08-1.01.09-1.51Zm9.43 22.32a2.39 2.39 0 1 1 4.13 2.38l-4.37 7.57a2.39 2.39 0 1 1-4.13-2.39l4.37-7.56Zm-14.77-8.53a2.39 2.39 0 1 1 4.14 2.39l-4.37 7.56a2.39 2.39 0 0 1-4.13-2.38l4.36-7.57Zm16.72 14.7a2.96 2.96 0 0 1-4.05 1.08l-13.76-7.95a2.96 2.96 0 1 1 2.96-5.13l13.76 7.95a2.96 2.96 0 0 1 1.09 4.04Zm-29.78 20.54a12.3 12.3 0 0 1-3.62-5.17 9.5 9.5 0 0 1-.25-5.37 11.27 11.27 0 0 1 2.64-4.85 11.25 11.25 0 0 1 4.57-3.14 9.6 9.6 0 0 1 5.37-.3c1.87.43 3.7 1.44 5.5 3.06a12.33 12.33 0 0 1 3.61 5.15c.61 1.82.7 3.6.26 5.36a11.24 11.24 0 0 1-2.65 4.87 11.2 11.2 0 0 1-4.55 3.13 9.4 9.4 0 0 1-5.37.31 12.26 12.26 0 0 1-5.5-3.05Zm4.08-4.53c.97.88 1.9 1.48 2.8 1.82.9.35 1.75.43 2.54.24a4.2 4.2 0 0 0 2.18-1.37 4.24 4.24 0 0 0 1.14-2.31c.1-.8-.07-1.64-.5-2.5a9.33 9.33 0 0 0-2.12-2.6 9.4 9.4 0 0 0-2.8-1.83 4.34 4.34 0 0 0-2.54-.24c-.8.2-1.52.66-2.17 1.39a4.24 4.24 0 0 0-1.14 2.3c-.1.81.06 1.64.5 2.5a9.21 9.21 0 0 0 2.11 2.6Zm-35.21 15.81a4.54 4.54 0 0 1 2.4-.38c.83.1 1.58.39 2.25.86a4.55 4.55 0 0 1 1.54 1.9c.35.79.48 1.6.38 2.4a4.81 4.81 0 0 1-2.76 3.79 4.73 4.73 0 0 1-6.19-2.38 4.81 4.81 0 0 1 .48-4.66 4.51 4.51 0 0 1 1.9-1.53Z"/></svg>`)),v(a({"block text-center text-xl font-medium":!0},f)),{context:e,store_name:t},this.__storeDomainGetValue,"accepted"===e&&this.getStorePageHref&&this.data?n(L||(L=B` <div ?hidden="${0}"> <a class="text-primary font-medium cursor-pointer rounded transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="store_link"></foxy-i18n> </a> </div> `),"accepted"!==e||!this.getStorePageHref,this.getStorePageHref(this.data._links["fx:store"].href)):"",{context:e,store_name:t},o(null===(i=null===(r=this.data)||void 0===r?void 0:r._links["fx:revoke"])||void 0===i?void 0:i.href),h.matches("reject",!0)&&h.matches("accept",!0),o(null===(l=null===(s=this.data)||void 0===s?void 0:s._links["fx:reject"])||void 0===l?void 0:l.href),o(null===(m=null===(d=this.data)||void 0===d?void 0:d._links["fx:accept"])||void 0===m?void 0:m.href))}}customElements.define("foxy-user-invitation-form",P);export{P as UserInvitationForm};
1
+ import"./shared-adbdfff2.js";import{I as e}from"./shared-c9061102.js";import"./shared-56226850.js";import"./shared-360196ad.js";import{a as t}from"./shared-ecbd0750.js";import"./shared-3d353eb8.js";import{_ as a,B as r,aT as i,aU as s}from"./shared-8f9014ff.js";import{N as l}from"./shared-fd8b44e3.js";import{i as o}from"./shared-53e42a77.js";import{h as n,c as d,s as c}from"./shared-ba5c42c7.js";import{a as m}from"./shared-47f3f5f5.js";import{a as f,g as h}from"./shared-37bdd118.js";import{c as v}from"./shared-4e709717.js";import"./shared-1c985317.js";import"./shared-58add5b4.js";import"./shared-69c98b7b.js";import"./shared-41c9c53f.js";import"./shared-930e68b7.js";import"./foxy-copy-to-clipboard.js";import"./shared-34a87829.js";import"./shared-5a469962.js";import"./shared-66278c21.js";import"./shared-6bf89411.js";import"./shared-d4b77609.js";import"./shared-eb49be2e.js";import"./shared-bf8d95b9.js";import"./shared-b2cbe727.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-b3fe8c63.js";import"./shared-e55c8dc4.js";import"./shared-27c16d99.js";import"./shared-0e25ac65.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-791b4510.js";import"./shared-9496e995.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-0e19bda5.js";let u,p=e=>e;customElements.define("foxy-internal-user-invitation-form-async-action",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return a(a({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return n(u||(u=p` <vaadin-button theme="${0}" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),o(null!=t?t:void 0),"busy"===e||this.disabled,this.__submit,e)}async __submit(){var e,t;if("busy"!==this.__state)try{this.__state="busy";const a=new l.API(this);(await a.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"})).ok?(null===(t=this.nucleon)||void 0===t||t.refresh(),this.__state="idle"):this.__state="fail"}catch(e){this.__state="fail"}}});let y,x,g,_,b,Z,j,w,S,$,k,M,C,L,B=e=>e;const H=m(e,"user-invitation-form");class P extends H{constructor(){super(...arguments),this.getStorePageHref=null,this.defaultDomain=null,this.layout=null,this.__storeDomainGetValue=()=>{var e;const t=this.defaultDomain,a=null===(e=this.data)||void 0===e?void 0:e.store_domain;return(null==a?void 0:a.includes("."))||!t?a:`${a}.${t}`}}static get properties(){return a(a({},super.properties),{},{getStorePageHref:{attribute:!1},defaultDomain:{attribute:"default-domain"},layout:{}})}static get styles(){return[...super.styles,d(y||(y=B`.inner-curve{--r:var(--lumo-border-radius-l);--s:3rem;--a:12deg;--m:0/calc(2 * var(--r)) var(--r) no-repeat radial-gradient(50% 100% at bottom, #000 calc(100% - 1px), #0000);--d:(var(--s) + var(--r)) * cos(var(--a));border-radius:var(--r);width:100%;mask:calc(50% + var(--d)) var(--m),calc(50% - var(--d)) var(--m),radial-gradient(var(--s) at 50% calc(-1 * sin(var(--a)) * var(--s)),#0000 100%,#000 calc(100% + 1px)) 0 calc(var(--r) * (1 - sin(var(--a)))) no-repeat,linear-gradient(90deg,#000 calc(50% - var(--d)),#0000 0 calc(50% + var(--d)),#000 0)}`))]}static get v8n(){return[({email:e})=>!!e||"email:v8n_required"]}get readonlySelector(){const e=["store",super.readonlySelector.toString()];return new r(e.join(" ").trim())}get hiddenSelector(){var e,t;const a=["timestamps","submit","undo",super.hiddenSelector.toString()],i=null===(e=this.data)||void 0===e?void 0:e.status,s=null!==(t=this.layout)&&void 0!==t?t:"user";return"accepted"!==i&&"sent"!==i&&a.unshift("revoke"),"accepted"!==i&&a.unshift("leave"),"sent"!==i&&a.unshift("accept","reject"),"rejected"===i&&"user"===s||"expired"===i&&"admin"===s||"revoked"===i&&"admin"===s||a.unshift("delete"),"sent"===i&&"admin"===s||a.unshift("resend"),new r(a.join(" ").trim())}renderBody(){const{layout:e,data:t}=this;return"admin"===e?t?this.__renderAdminSnapshotState(t):this.__renderAdminTemplateState():t?this.__renderUserSnapshotState(t):this.__renderUserTemplateState()}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t;try{t=(await e.json())._embedded["fx:errors"][0].message}catch(t){throw e}throw t.includes("already been created for this email and store")?["error:invitation_exists"]:t.includes("already has access to this store")?["error:already_has_access"]:e}}__getGravatar(e){return i((function*(){yield n(x||(x=B` <div style="height:5rem;width:5rem;left:calc(50% - 2.5rem);top:-2.8rem" class="rounded-full absolute top-0 bg-contrast-5"></div> `)),e&&(yield n(g||(g=B` <img data-testid="gravatar" style="height:5rem;width:5rem;left:calc(50% - 2.5rem);top:-2.8rem" class="rounded-full absolute top-0 bg-contrast-5 shadow-xs" src="${0}" alt=""> `),yield s(h(e))))}))()}__renderAdminTemplateState(){return n(_||(_=B` ${0} <foxy-internal-text-control infer="email"></foxy-internal-text-control> ${0} `),this.renderHeader(),super.renderBody())}__renderUserTemplateState(){return n(b||(b=B` <div class="p-xl flex items-center justify-center"> <foxy-spinner layout="vertical" infer="unavailable" state="empty"></foxy-spinner> </div> `))}__renderAdminSnapshotState({first_name:e,last_name:t}){var a,r,i,s,l,d,m;const h=(null==e?void 0:e.trim())||(null==t?void 0:t.trim()),u={first_name:e,last_name:t,context:h?"":"empty"},p=null===(a=this.data)||void 0===a?void 0:a.status,y=this.hiddenSelector;return n(Z||(Z=B` <div style="padding-top:3.5rem"> <div class="relative"> <div class="inner-curve bg-contrast-5 absolute inset-0"></div> ${0} <div class="relative pb-m px-m leading-xs grid gap-m" style="padding-top:calc(2.5rem + var(--lumo-space-m))"> <div> <foxy-i18n class="block text-xl font-medium text-center" infer="" key="full_name" .options="${0}"> </foxy-i18n> <div class="text-m text-center text-secondary">${0}</div> </div> <div style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" class="${0}"> <p class="font-medium flex items-center gap-s"> ${0} <foxy-i18n infer="" key="admin_status_title" .options="${0}"> </foxy-i18n> </p> <p class="text-body" style="padding-left:calc((1.25 * var(--lumo-font-size-m)) + var(--lumo-space-s))"> <foxy-i18n infer="" key="admin_status_text" .options="${0}"> </foxy-i18n> </p> </div> <div class="flex gap-m" ?hidden="${0}"> <foxy-internal-user-invitation-form-async-action infer="revoke" class="flex-1" theme="error" href="${0}"> </foxy-internal-user-invitation-form-async-action> <foxy-internal-user-invitation-form-async-action infer="resend" class="flex-1" href="${0}"> </foxy-internal-user-invitation-form-async-action> <foxy-internal-delete-control infer="delete" class="flex-1"> </foxy-internal-delete-control> </div> </div> </div> </div> `),f(this.__getGravatar(null===(r=this.data)||void 0===r?void 0:r.email)),u,null===(i=this.data)||void 0===i?void 0:i.email,v({"border rounded":!0,"border-contrast text-contrast":"revoked"===p||"expired"===p,"border-success text-success":"accepted"===p,"border-primary text-primary":"sent"===p,"border-error text-error":"rejected"===p}),"revoked"===p?c(j||(j=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm3 10.5a.75.75 0 0 0 0-1.5H9a.75.75 0 0 0 0 1.5h6Z" clip-rule="evenodd" /></svg>`)):"sent"===p?c(w||(w=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z" clip-rule="evenodd" /></svg>`)):"rejected"===p?c(S||(S=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z" clip-rule="evenodd" /></svg>`)):"accepted"===p?c($||($=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z" clip-rule="evenodd" /></svg>`)):"expired"===p?c(k||(k=B`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 1.25em; height: 1.25em"><path d="M3.375 3C2.339 3 1.5 3.84 1.5 4.875v.75c0 1.036.84 1.875 1.875 1.875h17.25c1.035 0 1.875-.84 1.875-1.875v-.75C22.5 3.839 21.66 3 20.625 3H3.375Z" /><path fill-rule="evenodd" d="m3.087 9 .54 9.176A3 3 0 0 0 6.62 21h10.757a3 3 0 0 0 2.995-2.824L20.913 9H3.087Zm6.133 2.845a.75.75 0 0 1 1.06 0l1.72 1.72 1.72-1.72a.75.75 0 1 1 1.06 1.06l-1.72 1.72 1.72 1.72a.75.75 0 1 1-1.06 1.06L12 15.685l-1.72 1.72a.75.75 0 1 1-1.06-1.06l1.72-1.72-1.72-1.72a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" /></svg>`)):"",{context:p},{context:p},y.matches("revoke",!0)&&y.matches("resend",!0)&&y.matches("delete",!0),o(null===(l=null===(s=this.data)||void 0===s?void 0:s._links["fx:revoke"])||void 0===l?void 0:l.href),o(null===(m=null===(d=this.data)||void 0===d?void 0:d._links["fx:resend"])||void 0===m?void 0:m.href))}__renderUserSnapshotState({status:e,store_name:t}){var r,i,s,l,d,m,f,h;const u=null===(r=this.data)||void 0===r?void 0:r._links,p=this.hiddenSelector,y={"text-primary":"sent"===e,"text-success":"accepted"===e,"text-error":"rejected"===e};return n(M||(M=B` <div class="${0}"> <div class="border-t flex-1"></div> ${0} <div class="border-t flex-1"></div> </div> <foxy-i18n infer="" class="${0}" key="user_status_title" .options="${0}"> </foxy-i18n> <foxy-internal-summary-control infer="store"> <foxy-internal-text-control layout="summary-item" infer="store-domain" .getValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="store-url"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="store-email"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> <foxy-i18n class="block text-secondary text-center" infer="" key="user_status_text" .options="${0}"> </foxy-i18n> <foxy-internal-user-invitation-form-async-action theme="error" class="flex-1" infer="leave" href="${0}"> </foxy-internal-user-invitation-form-async-action> <div class="grid grid-cols-2 gap-m" ?hidden="${0}"> <foxy-internal-user-invitation-form-async-action theme="error primary" infer="reject" href="${0}"> </foxy-internal-user-invitation-form-async-action> <foxy-internal-user-invitation-form-async-action theme="success primary" infer="accept" href="${0}"> </foxy-internal-user-invitation-form-async-action> </div> <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> `),v(a({"flex items-center gap-m":!0},y)),c(C||(C=B`<svg style="height: 5rem; width: 5rem" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 256 256"><path fill="currentColor" fill-rule="evenodd" d="M128 250c67.38 0 122-54.62 122-122S195.38 6 128 6 6 60.62 6 128s54.62 122 122 122Zm0 6c70.7 0 128-57.3 128-128S198.7 0 128 0 0 57.3 0 128s57.3 128 128 128Z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M128.5 218a89.5 89.5 0 1 0 0-179 89.5 89.5 0 0 0 0 179Zm23.8-46.25-5.13-3.08-54.48-32.91a3.6 3.6 0 0 1-1.69-3.12V78l5.07 3.02c1.06.6 1.78 1.8 1.78 3.15v46.4l52.75 31.87a3.63 3.63 0 0 1 1.72 3.17l-.01 6.14ZM166 180l-5.17-3.11a3.62 3.62 0 0 1-1.7-3.1v-46.47l-47.64-28.8v25.92l-.02 6.14-5.09-3.09a3.5 3.5 0 0 1-1.71-3.05V92.38a3.6 3.6 0 0 1 1.71-3.09 3.3 3.3 0 0 1 3.44.01l54.47 32.9a3.62 3.62 0 0 1 1.7 3.11v48.47L166 180Zm-46.1-44.34c.53.34 5.2 3.17 5.2 3.17s.04-4.24.04-6.22v-15.57c0-1.32-.68-2.48-1.7-3.1-.5-.31-5.14-3.06-5.14-3.06v21.73c0 1.29.64 2.41 1.6 3.05Zm18.86 11.42-5.17-3.14a3.62 3.62 0 0 1-1.66-3.08v-21.77l5.1 3.07a3.62 3.62 0 0 1 1.75 3.13v15.57l-.02 6.22Zm8.46 5.1 5.15 3.12v-21.78a3.6 3.6 0 0 0-1.8-3.16c-.48-.28-5.06-3.08-5.06-3.08v21.8c0 1.33.7 2.48 1.71 3.1Z" clip-rule="evenodd"/><path fill="currentColor" d="M132.57 222a2.96 2.96 0 0 1 2.96 2.96v15.86a3 3 0 0 1-3 3h-9.95a2.39 2.39 0 1 1 0-4.78h5.15a1.88 1.88 0 0 0 0-3.75h-4.22a2.39 2.39 0 1 1 0-4.77h3.1a3 3 0 0 0 3-3v-2.56a2.96 2.96 0 0 1 2.96-2.96Zm-37.07 6.3c.5-2.37 1.39-4.28 2.66-5.71a9.51 9.51 0 0 1 4.52-2.9c1.75-.5 3.59-.55 5.52-.14a11.1 11.1 0 0 1 5 2.38 9.6 9.6 0 0 1 2.95 4.5c.57 1.83.6 3.93.1 6.29a12.33 12.33 0 0 1-2.65 5.7 9.44 9.44 0 0 1-4.52 2.91c-1.75.51-3.6.56-5.54.14a11.2 11.2 0 0 1-4.98-2.37 9.42 9.42 0 0 1-2.96-4.5 12.25 12.25 0 0 1-.1-6.3Zm5.95 1.27a9.13 9.13 0 0 0-.17 3.34c.14.95.5 1.73 1.06 2.32.56.6 1.31 1 2.27 1.2.96.2 1.82.15 2.58-.17a4.27 4.27 0 0 0 1.91-1.69 9.2 9.2 0 0 0 1.19-3.12c.27-1.28.33-2.4.19-3.35a4.33 4.33 0 0 0-1.07-2.31 4.28 4.28 0 0 0-2.28-1.2 4.24 4.24 0 0 0-2.56.17c-.76.31-1.4.88-1.92 1.68a9.23 9.23 0 0 0-1.2 3.13Zm-15.5 6.41a2.84 2.84 0 0 1-1.67-2.33l-.52-5.52c0-.05-.04-.1-.09-.12a.14.14 0 0 0-.15.02l-4.5 3.3a2.82 2.82 0 1 1-3.29-4.57l4.84-3.4a3 3 0 0 0 1.24-2.87l-.8-5.83a2.85 2.85 0 1 1 5.65-.68l.58 5.7c0 .05.04.1.09.12.05.02.1.01.14-.02l4.63-3.38a2.85 2.85 0 1 1 3.29 4.64l-4.87 3.34a3 3 0 0 0-1.28 2.83l.69 5.84a2.84 2.84 0 0 1-3.98 2.93Zm-16.33-12.59a2.87 2.87 0 1 1-5.67-.91l1.42-7.81a.14.14 0 0 0-.2-.15l-6.99 3.77a2.87 2.87 0 1 1-2.61-5.11l10.27-4.98a3 3 0 0 0 1.12-.94l1.86-2.56a2.94 2.94 0 1 1 4.76 3.46l-1.86 2.56a3 3 0 0 0-.55 1.36l-1.55 11.3Zm-11.39-33.1a2.93 2.93 0 0 1-.22 4.21c-.6.55-1.3.8-2.12.75a2.93 2.93 0 0 1-2.06-1 2.89 2.89 0 0 1-.74-2.11 2.8 2.8 0 0 1 2.35-2.76 3.2 3.2 0 0 1 1.52.09c.5.16.92.43 1.27.82ZM34.2 187.3a2.39 2.39 0 1 1-4.14 2.39l-4.37-7.57a2.39 2.39 0 1 1 4.13-2.38l4.37 7.56Zm14.75-8.52a2.39 2.39 0 0 1-4.13 2.38l-4.37-7.56a2.39 2.39 0 1 1 4.13-2.39l4.37 7.57Zm-21.08 7.13a2.96 2.96 0 0 1 1.09-4.05l13.76-7.95a2.96 2.96 0 0 1 2.96 5.13L31.92 187a2.96 2.96 0 0 1-4.05-1.09Zm-2.9-36.06c2.3-.75 4.4-.94 6.28-.56a9.51 9.51 0 0 1 4.78 2.47 11.27 11.27 0 0 1 2.88 4.71c.61 1.9.76 3.74.44 5.53a9.6 9.6 0 0 1-2.43 4.8c-1.3 1.4-3.1 2.48-5.4 3.23-2.3.75-4.4.94-6.26.56a9.44 9.44 0 0 1-4.78-2.46 11.24 11.24 0 0 1-2.9-4.73 11.2 11.2 0 0 1-.43-5.5 9.42 9.42 0 0 1 2.42-4.81 12.26 12.26 0 0 1 5.4-3.24Zm1.88 5.8c-1.24.4-2.23.9-2.98 1.5a4.2 4.2 0 0 0-1.47 2.09 4.2 4.2 0 0 0 .1 2.57c.3.93.77 1.64 1.43 2.14.64.5 1.45.77 2.41.82.96.05 2.06-.13 3.3-.54 1.25-.4 2.24-.9 3-1.5a4.34 4.34 0 0 0 1.47-2.09 4.3 4.3 0 0 0-.1-2.57 4.24 4.24 0 0 0-1.43-2.14 4.24 4.24 0 0 0-2.42-.82 9.24 9.24 0 0 0-3.3.53Zm3.91-38.41a4.55 4.55 0 0 1-.87 2.28 4.9 4.9 0 0 1-1.87 1.52c-.75.34-1.55.46-2.4.37a4.52 4.52 0 0 1-2.28-.87 4.81 4.81 0 0 1-1.9-4.28 4.72 4.72 0 0 1 5.15-4.17 4.8 4.8 0 0 1 3.8 2.74c.34.75.46 1.55.37 2.41ZM44.58 84.8a2.96 2.96 0 0 1-4.05 1.09L26.8 77.96a3 3 0 0 1-1.1-4.1l4.98-8.62a2.39 2.39 0 1 1 4.13 2.39l-2.58 4.46a1.88 1.88 0 0 0 3.25 1.88l2.1-3.66a2.39 2.39 0 1 1 4.14 2.39l-1.54 2.68a3 3 0 0 0 1.1 4.1l2.21 1.28a2.96 2.96 0 0 1 1.09 4.04Zm13.07-35.26a12.31 12.31 0 0 1 3.62 5.17c.6 1.81.69 3.6.25 5.37a11.27 11.27 0 0 1-2.64 4.85 11.24 11.24 0 0 1-4.56 3.14c-1.72.6-3.5.7-5.37.3a12.34 12.34 0 0 1-5.5-3.06 12.33 12.33 0 0 1-3.62-5.15 9.46 9.46 0 0 1-.25-5.36c.43-1.77 1.31-3.4 2.64-4.87a11.2 11.2 0 0 1 4.56-3.13 9.4 9.4 0 0 1 5.37-.31c1.86.4 3.7 1.43 5.5 3.05Zm-4.07 4.53a9.15 9.15 0 0 0-2.8-1.82 4.18 4.18 0 0 0-2.55-.24 4.2 4.2 0 0 0-2.17 1.37 4.24 4.24 0 0 0-1.14 2.31c-.1.8.06 1.64.5 2.5a9.33 9.33 0 0 0 2.11 2.6c.97.87 1.9 1.48 2.8 1.83.9.34 1.75.42 2.54.24a4.3 4.3 0 0 0 2.18-1.38 4.24 4.24 0 0 0 1.14-2.3c.1-.82-.06-1.65-.5-2.5a9.24 9.24 0 0 0-2.11-2.61Zm2.2-16.63c.83-.6 1.92-.7 2.85-.28l5.04 2.3a.15.15 0 0 0 .2-.15l-.6-5.55a2.82 2.82 0 1 1 5.6-.56l.53 5.89a3 3 0 0 0 1.86 2.5l5.45 2.23a2.85 2.85 0 1 1-2.24 5.24l-5.22-2.35a.15.15 0 0 0-.2.15l.61 5.7a2.85 2.85 0 1 1-5.66.52l-.46-5.88a3 3 0 0 0-1.8-2.52l-5.42-2.33a2.84 2.84 0 0 1-.54-4.9Zm19.07-7.84a2.87 2.87 0 1 1 3.62-4.47l6.06 5.14a.14.14 0 0 0 .22-.1l.23-7.93a2.87 2.87 0 1 1 5.74.29l-.83 11.38a3 3 0 0 0 .25 1.44l1.29 2.9a2.94 2.94 0 1 1-5.37 2.39l-1.3-2.9a3 3 0 0 0-.9-1.14l-9.01-7Zm34.35 6.68a2.93 2.93 0 0 1-3.53-2.3 2.78 2.78 0 0 1 .41-2.2 2.93 2.93 0 0 1 1.9-1.3 2.9 2.9 0 0 1 2.2.42 2.8 2.8 0 0 1 1.21 3.41c-.18.5-.46.93-.84 1.28-.38.35-.83.58-1.34.7Zm14.61-19.33a2.39 2.39 0 0 1 0-4.77h8.74a2.39 2.39 0 0 1 0 4.77h-8.74Zm0 17.05a2.39 2.39 0 0 1 0-4.77h8.74a2.39 2.39 0 0 1 0 4.77h-8.74Zm4.37-21.82a2.96 2.96 0 0 1 2.97 2.96v15.9a2.96 2.96 0 0 1-5.93 0v-15.9a2.96 2.96 0 0 1 2.96-2.96Zm32.68 15.52a12.24 12.24 0 0 1-2.66 5.71 9.5 9.5 0 0 1-4.53 2.9c-1.74.5-3.58.55-5.52.14a11.24 11.24 0 0 1-5-2.38 9.6 9.6 0 0 1-2.94-4.5 12.4 12.4 0 0 1-.1-6.29c.5-2.37 1.38-4.28 2.65-5.7a9.44 9.44 0 0 1 4.51-2.91c1.75-.51 3.6-.56 5.54-.14 1.94.4 3.6 1.2 4.99 2.37a9.42 9.42 0 0 1 2.95 4.5c.58 1.82.62 3.92.11 6.3Zm-5.96-1.27c.27-1.28.33-2.4.18-3.34a4.18 4.18 0 0 0-1.07-2.32 4.2 4.2 0 0 0-2.27-1.2 4.24 4.24 0 0 0-2.57.17c-.75.31-1.39.88-1.92 1.69a9.2 9.2 0 0 0-1.18 3.12 9.4 9.4 0 0 0-.2 3.35 4.4 4.4 0 0 0 1.07 2.31c.57.6 1.33 1 2.29 1.2.96.2 1.8.15 2.56-.17.75-.31 1.4-.88 1.91-1.68.53-.81.93-1.85 1.2-3.13Zm31.3 22.59a4.54 4.54 0 0 1-1.53-1.9 4.9 4.9 0 0 1-.38-2.38 4.5 4.5 0 0 1 .88-2.27c.5-.7 1.14-1.21 1.89-1.54a4.81 4.81 0 0 1 4.65.5 4.72 4.72 0 0 1 1.04 6.55 4.8 4.8 0 0 1-4.27 1.91 4.51 4.51 0 0 1-2.28-.87Zm21.19 28.18a2.96 2.96 0 0 1 1.08-4.05l13.73-7.93a3 3 0 0 1 4.1 1.1l4.98 8.62a2.39 2.39 0 0 1-4.13 2.39l-2.58-4.47a1.87 1.87 0 1 0-3.25 1.88l2.11 3.65a2.39 2.39 0 1 1-4.13 2.39l-1.55-2.68a3 3 0 0 0-4.1-1.1l-2.22 1.28a2.96 2.96 0 0 1-4.04-1.08Zm24 28.95c-2.31.75-4.4.94-6.29.56a9.5 9.5 0 0 1-4.78-2.47 11.26 11.26 0 0 1-2.87-4.71c-.61-1.9-.76-3.74-.44-5.53a9.6 9.6 0 0 1 2.43-4.8 12.5 12.5 0 0 1 5.39-3.23c2.31-.75 4.4-.94 6.27-.56a9.44 9.44 0 0 1 4.78 2.46 11.23 11.23 0 0 1 2.89 4.73c.6 1.88.75 3.71.43 5.5a9.43 9.43 0 0 1-2.41 4.81 12.26 12.26 0 0 1-5.4 3.24Zm-1.89-5.8c1.25-.4 2.24-.9 2.98-1.5a4.17 4.17 0 0 0 1.48-2.09 4.2 4.2 0 0 0-.1-2.57 4.25 4.25 0 0 0-1.43-2.14 4.27 4.27 0 0 0-2.42-.82 9.32 9.32 0 0 0-3.3.54c-1.24.4-2.24.9-2.99 1.5a4.34 4.34 0 0 0-1.47 2.09 4.3 4.3 0 0 0 .1 2.57c.3.93.78 1.65 1.43 2.14.65.5 1.46.77 2.41.82.97.05 2.07-.13 3.31-.53Zm13.3 10.23a2.84 2.84 0 0 1-1.18 2.61l-4.52 3.21a.15.15 0 0 0-.06.14c.01.05.04.1.1.12l5.1 2.24a2.82 2.82 0 1 1-2.31 5.14l-5.37-2.48a3 3 0 0 0-3.1.35l-4.65 3.61a2.85 2.85 0 1 1-3.41-4.56l4.64-3.35a.15.15 0 0 0 .06-.13c0-.06-.04-.1-.08-.12l-5.25-2.31a2.84 2.84 0 1 1 2.38-5.17l5.32 2.54a3 3 0 0 0 3.1-.3l4.71-3.52a2.84 2.84 0 0 1 4.52 1.98Zm-2.74 20.44a2.87 2.87 0 1 1 2.06 5.36l-7.48 2.68a.13.13 0 0 0-.1.11c0 .06.03.1.07.13l6.76 4.17a2.87 2.87 0 1 1-3.12 4.83l-9.45-6.42a3 3 0 0 0-1.37-.5l-3.15-.33a2.94 2.94 0 0 1 .62-5.85l3.14.33a3 3 0 0 0 1.45-.2l10.57-4.31Zm-22.96 26.41a2.93 2.93 0 0 1 3.75-1.92 2.8 2.8 0 0 1 1.71 1.47c.37.74.42 1.5.17 2.28-.24.74-.73 1.3-1.46 1.7a2.8 2.8 0 0 1-3.56-.66c-.34-.4-.57-.85-.7-1.36-.1-.5-.08-1.01.09-1.51Zm9.43 22.32a2.39 2.39 0 1 1 4.13 2.38l-4.37 7.57a2.39 2.39 0 1 1-4.13-2.39l4.37-7.56Zm-14.77-8.53a2.39 2.39 0 1 1 4.14 2.39l-4.37 7.56a2.39 2.39 0 0 1-4.13-2.38l4.36-7.57Zm16.72 14.7a2.96 2.96 0 0 1-4.05 1.08l-13.76-7.95a2.96 2.96 0 1 1 2.96-5.13l13.76 7.95a2.96 2.96 0 0 1 1.09 4.04Zm-29.78 20.54a12.3 12.3 0 0 1-3.62-5.17 9.5 9.5 0 0 1-.25-5.37 11.27 11.27 0 0 1 2.64-4.85 11.25 11.25 0 0 1 4.57-3.14 9.6 9.6 0 0 1 5.37-.3c1.87.43 3.7 1.44 5.5 3.06a12.33 12.33 0 0 1 3.61 5.15c.61 1.82.7 3.6.26 5.36a11.24 11.24 0 0 1-2.65 4.87 11.2 11.2 0 0 1-4.55 3.13 9.4 9.4 0 0 1-5.37.31 12.26 12.26 0 0 1-5.5-3.05Zm4.08-4.53c.97.88 1.9 1.48 2.8 1.82.9.35 1.75.43 2.54.24a4.2 4.2 0 0 0 2.18-1.37 4.24 4.24 0 0 0 1.14-2.31c.1-.8-.07-1.64-.5-2.5a9.33 9.33 0 0 0-2.12-2.6 9.4 9.4 0 0 0-2.8-1.83 4.34 4.34 0 0 0-2.54-.24c-.8.2-1.52.66-2.17 1.39a4.24 4.24 0 0 0-1.14 2.3c-.1.81.06 1.64.5 2.5a9.21 9.21 0 0 0 2.11 2.6Zm-35.21 15.81a4.54 4.54 0 0 1 2.4-.38c.83.1 1.58.39 2.25.86a4.55 4.55 0 0 1 1.54 1.9c.35.79.48 1.6.38 2.4a4.81 4.81 0 0 1-2.76 3.79 4.73 4.73 0 0 1-6.19-2.38 4.81 4.81 0 0 1 .48-4.66 4.51 4.51 0 0 1 1.9-1.53Z"/></svg>`)),v(a({"block text-center text-xl font-medium":!0},y)),{context:e,store_name:t},this.__storeDomainGetValue,"accepted"===e&&this.getStorePageHref&&this.data?n(L||(L=B` <div ?hidden="${0}"> <a class="text-primary font-medium cursor-pointer rounded transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="store_link"></foxy-i18n> </a> </div> `),"accepted"!==e||!this.getStorePageHref,this.getStorePageHref(this.data._links["fx:store"].href)):"",{context:e,store_name:t},o(null!==(s=null===(i=null==u?void 0:u["fx:revoke"])||void 0===i?void 0:i.href)&&void 0!==s?s:null===(l=null==u?void 0:u["fx:reject"])||void 0===l?void 0:l.href),p.matches("reject",!0)&&p.matches("accept",!0),o(null===(m=null===(d=this.data)||void 0===d?void 0:d._links["fx:reject"])||void 0===m?void 0:m.href),o(null===(h=null===(f=this.data)||void 0===f?void 0:f._links["fx:accept"])||void 0===h?void 0:h.href))}}customElements.define("foxy-user-invitation-form",P);export{P as UserInvitationForm};
@@ -78,11 +78,17 @@
78
78
  "placeholder": "None (use default)",
79
79
  "helper_text": ""
80
80
  },
81
+ "content-html-warning": {
82
+ "text": "As you are caching from a remote template URL, we recommend making changes in your remote template directly and recaching the changes. Any changes made locally within the administration could be lost if the remote template is cached again."
83
+ },
81
84
  "content-text": {
82
85
  "label": "Custom text template",
83
86
  "placeholder": "None (use default)",
84
87
  "helper_text": ""
85
88
  },
89
+ "content-text-warning": {
90
+ "text": "As you are caching from a remote template URL, we recommend making changes in your remote template directly and recaching the changes. Any changes made locally within the administration could be lost if the remote template is cached again."
91
+ },
86
92
  "timestamps": {
87
93
  "date_created": "Created on",
88
94
  "date_modified": "Last updated on",
@@ -52,6 +52,7 @@
52
52
  "placeholder": "Required",
53
53
  "helper_text": "",
54
54
  "v8n_required": "Please enter the URL of your online store",
55
+ "v8n_invalid": "Please enter a valid URL starting with a protocol (http:// or https://).",
55
56
  "v8n_too_long": "Please use a URL that is 300 characters or less"
56
57
  }
57
58
  },
@@ -47,6 +47,9 @@
47
47
  "placeholder": "None (use default)",
48
48
  "helper_text": ""
49
49
  },
50
+ "content-warning": {
51
+ "text": "As you are caching from a remote template URL, we recommend making changes in your remote template directly and recaching the changes. Any changes made locally within the administration could be lost if the remote template is cached again."
52
+ },
50
53
  "timestamps": {
51
54
  "date_created": "Created on",
52
55
  "date_modified": "Last updated on",
@@ -18,7 +18,6 @@ export declare class EmailTemplateForm extends Base<Data> {
18
18
  private readonly __templateLanguageOptions;
19
19
  private readonly __toggleGetValue;
20
20
  private readonly __toggleSetValue;
21
- get readonlySelector(): BooleanSelector;
22
21
  get disabledSelector(): BooleanSelector;
23
22
  get hiddenSelector(): BooleanSelector;
24
23
  renderBody(): TemplateResult;
@@ -2,7 +2,7 @@ import { TranslatableMixin } from "../../../mixins/translatable.js";
2
2
  import { BooleanSelector } from '@foxy.io/sdk/core';
3
3
  import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
4
4
  import { ifDefined } from 'lit-html/directives/if-defined';
5
- import { html } from 'lit-element';
5
+ import { html, svg } from 'lit-element';
6
6
  const NS = 'email-template-form';
7
7
  const Base = TranslatableMixin(InternalForm, NS);
8
8
  /**
@@ -40,15 +40,6 @@ export class EmailTemplateForm extends Base {
40
40
  defaultSubject: { attribute: 'default-subject' },
41
41
  };
42
42
  }
43
- get readonlySelector() {
44
- const alwaysMatch = [super.readonlySelector.toString()];
45
- const subject = this.form.subject;
46
- if (this.form.content_html_url && subject)
47
- alwaysMatch.unshift('content-html');
48
- if (this.form.content_text_url && subject)
49
- alwaysMatch.unshift('content-text');
50
- return new BooleanSelector(alwaysMatch.join(' ').trim());
51
- }
52
43
  get disabledSelector() {
53
44
  const alwaysMatch = [super.disabledSelector.toString()];
54
45
  if (!this.in({ idle: { snapshot: 'clean' } }) ||
@@ -62,14 +53,20 @@ export class EmailTemplateForm extends Base {
62
53
  return new BooleanSelector(alwaysMatch.join(' ').trim());
63
54
  }
64
55
  get hiddenSelector() {
65
- var _a, _b, _c;
56
+ var _a, _b, _c, _d, _e, _f, _g;
66
57
  const alwaysMatch = [super.hiddenSelector.toString()];
67
58
  if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.content_html_url))
68
59
  alwaysMatch.unshift('html-source:cache');
69
60
  if (!((_b = this.data) === null || _b === void 0 ? void 0 : _b.content_text_url))
70
61
  alwaysMatch.unshift('text-source:cache');
71
- if (!((_c = this.data) === null || _c === void 0 ? void 0 : _c.subject) && !this.form.subject) {
72
- alwaysMatch.unshift('general:template-language', 'general:subject', 'html-source', 'text-source', 'content-html', 'content-text');
62
+ if (!this.form.content_html_url || ((_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.content_html) !== null && _d !== void 0 ? _d : '') === this.form.content_html) {
63
+ alwaysMatch.unshift('content-html-warning');
64
+ }
65
+ if (!this.form.content_text_url || ((_f = (_e = this.data) === null || _e === void 0 ? void 0 : _e.content_text) !== null && _f !== void 0 ? _f : '') === this.form.content_text) {
66
+ alwaysMatch.unshift('content-text-warning');
67
+ }
68
+ if (!((_g = this.data) === null || _g === void 0 ? void 0 : _g.subject) && !this.form.subject) {
69
+ alwaysMatch.unshift('general:template-language', 'general:subject', 'html-source', 'text-source', 'content-html', 'content-html-warning', 'content-text', 'content-text-warning');
73
70
  }
74
71
  return new BooleanSelector(alwaysMatch.join(' ').trim());
75
72
  }
@@ -104,6 +101,13 @@ export class EmailTemplateForm extends Base {
104
101
 
105
102
  <foxy-internal-source-control infer="content-html"></foxy-internal-source-control>
106
103
 
104
+ <foxy-internal-summary-control infer="content-html-warning" label="" helper-text="">
105
+ <div class="flex gap-s bg-error-10 text-error leading-xs text-s">
106
+ ${svg `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.25em; height: 1.25em; margin-top: 0.1em;" class="flex-shrink-0"><path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" clip-rule="evenodd" /></svg>`}
107
+ <foxy-i18n infer="" key="text"></foxy-i18n>
108
+ </div>
109
+ </foxy-internal-summary-control>
110
+
107
111
  <foxy-internal-summary-control infer="html-source">
108
112
  <foxy-internal-text-control layout="summary-item" infer="content-html-url">
109
113
  </foxy-internal-text-control>
@@ -117,6 +121,13 @@ export class EmailTemplateForm extends Base {
117
121
 
118
122
  <foxy-internal-source-control infer="content-text"></foxy-internal-source-control>
119
123
 
124
+ <foxy-internal-summary-control infer="content-text-warning" label="" helper-text="">
125
+ <div class="flex gap-s bg-error-10 text-error leading-xs text-s">
126
+ ${svg `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.25em; height: 1.25em; margin-top: 0.1em;" class="flex-shrink-0"><path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" clip-rule="evenodd" /></svg>`}
127
+ <foxy-i18n infer="" key="text"></foxy-i18n>
128
+ </div>
129
+ </foxy-internal-summary-control>
130
+
120
131
  <foxy-internal-summary-control infer="text-source">
121
132
  <foxy-internal-text-control layout="summary-item" infer="content-text-url">
122
133
  </foxy-internal-text-control>
@@ -1 +1 @@
1
- {"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailTemplateForm.ts"],"names":[],"mappings":"AAGA,OAA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AgB,IAAI,KAAK,CAAC,gBAAgB,EAAE;YACpD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;YACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACtF,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;SACnD;QAED,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAES,KAAK,CAAC,UAAU,CAAC,KAAoB;QAC7C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAC;QAEpE,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAElD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\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 { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'email-template-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for creating or editing email templates (`fx:email_template`).\n *\n * @element foxy-email-template-form\n * @since 1.14.0\n */\nexport class EmailTemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n defaultSubject: { attribute: 'default-subject' },\n };\n }\n\n /** Default email subject. Use this instead of i18next key when you need to use handlebars syntax. */\n defaultSubject: string | null = null;\n\n private readonly __templateLanguageOptions = [\n { rawLabel: 'Nunjucks', value: 'nunjucks' },\n { rawLabel: 'Handlebars', value: 'handlebars' },\n { rawLabel: 'Pug', value: 'pug' },\n { rawLabel: 'Twig', value: 'twig' },\n { rawLabel: 'EJS', value: 'ejs' },\n ];\n\n private readonly __toggleGetValue = () => !!this.form.subject;\n\n private readonly __toggleSetValue = (newValue: boolean) => {\n if (newValue) {\n this.edit({ subject: this.defaultSubject ?? this.t('general.subject.default_value') });\n } else {\n this.edit({ subject: '' });\n }\n };\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n const subject = this.form.subject;\n\n if (this.form.content_html_url && subject) alwaysMatch.unshift('content-html');\n if (this.form.content_text_url && subject) alwaysMatch.unshift('content-text');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get disabledSelector(): BooleanSelector {\n const alwaysMatch = [super.disabledSelector.toString()];\n\n if (\n !this.in({ idle: { snapshot: 'clean' } }) ||\n !this.data.content_html_url ||\n !this.data.content_text_url\n ) {\n alwaysMatch.unshift('html-source:cache', 'text-source:cache');\n }\n\n if (!this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-text'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.data?.content_html_url) alwaysMatch.unshift('html-source:cache');\n if (!this.data?.content_text_url) alwaysMatch.unshift('text-source:cache');\n if (!this.data?.subject && !this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'general:subject',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-text'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"description\">\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n infer=\"toggle\"\n .getValue=${this.__toggleGetValue}\n .setValue=${this.__toggleSetValue}\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control layout=\"summary-item\" infer=\"subject\">\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n layout=\"summary-item\"\n infer=\"template-language\"\n .options=${this.__templateLanguageOptions}\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-source-control infer=\"content-html\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"html-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-html-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n <foxy-internal-source-control infer=\"content-text\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"text-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-text-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n ${super.renderBody()}\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPost(edits);\n\n if (edits.content_html_url && edits.content_text_url) {\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n }\n\n return await this._fetch(data._links.self.href);\n }\n\n protected async _sendPatch(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPatch(edits);\n if (!edits.content_html_url && !edits.content_text_url) return data;\n\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n\n return await this._fetch(data._links.self.href);\n }\n}\n"]}
1
+ {"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailTemplateForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,IAAU;IAAjD;;QAQE,qGAAqG;QACrG,mBAAc,GAAkB,IAAI,CAAC;QAEpB,8BAAyB,GAAG;YAC3C,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;YAC3C,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;YAC/C,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YACjC,EAAE,QAAQ,EAAE,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;YAAE,OAAO,IAAI,CAAC;QAEpE,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAElD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\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 { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-element';\n\nconst NS = 'email-template-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for creating or editing email templates (`fx:email_template`).\n *\n * @element foxy-email-template-form\n * @since 1.14.0\n */\nexport class EmailTemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n defaultSubject: { attribute: 'default-subject' },\n };\n }\n\n /** Default email subject. Use this instead of i18next key when you need to use handlebars syntax. */\n defaultSubject: string | null = null;\n\n private readonly __templateLanguageOptions = [\n { rawLabel: 'Nunjucks', value: 'nunjucks' },\n { rawLabel: 'Handlebars', value: 'handlebars' },\n { rawLabel: 'Pug', value: 'pug' },\n { rawLabel: 'Twig', value: 'twig' },\n { rawLabel: 'EJS', value: 'ejs' },\n ];\n\n private readonly __toggleGetValue = () => !!this.form.subject;\n\n private readonly __toggleSetValue = (newValue: boolean) => {\n if (newValue) {\n this.edit({ subject: this.defaultSubject ?? this.t('general.subject.default_value') });\n } else {\n this.edit({ subject: '' });\n }\n };\n\n get disabledSelector(): BooleanSelector {\n const alwaysMatch = [super.disabledSelector.toString()];\n\n if (\n !this.in({ idle: { snapshot: 'clean' } }) ||\n !this.data.content_html_url ||\n !this.data.content_text_url\n ) {\n alwaysMatch.unshift('html-source:cache', 'text-source:cache');\n }\n\n if (!this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-text'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.data?.content_html_url) alwaysMatch.unshift('html-source:cache');\n if (!this.data?.content_text_url) alwaysMatch.unshift('text-source:cache');\n\n if (!this.form.content_html_url || (this.data?.content_html ?? '') === this.form.content_html) {\n alwaysMatch.unshift('content-html-warning');\n }\n if (!this.form.content_text_url || (this.data?.content_text ?? '') === this.form.content_text) {\n alwaysMatch.unshift('content-text-warning');\n }\n\n if (!this.data?.subject && !this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'general:subject',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-html-warning',\n 'content-text',\n 'content-text-warning'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"description\">\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n infer=\"toggle\"\n .getValue=${this.__toggleGetValue}\n .setValue=${this.__toggleSetValue}\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control layout=\"summary-item\" infer=\"subject\">\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n layout=\"summary-item\"\n infer=\"template-language\"\n .options=${this.__templateLanguageOptions}\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-source-control infer=\"content-html\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"content-html-warning\" label=\"\" helper-text=\"\">\n <div class=\"flex gap-s bg-error-10 text-error leading-xs text-s\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1.25em; height: 1.25em; margin-top: 0.1em;\" class=\"flex-shrink-0\"><path fill-rule=\"evenodd\" d=\"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z\" clip-rule=\"evenodd\" /></svg>`}\n <foxy-i18n infer=\"\" key=\"text\"></foxy-i18n>\n </div>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"html-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-html-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n <foxy-internal-source-control infer=\"content-text\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"content-text-warning\" label=\"\" helper-text=\"\">\n <div class=\"flex gap-s bg-error-10 text-error leading-xs text-s\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1.25em; height: 1.25em; margin-top: 0.1em;\" class=\"flex-shrink-0\"><path fill-rule=\"evenodd\" d=\"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z\" clip-rule=\"evenodd\" /></svg>`}\n <foxy-i18n infer=\"\" key=\"text\"></foxy-i18n>\n </div>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"text-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-text-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n ${super.renderBody()}\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPost(edits);\n\n if (edits.content_html_url && edits.content_text_url) {\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n }\n\n return await this._fetch(data._links.self.href);\n }\n\n protected async _sendPatch(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPatch(edits);\n if (!edits.content_html_url && !edits.content_text_url) return data;\n\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n\n return await this._fetch(data._links.self.href);\n }\n}\n"]}
@@ -4,6 +4,7 @@ import '../../internal/InternalSelectControl/index';
4
4
  import '../../internal/InternalSwitchControl/index';
5
5
  import '../../internal/InternalTextControl/index';
6
6
  import '../../internal/InternalForm/index';
7
+ import '../I18n/index';
7
8
  import './internal/InternalEmailTemplateFormAsyncAction/index';
8
9
  import { EmailTemplateForm } from './EmailTemplateForm';
9
10
  export { EmailTemplateForm };
@@ -4,6 +4,7 @@ import "../../internal/InternalSelectControl/index.js";
4
4
  import "../../internal/InternalSwitchControl/index.js";
5
5
  import "../../internal/InternalTextControl/index.js";
6
6
  import "../../internal/InternalForm/index.js";
7
+ import "../I18n/index.js";
7
8
  import "./internal/InternalEmailTemplateFormAsyncAction/index.js";
8
9
  import { EmailTemplateForm } from "./EmailTemplateForm.js";
9
10
  customElements.define('foxy-email-template-form', EmailTemplateForm);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/index.ts"],"names":[],"mappings":"AAAA,wDAAqD;AACrD,uDAAoD;AACpD,uDAAoD;AACpD,uDAAoD;AACpD,qDAAkD;AAClD,8CAA2C;AAE3C,kEAA+D;AAE/D,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAExD,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import '../../internal/InternalSummaryControl/index';\nimport '../../internal/InternalSourceControl/index';\nimport '../../internal/InternalSelectControl/index';\nimport '../../internal/InternalSwitchControl/index';\nimport '../../internal/InternalTextControl/index';\nimport '../../internal/InternalForm/index';\n\nimport './internal/InternalEmailTemplateFormAsyncAction/index';\n\nimport { EmailTemplateForm } from './EmailTemplateForm';\n\ncustomElements.define('foxy-email-template-form', EmailTemplateForm);\n\nexport { EmailTemplateForm };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/index.ts"],"names":[],"mappings":"AAAA,wDAAqD;AACrD,uDAAoD;AACpD,uDAAoD;AACpD,uDAAoD;AACpD,qDAAkD;AAClD,8CAA2C;AAE3C,0BAAuB;AAEvB,kEAA+D;AAE/D,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAExD,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import '../../internal/InternalSummaryControl/index';\nimport '../../internal/InternalSourceControl/index';\nimport '../../internal/InternalSelectControl/index';\nimport '../../internal/InternalSwitchControl/index';\nimport '../../internal/InternalTextControl/index';\nimport '../../internal/InternalForm/index';\n\nimport '../I18n/index';\n\nimport './internal/InternalEmailTemplateFormAsyncAction/index';\n\nimport { EmailTemplateForm } from './EmailTemplateForm';\n\ncustomElements.define('foxy-email-template-form', EmailTemplateForm);\n\nexport { EmailTemplateForm };\n"]}
@@ -4,6 +4,7 @@ import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
4
4
  import { ifDefined } from 'lit-html/directives/if-defined';
5
5
  import { html } from 'lit-html';
6
6
  import slugify from '@sindresorhus/slugify';
7
+ import memoize from 'lodash-es/memoize';
7
8
  import merge from 'lodash-es/merge';
8
9
  const NS = 'store-form';
9
10
  const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
@@ -278,6 +279,14 @@ export class StoreForm extends Base {
278
279
  };
279
280
  }
280
281
  static get v8n() {
282
+ const isURL = memoize((value) => {
283
+ try {
284
+ return Boolean(new URL(value));
285
+ }
286
+ catch (_a) {
287
+ return false;
288
+ }
289
+ });
281
290
  return [
282
291
  ({ store_name: v }) => !!v || 'store-name:v8n_required',
283
292
  ({ store_name: v }) => (v && v.length <= 50) || 'store-name:v8n_too_long',
@@ -302,6 +311,7 @@ export class StoreForm extends Base {
302
311
  },
303
312
  ({ store_url: v }) => !!v || 'store-url:v8n_required',
304
313
  ({ store_url: v }) => (v && v.length <= 300) || 'store-url:v8n_too_long',
314
+ ({ store_url: v }) => !v || isURL(v) || 'store-url:v8n_invalid',
305
315
  ({ receipt_continue_url: v }) => !v || v.length <= 300 || 'receipt-continue-url:v8n_too_long',
306
316
  ({ store_email: v }) => !!v || 'store-email:v8n_required',
307
317
  ({ store_email: v }) => (v && v.length <= 300) || 'store-email:v8n_too_long',