1import { 2 ModalStatusBox 3} from "./chunk-C7QD2AEU.js"; 4import "./chunk-GABYCIRX.js"; 5import "./chunk-GWTLZPQW.js"; 6import "./chunk-TUIXK4GB.js"; 7import "./chunk-2SIOJVPY.js"; 8import "./chunk-DELSWSYH.js"; 9import { 10 G 11} from "./chunk-F6HKBNBJ.js"; 12import "./chunk-EFX7LFQF.js"; 13import { 14 qe 15} from "./chunk-GW6OWVAS.js"; 16import "./chunk-V3VQYMUU.js"; 17import "./chunk-WAY6HQ7C.js"; 18import "./chunk-KAIIOKO3.js"; 19import "./chunk-F7LOI2M5.js"; 20import "./chunk-GWCOH4DF.js"; 21import "./chunk-FUATFXFK.js"; 22import "./chunk-55ARO2SJ.js"; 23import "./chunk-J46SIAYM.js"; 24import "./chunk-EUVCRAFR.js"; 25import "./chunk-5HUKUZMX.js"; 26import "./chunk-DRQXJS52.js"; 27import "./chunk-EKGTQN7B.js"; 28import "./chunk-57LJOLTQ.js"; 29import "./chunk-QOAWOBZZ.js"; 30import "./chunk-CXC3RFJP.js"; 31import "./chunk-LOYGATPO.js"; 32import "./chunk-MWZBDUVS.js"; 33import "./chunk-IVTAVDWF.js"; 34import { 35 require_react 36} from "./chunk-2TKNTQO7.js"; 37import { 38 __toESM, 39 init_buffer_shim 40} from "./chunk-DMHST2WB.js"; 41 42// ../VeeFriends.Web.Www.Components/React/PrivySignIn.tsx 43init_buffer_shim(); 44var React = __toESM(require_react()); 45var LoginFlow = ({ dotNetRef }) => { 46 const { authenticated, user } = G(); 47 const hasNotifiedRef = React.useRef(false); 48 const loginTriggeredRef = React.useRef(false); 49 const notifyDotNet = React.useCallback( 50 (eventType, userData, error) => { 51 if (!dotNetRef || hasNotifiedRef.current) { 52 return; 53 } 54 hasNotifiedRef.current = true; 55 const payload = { type: eventType }; 56 if (eventType === "login" && userData) { 57 const email = userData.email?.address ?? userData.linkedAccounts?.find((a) => a.type === "google_oauth")?.email ?? userData.linkedAccounts?.find((a) => a.type === "apple_oauth")?.email; 58 if (!email) { 59 payload.type = "login_error"; 60 payload.error = "No email found"; 61 } else { 62 payload.email = email; 63 payload.user = userData; 64 } 65 } else if (eventType === "login_error") { 66 payload.error = error; 67 } 68 dotNetRef.invokeMethodAsync("OnEventCallback", JSON.stringify(payload)); 69 }, 70 [dotNetRef] 71 ); 72 const { login } = qe({ 73 onComplete: ({ user: user2 }) => { 74 notifyDotNet("login", user2); 75 }, 76 onError: (error) => { 77 notifyDotNet("login_error", void 0, typeof error === "string" ? error : JSON.stringify(error)); 78 } 79 }); 80 React.useEffect(() => { 81 if (authenticated && user && !hasNotifiedRef.current) { 82 notifyDotNet("login", user); 83 } else if (!authenticated && !loginTriggeredRef.current) { 84 loginTriggeredRef.current = true; 85 login(); 86 } 87 }, [authenticated, user]); 88 return /* @__PURE__ */ React.createElement(ModalStatusBox, { text: "Logging in\u2026" }); 89}; 90function PrivySignIn(props) { 91 const { ready } = G(); 92 if (!ready) { 93 return /* @__PURE__ */ React.createElement(ModalStatusBox, { text: "Initializing..." }); 94 } 95 return /* @__PURE__ */ React.createElement(LoginFlow, { ...props }); 96} 97export { 98 PrivySignIn as default 99}; 100//# sourceMappingURL=PrivySignIn.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.