PageSourceSearch

https://reworkdigital.io/_next/static/chunks/pages/auth/callback-bd2c9ee52857432f.js

js reworkdigital.io collected 2026-10-05 02:43:26 UTC 10,684 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[43620],{1575:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>w});var a=r(37876),s=r(14232),i=r(89099),l=r(50873),n=r(19412),c=r(42009),o=r(77996),d=r(67609),h=r(20962),u=r(70442),g=r(74092),m=r(33890),x=r(6956),p=r(25707);function w(){let e=(0,i.useRouter)(),t=(0,u.Bd)(),[r,w]=(0,s.useState)("processing"),[f,b]=(0,s.useState)(t.authCallback.messages.initial),[k,j]=(0,s.useState)(""),v=(0,s.useRef)(!1);(0,s.useEffect)(()=>{e.isReady&&(v.current||(v.current=!0,y()))},[e.isReady]);let y=async()=>{try{if(!l.isFirebaseConfigured)throw Error(t.authCallback.errors.firebaseNotConfigured);let r=(0,l.getFirebaseAuth)(),a=(0,l.getFirebaseFirestore)(),s=e.query.role||sessionStorage.getItem("pendingRole")||localStorage.getItem("pendingRole")||"candidate";sessionStorage.removeItem("pendingRole"),localStorage.removeItem("pendingRole"),b(t.authCallback.messages.retrieving);let i=null;try{let e=await (0,n.getRedirectResult)(r);(null==e?void 0:e.user)&&(i=e.user)}catch(e){console.warn("getRedirectResult failed, will use fallback:",e.message)}if(!i&&r.currentUser&&(i=r.currentUser),i||(i=await new Promise(e=>{let t=setTimeout(()=>{a(),e(null)},8e3),a=(0,n.onAuthStateChanged)(r,r=>{clearTimeout(t),a(),e(r)})})),!i)throw console.error("No authenticated user found after redirect"),Error(t.authCallback.errors.authFailed);await N(i,s,a)}catch(r){console.error("Auth callback error:",r),w("error"),j(r.message||t.authCallback.errors.genericFailure),b(t.authCallback.messages.authFailed),setTimeout(()=>{e.replace("/login?error=auth_failed")},3e3)}},N=async(r,a,s)=>{try{b(t.authCallback.messages.settingUp),sessionStorage.removeItem("pendingRole"),localStorage.removeItem("pendingRole");let i=await (0,c.getDoc)((0,c.doc)(s,"users",r.uid));if(i.exists()){let a=i.data(),l=await (0,c.getDoc)((0,c.doc)(s,"profiles",r.uid));if(l.exists()){let s=l.data();if(s.firstName&&""!==s.firstName.trim()){let s=localStorage.getItem("redirect_after_login");localStorage.removeItem("redirect_after_login");let i=s&&!(0,h.oj)(s)?s:"";if(i){w("success"),b("Welcome back! Redirecting..."),setTimeout(()=>{e.replace(i)},1e3);return}w("success"),b(t.authCallback.messages.welcomeBack);let l=(0,h.Km)(a.role)||(0,x.kL)(await (0,p.yk)(r.uid,a));setTimeout(()=>{e.replace(l)},1e3);return}}w("success"),b(t.authCallback.messages.completeProfile),setTimeout(()=>{e.replace("/complete-profile")},1e3);return}if("business"===a&&r.email&&!(0,m.FY)(r.email)){try{await r.delete()}catch(e){console.warn("Failed to delete personal-email business signup:",e)}throw await (0,l.getFirebaseAuth)().signOut(),Error(m.w3)}b(t.authCallback.messages.creatingAccount);let n={uid:r.uid,email:r.email,role:a,...r.displayName&&{displayName:r.displayName},...r.photoURL&&{photoURL:r.photoURL},isActive:!0,isVerified:r.emailVerified,isCandidateApproved:!0,servicesAccessApproved:!0,projectsAccessApproved:!0,..."candidate"===a&&{approvalMethod:"auto_approved"},createdAt:(0,c.serverTimestamp)(),updatedAt:(0,c.serverTimestamp)()};await (0,c.setDoc)((0,c.doc)(s,"users",r.uid),n),w("success"),b(t.authCallback.messages.accountCreated),setTimeout(()=>{e.replace("/complete-profile")},1e3)}catch(e){throw console.error("Error processing authenticated user:",e),e}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Ay,{localeTitle:{en:g.P9.en.seo.authCallback.title,fr:g.P9.fr.seo.authCallback.title},noindex:!0}),(0,a.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 flex items-center justify-center p-4",children:(0,a.jsxs)("div",{className:"max-w-md w-full bg-white rounded-2xl shadow-xl p-8 text-center dark:bg-neutral-900",children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)(o.A,{variant:"text",className:"h-12 mx-auto",dark:!1})}),"processing"===r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-16 w-16 border-b-2 border-blue-600"})}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:t.authCallback.processingHeading}),(0,a.jsx)("p",{className:"text-gray-600",children:f})]}),"success"===r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-green-100",children:(0,a.jsx)("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})})}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:t.authCallback.successHeading}),(0,a.jsx)("p",{className:"text-gray-600",children:f})]}),"error"===r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-red-100",children:(0,a.jsx)("svg",{className:"w-8 h-8 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:t.authCallback.errorHeading}),(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:k||f}),(0,a.jsx)("button",{onClick:()=>
1e.replace("/login"),className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition",children:t.authCallback.tryAgainButton})]})]})})]})}},6956:(e,t,r)=>{"use strict";r.d(t,{N8:()=>l,bS:()=>i,cd:()=>c,fZ:()=>s,kL:()=>n});let a=["business","company","employer"];function s(e){return a.includes((e||"").trim().toLowerCase())}function i(e){if(!e)return!1;let t=(e.role||"").trim();return t?s(t):s(e.accountType)}async function l(e,t){if(!e)return"unknown";for(let r of["users","profiles"]){let a=null;try{a=await t(r,e)}catch(e){continue}if(a&&((a.role||"").trim()||(a.accountType||"").trim()))return i(a)?"business":"expert"}return"unknown"}function n(e){return"business"===e?"/company-dashboard":"/dashboard"}function c(e){return s(e)?"/business-hub":"/expert-hub"}},25707:(e,t,r)=>{"use strict";r.d(t,{xc:()=>n,yk:()=>c});var a=r(42009),s=r(50873),i=r(6956);async function l(e,t){let r=await (0,a.getDoc)((0,a.doc)((0,s.getFirebaseFirestore)(),e,t));return r.exists()?r.data():null}function n(e){return(0,i.N8)(e,l)}function c(e,t){return(0,i.N8)(e,async(e,r)=>"users"===e?t:l(e,r))}},27411:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var a=r(37876);function s(e){let{size:t=40,className:r="",dark:s}=e,i={width:t,height:t,objectFit:"contain",flexShrink:0},l="/rework-mark.png?v=4",n="/rework-mark-dark.png?v=4";return!0===s?(0,a.jsx)("img",{src:n,alt:"REWORK",width:t,height:t,draggable:!1,className:r,style:{display:"inline-block",...i}}):!1===s?(0,a.jsx)("img",{src:l,alt:"REWORK",width:t,height:t,draggable:!1,className:r,style:{display:"inline-block",...i}}):(0,a.jsxs)("span",{className:r,style:{display:"inline-block",width:t,height:t,lineHeight:0,flexShrink:0},"aria-label":"REWORK",role:"img",children:[(0,a.jsx)("img",{src:l,alt:"","aria-hidden":"true",width:t,height:t,draggable:!1,className:"block dark:hidden",style:i}),(0,a.jsx)("img",{src:n,alt:"","aria-hidden":"true",width:t,height:t,draggable:!1,className:"hidden dark:block",style:i})]})}},60849:(e,t,r)=>{"use strict";r.d(t,{D:()=>o});var a=r(14232);let s="rework-theme",i="light",l=new Set;function n(){let e=localStorage.getItem(s);return"light"===e||"dark"===e?e:"light"}function c(e){if("undefined"==typeof document)return;let t=document.documentElement;"dark"===e?t.classList.add("dark"):t.classList.remove("dark")}function o(){let[e,t]=(0,a.useState)("light"),[r,o]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=n();i=e,t(e),o(!0),c(e);let r=e=>t(e);l.add(r);let a=e=>{if(e.key!==s)return;let r=n();i=r,c(r),t(r)};return window.addEventListener("storage",a),()=>{l.delete(r),window.removeEventListener("storage",a)}},[]),{theme:e,toggleTheme:(0,a.useCallback)(()=>{var e;i=e="dark"===i?"light":"dark",localStorage.setItem(s,e),c(e),l.forEach(t=>t(e))},[]),mounted:r}}},71168:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/auth/callback",function(){return r(1575)}])},77996:(e,t,r)=>{"use strict";r.d(t,{A:()=>g});var a=r(37876),s=r(54587),i=r.n(s),l=r(89099),n=r(60849),c=r(27411),o=r(17398),d=r(89181),h=r(75794),u=r(39183);function g(e){let{className:t="",textClassName:r="",onClick:s,variant:g="full",size:m="md",dark:x,allWhite:p=!1,productName:w,productIcon:f,showText:b}=e,k=(0,l.useRouter)(),{theme:j}=(0,n.D)(),v=(null!=x?x:"dark"===j)||p,y="icon"===g,N=y?({xs:{width:24,height:24},sm:{width:28,height:28},md:{width:36,height:36},lg:{width:44,height:44},xl:{width:52,height:52}})[m]:({xs:{width:72,height:23},sm:{width:90,height:28},md:{width:120,height:38},lg:{width:148,height:47},xl:{width:176,height:56}})[m],C=v?"/rework-logo-white.png":"/rework-logo.png",R={xs:{width:36,height:36},sm:{width:44,height:44},md:{width:52,height:52},lg:{width:60,height:60},xl:{width:68,height:68}}[m],A={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg",xl:"text-xl"};return(0,a.jsxs)("div",{className:"flex items-center cursor-pointer group ".concat(t),onClick:()=>{s?s():k.push("/")},children:["text"!==g&&(0,a.jsx)("div",{className:"group-hover:scale-105 transition-transform duration-200 ".concat(y?"":"mr-2"),children:"finprob"===f?(0,a.jsx)(o.A,{size:y?N.width:R.width,dark:v}):"swiitch"===f?(0,a.jsx)(d.A,{size:y?N.width:R.width,dark:v}):"loevech"===f?(0,a.jsx)(h.A,{size:y?N.width:R.width,dark:v}):"resume"===f?(0,a.jsx)(u.A,{size:y?N.width:R.width,dark:v}):(0,a.jsx)(c.A,{size:y?N.width:R.width,dark:!!p||x})}),!y&&(w?/^rework\s+/i.test(w)?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-extrabold tracking-tight ".concat(A[m]," ").concat(v?"text-white":"text-neutral-900 dark:text-white"," ").concat(r),children:"REWORK"}),(0,a.jsx)("span",{className:"font-bold tracking-tight ".concat(A[m]," text-purple-600 dar
1k:text-purple-400"),children:w.replace(/^rework\s+/i,"")})]}):(0,a.jsx)("span",{className:"font-bold tracking-tight ".concat(A[m]," ").concat(v?"text-white":"text-neutral-900 dark:text-white"," ").concat(r),children:w}):(0,a.jsx)("div",{className:"relative group-hover:scale-105 transition-transform duration-200 flex-shrink-0",style:{width:N.width,height:N.height},children:(0,a.jsx)(i(),{src:C,alt:"REWORK Digital",fill:!0,sizes:"".concat(N.width,"px"),className:"object-contain",priority:!0,style:v?{filter:"brightness(0) invert(1)"}:void 0})}))]})}}},e=>{e.O(0,[90636,46593,38792],()=>e(e.s=71168)),_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.