@orangecheck/auth-client 2.50.1 → 2.52.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.
Files changed (37) hide show
  1. package/dist/bond.mjs +4 -4
  2. package/dist/{chunk-NJEQHNVI.mjs → chunk-2FBI2M6N.mjs} +324 -41
  3. package/dist/chunk-2FBI2M6N.mjs.map +1 -0
  4. package/dist/{chunk-XVLOTOCX.mjs → chunk-6UIOGWHT.mjs} +96 -4
  5. package/dist/chunk-6UIOGWHT.mjs.map +1 -0
  6. package/dist/{chunk-MIBVEZLP.mjs → chunk-7VBIHZVF.mjs} +3 -3
  7. package/dist/chunk-F6XAMBPI.mjs +107 -0
  8. package/dist/chunk-F6XAMBPI.mjs.map +1 -0
  9. package/dist/{chunk-IKNAIRW5.mjs → chunk-FDN374RW.mjs} +2 -2
  10. package/dist/{chunk-OKIFTNEO.mjs → chunk-HQ6APBHF.mjs} +8 -2
  11. package/dist/{chunk-OKIFTNEO.mjs.map → chunk-HQ6APBHF.mjs.map} +1 -1
  12. package/dist/{chunk-MGZ4NVXW.mjs → chunk-LKYBT4Q7.mjs} +5 -5
  13. package/dist/chunk-QHZ6E64O.mjs +61 -0
  14. package/dist/chunk-QHZ6E64O.mjs.map +1 -0
  15. package/dist/{chunk-2NCLRIVO.mjs → chunk-W6YYHOYL.mjs} +3 -3
  16. package/dist/chunk-W6YYHOYL.mjs.map +1 -0
  17. package/dist/components.mjs +3 -3
  18. package/dist/held-link.mjs +19 -0
  19. package/dist/held-link.mjs.map +1 -0
  20. package/dist/index.d.ts +34 -2
  21. package/dist/index.js +547 -37
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +22 -18
  24. package/dist/linked-identities.mjs +2 -2
  25. package/dist/passkey.mjs +9 -0
  26. package/dist/passkey.mjs.map +1 -0
  27. package/dist/provider.mjs +2 -2
  28. package/dist/refusal.mjs +1 -1
  29. package/dist/signin.mjs +7 -5
  30. package/dist/webauthn.mjs +6 -3
  31. package/package.json +1 -1
  32. package/dist/chunk-2NCLRIVO.mjs.map +0 -1
  33. package/dist/chunk-NJEQHNVI.mjs.map +0 -1
  34. package/dist/chunk-XVLOTOCX.mjs.map +0 -1
  35. /package/dist/{chunk-MIBVEZLP.mjs.map → chunk-7VBIHZVF.mjs.map} +0 -0
  36. /package/dist/{chunk-IKNAIRW5.mjs.map → chunk-FDN374RW.mjs.map} +0 -0
  37. /package/dist/{chunk-MGZ4NVXW.mjs.map → chunk-LKYBT4Q7.mjs.map} +0 -0
package/dist/bond.mjs CHANGED
@@ -4,18 +4,18 @@ import {
4
4
  bondFloorsText,
5
5
  bondRefusal,
6
6
  fetchOcBond
7
- } from "./chunk-MGZ4NVXW.mjs";
8
- import "./chunk-OKHAVNEU.mjs";
9
- import "./chunk-2NCLRIVO.mjs";
7
+ } from "./chunk-LKYBT4Q7.mjs";
8
+ import "./chunk-W6YYHOYL.mjs";
10
9
  import "./chunk-FNGBJD4S.mjs";
11
10
  import "./chunk-U7IUGDLW.mjs";
12
11
  import "./chunk-H2TXOCXH.mjs";
13
12
  import "./chunk-5KQ36QNH.mjs";
14
- import "./chunk-OKIFTNEO.mjs";
13
+ import "./chunk-HQ6APBHF.mjs";
15
14
  import "./chunk-E3QI365E.mjs";
16
15
  import "./chunk-X4PPXI3K.mjs";
17
16
  import "./chunk-JTT77LMU.mjs";
18
17
  import "./chunk-4BOO7EQR.mjs";
18
+ import "./chunk-OKHAVNEU.mjs";
19
19
  export {
20
20
  OcBond,
21
21
  bondFloorsText,
@@ -1,12 +1,10 @@
1
1
  import {
2
- useOptionalOcSession
3
- } from "./chunk-IKNAIRW5.mjs";
4
- import {
5
- DesignCheckbox
6
- } from "./chunk-OKHAVNEU.mjs";
2
+ cancelPasskeyAutofill,
3
+ passkeyCeremony
4
+ } from "./chunk-QHZ6E64O.mjs";
7
5
  import {
8
6
  LinkPromptStep
9
- } from "./chunk-2NCLRIVO.mjs";
7
+ } from "./chunk-W6YYHOYL.mjs";
10
8
  import {
11
9
  addressInputValue
12
10
  } from "./chunk-U7IUGDLW.mjs";
@@ -25,6 +23,9 @@ import {
25
23
  capText,
26
24
  otpNetworkCapText
27
25
  } from "./chunk-5KQ36QNH.mjs";
26
+ import {
27
+ useOptionalOcSession
28
+ } from "./chunk-FDN374RW.mjs";
28
29
  import {
29
30
  SEVERAL_SESSIONS_TEXT,
30
31
  endedSigninText,
@@ -32,17 +33,30 @@ import {
32
33
  humanSigninError,
33
34
  isSeveralSessions,
34
35
  networkError
35
- } from "./chunk-OKIFTNEO.mjs";
36
+ } from "./chunk-HQ6APBHF.mjs";
36
37
  import {
37
38
  stripFragment
38
39
  } from "./chunk-JTT77LMU.mjs";
39
40
  import {
40
41
  clearTabSession
41
42
  } from "./chunk-4BOO7EQR.mjs";
43
+ import {
44
+ DesignCheckbox
45
+ } from "./chunk-OKHAVNEU.mjs";
46
+ import {
47
+ FINAL_LINK_REFUSALS,
48
+ LINK_FRAGMENT,
49
+ heldLinkRefusalText,
50
+ linkBind,
51
+ maskEmail,
52
+ parseHeldLink,
53
+ readLinkKey
54
+ } from "./chunk-F6XAMBPI.mjs";
42
55
 
43
56
  // src/signin.tsx
44
57
  import { isFamilyOrigin } from "@orangecheck/auth-core/family-origins";
45
58
  import { normalizeEmail } from "@orangecheck/auth-core/identifiers";
59
+ import { browserSupportsWebAuthnAutofill } from "@simplewebauthn/browser";
46
60
  import * as React from "react";
47
61
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
48
62
  function isSameOriginPath(candidate, origin) {
@@ -121,13 +135,17 @@ function OcSignIn({
121
135
  paths,
122
136
  className,
123
137
  mode,
124
- providerHref
138
+ providerHref,
139
+ passkey = "off"
125
140
  }) {
126
- const walletEnabled = paths?.wallet ?? true;
127
- const emailEnabled = paths?.email ?? true;
141
+ const passkeyOnly = passkey === "only";
142
+ const layered = passkey === "layered";
143
+ const walletEnabled = !passkeyOnly && (paths?.wallet ?? true);
144
+ const emailEnabled = !passkeyOnly && !layered && (paths?.email ?? true);
128
145
  const firstParty = mode === "first-party";
129
146
  const credentials = firstParty ? "omit" : "include";
130
- const linkPrompt = linkPromptProp && !firstParty;
147
+ const linkPrompt = linkPromptProp && !firstParty && !passkeyOnly && !layered;
148
+ const [layering, setLayering] = React.useState(false);
131
149
  const providerSession = useOptionalOcSession();
132
150
  const recheck = onSeveralSessions ?? providerSession?.refresh;
133
151
  const [resolvedReturn, setResolvedReturn] = React.useState(
@@ -189,6 +207,14 @@ function OcSignIn({
189
207
  });
190
208
  if (OAUTH_EMAIL_CODE_REASONS.has(reason) && emailEnabled) setPath("email");
191
209
  }, [emailEnabled]);
210
+ const [heldLink, setHeldLink] = React.useState(null);
211
+ React.useEffect(() => {
212
+ if (!firstParty || typeof window === "undefined") return;
213
+ const { hash, pathname, search } = window.location;
214
+ if (!hash.startsWith(LINK_FRAGMENT)) return;
215
+ window.history.replaceState(window.history.state, "", `${pathname}${search}`);
216
+ setHeldLink({ link: parseHeldLink(hash) });
217
+ }, [firstParty]);
192
218
  const navigate = React.useCallback(
193
219
  async (account) => {
194
220
  if (resolveReturnTo) {
@@ -210,7 +236,7 @@ function OcSignIn({
210
236
  if (onSuccess) onSuccess(account, token);
211
237
  else void navigate(account);
212
238
  };
213
- if (!linkPrompt || !linkAlso) {
239
+ if (!linkPrompt || !linkAlso || via === "passkey") {
214
240
  proceed();
215
241
  return;
216
242
  }
@@ -235,30 +261,58 @@ function OcSignIn({
235
261
  },
236
262
  [onSuccess, linkPrompt, linkAlso, navigate, authOrigin]
237
263
  );
264
+ const onPasskey = (a, t) => void handleSuccess(a, t, "passkey");
265
+ if (passkeyOnly) {
266
+ return /* @__PURE__ */ jsx("div", { className, "data-oc-signin": "", children: /* @__PURE__ */ jsx(
267
+ PasskeyButton,
268
+ {
269
+ authOrigin,
270
+ add: addMode,
271
+ credentials,
272
+ onSuccess: onPasskey
273
+ }
274
+ ) });
275
+ }
276
+ if (layered && firstParty) {
277
+ return /* @__PURE__ */ jsxs(ConfigNote, { className, children: [
278
+ /* @__PURE__ */ jsx("code", { children: 'passkey="layered"' }),
279
+ " adds to a family session; a first-party site uses ",
280
+ /* @__PURE__ */ jsx("code", { children: '"with"' }),
281
+ " or ",
282
+ /* @__PURE__ */ jsx("code", { children: '"only"' })
283
+ ] });
284
+ }
285
+ if (layering) {
286
+ return /* @__PURE__ */ jsx("div", { className, "data-oc-signin": "", children: /* @__PURE__ */ jsx(
287
+ PasskeyLayerStep,
288
+ {
289
+ authOrigin,
290
+ credentials,
291
+ onSuccess: onPasskey
292
+ }
293
+ ) });
294
+ }
238
295
  if (!walletEnabled && !emailEnabled) {
239
- return /* @__PURE__ */ jsxs(
240
- "div",
296
+ return /* @__PURE__ */ jsxs(ConfigNote, { className, children: [
297
+ "no signin paths enabled \u2014 set ",
298
+ /* @__PURE__ */ jsx("code", { children: "paths.wallet" }),
299
+ " or",
300
+ " ",
301
+ /* @__PURE__ */ jsx("code", { children: "paths.email" }),
302
+ " to ",
303
+ /* @__PURE__ */ jsx("code", { children: "true" })
304
+ ] });
305
+ }
306
+ if (heldLink) {
307
+ return /* @__PURE__ */ jsx("div", { className, "data-oc-signin": "", children: /* @__PURE__ */ jsx(
308
+ HeldLinkStep,
241
309
  {
242
- className,
243
- "data-oc-signin": "",
244
- style: {
245
- padding: "1rem",
246
- border: "1px solid var(--border, #27272a)",
247
- color: "var(--foreground, #fafafa)",
248
- fontFamily: SIGNIN_FONT,
249
- fontSize: signinSize(12)
250
- },
251
- children: [
252
- "no signin paths enabled \u2014 set ",
253
- /* @__PURE__ */ jsx("code", { children: "paths.wallet" }),
254
- " or",
255
- " ",
256
- /* @__PURE__ */ jsx("code", { children: "paths.email" }),
257
- " to ",
258
- /* @__PURE__ */ jsx("code", { children: "true" })
259
- ]
310
+ link: heldLink.link,
311
+ authOrigin,
312
+ onSuccess: (a, t) => void handleSuccess(a, t, "email"),
313
+ onBack: () => setHeldLink(null)
260
314
  }
261
- );
315
+ ) });
262
316
  }
263
317
  if (signedIn) {
264
318
  return /* @__PURE__ */ jsx("div", { className, "data-oc-signin": "", children: /* @__PURE__ */ jsx(
@@ -328,7 +382,17 @@ function OcSignIn({
328
382
  ]
329
383
  }
330
384
  ),
331
- providersFirst && /* @__PURE__ */ jsx(
385
+ passkey === "with" && /* @__PURE__ */ jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsx(
386
+ PasskeyButton,
387
+ {
388
+ authOrigin,
389
+ add: addMode,
390
+ credentials,
391
+ onSuccess: onPasskey,
392
+ quiet: true
393
+ }
394
+ ) }),
395
+ providersFirst && !layered && /* @__PURE__ */ jsx(
332
396
  ProviderSignIn,
333
397
  {
334
398
  authOrigin,
@@ -387,7 +451,7 @@ function OcSignIn({
387
451
  add: addMode,
388
452
  credentials,
389
453
  onSeveralSessions: recheck,
390
- onSuccess: (a, t) => void handleSuccess(a, t, "wallet")
454
+ onSuccess: layered ? () => setLayering(true) : (a, t) => void handleSuccess(a, t, "wallet")
391
455
  }
392
456
  ),
393
457
  showEmail && /* @__PURE__ */ jsx(
@@ -396,14 +460,16 @@ function OcSignIn({
396
460
  authOrigin,
397
461
  add: addMode,
398
462
  credentials,
463
+ firstParty,
399
464
  onSeveralSessions: recheck,
400
- onSuccess: (a, t) => void handleSuccess(a, t, "email")
465
+ onSuccess: (a, t) => void handleSuccess(a, t, "email"),
466
+ onPasskey: passkey === "with" ? onPasskey : void 0
401
467
  }
402
468
  )
403
469
  ]
404
470
  }
405
471
  ),
406
- !providersFirst && /* @__PURE__ */ jsx(
472
+ !providersFirst && !layered && /* @__PURE__ */ jsx(
407
473
  ProviderSignIn,
408
474
  {
409
475
  authOrigin,
@@ -426,6 +492,26 @@ function OcSignIn({
426
492
  ] })
427
493
  ] });
428
494
  }
495
+ function ConfigNote({
496
+ className,
497
+ children
498
+ }) {
499
+ return /* @__PURE__ */ jsx(
500
+ "div",
501
+ {
502
+ className,
503
+ "data-oc-signin": "",
504
+ style: {
505
+ padding: "1rem",
506
+ border: "1px solid var(--border, #27272a)",
507
+ color: "var(--foreground, #fafafa)",
508
+ fontFamily: SIGNIN_FONT,
509
+ fontSize: signinSize(12)
510
+ },
511
+ children
512
+ }
513
+ );
514
+ }
429
515
  var SigninTab = React.forwardRef(function SigninTab2({ id, controls, active, onClick, onKeyDown, children }, ref) {
430
516
  return /* @__PURE__ */ jsx(
431
517
  "button",
@@ -587,6 +673,104 @@ function ProviderSignIn({
587
673
  }
588
674
  );
589
675
  }
676
+ var quietPasskeyStyle = {
677
+ boxSizing: "border-box",
678
+ width: "100%",
679
+ minHeight: 44,
680
+ padding: "0.6rem 0.875rem",
681
+ border: "1px solid var(--border, #27272a)",
682
+ borderRadius: SIGNIN_BUTTON_RADIUS,
683
+ background: "transparent",
684
+ color: "var(--foreground, #fafafa)",
685
+ fontFamily: SIGNIN_FONT,
686
+ fontSize: signinSize(12),
687
+ cursor: "pointer"
688
+ };
689
+ function PasskeyButton({
690
+ authOrigin,
691
+ add,
692
+ credentials,
693
+ onSuccess,
694
+ quiet = false
695
+ }) {
696
+ const uid = React.useId();
697
+ const [busy, setBusy] = React.useState(false);
698
+ const [error, setError] = React.useState(null);
699
+ async function run() {
700
+ if (busy) return;
701
+ setError(null);
702
+ setBusy(true);
703
+ try {
704
+ const r = await passkeyCeremony({ authOrigin, kind: "signin", credentials, add });
705
+ if (r.ok) {
706
+ onSuccess(r.account, r.token);
707
+ return;
708
+ }
709
+ setError(humanSigninError(r.reason, "passkey"));
710
+ } catch (err) {
711
+ setError(failureMessage(err, "passkey", "submit", authOrigin));
712
+ } finally {
713
+ setBusy(false);
714
+ }
715
+ }
716
+ return /* @__PURE__ */ jsxs("div", { "data-oc-signin-passkey": "", children: [
717
+ /* @__PURE__ */ jsx(
718
+ "button",
719
+ {
720
+ type: "button",
721
+ onClick: () => void run(),
722
+ "aria-disabled": busy || void 0,
723
+ "aria-describedby": describedBy(error && `${uid}-error`),
724
+ style: quiet ? { ...quietPasskeyStyle, opacity: busy ? 0.5 : 1 } : { ...submitStyle(busy), marginTop: 0 },
725
+ children: busy ? "Waiting for your passkey\u2026" : quiet ? "Sign in with a passkey" : /* @__PURE__ */ jsx(Submit, { children: "Sign in with a passkey" })
726
+ }
727
+ ),
728
+ error && /* @__PURE__ */ jsx(ErrorLine, { id: `${uid}-error`, children: error }),
729
+ /* @__PURE__ */ jsx(Busy, { children: busy ? "Waiting for your passkey\u2026" : null })
730
+ ] });
731
+ }
732
+ function PasskeyLayerStep({
733
+ authOrigin,
734
+ credentials,
735
+ onSuccess
736
+ }) {
737
+ const uid = React.useId();
738
+ const [busy, setBusy] = React.useState(false);
739
+ const [error, setError] = React.useState(null);
740
+ async function run() {
741
+ if (busy) return;
742
+ setError(null);
743
+ setBusy(true);
744
+ try {
745
+ const r = await passkeyCeremony({ authOrigin, kind: "layer", credentials });
746
+ if (r.ok) {
747
+ onSuccess(r.account, r.token);
748
+ return;
749
+ }
750
+ setError(humanSigninError(r.reason, "passkey"));
751
+ } catch (err) {
752
+ setError(failureMessage(err, "passkey", "submit", authOrigin));
753
+ } finally {
754
+ setBusy(false);
755
+ }
756
+ }
757
+ return /* @__PURE__ */ jsxs("div", { "data-oc-signin-passkey-layer": "", children: [
758
+ /* @__PURE__ */ jsx(FlowHeader, { children: "Your wallet signed you in. This site also asks for your passkey." }),
759
+ /* @__PURE__ */ jsx(
760
+ "button",
761
+ {
762
+ type: "button",
763
+ onClick: () => void run(),
764
+ "aria-disabled": busy || void 0,
765
+ "aria-describedby": describedBy(error && `${uid}-error`),
766
+ style: submitStyle(busy),
767
+ children: busy ? "Waiting for your passkey\u2026" : /* @__PURE__ */ jsx(Submit, { children: "Confirm with your passkey" })
768
+ }
769
+ ),
770
+ error && /* @__PURE__ */ jsx(ErrorLine, { id: `${uid}-error`, children: error }),
771
+ /* @__PURE__ */ jsx(Busy, { children: busy ? "Waiting for your passkey\u2026" : null })
772
+ ] });
773
+ }
590
774
  function recheckAfter(err, recheck) {
591
775
  if (!recheck || !isSeveralSessions(err)) return;
592
776
  void Promise.resolve().then(recheck).catch(() => {
@@ -875,8 +1059,10 @@ function EmailFlow({
875
1059
  authOrigin,
876
1060
  add,
877
1061
  credentials,
1062
+ firstParty,
878
1063
  onSuccess,
879
- onSeveralSessions
1064
+ onSeveralSessions,
1065
+ onPasskey
880
1066
  }) {
881
1067
  const uid = React.useId();
882
1068
  const [stage, setStage] = React.useState("enter");
@@ -896,13 +1082,36 @@ function EmailFlow({
896
1082
  codeError: `${uid}-code-error`,
897
1083
  listed: `${uid}-listed`
898
1084
  };
1085
+ const onPasskeyRef = React.useRef(onPasskey);
1086
+ React.useEffect(() => {
1087
+ onPasskeyRef.current = onPasskey;
1088
+ });
1089
+ const autofill = onPasskey !== void 0 && stage === "enter";
1090
+ React.useEffect(() => {
1091
+ if (!autofill) return;
1092
+ let live = true;
1093
+ void (async () => {
1094
+ try {
1095
+ if (!await browserSupportsWebAuthnAutofill() || !live) return;
1096
+ const r = await passkeyCeremony({ authOrigin, kind: "signin", credentials, add, autofill: true });
1097
+ if (r.ok) onPasskeyRef.current?.(r.account, r.token);
1098
+ else if (live && r.step === "verify") setEmailError(humanSigninError(r.reason, "passkey"));
1099
+ } catch {
1100
+ }
1101
+ })();
1102
+ return () => {
1103
+ live = false;
1104
+ cancelPasskeyAutofill();
1105
+ };
1106
+ }, [autofill, authOrigin, credentials, add]);
899
1107
  async function sendCode(address) {
900
1108
  try {
1109
+ const bind = firstParty ? await linkBind() : void 0;
901
1110
  const res = await fetch(`${authOrigin}/api/auth/email-otp/start`, {
902
1111
  method: "POST",
903
1112
  credentials,
904
1113
  headers: { "Content-Type": "application/json" },
905
- body: JSON.stringify({ email: address })
1114
+ body: JSON.stringify({ email: address, ...bind ? { link_bind: bind } : {} })
906
1115
  });
907
1116
  const json = await res.json();
908
1117
  if (json.reason === "otp_network_cap") return otpNetworkCapText(json.retry_at);
@@ -1008,7 +1217,7 @@ function EmailFlow({
1008
1217
  "data-oca-field": "",
1009
1218
  id: `${uid}-email`,
1010
1219
  type: "email",
1011
- autoComplete: "email",
1220
+ autoComplete: onPasskey ? "username webauthn" : "email",
1012
1221
  value: email,
1013
1222
  onChange: (e) => {
1014
1223
  setEmail(e.target.value);
@@ -1106,6 +1315,80 @@ function EmailFlow({
1106
1315
  ] })
1107
1316
  ] }, "code");
1108
1317
  }
1318
+ function HeldLinkStep({
1319
+ link,
1320
+ authOrigin,
1321
+ onSuccess,
1322
+ onBack
1323
+ }) {
1324
+ const uid = React.useId();
1325
+ const [press, setPress] = React.useState(() => {
1326
+ if (!link) return { kind: "final", text: heldLinkRefusalText("wrong_link") };
1327
+ if (link.exp * 1e3 <= Date.now()) {
1328
+ return { kind: "final", text: heldLinkRefusalText("expired") };
1329
+ }
1330
+ if (!readLinkKey()) return { kind: "final", text: heldLinkRefusalText("wrong_browser") };
1331
+ return { kind: "idle" };
1332
+ });
1333
+ async function signIn(l) {
1334
+ setPress({ kind: "sending" });
1335
+ let reason;
1336
+ try {
1337
+ const res = await fetch(`${authOrigin}/api/auth/email-otp/verify`, {
1338
+ method: "POST",
1339
+ credentials: "omit",
1340
+ headers: { "Content-Type": "application/json" },
1341
+ body: JSON.stringify({
1342
+ email: l.email,
1343
+ token: l.token,
1344
+ link_secret: l.secret,
1345
+ link_key: readLinkKey()
1346
+ })
1347
+ });
1348
+ const json = await res.json().catch(() => ({}));
1349
+ if (res.ok && "ok" in json && json.ok && json.account) {
1350
+ onSuccess(json.account, json.token);
1351
+ return;
1352
+ }
1353
+ reason = json.reason;
1354
+ } catch {
1355
+ reason = void 0;
1356
+ }
1357
+ const text = heldLinkRefusalText(reason);
1358
+ const final = reason !== void 0 && FINAL_LINK_REFUSALS.has(reason);
1359
+ setPress(final ? { kind: "final", text } : { kind: "refused", text });
1360
+ }
1361
+ if (press.kind === "final" || !link) {
1362
+ return /* @__PURE__ */ jsxs("div", { "data-oc-signin-held-link": "", children: [
1363
+ /* @__PURE__ */ jsx(ErrorLine, { id: `${uid}-error`, children: press.kind === "final" ? press.text : heldLinkRefusalText("wrong_link") }),
1364
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: onBack, style: submitStyle(false), children: /* @__PURE__ */ jsx(Submit, { children: "Ask for a new link" }) })
1365
+ ] });
1366
+ }
1367
+ const sending = press.kind === "sending";
1368
+ return /* @__PURE__ */ jsxs("div", { "data-oc-signin-held-link": "", children: [
1369
+ /* @__PURE__ */ jsxs(FlowHeader, { children: [
1370
+ "Sign in as",
1371
+ " ",
1372
+ /* @__PURE__ */ jsx("span", { style: { color: "var(--foreground, #fafafa)" }, children: maskEmail(link.email) }),
1373
+ " ",
1374
+ "with the link from your email. Nothing happens until you press the button."
1375
+ ] }),
1376
+ /* @__PURE__ */ jsx(
1377
+ "button",
1378
+ {
1379
+ type: "button",
1380
+ onClick: () => void signIn(link),
1381
+ "aria-disabled": sending || void 0,
1382
+ "aria-describedby": press.kind === "refused" ? `${uid}-error` : void 0,
1383
+ disabled: sending,
1384
+ style: submitStyle(sending),
1385
+ children: sending ? "Signing in\u2026" : /* @__PURE__ */ jsx(Submit, { children: "Sign in" })
1386
+ }
1387
+ ),
1388
+ press.kind === "refused" && /* @__PURE__ */ jsx(ErrorLine, { id: `${uid}-error`, children: press.text }),
1389
+ /* @__PURE__ */ jsx(Busy, { children: sending ? "Signing in\u2026" : null })
1390
+ ] });
1391
+ }
1109
1392
  function Submit({ children }) {
1110
1393
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1111
1394
  children,
@@ -1300,4 +1583,4 @@ export {
1300
1583
  looksLikeBitcoinAddress,
1301
1584
  OcSignIn
1302
1585
  };
1303
- //# sourceMappingURL=chunk-NJEQHNVI.mjs.map
1586
+ //# sourceMappingURL=chunk-2FBI2M6N.mjs.map