@orangecheck/auth-client 2.36.1 → 2.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bond.mjs +4 -4
- package/dist/{chunk-EFMTFRCS.mjs → chunk-4YHFT5SR.mjs} +2 -2
- package/dist/{chunk-XCZVSE7M.mjs → chunk-AHGVGINO.mjs} +2 -2
- package/dist/{chunk-BMMNHG74.mjs → chunk-BSZCD5YA.mjs} +2 -2
- package/dist/{chunk-E2XQ7YED.mjs → chunk-DRRU6M5Z.mjs} +12 -4
- package/dist/chunk-DRRU6M5Z.mjs.map +1 -0
- package/dist/{chunk-MKE33INV.mjs → chunk-J32TKDC5.mjs} +19 -8
- package/dist/chunk-J32TKDC5.mjs.map +1 -0
- package/dist/{chunk-EZKAMTG7.mjs → chunk-KNUHQUTI.mjs} +2 -2
- package/dist/{chunk-ASL3DS3Q.mjs → chunk-YUJNANKB.mjs} +3 -3
- package/dist/{chunk-VRLFZAGK.mjs → chunk-Z3HVBT5Q.mjs} +1 -1
- package/dist/chunk-Z3HVBT5Q.mjs.map +1 -0
- package/dist/components.mjs +3 -3
- package/dist/index.js +27 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/linked-identities.mjs +3 -3
- package/dist/provider.mjs +2 -2
- package/dist/signin.mjs +4 -4
- package/dist/sudo.mjs +2 -2
- package/dist/types.mjs +1 -1
- package/dist/webauthn.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-E2XQ7YED.mjs.map +0 -1
- package/dist/chunk-MKE33INV.mjs.map +0 -1
- package/dist/chunk-VRLFZAGK.mjs.map +0 -1
- /package/dist/{chunk-EFMTFRCS.mjs.map → chunk-4YHFT5SR.mjs.map} +0 -0
- /package/dist/{chunk-XCZVSE7M.mjs.map → chunk-AHGVGINO.mjs.map} +0 -0
- /package/dist/{chunk-BMMNHG74.mjs.map → chunk-BSZCD5YA.mjs.map} +0 -0
- /package/dist/{chunk-EZKAMTG7.mjs.map → chunk-KNUHQUTI.mjs.map} +0 -0
- /package/dist/{chunk-ASL3DS3Q.mjs.map → chunk-YUJNANKB.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -329,6 +329,12 @@ function buildAddAccountUrl(cfg, returnTo) {
|
|
|
329
329
|
return u.toString();
|
|
330
330
|
}
|
|
331
331
|
var SessionContext = React4__namespace.createContext(null);
|
|
332
|
+
function onHistory(change) {
|
|
333
|
+
window.addEventListener("popstate", change);
|
|
334
|
+
return () => window.removeEventListener("popstate", change);
|
|
335
|
+
}
|
|
336
|
+
var pageAddress = () => window.location.href.split("#")[0];
|
|
337
|
+
var noPageYet = () => void 0;
|
|
332
338
|
function normalizeDisplayIdentity(raw, didOc) {
|
|
333
339
|
const di = raw.display_identity ?? raw.displayIdentity;
|
|
334
340
|
if (di && typeof di === "object" && typeof di.value === "string" && di.value.length > 0 && typeof di.kind === "string" && DISPLAY_IDENTITY_KINDS.includes(di.kind)) {
|
|
@@ -616,8 +622,9 @@ function OcSessionProvider({
|
|
|
616
622
|
},
|
|
617
623
|
[cfg.authOrigin, refresh]
|
|
618
624
|
);
|
|
625
|
+
const here = React4__namespace.useSyncExternalStore(onHistory, pageAddress, noPageYet);
|
|
619
626
|
const value = React4__namespace.useMemo(() => {
|
|
620
|
-
const returnTo = defaultReturnTo ??
|
|
627
|
+
const returnTo = defaultReturnTo ?? here;
|
|
621
628
|
return {
|
|
622
629
|
status,
|
|
623
630
|
account,
|
|
@@ -643,7 +650,8 @@ function OcSessionProvider({
|
|
|
643
650
|
addAccountUrl,
|
|
644
651
|
setDisplayIdentity,
|
|
645
652
|
cfg,
|
|
646
|
-
defaultReturnTo
|
|
653
|
+
defaultReturnTo,
|
|
654
|
+
here
|
|
647
655
|
]);
|
|
648
656
|
return /* @__PURE__ */ jsxRuntime.jsx(SessionContext.Provider, { value, children });
|
|
649
657
|
}
|
|
@@ -2298,6 +2306,16 @@ function looksLikeBitcoinAddress(input) {
|
|
|
2298
2306
|
if (BECH32_ADDRESS.test(s)) return s === s.toLowerCase() || s === s.toUpperCase();
|
|
2299
2307
|
return BASE58_ADDRESS.test(s);
|
|
2300
2308
|
}
|
|
2309
|
+
var OAUTH_EMAIL_CODE_REASONS = /* @__PURE__ */ new Set(["email_code_required", "account_mismatch"]);
|
|
2310
|
+
function oauthErrorText(reason) {
|
|
2311
|
+
if (reason === "email_code_required") {
|
|
2312
|
+
return "This email already has an orangecheck account. Sign in to it with an email code below.";
|
|
2313
|
+
}
|
|
2314
|
+
if (reason === "account_mismatch") {
|
|
2315
|
+
return "A different Google or GitHub account is already linked to this email. Use that one, or sign in with an email code below.";
|
|
2316
|
+
}
|
|
2317
|
+
return "That sign-in didn't finish. Try again, or use another way below.";
|
|
2318
|
+
}
|
|
2301
2319
|
function OcSignIn({
|
|
2302
2320
|
audience,
|
|
2303
2321
|
returnTo,
|
|
@@ -2363,13 +2381,14 @@ function OcSignIn({
|
|
|
2363
2381
|
};
|
|
2364
2382
|
const [signedIn, setSignedIn] = React4__namespace.useState(null);
|
|
2365
2383
|
const [linkAlso, setLinkAlso] = React4__namespace.useState(false);
|
|
2366
|
-
const [oauthError, setOauthError] = React4__namespace.useState(
|
|
2384
|
+
const [oauthError, setOauthError] = React4__namespace.useState(null);
|
|
2367
2385
|
React4__namespace.useEffect(() => {
|
|
2368
2386
|
if (typeof window === "undefined") return;
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2387
|
+
const reason = new URLSearchParams(window.location.search).get("oauth_error");
|
|
2388
|
+
if (reason === null) return;
|
|
2389
|
+
setOauthError(reason);
|
|
2390
|
+
if (OAUTH_EMAIL_CODE_REASONS.has(reason) && emailEnabled) setPath("email");
|
|
2391
|
+
}, [emailEnabled]);
|
|
2373
2392
|
const navigate = React4__namespace.useCallback(
|
|
2374
2393
|
async (account) => {
|
|
2375
2394
|
if (resolveReturnTo) {
|
|
@@ -2470,7 +2489,7 @@ function OcSignIn({
|
|
|
2470
2489
|
fontFamily: SIGNIN_FONT,
|
|
2471
2490
|
fontSize: signinRoleSize("text", signinSize(11))
|
|
2472
2491
|
},
|
|
2473
|
-
children:
|
|
2492
|
+
children: oauthErrorText(oauthError)
|
|
2474
2493
|
}
|
|
2475
2494
|
),
|
|
2476
2495
|
addMode && /* @__PURE__ */ jsxRuntime.jsxs(
|