@orangecheck/auth-client 2.27.0 → 2.29.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 CHANGED
@@ -47,6 +47,7 @@ interface OcAuthConfig {
47
47
  signInPath?: string;
48
48
  mePath?: string;
49
49
  logoutPath?: string;
50
+ multiAccount?: boolean;
50
51
  }
51
52
  declare const DEFAULT_CONFIG: Required<OcAuthConfig>;
52
53
  declare function buildSignInUrl(cfg: Required<OcAuthConfig>, returnTo?: string): string;
@@ -118,7 +119,7 @@ interface UseOcAddressSuggestionReturn {
118
119
  declare function useOcAddressSuggestion(options: UseOcAddressSuggestionOptions): UseOcAddressSuggestionReturn;
119
120
  declare const OcAddressInput: React.ForwardRefExoticComponent<OcAddressInputProps & React.RefAttributes<HTMLInputElement>>;
120
121
 
121
- interface OcSignInProps {
122
+ interface OcSignInBaseProps {
122
123
  audience: string;
123
124
  returnTo?: string;
124
125
  onSuccess?: (account: OcAccount, token?: string) => void;
@@ -134,9 +135,17 @@ interface OcSignInProps {
134
135
  add?: boolean;
135
136
  className?: string;
136
137
  }
138
+ type OcSignInProps = OcSignInBaseProps & ({
139
+ mode?: 'family';
140
+ providerHref?: undefined;
141
+ } | {
142
+ mode: 'first-party';
143
+ onSuccess: (account: OcAccount, token?: string) => void;
144
+ providerHref?: (providerId: string) => string;
145
+ });
137
146
  declare function safeReturnTo(input: string | undefined): string;
138
147
  declare function familyReturnTarget(input: string | undefined | null): string | undefined;
139
- declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, linkPrompt, add: addProp, authOrigin, initialPath, providersFirst, paths, className, }: OcSignInProps): React.ReactElement;
148
+ declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, linkPrompt: linkPromptProp, add: addProp, authOrigin, initialPath, providersFirst, paths, className, mode, providerHref, }: OcSignInProps): React.ReactElement;
140
149
 
141
150
  interface OcLinkedIdentity {
142
151
  id: string;
package/dist/index.d.ts CHANGED
@@ -47,6 +47,7 @@ interface OcAuthConfig {
47
47
  signInPath?: string;
48
48
  mePath?: string;
49
49
  logoutPath?: string;
50
+ multiAccount?: boolean;
50
51
  }
51
52
  declare const DEFAULT_CONFIG: Required<OcAuthConfig>;
52
53
  declare function buildSignInUrl(cfg: Required<OcAuthConfig>, returnTo?: string): string;
@@ -118,7 +119,7 @@ interface UseOcAddressSuggestionReturn {
118
119
  declare function useOcAddressSuggestion(options: UseOcAddressSuggestionOptions): UseOcAddressSuggestionReturn;
119
120
  declare const OcAddressInput: React.ForwardRefExoticComponent<OcAddressInputProps & React.RefAttributes<HTMLInputElement>>;
120
121
 
121
- interface OcSignInProps {
122
+ interface OcSignInBaseProps {
122
123
  audience: string;
123
124
  returnTo?: string;
124
125
  onSuccess?: (account: OcAccount, token?: string) => void;
@@ -134,9 +135,17 @@ interface OcSignInProps {
134
135
  add?: boolean;
135
136
  className?: string;
136
137
  }
138
+ type OcSignInProps = OcSignInBaseProps & ({
139
+ mode?: 'family';
140
+ providerHref?: undefined;
141
+ } | {
142
+ mode: 'first-party';
143
+ onSuccess: (account: OcAccount, token?: string) => void;
144
+ providerHref?: (providerId: string) => string;
145
+ });
137
146
  declare function safeReturnTo(input: string | undefined): string;
138
147
  declare function familyReturnTarget(input: string | undefined | null): string | undefined;
139
- declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, linkPrompt, add: addProp, authOrigin, initialPath, providersFirst, paths, className, }: OcSignInProps): React.ReactElement;
148
+ declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, linkPrompt: linkPromptProp, add: addProp, authOrigin, initialPath, providersFirst, paths, className, mode, providerHref, }: OcSignInProps): React.ReactElement;
140
149
 
141
150
  interface OcLinkedIdentity {
142
151
  id: string;
package/dist/index.js CHANGED
@@ -32,7 +32,8 @@ var DEFAULT_CONFIG = {
32
32
  authOrigin: "https://ochk.io",
33
33
  signInPath: "/signin",
34
34
  mePath: "/api/auth/me",
35
- logoutPath: "/api/auth/logout"
35
+ logoutPath: "/api/auth/logout",
36
+ multiAccount: true
36
37
  };
37
38
  function resolveConfig(cfg) {
38
39
  return { ...DEFAULT_CONFIG, ...cfg ?? {} };
@@ -288,7 +289,7 @@ function OcSessionProvider({
288
289
  const pinInFlightRef = React4__namespace.useRef(false);
289
290
  const pinThisTab = React4__namespace.useCallback(
290
291
  async (didOc) => {
291
- if (pinInFlightRef.current || readTabSession()) return;
292
+ if (!cfg.multiAccount || pinInFlightRef.current || readTabSession()) return;
292
293
  pinInFlightRef.current = true;
293
294
  try {
294
295
  const res = await fetch(`${cfg.authOrigin}/api/auth/tab`, {
@@ -307,7 +308,7 @@ function OcSessionProvider({
307
308
  pinInFlightRef.current = false;
308
309
  }
309
310
  },
310
- [cfg.authOrigin]
311
+ [cfg.authOrigin, cfg.multiAccount]
311
312
  );
312
313
  const refresh = React4__namespace.useCallback(async () => {
313
314
  if (typeof window === "undefined") return;
@@ -354,7 +355,7 @@ function OcSessionProvider({
354
355
  setError(null);
355
356
  if (acct && !pin) void pinThisTab(acct.didOc);
356
357
  const currentOrigin = typeof window !== "undefined" ? window.location.origin : null;
357
- if (acct && rosterEntries.length === 0 && currentOrigin !== null && !cfg.authOrigin.startsWith(currentOrigin)) {
358
+ if (cfg.multiAccount && acct && rosterEntries.length === 0 && currentOrigin !== null && !cfg.authOrigin.startsWith(currentOrigin)) {
358
359
  const peers = await fetchHostRoster(cfg);
359
360
  if (peers.length > 0) setRoster(peers);
360
361
  }
@@ -367,15 +368,21 @@ function OcSessionProvider({
367
368
  let cancelled = false;
368
369
  consumeTabAdoptMarker();
369
370
  void (async () => {
370
- await consumeTabAccountHint(cfg.authOrigin);
371
+ if (cfg.multiAccount) await consumeTabAccountHint(cfg.authOrigin);
371
372
  if (!cancelled) void refresh();
372
373
  })();
373
374
  return () => {
374
375
  cancelled = true;
375
376
  };
376
- }, [refresh, cfg.authOrigin]);
377
- React4__namespace.useEffect(() => installTabFetchInterceptor(cfg.authOrigin), [cfg.authOrigin]);
378
- React4__namespace.useEffect(() => installTabLinkDecorator(cfg.authOrigin), [cfg.authOrigin]);
377
+ }, [refresh, cfg.authOrigin, cfg.multiAccount]);
378
+ React4__namespace.useEffect(
379
+ () => cfg.multiAccount ? installTabFetchInterceptor(cfg.authOrigin) : void 0,
380
+ [cfg.authOrigin, cfg.multiAccount]
381
+ );
382
+ React4__namespace.useEffect(
383
+ () => cfg.multiAccount ? installTabLinkDecorator(cfg.authOrigin) : void 0,
384
+ [cfg.authOrigin, cfg.multiAccount]
385
+ );
379
386
  const signOut = React4__namespace.useCallback(
380
387
  async (opts) => {
381
388
  const scope = opts?.scope ?? "all";
@@ -1189,6 +1196,7 @@ var signinSize = (px) => `calc(${px}px * var(--oc-signin-scale, 1))`;
1189
1196
  var signinRadius = (px) => `var(--oc-signin-radius, ${px}px)`;
1190
1197
  var SIGNIN_BUTTON_RADIUS = "var(--oc-signin-button-radius, 6px)";
1191
1198
  var SIGNIN_STRONG = "var(--oc-signin-strong, 600)";
1199
+ var SIGNIN_ARROW = "var(--oc-signin-arrow, inline)";
1192
1200
  var DEFAULT_AUTH_ORIGIN = "https://ochk.io";
1193
1201
  async function fetchOcLinkedIdentities(opts) {
1194
1202
  const authOrigin = opts?.authOrigin ?? DEFAULT_AUTH_ORIGIN;
@@ -2142,16 +2150,21 @@ function OcSignIn({
2142
2150
  returnTo,
2143
2151
  onSuccess,
2144
2152
  resolveReturnTo,
2145
- linkPrompt = true,
2153
+ linkPrompt: linkPromptProp = true,
2146
2154
  add: addProp,
2147
2155
  authOrigin = "https://ochk.io",
2148
2156
  initialPath,
2149
2157
  providersFirst = true,
2150
2158
  paths,
2151
- className
2159
+ className,
2160
+ mode,
2161
+ providerHref
2152
2162
  }) {
2153
2163
  const walletEnabled = paths?.wallet ?? true;
2154
2164
  const emailEnabled = paths?.email ?? true;
2165
+ const firstParty = mode === "first-party";
2166
+ const credentials = firstParty ? "omit" : "include";
2167
+ const linkPrompt = linkPromptProp && !firstParty;
2155
2168
  const [resolvedReturn, setResolvedReturn] = React4__namespace.useState(
2156
2169
  () => familyReturnTarget(returnTo) ?? safeReturnTo(returnTo)
2157
2170
  );
@@ -2166,15 +2179,19 @@ function OcSignIn({
2166
2179
  const fromQuery = familyReturnTarget(q.get("return_to")) ?? familyReturnTarget(q.get("next"));
2167
2180
  setResolvedReturn(fromQuery ?? "/");
2168
2181
  }, [returnTo]);
2169
- const [addMode, setAddMode] = React4__namespace.useState(Boolean(addProp));
2182
+ const [addMode, setAddMode] = React4__namespace.useState(Boolean(addProp) && !firstParty);
2170
2183
  React4__namespace.useEffect(() => {
2171
2184
  if (typeof window === "undefined") return;
2185
+ if (firstParty) {
2186
+ setAddMode(false);
2187
+ return;
2188
+ }
2172
2189
  if (addProp !== void 0) {
2173
2190
  setAddMode(Boolean(addProp));
2174
2191
  return;
2175
2192
  }
2176
2193
  setAddMode(new URLSearchParams(window.location.search).get("add") === "1");
2177
- }, [addProp]);
2194
+ }, [addProp, firstParty]);
2178
2195
  const [path, setPath] = React4__namespace.useState(
2179
2196
  initialPath ?? (providersFirst ? "email" : "wallet")
2180
2197
  );
@@ -2331,6 +2348,9 @@ function OcSignIn({
2331
2348
  authOrigin,
2332
2349
  returnTo: resolvedReturn,
2333
2350
  add: addMode,
2351
+ credentials,
2352
+ firstParty,
2353
+ providerHref,
2334
2354
  first: true
2335
2355
  }
2336
2356
  ),
@@ -2352,7 +2372,7 @@ function OcSignIn({
2352
2372
  {
2353
2373
  active: path === "email",
2354
2374
  onClick: () => setPath("email"),
2355
- children: "email"
2375
+ children: "Email"
2356
2376
  }
2357
2377
  ),
2358
2378
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2360,7 +2380,7 @@ function OcSignIn({
2360
2380
  {
2361
2381
  active: path === "wallet",
2362
2382
  onClick: () => setPath("wallet"),
2363
- children: "bitcoin wallet"
2383
+ children: "Bitcoin wallet"
2364
2384
  }
2365
2385
  )
2366
2386
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -2369,7 +2389,7 @@ function OcSignIn({
2369
2389
  {
2370
2390
  active: path === "wallet",
2371
2391
  onClick: () => setPath("wallet"),
2372
- children: "bitcoin wallet"
2392
+ children: "Bitcoin wallet"
2373
2393
  }
2374
2394
  ),
2375
2395
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2377,7 +2397,7 @@ function OcSignIn({
2377
2397
  {
2378
2398
  active: path === "email",
2379
2399
  onClick: () => setPath("email"),
2380
- children: "email"
2400
+ children: "Email"
2381
2401
  }
2382
2402
  )
2383
2403
  ] })
@@ -2390,6 +2410,7 @@ function OcSignIn({
2390
2410
  authOrigin,
2391
2411
  audience,
2392
2412
  add: addMode,
2413
+ credentials,
2393
2414
  onSuccess: (a, t) => void handleSuccess(a, t, "wallet")
2394
2415
  }
2395
2416
  ),
@@ -2398,11 +2419,22 @@ function OcSignIn({
2398
2419
  {
2399
2420
  authOrigin,
2400
2421
  add: addMode,
2422
+ credentials,
2401
2423
  onSuccess: (a, t) => void handleSuccess(a, t, "email")
2402
2424
  }
2403
2425
  )
2404
2426
  ] }),
2405
- !providersFirst && /* @__PURE__ */ jsxRuntime.jsx(ProviderSignIn, { authOrigin, returnTo: resolvedReturn, add: addMode }),
2427
+ !providersFirst && /* @__PURE__ */ jsxRuntime.jsx(
2428
+ ProviderSignIn,
2429
+ {
2430
+ authOrigin,
2431
+ returnTo: resolvedReturn,
2432
+ add: addMode,
2433
+ credentials,
2434
+ firstParty,
2435
+ providerHref
2436
+ }
2437
+ ),
2406
2438
  linkPrompt && /* @__PURE__ */ jsxRuntime.jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
2407
2439
  /* @__PURE__ */ jsxRuntime.jsx(
2408
2440
  "input",
@@ -2475,14 +2507,19 @@ function ProviderSignIn({
2475
2507
  authOrigin,
2476
2508
  returnTo,
2477
2509
  add,
2510
+ credentials,
2511
+ firstParty,
2512
+ providerHref,
2478
2513
  first = false
2479
2514
  }) {
2480
2515
  const [providers, setProviders] = React4__namespace.useState(null);
2481
2516
  const [origin, setOrigin] = React4__namespace.useState("");
2517
+ const hidden = firstParty && !providerHref;
2482
2518
  React4__namespace.useEffect(() => {
2483
2519
  setOrigin(window.location.origin);
2520
+ if (hidden) return;
2484
2521
  let cancelled = false;
2485
- fetch(`${authOrigin}/api/auth/providers`, { credentials: "include" }).then((r) => r.ok ? r.json() : null).then((body) => {
2522
+ fetch(`${authOrigin}/api/auth/providers`, { credentials }).then((r) => r.ok ? r.json() : null).then((body) => {
2486
2523
  if (!cancelled) setProviders(body?.providers ?? []);
2487
2524
  }).catch(() => {
2488
2525
  if (!cancelled) setProviders([]);
@@ -2490,7 +2527,8 @@ function ProviderSignIn({
2490
2527
  return () => {
2491
2528
  cancelled = true;
2492
2529
  };
2493
- }, [authOrigin]);
2530
+ }, [authOrigin, credentials, hidden]);
2531
+ if (hidden) return null;
2494
2532
  if (providers !== null && providers.length === 0) return null;
2495
2533
  const providerReturnTo = returnTo.startsWith("/") ? origin ? `${origin}${returnTo}` : returnTo : returnTo;
2496
2534
  const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
@@ -2548,7 +2586,7 @@ function ProviderSignIn({
2548
2586
  const buttons = providers.map((p, i) => /* @__PURE__ */ jsxRuntime.jsxs(
2549
2587
  "a",
2550
2588
  {
2551
- href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
2589
+ href: providerHref ? providerHref(p.id) : `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
2552
2590
  providerReturnTo
2553
2591
  )}${add ? "&add=1" : ""}`,
2554
2592
  "data-oc-signin-provider": p.id,
@@ -2581,7 +2619,13 @@ async function loadAdapter() {
2581
2619
  async function detectBrowserWallets() {
2582
2620
  return (await loadAdapter()).detectWallets().filter((w) => w.detected && w.id !== "manual").map((w) => ({ id: w.id, name: w.name }));
2583
2621
  }
2584
- function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2622
+ function WalletFlow({
2623
+ authOrigin,
2624
+ audience,
2625
+ add,
2626
+ credentials,
2627
+ onSuccess
2628
+ }) {
2585
2629
  const uid = React4__namespace.useId();
2586
2630
  const ids = {
2587
2631
  address: `${uid}-address`,
@@ -2623,7 +2667,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2623
2667
  async function submitSignature(message, nonce, signature, scheme) {
2624
2668
  const res = await fetch(`${authOrigin}/api/auth/signin`, {
2625
2669
  method: "POST",
2626
- credentials: "include",
2670
+ credentials,
2627
2671
  headers: { "Content-Type": "application/json" },
2628
2672
  body: JSON.stringify({
2629
2673
  message,
@@ -2715,7 +2759,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2715
2759
  address.trim(),
2716
2760
  ", sign the text below, and paste the signature back here. Nothing is spent."
2717
2761
  ] }),
2718
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.message, children: "message to sign" }),
2762
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.message, children: "Message to sign" }),
2719
2763
  /* @__PURE__ */ jsxRuntime.jsx(
2720
2764
  "textarea",
2721
2765
  {
@@ -2727,10 +2771,10 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2727
2771
  style: { ...inputStyle2, resize: "vertical" }
2728
2772
  }
2729
2773
  ),
2730
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => void copyMessage(), style: linkButtonStyle, children: copied === "copied" ? "copied" : "copy message" }),
2774
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => void copyMessage(), style: linkButtonStyle, children: copied === "copied" ? "Copied" : "Copy message" }),
2731
2775
  copied === "failed" && /* @__PURE__ */ jsxRuntime.jsx(Hint, { children: "Couldn't copy here. Select the text above and copy it." }),
2732
2776
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: 14 }, children: [
2733
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.signature, children: "signature" }),
2777
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.signature, children: "Signature" }),
2734
2778
  /* @__PURE__ */ jsxRuntime.jsx(
2735
2779
  "textarea",
2736
2780
  {
@@ -2756,7 +2800,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2756
2800
  type: "submit",
2757
2801
  disabled: submitting || !pasted.trim(),
2758
2802
  style: submitStyle(submitting || !pasted.trim()),
2759
- children: submitting ? "checking\u2026" : "sign me in \u2192"
2803
+ children: submitting ? "Checking\u2026" : /* @__PURE__ */ jsxRuntime.jsx(Submit, { children: "Sign me in" })
2760
2804
  }
2761
2805
  ),
2762
2806
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2770,7 +2814,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2770
2814
  setCopied("idle");
2771
2815
  },
2772
2816
  style: linkButtonStyle,
2773
- children: "use a different address"
2817
+ children: "Use a different address"
2774
2818
  }
2775
2819
  )
2776
2820
  ] });
@@ -2778,7 +2822,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2778
2822
  const noBrowserWallet = wallets !== null && wallets.length === 0;
2779
2823
  return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: signIn, "data-oc-signin-wallet": "", children: [
2780
2824
  /* @__PURE__ */ jsxRuntime.jsx(FlowHeader, { children: "Your wallet signs a short message to prove you hold the address. Nothing is spent and your key never leaves the wallet. Works with browser wallets, or any wallet that can sign a message, like Sparrow." }),
2781
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.address, children: "bitcoin address" }),
2825
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.address, children: "Bitcoin address" }),
2782
2826
  /* @__PURE__ */ jsxRuntime.jsx(
2783
2827
  "input",
2784
2828
  {
@@ -2799,7 +2843,7 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2799
2843
  }
2800
2844
  ),
2801
2845
  wallets && wallets.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: 12 }, children: [
2802
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.wallet, children: "sign with" }),
2846
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: ids.wallet, children: "Sign with" }),
2803
2847
  /* @__PURE__ */ jsxRuntime.jsx(
2804
2848
  "select",
2805
2849
  {
@@ -2818,13 +2862,13 @@ function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2818
2862
  type: "submit",
2819
2863
  disabled: submitting || !address.trim(),
2820
2864
  style: submitStyle(submitting || !address.trim()),
2821
- children: submitting ? "waiting for wallet\u2026" : noBrowserWallet ? "get the message to sign \u2192" : "sign in with wallet \u2192"
2865
+ children: submitting ? "Waiting for wallet\u2026" : noBrowserWallet ? /* @__PURE__ */ jsxRuntime.jsx(Submit, { children: "Get the message to sign" }) : /* @__PURE__ */ jsxRuntime.jsx(Submit, { children: "Sign in with wallet" })
2822
2866
  }
2823
2867
  ),
2824
2868
  noBrowserWallet && /* @__PURE__ */ jsxRuntime.jsx(Hint, { children: "No browser wallet found here. You can sign with any wallet and paste." })
2825
2869
  ] });
2826
2870
  }
2827
- function EmailFlow({ authOrigin, add, onSuccess }) {
2871
+ function EmailFlow({ authOrigin, add, credentials, onSuccess }) {
2828
2872
  const uid = React4__namespace.useId();
2829
2873
  const [stage, setStage] = React4__namespace.useState("enter");
2830
2874
  const [email, setEmail] = React4__namespace.useState("");
@@ -2838,7 +2882,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2838
2882
  try {
2839
2883
  const res = await fetch(`${authOrigin}/api/auth/email-otp/start`, {
2840
2884
  method: "POST",
2841
- credentials: "include",
2885
+ credentials,
2842
2886
  headers: { "Content-Type": "application/json" },
2843
2887
  body: JSON.stringify({ email: address })
2844
2888
  });
@@ -2890,7 +2934,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2890
2934
  try {
2891
2935
  const res = await fetch(`${authOrigin}/api/auth/email-otp/verify`, {
2892
2936
  method: "POST",
2893
- credentials: "include",
2937
+ credentials,
2894
2938
  headers: { "Content-Type": "application/json" },
2895
2939
  body: JSON.stringify({
2896
2940
  email,
@@ -2916,7 +2960,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2916
2960
  if (stage === "enter") {
2917
2961
  return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: start, "data-oc-signin-email": "", children: [
2918
2962
  /* @__PURE__ */ jsxRuntime.jsx(FlowHeader, { children: "We email you a 6-digit code. No password, and no wallet needed to start. Link a Bitcoin address any time \u2014 that is the identity you hold yourself." }),
2919
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: `${uid}-email`, children: "email" }),
2963
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: `${uid}-email`, children: "Email" }),
2920
2964
  /* @__PURE__ */ jsxRuntime.jsx(
2921
2965
  "input",
2922
2966
  {
@@ -2935,7 +2979,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2935
2979
  }
2936
2980
  ),
2937
2981
  emailError && /* @__PURE__ */ jsxRuntime.jsx(ErrorLine2, { children: emailError }),
2938
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", disabled: submitting, style: submitStyle(submitting), children: submitting ? "sending\u2026" : "send one-time code \u2192" })
2982
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", disabled: submitting, style: submitStyle(submitting), children: submitting ? "Sending\u2026" : /* @__PURE__ */ jsxRuntime.jsx(Submit, { children: "Send one-time code" }) })
2939
2983
  ] });
2940
2984
  }
2941
2985
  return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: verify, "data-oc-signin-email-verify": "", children: [
@@ -2944,7 +2988,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2944
2988
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "var(--foreground, #fafafa)" }, children: email }),
2945
2989
  ". It expires in 10 minutes."
2946
2990
  ] }),
2947
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: `${uid}-code`, children: "one-time code" }),
2991
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: `${uid}-code`, children: "One-time code" }),
2948
2992
  /* @__PURE__ */ jsxRuntime.jsx(
2949
2993
  "input",
2950
2994
  {
@@ -2973,7 +3017,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2973
3017
  type: "submit",
2974
3018
  disabled: submitting || code.length !== 6,
2975
3019
  style: submitStyle(submitting || code.length !== 6),
2976
- children: submitting ? "verifying\u2026" : "verify \xB7 sign me in \u2192"
3020
+ children: submitting ? "Verifying\u2026" : /* @__PURE__ */ jsxRuntime.jsx(Submit, { children: "Verify \xB7 sign me in" })
2977
3021
  }
2978
3022
  ),
2979
3023
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -2984,7 +3028,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2984
3028
  onClick: () => void resend(),
2985
3029
  disabled: submitting,
2986
3030
  style: linkButtonStyle,
2987
- children: "send a new code"
3031
+ children: "Send a new code"
2988
3032
  }
2989
3033
  ),
2990
3034
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2998,12 +3042,18 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2998
3042
  setResent(false);
2999
3043
  },
3000
3044
  style: linkButtonStyle,
3001
- children: "use a different email"
3045
+ children: "Use a different email"
3002
3046
  }
3003
3047
  )
3004
3048
  ] })
3005
3049
  ] });
3006
3050
  }
3051
+ function Submit({ children }) {
3052
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3053
+ children,
3054
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { display: SIGNIN_ARROW }, children: " \u2192" })
3055
+ ] });
3056
+ }
3007
3057
  function FlowHeader({
3008
3058
  label,
3009
3059
  children