1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1776],{34208:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__N_SSP:()=>D,default:()=>T});var i=n(18153),r=n(44824),a=n(14232),o=n(29920),s=n(76252),l=n(89099),d=n(77539),c=n(44157),h=n(11757);let{onboardingApiHost:u,onboardingApiOnboardEndpoint:m}=d.YG;class g{constructor(e){this.sendOnboardingLinkToCustomer=async(e,t)=>{let n=await this.auth.callApi(this.invitationsBaseUrl,{method:"POST",body:JSON.stringify({customerId:e,systemId:t})});try{if(n.ok){let e={smsSent:!1,emailSent:!1},{channel:t,recipient:i}=await n.json();return{data:t?.toLowerCase()==="email"?{...e,emailSent:!0,emailAddress:i}:{...e,smsSent:!0,phone:i}}}}catch(e){e instanceof Error&&console.warn(`Cannot create invitation: ${e.message}`)}return{data:void 0,isError:!0}},this.getOnboardInviteInfo=async e=>{try{let t=`${this.invitationsBaseUrl}${e}`,n=await this.auth.callApi(t),{customerId:i,name:r,systemId:a}=await n.json();return{customerName:r,customerId:i,systemId:a}}catch(e){e instanceof Error&&console.log(`Could not fetch invite info: ${e.message}`);return}},this.acceptOnboardId=async e=>{let t,n=`${this.invitationsBaseUrl}${e}`,i=await this.auth.callApi(n,{method:"PUT"});return i.ok||(t="0024"===(await i.json()).code?"Cannot accept":"Other"),{ok:i.ok,error:t}},this.onboardUrl=`${u}${m}`,this.invitationsBaseUrl=`${u}/invitations/`,this.auth=e}static{this.create=()=>new g(new h.t)}}let{onboardingDigitalCrmHost:f}=d.YG,p=(0,s.A)(o.$n)` 2 &[disabled] { 3 opacity: 0.5; 4 } 5`,v=(0,s.A)(o.P)` 6 strong { 7 font-weight: 600; 8 } 9`,k=(0,s.A)(o.L9)` 10 strong { 11 font-weight: 600; 12 } 13`,b=(0,s.A)(o.e2)` 14 margin-top: 2rem; 15`,y=e=>{let{onboardingInfo:t,inviteId:n}=e,r=(0,c.iZ)(),s=(0,l.useRouter)(),[d,h]=(0,a.useState)(!1),u=!d,m=(0,a.useCallback)(async e=>{if(e.ok){let e="digital-crm"===t.systemId,i=`${f}/nb-NO/Register?invitation=${n}`;await s.push(e?i:"/minesider?onboarding=success")}else{let{error:t}=e;console.log(`Could not accept invitation. Reason: ${t}`)}},[n,t.systemId,s]),y=(0,a.useCallback)(()=>s.push("/minesider?onboarding=canceled"),[s]),w=(0,a.useCallback)(async e=>{if(e.preventDefault(),!d)return;if(!n)return void console.warn("Cannot accept invitation without invitation id");let t=g.create(),i=await t.acceptOnboardId(n);await m(i)},[m,n,d]);return(0,i.Y)("form",{onSubmit:w,children:(0,i.Y)(o.mI,{color:"none",heading:"Bekreft tilgang til kundeforhold",preHeading:`${t.name}, ${t.customerId}`,contentAlignment:"left",children:(0,i.FD)(i.FK,{children:[(0,i.FD)(v,{children:["Gi brukerkontoen ",(0,i.Y)("strong",{children:r?.name||"du n\xe5 bruker"})," tilgang til kundeforholdet"," ",(0,i.Y)("strong",{children:t.name})," med kundenummer ",(0,i.Y)("strong",{children:t.customerId}),"."]}),(0,i.Y)(o.oV,{label:(0,i.FD)(k,{appearance:"body-s",children:["Jeg bekrefter at jeg skal v\xe6re eier og administrator av kundeforhold ",(0,i.Y)("strong",{children:t.customerId})," (",t.name,")"]}),type:"checkbox",id:"confirmation",onChange:()=>h(!d)}),(0,i.FD)(b,{alignItems:"center",justify:"flex-start",children:[(0,i.Y)(o.$n,{type:"button",onClick:y,mode:"secondary",children:"Avbryt"}),(0,i.Y)(p,{type:"button",onClick:w,disabled:u,children:"Bekreft"})]})]})})})};var w=n(55764);let Y=async e=>{try{if(!e||""===e)return void console.warn(`Cannot use invalid format of invitation id: ${e}`);let t=await g.create().getOnboardInviteInfo(e);if(t){let{customerName:e,customerId:n,systemId:i}=t;return{name:e,customerId:n,systemId:i}}}catch(e){e instanceof Error&&console.log(e.message)}},C=({children:e})=>(0,i.Y)(o.mc,{capacity:"xl",children:(0,i.Y)(o.fI,{children:(0,i.Y)(o.VP,{children:(0,i.Y)(o.so,{paddingTop:"l",rowGap:"none",direction:"column",children:e})})})}),I=({inviteId:e})=>{let t=async()=>Y(e),[n,r]=(0,w.D)(t);return r?n&&e&&n.customerId?(0,i.Y)(C,{children:(0,i.Y)(y,{inviteId:e,onboardingInfo:n})}):(0,i.FD)(C,{children:[(0,i.Y)(o.H2,{children:"En feil oppstod"}),(0,i.Y)(o.P,{children:"Kan ikke knytte konto uten gyldig invitasjon."})]}):(0,i.Y)(C,{children:(0,i.Y)(o.P,{children:"Henter invitasjon..."})})};var $=n(7941),_=n(78333),S=n(3422),A=n(14517),O=n(88220).Buffer;let E=e=>{let{MessageComponent:t}=e,{asPath:n}=(0,l.useRouter)(),{isLoggedIn:r,logInAuth0:o}=(0,c.Z2)();return(0,a.useEffect)(()=>{var e,t;let i,a=Math.random().toString(36).slice(2),s=((e=JSON.stringify({to:n,nonce:a}))instanceof O?e:O.from(e.toString(),"binary")).toString("base64");(0,S.setCookie)(null,A.p5,s,{expires:(t=new Date,(i=(0,_.a)(t,void 0)).setTime(i.getTime()+35*$.Cg),i),secure:A.gM.startsWith("https"),httpOnly:!1,path:"/"}),r||o({state:a})},[]),(0,i.Y)(t,{})},N=()=>(0,i.Y)("p",{children:"For \xe5 gi deg mest ut av denne siden logger vi deg inn f\xf8rst!"}),P=e=>{let{WrappedComponent:t,MessageComponent:n}=e,{isLoggedIn:r}=(0,c.Z2)();return r?(0,i.Y)(t,{...e}):(0,i.Y)(E,{MessageComponent:n})};var D=!0;let T=((e,t=N)=>n=>
15(0,i.Y)(P,{WrappedComponent:e,MessageComponent:t,...n}))(({menu:e,footer:t,inviteId:n,lang:a})=>(0,i.Y)(r.A,{lang:a,menu:e,footer:t,pageUrlArray:{0:{path:"godta",name:"Godta "},1:{path:"minesider",name:"Mine sider"}},seo:{_type:"seo",title:"Mine sider",description:"Administrer dine kundeforhold p\xe5 Mine sider",disallowRobots:!1,image:void 0},children:(0,i.Y)(I,{inviteId:n})}))},68004:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/minesider/godta",function(){return n(34208)}])}},e=>{e.O(0,[8749,8284,9629,1229,6894,1552,4824,6593,636,8792],()=>e(e.s=68004)),_N_E=e.O()}]);
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.