PageSourceSearch

https://mysendbit.com/assets/SocialCallback-Zg09bNdD.js

js mysendbit.com collected 2026-10-02 00:53:21 UTC 2,873 bytes, 1 lines download raw bytes

1import{p as f,h,r as g,j as c}from"./vendor-react-Dw7X3JZT.js";import{u as m,a as v,l as S,g as x,h as y,b as E}from"./index-BEZ7mpN6.js";import"./vendor-utils-WadUx6vN.js";import"./vendor-CZR7Gm73.js";import"./vendor-ui-ODtAki8E.js";import"./vendor-framer-motion-CpxrKHsN.js";function b(t){if(t.get("error"))return t.get("error_description")||t.get("message")||t.get("error")||null;if(t.get("success")==="false")return t.get("message")||"Authentication failed.";const e=t.get("errors");if(e)try{const n=JSON.parse(e),r=Object.keys(n)[0];if(r){const a=n[r];return Array.isArray(a)?a[0]:String(a)}}catch{return e}return null}const _=()=>{const[t]=f(),e=h(),{handleSocialAuthResponse:n}=m(),{addToast:r}=v(),a=g.useRef(!1);return g.useEffect(()=>{if(a.current)return;a.current=!0;const d=t.get("code"),o=b(t);if(o){const i=o.toLowerCase().includes("phone number")||o.toLowerCase().includes("sign up");r({title:"Social sign-in failed",description:i?"This Google account isn't linked to a SendBit account yet. Please register first.":o,variant:"destructive",duration:6e3}),e(i?"/auth/register":"/auth/login",{replace:!0});return}if(!d){r({title:"Social sign-in failed",description:"No authorisation code received. Please try again.",variant:"destructive"}),e("/auth/login",{replace:!0});return}(async()=>{try{x(),await y();const i=await E.exchangeSocialCode(d),s=await n(i);if(s.success){const u=i.data?.is_new_user,l=i.data?.requires_phone_verification,p=i.data?.user?.email??"";if(l){r({title:u?"Account created!":"Almost there!",description:"Please verify your phone number to continue.",variant:"success",duration:5e3}),e("/auth/verify-account",{replace:!0,state:{email:p,fromPhoneVerification:!0}});return}r(u?{title:"Account created!",description:"Your account is ready. Welcome to SendBit!",variant:"success",duration:6e3}:{title:"Welcome back!",description:"You're now signed in.",variant:"success"}),e("/dashboard/home",{replace:!0})}else r({title:"Social sign-in failed",description:s.message||"Authentication failed. Please try again.",variant:"destructive"}),e("/auth/login",{replace:!0})}catch(i){const s=i;if(s?.response?.status===403&&s.response?.data?.errors?.error_code==="DEVICE_VERIFICATION_REQUIRED"){const l=s.response?.data?.data?.email??"";e("/auth/device-verification",{replace:!0,state:{email:l}});return}r({title:"Social sign-in failed",description:"An unexpected error occurred. Please try again.",variant:"destructive"}),e("/auth/login",{replace:!0})}})()},[r,n,e,t]),c.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-white gap-6",children:[c.jsx("img",{src:S,alt:"SendBit",className:"h-10 w-auto"}),c.jsx("div",{className:"w-10 h-10 border-4 border-purple-200 border-t-purple-700 rounded-full animate-spin"}),c.jsx("p",{className:"text-sm text-gray-500",children:"Completing sign-in…"})]})};export{_ as default};

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.