@orangecheck/auth-client 2.26.0 → 2.28.0
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/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +145 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +145 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,8 @@ var DEFAULT_CONFIG = {
|
|
|
10
10
|
authOrigin: "https://ochk.io",
|
|
11
11
|
signInPath: "/signin",
|
|
12
12
|
mePath: "/api/auth/me",
|
|
13
|
-
logoutPath: "/api/auth/logout"
|
|
13
|
+
logoutPath: "/api/auth/logout",
|
|
14
|
+
multiAccount: true
|
|
14
15
|
};
|
|
15
16
|
function resolveConfig(cfg) {
|
|
16
17
|
return { ...DEFAULT_CONFIG, ...cfg ?? {} };
|
|
@@ -266,7 +267,7 @@ function OcSessionProvider({
|
|
|
266
267
|
const pinInFlightRef = React4.useRef(false);
|
|
267
268
|
const pinThisTab = React4.useCallback(
|
|
268
269
|
async (didOc) => {
|
|
269
|
-
if (pinInFlightRef.current || readTabSession()) return;
|
|
270
|
+
if (!cfg.multiAccount || pinInFlightRef.current || readTabSession()) return;
|
|
270
271
|
pinInFlightRef.current = true;
|
|
271
272
|
try {
|
|
272
273
|
const res = await fetch(`${cfg.authOrigin}/api/auth/tab`, {
|
|
@@ -285,7 +286,7 @@ function OcSessionProvider({
|
|
|
285
286
|
pinInFlightRef.current = false;
|
|
286
287
|
}
|
|
287
288
|
},
|
|
288
|
-
[cfg.authOrigin]
|
|
289
|
+
[cfg.authOrigin, cfg.multiAccount]
|
|
289
290
|
);
|
|
290
291
|
const refresh = React4.useCallback(async () => {
|
|
291
292
|
if (typeof window === "undefined") return;
|
|
@@ -332,7 +333,7 @@ function OcSessionProvider({
|
|
|
332
333
|
setError(null);
|
|
333
334
|
if (acct && !pin) void pinThisTab(acct.didOc);
|
|
334
335
|
const currentOrigin = typeof window !== "undefined" ? window.location.origin : null;
|
|
335
|
-
if (acct && rosterEntries.length === 0 && currentOrigin !== null && !cfg.authOrigin.startsWith(currentOrigin)) {
|
|
336
|
+
if (cfg.multiAccount && acct && rosterEntries.length === 0 && currentOrigin !== null && !cfg.authOrigin.startsWith(currentOrigin)) {
|
|
336
337
|
const peers = await fetchHostRoster(cfg);
|
|
337
338
|
if (peers.length > 0) setRoster(peers);
|
|
338
339
|
}
|
|
@@ -345,15 +346,21 @@ function OcSessionProvider({
|
|
|
345
346
|
let cancelled = false;
|
|
346
347
|
consumeTabAdoptMarker();
|
|
347
348
|
void (async () => {
|
|
348
|
-
await consumeTabAccountHint(cfg.authOrigin);
|
|
349
|
+
if (cfg.multiAccount) await consumeTabAccountHint(cfg.authOrigin);
|
|
349
350
|
if (!cancelled) void refresh();
|
|
350
351
|
})();
|
|
351
352
|
return () => {
|
|
352
353
|
cancelled = true;
|
|
353
354
|
};
|
|
354
|
-
}, [refresh, cfg.authOrigin]);
|
|
355
|
-
React4.useEffect(
|
|
356
|
-
|
|
355
|
+
}, [refresh, cfg.authOrigin, cfg.multiAccount]);
|
|
356
|
+
React4.useEffect(
|
|
357
|
+
() => cfg.multiAccount ? installTabFetchInterceptor(cfg.authOrigin) : void 0,
|
|
358
|
+
[cfg.authOrigin, cfg.multiAccount]
|
|
359
|
+
);
|
|
360
|
+
React4.useEffect(
|
|
361
|
+
() => cfg.multiAccount ? installTabLinkDecorator(cfg.authOrigin) : void 0,
|
|
362
|
+
[cfg.authOrigin, cfg.multiAccount]
|
|
363
|
+
);
|
|
357
364
|
const signOut = React4.useCallback(
|
|
358
365
|
async (opts) => {
|
|
359
366
|
const scope = opts?.scope ?? "all";
|
|
@@ -1158,6 +1165,15 @@ var SUDO_ACCOUNT_MISMATCH_MESSAGE = "Switch this tab to that account first \u201
|
|
|
1158
1165
|
function isSudoAccountMismatch(body) {
|
|
1159
1166
|
return body?.reason === "sudo_account_mismatch";
|
|
1160
1167
|
}
|
|
1168
|
+
|
|
1169
|
+
// src/appearance.ts
|
|
1170
|
+
var SIGNIN_FONT = "var(--oc-signin-font, ui-monospace, SFMono-Regular, monospace)";
|
|
1171
|
+
var SIGNIN_CASE = "var(--oc-signin-case, uppercase)";
|
|
1172
|
+
var signinTracking = (em) => `var(--oc-signin-tracking, ${em})`;
|
|
1173
|
+
var signinSize = (px) => `calc(${px}px * var(--oc-signin-scale, 1))`;
|
|
1174
|
+
var signinRadius = (px) => `var(--oc-signin-radius, ${px}px)`;
|
|
1175
|
+
var SIGNIN_BUTTON_RADIUS = "var(--oc-signin-button-radius, 6px)";
|
|
1176
|
+
var SIGNIN_STRONG = "var(--oc-signin-strong, 600)";
|
|
1161
1177
|
var DEFAULT_AUTH_ORIGIN = "https://ochk.io";
|
|
1162
1178
|
async function fetchOcLinkedIdentities(opts) {
|
|
1163
1179
|
const authOrigin = opts?.authOrigin ?? DEFAULT_AUTH_ORIGIN;
|
|
@@ -1372,8 +1388,8 @@ function IdentityRow({
|
|
|
1372
1388
|
style: {
|
|
1373
1389
|
marginTop: 4,
|
|
1374
1390
|
color: V.foreground,
|
|
1375
|
-
fontFamily:
|
|
1376
|
-
fontSize: 12,
|
|
1391
|
+
fontFamily: SIGNIN_FONT,
|
|
1392
|
+
fontSize: signinSize(12),
|
|
1377
1393
|
wordBreak: "break-all"
|
|
1378
1394
|
},
|
|
1379
1395
|
children: display
|
|
@@ -1451,8 +1467,8 @@ function ConsolidationPanel({ entries }) {
|
|
|
1451
1467
|
gap: 8,
|
|
1452
1468
|
padding: "8px 0",
|
|
1453
1469
|
borderTop: `1px solid ${V.border}`,
|
|
1454
|
-
fontFamily:
|
|
1455
|
-
fontSize: 11
|
|
1470
|
+
fontFamily: SIGNIN_FONT,
|
|
1471
|
+
fontSize: signinSize(11)
|
|
1456
1472
|
},
|
|
1457
1473
|
children: [
|
|
1458
1474
|
/* @__PURE__ */ jsx("code", { style: { color: V.foreground, wordBreak: "break-all" }, children: e.did_oc }),
|
|
@@ -1755,7 +1771,7 @@ function BtcLinkForm({
|
|
|
1755
1771
|
placeholder: "bc1q\u2026",
|
|
1756
1772
|
autoCapitalize: "none",
|
|
1757
1773
|
spellCheck: false,
|
|
1758
|
-
style: { ...inputStyle, fontFamily:
|
|
1774
|
+
style: { ...inputStyle, fontFamily: SIGNIN_FONT }
|
|
1759
1775
|
}
|
|
1760
1776
|
),
|
|
1761
1777
|
err && /* @__PURE__ */ jsx(ErrorLine, { children: err }),
|
|
@@ -1785,7 +1801,7 @@ function BtcLinkForm({
|
|
|
1785
1801
|
/* @__PURE__ */ jsxs("p", { style: bodyStyle, children: [
|
|
1786
1802
|
"Sign the challenge with the wallet that controls",
|
|
1787
1803
|
" ",
|
|
1788
|
-
/* @__PURE__ */ jsx("span", { style: { fontFamily:
|
|
1804
|
+
/* @__PURE__ */ jsx("span", { style: { fontFamily: SIGNIN_FONT, wordBreak: "break-all" }, children: addr }),
|
|
1789
1805
|
"."
|
|
1790
1806
|
] }),
|
|
1791
1807
|
/* @__PURE__ */ jsx(
|
|
@@ -1893,10 +1909,10 @@ function SectionLabel({
|
|
|
1893
1909
|
{
|
|
1894
1910
|
style: {
|
|
1895
1911
|
color,
|
|
1896
|
-
fontFamily:
|
|
1897
|
-
fontSize: 10,
|
|
1898
|
-
letterSpacing: "0.18em",
|
|
1899
|
-
textTransform:
|
|
1912
|
+
fontFamily: SIGNIN_FONT,
|
|
1913
|
+
fontSize: signinSize(10),
|
|
1914
|
+
letterSpacing: signinTracking("0.18em"),
|
|
1915
|
+
textTransform: SIGNIN_CASE,
|
|
1900
1916
|
marginBottom: 8
|
|
1901
1917
|
},
|
|
1902
1918
|
children
|
|
@@ -1911,8 +1927,8 @@ function ErrorLine({ children }) {
|
|
|
1911
1927
|
style: {
|
|
1912
1928
|
margin: "8px 0 0",
|
|
1913
1929
|
color: V.destructive,
|
|
1914
|
-
fontFamily:
|
|
1915
|
-
fontSize: 11
|
|
1930
|
+
fontFamily: SIGNIN_FONT,
|
|
1931
|
+
fontSize: signinSize(11)
|
|
1916
1932
|
},
|
|
1917
1933
|
children
|
|
1918
1934
|
}
|
|
@@ -1921,7 +1937,6 @@ function ErrorLine({ children }) {
|
|
|
1921
1937
|
function FormButtons({ children }) {
|
|
1922
1938
|
return /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 12 }, children });
|
|
1923
1939
|
}
|
|
1924
|
-
var MONO = "ui-monospace, SFMono-Regular, monospace";
|
|
1925
1940
|
var V = {
|
|
1926
1941
|
primary: "var(--primary, #f97316)",
|
|
1927
1942
|
foreground: "var(--foreground, #fafafa)",
|
|
@@ -1953,8 +1968,8 @@ var bodyStyle = {
|
|
|
1953
1968
|
};
|
|
1954
1969
|
var hintStyle = {
|
|
1955
1970
|
color: V.muted,
|
|
1956
|
-
fontFamily:
|
|
1957
|
-
fontSize: 10.5,
|
|
1971
|
+
fontFamily: SIGNIN_FONT,
|
|
1972
|
+
fontSize: signinSize(10.5),
|
|
1958
1973
|
opacity: 0.8
|
|
1959
1974
|
};
|
|
1960
1975
|
var rowStyle = {
|
|
@@ -1967,10 +1982,10 @@ var rowStyle = {
|
|
|
1967
1982
|
};
|
|
1968
1983
|
var rowLabelStyle = {
|
|
1969
1984
|
color: V.foreground,
|
|
1970
|
-
fontFamily:
|
|
1971
|
-
fontSize: 10.5,
|
|
1972
|
-
letterSpacing: "0.12em",
|
|
1973
|
-
textTransform:
|
|
1985
|
+
fontFamily: SIGNIN_FONT,
|
|
1986
|
+
fontSize: signinSize(10.5),
|
|
1987
|
+
letterSpacing: signinTracking("0.12em"),
|
|
1988
|
+
textTransform: SIGNIN_CASE,
|
|
1974
1989
|
opacity: 0.8
|
|
1975
1990
|
};
|
|
1976
1991
|
var inputStyle = {
|
|
@@ -1979,8 +1994,8 @@ var inputStyle = {
|
|
|
1979
1994
|
background: V.background,
|
|
1980
1995
|
color: V.foreground,
|
|
1981
1996
|
border: `1px solid ${V.border}`,
|
|
1982
|
-
borderRadius: 6,
|
|
1983
|
-
fontFamily:
|
|
1997
|
+
borderRadius: signinRadius(6),
|
|
1998
|
+
fontFamily: SIGNIN_FONT,
|
|
1984
1999
|
// 16px — never lower · suppresses iOS Safari focus auto-zoom.
|
|
1985
2000
|
fontSize: 16,
|
|
1986
2001
|
outline: "none",
|
|
@@ -1989,11 +2004,11 @@ var inputStyle = {
|
|
|
1989
2004
|
function btnBase(disabled) {
|
|
1990
2005
|
return {
|
|
1991
2006
|
padding: "0.5rem 0.875rem",
|
|
1992
|
-
borderRadius:
|
|
1993
|
-
fontFamily:
|
|
1994
|
-
fontSize: 10.5,
|
|
1995
|
-
letterSpacing: "0.12em",
|
|
1996
|
-
textTransform:
|
|
2007
|
+
borderRadius: SIGNIN_BUTTON_RADIUS,
|
|
2008
|
+
fontFamily: SIGNIN_FONT,
|
|
2009
|
+
fontSize: signinSize(10.5),
|
|
2010
|
+
letterSpacing: signinTracking("0.12em"),
|
|
2011
|
+
textTransform: SIGNIN_CASE,
|
|
1997
2012
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
1998
2013
|
opacity: disabled ? 0.5 : 1
|
|
1999
2014
|
};
|
|
@@ -2112,16 +2127,21 @@ function OcSignIn({
|
|
|
2112
2127
|
returnTo,
|
|
2113
2128
|
onSuccess,
|
|
2114
2129
|
resolveReturnTo,
|
|
2115
|
-
linkPrompt = true,
|
|
2130
|
+
linkPrompt: linkPromptProp = true,
|
|
2116
2131
|
add: addProp,
|
|
2117
2132
|
authOrigin = "https://ochk.io",
|
|
2118
2133
|
initialPath,
|
|
2119
2134
|
providersFirst = true,
|
|
2120
2135
|
paths,
|
|
2121
|
-
className
|
|
2136
|
+
className,
|
|
2137
|
+
mode,
|
|
2138
|
+
providerHref
|
|
2122
2139
|
}) {
|
|
2123
2140
|
const walletEnabled = paths?.wallet ?? true;
|
|
2124
2141
|
const emailEnabled = paths?.email ?? true;
|
|
2142
|
+
const firstParty = mode === "first-party";
|
|
2143
|
+
const credentials = firstParty ? "omit" : "include";
|
|
2144
|
+
const linkPrompt = linkPromptProp && !firstParty;
|
|
2125
2145
|
const [resolvedReturn, setResolvedReturn] = React4.useState(
|
|
2126
2146
|
() => familyReturnTarget(returnTo) ?? safeReturnTo(returnTo)
|
|
2127
2147
|
);
|
|
@@ -2136,15 +2156,19 @@ function OcSignIn({
|
|
|
2136
2156
|
const fromQuery = familyReturnTarget(q.get("return_to")) ?? familyReturnTarget(q.get("next"));
|
|
2137
2157
|
setResolvedReturn(fromQuery ?? "/");
|
|
2138
2158
|
}, [returnTo]);
|
|
2139
|
-
const [addMode, setAddMode] = React4.useState(Boolean(addProp));
|
|
2159
|
+
const [addMode, setAddMode] = React4.useState(Boolean(addProp) && !firstParty);
|
|
2140
2160
|
React4.useEffect(() => {
|
|
2141
2161
|
if (typeof window === "undefined") return;
|
|
2162
|
+
if (firstParty) {
|
|
2163
|
+
setAddMode(false);
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2142
2166
|
if (addProp !== void 0) {
|
|
2143
2167
|
setAddMode(Boolean(addProp));
|
|
2144
2168
|
return;
|
|
2145
2169
|
}
|
|
2146
2170
|
setAddMode(new URLSearchParams(window.location.search).get("add") === "1");
|
|
2147
|
-
}, [addProp]);
|
|
2171
|
+
}, [addProp, firstParty]);
|
|
2148
2172
|
const [path, setPath] = React4.useState(
|
|
2149
2173
|
initialPath ?? (providersFirst ? "email" : "wallet")
|
|
2150
2174
|
);
|
|
@@ -2213,8 +2237,8 @@ function OcSignIn({
|
|
|
2213
2237
|
padding: "1rem",
|
|
2214
2238
|
border: "1px solid var(--border, #27272a)",
|
|
2215
2239
|
color: "var(--foreground, #fafafa)",
|
|
2216
|
-
fontFamily:
|
|
2217
|
-
fontSize: 12
|
|
2240
|
+
fontFamily: SIGNIN_FONT,
|
|
2241
|
+
fontSize: signinSize(12)
|
|
2218
2242
|
},
|
|
2219
2243
|
children: [
|
|
2220
2244
|
"no signin paths enabled \u2014 set ",
|
|
@@ -2252,10 +2276,10 @@ function OcSignIn({
|
|
|
2252
2276
|
marginBottom: 14,
|
|
2253
2277
|
padding: "0.6rem 0.75rem",
|
|
2254
2278
|
border: "1px solid var(--destructive, #ef4444)",
|
|
2255
|
-
borderRadius: 6,
|
|
2279
|
+
borderRadius: signinRadius(6),
|
|
2256
2280
|
color: "var(--destructive, #ef4444)",
|
|
2257
|
-
fontFamily:
|
|
2258
|
-
fontSize: 11
|
|
2281
|
+
fontFamily: SIGNIN_FONT,
|
|
2282
|
+
fontSize: signinSize(11)
|
|
2259
2283
|
},
|
|
2260
2284
|
children: "That sign-in didn't finish. Try again, or use another way below."
|
|
2261
2285
|
}
|
|
@@ -2269,11 +2293,11 @@ function OcSignIn({
|
|
|
2269
2293
|
padding: "0.6rem 0.75rem",
|
|
2270
2294
|
border: "1px solid var(--primary, #f97316)",
|
|
2271
2295
|
borderLeftWidth: 3,
|
|
2272
|
-
borderRadius: 4,
|
|
2296
|
+
borderRadius: signinRadius(4),
|
|
2273
2297
|
background: "color-mix(in srgb, var(--primary, #f97316) 8%, transparent)",
|
|
2274
2298
|
color: "var(--foreground, #fafafa)",
|
|
2275
|
-
fontFamily:
|
|
2276
|
-
fontSize: 11,
|
|
2299
|
+
fontFamily: SIGNIN_FONT,
|
|
2300
|
+
fontSize: signinSize(11),
|
|
2277
2301
|
lineHeight: 1.6
|
|
2278
2302
|
},
|
|
2279
2303
|
children: [
|
|
@@ -2282,9 +2306,9 @@ function OcSignIn({
|
|
|
2282
2306
|
{
|
|
2283
2307
|
style: {
|
|
2284
2308
|
color: "var(--primary, #f97316)",
|
|
2285
|
-
letterSpacing: "0.12em",
|
|
2286
|
-
textTransform:
|
|
2287
|
-
fontSize: 10,
|
|
2309
|
+
letterSpacing: signinTracking("0.12em"),
|
|
2310
|
+
textTransform: SIGNIN_CASE,
|
|
2311
|
+
fontSize: signinSize(10),
|
|
2288
2312
|
display: "block",
|
|
2289
2313
|
marginBottom: 3
|
|
2290
2314
|
},
|
|
@@ -2301,6 +2325,9 @@ function OcSignIn({
|
|
|
2301
2325
|
authOrigin,
|
|
2302
2326
|
returnTo: resolvedReturn,
|
|
2303
2327
|
add: addMode,
|
|
2328
|
+
credentials,
|
|
2329
|
+
firstParty,
|
|
2330
|
+
providerHref,
|
|
2304
2331
|
first: true
|
|
2305
2332
|
}
|
|
2306
2333
|
),
|
|
@@ -2360,6 +2387,7 @@ function OcSignIn({
|
|
|
2360
2387
|
authOrigin,
|
|
2361
2388
|
audience,
|
|
2362
2389
|
add: addMode,
|
|
2390
|
+
credentials,
|
|
2363
2391
|
onSuccess: (a, t) => void handleSuccess(a, t, "wallet")
|
|
2364
2392
|
}
|
|
2365
2393
|
),
|
|
@@ -2368,11 +2396,22 @@ function OcSignIn({
|
|
|
2368
2396
|
{
|
|
2369
2397
|
authOrigin,
|
|
2370
2398
|
add: addMode,
|
|
2399
|
+
credentials,
|
|
2371
2400
|
onSuccess: (a, t) => void handleSuccess(a, t, "email")
|
|
2372
2401
|
}
|
|
2373
2402
|
)
|
|
2374
2403
|
] }),
|
|
2375
|
-
!providersFirst && /* @__PURE__ */ jsx(
|
|
2404
|
+
!providersFirst && /* @__PURE__ */ jsx(
|
|
2405
|
+
ProviderSignIn,
|
|
2406
|
+
{
|
|
2407
|
+
authOrigin,
|
|
2408
|
+
returnTo: resolvedReturn,
|
|
2409
|
+
add: addMode,
|
|
2410
|
+
credentials,
|
|
2411
|
+
firstParty,
|
|
2412
|
+
providerHref
|
|
2413
|
+
}
|
|
2414
|
+
),
|
|
2376
2415
|
linkPrompt && /* @__PURE__ */ jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
|
|
2377
2416
|
/* @__PURE__ */ jsx(
|
|
2378
2417
|
"input",
|
|
@@ -2413,10 +2452,10 @@ function SigninTab({
|
|
|
2413
2452
|
border: "none",
|
|
2414
2453
|
borderBottom: active ? "2px solid var(--primary, #f97316)" : "2px solid transparent",
|
|
2415
2454
|
color: active ? "var(--foreground, #fafafa)" : "var(--muted-foreground, #a1a1aa)",
|
|
2416
|
-
fontFamily:
|
|
2417
|
-
fontSize: 11,
|
|
2418
|
-
letterSpacing: "0.12em",
|
|
2419
|
-
textTransform:
|
|
2455
|
+
fontFamily: SIGNIN_FONT,
|
|
2456
|
+
fontSize: signinSize(11),
|
|
2457
|
+
letterSpacing: signinTracking("0.12em"),
|
|
2458
|
+
textTransform: SIGNIN_CASE,
|
|
2420
2459
|
cursor: "pointer",
|
|
2421
2460
|
marginBottom: -1
|
|
2422
2461
|
},
|
|
@@ -2445,14 +2484,19 @@ function ProviderSignIn({
|
|
|
2445
2484
|
authOrigin,
|
|
2446
2485
|
returnTo,
|
|
2447
2486
|
add,
|
|
2487
|
+
credentials,
|
|
2488
|
+
firstParty,
|
|
2489
|
+
providerHref,
|
|
2448
2490
|
first = false
|
|
2449
2491
|
}) {
|
|
2450
2492
|
const [providers, setProviders] = React4.useState(null);
|
|
2451
2493
|
const [origin, setOrigin] = React4.useState("");
|
|
2494
|
+
const hidden = firstParty && !providerHref;
|
|
2452
2495
|
React4.useEffect(() => {
|
|
2453
2496
|
setOrigin(window.location.origin);
|
|
2497
|
+
if (hidden) return;
|
|
2454
2498
|
let cancelled = false;
|
|
2455
|
-
fetch(`${authOrigin}/api/auth/providers`, { credentials
|
|
2499
|
+
fetch(`${authOrigin}/api/auth/providers`, { credentials }).then((r) => r.ok ? r.json() : null).then((body) => {
|
|
2456
2500
|
if (!cancelled) setProviders(body?.providers ?? []);
|
|
2457
2501
|
}).catch(() => {
|
|
2458
2502
|
if (!cancelled) setProviders([]);
|
|
@@ -2460,7 +2504,8 @@ function ProviderSignIn({
|
|
|
2460
2504
|
return () => {
|
|
2461
2505
|
cancelled = true;
|
|
2462
2506
|
};
|
|
2463
|
-
}, [authOrigin]);
|
|
2507
|
+
}, [authOrigin, credentials, hidden]);
|
|
2508
|
+
if (hidden) return null;
|
|
2464
2509
|
if (providers !== null && providers.length === 0) return null;
|
|
2465
2510
|
const providerReturnTo = returnTo.startsWith("/") ? origin ? `${origin}${returnTo}` : returnTo : returnTo;
|
|
2466
2511
|
const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
|
|
@@ -2478,10 +2523,10 @@ function ProviderSignIn({
|
|
|
2478
2523
|
// marginTop owns the gap above, so the divider only pads below.
|
|
2479
2524
|
margin: first ? `${BLOCK_GAP}px 0` : `0 0 ${BLOCK_GAP}px`,
|
|
2480
2525
|
color: "var(--muted-foreground, #a1a1aa)",
|
|
2481
|
-
fontFamily:
|
|
2482
|
-
fontSize: 10,
|
|
2483
|
-
letterSpacing: "0.16em",
|
|
2484
|
-
textTransform:
|
|
2526
|
+
fontFamily: SIGNIN_FONT,
|
|
2527
|
+
fontSize: signinSize(10),
|
|
2528
|
+
letterSpacing: signinTracking("0.16em"),
|
|
2529
|
+
textTransform: SIGNIN_CASE
|
|
2485
2530
|
},
|
|
2486
2531
|
children: [
|
|
2487
2532
|
/* @__PURE__ */ jsx("span", { style: line }),
|
|
@@ -2501,11 +2546,11 @@ function ProviderSignIn({
|
|
|
2501
2546
|
marginTop: i === 0 ? 0 : BUTTON_GAP,
|
|
2502
2547
|
padding: "0.6rem 0.875rem",
|
|
2503
2548
|
border: "1px solid var(--border, #27272a)",
|
|
2504
|
-
borderRadius:
|
|
2549
|
+
borderRadius: SIGNIN_BUTTON_RADIUS,
|
|
2505
2550
|
background: "transparent",
|
|
2506
2551
|
color: "var(--muted-foreground, #a1a1aa)",
|
|
2507
|
-
fontFamily:
|
|
2508
|
-
fontSize: 12,
|
|
2552
|
+
fontFamily: SIGNIN_FONT,
|
|
2553
|
+
fontSize: signinSize(12),
|
|
2509
2554
|
textDecoration: "none"
|
|
2510
2555
|
});
|
|
2511
2556
|
if (providers === null) {
|
|
@@ -2518,7 +2563,7 @@ function ProviderSignIn({
|
|
|
2518
2563
|
const buttons = providers.map((p, i) => /* @__PURE__ */ jsxs(
|
|
2519
2564
|
"a",
|
|
2520
2565
|
{
|
|
2521
|
-
href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
2566
|
+
href: providerHref ? providerHref(p.id) : `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
2522
2567
|
providerReturnTo
|
|
2523
2568
|
)}${add ? "&add=1" : ""}`,
|
|
2524
2569
|
"data-oc-signin-provider": p.id,
|
|
@@ -2551,7 +2596,13 @@ async function loadAdapter() {
|
|
|
2551
2596
|
async function detectBrowserWallets() {
|
|
2552
2597
|
return (await loadAdapter()).detectWallets().filter((w) => w.detected && w.id !== "manual").map((w) => ({ id: w.id, name: w.name }));
|
|
2553
2598
|
}
|
|
2554
|
-
function WalletFlow({
|
|
2599
|
+
function WalletFlow({
|
|
2600
|
+
authOrigin,
|
|
2601
|
+
audience,
|
|
2602
|
+
add,
|
|
2603
|
+
credentials,
|
|
2604
|
+
onSuccess
|
|
2605
|
+
}) {
|
|
2555
2606
|
const uid = React4.useId();
|
|
2556
2607
|
const ids = {
|
|
2557
2608
|
address: `${uid}-address`,
|
|
@@ -2593,7 +2644,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
|
|
|
2593
2644
|
async function submitSignature(message, nonce, signature, scheme) {
|
|
2594
2645
|
const res = await fetch(`${authOrigin}/api/auth/signin`, {
|
|
2595
2646
|
method: "POST",
|
|
2596
|
-
credentials
|
|
2647
|
+
credentials,
|
|
2597
2648
|
headers: { "Content-Type": "application/json" },
|
|
2598
2649
|
body: JSON.stringify({
|
|
2599
2650
|
message,
|
|
@@ -2794,7 +2845,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
|
|
|
2794
2845
|
noBrowserWallet && /* @__PURE__ */ jsx(Hint, { children: "No browser wallet found here. You can sign with any wallet and paste." })
|
|
2795
2846
|
] });
|
|
2796
2847
|
}
|
|
2797
|
-
function EmailFlow({ authOrigin, add, onSuccess }) {
|
|
2848
|
+
function EmailFlow({ authOrigin, add, credentials, onSuccess }) {
|
|
2798
2849
|
const uid = React4.useId();
|
|
2799
2850
|
const [stage, setStage] = React4.useState("enter");
|
|
2800
2851
|
const [email, setEmail] = React4.useState("");
|
|
@@ -2808,7 +2859,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
|
|
|
2808
2859
|
try {
|
|
2809
2860
|
const res = await fetch(`${authOrigin}/api/auth/email-otp/start`, {
|
|
2810
2861
|
method: "POST",
|
|
2811
|
-
credentials
|
|
2862
|
+
credentials,
|
|
2812
2863
|
headers: { "Content-Type": "application/json" },
|
|
2813
2864
|
body: JSON.stringify({ email: address })
|
|
2814
2865
|
});
|
|
@@ -2860,7 +2911,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
|
|
|
2860
2911
|
try {
|
|
2861
2912
|
const res = await fetch(`${authOrigin}/api/auth/email-otp/verify`, {
|
|
2862
2913
|
method: "POST",
|
|
2863
|
-
credentials
|
|
2914
|
+
credentials,
|
|
2864
2915
|
headers: { "Content-Type": "application/json" },
|
|
2865
2916
|
body: JSON.stringify({
|
|
2866
2917
|
email,
|
|
@@ -2984,10 +3035,10 @@ function FlowHeader({
|
|
|
2984
3035
|
{
|
|
2985
3036
|
style: {
|
|
2986
3037
|
color: "var(--primary, #f97316)",
|
|
2987
|
-
fontFamily:
|
|
2988
|
-
fontSize: 10,
|
|
2989
|
-
letterSpacing: "0.18em",
|
|
2990
|
-
textTransform:
|
|
3038
|
+
fontFamily: SIGNIN_FONT,
|
|
3039
|
+
fontSize: signinSize(10),
|
|
3040
|
+
letterSpacing: signinTracking("0.18em"),
|
|
3041
|
+
textTransform: SIGNIN_CASE,
|
|
2991
3042
|
marginBottom: 6
|
|
2992
3043
|
},
|
|
2993
3044
|
children: label
|
|
@@ -3016,10 +3067,10 @@ var linkButtonStyle = {
|
|
|
3016
3067
|
background: "transparent",
|
|
3017
3068
|
border: "none",
|
|
3018
3069
|
color: "var(--muted-foreground, #a1a1aa)",
|
|
3019
|
-
fontFamily:
|
|
3020
|
-
fontSize: 11,
|
|
3021
|
-
letterSpacing: "0.12em",
|
|
3022
|
-
textTransform:
|
|
3070
|
+
fontFamily: SIGNIN_FONT,
|
|
3071
|
+
fontSize: signinSize(11),
|
|
3072
|
+
letterSpacing: signinTracking("0.12em"),
|
|
3073
|
+
textTransform: SIGNIN_CASE,
|
|
3023
3074
|
cursor: "pointer",
|
|
3024
3075
|
padding: 0
|
|
3025
3076
|
};
|
|
@@ -3034,10 +3085,10 @@ function Label({
|
|
|
3034
3085
|
style: {
|
|
3035
3086
|
display: "block",
|
|
3036
3087
|
color: "var(--foreground, #fafafa)",
|
|
3037
|
-
fontFamily:
|
|
3038
|
-
fontSize: 11,
|
|
3039
|
-
letterSpacing: "0.12em",
|
|
3040
|
-
textTransform:
|
|
3088
|
+
fontFamily: SIGNIN_FONT,
|
|
3089
|
+
fontSize: signinSize(11),
|
|
3090
|
+
letterSpacing: signinTracking("0.12em"),
|
|
3091
|
+
textTransform: SIGNIN_CASE,
|
|
3041
3092
|
marginBottom: 6
|
|
3042
3093
|
},
|
|
3043
3094
|
children
|
|
@@ -3050,8 +3101,8 @@ var inputStyle2 = {
|
|
|
3050
3101
|
background: "var(--background, #0a0a0a)",
|
|
3051
3102
|
color: "var(--foreground, #fafafa)",
|
|
3052
3103
|
border: "1px solid var(--input, #27272a)",
|
|
3053
|
-
borderRadius: 6,
|
|
3054
|
-
fontFamily:
|
|
3104
|
+
borderRadius: signinRadius(6),
|
|
3105
|
+
fontFamily: SIGNIN_FONT,
|
|
3055
3106
|
// 16px — never below it. A sub-16px font-size makes iOS Safari
|
|
3056
3107
|
// auto-zoom the viewport on focus; the family rule is >=16px on
|
|
3057
3108
|
// every form field. Desktop reads fine at 16 too.
|
|
@@ -3068,8 +3119,8 @@ var linkAlsoStyle = {
|
|
|
3068
3119
|
paddingTop: 14,
|
|
3069
3120
|
borderTop: "1px solid var(--border, #27272a)",
|
|
3070
3121
|
color: "var(--muted-foreground, #a1a1aa)",
|
|
3071
|
-
fontFamily:
|
|
3072
|
-
fontSize: 12,
|
|
3122
|
+
fontFamily: SIGNIN_FONT,
|
|
3123
|
+
fontSize: signinSize(12),
|
|
3073
3124
|
lineHeight: 1.5,
|
|
3074
3125
|
cursor: "pointer"
|
|
3075
3126
|
};
|
|
@@ -3080,12 +3131,12 @@ function submitStyle(disabled) {
|
|
|
3080
3131
|
background: "var(--primary, #f97316)",
|
|
3081
3132
|
color: "var(--primary-foreground, #0a0a0a)",
|
|
3082
3133
|
border: "none",
|
|
3083
|
-
borderRadius:
|
|
3084
|
-
fontFamily:
|
|
3085
|
-
fontSize: 11,
|
|
3086
|
-
letterSpacing: "0.14em",
|
|
3087
|
-
textTransform:
|
|
3088
|
-
fontWeight:
|
|
3134
|
+
borderRadius: SIGNIN_BUTTON_RADIUS,
|
|
3135
|
+
fontFamily: SIGNIN_FONT,
|
|
3136
|
+
fontSize: signinSize(11),
|
|
3137
|
+
letterSpacing: signinTracking("0.14em"),
|
|
3138
|
+
textTransform: SIGNIN_CASE,
|
|
3139
|
+
fontWeight: SIGNIN_STRONG,
|
|
3089
3140
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
3090
3141
|
opacity: disabled ? 0.5 : 1,
|
|
3091
3142
|
width: "100%"
|
|
@@ -3100,8 +3151,8 @@ function ErrorLine2({ children }) {
|
|
|
3100
3151
|
marginTop: 6,
|
|
3101
3152
|
marginBottom: 0,
|
|
3102
3153
|
color: "var(--destructive, #ef4444)",
|
|
3103
|
-
fontFamily:
|
|
3104
|
-
fontSize: 11,
|
|
3154
|
+
fontFamily: SIGNIN_FONT,
|
|
3155
|
+
fontSize: signinSize(11),
|
|
3105
3156
|
letterSpacing: "0.04em"
|
|
3106
3157
|
},
|
|
3107
3158
|
children
|
|
@@ -3116,7 +3167,7 @@ function Hint({ children }) {
|
|
|
3116
3167
|
marginTop: 12,
|
|
3117
3168
|
marginBottom: 0,
|
|
3118
3169
|
color: "var(--muted-foreground, #a1a1aa)",
|
|
3119
|
-
fontFamily:
|
|
3170
|
+
fontFamily: SIGNIN_FONT,
|
|
3120
3171
|
fontSize: 10.5,
|
|
3121
3172
|
lineHeight: 1.55
|
|
3122
3173
|
},
|