1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5031],{18738:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/userauth",function(){return r(31364)}])},31364:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>k});var n=r(56191),a=r.n(n),o=r(60180),c=r.n(o),i=r(92564),u=r(68524),s=r(14232),l=r(63100),d=r(81976),f=r(12552),m=r(96184),p=r(26771),h=r(86364),v=r(87842),S=r(83468),g=r(37876);let k=function(){var e,t,r=(0,i.Jd)(),n=r.user,o=r.isLoading,k=(0,s.useState)(l.gv),C=k[0];k[1];var D=(0,s.useState)({}),T=D[0];D[1];var E=(0,s.useState)(""),x=E[0],N=E[1],P="/",A="false",w=d.A.RETURN_APP_URL_KEY,I=d.A.ENABLE_DTC_CONSENT_KEY,b=function(e){if("u">typeof document){var t=d.A.DTC_TOKEN_COOKIE_EXPIRE_HRS||"1",r=new Date;r.setHours(r.getHours()+Number(t));var n=r.toUTCString();if(e.token&&(document.cookie="DtcAuth0Token=".concat(e.token,"; Secure; SameSite=Strict; Path=/; Expires=").concat(n)),e.email&&(document.cookie="DtcAuth0Email=".concat(e.email,"; Secure; SameSite=Strict; Path=/; Expires=").concat(n)),e.firstName||e.lastName){var a="".concat(e.firstName||""," ").concat(e.lastName||"").trim();document.cookie="DtcCdpFullName=".concat(a,"; Secure; SameSite=Strict; Path=/; Expires=").concat(n)}e.consent&&(document.cookie="DtcCdpConsent=".concat(e.consent,"; Secure; SameSite=Strict; Path=/; Expires=").concat(n))}},_=function(e){if("u">
1typeof document){var t,r=d.A.DTC_TOKEN_COOKIE_EXPIRE_HRS||"1",n=new Date;n.setHours(n.getHours()+Number(r));var a=(null==e||null==(t=e.token)?void 0:t.replace("Opaque","").trim())||"";document.cookie="".concat(d.A.DTC_TOKEN_KEY_ACCOUNT,"=").concat(a,"; Secure; SameSite=Strict; Path=/; Expires=").concat(n.toUTCString()),document.cookie="DtcToken=".concat(null==e?void 0:e.token,"; Secure; SameSite=Strict; Path=/; Expires=").concat(n.toUTCString()),document.cookie="DtcConsumerId=".concat(null==e?void 0:e.customerId,"; Secure; SameSite=Strict; Path=/; Expires=").concat(n.toUTCString());var o=new Date(0).toUTCString();document.cookie="DtcAuth0Token=; Secure; SameSite=Strict; Path=/; Expires=".concat(o),document.cookie="DtcAuth0Email=; Secure; SameSite=Strict; Path=/; Expires=".concat(o),document.cookie="DtcCdpFullName=; Secure; SameSite=Strict; Path=/; Expires=".concat(o),document.cookie="DtcCdpConsent=; Secure; SameSite=Strict; Path=/; Expires=".concat(o)}},U=(e=a()(c().mark(function e(){var t,r;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return P=(t=new URLSearchParams(window.location.search)).get(w),A=t.get(I),e.next=3,(0,l.V6)(l.I3.navigationBlock);case 3:r=e.sent,setTimeout(function(){if(r)(0,l.zH)((0,l.jd)({feature:l.I3.oktaFeature,message:l.I3.oktaTokenExist,component:l.I3.navigationBlock})),(0,l.kr)(r,C,T,function(){var e=a()(c().mark(function e(t,a){var o,i,u,s,v,S,g,k,C,D,T,E;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=36;break}if(g=null==a||null==(o=a.data)?void 0:o.profile,(0,l.zH)((0,l.jd)({feature:l.I3.oktaFeature,message:l.I3.CDPProfileExist,component:l.I3.navigationBlock})),k=null==g||null==(i=g.traits)?void 0:i.find(function(e){return"firstName"===e.traitName}),C=null==g||null==(u=g.traits)?void 0:u.find(function(e){return"lastName"===e.traitName}),D=null==g||null==(s=g.traits)?void 0:s.find(function(e){return"consentForDTCProfileCreation"===e.traitName}),T="".concat("https://loginservice.thehut.net/pg_okta_prod_nl?site=159&subsite=nl&shield=true&returnUrl=").concat("https://www.oralb.nl").concat(d.A.DTC_API_URL).concat(d.A.DTC_CIAM_AUTH_PATH,"?").concat(w,"=").concat(P),!(D&&(null==(v=D.values)?void 0:v.toLowerCase())==="true")){e.next=13;break}return b({token:r,email:(null==n?void 0:n.email)||void 0,firstName:null==k?void 0:k.values,lastName:null==C?void 0:C.values,consent:D.values}),(0,f.zh)(T),e.abrupt("return");case 13:if((null==(S=A)?void 0:S.toLowerCase())!=="true"){e.next=31;break}return E={input:{transmitterSourceId:h.uM.transmitterSourceId,traits:[{traitName:"consentForDTCProfileCreation",traitValue:"true"}]}},e.prev=15,e.next=18,(0,m.AA)(r,p.HA,E);case 18:b({token:r,email:(null==n?void 0:n.email)||void 0,firstName:null==k?void 0:k.values,lastName:null==C?void 0:C.values,consent:"true"}),e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(15),console.error("[UserAuth] Error updating CDP consent:",e.t0),(0,f.zh)(P||"/"),e.abrupt("return");case 26:return console.log("[UserAuth] Redirecting to DTC URL after consent update:",T),(0,f.zh)(T),e.abrupt("return");case 31:return console.log("[UserAuth] No DTC consent needed, redirecting to:",P||"/"),(0,f.zh)(P||"/"),e.abrupt("return");case 34:e.next=40;break;case 36:return console.log("[UserAuth] CDP data fetch failed"),(0,l.zH)((0,l.jd)({feature:l.I3.oktaFeature,message:l.I3.oktaTokenNotExist,component:l.I3.navigationBlock})),(0,f.zh)(P||"/"),e.abrupt("return");case 40:case"end":return e.stop()}},e,null,[[15,21]])}));return function(t,r){return e.apply(this,arguments)}}());else{console.warn("[UserAuth] No token available, cannot proceed with authentication"),N("[UserAuth] No token available, cannot proceed with authentication");return}},2e3);case 5:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)}),O=(t=a()(c().mark(function e(t){var r,n;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=new URLSearchParams(window.location.search).get(d.A.RETURN_APP_URL_KEY),e.prev=1,e.next=4,(0,l.V6)(l.I3.navigationBlock);case 4:return n=e.sent,e.next=7,(0,l.kr)(n,C,T,function(){var e=a()(c().mark(function e(r,a){var o,i,u,s,l,d,f,v,g,k,C,D,T,E,x,P,A;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r){e.next=51;break}return u=(null==(i=null==a||null==(o=a.data)?void 0:o.profile)?void 0:i.opts)||[],e.prev=3,e.next=6,(0,S.eo)({socialToken:t.dtcSocialAccessToken,email:t.dtcAuth0Email,fullName:t.dtcCdpFullName||"",opts:u});case 6:if(!(null==(s=e.sent)?void 0:s.ErrorMessage)){e.next=11;break}return console.error("[DTC Token] Error from DTC service:",s.ErrorMessage),N(s.ErrorMessage),e.abrupt("return");case 11:if(!(s&&"u">typeof document)){e.next=42;break}if(null==s?void 0:s.customerId){e.next=16;break}return console.error("DTC Token Data does not contain customerId",s),N("DTC Token Data does not contain customerId!"),e.abrupt("return");case 16:return e.prev=16,l={input:{transmitterSourceId:h.uM.transmitterSourceId,traits:[{traitName:"DTCIdentifer",traitValue:s.customerId||""}]}},e.next=20,(0,m.AA)(n,p.HA,l);case 20:e.prev=20,(d=sessionStorage.getItem("CDPProfile"))&&(k=null==(g=JSON.parse(d))||null==(f=g.data)||null==(v=f.profile)?void 0:v.traits)&&Array.isArray(k)&&(D=k.find(function(e){return"DTCIdentifer"===e.traitName}),T=k.find(function(e){return"consentForDTCProfileCreation"===e.traitName}),D&&D.values&&T&&(null==(C=T.values)?void 0:C.toLowerCase())==="true"||(A=(null==g||null==(E=g.data)||null==(x=E.profile)||null==(P=x.ids)?void 0:P.sourceId)||"",D?(D.values=s.customerId,D.collectedDate=new Date().toISOString(),D.collectedBy=A):k.push({traitName:"DTCIdentifer",values:s.customerId,collectedDate:new Date().toISOString(),collectedBy:A}),T?(T.values="true",T.collectedDate=new Date().toISOString(),T.collectedBy=A):k.push({traitName:"consentForDTCProfileCreation",values:"true",collectedDate:new Date().toISOString(),collectedBy:A}),sessionStorage.setItem("CDPProfile",JSON.stringify(g)),console.log("CDPProfile updated with DTCIdentifer from cookie"))),e.next=30;break;case 25:return e.prev=25,e.t0=e.catch(20),console.error("Error updating CDPProfile with DTCIdentifer:",e.t0),N("Error updating CDPProfile with DTCIdentifer: "+(e.t0 instanceof Error?e.t0.message:String(e.t0))),e.abrupt("return");case 30:return e.next=32,(0,S.vv)({dtcToken:s.token,opts:u});case 32:console.log("DTC Marketing Preference update response:-----",e.sent),e.next=41;break;case 36:return e.prev=36,e.t1=e.catch(16),console.log("Error updating DTCIdentifier trait:",e.t1 instanceof Error?e.t1.message:String(e.t1)),N("Error updating DTCIdentifier trait: "+(e.t1 instanceof Error?e.t1.message:String(e.t1))),e.abrupt("return");case 41:_(s);case 42:e.next=49;break;case 44:return e.prev=44,e.t2=e.catch(3),console.error("Error generating DTC token:",e.t2 instanceof Error?e.t2.message:String(e.t2)),N("Error generating DTC token: "+(e.t2 instanceof Error?e.t2.message:String(e.t2))),e.abrupt("return");case 49:e.next=54;break;case 51:return console.warn("[DTC Token] CDP data fetch failed, cannot proceed"),N("CDP data fetch failed, cannot proceed! Please try again."),e.abrupt("return");case 54:case"end":return e.stop()}},e,null,[[3,44],[16,36],[20,25]])}));return function(t,r){return e.apply(this,arguments)}}());case 7:e.next=14;break;case 9:return e.prev=9,e.t0=e.catch(1),console.error("[DTC Token] Error generating DTC token (outer):",e.t0),N("An error occurred while generating DTC token. Please try again."),e.abrupt("return");case 14:(0,f.zh)(r||"/");case 15:case"end":return e.stop()}},e,null,[[1,9]])})),function(e){return t.apply(this,arguments)});return(0,s.useEffect)(function(){if(o)return void console.log("[UserAuth] Waiting for auth state...");if(!n){console.log("[UserAuth] Waiting for user to be available..."),(0,f.zh)("/api/auth/login");return}var e=null,t=new URLSearchParams(window.location.search).get("Code");t&&(e=(0,v.TW)(decodeURIComponent(t)));var r=(0,v.WT)("DtcAuth0Email"),a=(0,v.WT)("DtcCdpFullName")||"";
1e&&r?O({dtcSocialAccessToken:e,dtcAuth0Email:r,dtcCdpFullName:a}):U()},[o,n]),(0,g.jsx)(i.vu,{children:x?(0,g.jsx)("div",{className:"flex min-h-screen items-center justify-center",children:(0,g.jsxs)("div",{className:"text-center",children:[(0,g.jsx)("p",{className:"text-lg font-semibold text-red-600",children:x}),(0,g.jsx)("button",{onClick:function(){return(0,f.zh)("/")},className:"mt-4 rounded bg-blue-600 px-6 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"Home Page"})]})}):(0,g.jsx)(u.A,{fullScreen:!0,text:d.A.USER_AUTH_LOADER})})}}},e=>{e.O(0,[4126,8216,7128,8763,5816,5349,3626,230,3019,9744,4183,7686,7293,5012,769,1343,9897,1730,3580,9192,8979,5743,2626,3158,2877,2816,9679,2559,6941,7214,6975,4853,4920,7296,6835,6954,159,607,2190,989,1268,4162,2232,236,9381,8642,8906,6295,1569,9077,1785,8731,936,1156,5322,3289,3602,2821,3579,4937,7089,8443,5703,2876,4421,1346,4540,3976,4969,8790,8311,7064,58,9921,3575,4619,2865,7950,8262,4127,8025,7892,9225,3035,452,9745,5106,8792],()=>e(e.s=18738)),_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.