1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[567],{11603:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(37876);n(14232);var i=n(71490),l=n.n(i),a=n(70221);let o=e=>{let{severity:t="error",children:n}=e;return(0,r.jsx)("div",{className:l().container,children:(0,r.jsx)("div",{className:l().message,style:"warning"===t?{backgroundColor:"".concat(a.A.orange100,"88")}:{backgroundColor:a.A.errorBg},children:n})})}},19421:e=>{e.exports={grey200:"#E6E6EC",grey400:"#7D7D84",error:"#E9283A",input:"TextInput_input__HJBoe",inputError:"TextInput_inputError__szrDX"}},45682:()=>{},67057:(e,t,n)=>{"use strict";n.d(t,{_j:()=>c,jL:()=>u,pM:()=>o,rw:()=>s,vP:()=>d});var r=n(89099),i=n.n(r);let l=(e,t)=>{var n,r,i,l,a,o,s,d;return(null==e?void 0:e.__typename)==="PaymentMethodStripeCard"&&(null==t?void 0:t.__typename)==="PaymentMethodStripeCard"&&(null==(n=e.card)?void 0:n.fingerprint)===(null==(r=t.card)?void 0:r.fingerprint)||(null==e?void 0:e.__typename)==="PaymentMethodStripeSepa"&&(null==t?void 0:t.__typename)==="PaymentMethodStripeSepa"&&(null==(i=e.sepa_debit)?void 0:i.fingerprint)===(null==(l=t.sepa_debit)?void 0:l.fingerprint)||(null==e?void 0:e.__typename)==="PaymentMethodStripeBacs"&&(null==t?void 0:t.__typename)==="PaymentMethodStripeBacs"&&(null==(a=e.bacs_debit)?void 0:a.fingerprint)===(null==(o=t.bacs_debit)?void 0:o.fingerprint)||(null==e?void 0:e.__typename)==="PaymentMethodStripePaypal"&&(null==t?void 0:t.__typename)==="PaymentMethodStripePaypal"&&(null==(s=e.paypal)?void 0:s.payer_id)===(null==(d=t.paypal)?void 0:d.payer_id)||(null==e?void 0:e.__typename)==="PaymentMethodTrustly"&&(null==t?void 0:t.__typename)==="PaymentMethodTrustly"&&e.id===t.id&&e.type===t.type||!e&&!t||!1},a=(e,t)=>(null==e?void 0:e.__typename)==="PayoutMethodPaypal"&&(null==t?void 0:t.__typename)==="PayoutMethodPaypal"&&e.id===t.id||(null==e?void 0:e.__typename)==="PaymentMethodTrustly"&&(null==t?void 0:t.__typename)==="PaymentMethodTrustly"&&e.id===t.id&&e.type===t.type||(null==e?void 0:e.__typename)==="PayoutMethodAtlar"&&(null==t?void 0:t.__typename)==="PayoutMethodAtlar"&&e.id===t.id||(null==e?void 0:e.__typename)==="PayoutMethodSwish"&&(null==t?void 0:t.__typename)==="PayoutMethodSwish"&&e.id===t.id||!e&&!t||!1,o=e=>{let{policies:t,paymentMethods:n}=e;return t.reduce((e,t)=>{var r,i;let a=null==(r=t.paymentMethod)?void 0:r.id,o=null==n?void 0:n.find(e=>e.id===a);for(let{policies:n,paymentMethod:r}of e)if(l(r,o))return n.push(t),e;return e.push({policies:[t],paymentMethod:o,hasPayoutMethod:!!(null==(i=t.payoutMethod)?void 0:i.id)}),e},[]).sort((e,t)=>e.paymentMethod?-1:+!!t.paymentMethod)},s=e=>{let{policies:t,paymentMethods:n}=e,r=n.reduce((e,t)=>(e.find(e=>{let{paymentMethod:n}=e;return l(n,t)})||e.push({policies:[],paymentMethod:t}),e),[]);for(let e of t){var i;let t=null==(i=e.paymentMethod)?void 0:i.id,a=null==n?void 0:n.find(e=>e.id===t);for(let{policies:t,paymentMethod:n}of r)l(n,a)&&t.push(e)}return r},d=e=>{let{policies:t,payoutMethods:n}=e,r=n.reduce((e,t)=>(e.find(e=>{let{payoutMethod:n}=e;return a(n,t)})||e.push({policies:[],payoutMethod:t}),e),[]);for(let e of t){var i,l;let t=null==(l=e.client)||null==(i=l.metadata)?void 0:i.payoutMethodId,o=null==n?void 0:n.find(e=>e.id===t);for(let{policies:t,payoutMethod:n}of r)a(n,o)&&t.push(e)}return r},u=()=>{i().replace("/payments/login?returnUrl=".concat(window.location.href.split("?")[0]))},c=()=>{let{returnUrl:e}=i().query;return Array.isArray(e)?i().replace(e[0]):i().replace(null!=e?e:"/payments")}},68067:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(43080);let i=()=>{let e=e=>{sessionStorage.setItem("token",e),sessionStorage.setItem("openidToken","")},t=()=>{var e;return r.M&&null!=(e=sessionStorage.getItem("token"))?e:""},n=e=>{sessionStorage.setItem("openidToken",e),sessionStorage.setItem("token","")},i=()=>{var e;return r.M&&null!=(e=sessionStorage.getItem("openidToken"))?e:""};return{setToken:e,getToken:t,hasToken:()=>!!t(),setOpenidToken:n,getOpenidToken:i,hasOpenidToken:()=>!!i(),logout:()=>{e(""),n("")}}}},71490:e=>{e.exports={pink100:"#F9D8CB",blue100:"#E2EBFF",errorBg:"#FFE7E9",container:"ErrorMessage_container__diNug",message:"ErrorMessage_message__fUVW_"}},73770:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__N_SSP:()=>D,default:()=>F});var r=n(37876),i=n(27127),l=n(14232),a=n(13808),o=n(28888),s=n(16265),d=n(80425),u=n(1325),c=n(68067),p=n(67057);function y(){let e=(0,o._)(["\n query GenerateIdToken {\n generateIdToken {\n redirectUrl\n }\n }\n"]);return y=function(){return e},e}let m=(0,s.J1)(y()),h=e=>{let{idToken:t}=e,{setOpenidToken:n,logout:i}=(0,c.A)(),[a,o]=(0,l.useState)("");return l.useEffect(()=>{a&&(window.location.href=a)},[a]),l.useEffect(()=>{t?(n(t),(0,p._j)()):(async()=>{var e,t;i();let{data:n}=await d.A.query({query:m});o(null!=(t=null==(e=n.generateIdToken)?void 0:e.redirectUrl)?t:"")})()},[t]),(0,r.jsx)("div",{style:{backgroundColor:"#f2f2f7",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(u.A,{})})};var g=n(23529),v=n(34746),f=n(49640),_=n(8622),x=n(79112),j=n(79194),A=n(48230),k=n.n(A),P=n(54587),M=n.n(P),b=n(85302),w=n(90526),S=n(11603);let T=e=>{let{value:t,onChange:n,onBackspace:i,nativeRef:l}=e;return(0,r.jsx)(j.A,{inputMode:"numeric",value:t,onChangeText:e=>{(!e||Number.isInteger(parseInt(e,10)))&&n(e)},maxLength:1,style:{fontSize:30,fontWeight:600,textAlign:"center"},nativeRef:l,onKeyDown:e=>{"Backspace"===e.key&&i()}})},E=e=>{let{code:t,setCode:n}=e,i=[(0,l.useRef)(),(0,l.useRef)(),(0,l.useRef)(),(0,l.useRef)()];(0,l.useEffect)(()=>{var e;(null==(e=i[0])?void 0:e.current)&&i[0].current.focus()},[i[0]]);let a=(e,r)=>{n([...t.slice(0,r),e,...t.slice(r+1)]),e&&(e=>{let n=e+1;for(;n<=3;){if(!t[n]){var r,l;null==(l=i[n])||null==(r=l.current)||r.focus();return}n+=1}})(r)},o=e=>{t[e]||(n([...t.slice(0,e-1),"",...t.slice(e)]),(e=>{var t,n;
1null==(n=i[e-1])||null==(t=n.current)||t.focus()})(e))};return(0,r.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,r.jsx)(T,{value:t[0],onChange:e=>a(e,0),onBackspace:()=>o(0),nativeRef:i[0]}),(0,r.jsx)(T,{value:t[1],onChange:e=>a(e,1),onBackspace:()=>o(1),nativeRef:i[1]}),(0,r.jsx)(T,{value:t[2],onChange:e=>a(e,2),onBackspace:()=>o(2),nativeRef:i[2]}),(0,r.jsx)(T,{value:t[3],onChange:e=>a(e,3),onBackspace:()=>o(3),nativeRef:i[3]})]})},C=()=>{let e=["","","",""],{t,i18n:n}=(0,a.n3)(),[i,o]=(0,l.useState)(!1),[s,d]=(0,l.useState)(null),[u,y]=(0,l.useState)(""),[m,h]=(0,l.useState)(e),[g,A]=(0,l.useState)(""),{setToken:P}=(0,c.A)(),T=async()=>{o(!0),A("");try{await v.N.signUp({username:u,password:"".concat(Date.now().toString(),"#$aA"),attributes:{email:u,locale:null==n?void 0:n.language}})}catch(e){if("UsernameExistsException"!==e.code){A(t("payment.login.error.sign_up")),o(!1);return}}try{d(await v.N.signIn(u))}catch(e){A(t("payment.login.error.sign_in")),A("Sign in error")}o(!1)},C=async()=>{o(!0),A("");try{await v.N.sendCustomChallengeAnswer(s,m.join(""))}catch(e){A(t("payment.login.error.revoked_code")),d(null),o(!1);return}try{let e=await v.N.currentSession();await v.N.forgetDevice(),P(e.getIdToken().getJwtToken()),(0,p._j)()}catch(e){A(t("payment.login.error.wrong_code")),o(!1)}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{padding:10},children:(0,r.jsx)(k(),{href:"/",children:(0,r.jsx)(M(),{src:"/images/logo-with-name.svg",alt:"Lassie",width:105,height:34})})}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"75vh"},children:(0,r.jsx)("div",{style:{maxWidth:300},children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_.A,{variant:"h1",children:t("payment.login.code_title")}),(0,r.jsx)(x.A,{size:1}),(0,r.jsx)(_.A,{children:(0,r.jsx)(b.x6,{i18nKey:"payment.login.code_description",tOptions:{email:u}})}),(0,r.jsx)(x.A,{size:4}),(0,r.jsx)(E,{code:m,setCode:h}),g&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.A,{size:1}),(0,r.jsx)(S.A,{children:(0,r.jsx)(_.A,{color:"error",children:g})})]}),(0,r.jsx)(x.A,{size:2}),(0,r.jsx)(f.A,{title:t("payment.login.code_button"),onPress:C,loading:i,disabled:!(m[0]&&m[1]&&m[2]&&m[3])}),(0,r.jsx)(x.A,{size:2}),(0,r.jsx)(f.A,{variant:"custom",color:"white",textColor:"blue300",title:t("global.back"),onPress:()=>{h(e),A(""),d(null)}})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_.A,{variant:"h1",children:t("payment.login.email_title")}),(0,r.jsx)(x.A,{size:1}),(0,r.jsx)(_.A,{children:t("payment.login.email_description")}),(0,r.jsx)(x.A,{size:4}),(0,r.jsx)(j.A,{name:"email",type:"email",value:u,onChangeText:e=>y(e),placeHolder:"Email",onKeyDown:e=>{"Enter"===e.key&&(0,w.DT)(u)&&T()}}),g&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.A,{size:1}),(0,r.jsx)(S.A,{children:(0,r.jsx)(_.A,{color:"error",children:g})})]}),(0,r.jsx)(x.A,{size:2}),(0,r.jsx)(f.A,{title:t("payment.login.email_button"),onPress:T,loading:i,disabled:!(0,w.DT)(u)})]})})})]})};var I=n(4230),R=n(3906),B=n(89099);i.H.configure(R.vR[R.RY?"production":"development"]);let N=e=>{let{idToken:t}=e;switch((0,I.ex)()){case"bankid":return(0,r.jsx)(h,{idToken:t});case"email":return(0,r.jsx)(C,{})}};var D=!0;let F=e=>{let{idToken:t}=e;(0,a.LE)();let{t:n}=(0,a.n3)(),i=(0,B.useRouter)();return(0,l.useEffect)(()=>{if(R.RY)return;let e=i.query.dev,t=(e=>{if(!e)return null;let[t,n,...r]=e.split(":"),i=r.join(":");return t&&i&&("email"===n||"ssn"===n)?{slot:"openidToken",sentinel:"dev:".concat(t,":").concat(n,":").concat(i)}:null})("string"==typeof e?e:void 0);t&&(sessionStorage.removeItem("token"),sessionStorage.removeItem("openidToken"),sessionStorage.setItem(t.slot,t.sentinel),i.replace("/payments"))},[i]),(0,r.jsx)(g.P,{title:n("login.meta.description"),description:n("login.meta.description"),children:(0,r.jsx)(N,{idToken:t})})}},75382:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/payments/login",function(){return n(73770)}])},79194:(e,t,n)=>{"use strict";n.d(t,{A:()=>p,r:()=>c});var r=n(37876),i=n(14232),l=n(19421),a=n.n(l),o=n(8622),s=n(58103),d=n.n(s);let u=e=>
1{let{inputMode:t,disabled:n=!1,value:l,onChangeText:s,placeHolder:u,maxLength:c,onFocus:p,onBlur:y,nativeRef:m,label:h,error:g,type:v,style:f,name:_,autoComplete:x,className:j,onKeyDown:A,onKeyUp:k,ariaLabel:P="",ariaDescribedBy:M,ariaInvalid:b,required:w}=e,[S]=(0,i.useState)(Math.random()+"");return(0,r.jsxs)(r.Fragment,{children:[h&&(0,r.jsx)("label",{htmlFor:S,children:(0,r.jsx)(o.A,{variant:"body3",children:h})}),(0,r.jsx)("input",{"data-testid":"text-input",inputMode:t,type:v,required:w,name:_||S,className:d()(a().input,g&&a().inputError,j),value:l,onChange:e=>{if(["email","date","number"].includes(null!=v?v:"text")){var t;s(null==(t=e.target.value)?void 0:t.trim())}else s(e.target.value)},placeholder:u,maxLength:c,ref:m,onFocus:p,onBlur:y,disabled:n,style:f,autoComplete:x,onKeyDown:A,onKeyUp:k,"aria-label":P,"aria-invalid":b?"true":"false","aria-describedby":M}),g&&(0,r.jsx)("div",{children:(0,r.jsx)(o.A,{variant:"body3",color:"error",children:g})})]})},c=e=>{let{first:t,last:n,...i}=e;return(0,r.jsx)(u,{...i,style:{borderRadius:0,borderTopWidth:+!!t,borderTopLeftRadius:24*!!t,borderTopRightRadius:24*!!t,borderBottomLeftRadius:24*!!n,paddingLeft:20}})},p=u},80425:(e,t,n)=>{"use strict";n.d(t,{A:()=>y});var r=n(71474),i=n(26410),l=n(57932),a=n(1849),o=n(75953),s=n(3906),d=n(4230),u=n(43080);let c=(0,r.$)({uri:s.DR.GRAPHQL_ENDPOINT}),p=(0,o.o)(async(e,t)=>{let{headers:n}=t,r="",i="";if(u.M){var l,a;r=null!=(l=sessionStorage.getItem("token"))?l:"",i=null!=(a=sessionStorage.getItem("openidToken"))?a:""}return{headers:{...n,authorization:r?"Bearer ".concat(r):"","x-openid-auth":i?"Bearer ".concat(i):"","x-org":(0,d.VB)()}}}),y=new i.R({cache:new l.D({typePolicies:{KennelPolicy:{fields:{metadata:{merge(e,t,n){let{mergeObjects:r}=n;return r(e,t)}}}},KennelClient:{fields:{metadata:{merge(e,t,n){let{mergeObjects:r}=n;return r(e,t)}}}},KennelFee:{keyFields:["name","total"]},AppProduct:{keyFields:["slug"]},DraftPreview:{fields:{policyPreviews:{merge:(e,t)=>t}}},Query:{fields:{userPaymentPolicies:{merge:(e,t)=>t},paymentPolicies:{merge:(e,t)=>t}}}}}),link:(0,a.H)([p,c])})},85302:(e,t,n)=>{"use strict";n.d(t,{$z:()=>u,x6:()=>c,x9:()=>d});var r=n(37876);n(14232);var i=n(48230),l=n.n(i),a=n(70221),o=n(65157),s=n(4230);let d=e=>{let{children:t,...n}=e;return t?(0,r.jsx)(l(),{...n,legacyBehavior:!0,children:t[0]}):null},u=e=>{let{children:t,color:n}=e;return(0,r.jsx)("a",{style:{color:n||a.A.blue300},href:"mailto:".concat(t),children:t})},c=e=>{let{i18nKey:t,defaults:n,tOptions:i={},values:l={},components:a={}}=e;return(0,r.jsx)(o.x6,{i18nKey:t,defaults:n,values:l,tOptions:{...i,context:(0,s.VB)()},components:a})}}},e=>{e.O(0,[7,742,746,636,593,792],()=>e(e.s=75382)),_N_E=e.O()}]); 2//# sourceMappingURL=login-5ada2aaac3544261.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.