@foxy.io/elements 1.22.0-beta.5 → 1.22.0
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-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +16 -15
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.d.ts +1 -0
- package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js +8 -0
- package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js.map +1 -1
- package/dist/elements/public/CustomerPortal/CustomerPortal.d.ts +3 -0
- package/dist/elements/public/CustomerPortal/CustomerPortal.js +12 -0
- package/dist/elements/public/CustomerPortal/CustomerPortal.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.d.ts +2 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js +3 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalTransactions.d.ts +2 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalTransactions.js +3 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalTransactions.js.map +1 -1
- package/dist/elements/public/SignInForm/SignInForm.d.ts +1 -0
- package/dist/elements/public/SignInForm/SignInForm.js +8 -0
- package/dist/elements/public/SignInForm/SignInForm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-fcce5337.js";import"./shared-57c6cfd1.js";import"./shared-c0ec65fa.js";import"./shared-9e8bff76.js";import"./shared-24a762c1.js";import"./shared-950875f2.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-b137f17a.js";import{h as e}from"./shared-7f33a83a.js";import{C as s}from"./shared-de790de9.js";import{N as
|
|
1
|
+
import"./shared-fcce5337.js";import"./shared-57c6cfd1.js";import"./shared-c0ec65fa.js";import"./shared-9e8bff76.js";import"./shared-24a762c1.js";import"./shared-950875f2.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-b137f17a.js";import{h as e}from"./shared-7f33a83a.js";import{C as s}from"./shared-de790de9.js";import{N as t}from"./shared-eb900735.js";import{T as i,a as r}from"./shared-e9c81269.js";import{c as a}from"./shared-4e709717.js";import{i as o}from"./shared-d3bf9ac0.js";import{v as l}from"./shared-b738ee96.js";import"./shared-533c3914.js";import"./shared-b2474263.js";import"./shared-668947de.js";import"./shared-98755831.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";let n,d,m,h,c=e=>e;const p=i(s(r(t,"access-recovery-form")));class u extends p{constructor(){super(...arguments),this.templates={},this.__checkEmailValidity=()=>!this.errors.some((e=>e.startsWith("email"))),this.__renderEmail=()=>{var s;const t=this.in("fail"),i=this.in("busy"),r=this.in({idle:"snapshot"}),a=this.errors.filter((e=>e.startsWith("email"))).map((e=>e.replace("email","v8n"))),l=a[0]?this.t(a[0]).toString():"";return e(n||(n=c` <div> ${0} <vaadin-email-field error-message="${0}" data-testid="email" class="w-full" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @input="${0}" @keydown="${0}"> </vaadin-email-field> ${0} </div> `),this.renderTemplateOrSlot("email:before"),l,this.t("email").toString(),o(null===(s=this.form.detail)||void 0===s?void 0:s.email),i||r||t||this.disabledSelector.matches("email",!0),this.readonlySelector.matches("email",!0),this.__checkEmailValidity,(e=>{this.edit({detail:{email:e.target.value},type:"email"})}),(e=>{"Enter"===e.key&&this.submit()}),this.renderTemplateOrSlot("email:after"))},this.__renderMessage=()=>{const s=this.in("fail"),t=s?"bg-error-10 text-error":"bg-success-10 text-success",i=s?"lumo:error":"lumo:cog",r=s?"unknown_error":"recover_access_success";return e(d||(d=c` <div> ${0} <p class="leading-s flex items-start text-s rounded p-s ${0}"> <iron-icon class="flex-shrink-0 icon-inline text-l mr-s" icon="${0}"></iron-icon> <foxy-i18n lang="${0}" key="${0}" ns="${0}" data-testid="message"></foxy-i18n> </p> ${0} </div> `),this.renderTemplateOrSlot("message:before"),t,i,this.lang,r,this.ns,this.renderTemplateOrSlot("message:after"))},this.__renderSubmit=()=>{const s=this.in("fail"),t=0===this.errors.length,i=this.in("busy"),r=this.in({idle:"snapshot"}),a=i||r||!t||s;return e(m||(m=c` <div> ${0} <vaadin-button data-testid="submit" class="w-full" theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="recover_access" ns="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("submit:before"),a||this.disabledSelector.matches("submit",!0),(()=>this.submit()),this.lang,this.ns,this.renderTemplateOrSlot("submit:after"))}}static get v8n(){return[({detail:e})=>(null==e?void 0:e.email)&&e.email.length>0||"email_required",({detail:e})=>{var s;return l(null!==(s=null==e?void 0:e.email)&&void 0!==s?s:"")||"email_invalid_email"}]}render(){var s,t;const i=this.hiddenSelector,r=this.in({idle:"snapshot"})||this.in("fail"),o=this.in("busy");return e(h||(h=c` <main data-testid="wrapper" aria-live="polite" aria-busy="${0}" class="relative font-lumo text-m leading-m space-y-m"> ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="busy" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </main> `),o,i.matches("email",!0)?"":this.__renderEmail(),i.matches("message",!0)||!r?"":this.__renderMessage(),i.matches("submit",!0)?"":this.__renderSubmit(),a({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!o}),this.lang,this.ns,null!==(t=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==t?t:"")}async _sendPost(e){const s=JSON.stringify(e),i=await this._fetch(this.parent,{body:s,method:"POST"}),r=t.Rumour(this.group),a=[...this.related,this.parent];return r.share({data:i,related:a,source:i._links.self.href}),i}}customElements.define("foxy-access-recovery-form",u);export{u as AccessRecoveryForm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de.js";import"./shared-24a762c1.js";import"./shared-0479553e.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as
|
|
1
|
+
import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de.js";import"./shared-24a762c1.js";import"./shared-0479553e.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import{TransactionsTable as e}from"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as t,B as s,am as r}from"./shared-98755831.js";import{h as o,L as i,c as n}from"./shared-7f33a83a.js";import{A as a}from"./shared-daf52401.js";import"./shared-b5517c1b.js";import{C as l}from"./shared-bd819b5b.js";import{a as d,T as c,R as m}from"./shared-e9c81269.js";import{A as h}from"./shared-509a2f52.js";import{I as u}from"./shared-a8cf402a.js";import{c as p}from"./shared-4e709717.js";import{C as f}from"./shared-de790de9.js";import{N as g}from"./shared-eb900735.js";import{i as $}from"./shared-d3bf9ac0.js";import"./shared-533c3914.js";import"./foxy-attribute-card.js";import"./shared-b137f17a.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./foxy-attribute-form.js";import"./shared-3b8b5eda.js";import"./shared-9e8bff76.js";import"./shared-57c6cfd1.js";import"./shared-b2474263.js";import"./shared-15c94a90.js";import"./shared-bc36bc72.js";import"./shared-950875f2.js";import"./shared-014f1513.js";import"./shared-c5106979.js";import"./shared-1f4b9c6b.js";import"./shared-f8e3be56.js";import"./shared-178f7222.js";import"./shared-5425e3d3.js";import"./shared-11c2efc8.js";import"./shared-9725c399.js";import"./shared-03858aee.js";import"./shared-e2f4962c.js";import"./shared-9271a609.js";import"./foxy-customer-form.js";import"./foxy-nucleon-element.js";import"./shared-b738ee96.js";import"./foxy-address-card.js";import"./shared-c2ec3291.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-82f873bd.js";import"./shared-3b9b9427.js";import"./shared-c0816371.js";import"./shared-99065f2a.js";import"./shared-6f4005e5.js";import"./shared-38ed7905.js";import"./shared-963c4a87.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-06c64816.js";import"./shared-bcc4cf7f.js";import"./foxy-cancellation-form.js";import"./shared-1a9496d4.js";import"./shared-bc7f58ef.js";import"./foxy-transaction-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-cb34d19f.js";import"./shared-9e04b9c3.js";import"./shared-d519a301.js";import"./shared-fcce5337.js";import"./shared-5fbda766.js";import"./shared-4ac2a677.js";let y,b,v=e=>e;class S extends(d(c(l),"customer-portal")){constructor(){super(...arguments),this.transactionsTableColumns=[e.priceColumn,e.summaryColumn,e.statusColumn,e.idColumn,e.dateColumn,e.receiptColumn],this.group=""}static get properties(){return t(t({},super.properties),{},{transactionsTableColumns:{attribute:!1},group:{type:String}})}render(){return this.api.storage.getItem(a.SESSION)?o(y||(y=v` <foxy-internal-customer-portal-logged-in-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" customer="${0}" group="${0}" class="h-full" lang="${0}" href="${0}" ns="${0}" .transactionsTableColumns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.base,this.group,this.lang,new URL("./customer_portal_settings",this.base).toString(),this.ns,this.transactionsTableColumns,this.templates):o(b||(b=v` <foxy-internal-customer-portal-logged-out-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" group="${0}" class="h-full" lang="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-out-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.group,this.lang,this.ns,this.templates)}}let x,_,j=e=>e;const T=m(c(d(u(i))));let w,O,k,E,R=e=>e;class z extends(c(i)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return t(t({},super.properties),{},{disabled:{type:Boolean},href:{type:String},icon:{type:String}})}render(){const e=p({"flex-auto font-medium tracking-wide text-s rounded-s transition-colors":!0,"hover-text-primary hover-cursor-pointer":!this.disabled,"focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2":!this.disabled,"text-disabled cursor-default":this.disabled}),t=o(w||(w=R` ${0} <slot></slot> `),this.icon?o(O||(O=R`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?o(k||(k=R`<button class="${0}" disabled="disabled">${0}</button>`),e,t):o(E||(E=R` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,t)}}let N,A,F,C,I,H,U,q,L,P,D=e=>e;const V=c(f(d(g)));let B,J,W,G,K,M,Q,X,Y,Z,ee=e=>e;const te=c(f(d(u(i))));const se=["html"],re=["html"];let oe,ie,ne,ae,le,de,ce,me,he,ue,pe,fe,ge=e=>e;const $e=d(f(c(u(i))));let ye,be,ve,Se=e=>e;const xe=f(c(d(u(i),"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends V{constructor(){var e;super(...arguments),e=this,this.templates={},this.customer="",this.loggingOutState="idle",this.transactionsTableColumns=[],this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var t,s,r,i,n;const a="customer:header:actions:sign-out",l=this.loggingOutState,d=this.disabledSelector.matches(a)||!(null===(t=this.__customerElement)||void 0===t?void 0:t.in({idle:"snapshot"}))||"idle"!==l,c={"border-radius":"100%",padding:"var(--lumo-space-xs)",display:"flex",margin:"0",cursor:d?"default":"pointer"};return o(N||(N=D` <div style="display:flex;margin-left:var(--lumo-space-m)"> ${0} <vaadin-button data-testid="sign-out" aria-label="${0}" style="${0}" theme="icon" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t("sign_out").toString(),Object.entries(c).reduce(((e,[t,s])=>`${e}${t}:${s};`),""),d,(async function(){try{e.loggingOutState="busy",await new h(e).fetch("foxy://customer-api/session",{method:"DELETE"}),e.loggingOutState="idle"}catch(t){e.loggingOutState="fail",e.loggingOutStateResetTimeout=setTimeout((()=>{e.loggingOutState="idle",e.loggingOutStateResetTimeout=null}),1e3)}}),"idle"===l?o(A||(A=D`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):o(F||(F=D` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0}"> </foxy-spinner> `),"fail"===l?"error":"busy",this.lang,[this.ns,null!==(r=null===(s=customElements.get("foxy-customer"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",null!==(n=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==n?n:""].join(" ")),this.renderTemplateOrSlot(`${a}:after`))},this.__renderSubscriptions=(e,t)=>{const s="customer:subscriptions";return e(C||(C=D`
|
|
2
2
|
${0}
|
|
3
3
|
|
|
4
4
|
<foxy-internal-customer-portal-subscriptions
|
|
@@ -15,7 +15,7 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
15
15
|
</foxy-internal-customer-portal-subscriptions>
|
|
16
16
|
|
|
17
17
|
${0}
|
|
18
|
-
`),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),this.hiddenSelector.zoom(s).toString(),t.group,t.lang,t.ns,this.getNestedTemplates(s),this.data,t.data,this.renderTemplateOrSlot(`${s}:after`))},this.__renderTransactions=(e,t)=>{const s="customer:transactions";return e(I||(I=
|
|
18
|
+
`),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),this.hiddenSelector.zoom(s).toString(),t.group,t.lang,t.ns,this.getNestedTemplates(s),this.data,t.data,this.renderTemplateOrSlot(`${s}:after`))},this.__renderTransactions=(e,t)=>{const s="customer:transactions";return e(I||(I=D`
|
|
19
19
|
${0}
|
|
20
20
|
|
|
21
21
|
<foxy-internal-customer-portal-transactions
|
|
@@ -27,16 +27,17 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
27
27
|
ns=${0}
|
|
28
28
|
.templates=${0}
|
|
29
29
|
.customer=${0}
|
|
30
|
+
.columns=${0}
|
|
30
31
|
>
|
|
31
32
|
</foxy-internal-customer-portal-transactions>
|
|
32
33
|
|
|
33
34
|
${0}
|
|
34
|
-
`),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),this.hiddenSelector.zoom(s).toString(),t.group,t.lang,t.ns,this.getNestedTemplates(s),t.data,this.renderTemplateOrSlot(`${s}:after`))}}static get properties(){return
|
|
35
|
+
`),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),this.hiddenSelector.zoom(s).toString(),t.group,t.lang,t.ns,this.getNestedTemplates(s),t.data,this.transactionsTableColumns,this.renderTemplateOrSlot(`${s}:after`))}}static get properties(){return t(t({},super.properties),{},{customer:{type:String},loggingOutState:{attribute:!1},transactionsTableColumns:{attribute:!1},loggingOutStateResetTimeout:{attribute:!1}})}render(){var e,t;const r=this.hiddenSelector.zoom("customer"),i=new s(["attributes","transactions","subscriptions","addresses:actions:create","header:actions:edit:form:delete",r.toString()].join(" ")).toString(),n=this.getNestedTemplates("customer"),a=n["header:actions:after"],l=n["header:actions:edit:form:timestamps:after"],d=n.default;return n["header:actions:after"]=(e,t)=>{const s=r.matches("header:actions:sign-out",!0);return e(H||(H=D`
|
|
35
36
|
<div style="display:flex">
|
|
36
37
|
${0}
|
|
37
38
|
${0}
|
|
38
39
|
</div>
|
|
39
|
-
`),s?"":this.__renderHeaderActionsSignOut(),null==a?void 0:a(e,t))},n.default=(e,t)=>{const s=this.__renderSubscriptions,
|
|
40
|
+
`),s?"":this.__renderHeaderActionsSignOut(),null==a?void 0:a(e,t))},n.default=(e,t)=>{const s=this.__renderSubscriptions,o=this.__renderTransactions;return e(U||(U=D`
|
|
40
41
|
<style>
|
|
41
42
|
.space-y-m > :not([hidden]) ~ :not([hidden]) {
|
|
42
43
|
--tw-space-y-reverse: 0;
|
|
@@ -51,10 +52,10 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
51
52
|
${0}
|
|
52
53
|
${0}
|
|
53
54
|
</div>
|
|
54
|
-
`),
|
|
55
|
+
`),r.matches("default",!0)?"":null==d?void 0:d(e,t),r.matches("subscriptions",!0)?"":s(e,t),r.matches("transactions",!0)?"":o(e,t))},n["header:actions:edit:form:timestamps:after"]=(e,t)=>{var s,r;const o="change-password";return e(q||(q=D`
|
|
55
56
|
${0}
|
|
56
57
|
${0}
|
|
57
|
-
`),null==l?void 0:l(e,t),t.hiddenSelector.matches(o,!0)?"":e(L||(L=
|
|
58
|
+
`),null==l?void 0:l(e,t),t.hiddenSelector.matches(o,!0)?"":e(L||(L=D`
|
|
58
59
|
${0}
|
|
59
60
|
|
|
60
61
|
<foxy-internal-customer-portal-change-password
|
|
@@ -69,7 +70,7 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
69
70
|
</foxy-internal-customer-portal-change-password>
|
|
70
71
|
|
|
71
72
|
${0}
|
|
72
|
-
`),t.renderTemplateOrSlot(`${o}:before`),t.href,null!==(r=null===(s=t.data)||void 0===s?void 0:s.email)&&void 0!==r?r:"",t.lang,t.ns,t.in("busy")||t.disabledSelector.matches(o,!0),t.renderTemplateOrSlot(`${o}:after`)))},
|
|
73
|
+
`),t.renderTemplateOrSlot(`${o}:before`),t.href,null!==(r=null===(s=t.data)||void 0===s?void 0:s.email)&&void 0!==r?r:"",t.lang,t.ns,t.in("busy")||t.disabledSelector.matches(o,!0),t.renderTemplateOrSlot(`${o}:after`)))},o(P||(P=D` <foxy-customer readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="customer" group="${0}" href="${0}" lang="${0}" ns="${0} ${0}" id="customer" .templates="${0}" @update="${0}"> </foxy-customer> `),this.readonlySelector.zoom("customer").toString(),this.disabledSelector.zoom("customer").toString(),i,this.group,this.customer,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-customer"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",n,(()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.loggingOutStateResetTimeout&&clearTimeout(this.loggingOutStateResetTimeout)}get __customerElement(){return this.renderRoot.querySelector("#customer")}}),customElements.define("foxy-internal-customer-portal-logged-out-view",class extends te{constructor(){super(...arguments),this.group="",this.page="sign-in",this.__renderAccessRecoveryHeader=()=>{var e,t,s,r;const{lang:i,ns:n}=this,a=this.renderRoot.querySelector("#access-recovery-form"),l=!!(null==a?void 0:a.in("busy"));return o(B||(B=ee` <div class="flex flex-col leading-m font-lumo" data-testid="access-recovery:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="recover_access_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:header:before"),l?"text-disabled":"text-body",i,n,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",l?"text-disabled":"text-secondary",i,n,null!==(r=null===(s=customElements.get("foxy-access-recovery-form"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot("access-recovery:header:after"))},this.__renderAccessRecoveryBack=()=>{var e,t;const s=this.renderRoot.querySelector("#access-recovery-form"),r=this.disabledSelector.zoom("access-recovery");return o(J||(J=ee` <div> ${0} <vaadin-button data-testid="access-recovery:back" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="back" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:back:before"),!!(null==s?void 0:s.in("busy"))||r.matches("back",!0),(()=>this.page="sign-in"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("access-recovery:back:after"))},this.__renderAccessRecoveryForm=()=>{var e,t;const s="access-recovery:form",r=this.hiddenSelector.zoom(s);return o(W||(W=ee` <div> ${0} <foxy-access-recovery-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="access-recovery:form" parent="foxy://customer-api/recover" group="${0}" lang="${0}" ns="${0} ${0}" id="access-recovery-form" .templates="${0}" @update="${0}"> </foxy-access-recovery-form> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),r.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates(s),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${s}:after`))},this.__renderAccessRecovery=()=>{const e="access-recovery",t=this.hiddenSelector.zoom(e);return o(G||(G=ee` <div class="h-full flex" data-testid="access-recovery"> <div class="m-auto max-w-20rem flex-1"> ${0} <div class="space-y-l"> ${0} <div class="space-y-s"> ${0} ${0} </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderAccessRecoveryHeader(),t.matches("form",!0)?"":this.__renderAccessRecoveryForm(),t.matches("back",!0)?"":this.__renderAccessRecoveryBack(),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignInHeader=()=>{var e,t,s,r;const{lang:i,ns:n}=this,a=this.renderRoot.querySelector("#sign-in-form"),l=!!(null==a?void 0:a.in("busy"));return o(K||(K=ee` <div class="flex flex-col leading-m font-lumo" data-testid="sign-in:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_in" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_in_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-in:header:before"),l?"text-disabled":"text-body",i,n,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",l?"text-disabled":"text-secondary",i,n,null!==(r=null===(s=customElements.get("foxy-sign-in-form"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot("sign-in:header:after"))},this.__renderSignInRecover=()=>{var e,t;const s=this.renderRoot.querySelector("#sign-in-form"),r=this.disabledSelector.zoom("sign-in");return o(M||(M=ee` <div> ${0} <vaadin-button data-testid="sign-in:recover" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:recover:before"),!!(null==s?void 0:s.in("busy"))||r.matches("recover",!0),(()=>this.page="access-recovery"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("sign-in:recover:after"))},this.__renderSignInForm=()=>{var e,t;const s="sign-in:form",r=this.hiddenSelector.zoom(s);return o(Q||(Q=ee` <div> ${0} <foxy-sign-in-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-in:form" parent="foxy://customer-api/session" group="${0}" lang="${0}" id="sign-in-form" ns="${0} ${0}" .templates="${0}" @update="${0}"> </foxy-sign-in-form> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),r.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates("sign-in:form"),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${s}:after`))},this.__renderSignIn=()=>{const e="sign-in",t=this.hiddenSelector.zoom(e);return o(X||(X=ee` <div class="h-full flex" data-testid="sign-in"> <div class="m-auto max-w-20rem flex-1"> ${0} <div class="space-y-l"> ${0} <div class="space-y-s"> ${0} ${0} </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot("sign-in:before"),t.matches("header",!0)?"":this.__renderSignInHeader(),t.matches("form",!0)?"":this.__renderSignInForm(),t.matches("recover",!0)?"":this.__renderSignInRecover(),this.renderTemplateOrSlot("sign-in:after"))}}static get properties(){return t(t({},super.properties),{},{group:{type:String},page:{type:String}})}static get styles(){return[super.styles,n(Y||(Y=ee`.max-w-20rem{max-width:20rem}`))]}render(){const{page:e,hiddenSelector:t}=this;return"access-recovery"!==e||t.matches("access-recovery",!0)?"sign-in"!==e||t.matches("sign-in",!0)?o(Z||(Z=ee``)):this.__renderSignIn():this.__renderAccessRecovery()}}),customElements.define("foxy-internal-customer-portal-subscriptions",class extends $e{constructor(){super(...arguments),this.settings=null,this.customer=null,this.group="",this.__renderFormHeaderActionsUpdate=(e,t)=>{var s;const r=!!(null===(s=t.data)||void 0===s?void 0:s.end_date)&&new Date(t.data.end_date).getTime()<=Date.now();let o="";if(!r&&t.in({idle:"snapshot"})){const e=t.data._links["fx:sub_token_url"].href,s=new URL(e);s.searchParams.set("cart","checkout"),s.searchParams.set("sub_restart","auto"),o=s.toString()}return e(oe||(oe=ge`
|
|
73
74
|
${0}
|
|
74
75
|
|
|
75
76
|
<foxy-internal-customer-portal-link
|
|
@@ -82,7 +83,7 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
82
83
|
</foxy-internal-customer-portal-link>
|
|
83
84
|
|
|
84
85
|
${0}
|
|
85
|
-
`),t.renderTemplateOrSlot("header:actions:update:before"),o,r||!t.in("idle"),t.lang,t.ns,t.renderTemplateOrSlot("header:actions:update:after"))},this.__renderFormHeaderActionsEnd=(e,t)=>{var s;const r=!!(null===(s=t.data)||void 0===s?void 0:s.end_date);let o="";if(!r&&t.in({idle:"snapshot"})){const e=new URL(t.data._links["fx:sub_token_url"].href);e.searchParams.set("sub_cancel","true"),o=e.toString()}return e(
|
|
86
|
+
`),t.renderTemplateOrSlot("header:actions:update:before"),o,r||!t.in("idle"),t.lang,t.ns,t.renderTemplateOrSlot("header:actions:update:after"))},this.__renderFormHeaderActionsEnd=(e,t)=>{var s;const r=!!(null===(s=t.data)||void 0===s?void 0:s.end_date);let o="";if(!r&&t.in({idle:"snapshot"})){const e=new URL(t.data._links["fx:sub_token_url"].href);e.searchParams.set("sub_cancel","true"),o=e.toString()}return e(ie||(ie=ge`
|
|
86
87
|
${0}
|
|
87
88
|
|
|
88
89
|
<foxy-internal-customer-portal-link
|
|
@@ -95,7 +96,7 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
95
96
|
</foxy-internal-customer-portal-link>
|
|
96
97
|
|
|
97
98
|
${0}
|
|
98
|
-
`),t.renderTemplateOrSlot("header:actions:end:before"),o,r||!t.in("idle"),t.lang,t.ns,t.renderTemplateOrSlot("header:actions:end:after"))},this.__renderFormHeaderActions=(e,t)=>{const s=t.hiddenSelector.matches("header:actions:update"),r=t.hiddenSelector.matches("header:actions:end");return e(
|
|
99
|
+
`),t.renderTemplateOrSlot("header:actions:end:before"),o,r||!t.in("idle"),t.lang,t.ns,t.renderTemplateOrSlot("header:actions:end:after"))},this.__renderFormHeaderActions=(e,t)=>{const s=t.hiddenSelector.matches("header:actions:update"),r=t.hiddenSelector.matches("header:actions:end");return e(ne||(ne=ge`
|
|
99
100
|
<style>
|
|
100
101
|
main {
|
|
101
102
|
display: flex;
|
|
@@ -115,7 +116,7 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
115
116
|
</main>
|
|
116
117
|
|
|
117
118
|
${0}
|
|
118
|
-
`),t.renderTemplateOrSlot("header:actions:before"),s?"":this.__renderFormHeaderActionsUpdate(e,t),r?"":this.__renderFormHeaderActionsEnd(e,t),t.renderTemplateOrSlot("header:actions:after"))},this.__renderFormItemsActionsUpdate=(e,t)=>{var s,r,o,i;const n=null!==(o=null===(r=null===(s=t.data)||void 0===s?void 0:s._links["fx:sub_modification_url"])||void 0===r?void 0:r.href)&&void 0!==o?o:"",a=!!(null===(i=t.data)||void 0===i?void 0:i.end_date)&&new Date(t.data.end_date).getTime()<=Date.now();return e(
|
|
119
|
+
`),t.renderTemplateOrSlot("header:actions:before"),s?"":this.__renderFormHeaderActionsUpdate(e,t),r?"":this.__renderFormHeaderActionsEnd(e,t),t.renderTemplateOrSlot("header:actions:after"))},this.__renderFormItemsActionsUpdate=(e,t)=>{var s,r,o,i;const n=null!==(o=null===(r=null===(s=t.data)||void 0===s?void 0:s._links["fx:sub_modification_url"])||void 0===r?void 0:r.href)&&void 0!==o?o:"",a=!!(null===(i=t.data)||void 0===i?void 0:i.end_date)&&new Date(t.data.end_date).getTime()<=Date.now();return e(ae||(ae=ge`
|
|
119
120
|
${0}
|
|
120
121
|
|
|
121
122
|
<foxy-internal-customer-portal-link
|
|
@@ -128,13 +129,13 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
128
129
|
</foxy-internal-customer-portal-link>
|
|
129
130
|
|
|
130
131
|
${0}
|
|
131
|
-
`),t.renderTemplateOrSlot("items:actions:update:before"),n,a||!t.in("idle"),t.lang,t.ns,t.renderTemplateOrSlot("items:actions:update:after"))},this.__renderForm=
|
|
132
|
+
`),t.renderTemplateOrSlot("items:actions:update:before"),n,a||!t.in("idle"),t.lang,t.ns,t.renderTemplateOrSlot("items:actions:update:after"))},this.__renderForm=e=>{var r,i;const n=t({},e.dialog.templates),a=n["header:after"],l=n["items:actions:after"];return n["header:after"]=(e,t)=>{const s=t.hiddenSelector.matches("header:actions",!0);return e(le||(le=ge`
|
|
132
133
|
${0}
|
|
133
134
|
${0}
|
|
134
|
-
`),s?"":this.__renderFormHeaderActions(e,t),null==a?void 0:a(e,t))},n["items:actions:after"]=(e,t)=>{var s;const r=!!(null===(s=t.data)||void 0===s?void 0:s._links["fx:sub_modification_url"]),o=t.hiddenSelector.matches("items:actions:update",!0);return e(
|
|
135
|
+
`),s?"":this.__renderFormHeaderActions(e,t),null==a?void 0:a(e,t))},n["items:actions:after"]=(e,t)=>{var s;const r=!!(null===(s=t.data)||void 0===s?void 0:s._links["fx:sub_modification_url"]),o=t.hiddenSelector.matches("items:actions:update",!0);return e(de||(de=ge`
|
|
135
136
|
${0}
|
|
136
137
|
${0}
|
|
137
|
-
`),r&&!o?this.__renderFormItemsActionsUpdate(e,t):"",null==l?void 0:l(e,t))},
|
|
138
|
+
`),r&&!o?this.__renderFormItemsActionsUpdate(e,t):"",null==l?void 0:l(e,t))},o(ce||(ce=ge` <foxy-subscription-form disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" settings="${0}" parent="${0}" group="${0}" lang="${0}" href="${0}" ns="${0} ${0}" id="form" .templates="${0}" @update="${0}" @fetch="${0}"> </foxy-subscription-form> `),e.dialog.disabledControls.toString(),e.dialog.readonlyControls.toString(),new s(`attributes timestamps start-date past-due-amount customer ${e.dialog.hiddenSelector}`),JSON.stringify(this.settings),e.dialog.parent,e.dialog.group,e.dialog.lang,e.dialog.href,e.dialog.ns,null!==(i=null===(r=customElements.get("foxy-subscription-form"))||void 0===r?void 0:r.defaultNS)&&void 0!==i?i:"",n,e.handleUpdate,e.handleFetch)},this.__renderPageItem=e=>{let{html:t}=e,s=r(e,se);var o,i;return t(me||(me=ge`
|
|
138
139
|
<button
|
|
139
140
|
class=${0}
|
|
140
141
|
?disabled=${0}
|
|
@@ -151,7 +152,7 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
151
152
|
>
|
|
152
153
|
</foxy-subscription-card>
|
|
153
154
|
</button>
|
|
154
|
-
`),
|
|
155
|
+
`),p({"block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l":!0,"focus-outline-none focus-border-primary":!0,"hover-border-contrast-30":null!==s.data}),null===s.data,(e=>{const t=new URL(s.href);t.searchParams.set("zoom","last_transaction,transaction_template:items"),this.__subscriptionDialog.href=t.toString(),this.__subscriptionDialog.show(e.currentTarget)}),s.parent,s.group,s.lang,s.href,s.ns,null!==(i=null===(o=customElements.get("foxy-subscription-card"))||void 0===o?void 0:o.defaultNS)&&void 0!==i?i:"",s.templates)},this.__renderPage=e=>{let{html:t}=e,s=r(e,re);return t(he||(he=ge`
|
|
155
156
|
<foxy-collection-page
|
|
156
157
|
ns=${0}
|
|
157
158
|
href=${0}
|
|
@@ -162,4 +163,4 @@ import"./foxy-customer.js";import"./shared-c0ec65fa.js";import"./shared-668947de
|
|
|
162
163
|
.templates=${0}
|
|
163
164
|
>
|
|
164
165
|
</foxy-collection-page>
|
|
165
|
-
`),
|
|
166
|
+
`),s.ns,s.href,s.lang,s.group,this.__renderPageItem,s.templates)},this.__renderHeader=()=>o(ue||(ue=ge` ${0} <foxy-i18n class="block text-l font-medium" lang="${0}" key="subscription_plural" ns="${0}"> </foxy-i18n> ${0} `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{var e;const t=this.disabledSelector.zoom("list"),s=this.readonlySelector.zoom("list"),r=[this.hiddenSelector.zoom("list").zoom("form").toString(),"end-date"];return o(pe||(pe=ge` ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" header="update" parent="${0}" group="${0}" lang="${0}" ns="${0}" id="subscription-dialog" .form="${0}" .templates="${0}"> </foxy-form-dialog> <foxy-collection-pages class="block space-y-m" first="${0}" group="${0}" lang="${0}" ns="${0}" manual .page="${0}" .templates="${0}"> </foxy-collection-pages> ${0} `),this.renderTemplateOrSlot("list:before"),s.zoom("form").toString(),t.zoom("form").toString(),r.join(" ").trim(),$(null===(e=this.customer)||void 0===e?void 0:e._links["fx:subscriptions"].href),this.group,this.lang,this.ns,this.__renderForm,this.getNestedTemplates("list:form"),this.__activeSubscriptionsLink,this.group,this.lang,this.ns,this.__renderPage,this.getNestedTemplates("list:card"),this.renderTemplateOrSlot("list:after"))}}static get properties(){return t(t({},super.properties),{},{settings:{attribute:!1},customer:{attribute:!1},group:{type:String}})}render(){return o(fe||(fe=ge` <div class="space-y-s" data-testid="subscriptions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("list",!0)?"":this.__renderList())}get __subscriptionDialog(){return this.renderRoot.querySelector("#subscription-dialog")}get __activeSubscriptionsLink(){try{const e=new URL(this.customer._links["fx:subscriptions"].href);return e.searchParams.set("zoom","last_transaction,transaction_template:items"),e.toString()}catch(e){return""}}}),customElements.define("foxy-internal-customer-portal-transactions",class extends xe{constructor(){super(...arguments),this.customer=null,this.columns=[],this.group="",this.__renderHeader=()=>o(ye||(ye=Se` <div> ${0} <foxy-i18n class="text-l font-medium" lang="${0}" key="transaction_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{let e="";if(this.customer){const t=new URL(this.customer._links["fx:transactions"].href);t.searchParams.set("zoom","items"),e=t.toString()}return o(be||(be=Se` <div> ${0} <foxy-collection-pages spinner="foxy-spinner" group="${0}" first="${0}" class="block divide-y divide-contrast-10 px-m border border-contrast-10 rounded-t-l rounded-b-l" page="foxy-transactions-table" lang="${0}" ns="${0}" manual .templates="${0}" .props="${0}"> </foxy-collection-pages> ${0} </div> `),this.renderTemplateOrSlot("list:before"),this.group,e,this.lang,this.ns,this.getNestedTemplates("table"),{".columns":this.columns},this.renderTemplateOrSlot("list:after"))}}static get properties(){return t(t({},super.properties),{},{customer:{attribute:!1},columns:{attribute:!1},group:{type:String}})}render(){return o(ve||(ve=Se` <div class="space-y-s" data-testid="transactions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header")?"":this.__renderHeader(),this.hiddenSelector.matches("list")?"":this.__renderList())}}),customElements.define("foxy-internal-customer-portal-change-password",class extends T{constructor(){super(...arguments),this.isErrorVisible=!1,this.disabled=!1,this.customer="",this.session="",this.email="",this.step=1,this.__handleTriggerClick=e=>{const t=e.currentTarget,s=this.renderRoot.querySelector("#dialog");this.isErrorVisible=!1,this.step=1,s.show(t)},this.__handleSignInFormUpdate=(e,t)=>{var s,r,o,i;t.handleUpdate(e);const n=e.currentTarget;!(null===(s=n.form.credential)||void 0===s?void 0:s.email)&&this.email&&n.edit({type:null!==(r=n.form.type)&&void 0!==r?r:"password",credential:{email:this.email,password:null!==(i=null===(o=n.form.credential)||void 0===o?void 0:o.password)&&void 0!==i?i:""}})},this.__handleSignInFormFetch=e=>{e.defaultPrevented||"POST"===e.request.method&&e.request.url===this.session&&(e.preventDefault(),e.stopImmediatePropagation(),e.respondWith(this.__getResponse(e.request)))},this.__renderSignInForm=e=>{const t=[],s=["email"];let r="bg-primary-10",i="text-primary",n="icons:lock-outline",a="password:before";return 2===this.step&&(s.push("password"),a="new-password:before",n="icons:lock-open"),3===this.step&&(t.push("new-password"),s.push("password","submit"),r="bg-success-10",i="text-success",a="new-password:before",n="icons:done-all"),this.isErrorVisible||s.push("error"),o(x||(x=j` <foxy-sign-in-form readonlycontrols="${0}" hiddencontrols="${0}" parent="${0}" class="mt-s sm-w-narrow-modal" lang="${0}" ns="${0}" @update="${0}" @fetch="${0}"> <div class="mx-auto flex mb-m w-l h-l rounded-t-l rounded-b-l ${0}" slot="${0}"> <iron-icon icon="${0}" class="m-auto ${0}"></iron-icon> </div> <foxy-i18n class="block text-center text-m text-secondary leading-m mb-m" lang="${0}" slot="${0}" key="change_password_step_${0}" ns="${0}"> </foxy-i18n> </foxy-sign-in-form> `),t.join(" "),s.join(" "),this.session,e.dialog.lang,e.dialog.ns,(t=>this.__handleSignInFormUpdate(t,e)),this.__handleSignInFormFetch,r,a,n,i,e.dialog.lang,a,this.step,e.dialog.ns)}}static get properties(){return t(t({},super.properties),{},{isErrorVisible:{attribute:!1},disabled:{type:Boolean},customer:{type:String},session:{type:String},email:{type:String},step:{attribute:!1},fail:{attribute:!1}})}render(){return o(_||(_=j` <foxy-form-dialog hiddencontrols="save-button" header="change_password" lang="${0}" ns="${0}" alert id="dialog" .form="${0}"> </foxy-form-dialog> <vaadin-button class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="change_password" ns="${0}"></foxy-i18n> </vaadin-button> `),this.lang,this.ns,this.__renderSignInForm,this.disabled,this.__handleTriggerClick,this.lang,this.ns)}async __getResponse(e){const t=await e.clone().json(),s=new h(this);if(this.isErrorVisible=!1,1===this.step){const r=await s.fetch(e.url,{method:e.method,body:JSON.stringify(t)});if(r.ok){this.step=2;const e={_embedded:{"fx:errors":[{code:"new_password_required_error"}]}};return new h.WHATWGResponse(JSON.stringify(e),{status:400})}return this.isErrorVisible=!0,r}if(2===this.step){const r=await s.fetch(this.customer,{method:"PATCH",body:JSON.stringify({password:t.credential.new_password,password_old:t.credential.password})});return r.ok?(this.step=3,t._links={self:{href:e.url}},new h.WHATWGResponse(JSON.stringify(t))):(this.isErrorVisible=!0,r)}return s.fetch(e)}}),customElements.define("foxy-internal-customer-portal-link",z),customElements.define("foxy-customer-portal",S);export{S as CustomerPortal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-fcce5337.js";import"./shared-57c6cfd1.js";import"./shared-5fbda766.js";import"./shared-4ac2a677.js";import"./shared-c0ec65fa.js";import"./shared-9e8bff76.js";import"./shared-24a762c1.js";import"./shared-950875f2.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-b137f17a.js";import{_ as e}from"./shared-98755831.js";import{h as t}from"./shared-7f33a83a.js";import{C as r}from"./shared-de790de9.js";import{N as i}from"./shared-eb900735.js";import{T as n,a}from"./shared-e9c81269.js";import{c as o}from"./shared-4e709717.js";import{i as s}from"./shared-d3bf9ac0.js";import{v as d}from"./shared-b738ee96.js";import"./shared-533c3914.js";import"./shared-b2474263.js";import"./shared-668947de.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){var i,n;void 0===(n="function"==typeof(i=function(){for(var e=[null,[[10,7,17,13],[1,1,1,1],[]],[[16,10,28,22],[1,1,1,1],[4,16]],[[26,15,22,18],[1,1,2,2],[4,20]],[[18,20,16,26],[2,1,4,2],[4,24]],[[24,26,22,18],[2,1,4,4],[4,28]],[[16,18,28,24],[4,2,4,4],[4,32]],[[18,20,26,18],[4,2,5,6],[4,20,36]],[[22,24,26,22],[4,2,6,6],[4,22,40]],[[22,30,24,20],[5,2,8,8],[4,24,44]],[[26,18,28,24],[5,4,8,8],[4,26,48]],[[30,20,24,28],[5,4,11,8],[4,28,52]],[[22,24,28,26],[8,4,11,10],[4,30,56]],[[22,26,22,24],[9,4,16,12],[4,32,60]],[[24,30,24,20],[9,4,16,16],[4,24,44,64]],[[24,22,24,30],[10,6,18,12],[4,24,46,68]],[[28,24,30,24],[10,6,16,17],[4,24,48,72]],[[28,28,28,28],[11,6,19,16],[4,28,52,76]],[[26,30,28,28],[13,6,21,18],[4,28,54,80]],[[26,28,26,26],[14,7,25,21],[4,28,56,84]],[[26,28,28,30],[16,8,25,20],[4,32,60,88]],[[26,28,30,28],[17,8,25,23],[4,26,48,70,92]],[[28,28,24,30],[17,9,34,23],[4,24,48,72,96]],[[28,30,30,30],[18,9,30,25],[4,28,52,76,100]],[[28,30,30,30],[20,10,32,27],[4,26,52,78,104]],[[28,26,30,30],[21,12,35,29],[4,30,56,82,108]],[[28,28,30,28],[23,12,37,34],[4,28,56,84,112]],[[28,30,30,30],[25,12,40,34],[4,32,60,88,116]],[[28,30,30,30],[26,13,42,35],[4,24,48,72,96,120]],[[28,30,30,30],[28,14,45,38],[4,28,52,76,100,124]],[[28,30,30,30],[29,15,48,40],[4,24,50,76,102,128]],[[28,30,30,30],[31,16,51,43],[4,28,54,80,106,132]],[[28,30,30,30],[33,17,54,45],[4,32,58,84,110,136]],[[28,30,30,30],[35,18,57,48],[4,28,56,84,112,140]],[[28,30,30,30],[37,19,60,51],[4,32,60,88,116,144]],[[28,30,30,30],[38,19,63,53],[4,28,52,76,100,124,148]],[[28,30,30,30],[40,20,66,56],[4,22,48,74,100,126,152]],[[28,30,30,30],[43,21,70,59],[4,26,52,78,104,130,156]],[[28,30,30,30],[45,22,74,62],[4,30,56,82,108,134,160]],[[28,30,30,30],[47,24,77,65],[4,24,52,80,108,136,164]],[[28,30,30,30],[49,25,81,68],[4,28,56,84,112,140,168]]],t=/^\d*$/,r=/^[A-Za-z0-9 $%*+\-.\/:]*$/,i=/^[A-Z0-9 $%*+\-.\/:]*$/,n=[],a=[-1],o=0,s=1;o<255;++o)n.push(s),a[s]=o,s=2*s^(s>=128?285:0);var d=[[]];for(o=0;o<30;++o){for(var l=d[o],c=[],u=0;u<=o;++u){var f=u<o?n[l[u]]:0,h=n[(o+(l[u-1]||0))%255];c.push(a[f^h])}d.push(c)}var m={};for(o=0;o<45;++o)m["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".charAt(o)]=o;var p=[function(e,t){return(e+t)%2==0},function(e,t){return e%2==0},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return((e/2|0)+(t/3|0))%2==0},function(e,t){return e*t%2+e*t%3==0},function(e,t){return(e*t%2+e*t%3)%2==0},function(e,t){return((e+t)%2+e*t%3)%2==0}],v=function(e){return e>6},b=function(t,r){var i=-8&function(t){var r=e[t],i=16*t*t+128*t+64;return v(t)&&(i-=36),r[2].length&&(i-=25*r[2].length*r[2].length-10*r[2].length-55),i}(t),n=e[t];return i-8*n[0][r]*n[1][r]},g=function(e,t){switch(t){case 1:return e<10?10:e<27?12:14;case 2:return e<10?9:e<27?11:13;case 4:return e<10?8:16;case 8:return e<10?8:e<27?10:12}},y=function(e,t,r){var i=b(e,r)-4-g(e,t);switch(t){case 1:return 3*(i/10|0)+(i%10<4?0:i%10<7?1:2);case 2:return 2*(i/11|0)+(i%11<6?0:1);case 4:return i/8|0;case 8:return i/13|0}},_=function(e,t){for(var r=e.slice(0),i=e.length,o=t.length,s=0;s<o;++s)r.push(0);for(s=0;s<i;){var d=a[r[s++]];if(d>=0)for(var l=0;l<o;++l)r[s+l]^=n[(d+t[l])%255]}return r.slice(i)},w=function(e,t,r,i){for(var n=e<<i,a=t-1;a>=0;--a)n>>i+a&1&&(n^=r<<a);return e<<i|n},$=function(e,t,r){for(var i=p[r],n=e.length,a=0;a<n;++a)for(var o=0;o<n;++o)t[a][o]||(e[a][o]^=i(a,o));return e},S=function(e,t,r,i){for(var n=e.length,a=21522^w(r<<3|i,5,1335,10),o=0;o<15;++o){var s=[n-1,n-2,n-3,n-4,n-5,n-6,n-7,n-8,7,5,4,3,2,1,0][o];e[[0,1,2,3,4,5,7,8,n-7,n-6,n-5,n-4,n-3,n-2,n-1][o]][8]=e[8][s]=a>>o&1}return e},x=function(e){for(var t=function(e){for(var t=0,r=0;r<e.length;++r)e[r]>=5&&(t+=e[r]-5+3);for(r=5;r<e.length;r+=2){var i=e[r];e[r-1]==i&&e[r-2]==3*i&&e[r-3]==i&&e[r-4]==i&&(e[r-5]>=4*i||e[r+1]>=4*i)&&(t+=40)}return t},r=e.length,i=0,n=0,a=0;a<r;++a){var o,s=e[a];o=[0];for(var d=0;d<r;){for(l=0;d<r&&s[d];++l)++d;for(o.push(l),l=0;d<r&&!s[d];++l)++d;o.push(l)}i+=t(o),o=[0];for(d=0;d<r;){var l;for(l=0;d<r&&e[d][a];++l)++d;for(o.push(l),l=0;d<r&&!e[d][a];++l)++d;o.push(l)}i+=t(o);var c=e[a+1]||[];n+=s[0];for(d=1;d<r;++d){var u=s[d];n+=u,s[d-1]==u&&c[d]===u&&c[d-1]===u&&(i+=3)}}return i+10*(Math.abs(n/r/r-.5)/.05|0)},k=function(t,r,i,n,a){var o=e[r],s=function(e,t,r,i){var n=[],a=0,o=8,s=r.length,d=function(e,t){if(t>=o){for(n.push(a|e>>(t-=o));t>=8;)n.push(e>>(t-=8)&255);a=0,o=8}t>0&&(a|=(e&(1<<t)-1)<<(o-=t))},l=g(e,t);switch(d(t,4),d(s,l),t){case 1:for(var c=2;c<s;c+=3)d(parseInt(r.substring(c-2,c+1),10),10);d(parseInt(r.substring(c-2),10),[0,4,7][s%3]);break;case 2:for(c=1;c<s;c+=2)d(45*m[r.charAt(c-1)]+m[r.charAt(c)],11);s%2==1&&d(m[r.charAt(c-1)],6);break;case 4:for(c=0;c<s;++c)d(r[c],8)}for(d(0,4),o<8&&n.push(a);n.length+1<i;)n.push(236,17);return n.length<i&&n.push(236),n}(r,i,t,b(r,n)>>3);s=function(e,t,r){for(var i=[],n=e.length/t|0,a=0,o=t-e.length%t,s=0;s<o;++s)i.push(a),a+=n;for(s=o;s<t;++s)i.push(a),a+=n+1;i.push(a);var d=[];for(s=0;s<t;++s)d.push(_(e.slice(i[s],i[s+1]),r));var l=[],c=e.length/t|0;for(s=0;s<c;++s)for(var u=0;u<t;++u)l.push(e[i[u]+s]);for(u=o;u<t;++u)l.push(e[i[u+1]-1]);for(s=0;s<r.length;++s)for(u=0;u<t;++u)l.push(d[u][s]);return l}(s,o[1][n],d[o[0][n]]);var l=function(t){for(var r=e[t],i=function(e){return 4*e+17}(t),n=[],a=[],o=0;o<i;++o)n.push([]),a.push([]);var s=function(e,t,r,i,o){for(var s=0;s<r;++s)for(var d=0;d<i;++d)n[e+s][t+d]=o[s]>>d&1,a[e+s][t+d]=1};s(0,0,9,9,[127,65,93,93,93,65,383,0,64]),s(i-8,0,8,9,[256,127,65,93,93,93,65,127]),s(0,i-8,9,8,[254,130,186,186,186,130,254,0,0]);for(o=9;o<i-8;++o)n[6][o]=n[o][6]=1&~o,a[6][o]=a[o][6]=1;var d=r[2],l=d.length;for(o=0;o<l;++o)for(var c=0==o?l-1:l,u=0==o||o==l-1?1:0;u<c;++u)s(d[o],d[u],5,5,[31,17,21,17,31]);if(v(t)){var f=w(t,6,7973,12),h=0;for(o=0;o<6;++o)for(u=0;u<3;++u)n[o][i-11+u]=n[i-11+u][o]=f>>h++&1,a[o][i-11+u]=a[i-11+u][o]=1}return{matrix:n,reserved:a}}(r),c=l.matrix,u=l.reserved;if(function(e,t,r){for(var i=e.length,n=0,a=-1,o=i-1;o>=0;o-=2){6==o&&--o;for(var s=a<0?i-1:0,d=0;d<i;++d){for(var l=o;l>o-2;--l)t[s][l]||(e[s][l]=r[n>>3]>>(7&~n)&1,++n);s+=a}a=-a}}(c,u,s),a<0){$(c,u,0),S(c,0,n,0);var f=0,h=x(c);for($(c,u,0),a=1;a<8;++a){$(c,u,a),S(c,0,n,a);var p=x(c);h>p&&(h=p,f=a),$(c,u,a)}a=f}return $(c,u,a),S(c,0,n,a),c},j={generate:function(e,n){var a=(n=n||{}).version||-1,o={L:1,M:0,Q:3,H:2}[(n.ecclevel||"L").toUpperCase()],s=n.mode?{numeric:1,alphanumeric:2,octet:4}[n.mode.toLowerCase()]:-1,d="mask"in n?n.mask:-1;if(s<0)s="string"==typeof e?e.match(t)?1:e.match(i)?2:4:4;else if(1!=s&&2!=s&&4!=s)throw"invalid or unsupported mode";if(null===(e=function(e,i){switch(e){case 1:return i.match(t)?i:null;case 2:return i.match(r)?i.toUpperCase():null;case 4:if("string"==typeof i){for(var n=[],a=0;a<i.length;++a){var o=i.charCodeAt(a);o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}return i}}(s,e)))throw"invalid data format";if(o<0||o>3)throw"invalid ECC level";if(a<0){for(a=1;a<=40&&!(e.length<=y(a,s,o));++a);if(a>40)throw"too large data"}else if(a<1||a>40)throw"invalid version";if(-1!=d&&(d<0||d>8))throw"invalid mask";return k(e,a,s,o,d)},generateHTML:function(e,t){t=t||{};for(var r=j.generate(e,t),i=Math.max(t.modulesize||5,.5),n=Math.max(null!==t.margin?t.margin:4,0),a=document.createElement("div"),o=r.length,s=['<table border="0" cellspacing="0" cellpadding="0" style="border:'+i*n+'px solid #fff;background:#fff">'],d=0;d<o;++d){s.push("<tr>");for(var l=0;l<o;++l)s.push('<td style="width:'+i+"px;height:"+i+"px"+(r[d][l]?";background:#000":"")+'"></td>');s.push("</tr>")}return a.className="qrcode",a.innerHTML=s.join("")+"</table>",a},generateSVG:function(e,t){t=t||{};var r=j.generate(e,t),i=r.length,n=Math.max(t.modulesize||5,.5),a=Math.max(null!==t.margin?t.margin:4,0),o=n*(i+2*a),s=' class= "fg" width="'+n+'" height="'+n+'"/>',d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 "+o+" "+o),d.setAttribute("style","shape-rendering:crispEdges"),t.modulesize&&(d.setAttribute("width",o),d.setAttribute("height",o));for(var l=["<style scoped>.bg{fill:#FFF}.fg{fill:#000}</style>",'<rect class="bg" x="0" y="0"','width="'+o+'" height="'+o+'"/>'],c=a*n,u=0;u<i;++u){for(var f=a*n,h=0;h<i;++h)r[u][h]&&l.push('<rect x="'+f+'" y="'+c+'"',s),f+=n;c+=n}return d.innerHTML=l.join(""),d},generatePNG:function(e,t){t=t||{};var r,i=j.generate(e,t),n=Math.max(t.modulesize||5,.5),a=Math.max(null!==t.margin?t.margin:4,0),o=i.length,s=n*(o+2*a),d=document.createElement("canvas");if(d.width=d.height=s,!(r=d.getContext("2d")))throw"canvas support is needed for PNG output";r.fillStyle="#fff",r.fillRect(0,0,s,s),r.fillStyle="#000";for(var l=0;l<o;++l)for(var c=0;c<o;++c)i[l][c]&&r.fillRect(n*(a+c),n*(a+l),n,n);return d.toDataURL()}};return j})?i.apply(t,[]):i)||(e.exports=n)},function(e,t,r){r.r(t);var i=r(0),n=r.n(i);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return l(e,arguments,u(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),c(i,e)})(e)}function l(e,t,r){return(l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var n=new(Function.bind.apply(e,i));return r&&c(n,r.prototype),n}).apply(null,arguments)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=function(e){function t(){var e,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this,(e=!(r=u(t).call(this))||"object"!==a(r)&&"function"!=typeof r?s(this):r)._defineProperty=e._defineProperty.bind(s(e)),e.attachShadow({mode:"open"}),Object.keys(t.defaultAttributes).map(e._defineProperty),e}var r,i,l;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,d(HTMLElement)),r=t,l=[{key:"defaultAttributes",get:function(){return{data:null,format:"png",modulesize:5,margin:4}}},{key:"observedAttributes",get:function(){return Object.keys(t.defaultAttributes)}}],(i=[{key:"attributeChangedCallback",value:function(e,t,r){var i=this[e+"Changed"];i&&"function"==typeof i&&i.call(this,t,r),this.generate()}},{key:"_defineProperty",value:function(e){var r=this;Object.defineProperty(this,e,{get:function(){var i=r.getAttribute(e);return null===i?t.defaultAttributes[e]:i},set:function(t){r.setAttribute(e,t)}})}},{key:"getOptions",value:function(){var e=this.modulesize,t=this.margin;return{modulesize:null!==e?parseInt(e):e,margin:null!==t?parseInt(t):t}}},{key:"generate",value:function(){null!==this.data?"png"===this.format?this.generatePNG():"html"===this.format?this.generateHTML():"svg"===this.format?this.generateSVG():this.shadowRoot.innerHTML="<div>qr-code: "+this.format+" not supported!</div>":this.shadowRoot.innerHTML="<div>qr-code: no data!</div>"}},{key:"generatePNG",value:function(){try{var e=document.createElement("img");e.src=n.a.generatePNG(this.data,this.getOptions()),this.clear(),this.shadowRoot.appendChild(e)}catch(e){this.shadowRoot.innerHTML="<div>qr-code: no canvas support!</div>"}}},{key:"generateHTML",value:function(){var e=n.a.generateHTML(this.data,this.getOptions());this.clear(),this.shadowRoot.appendChild(e)}},{key:"generateSVG",value:function(){var e=n.a.generateSVG(this.data,this.getOptions());this.clear(),this.shadowRoot.appendChild(e)}},{key:"clear",value:function(){for(;this.shadowRoot.lastChild;)this.shadowRoot.removeChild(this.shadowRoot.lastChild)}}])&&o(r.prototype,i),l&&o(r,l),t}();customElements.define("qr-code",f)}]);let l,c,u,f,h,m,p,v,b,g=e=>e;const y=n(r(a(i,"sign-in-form")));class _ extends y{constructor(){super(...arguments),this.templates={},this.issuer="Unknown",this.__emailValidator=()=>!this.errors.some((e=>e.startsWith("email"))),this.__passwordValidator=()=>!this.errors.some((e=>e.startsWith("password"))),this.__newPasswordValidator=()=>!this.errors.some((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),this.__mfaTotpCodeValidator=()=>!this.errors.some((e=>e.startsWith("mfa_totp_code")&&!e.endsWith("_error"))),this.__renderEmail=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:n}=this,a=n.find((e=>e.startsWith("email"))),o=null==a?void 0:a.replace("email","v8n"),d=o?this.t(o).toString():"",c=this.in("busy");return t(l||(l=g` <div> ${0} <vaadin-email-field error-message="${0}" data-testid="email" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-email-field> ${0} </div> `),this.renderTemplateOrSlot("email:before"),d,this.t("email").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.email),c||r.matches("email",!0),i.matches("email",!0),this.__emailValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=e.target.value,n=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.password)&&void 0!==r?r:"";this.edit({credential:{email:i,password:n},type:"password"})}),this.renderTemplateOrSlot("email:after"))},this.__renderPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:n}=this,a=n.find((e=>e.startsWith("password"))),o=null==a?void 0:a.replace("password","v8n"),d=o?this.t(o).toString():"",l=this.in("busy");return t(c||(c=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("password:before"),d,this.t("password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.password),l||r.matches("password",!0),i.matches("password",!0),this.__passwordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",n=e.target.value;this.edit({credential:{email:i,password:n},type:"password"})}),this.renderTemplateOrSlot("password:after"))},this.__renderNewPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:n}=this,a=n.find((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),o=null==a?void 0:a.replace("new_password","v8n"),d=o?this.t(o).toString():"",l=this.in("busy");return t(u||(u=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="new-password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("new-password:before"),d,this.t("new_password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.new_password),l||r.matches("new-password",!0),i.matches("new-password",!0),this.__newPasswordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r,i,n;this.edit({type:"password",credential:{email:null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",password:null!==(n=null===(i=this.form.credential)||void 0===i?void 0:i.password)&&void 0!==n?n:"",new_password:e.target.value}})}),this.renderTemplateOrSlot("new-password:after"))},this.__renderMfaTotpCode=()=>{var r;const{disabledSelector:i,readonlySelector:n,errors:a}=this,o=this.__mfaSecretCode,d="mfa_totp_code",l="mfa-totp-code",c=a.find((e=>e.startsWith(d)&&!e.endsWith("_error"))),u=null==c?void 0:c.replace(d,"v8n"),h=u?this.t(u).toString():"",m=this.in("busy");return t(f||(f=g` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" placeholder="123456" data-testid="${0}" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" autofocus @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${l}:before`),h,o?this.t("mfa_totp_code_hint"):"",l,this.t(d).toString(),s(null===(r=this.form.credential)||void 0===r?void 0:r.mfa_totp_code),m||i.matches(l,!0),n.matches(l,!0),this.__mfaTotpCodeValidator,(e=>"Enter"===e.key&&this.submit()),(t=>{const r=t.target.value,i=e(e({},this.form.credential),{},{mfa_totp_code:r});o&&(i.mfa_secret_code=o),this.edit({type:"password",credential:i})}),this.renderTemplateOrSlot(`${l}:after`))},this.__renderMfaSecretCode=()=>{var e,r;const i="mfa-secret-code",n=this.__mfaSecretCode,a=encodeURIComponent(this.issuer),o=encodeURIComponent(null!==(r=null===(e=this.form.credential)||void 0===e?void 0:e.email)&&void 0!==r?r:""),s=new URL(`otpauth://totp/${a}:${o}`);return s.searchParams.set("secret",n),s.searchParams.set("issuer",this.issuer),t(h||(h=g` <div> ${0} <div data-testid="${0}" class="flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10" style="background:#fff;color:#000"> <qr-code modulesize="2" margin="0" format="svg" class="inline-flex" data="${0}"> </qr-code> <div class="break-all font-medium leading-s text-xs tracking-widest"> ${0} </div> </div> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),i,s.toString(),n,this.renderTemplateOrSlot(`${i}:after`))},this.__renderMfaRememberDevice=()=>{var r;const{__mfaSecretCode:i,form:n,lang:a,ns:o}=this,s="mfa-remember-device",d=this.in("busy")||this.disabledSelector.matches(s,!0);return t(m||(m=g` <div> ${0} <vaadin-checkbox data-testid="${0}" class="mb-m" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block" lang="${0}" key="mfa_remember_device" ns="${0}"></foxy-i18n> <foxy-i18n class="block text-xs ${0}" lang="${0}" key="mfa_remember_device_hint" ns="${0}"> </foxy-i18n> </vaadin-checkbox> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),s,d,!!(null===(r=n.credential)||void 0===r?void 0:r.mfa_remember_device),(t=>{var r,a;const o=t.currentTarget,s=e(e({},n.credential),{},{mfa_remember_device:o.checked,mfa_totp_code:null!==(a=null===(r=n.credential)||void 0===r?void 0:r.mfa_totp_code)&&void 0!==a?a:""});i&&(s.mfa_secret_code=i),this.edit({credential:s})}),a,o,d?"text-disabled":"text-secondary",a,o,this.renderTemplateOrSlot(`${s}:after`))},this.__renderError=()=>t(p||(p=g` <div> ${0} <p class="leading-s flex items-start text-s rounded p-s bg-error-10 text-error"> <iron-icon class="flex-shrink-0 mr-s icon-inline text-l" icon="lumo:error"></iron-icon> <foxy-i18n data-testid="error" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </p> ${0} </div> `),this.renderTemplateOrSlot("error:before"),this.lang,this.errors[0],this.ns,this.renderTemplateOrSlot("error:after")),this.__renderSubmit=()=>{const e=this.in({idle:{snapshot:{dirty:"valid"}}})||this.in({idle:{snapshot:{clean:"valid"}}})||this.in({idle:{template:{dirty:"valid"}}})||this.in({idle:{template:{clean:"valid"}}});return t(v||(v=g` <div> ${0} <vaadin-button data-testid="submit" class="w-full mt-m" theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="sign_in"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("submit:before"),!e||this.in("busy")||this.disabledSelector.matches("submit",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("submit:after"))}}static get properties(){return e(e({},super.properties),{},{issuer:{type:String}})}static get v8n(){return[({credential:e})=>!!(null==e?void 0:e.email)||"email_required",({credential:e})=>{var t;return d(null!==(t=null==e?void 0:e.email)&&void 0!==t?t:"")||"email_invalid_email"},({credential:e})=>!!(null==e?void 0:e.password)||"password_required",({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.new_password)||void 0===t?void 0:t.length)||"new_password_required"},({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.mfa_totp_code)||void 0===t?void 0:t.length)||"mfa_totp_code_required"}]}render(){var e,r,i,n;const{hiddenSelector:a,errors:s,lang:d,form:l,ns:c}=this,u=this.__mfaSecretCode,f=null===(e=l.credential)||void 0===e?void 0:e.mfa_totp_code,h=!!u||!!f||s.some((e=>e.startsWith("mfa"))),m="string"==typeof(null===(r=this.form.credential)||void 0===r?void 0:r.new_password)||s.some((e=>e.startsWith("new_password_"))),p=!h&&!f||a.matches("mfa-totp-code",!0),v=!h||h&&u||a.matches("mfa-remember-device",!0),y=!u||a.matches("mfa-secret-code",!0),_=h||a.matches("new-password",!0),w=s.some((e=>e.endsWith("_error"))),$=this.in("busy");return t(b||(b=g` <main aria-live="polite" aria-busy="${0}" class="relative font-lumo text-m leading-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="busy" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </main> `),$,a.matches("email",!0)?"":this.__renderEmail(),h||a.matches("password",!0)?"":this.__renderPassword(),_||!m?"":this.__renderNewPassword(),p?"":this.__renderMfaTotpCode(),y?"":this.__renderMfaSecretCode(),v?"":this.__renderMfaRememberDevice(),a.matches("error",!0)||!w?"":this.__renderError(),a.matches("submit",!0)?"":this.__renderSubmit(),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!$}),d,c,null!==(n=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==n?n:"")}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t="unknown_error";try{const r=(await e.json())._embedded["fx:errors"][0].code;"string"==typeof r&&(t=r)}catch(e){}throw[t]}}get __mfaSecretCode(){var e;const t=null===(e=this.form.credential)||void 0===e?void 0:e.mfa_secret_code;if(t)return t;const r="mfa_required",i=this.errors.find((e=>e.startsWith(r)));return null==i?void 0:i.replace(r,"").trim()}}customElements.define("foxy-sign-in-form",_);export{_ as SignInForm};
|
|
1
|
+
import"./shared-fcce5337.js";import"./shared-57c6cfd1.js";import"./shared-5fbda766.js";import"./shared-4ac2a677.js";import"./shared-c0ec65fa.js";import"./shared-9e8bff76.js";import"./shared-24a762c1.js";import"./shared-950875f2.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-b137f17a.js";import{_ as e}from"./shared-98755831.js";import{h as t}from"./shared-7f33a83a.js";import{C as r}from"./shared-de790de9.js";import{N as i}from"./shared-eb900735.js";import{T as n,a}from"./shared-e9c81269.js";import{c as o}from"./shared-4e709717.js";import{i as s}from"./shared-d3bf9ac0.js";import{v as d}from"./shared-b738ee96.js";import"./shared-533c3914.js";import"./shared-b2474263.js";import"./shared-668947de.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){var i,n;void 0===(n="function"==typeof(i=function(){for(var e=[null,[[10,7,17,13],[1,1,1,1],[]],[[16,10,28,22],[1,1,1,1],[4,16]],[[26,15,22,18],[1,1,2,2],[4,20]],[[18,20,16,26],[2,1,4,2],[4,24]],[[24,26,22,18],[2,1,4,4],[4,28]],[[16,18,28,24],[4,2,4,4],[4,32]],[[18,20,26,18],[4,2,5,6],[4,20,36]],[[22,24,26,22],[4,2,6,6],[4,22,40]],[[22,30,24,20],[5,2,8,8],[4,24,44]],[[26,18,28,24],[5,4,8,8],[4,26,48]],[[30,20,24,28],[5,4,11,8],[4,28,52]],[[22,24,28,26],[8,4,11,10],[4,30,56]],[[22,26,22,24],[9,4,16,12],[4,32,60]],[[24,30,24,20],[9,4,16,16],[4,24,44,64]],[[24,22,24,30],[10,6,18,12],[4,24,46,68]],[[28,24,30,24],[10,6,16,17],[4,24,48,72]],[[28,28,28,28],[11,6,19,16],[4,28,52,76]],[[26,30,28,28],[13,6,21,18],[4,28,54,80]],[[26,28,26,26],[14,7,25,21],[4,28,56,84]],[[26,28,28,30],[16,8,25,20],[4,32,60,88]],[[26,28,30,28],[17,8,25,23],[4,26,48,70,92]],[[28,28,24,30],[17,9,34,23],[4,24,48,72,96]],[[28,30,30,30],[18,9,30,25],[4,28,52,76,100]],[[28,30,30,30],[20,10,32,27],[4,26,52,78,104]],[[28,26,30,30],[21,12,35,29],[4,30,56,82,108]],[[28,28,30,28],[23,12,37,34],[4,28,56,84,112]],[[28,30,30,30],[25,12,40,34],[4,32,60,88,116]],[[28,30,30,30],[26,13,42,35],[4,24,48,72,96,120]],[[28,30,30,30],[28,14,45,38],[4,28,52,76,100,124]],[[28,30,30,30],[29,15,48,40],[4,24,50,76,102,128]],[[28,30,30,30],[31,16,51,43],[4,28,54,80,106,132]],[[28,30,30,30],[33,17,54,45],[4,32,58,84,110,136]],[[28,30,30,30],[35,18,57,48],[4,28,56,84,112,140]],[[28,30,30,30],[37,19,60,51],[4,32,60,88,116,144]],[[28,30,30,30],[38,19,63,53],[4,28,52,76,100,124,148]],[[28,30,30,30],[40,20,66,56],[4,22,48,74,100,126,152]],[[28,30,30,30],[43,21,70,59],[4,26,52,78,104,130,156]],[[28,30,30,30],[45,22,74,62],[4,30,56,82,108,134,160]],[[28,30,30,30],[47,24,77,65],[4,24,52,80,108,136,164]],[[28,30,30,30],[49,25,81,68],[4,28,56,84,112,140,168]]],t=/^\d*$/,r=/^[A-Za-z0-9 $%*+\-.\/:]*$/,i=/^[A-Z0-9 $%*+\-.\/:]*$/,n=[],a=[-1],o=0,s=1;o<255;++o)n.push(s),a[s]=o,s=2*s^(s>=128?285:0);var d=[[]];for(o=0;o<30;++o){for(var l=d[o],c=[],u=0;u<=o;++u){var f=u<o?n[l[u]]:0,h=n[(o+(l[u-1]||0))%255];c.push(a[f^h])}d.push(c)}var m={};for(o=0;o<45;++o)m["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".charAt(o)]=o;var p=[function(e,t){return(e+t)%2==0},function(e,t){return e%2==0},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return((e/2|0)+(t/3|0))%2==0},function(e,t){return e*t%2+e*t%3==0},function(e,t){return(e*t%2+e*t%3)%2==0},function(e,t){return((e+t)%2+e*t%3)%2==0}],v=function(e){return e>6},b=function(t,r){var i=-8&function(t){var r=e[t],i=16*t*t+128*t+64;return v(t)&&(i-=36),r[2].length&&(i-=25*r[2].length*r[2].length-10*r[2].length-55),i}(t),n=e[t];return i-8*n[0][r]*n[1][r]},g=function(e,t){switch(t){case 1:return e<10?10:e<27?12:14;case 2:return e<10?9:e<27?11:13;case 4:return e<10?8:16;case 8:return e<10?8:e<27?10:12}},y=function(e,t,r){var i=b(e,r)-4-g(e,t);switch(t){case 1:return 3*(i/10|0)+(i%10<4?0:i%10<7?1:2);case 2:return 2*(i/11|0)+(i%11<6?0:1);case 4:return i/8|0;case 8:return i/13|0}},_=function(e,t){for(var r=e.slice(0),i=e.length,o=t.length,s=0;s<o;++s)r.push(0);for(s=0;s<i;){var d=a[r[s++]];if(d>=0)for(var l=0;l<o;++l)r[s+l]^=n[(d+t[l])%255]}return r.slice(i)},w=function(e,t,r,i){for(var n=e<<i,a=t-1;a>=0;--a)n>>i+a&1&&(n^=r<<a);return e<<i|n},$=function(e,t,r){for(var i=p[r],n=e.length,a=0;a<n;++a)for(var o=0;o<n;++o)t[a][o]||(e[a][o]^=i(a,o));return e},S=function(e,t,r,i){for(var n=e.length,a=21522^w(r<<3|i,5,1335,10),o=0;o<15;++o){var s=[n-1,n-2,n-3,n-4,n-5,n-6,n-7,n-8,7,5,4,3,2,1,0][o];e[[0,1,2,3,4,5,7,8,n-7,n-6,n-5,n-4,n-3,n-2,n-1][o]][8]=e[8][s]=a>>o&1}return e},x=function(e){for(var t=function(e){for(var t=0,r=0;r<e.length;++r)e[r]>=5&&(t+=e[r]-5+3);for(r=5;r<e.length;r+=2){var i=e[r];e[r-1]==i&&e[r-2]==3*i&&e[r-3]==i&&e[r-4]==i&&(e[r-5]>=4*i||e[r+1]>=4*i)&&(t+=40)}return t},r=e.length,i=0,n=0,a=0;a<r;++a){var o,s=e[a];o=[0];for(var d=0;d<r;){for(l=0;d<r&&s[d];++l)++d;for(o.push(l),l=0;d<r&&!s[d];++l)++d;o.push(l)}i+=t(o),o=[0];for(d=0;d<r;){var l;for(l=0;d<r&&e[d][a];++l)++d;for(o.push(l),l=0;d<r&&!e[d][a];++l)++d;o.push(l)}i+=t(o);var c=e[a+1]||[];n+=s[0];for(d=1;d<r;++d){var u=s[d];n+=u,s[d-1]==u&&c[d]===u&&c[d-1]===u&&(i+=3)}}return i+10*(Math.abs(n/r/r-.5)/.05|0)},k=function(t,r,i,n,a){var o=e[r],s=function(e,t,r,i){var n=[],a=0,o=8,s=r.length,d=function(e,t){if(t>=o){for(n.push(a|e>>(t-=o));t>=8;)n.push(e>>(t-=8)&255);a=0,o=8}t>0&&(a|=(e&(1<<t)-1)<<(o-=t))},l=g(e,t);switch(d(t,4),d(s,l),t){case 1:for(var c=2;c<s;c+=3)d(parseInt(r.substring(c-2,c+1),10),10);d(parseInt(r.substring(c-2),10),[0,4,7][s%3]);break;case 2:for(c=1;c<s;c+=2)d(45*m[r.charAt(c-1)]+m[r.charAt(c)],11);s%2==1&&d(m[r.charAt(c-1)],6);break;case 4:for(c=0;c<s;++c)d(r[c],8)}for(d(0,4),o<8&&n.push(a);n.length+1<i;)n.push(236,17);return n.length<i&&n.push(236),n}(r,i,t,b(r,n)>>3);s=function(e,t,r){for(var i=[],n=e.length/t|0,a=0,o=t-e.length%t,s=0;s<o;++s)i.push(a),a+=n;for(s=o;s<t;++s)i.push(a),a+=n+1;i.push(a);var d=[];for(s=0;s<t;++s)d.push(_(e.slice(i[s],i[s+1]),r));var l=[],c=e.length/t|0;for(s=0;s<c;++s)for(var u=0;u<t;++u)l.push(e[i[u]+s]);for(u=o;u<t;++u)l.push(e[i[u+1]-1]);for(s=0;s<r.length;++s)for(u=0;u<t;++u)l.push(d[u][s]);return l}(s,o[1][n],d[o[0][n]]);var l=function(t){for(var r=e[t],i=function(e){return 4*e+17}(t),n=[],a=[],o=0;o<i;++o)n.push([]),a.push([]);var s=function(e,t,r,i,o){for(var s=0;s<r;++s)for(var d=0;d<i;++d)n[e+s][t+d]=o[s]>>d&1,a[e+s][t+d]=1};s(0,0,9,9,[127,65,93,93,93,65,383,0,64]),s(i-8,0,8,9,[256,127,65,93,93,93,65,127]),s(0,i-8,9,8,[254,130,186,186,186,130,254,0,0]);for(o=9;o<i-8;++o)n[6][o]=n[o][6]=1&~o,a[6][o]=a[o][6]=1;var d=r[2],l=d.length;for(o=0;o<l;++o)for(var c=0==o?l-1:l,u=0==o||o==l-1?1:0;u<c;++u)s(d[o],d[u],5,5,[31,17,21,17,31]);if(v(t)){var f=w(t,6,7973,12),h=0;for(o=0;o<6;++o)for(u=0;u<3;++u)n[o][i-11+u]=n[i-11+u][o]=f>>h++&1,a[o][i-11+u]=a[i-11+u][o]=1}return{matrix:n,reserved:a}}(r),c=l.matrix,u=l.reserved;if(function(e,t,r){for(var i=e.length,n=0,a=-1,o=i-1;o>=0;o-=2){6==o&&--o;for(var s=a<0?i-1:0,d=0;d<i;++d){for(var l=o;l>o-2;--l)t[s][l]||(e[s][l]=r[n>>3]>>(7&~n)&1,++n);s+=a}a=-a}}(c,u,s),a<0){$(c,u,0),S(c,0,n,0);var f=0,h=x(c);for($(c,u,0),a=1;a<8;++a){$(c,u,a),S(c,0,n,a);var p=x(c);h>p&&(h=p,f=a),$(c,u,a)}a=f}return $(c,u,a),S(c,0,n,a),c},j={generate:function(e,n){var a=(n=n||{}).version||-1,o={L:1,M:0,Q:3,H:2}[(n.ecclevel||"L").toUpperCase()],s=n.mode?{numeric:1,alphanumeric:2,octet:4}[n.mode.toLowerCase()]:-1,d="mask"in n?n.mask:-1;if(s<0)s="string"==typeof e?e.match(t)?1:e.match(i)?2:4:4;else if(1!=s&&2!=s&&4!=s)throw"invalid or unsupported mode";if(null===(e=function(e,i){switch(e){case 1:return i.match(t)?i:null;case 2:return i.match(r)?i.toUpperCase():null;case 4:if("string"==typeof i){for(var n=[],a=0;a<i.length;++a){var o=i.charCodeAt(a);o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}return i}}(s,e)))throw"invalid data format";if(o<0||o>3)throw"invalid ECC level";if(a<0){for(a=1;a<=40&&!(e.length<=y(a,s,o));++a);if(a>40)throw"too large data"}else if(a<1||a>40)throw"invalid version";if(-1!=d&&(d<0||d>8))throw"invalid mask";return k(e,a,s,o,d)},generateHTML:function(e,t){t=t||{};for(var r=j.generate(e,t),i=Math.max(t.modulesize||5,.5),n=Math.max(null!==t.margin?t.margin:4,0),a=document.createElement("div"),o=r.length,s=['<table border="0" cellspacing="0" cellpadding="0" style="border:'+i*n+'px solid #fff;background:#fff">'],d=0;d<o;++d){s.push("<tr>");for(var l=0;l<o;++l)s.push('<td style="width:'+i+"px;height:"+i+"px"+(r[d][l]?";background:#000":"")+'"></td>');s.push("</tr>")}return a.className="qrcode",a.innerHTML=s.join("")+"</table>",a},generateSVG:function(e,t){t=t||{};var r=j.generate(e,t),i=r.length,n=Math.max(t.modulesize||5,.5),a=Math.max(null!==t.margin?t.margin:4,0),o=n*(i+2*a),s=' class= "fg" width="'+n+'" height="'+n+'"/>',d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 "+o+" "+o),d.setAttribute("style","shape-rendering:crispEdges"),t.modulesize&&(d.setAttribute("width",o),d.setAttribute("height",o));for(var l=["<style scoped>.bg{fill:#FFF}.fg{fill:#000}</style>",'<rect class="bg" x="0" y="0"','width="'+o+'" height="'+o+'"/>'],c=a*n,u=0;u<i;++u){for(var f=a*n,h=0;h<i;++h)r[u][h]&&l.push('<rect x="'+f+'" y="'+c+'"',s),f+=n;c+=n}return d.innerHTML=l.join(""),d},generatePNG:function(e,t){t=t||{};var r,i=j.generate(e,t),n=Math.max(t.modulesize||5,.5),a=Math.max(null!==t.margin?t.margin:4,0),o=i.length,s=n*(o+2*a),d=document.createElement("canvas");if(d.width=d.height=s,!(r=d.getContext("2d")))throw"canvas support is needed for PNG output";r.fillStyle="#fff",r.fillRect(0,0,s,s),r.fillStyle="#000";for(var l=0;l<o;++l)for(var c=0;c<o;++c)i[l][c]&&r.fillRect(n*(a+c),n*(a+l),n,n);return d.toDataURL()}};return j})?i.apply(t,[]):i)||(e.exports=n)},function(e,t,r){r.r(t);var i=r(0),n=r.n(i);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return l(e,arguments,u(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),c(i,e)})(e)}function l(e,t,r){return(l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var n=new(Function.bind.apply(e,i));return r&&c(n,r.prototype),n}).apply(null,arguments)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=function(e){function t(){var e,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this,(e=!(r=u(t).call(this))||"object"!==a(r)&&"function"!=typeof r?s(this):r)._defineProperty=e._defineProperty.bind(s(e)),e.attachShadow({mode:"open"}),Object.keys(t.defaultAttributes).map(e._defineProperty),e}var r,i,l;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,d(HTMLElement)),r=t,l=[{key:"defaultAttributes",get:function(){return{data:null,format:"png",modulesize:5,margin:4}}},{key:"observedAttributes",get:function(){return Object.keys(t.defaultAttributes)}}],(i=[{key:"attributeChangedCallback",value:function(e,t,r){var i=this[e+"Changed"];i&&"function"==typeof i&&i.call(this,t,r),this.generate()}},{key:"_defineProperty",value:function(e){var r=this;Object.defineProperty(this,e,{get:function(){var i=r.getAttribute(e);return null===i?t.defaultAttributes[e]:i},set:function(t){r.setAttribute(e,t)}})}},{key:"getOptions",value:function(){var e=this.modulesize,t=this.margin;return{modulesize:null!==e?parseInt(e):e,margin:null!==t?parseInt(t):t}}},{key:"generate",value:function(){null!==this.data?"png"===this.format?this.generatePNG():"html"===this.format?this.generateHTML():"svg"===this.format?this.generateSVG():this.shadowRoot.innerHTML="<div>qr-code: "+this.format+" not supported!</div>":this.shadowRoot.innerHTML="<div>qr-code: no data!</div>"}},{key:"generatePNG",value:function(){try{var e=document.createElement("img");e.src=n.a.generatePNG(this.data,this.getOptions()),this.clear(),this.shadowRoot.appendChild(e)}catch(e){this.shadowRoot.innerHTML="<div>qr-code: no canvas support!</div>"}}},{key:"generateHTML",value:function(){var e=n.a.generateHTML(this.data,this.getOptions());this.clear(),this.shadowRoot.appendChild(e)}},{key:"generateSVG",value:function(){var e=n.a.generateSVG(this.data,this.getOptions());this.clear(),this.shadowRoot.appendChild(e)}},{key:"clear",value:function(){for(;this.shadowRoot.lastChild;)this.shadowRoot.removeChild(this.shadowRoot.lastChild)}}])&&o(r.prototype,i),l&&o(r,l),t}();customElements.define("qr-code",f)}]);let l,c,u,f,h,m,p,v,b,g=e=>e;const y=n(r(a(i,"sign-in-form")));class _ extends y{constructor(){super(...arguments),this.templates={},this.issuer="Unknown",this.__emailValidator=()=>!this.errors.some((e=>e.startsWith("email"))),this.__passwordValidator=()=>!this.errors.some((e=>e.startsWith("password"))),this.__newPasswordValidator=()=>!this.errors.some((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),this.__mfaTotpCodeValidator=()=>!this.errors.some((e=>e.startsWith("mfa_totp_code")&&!e.endsWith("_error"))),this.__renderEmail=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:n}=this,a=n.find((e=>e.startsWith("email"))),o=null==a?void 0:a.replace("email","v8n"),d=o?this.t(o).toString():"",c=this.in("busy");return t(l||(l=g` <div> ${0} <vaadin-email-field error-message="${0}" data-testid="email" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-email-field> ${0} </div> `),this.renderTemplateOrSlot("email:before"),d,this.t("email").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.email),c||r.matches("email",!0),i.matches("email",!0),this.__emailValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=e.target.value,n=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.password)&&void 0!==r?r:"";this.edit({credential:{email:i,password:n},type:"password"})}),this.renderTemplateOrSlot("email:after"))},this.__renderPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:n}=this,a=n.find((e=>e.startsWith("password"))),o=null==a?void 0:a.replace("password","v8n"),d=o?this.t(o).toString():"",l=this.in("busy");return t(c||(c=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("password:before"),d,this.t("password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.password),l||r.matches("password",!0),i.matches("password",!0),this.__passwordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",n=e.target.value;this.edit({credential:{email:i,password:n},type:"password"})}),this.renderTemplateOrSlot("password:after"))},this.__renderNewPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:n}=this,a=n.find((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),o=null==a?void 0:a.replace("new_password","v8n"),d=o?this.t(o).toString():"",l=this.in("busy");return t(u||(u=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="new-password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("new-password:before"),d,this.t("new_password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.new_password),l||r.matches("new-password",!0),i.matches("new-password",!0),this.__newPasswordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r,i,n;this.edit({type:"password",credential:{email:null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",password:null!==(n=null===(i=this.form.credential)||void 0===i?void 0:i.password)&&void 0!==n?n:"",new_password:e.target.value}})}),this.renderTemplateOrSlot("new-password:after"))},this.__renderMfaTotpCode=()=>{var r;const{disabledSelector:i,readonlySelector:n,errors:a}=this,o=this.__mfaSecretCode,d="mfa_totp_code",l="mfa-totp-code",c=a.find((e=>e.startsWith(d)&&!e.endsWith("_error"))),u=null==c?void 0:c.replace(d,"v8n"),h=u?this.t(u).toString():"",m=this.in("busy");return t(f||(f=g` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" placeholder="123456" data-testid="${0}" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" autofocus @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${l}:before`),h,o?this.t("mfa_totp_code_hint"):"",l,this.t(d).toString(),s(null===(r=this.form.credential)||void 0===r?void 0:r.mfa_totp_code),m||i.matches(l,!0),n.matches(l,!0),this.__mfaTotpCodeValidator,(e=>"Enter"===e.key&&this.submit()),(t=>{const r=t.target.value,i=e(e({},this.form.credential),{},{mfa_totp_code:r});o&&(i.mfa_secret_code=o),this.edit({type:"password",credential:i})}),this.renderTemplateOrSlot(`${l}:after`))},this.__renderMfaSecretCode=()=>{var e,r;const i="mfa-secret-code",n=this.__mfaSecretCode,a=encodeURIComponent(this.issuer),o=encodeURIComponent(null!==(r=null===(e=this.form.credential)||void 0===e?void 0:e.email)&&void 0!==r?r:""),s=new URL(`otpauth://totp/${a}:${o}`);return s.searchParams.set("secret",n),s.searchParams.set("issuer",this.issuer),t(h||(h=g` <div> ${0} <div data-testid="${0}" class="flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10" style="background:#fff;color:#000"> <qr-code modulesize="2" margin="0" format="svg" class="inline-flex" data="${0}"> </qr-code> <div class="break-all font-medium leading-s text-xs tracking-widest"> ${0} </div> </div> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),i,s.toString(),n,this.renderTemplateOrSlot(`${i}:after`))},this.__renderMfaRememberDevice=()=>{var r;const{__mfaSecretCode:i,form:n,lang:a,ns:o}=this,s="mfa-remember-device",d=this.in("busy")||this.disabledSelector.matches(s,!0);return t(m||(m=g` <div> ${0} <vaadin-checkbox data-testid="${0}" class="mb-m" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block" lang="${0}" key="mfa_remember_device" ns="${0}"></foxy-i18n> <foxy-i18n class="block text-xs ${0}" lang="${0}" key="mfa_remember_device_hint" ns="${0}"> </foxy-i18n> </vaadin-checkbox> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),s,d,!!(null===(r=n.credential)||void 0===r?void 0:r.mfa_remember_device),(t=>{var r,a;const o=t.currentTarget,s=e(e({},n.credential),{},{mfa_remember_device:o.checked,mfa_totp_code:null!==(a=null===(r=n.credential)||void 0===r?void 0:r.mfa_totp_code)&&void 0!==a?a:""});i&&(s.mfa_secret_code=i),this.edit({credential:s})}),a,o,d?"text-disabled":"text-secondary",a,o,this.renderTemplateOrSlot(`${s}:after`))},this.__renderError=()=>t(p||(p=g` <div> ${0} <p class="leading-s flex items-start text-s rounded p-s bg-error-10 text-error"> <iron-icon class="flex-shrink-0 mr-s icon-inline text-l" icon="lumo:error"></iron-icon> <foxy-i18n data-testid="error" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </p> ${0} </div> `),this.renderTemplateOrSlot("error:before"),this.lang,this.errors[0],this.ns,this.renderTemplateOrSlot("error:after")),this.__renderSubmit=()=>{const e=this.in({idle:{snapshot:{dirty:"valid"}}})||this.in({idle:{snapshot:{clean:"valid"}}})||this.in({idle:{template:{dirty:"valid"}}})||this.in({idle:{template:{clean:"valid"}}});return t(v||(v=g` <div> ${0} <vaadin-button data-testid="submit" class="w-full mt-m" theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="sign_in"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("submit:before"),!e||this.in("busy")||this.disabledSelector.matches("submit",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("submit:after"))}}static get properties(){return e(e({},super.properties),{},{issuer:{type:String}})}static get v8n(){return[({credential:e})=>!!(null==e?void 0:e.email)||"email_required",({credential:e})=>{var t;return d(null!==(t=null==e?void 0:e.email)&&void 0!==t?t:"")||"email_invalid_email"},({credential:e})=>!!(null==e?void 0:e.password)||"password_required",({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.new_password)||void 0===t?void 0:t.length)||"new_password_required"},({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.mfa_totp_code)||void 0===t?void 0:t.length)||"mfa_totp_code_required"}]}render(){var e,r,i,n;const{hiddenSelector:a,errors:s,lang:d,form:l,ns:c}=this,u=this.__mfaSecretCode,f=null===(e=l.credential)||void 0===e?void 0:e.mfa_totp_code,h=!!u||!!f||s.some((e=>e.startsWith("mfa"))),m="string"==typeof(null===(r=this.form.credential)||void 0===r?void 0:r.new_password)||s.some((e=>e.startsWith("new_password_"))),p=!h&&!f||a.matches("mfa-totp-code",!0),v=!h||h&&u||a.matches("mfa-remember-device",!0),y=!u||a.matches("mfa-secret-code",!0),_=h||a.matches("new-password",!0),w=s.some((e=>e.endsWith("_error"))),$=this.in("busy");return t(b||(b=g` <main aria-live="polite" aria-busy="${0}" class="relative font-lumo text-m leading-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="busy" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </main> `),$,a.matches("email",!0)?"":this.__renderEmail(),h||a.matches("password",!0)?"":this.__renderPassword(),_||!m?"":this.__renderNewPassword(),p?"":this.__renderMfaTotpCode(),y?"":this.__renderMfaSecretCode(),v?"":this.__renderMfaRememberDevice(),a.matches("error",!0)||!w?"":this.__renderError(),a.matches("submit",!0)?"":this.__renderSubmit(),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!$}),d,c,null!==(n=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==n?n:"")}async _sendPost(e){const t=JSON.stringify(e),r=await this._fetch(this.parent,{body:t,method:"POST"}),n=i.Rumour(this.group),a=[...this.related,this.parent];return n.share({data:r,related:a,source:r._links.self.href}),r}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t="unknown_error";try{const r=(await e.json())._embedded["fx:errors"][0].code;"string"==typeof r&&(t=r)}catch(e){}throw[t]}}get __mfaSecretCode(){var e;const t=null===(e=this.form.credential)||void 0===e?void 0:e.mfa_secret_code;if(t)return t;const r="mfa_required",i=this.errors.find((e=>e.startsWith(r)));return null==i?void 0:i.replace(r,"").trim()}}customElements.define("foxy-sign-in-form",_);export{_ as SignInForm};
|
|
@@ -154,5 +154,13 @@ export class AccessRecoveryForm extends Base {
|
|
|
154
154
|
</main>
|
|
155
155
|
`;
|
|
156
156
|
}
|
|
157
|
+
async _sendPost(edits) {
|
|
158
|
+
const body = JSON.stringify(edits);
|
|
159
|
+
const data = await this._fetch(this.parent, { body, method: 'POST' });
|
|
160
|
+
const rumour = NucleonElement.Rumour(this.group);
|
|
161
|
+
const related = [...this.related, this.parent];
|
|
162
|
+
rumour.share({ data, related, source: data._links.self.href });
|
|
163
|
+
return data;
|
|
164
|
+
}
|
|
157
165
|
}
|
|
158
166
|
//# sourceMappingURL=AccessRecoveryForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessRecoveryForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AccessRecoveryForm/AccessRecoveryForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAElE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU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I,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAE/B,OAAO,IAAI,CAAA;;;;oBAIK,MAAM;;;UAGhB,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE;UACjE,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE;UAChF,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;;;;kBAI3D,QAAQ,CAAC;YACf,2DAA2D,EAAE,IAAI;YACjE,+BAA+B,EAAE,CAAC,MAAM;SACzC,CAAC;;;;;;mBAMO,IAAI,CAAC,IAAI;kBACV,IAAI,CAAC,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,0CAAE,SAAS,mCAAI,EAAE;;;;;KAK3E,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-element';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { validate as isEmail } from 'email-validator';\n\nconst NS = 'access-recovery-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Email-based \"forgot password\" form.\n *\n * @slot email:before\n * @slot email:after\n *\n * @slot message:before\n * @slot message:after\n *\n * @slot submit:before\n * @slot submit:after\n *\n * @element foxy-access-recovery-form\n * @since 1.4.0\n */\nexport class AccessRecoveryForm extends Base<Data> {\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ detail: d }) => (d?.email && d.email.length > 0) || 'email_required',\n ({ detail: d }) => isEmail(d?.email ?? '') || 'email_invalid_email',\n ];\n }\n\n templates: Templates = {};\n\n private readonly __checkEmailValidity = () => {\n return !this.errors.some(err => err.startsWith('email'));\n };\n\n private readonly __renderEmail = () => {\n const isFailed = this.in('fail');\n const isBusy = this.in('busy');\n const isDone = this.in({ idle: 'snapshot' });\n\n const emailErrors = this.errors.filter(error => error.startsWith('email'));\n const emailErrorKeys = emailErrors.map(error => error.replace('email', 'v8n'));\n const emailErrorMessage = emailErrorKeys[0] ? this.t(emailErrorKeys[0]).toString() : '';\n\n const handleKeyDown = (evt: KeyboardEvent) => {\n if (evt.key === 'Enter') this.submit();\n };\n\n const handleInput = (evt: InputEvent) => {\n this.edit({\n detail: { email: (evt.target as EmailFieldElement).value },\n type: 'email',\n });\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.detail?.email)}\n ?disabled=${isBusy || isDone || isFailed || this.disabledSelector.matches('email', true)}\n ?readonly=${this.readonlySelector.matches('email', true)}\n .checkValidity=${this.__checkEmailValidity}\n @input=${handleInput}\n @keydown=${handleKeyDown}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderMessage = () => {\n const isFailed = this.in('fail');\n const color = isFailed ? 'bg-error-10 text-error' : 'bg-success-10 text-success';\n const icon = isFailed ? 'lumo:error' : 'lumo:cog';\n const key = isFailed ? 'unknown_error' : 'recover_access_success';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('message:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s ${color}\">\n <iron-icon class=\"flex-shrink-0 icon-inline text-l mr-s\" icon=${icon}></iron-icon>\n <foxy-i18n lang=${this.lang} key=${key} ns=${this.ns} data-testid=\"message\"></foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('message:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isFailed = this.in('fail');\n const isValid = this.errors.length === 0;\n const isBusy = this.in('busy');\n const isDone = this.in({ idle: 'snapshot' });\n const isDisabledByForm = isBusy || isDone || !isValid || isFailed;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full\"\n theme=\"primary\"\n ?disabled=${isDisabledByForm || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n lang=${this.lang} key=\"recover_access\" ns=${this.ns}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const isDone = this.in({ idle: 'snapshot' }) || this.in('fail');\n const isBusy = this.in('busy');\n\n return html`\n <main\n data-testid=\"wrapper\"\n aria-live=\"polite\"\n aria-busy=${isBusy}\n class=\"relative font-lumo text-m leading-m space-y-m\"\n >\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${hiddenSelector.matches('message', true) || !isDone ? '' : this.__renderMessage()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AccessRecoveryForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AccessRecoveryForm/AccessRecoveryForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAElE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU;IAAlD;;QAQE,cAAS,GAAc,EAAE,CAAC;QAET,yBAAoB,GAAG,GAAG,EAAE;YAC3C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC;QAEe,kBAAa,GAAG,GAAG,EAAE;;YACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;YAC/B,MAAM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CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE;UAChF,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;;;;kBAI3D,QAAQ,CAAC;YACf,2DAA2D,EAAE,IAAI;YACjE,+BAA+B,EAAE,CAAC,MAAM;SACzC,CAAC;;;;;;mBAMO,IAAI,CAAC,IAAI;kBACV,IAAI,CAAC,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,0CAAE,SAAS,mCAAI,EAAE;;;;;KAK3E,CAAC;IACJ,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,KAAoB;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAEtE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE/D,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-element';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { validate as isEmail } from 'email-validator';\n\nconst NS = 'access-recovery-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Email-based \"forgot password\" form.\n *\n * @slot email:before\n * @slot email:after\n *\n * @slot message:before\n * @slot message:after\n *\n * @slot submit:before\n * @slot submit:after\n *\n * @element foxy-access-recovery-form\n * @since 1.4.0\n */\nexport class AccessRecoveryForm extends Base<Data> {\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ detail: d }) => (d?.email && d.email.length > 0) || 'email_required',\n ({ detail: d }) => isEmail(d?.email ?? '') || 'email_invalid_email',\n ];\n }\n\n templates: Templates = {};\n\n private readonly __checkEmailValidity = () => {\n return !this.errors.some(err => err.startsWith('email'));\n };\n\n private readonly __renderEmail = () => {\n const isFailed = this.in('fail');\n const isBusy = this.in('busy');\n const isDone = this.in({ idle: 'snapshot' });\n\n const emailErrors = this.errors.filter(error => error.startsWith('email'));\n const emailErrorKeys = emailErrors.map(error => error.replace('email', 'v8n'));\n const emailErrorMessage = emailErrorKeys[0] ? this.t(emailErrorKeys[0]).toString() : '';\n\n const handleKeyDown = (evt: KeyboardEvent) => {\n if (evt.key === 'Enter') this.submit();\n };\n\n const handleInput = (evt: InputEvent) => {\n this.edit({\n detail: { email: (evt.target as EmailFieldElement).value },\n type: 'email',\n });\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.detail?.email)}\n ?disabled=${isBusy || isDone || isFailed || this.disabledSelector.matches('email', true)}\n ?readonly=${this.readonlySelector.matches('email', true)}\n .checkValidity=${this.__checkEmailValidity}\n @input=${handleInput}\n @keydown=${handleKeyDown}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderMessage = () => {\n const isFailed = this.in('fail');\n const color = isFailed ? 'bg-error-10 text-error' : 'bg-success-10 text-success';\n const icon = isFailed ? 'lumo:error' : 'lumo:cog';\n const key = isFailed ? 'unknown_error' : 'recover_access_success';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('message:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s ${color}\">\n <iron-icon class=\"flex-shrink-0 icon-inline text-l mr-s\" icon=${icon}></iron-icon>\n <foxy-i18n lang=${this.lang} key=${key} ns=${this.ns} data-testid=\"message\"></foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('message:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isFailed = this.in('fail');\n const isValid = this.errors.length === 0;\n const isBusy = this.in('busy');\n const isDone = this.in({ idle: 'snapshot' });\n const isDisabledByForm = isBusy || isDone || !isValid || isFailed;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full\"\n theme=\"primary\"\n ?disabled=${isDisabledByForm || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n lang=${this.lang} key=\"recover_access\" ns=${this.ns}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const isDone = this.in({ idle: 'snapshot' }) || this.in('fail');\n const isBusy = this.in('busy');\n\n return html`\n <main\n data-testid=\"wrapper\"\n aria-live=\"polite\"\n aria-busy=${isBusy}\n class=\"relative font-lumo text-m leading-m space-y-m\"\n >\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${hiddenSelector.matches('message', true) || !isDone ? '' : this.__renderMessage()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.parent, { body, method: 'POST' });\n\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n rumour.share({ data, related, source: data._links.self.href });\n\n return data;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
2
|
import { CustomerApi } from '../CustomerApi/CustomerApi';
|
|
3
|
+
import { TransactionsTable } from '../TransactionsTable/TransactionsTable';
|
|
3
4
|
declare const CustomerPortal_base: typeof CustomerApi & {
|
|
4
5
|
styles: import("lit-element").CSSResultArray;
|
|
5
6
|
} & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
@@ -7,6 +8,8 @@ declare const CustomerPortal_base: typeof CustomerApi & {
|
|
|
7
8
|
};
|
|
8
9
|
export declare class CustomerPortal extends CustomerPortal_base {
|
|
9
10
|
static get properties(): PropertyDeclarations;
|
|
11
|
+
/** Same as `.columns` property on `foxy-transactions-table`. Sets columns of that table. */
|
|
12
|
+
transactionsTableColumns: TransactionsTable['columns'];
|
|
10
13
|
/** Rumour group. Elements in different groups will not share updates. Empty by default. */
|
|
11
14
|
group: string;
|
|
12
15
|
render(): TemplateResult;
|
|
@@ -3,15 +3,26 @@ import { API } from '@foxy.io/sdk/customer';
|
|
|
3
3
|
import { CustomerApi } from "../CustomerApi/CustomerApi.js";
|
|
4
4
|
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
5
5
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
6
|
+
import { TransactionsTable } from "../TransactionsTable/TransactionsTable.js";
|
|
6
7
|
export class CustomerPortal extends TranslatableMixin(ThemeableMixin(CustomerApi), 'customer-portal') {
|
|
7
8
|
constructor() {
|
|
8
9
|
super(...arguments);
|
|
10
|
+
/** Same as `.columns` property on `foxy-transactions-table`. Sets columns of that table. */
|
|
11
|
+
this.transactionsTableColumns = [
|
|
12
|
+
TransactionsTable.priceColumn,
|
|
13
|
+
TransactionsTable.summaryColumn,
|
|
14
|
+
TransactionsTable.statusColumn,
|
|
15
|
+
TransactionsTable.idColumn,
|
|
16
|
+
TransactionsTable.dateColumn,
|
|
17
|
+
TransactionsTable.receiptColumn,
|
|
18
|
+
];
|
|
9
19
|
/** Rumour group. Elements in different groups will not share updates. Empty by default. */
|
|
10
20
|
this.group = '';
|
|
11
21
|
}
|
|
12
22
|
static get properties() {
|
|
13
23
|
return {
|
|
14
24
|
...super.properties,
|
|
25
|
+
transactionsTableColumns: { attribute: false },
|
|
15
26
|
group: { type: String },
|
|
16
27
|
};
|
|
17
28
|
}
|
|
@@ -28,6 +39,7 @@ export class CustomerPortal extends TranslatableMixin(ThemeableMixin(CustomerApi
|
|
|
28
39
|
lang=${this.lang}
|
|
29
40
|
href=${new URL('./customer_portal_settings', this.base).toString()}
|
|
30
41
|
ns=${this.ns}
|
|
42
|
+
.transactionsTableColumns=${this.transactionsTableColumns}
|
|
31
43
|
.templates=${this.templates}
|
|
32
44
|
>
|
|
33
45
|
</foxy-internal-customer-portal-logged-in-view>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerPortal.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/CustomerPortal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,GAAG,E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CAAC,QAAQ,EAAE;+BAChC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE;6BAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE;uBACpC,IAAI,CAAC,IAAI;oBACZ,IAAI,CAAC,KAAK;;mBAEX,IAAI,CAAC,IAAI;mBACT,IAAI,GAAG,CAAC,4BAA4B,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;iBAC7D,IAAI,CAAC,EAAE;wCACgB,IAAI,CAAC,wBAAwB;yBAC5C,IAAI,CAAC,SAAS;;;SAG9B;YACH,CAAC,CAAC,IAAI,CAAA;;+BAEmB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE;+BAChC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE;6BAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE;oBACvC,IAAI,CAAC,KAAK;;mBAEX,IAAI,CAAC,IAAI;iBACX,IAAI,CAAC,EAAE;yBACC,IAAI,CAAC,SAAS;;;SAG9B,CAAC;IACR,CAAC;CACF","sourcesContent":["import { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { API } from '@foxy.io/sdk/customer';\nimport { CustomerApi } from '../CustomerApi/CustomerApi';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { TransactionsTable } from '../TransactionsTable/TransactionsTable';\n\nexport class CustomerPortal extends TranslatableMixin(\n ThemeableMixin(CustomerApi),\n 'customer-portal'\n) {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n transactionsTableColumns: { attribute: false },\n group: { type: String },\n };\n }\n\n /** Same as `.columns` property on `foxy-transactions-table`. Sets columns of that table. */\n transactionsTableColumns: TransactionsTable['columns'] = [\n TransactionsTable.priceColumn,\n TransactionsTable.summaryColumn,\n TransactionsTable.statusColumn,\n TransactionsTable.idColumn,\n TransactionsTable.dateColumn,\n TransactionsTable.receiptColumn,\n ];\n\n /** Rumour group. Elements in different groups will not share updates. Empty by default. */\n group = '';\n\n render(): TemplateResult {\n return this.api.storage.getItem(API.SESSION)\n ? html`\n <foxy-internal-customer-portal-logged-in-view\n disabledcontrols=${this.disabledSelector.toString()}\n readonlycontrols=${this.readonlySelector.toString()}\n hiddencontrols=${this.hiddenSelector.toString()}\n customer=${this.base}\n group=${this.group}\n class=\"h-full\"\n lang=${this.lang}\n href=${new URL('./customer_portal_settings', this.base).toString()}\n ns=${this.ns}\n .transactionsTableColumns=${this.transactionsTableColumns}\n .templates=${this.templates}\n >\n </foxy-internal-customer-portal-logged-in-view>\n `\n : html`\n <foxy-internal-customer-portal-logged-out-view\n disabledcontrols=${this.disabledSelector.toString()}\n readonlycontrols=${this.readonlySelector.toString()}\n hiddencontrols=${this.hiddenSelector.toString()}\n group=${this.group}\n class=\"h-full\"\n lang=${this.lang}\n ns=${this.ns}\n .templates=${this.templates}\n >\n </foxy-internal-customer-portal-logged-out-view>\n `;\n }\n}\n"]}
|
|
@@ -5,6 +5,7 @@ import { PropertyDeclarations } from 'lit-element';
|
|
|
5
5
|
import { Rels } from '@foxy.io/sdk/customer';
|
|
6
6
|
import { Resource } from '@foxy.io/sdk/core';
|
|
7
7
|
import { Templates } from './types';
|
|
8
|
+
import { TransactionsTable } from '../TransactionsTable/TransactionsTable';
|
|
8
9
|
declare const Base: typeof NucleonElement & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
9
10
|
defaultNS: string;
|
|
10
11
|
} & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost> & {
|
|
@@ -16,6 +17,7 @@ export declare class InternalCustomerPortalLoggedInView extends Base<Data> {
|
|
|
16
17
|
templates: Templates;
|
|
17
18
|
customer: string;
|
|
18
19
|
loggingOutState: 'idle' | 'busy' | 'fail';
|
|
20
|
+
transactionsTableColumns: TransactionsTable['columns'];
|
|
19
21
|
loggingOutStateResetTimeout: NodeJS.Timeout | null;
|
|
20
22
|
private readonly __renderHeaderActionsSignOut;
|
|
21
23
|
private readonly __renderSubscriptions;
|
|
@@ -12,6 +12,7 @@ export class InternalCustomerPortalLoggedInView extends Base {
|
|
|
12
12
|
this.templates = {};
|
|
13
13
|
this.customer = '';
|
|
14
14
|
this.loggingOutState = 'idle';
|
|
15
|
+
this.transactionsTableColumns = [];
|
|
15
16
|
this.loggingOutStateResetTimeout = null;
|
|
16
17
|
this.__renderHeaderActionsSignOut = () => {
|
|
17
18
|
var _a, _b, _c, _d, _e;
|
|
@@ -110,6 +111,7 @@ export class InternalCustomerPortalLoggedInView extends Base {
|
|
|
110
111
|
ns=${host.ns}
|
|
111
112
|
.templates=${this.getNestedTemplates(scope)}
|
|
112
113
|
.customer=${host.data}
|
|
114
|
+
.columns=${this.transactionsTableColumns}
|
|
113
115
|
>
|
|
114
116
|
</foxy-internal-customer-portal-transactions>
|
|
115
117
|
|
|
@@ -122,6 +124,7 @@ export class InternalCustomerPortalLoggedInView extends Base {
|
|
|
122
124
|
...super.properties,
|
|
123
125
|
customer: { type: String },
|
|
124
126
|
loggingOutState: { attribute: false },
|
|
127
|
+
transactionsTableColumns: { attribute: false },
|
|
125
128
|
loggingOutStateResetTimeout: { attribute: false },
|
|
126
129
|
};
|
|
127
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCustomerPortalLoggedInView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAC3E,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,iCAA8B;AAG5C,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,MAAM,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AAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;2BACjD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;yBACnD,sBAAsB;;gBAE/B,IAAI,CAAC,KAAK;eACX,IAAI,CAAC,QAAQ;eACb,IAAI,CAAC,IAAI;cACV,IAAI,CAAC,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,0CAAE,SAAS,mCAAI,EAAE;;qBAExD,SAAS;kBACZ,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,2BAA2B;YAAE,YAAY,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACvF,CAAC;IAED,IAAY,iBAAiB;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAW,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { API } from '../NucleonElement/API';\nimport { Customer } from '../Customer/Customer';\nimport { Templates as CustomerTemplates } from '../Customer/types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/customer';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { Templates } from './types';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\n\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement)));\ntype Data = Resource<Rels.CustomerPortalSettings>;\n\nexport class InternalCustomerPortalLoggedInView extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n customer: { type: String },\n loggingOutState: { attribute: false },\n loggingOutStateResetTimeout: { attribute: false },\n };\n }\n\n templates: Templates = {};\n\n customer = '';\n\n loggingOutState: 'idle' | 'busy' | 'fail' = 'idle';\n\n loggingOutStateResetTimeout: NodeJS.Timeout | null = null;\n\n private readonly __renderHeaderActionsSignOut = () => {\n const scope = 'customer:header:actions:sign-out';\n const state = this.loggingOutState;\n\n const isDisabled =\n this.disabledSelector.matches(scope) ||\n !this.__customerElement?.in({ idle: 'snapshot' }) ||\n state !== 'idle';\n\n const handleClick = async () => {\n try {\n this.loggingOutState = 'busy';\n await new API(this).fetch('foxy://customer-api/session', { method: 'DELETE' });\n this.loggingOutState = 'idle';\n } catch {\n this.loggingOutState = 'fail';\n this.loggingOutStateResetTimeout = setTimeout(() => {\n this.loggingOutState = 'idle';\n this.loggingOutStateResetTimeout = null;\n }, 1000);\n }\n };\n\n const style = {\n 'border-radius': '100%',\n 'padding': 'var(--lumo-space-xs)',\n 'display': 'flex',\n 'margin': '0',\n 'cursor': isDisabled ? 'default' : 'pointer',\n };\n\n return html`\n <div style=\"display: flex; margin-left: var(--lumo-space-m)\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-button\n data-testid=\"sign-out\"\n aria-label=${this.t('sign_out').toString()}\n style=${Object.entries(style).reduce((p, [k, v]) => `${p}${k}:${v};`, '')}\n theme=\"icon\"\n ?disabled=${isDisabled}\n @click=${handleClick}\n >\n ${state === 'idle'\n ? html`<iron-icon icon=\"icons:exit-to-app\"></iron-icon>`\n : html`\n <foxy-spinner\n layout=\"no-label\"\n state=${state === 'fail' ? 'error' : 'busy'}\n style=\"margin: auto\"\n lang=${this.lang}\n ns=${[\n this.ns,\n customElements.get('foxy-customer')?.defaultNS ?? '',\n customElements.get('foxy-spinner')?.defaultNS ?? '',\n ].join(' ')}\n >\n </foxy-spinner>\n `}\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSubscriptions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:subscriptions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-subscriptions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .settings=${this.data}\n .customer=${host.data}\n >\n </foxy-internal-customer-portal-subscriptions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n private readonly __renderTransactions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:transactions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-transactions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .customer=${host.data}\n >\n </foxy-internal-customer-portal-transactions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector.zoom('customer');\n const customerHiddenControls = new BooleanSelector(\n [\n 'attributes',\n 'transactions',\n 'subscriptions',\n 'addresses:actions:create',\n 'header:actions:edit:form:delete',\n hiddenSelector.toString(),\n ].join(' ')\n ).toString();\n\n const templates: CustomerTemplates = this.getNestedTemplates('customer');\n const originalHeaderActionsAfterTemplate = templates['header:actions:after'];\n const originalTimestampsAfterTemplate = templates['header:actions:edit:form:timestamps:after'];\n const originalDefaultTemplate = templates['default'];\n\n templates['header:actions:after'] = (html, host) => {\n const isSignOutHidden = hiddenSelector.matches('header:actions:sign-out', true);\n return html`\n <div style=\"display:flex\">\n ${isSignOutHidden ? '' : this.__renderHeaderActionsSignOut()}\n ${originalHeaderActionsAfterTemplate?.(html, host)}\n </div>\n `;\n };\n\n templates['default'] = (html, host) => {\n const renderSubscriptions = this.__renderSubscriptions;\n const renderTransactions = this.__renderTransactions;\n\n return html`\n <style>\n .space-y-m > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(var(--lumo-space-m, 1rem) * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(var(--lumo-space-m, 1rem) * var(--tw-space-y-reverse));\n }\n </style>\n\n ${hiddenSelector.matches('default', true) ? '' : originalDefaultTemplate?.(html, host)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('subscriptions', true) ? '' : renderSubscriptions(html, host)}\n ${hiddenSelector.matches('transactions', true) ? '' : renderTransactions(html, host)}\n </div>\n `;\n };\n\n templates['header:actions:edit:form:timestamps:after'] = (html, host) => {\n const scope = 'change-password';\n\n return html`\n ${originalTimestampsAfterTemplate?.(html, host)}\n ${host.hiddenSelector.matches(scope, true)\n ? ''\n : html`\n ${host.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-change-password\n customer=${host.href}\n session=\"foxy://customer-api/session\"\n style=\"margin-top: var(--lumo-space-l)\"\n email=${host.data?.email ?? ''}\n lang=${host.lang}\n ns=${host.ns}\n ?disabled=${host.in('busy') || host.disabledSelector.matches(scope, true)}\n >\n </foxy-internal-customer-portal-change-password>\n\n ${host.renderTemplateOrSlot(`${scope}:after`)}\n `}\n `;\n };\n\n return html`\n <foxy-customer\n readonlycontrols=${this.readonlySelector.zoom('customer').toString()}\n disabledcontrols=${this.disabledSelector.zoom('customer').toString()}\n hiddencontrols=${customerHiddenControls}\n data-testid=\"customer\"\n group=${this.group}\n href=${this.customer}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-customer')?.defaultNS ?? ''}\"\n id=\"customer\"\n .templates=${templates}\n @update=${() => this.requestUpdate()}\n >\n </foxy-customer>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.loggingOutStateResetTimeout) clearTimeout(this.loggingOutStateResetTimeout);\n }\n\n private get __customerElement() {\n return this.renderRoot.querySelector<Customer>('#customer');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalCustomerPortalLoggedInView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAC3E,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,iCAA8B;AAG5C,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAGlF,MAAM,OAAO,kCAAmC,SAAQ,IAAU;IAAlE;;QAWE,cAAS,GAAc,EAAE,CAAC;QAE1B,aAAQ,GAAG,EAAE,CAAC;QAEd,oBAAe,GAA6B,MAAM,CAAC;QAEnD,6BAAwB,GAAiC,EAAE,CAAC;QAE5D,gCAA2B,GAA0B,IAAI,CAAC;QAEzC,iCAA4B,GAAG,GAAG,EAAE;;YACnD,MAAM,KAAK,GAAG,kCAAkC,CAAC;YACjD,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC;YAEnC,MAAM,UAAU,GACd,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC;gBACpC,QAAC,IAAI,CAAC,iBAAiB,0CAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAC;gBACjD,KAAK,KAAK,MAAM,CAAC;YAEnB,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;gBAC7B,IAAI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AC;IACvF,CAAC;IAED,IAAY,iBAAiB;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAW,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { API } from '../NucleonElement/API';\nimport { Customer } from '../Customer/Customer';\nimport { Templates as CustomerTemplates } from '../Customer/types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/customer';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { Templates } from './types';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { TransactionsTable } from '../TransactionsTable/TransactionsTable';\n\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement)));\ntype Data = Resource<Rels.CustomerPortalSettings>;\n\nexport class InternalCustomerPortalLoggedInView extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n customer: { type: String },\n loggingOutState: { attribute: false },\n transactionsTableColumns: { attribute: false },\n loggingOutStateResetTimeout: { attribute: false },\n };\n }\n\n templates: Templates = {};\n\n customer = '';\n\n loggingOutState: 'idle' | 'busy' | 'fail' = 'idle';\n\n transactionsTableColumns: TransactionsTable['columns'] = [];\n\n loggingOutStateResetTimeout: NodeJS.Timeout | null = null;\n\n private readonly __renderHeaderActionsSignOut = () => {\n const scope = 'customer:header:actions:sign-out';\n const state = this.loggingOutState;\n\n const isDisabled =\n this.disabledSelector.matches(scope) ||\n !this.__customerElement?.in({ idle: 'snapshot' }) ||\n state !== 'idle';\n\n const handleClick = async () => {\n try {\n this.loggingOutState = 'busy';\n await new API(this).fetch('foxy://customer-api/session', { method: 'DELETE' });\n this.loggingOutState = 'idle';\n } catch {\n this.loggingOutState = 'fail';\n this.loggingOutStateResetTimeout = setTimeout(() => {\n this.loggingOutState = 'idle';\n this.loggingOutStateResetTimeout = null;\n }, 1000);\n }\n };\n\n const style = {\n 'border-radius': '100%',\n 'padding': 'var(--lumo-space-xs)',\n 'display': 'flex',\n 'margin': '0',\n 'cursor': isDisabled ? 'default' : 'pointer',\n };\n\n return html`\n <div style=\"display: flex; margin-left: var(--lumo-space-m)\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-button\n data-testid=\"sign-out\"\n aria-label=${this.t('sign_out').toString()}\n style=${Object.entries(style).reduce((p, [k, v]) => `${p}${k}:${v};`, '')}\n theme=\"icon\"\n ?disabled=${isDisabled}\n @click=${handleClick}\n >\n ${state === 'idle'\n ? html`<iron-icon icon=\"icons:exit-to-app\"></iron-icon>`\n : html`\n <foxy-spinner\n layout=\"no-label\"\n state=${state === 'fail' ? 'error' : 'busy'}\n style=\"margin: auto\"\n lang=${this.lang}\n ns=${[\n this.ns,\n customElements.get('foxy-customer')?.defaultNS ?? '',\n customElements.get('foxy-spinner')?.defaultNS ?? '',\n ].join(' ')}\n >\n </foxy-spinner>\n `}\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSubscriptions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:subscriptions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-subscriptions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .settings=${this.data}\n .customer=${host.data}\n >\n </foxy-internal-customer-portal-subscriptions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n private readonly __renderTransactions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:transactions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-transactions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .customer=${host.data}\n .columns=${this.transactionsTableColumns}\n >\n </foxy-internal-customer-portal-transactions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector.zoom('customer');\n const customerHiddenControls = new BooleanSelector(\n [\n 'attributes',\n 'transactions',\n 'subscriptions',\n 'addresses:actions:create',\n 'header:actions:edit:form:delete',\n hiddenSelector.toString(),\n ].join(' ')\n ).toString();\n\n const templates: CustomerTemplates = this.getNestedTemplates('customer');\n const originalHeaderActionsAfterTemplate = templates['header:actions:after'];\n const originalTimestampsAfterTemplate = templates['header:actions:edit:form:timestamps:after'];\n const originalDefaultTemplate = templates['default'];\n\n templates['header:actions:after'] = (html, host) => {\n const isSignOutHidden = hiddenSelector.matches('header:actions:sign-out', true);\n return html`\n <div style=\"display:flex\">\n ${isSignOutHidden ? '' : this.__renderHeaderActionsSignOut()}\n ${originalHeaderActionsAfterTemplate?.(html, host)}\n </div>\n `;\n };\n\n templates['default'] = (html, host) => {\n const renderSubscriptions = this.__renderSubscriptions;\n const renderTransactions = this.__renderTransactions;\n\n return html`\n <style>\n .space-y-m > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(var(--lumo-space-m, 1rem) * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(var(--lumo-space-m, 1rem) * var(--tw-space-y-reverse));\n }\n </style>\n\n ${hiddenSelector.matches('default', true) ? '' : originalDefaultTemplate?.(html, host)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('subscriptions', true) ? '' : renderSubscriptions(html, host)}\n ${hiddenSelector.matches('transactions', true) ? '' : renderTransactions(html, host)}\n </div>\n `;\n };\n\n templates['header:actions:edit:form:timestamps:after'] = (html, host) => {\n const scope = 'change-password';\n\n return html`\n ${originalTimestampsAfterTemplate?.(html, host)}\n ${host.hiddenSelector.matches(scope, true)\n ? ''\n : html`\n ${host.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-change-password\n customer=${host.href}\n session=\"foxy://customer-api/session\"\n style=\"margin-top: var(--lumo-space-l)\"\n email=${host.data?.email ?? ''}\n lang=${host.lang}\n ns=${host.ns}\n ?disabled=${host.in('busy') || host.disabledSelector.matches(scope, true)}\n >\n </foxy-internal-customer-portal-change-password>\n\n ${host.renderTemplateOrSlot(`${scope}:after`)}\n `}\n `;\n };\n\n return html`\n <foxy-customer\n readonlycontrols=${this.readonlySelector.zoom('customer').toString()}\n disabledcontrols=${this.disabledSelector.zoom('customer').toString()}\n hiddencontrols=${customerHiddenControls}\n data-testid=\"customer\"\n group=${this.group}\n href=${this.customer}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-customer')?.defaultNS ?? ''}\"\n id=\"customer\"\n .templates=${templates}\n @update=${() => this.requestUpdate()}\n >\n </foxy-customer>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.loggingOutStateResetTimeout) clearTimeout(this.loggingOutStateResetTimeout);\n }\n\n private get __customerElement() {\n return this.renderRoot.querySelector<Customer>('#customer');\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
2
|
import { Graph } from '@foxy.io/sdk/customer';
|
|
3
3
|
import { Resource } from '@foxy.io/sdk/core';
|
|
4
|
+
import { TransactionsTable } from '../TransactionsTable/TransactionsTable';
|
|
4
5
|
declare const Base: typeof LitElement & import("lit-element").Constructor<import("../../../mixins/inferrable").InferrableMixinHost> & {
|
|
5
6
|
inferredProperties: string[];
|
|
6
7
|
} & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
@@ -11,6 +12,7 @@ declare const Base: typeof LitElement & import("lit-element").Constructor<import
|
|
|
11
12
|
export declare class InternalCustomerPortalTransactions extends Base {
|
|
12
13
|
static get properties(): PropertyDeclarations;
|
|
13
14
|
customer: Resource<Graph> | null;
|
|
15
|
+
columns: TransactionsTable['columns'];
|
|
14
16
|
group: string;
|
|
15
17
|
private readonly __renderHeader;
|
|
16
18
|
private readonly __renderList;
|
|
@@ -9,6 +9,7 @@ export class InternalCustomerPortalTransactions extends Base {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.customer = null;
|
|
12
|
+
this.columns = [];
|
|
12
13
|
this.group = '';
|
|
13
14
|
this.__renderHeader = () => {
|
|
14
15
|
return html `
|
|
@@ -48,6 +49,7 @@ export class InternalCustomerPortalTransactions extends Base {
|
|
|
48
49
|
ns=${this.ns}
|
|
49
50
|
manual
|
|
50
51
|
.templates=${this.getNestedTemplates('table')}
|
|
52
|
+
.props=${{ '.columns': this.columns }}
|
|
51
53
|
>
|
|
52
54
|
</foxy-collection-pages>
|
|
53
55
|
|
|
@@ -60,6 +62,7 @@ export class InternalCustomerPortalTransactions extends Base {
|
|
|
60
62
|
return {
|
|
61
63
|
...super.properties,
|
|
62
64
|
customer: { attribute: false },
|
|
65
|
+
columns: { attribute: false },
|
|
63
66
|
group: { type: String },
|
|
64
67
|
};
|
|
65
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCustomerPortalTransactions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalTransactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;
|
|
1
|
+
{"version":3,"file":"InternalCustomerPortalTransactions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalTransactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAG7D,MAAM,EAAE,GAAG,iBAAiB,CAAC;AAC7B,MAAM,IAAI,GAAG,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEnG,MAAM,OAAO,kCAAmC,SAAQ,IAAI;IAA5D;;QAUE,aAAQ,GAA2B,IAAI,CAAC;QAExC,YAAO,GAAiC,EAAE,CAAC;QAE3C,UAAK,GAAG,EAAE,CAAC;QAEM,mBAAc,GAAG,GAAG,EAAE;YACrC,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC;;;;iBAInC,IAAI,CAAC,IAAI;;eAEX,IAAI,CAAC,EAAE;;;;UAIZ,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;QACJ,CAAC,CAAC;QAEe,iBAAY,GAAG,GAAG,EAAE;YACnC,IAAI,KAAK,GAAG,EAAE,CAAC;YAEf,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC;gBACvE,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAC3C,KAAK,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;aAC7B;YAED,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC;;;;kBAIhC,IAAI,CAAC,KAAK;kBACV,KAAK;;;iBAGN,IAAI,CAAC,IAAI;eACX,IAAI,CAAC,EAAE;;uBAEC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;mBACpC,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE;;;;UAIrC,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC;;KAE5C,CAAC;QACJ,CAAC,CAAC;IAUJ,CAAC;IAzEC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC7B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IA0DD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UAClE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEnE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { Graph } from '@foxy.io/sdk/customer';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InferrableMixin } from '../../../mixins/inferrable';\nimport { TransactionsTable } from '../TransactionsTable/TransactionsTable';\n\nconst NS = 'customer-portal';\nconst Base = ConfigurableMixin(ThemeableMixin(TranslatableMixin(InferrableMixin(LitElement), NS)));\n\nexport class InternalCustomerPortalTransactions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n customer: { attribute: false },\n columns: { attribute: false },\n group: { type: String },\n };\n }\n\n customer: Resource<Graph> | null = null;\n\n columns: TransactionsTable['columns'] = [];\n\n group = '';\n\n private readonly __renderHeader = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"text-l font-medium\"\n lang=${this.lang}\n key=\"transaction_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n };\n\n private readonly __renderList = () => {\n let first = '';\n\n if (this.customer) {\n const firstURL = new URL(this.customer._links['fx:transactions'].href);\n firstURL.searchParams.set('zoom', 'items');\n first = firstURL.toString();\n }\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-collection-pages\n spinner=\"foxy-spinner\"\n group=${this.group}\n first=${first}\n class=\"block divide-y divide-contrast-10 px-m border border-contrast-10 rounded-t-l rounded-b-l\"\n page=\"foxy-transactions-table\"\n lang=${this.lang}\n ns=${this.ns}\n manual\n .templates=${this.getNestedTemplates('table')}\n .props=${{ '.columns': this.columns }}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"transactions\">\n ${this.hiddenSelector.matches('header') ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list') ? '' : this.__renderList()}\n </div>\n `;\n }\n}\n"]}
|
|
@@ -48,6 +48,7 @@ export declare class SignInForm extends Base<Data> {
|
|
|
48
48
|
private readonly __renderError;
|
|
49
49
|
private readonly __renderSubmit;
|
|
50
50
|
render(): TemplateResult;
|
|
51
|
+
protected _sendPost(edits: Partial<Data>): Promise<Data>;
|
|
51
52
|
protected _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult>;
|
|
52
53
|
private get __mfaSecretCode();
|
|
53
54
|
}
|
|
@@ -370,6 +370,14 @@ export class SignInForm extends Base {
|
|
|
370
370
|
</main>
|
|
371
371
|
`;
|
|
372
372
|
}
|
|
373
|
+
async _sendPost(edits) {
|
|
374
|
+
const body = JSON.stringify(edits);
|
|
375
|
+
const data = await this._fetch(this.parent, { body, method: 'POST' });
|
|
376
|
+
const rumour = NucleonElement.Rumour(this.group);
|
|
377
|
+
const related = [...this.related, this.parent];
|
|
378
|
+
rumour.share({ data, related, source: data._links.self.href });
|
|
379
|
+
return data;
|
|
380
|
+
}
|
|
373
381
|
async _fetch(...args) {
|
|
374
382
|
try {
|
|
375
383
|
return await super._fetch(...args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SignInForm/SignInForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,cAAc,CAAC;AAC1B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C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CAAC;IAES,KAAK,CAAC,MAAM,CAAiB,GAAG,IAAiC;QACzE,IAAI;YACF,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;SACpC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,QAAQ,GAAG,eAAe,CAAC;YAE/B,IAAI;gBACF,MAAM,IAAI,GAAG,CAAC,MAAO,GAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC7E,IAAI,OAAO,IAAI,KAAK,QAAQ;oBAAE,QAAQ,GAAG,IAAI,CAAC;aAC/C;YAAC,WAAM;gBACN,kCAAkC;aACnC;YAED,MAAM,CAAC,QAAQ,CAAC,CAAC;SAClB;IACH,CAAC;IAED,IAAY,eAAe;;QACzB,MAAM,YAAY,SAAG,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,eAAe,CAAC;QAC3D,IAAI,YAAY;YAAE,OAAO,YAAY,CAAC;QAEtC,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1E,OAAO,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,GAAG;IACnD,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { PasswordFieldElement } from '@vaadin/vaadin-text-field/vaadin-password-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { validate as isEmail } from 'email-validator';\n\nconst NS = 'sign-in-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for email/password sign in.\n *\n * @slot email:before\n * @slot email:after\n * @slot password:before\n * @slot password:after\n * @slot new-password:before\n * @slot new-password:after\n * @slot mfa-secret-code:before\n * @slot mfa-secret-code:after\n * @slot mfa-totp-code:before\n * @slot mfa-totp-code:after\n * @slot mfa-remember-device:before\n * @slot mfa-remember-device:after\n * @slot error:before\n * @slot error:after\n * @slot submit:before\n * @slot submit:after\n *\n * @element foxy-sign-in-form\n * @since 1.4.0\n */\nexport class SignInForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n issuer: { type: String },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ credential: c }) => !!c?.email || 'email_required',\n ({ credential: c }) => isEmail(c?.email ?? '') || 'email_invalid_email',\n ({ credential: c }) => !!c?.password || 'password_required',\n ({ credential: c }) => (c?.new_password?.length === 0 ? 'new_password_required' : true),\n ({ credential: c }) => (c?.mfa_totp_code?.length === 0 ? 'mfa_totp_code_required' : true),\n ];\n }\n\n templates: Templates = {};\n\n issuer = 'Unknown';\n\n private readonly __emailValidator = () => !this.errors.some(err => err.startsWith('email'));\n\n private readonly __passwordValidator = () => !this.errors.some(err => err.startsWith('password'));\n\n private readonly __newPasswordValidator = () => {\n return !this.errors.some(err => err.startsWith('new_password') && !err.endsWith('_error'));\n };\n\n private readonly __mfaTotpCodeValidator = () => {\n return !this.errors.some(err => err.startsWith('mfa_totp_code') && !err.endsWith('_error'));\n };\n\n private readonly __renderEmail = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const emailError = errors.find(err => err.startsWith('email'));\n const emailErrorKey = emailError?.replace('email', 'v8n');\n const emailErrorMessage = emailErrorKey ? this.t(emailErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full mb-m\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.credential?.email)}\n ?disabled=${isBusy || disabledSelector.matches('email', true)}\n ?readonly=${readonlySelector.matches('email', true)}\n .checkValidity=${this.__emailValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = (evt.target as EmailFieldElement).value;\n const password = this.form.credential?.password ?? '';\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const passwordError = errors.find(err => err.startsWith('password'));\n const passwordErrorKey = passwordError?.replace('password', 'v8n');\n const passwordErrorMessage = passwordErrorKey ? this.t(passwordErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('password:before')}\n\n <vaadin-password-field\n error-message=${passwordErrorMessage}\n data-testid=\"password\"\n class=\"w-full mb-m\"\n label=${this.t('password').toString()}\n value=${ifDefined(this.form.credential?.password)}\n ?disabled=${isBusy || disabledSelector.matches('password', true)}\n ?readonly=${readonlySelector.matches('password', true)}\n .checkValidity=${this.__passwordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = this.form.credential?.email ?? '';\n const password = (evt.target as PasswordFieldElement).value;\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('password:after')}\n </div>\n `;\n };\n\n private readonly __renderNewPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const error = errors.find(err => err.startsWith('new_password') && !err.endsWith('_error'));\n const errorKey = error?.replace('new_password', 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('new-password:before')}\n\n <vaadin-password-field\n error-message=${errorMessage}\n data-testid=\"new-password\"\n class=\"w-full mb-m\"\n label=${this.t('new_password').toString()}\n value=${ifDefined(this.form.credential?.new_password)}\n ?disabled=${isBusy || disabledSelector.matches('new-password', true)}\n ?readonly=${readonlySelector.matches('new-password', true)}\n .checkValidity=${this.__newPasswordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n this.edit({\n type: 'password',\n credential: {\n email: this.form.credential?.email ?? '',\n password: this.form.credential?.password ?? '',\n new_password: (evt.target as PasswordFieldElement).value,\n },\n });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('new-password:after')}\n </div>\n `;\n };\n\n private readonly __renderMfaTotpCode = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const mfaSecretCode = this.__mfaSecretCode;\n const prefix = 'mfa_totp_code';\n const scope = 'mfa-totp-code';\n const error = errors.find(err => err.startsWith(prefix) && !err.endsWith('_error'));\n const errorKey = error?.replace(prefix, 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n error-message=${errorMessage}\n helper-text=${mfaSecretCode ? this.t('mfa_totp_code_hint') : ''}\n placeholder=\"123456\"\n data-testid=${scope}\n class=\"w-full mb-m\"\n label=${this.t(prefix).toString()}\n value=${ifDefined(this.form.credential?.mfa_totp_code)}\n ?disabled=${isBusy || disabledSelector.matches(scope, true)}\n ?readonly=${readonlySelector.matches(scope, true)}\n .checkValidity=${this.__mfaTotpCodeValidator}\n autofocus\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const mfaTotpCode = (evt.target as PasswordFieldElement).value;\n const credential = { ...this.form.credential!, mfa_totp_code: mfaTotpCode };\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ type: 'password', credential });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaSecretCode = () => {\n const scope = 'mfa-secret-code';\n const mfaSecretCode = this.__mfaSecretCode!;\n const issuer = encodeURIComponent(this.issuer);\n const email = encodeURIComponent(this.form.credential?.email ?? '');\n const otpauthUrl = new URL(`otpauth://totp/${issuer}:${email}`);\n\n otpauthUrl.searchParams.set('secret', mfaSecretCode);\n otpauthUrl.searchParams.set('issuer', this.issuer);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div\n data-testid=${scope}\n class=\"flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10\"\n style=\"background: white; color: black;\"\n >\n <qr-code\n modulesize=\"2\"\n margin=\"0\"\n format=\"svg\"\n class=\"inline-flex\"\n data=${otpauthUrl.toString()}\n >\n </qr-code>\n\n <div class=\"break-all font-medium leading-s text-xs tracking-widest\">\n ${mfaSecretCode}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaRememberDevice = () => {\n const { __mfaSecretCode: mfaSecretCode, form, lang, ns } = this;\n const scope = 'mfa-remember-device';\n const isBusy = this.in('busy');\n const isDisabled = isBusy || this.disabledSelector.matches(scope, true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-checkbox\n data-testid=${scope}\n class=\"mb-m\"\n ?disabled=${isDisabled}\n ?checked=${!!form.credential?.mfa_remember_device}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n const credential = {\n ...form.credential!,\n mfa_remember_device: target.checked,\n mfa_totp_code: form.credential?.mfa_totp_code ?? '',\n };\n\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ credential });\n }}\n >\n <foxy-i18n class=\"block\" lang=${lang} key=\"mfa_remember_device\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"block text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"mfa_remember_device_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n </vaadin-checkbox>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderError = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('error:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s bg-error-10 text-error\">\n <iron-icon class=\"flex-shrink-0 mr-s icon-inline text-l\" icon=\"lumo:error\"></iron-icon>\n <foxy-i18n data-testid=\"error\" lang=${this.lang} key=${this.errors[0]} ns=${this.ns}>\n </foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('error:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isValid =\n this.in({ idle: { snapshot: { dirty: 'valid' } } }) ||\n this.in({ idle: { snapshot: { clean: 'valid' } } }) ||\n this.in({ idle: { template: { dirty: 'valid' } } }) ||\n this.in({ idle: { template: { clean: 'valid' } } });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full mt-m\"\n theme=\"primary\"\n ?disabled=${!isValid || this.in('busy') || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"sign_in\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { hiddenSelector, errors, lang, form, ns } = this;\n const mfaSecretCode = this.__mfaSecretCode;\n const mfaTotpCode = form.credential?.mfa_totp_code;\n\n const isMfaRequired =\n !!mfaSecretCode || !!mfaTotpCode || errors.some(err => err.startsWith('mfa'));\n\n const isNewPasswordRequired =\n typeof this.form.credential?.new_password === 'string' ||\n errors.some(error => error.startsWith('new_password_'));\n\n const isMfaTotpCodeHidden =\n (!isMfaRequired && !mfaTotpCode) || hiddenSelector.matches('mfa-totp-code', true);\n\n const isMfaRememberDeviceHidden =\n !isMfaRequired ||\n (isMfaRequired && mfaSecretCode) ||\n hiddenSelector.matches('mfa-remember-device', true);\n\n const isMfaSecretCodeHidden = !mfaSecretCode || hiddenSelector.matches('mfa-secret-code', true);\n const isNewPasswordHidden = isMfaRequired || hiddenSelector.matches('new-password', true);\n const isFailed = errors.some(error => error.endsWith('_error'));\n const isBusy = this.in('busy');\n\n return html`\n <main aria-live=\"polite\" aria-busy=${isBusy} class=\"relative font-lumo text-m leading-m\">\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${isMfaRequired || hiddenSelector.matches('password', true) ? '' : this.__renderPassword()}\n ${isNewPasswordHidden || !isNewPasswordRequired ? '' : this.__renderNewPassword()}\n ${isMfaTotpCodeHidden ? '' : this.__renderMfaTotpCode()}\n ${isMfaSecretCodeHidden ? '' : this.__renderMfaSecretCode()}\n ${isMfaRememberDeviceHidden ? '' : this.__renderMfaRememberDevice()}\n ${hiddenSelector.matches('error', true) || !isFailed ? '' : this.__renderError()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let v8nError = 'unknown_error';\n\n try {\n const code = (await (err as Response).json())._embedded['fx:errors'][0].code;\n if (typeof code === 'string') v8nError = code;\n } catch {\n // Unknown error format, ignoring.\n }\n\n throw [v8nError];\n }\n }\n\n private get __mfaSecretCode() {\n const storedSecret = this.form.credential?.mfa_secret_code;\n if (storedSecret) return storedSecret;\n\n const prefix = 'mfa_required';\n const mfaSetupError = this.errors.find(error => error.startsWith(prefix));\n return mfaSetupError?.replace(prefix, '').trim();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SignInForm/SignInForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,cAAc,CAAC;AAC1B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAkBE,cAAS,GAAc,EAAE,CAAC;QAE1B,WAAM,GAAG,SAAS,CAAC;QAEF,qBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC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AAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,GAAG;IACnD,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { PasswordFieldElement } from '@vaadin/vaadin-text-field/vaadin-password-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { validate as isEmail } from 'email-validator';\n\nconst NS = 'sign-in-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for email/password sign in.\n *\n * @slot email:before\n * @slot email:after\n * @slot password:before\n * @slot password:after\n * @slot new-password:before\n * @slot new-password:after\n * @slot mfa-secret-code:before\n * @slot mfa-secret-code:after\n * @slot mfa-totp-code:before\n * @slot mfa-totp-code:after\n * @slot mfa-remember-device:before\n * @slot mfa-remember-device:after\n * @slot error:before\n * @slot error:after\n * @slot submit:before\n * @slot submit:after\n *\n * @element foxy-sign-in-form\n * @since 1.4.0\n */\nexport class SignInForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n issuer: { type: String },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ credential: c }) => !!c?.email || 'email_required',\n ({ credential: c }) => isEmail(c?.email ?? '') || 'email_invalid_email',\n ({ credential: c }) => !!c?.password || 'password_required',\n ({ credential: c }) => (c?.new_password?.length === 0 ? 'new_password_required' : true),\n ({ credential: c }) => (c?.mfa_totp_code?.length === 0 ? 'mfa_totp_code_required' : true),\n ];\n }\n\n templates: Templates = {};\n\n issuer = 'Unknown';\n\n private readonly __emailValidator = () => !this.errors.some(err => err.startsWith('email'));\n\n private readonly __passwordValidator = () => !this.errors.some(err => err.startsWith('password'));\n\n private readonly __newPasswordValidator = () => {\n return !this.errors.some(err => err.startsWith('new_password') && !err.endsWith('_error'));\n };\n\n private readonly __mfaTotpCodeValidator = () => {\n return !this.errors.some(err => err.startsWith('mfa_totp_code') && !err.endsWith('_error'));\n };\n\n private readonly __renderEmail = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const emailError = errors.find(err => err.startsWith('email'));\n const emailErrorKey = emailError?.replace('email', 'v8n');\n const emailErrorMessage = emailErrorKey ? this.t(emailErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full mb-m\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.credential?.email)}\n ?disabled=${isBusy || disabledSelector.matches('email', true)}\n ?readonly=${readonlySelector.matches('email', true)}\n .checkValidity=${this.__emailValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = (evt.target as EmailFieldElement).value;\n const password = this.form.credential?.password ?? '';\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const passwordError = errors.find(err => err.startsWith('password'));\n const passwordErrorKey = passwordError?.replace('password', 'v8n');\n const passwordErrorMessage = passwordErrorKey ? this.t(passwordErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('password:before')}\n\n <vaadin-password-field\n error-message=${passwordErrorMessage}\n data-testid=\"password\"\n class=\"w-full mb-m\"\n label=${this.t('password').toString()}\n value=${ifDefined(this.form.credential?.password)}\n ?disabled=${isBusy || disabledSelector.matches('password', true)}\n ?readonly=${readonlySelector.matches('password', true)}\n .checkValidity=${this.__passwordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = this.form.credential?.email ?? '';\n const password = (evt.target as PasswordFieldElement).value;\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('password:after')}\n </div>\n `;\n };\n\n private readonly __renderNewPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const error = errors.find(err => err.startsWith('new_password') && !err.endsWith('_error'));\n const errorKey = error?.replace('new_password', 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('new-password:before')}\n\n <vaadin-password-field\n error-message=${errorMessage}\n data-testid=\"new-password\"\n class=\"w-full mb-m\"\n label=${this.t('new_password').toString()}\n value=${ifDefined(this.form.credential?.new_password)}\n ?disabled=${isBusy || disabledSelector.matches('new-password', true)}\n ?readonly=${readonlySelector.matches('new-password', true)}\n .checkValidity=${this.__newPasswordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n this.edit({\n type: 'password',\n credential: {\n email: this.form.credential?.email ?? '',\n password: this.form.credential?.password ?? '',\n new_password: (evt.target as PasswordFieldElement).value,\n },\n });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('new-password:after')}\n </div>\n `;\n };\n\n private readonly __renderMfaTotpCode = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const mfaSecretCode = this.__mfaSecretCode;\n const prefix = 'mfa_totp_code';\n const scope = 'mfa-totp-code';\n const error = errors.find(err => err.startsWith(prefix) && !err.endsWith('_error'));\n const errorKey = error?.replace(prefix, 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n error-message=${errorMessage}\n helper-text=${mfaSecretCode ? this.t('mfa_totp_code_hint') : ''}\n placeholder=\"123456\"\n data-testid=${scope}\n class=\"w-full mb-m\"\n label=${this.t(prefix).toString()}\n value=${ifDefined(this.form.credential?.mfa_totp_code)}\n ?disabled=${isBusy || disabledSelector.matches(scope, true)}\n ?readonly=${readonlySelector.matches(scope, true)}\n .checkValidity=${this.__mfaTotpCodeValidator}\n autofocus\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const mfaTotpCode = (evt.target as PasswordFieldElement).value;\n const credential = { ...this.form.credential!, mfa_totp_code: mfaTotpCode };\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ type: 'password', credential });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaSecretCode = () => {\n const scope = 'mfa-secret-code';\n const mfaSecretCode = this.__mfaSecretCode!;\n const issuer = encodeURIComponent(this.issuer);\n const email = encodeURIComponent(this.form.credential?.email ?? '');\n const otpauthUrl = new URL(`otpauth://totp/${issuer}:${email}`);\n\n otpauthUrl.searchParams.set('secret', mfaSecretCode);\n otpauthUrl.searchParams.set('issuer', this.issuer);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div\n data-testid=${scope}\n class=\"flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10\"\n style=\"background: white; color: black;\"\n >\n <qr-code\n modulesize=\"2\"\n margin=\"0\"\n format=\"svg\"\n class=\"inline-flex\"\n data=${otpauthUrl.toString()}\n >\n </qr-code>\n\n <div class=\"break-all font-medium leading-s text-xs tracking-widest\">\n ${mfaSecretCode}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaRememberDevice = () => {\n const { __mfaSecretCode: mfaSecretCode, form, lang, ns } = this;\n const scope = 'mfa-remember-device';\n const isBusy = this.in('busy');\n const isDisabled = isBusy || this.disabledSelector.matches(scope, true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-checkbox\n data-testid=${scope}\n class=\"mb-m\"\n ?disabled=${isDisabled}\n ?checked=${!!form.credential?.mfa_remember_device}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n const credential = {\n ...form.credential!,\n mfa_remember_device: target.checked,\n mfa_totp_code: form.credential?.mfa_totp_code ?? '',\n };\n\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ credential });\n }}\n >\n <foxy-i18n class=\"block\" lang=${lang} key=\"mfa_remember_device\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"block text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"mfa_remember_device_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n </vaadin-checkbox>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderError = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('error:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s bg-error-10 text-error\">\n <iron-icon class=\"flex-shrink-0 mr-s icon-inline text-l\" icon=\"lumo:error\"></iron-icon>\n <foxy-i18n data-testid=\"error\" lang=${this.lang} key=${this.errors[0]} ns=${this.ns}>\n </foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('error:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isValid =\n this.in({ idle: { snapshot: { dirty: 'valid' } } }) ||\n this.in({ idle: { snapshot: { clean: 'valid' } } }) ||\n this.in({ idle: { template: { dirty: 'valid' } } }) ||\n this.in({ idle: { template: { clean: 'valid' } } });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full mt-m\"\n theme=\"primary\"\n ?disabled=${!isValid || this.in('busy') || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"sign_in\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { hiddenSelector, errors, lang, form, ns } = this;\n const mfaSecretCode = this.__mfaSecretCode;\n const mfaTotpCode = form.credential?.mfa_totp_code;\n\n const isMfaRequired =\n !!mfaSecretCode || !!mfaTotpCode || errors.some(err => err.startsWith('mfa'));\n\n const isNewPasswordRequired =\n typeof this.form.credential?.new_password === 'string' ||\n errors.some(error => error.startsWith('new_password_'));\n\n const isMfaTotpCodeHidden =\n (!isMfaRequired && !mfaTotpCode) || hiddenSelector.matches('mfa-totp-code', true);\n\n const isMfaRememberDeviceHidden =\n !isMfaRequired ||\n (isMfaRequired && mfaSecretCode) ||\n hiddenSelector.matches('mfa-remember-device', true);\n\n const isMfaSecretCodeHidden = !mfaSecretCode || hiddenSelector.matches('mfa-secret-code', true);\n const isNewPasswordHidden = isMfaRequired || hiddenSelector.matches('new-password', true);\n const isFailed = errors.some(error => error.endsWith('_error'));\n const isBusy = this.in('busy');\n\n return html`\n <main aria-live=\"polite\" aria-busy=${isBusy} class=\"relative font-lumo text-m leading-m\">\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${isMfaRequired || hiddenSelector.matches('password', true) ? '' : this.__renderPassword()}\n ${isNewPasswordHidden || !isNewPasswordRequired ? '' : this.__renderNewPassword()}\n ${isMfaTotpCodeHidden ? '' : this.__renderMfaTotpCode()}\n ${isMfaSecretCodeHidden ? '' : this.__renderMfaSecretCode()}\n ${isMfaRememberDeviceHidden ? '' : this.__renderMfaRememberDevice()}\n ${hiddenSelector.matches('error', true) || !isFailed ? '' : this.__renderError()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.parent, { body, method: 'POST' });\n\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n rumour.share({ data, related, source: data._links.self.href });\n\n return data;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let v8nError = 'unknown_error';\n\n try {\n const code = (await (err as Response).json())._embedded['fx:errors'][0].code;\n if (typeof code === 'string') v8nError = code;\n } catch {\n // Unknown error format, ignoring.\n }\n\n throw [v8nError];\n }\n }\n\n private get __mfaSecretCode() {\n const storedSecret = this.form.credential?.mfa_secret_code;\n if (storedSecret) return storedSecret;\n\n const prefix = 'mfa_required';\n const mfaSetupError = this.errors.find(error => error.startsWith(prefix));\n return mfaSetupError?.replace(prefix, '').trim();\n }\n}\n"]}
|