@coinbase/cdp-react 0.0.108 → 0.0.110

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 (101) hide show
  1. package/dist/assets/OAuthStatusModal.css +1 -1
  2. package/dist/assets/SignIn.css +1 -1
  3. package/dist/assets/SignInImage.css +1 -1
  4. package/dist/assets/StatusView.css +1 -0
  5. package/dist/assets/SwitchTransition.css +1 -1
  6. package/dist/chunks/{CDPReactProvider.CFWIUvzR.js → CDPReactProvider.BWInVuNJ.js} +89 -86
  7. package/dist/chunks/LinkAuthFlow.0FnIchwa.js +144 -0
  8. package/dist/chunks/index.Du1vsLh6.js +23 -0
  9. package/dist/components/CDPReactProvider/index.d.ts +7 -1
  10. package/dist/components/CDPReactProvider/index.js +11 -7
  11. package/dist/components/EnrollMfa/index.js +1 -1
  12. package/dist/components/EnrollMfaModal/index.js +1 -1
  13. package/dist/components/ExportWallet/index.js +6 -4
  14. package/dist/components/ExportWalletModal/index.js +1 -1
  15. package/dist/components/Fund/index.js +1 -1
  16. package/dist/components/FundModal/index.js +1 -1
  17. package/dist/components/LinkAuth/LinkAuthFlow.js +9 -5
  18. package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +2 -2
  19. package/dist/components/LinkAuth/LinkAuthFlowProvider.d.ts +22 -8
  20. package/dist/components/LinkAuth/LinkAuthFlowProvider.js +2 -2
  21. package/dist/components/LinkAuth/LinkAuthItem.js +1 -1
  22. package/dist/components/LinkAuth/LinkAuthItems.js +35 -28
  23. package/dist/components/LinkAuth/LinkAuthProvider.js +25 -18
  24. package/dist/components/LinkAuth/index.d.ts +2 -2
  25. package/dist/components/LinkAuth/index.js +63 -62
  26. package/dist/components/LinkAuth/types.d.ts +6 -1
  27. package/dist/components/LinkAuth/types.js +5 -3
  28. package/dist/components/LinkAuth/utils.js +3 -3
  29. package/dist/components/LinkAuthModal/index.d.ts +1 -1
  30. package/dist/components/LinkAuthModal/index.js +56 -46
  31. package/dist/components/OAuthStatusModal/index.js +113 -135
  32. package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +5 -2
  33. package/dist/components/SignIn/SignInAuthMethodButtons.js +83 -52
  34. package/dist/components/SignIn/SignInBackButton.js +1 -1
  35. package/dist/components/SignIn/SignInDescription.js +2 -2
  36. package/dist/components/SignIn/SignInForm.js +2 -2
  37. package/dist/components/SignIn/SignInImage.d.ts +12 -3
  38. package/dist/components/SignIn/SignInImage.js +36 -13
  39. package/dist/components/SignIn/SignInProvider.js +5 -4
  40. package/dist/components/SignIn/SignInTitle.js +2 -2
  41. package/dist/components/SignIn/flows/SignInWithEmail.d.ts +0 -4
  42. package/dist/components/SignIn/flows/SignInWithEmail.js +73 -74
  43. package/dist/components/SignIn/flows/SignInWithOAuth.js +1 -1
  44. package/dist/components/SignIn/flows/SignInWithSiwe.d.ts +27 -0
  45. package/dist/components/SignIn/flows/SignInWithSiwe.js +63 -0
  46. package/dist/components/SignIn/flows/SignInWithSms.d.ts +0 -6
  47. package/dist/components/SignIn/flows/SignInWithSms.js +85 -86
  48. package/dist/components/SignIn/hooks/useEmailForm.js +13 -13
  49. package/dist/components/SignIn/hooks/useFlowTransition.d.ts +14 -0
  50. package/dist/components/SignIn/hooks/useFlowTransition.js +13 -0
  51. package/dist/components/SignIn/hooks/useOTPForm.js +29 -29
  52. package/dist/components/SignIn/hooks/usePhoneNumberForm.js +10 -10
  53. package/dist/components/SignIn/hooks/useStartSiwe.d.ts +10 -0
  54. package/dist/components/SignIn/hooks/useStartSiwe.js +24 -0
  55. package/dist/components/SignIn/index.d.ts +2 -2
  56. package/dist/components/SignIn/index.js +29 -29
  57. package/dist/components/SignIn/types.d.ts +24 -2
  58. package/dist/components/SignIn/types.js +5 -1
  59. package/dist/components/SignIn/useSignInReducer.js +67 -46
  60. package/dist/components/SignInModal/index.d.ts +1 -1
  61. package/dist/components/SignInModal/index.js +77 -67
  62. package/dist/components/SiweStatusView/connectors/baseAccount.d.ts +22 -0
  63. package/dist/components/SiweStatusView/connectors/baseAccount.js +49 -0
  64. package/dist/components/SiweStatusView/connectors/siweConnectors.d.ts +6 -0
  65. package/dist/components/SiweStatusView/connectors/siweConnectors.js +9 -0
  66. package/dist/components/SiweStatusView/connectors/types.d.ts +45 -0
  67. package/dist/components/SiweStatusView/connectors/types.js +2 -0
  68. package/dist/components/SiweStatusView/getSiweErrorMessage.d.ts +13 -0
  69. package/dist/components/SiweStatusView/getSiweErrorMessage.js +15 -0
  70. package/dist/components/SiweStatusView/index.d.ts +36 -0
  71. package/dist/components/SiweStatusView/index.js +71 -0
  72. package/dist/components/SiweStatusView/toSiweProvider.d.ts +10 -0
  73. package/dist/components/SiweStatusView/toSiweProvider.js +13 -0
  74. package/dist/components/SiweStatusView/useSiweFlow.d.ts +37 -0
  75. package/dist/components/SiweStatusView/useSiweFlow.js +35 -0
  76. package/dist/components/VerifyMfa/index.js +1 -1
  77. package/dist/components/VerifyMfaInline/index.js +1 -1
  78. package/dist/components/VerifyMfaModal/index.js +1 -1
  79. package/dist/components/ui/StatusView/index.d.ts +35 -0
  80. package/dist/components/ui/StatusView/index.js +55 -0
  81. package/dist/components/ui/SwitchFadeTransition/index.d.ts +1 -1
  82. package/dist/components/ui/SwitchFadeTransition/index.js +8 -12
  83. package/dist/components/ui/SwitchSlideTransition/index.d.ts +1 -1
  84. package/dist/components/ui/SwitchSlideTransition/index.js +8 -12
  85. package/dist/components/ui/SwitchTransition/index.d.ts +10 -3
  86. package/dist/components/ui/SwitchTransition/index.js +99 -98
  87. package/dist/hooks/useVerifyMfaModal.js +1 -1
  88. package/dist/icons/IconBaseColorLogo.d.ts +10 -0
  89. package/dist/icons/IconBaseColorLogo.js +13 -0
  90. package/dist/icons/IconBaseLogo.d.ts +24 -0
  91. package/dist/icons/IconBaseLogo.js +13 -0
  92. package/dist/icons/index.d.ts +2 -0
  93. package/dist/icons/index.js +36 -32
  94. package/dist/index.js +230 -225
  95. package/dist/version.d.ts +1 -1
  96. package/dist/version.js +1 -1
  97. package/package.json +13 -6
  98. package/dist/assets/SwitchFadeTransition.css +0 -1
  99. package/dist/assets/SwitchSlideTransition.css +0 -1
  100. package/dist/chunks/LinkAuthFlow.S1XbYaG5.js +0 -111
  101. package/dist/chunks/index.IrJ_irKX.js +0 -17
@@ -2,7 +2,7 @@ import { u as S, A as D } from "../../chunks/useSendComponentCallOnce.BI4daEvm.j
2
2
  import { createContext as A, useContext as k, useMemo as h, useState as L, useCallback as U } from "react";
3
3
  import { VERSION as q } from "../../version.js";
4
4
  import "../AuthButton/index.js";
5
- import { u as b } from "../../chunks/CDPReactProvider.CFWIUvzR.js";
5
+ import { u as b } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
6
6
  import { CopyAddress as H } from "../CopyAddress/index.js";
7
7
  import { CopyEvmKeyButton as J } from "../CopyEvmKeyButton/index.js";
8
8
  import { CopySolanaKeyButton as X } from "../CopySolanaKeyButton/index.js";
@@ -36,6 +36,8 @@ import "../../theme/utils.js";
36
36
  import "../../icons/IconAppleLogo.js";
37
37
  import "../../icons/IconArrowLeft.js";
38
38
  import "../../icons/IconArrowsUpDown.js";
39
+ import "../../icons/IconBaseColorLogo.js";
40
+ import "../../icons/IconBaseLogo.js";
39
41
  import "../../icons/IconCheck.js";
40
42
  import "../../icons/IconCheckCircle.js";
41
43
  import "../../icons/IconChevronDown.js";
@@ -69,7 +71,7 @@ import "../EnrollMfa/EnrollMfaItems.js";
69
71
  import "../EnrollMfa/EnrollMfaTitle.js";
70
72
  import "../Fund/FundForm.js";
71
73
  import "../Fund/FundTitle.js";
72
- import "../../chunks/LinkAuthFlow.S1XbYaG5.js";
74
+ import "../../chunks/LinkAuthFlow.0FnIchwa.js";
73
75
  import "../LinkAuth/LinkAuthFlowBackButton.js";
74
76
  import "../LinkAuth/LinkAuthItem.js";
75
77
  import "../LinkAuth/LinkAuthItems.js";
@@ -333,7 +335,7 @@ import '../../assets/ExportWallet.css';const at = "ExportWallet-module__footer__
333
335
  ]
334
336
  }
335
337
  ) });
336
- }, se = ({
338
+ }, me = ({
337
339
  address: o,
338
340
  children: e,
339
341
  onIframeReady: r,
@@ -366,7 +368,7 @@ import '../../assets/ExportWallet.css';const at = "ExportWallet-module__footer__
366
368
  };
367
369
  D.registerPackageVersion("react", q);
368
370
  export {
369
- se as E,
371
+ me as E,
370
372
  pt as ExportWallet,
371
373
  j as ExportWalletCopyAddress,
372
374
  B as ExportWalletCopyKeyButton,
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
3
3
  import "react";
4
4
  import "../../chunks/lite.1fxw3LjI.js";
5
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
5
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
6
6
  import { E as W, a as g, b as n, c as C, d as T } from "../ExportWallet/index.js";
7
7
  import "../ui/Banner/index.js";
8
8
  import "../ui/Button/index.js";
@@ -1,7 +1,7 @@
1
1
  import { jsx as n, jsxs as i, Fragment as f } from "react/jsx-runtime";
2
2
  import { u as p } from "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
3
3
  import { useId as a } from "react";
4
- import { u as c } from "../../chunks/CDPReactProvider.CFWIUvzR.js";
4
+ import { u as c } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
5
5
  import { CoinbaseFooter as F } from "../ui/CoinbaseFooter/index.js";
6
6
  import { FundForm as l } from "./FundForm.js";
7
7
  import { FundProvider as C, useFundContext as _ } from "./FundProvider.js";
@@ -2,7 +2,7 @@ import { jsx as o, jsxs as u, Fragment as p } from "react/jsx-runtime";
2
2
  import { u as w } from "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
3
3
  import { createContext as j, useState as A, useCallback as F, useMemo as S, useId as $, useContext as z } from "react";
4
4
  import { c as x } from "../../chunks/lite.1fxw3LjI.js";
5
- import { u as V } from "../../chunks/CDPReactProvider.CFWIUvzR.js";
5
+ import { u as V } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
6
6
  import { Fund as k, FundFooter as D } from "../Fund/index.js";
7
7
  import { Button as v } from "../ui/Button/index.js";
8
8
  import { Modal as H, ModalContent as L, ModalTitle as R, ModalClose as U, ModalTrigger as W } from "../ui/Modal/index.js";
@@ -1,19 +1,23 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
3
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
4
4
  import "../SignIn/index.js";
5
5
  import "@coinbase/cdp-hooks";
6
- import "../ui/SwitchSlideTransition/index.js";
6
+ import "../ui/SwitchTransition/index.js";
7
7
  import "../ui/VisuallyHidden/index.js";
8
- import { a as A } from "../../chunks/LinkAuthFlow.S1XbYaG5.js";
8
+ import { a as c } from "../../chunks/LinkAuthFlow.0FnIchwa.js";
9
9
  import "./LinkAuthItems.js";
10
+ import "./LinkAuthProvider.js";
10
11
  import "./types.js";
12
+ import "../SiweStatusView/index.js";
13
+ import "../ui/CoinbaseFooter/index.js";
11
14
  import "../SignIn/SignInProvider.js";
12
15
  import "../SignIn/SignInImage.js";
13
16
  import "../SignIn/SignInForm.js";
14
17
  import "../SignIn/SignInTitle.js";
15
18
  import "../SignIn/SignInDescription.js";
16
- import "../SignIn/SignInFooter.js";
19
+ import "../SiweStatusView/toSiweProvider.js";
20
+ import "../SiweStatusView/useSiweFlow.js";
17
21
  export {
18
- A as LinkAuthFlow
22
+ c as LinkAuthFlow
19
23
  };
@@ -3,9 +3,9 @@ import { c as k } from "../../chunks/lite.1fxw3LjI.js";
3
3
  import "react";
4
4
  import { Button as p } from "../ui/Button/index.js";
5
5
  import { IconArrowLeft as f } from "../../icons/IconArrowLeft.js";
6
- import { b as w } from "../../chunks/LinkAuthFlow.S1XbYaG5.js";
6
+ import { b as w } from "../../chunks/LinkAuthFlow.0FnIchwa.js";
7
7
  import { useLinkAuthContext as _ } from "./LinkAuthProvider.js";
8
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
8
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
9
9
  import { methodToView as b } from "./utils.js";
10
10
  import '../../assets/LinkAuthFlowBackButton.css';const h = "LinkAuthFlowBackButton-module__button___wPKfW", B = "LinkAuthFlowBackButton-module__icon___OUmzY", o = {
11
11
  button: h,
@@ -1,8 +1,8 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
2
  import { AuthMethod } from '../CDPReactProvider';
3
- import { SwitchSlideTransitionRef } from '../ui/SwitchSlideTransition';
3
+ import { SwitchTransitionRef } from '../ui/SwitchTransition';
4
4
  import { SignInContentRef } from './LinkAuthFlow';
5
- import { LinkAuthFlowView } from './types';
5
+ import { LinkAuthFlowView, LinkTransitionName } from './types';
6
6
  /**
7
7
  * The value of the link auth flow context.
8
8
  *
@@ -11,12 +11,19 @@ import { LinkAuthFlowView } from './types';
11
11
  export interface LinkAuthFlowContextValue {
12
12
  /** A function to call when the back button is clicked. */
13
13
  back: () => void;
14
- /** The direction of the flow transition. */
14
+ /**
15
+ * The direction of the flow transition.
16
+ *
17
+ * @deprecated Use `transitionName` instead; `direction` is derived from
18
+ * `transitionName` for backwards compatibility and no longer controls the animation.
19
+ */
15
20
  direction?: "left" | "right";
16
21
  /** A function to call when the user links an auth method. */
17
22
  link: (method: AuthMethod) => void;
18
23
  /** A function to call when an auth method is successfully linked. */
19
24
  linkSuccess: () => void;
25
+ /** The transition animation used between flow views (fade for SIWE, slide otherwise). */
26
+ transitionName: LinkTransitionName;
20
27
  }
21
28
  /**
22
29
  * The value of the link auth flow context for the internal use of the component.
@@ -25,7 +32,7 @@ export interface LinkAuthFlowContextValue {
25
32
  */
26
33
  export interface LinkAuthFlowContextValueInternal extends LinkAuthFlowContextValue {
27
34
  /** A ref to the flow transition. */
28
- transitionRef: RefObject<SwitchSlideTransitionRef<LinkAuthFlowView> | null> | null;
35
+ transitionRef: RefObject<SwitchTransitionRef<LinkAuthFlowView> | null> | null;
29
36
  /** A ref that provides the ability to go back to the previous step of the sign in flow. */
30
37
  signInRef: RefObject<SignInContentRef | null> | null;
31
38
  }
@@ -37,8 +44,8 @@ export interface LinkAuthFlowContextValueInternal extends LinkAuthFlowContextVal
37
44
  interface LinkAuthFlowProviderProps {
38
45
  /** The children of the component. */
39
46
  children?: ReactNode;
40
- /** The direction of the flow transition. */
41
- direction?: LinkAuthFlowContextValue["direction"];
47
+ /** The transition animation used between flow views. Defaults to a left slide. */
48
+ transitionName?: LinkAuthFlowContextValueInternal["transitionName"];
42
49
  /** A function to call when the back button is clicked. */
43
50
  onBack: LinkAuthFlowContextValue["back"];
44
51
  /** A function to call when the user links an auth method. */
@@ -71,12 +78,19 @@ export declare const useLinkAuthFlowInternal: () => LinkAuthFlowContextValueInte
71
78
  export declare const useLinkAuthFlow: () => {
72
79
  /** A function to call when the back button is clicked. */
73
80
  back: () => void;
74
- /** The direction of the flow transition. */
81
+ /**
82
+ * The direction of the flow transition.
83
+ *
84
+ * @deprecated Use `transitionName` instead; `direction` is derived from
85
+ * `transitionName` for backwards compatibility and no longer controls the animation.
86
+ */
75
87
  direction?: "left" | "right";
76
88
  /** A function to call when the user links an auth method. */
77
89
  link: (method: AuthMethod) => void;
78
90
  /** A function to call when an auth method is successfully linked. */
79
91
  linkSuccess: () => void;
92
+ /** The transition animation used between flow views (fade for SIWE, slide otherwise). */
93
+ transitionName: LinkTransitionName;
80
94
  };
81
95
  /**
82
96
  * A provider for the link auth flow.
@@ -89,5 +103,5 @@ export declare const useLinkAuthFlow: () => {
89
103
  *
90
104
  * @group Components
91
105
  */
92
- export declare const LinkAuthFlowProvider: ({ direction, children, onBack, onLink, onLinkSuccess, signInRef, transitionRef, }: LinkAuthFlowProviderProps) => import("react/jsx-runtime").JSX.Element;
106
+ export declare const LinkAuthFlowProvider: ({ transitionName, children, onBack, onLink, onLinkSuccess, signInRef, transitionRef, }: LinkAuthFlowProviderProps) => import("react/jsx-runtime").JSX.Element;
93
107
  export {};
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
4
- import { L as e, u as n, b as s } from "../../chunks/LinkAuthFlow.S1XbYaG5.js";
3
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
4
+ import { L as e, u as n, b as s } from "../../chunks/LinkAuthFlow.0FnIchwa.js";
5
5
  export {
6
6
  e as LinkAuthFlowProvider,
7
7
  n as useLinkAuthFlow,
@@ -1,7 +1,7 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { ToggleListItem as s } from "../ui/ToggleListItem/index.js";
4
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
4
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
5
5
  const u = ({
6
6
  authMethod: n,
7
7
  userAlias: e,
@@ -1,49 +1,56 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { c as b } from "../../chunks/lite.1fxw3LjI.js";
3
- import { useMemo as g } from "react";
4
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
5
- import { IconAppleLogo as d } from "../../icons/IconAppleLogo.js";
6
- import { IconEnvelope as f } from "../../icons/IconEnvelope.js";
7
- import { IconGoogleColorLogo as L } from "../../icons/IconGoogleColorLogo.js";
8
- import { IconPhone as _ } from "../../icons/IconPhone.js";
9
- import { IconTelegramLogo as A } from "../../icons/IconTelegramLogo.js";
2
+ import { c as u } from "../../chunks/lite.1fxw3LjI.js";
3
+ import { useMemo as f } from "react";
4
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
5
+ import { siweConnectors as d } from "../SiweStatusView/connectors/siweConnectors.js";
6
+ import { IconAppleLogo as g } from "../../icons/IconAppleLogo.js";
7
+ import { IconEnvelope as L } from "../../icons/IconEnvelope.js";
8
+ import { IconGoogleColorLogo as A } from "../../icons/IconGoogleColorLogo.js";
9
+ import { IconPhone as M } from "../../icons/IconPhone.js";
10
+ import { IconTelegramLogo as _ } from "../../icons/IconTelegramLogo.js";
10
11
  import { IconXLogo as P } from "../../icons/IconXLogo.js";
11
12
  import { LinkAuthItem as T } from "./LinkAuthItem.js";
12
13
  import { useLinkAuthContext as k } from "./LinkAuthProvider.js";
13
- import '../../assets/LinkAuthItems.css';const x = "LinkAuthItems-module__list___5AimM", M = {
14
+ import '../../assets/LinkAuthItems.css';const x = "LinkAuthItems-module__list___5AimM", E = {
14
15
  list: x
15
- }, m = {
16
- email: { Icon: /* @__PURE__ */ e(f, { "aria-label": "Email" }), label: "Email" },
17
- sms: { Icon: /* @__PURE__ */ e(_, { "aria-label": "Phone" }), label: "Phone" },
18
- "oauth:google": { Icon: /* @__PURE__ */ e(L, { "aria-label": "Google" }), label: "Google" },
19
- "oauth:apple": { Icon: /* @__PURE__ */ e(d, { "aria-label": "Apple" }), label: "Apple" },
16
+ }, w = Object.fromEntries(
17
+ Object.entries(d).map(([i, l]) => {
18
+ const t = l.colorIcon ?? l.icon;
19
+ return [`siwe:${i}`, { Icon: /* @__PURE__ */ e(t, { "aria-label": l.label }), label: l.label }];
20
+ })
21
+ ), c = {
22
+ email: { Icon: /* @__PURE__ */ e(L, { "aria-label": "Email" }), label: "Email" },
23
+ sms: { Icon: /* @__PURE__ */ e(M, { "aria-label": "Phone" }), label: "Phone" },
24
+ "oauth:google": { Icon: /* @__PURE__ */ e(A, { "aria-label": "Google" }), label: "Google" },
25
+ "oauth:apple": { Icon: /* @__PURE__ */ e(g, { "aria-label": "Apple" }), label: "Apple" },
20
26
  "oauth:x": { Icon: /* @__PURE__ */ e(P, { "aria-label": "X" }), label: "X" },
21
- "oauth:telegram": { Icon: /* @__PURE__ */ e(A, { "aria-label": "Telegram" }), label: "Telegram" }
22
- }, O = ({ children: s, className: c = "", onLink: t, ...p }) => {
23
- const { state: h, dispatch: a } = k(), { authMethods: i, isPending: r, methodToLink: n } = h, I = g(() => i.filter((o) => m[o.method]).map((o) => {
24
- const { Icon: l, label: u } = m[o.method];
27
+ "oauth:telegram": { Icon: /* @__PURE__ */ e(_, { "aria-label": "Telegram" }), label: "Telegram" },
28
+ ...w
29
+ }, q = ({ children: i, className: l = "", onLink: t, ...p }) => {
30
+ const { state: h, dispatch: r } = k(), { authMethods: n, isPending: m, methodToLink: s } = h, I = f(() => n.filter((o) => c[o.method]).map((o) => {
31
+ const { Icon: a, label: b } = c[o.method];
25
32
  return {
26
33
  ...o,
27
- icon: l,
28
- label: u,
34
+ icon: a,
35
+ label: b,
29
36
  onLink: async () => {
30
- a({ type: "LINK_AUTH_METHOD", payload: { method: o.method } }), await t?.(o.method);
37
+ r({ type: "LINK_AUTH_METHOD", payload: { method: o.method } }), await t?.(o.method);
31
38
  }
32
39
  };
33
- }), [i, a, t]);
34
- return /* @__PURE__ */ e("ul", { className: b(M.list, c), ...p, children: I.map(({ method: o, ...l }) => /* @__PURE__ */ e("li", { children: s?.({
35
- ...l,
40
+ }), [n, r, t]);
41
+ return /* @__PURE__ */ e("ul", { className: u(E.list, l), ...p, children: I.map(({ method: o, ...a }) => /* @__PURE__ */ e("li", { children: i?.({
42
+ ...a,
36
43
  authMethod: o,
37
- isPending: r && n === o
44
+ isPending: m && s === o
38
45
  }) || /* @__PURE__ */ e(
39
46
  T,
40
47
  {
41
- ...l,
48
+ ...a,
42
49
  authMethod: o,
43
- isPending: r && n === o
50
+ isPending: m && s === o
44
51
  }
45
52
  ) }, o)) });
46
53
  };
47
54
  export {
48
- O as LinkAuthItems
55
+ q as LinkAuthItems
49
56
  };
@@ -1,14 +1,21 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import { useCurrentUser as c } from "@coinbase/cdp-hooks";
3
- import { createContext as M, useContext as p, useMemo as r, useReducer as A, useEffect as f } from "react";
4
- import { u as L } from "../../chunks/CDPReactProvider.CFWIUvzR.js";
3
+ import { createContext as M, useContext as p, useMemo as d, useReducer as A, useEffect as f } from "react";
4
+ import { u as L } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
5
5
  import { formatPhoneNumber as k } from "../../utils/formatPhoneNumber.js";
6
6
  const g = {
7
7
  methodToLink: null,
8
8
  authMethods: [],
9
9
  error: null,
10
10
  isPending: !1
11
- }, d = M(void 0), T = (e, t) => {
11
+ }, r = M(void 0), T = (e, t) => {
12
+ if (t.startsWith("siwe:")) {
13
+ const o = e.authenticationMethods.siwe?.address;
14
+ return {
15
+ userAlias: o ? `${o.slice(0, 6)}...${o.slice(-4)}` : "",
16
+ isLinked: !!o
17
+ };
18
+ }
12
19
  switch (t) {
13
20
  case "email":
14
21
  return {
@@ -76,33 +83,33 @@ function E(e, t) {
76
83
  }
77
84
  }
78
85
  const y = ({ children: e }) => {
79
- const { currentUser: t } = c(), { authMethods: n } = L(), a = r(() => {
80
- const i = [];
81
- return n.forEach((s) => {
86
+ const { currentUser: t } = c(), { authMethods: o } = L(), i = d(() => {
87
+ const a = [];
88
+ return o.forEach((n) => {
82
89
  if (!t) {
83
- i.push({
90
+ a.push({
84
91
  userAlias: "",
85
92
  isLinked: !1,
86
- method: s
93
+ method: n
87
94
  });
88
95
  return;
89
96
  }
90
- const u = T(t, s);
91
- i.push({
97
+ const u = T(t, n);
98
+ a.push({
92
99
  userAlias: u?.userAlias ?? "",
93
100
  isLinked: u?.isLinked ?? !1,
94
- method: s
101
+ method: n
95
102
  });
96
- }), i;
97
- }, [t, n]), [h, o] = A(E, {
103
+ }), a;
104
+ }, [t, o]), [h, s] = A(E, {
98
105
  ...g,
99
- authMethods: a
100
- }), l = r(() => ({ state: h, dispatch: o }), [h, o]);
106
+ authMethods: i
107
+ }), l = d(() => ({ state: h, dispatch: s }), [h, s]);
101
108
  return f(() => {
102
- o({ type: "SET_AUTH_METHODS", payload: { methods: a } });
103
- }, [o, a]), /* @__PURE__ */ m(d.Provider, { value: l, children: e });
109
+ s({ type: "SET_AUTH_METHODS", payload: { methods: i } });
110
+ }, [s, i]), /* @__PURE__ */ m(r.Provider, { value: l, children: e });
104
111
  }, C = () => {
105
- const e = p(d);
112
+ const e = p(r);
106
113
  if (!e)
107
114
  throw new Error("useLinkAuthContext must be used within a LinkAuthProvider");
108
115
  return e;
@@ -7,7 +7,7 @@ import { LinkAuthItem, LinkAuthItemProps } from './LinkAuthItem';
7
7
  import { LinkAuthItems, LinkAuthItemsProps } from './LinkAuthItems';
8
8
  import { useLinkAuthContext, LinkAuthContextValue } from './LinkAuthProvider';
9
9
  import { LinkAuthTitle, LinkAuthTitleProps } from './LinkAuthTitle';
10
- import { LinkAuthState, LinkAuthMethod, LinkAuthAction } from './types';
10
+ import { LinkAuthState, LinkAuthMethod, LinkAuthAction, LinkTransitionName } from './types';
11
11
  /**
12
12
  * Props for the LinkAuth component
13
13
  *
@@ -184,4 +184,4 @@ declare const LinkAuthError: ({ role, ...props }: HTMLAttributes<HTMLDivElement>
184
184
  * ```
185
185
  */
186
186
  declare const LinkAuth: (props: LinkAuthProps) => import("react/jsx-runtime").JSX.Element;
187
- export { LinkAuthError, LinkAuthFlow, LinkAuthFlowBackButton, LinkAuthItem, LinkAuthItems, LinkAuthTitle, LinkAuth, useLinkAuthContext, useLinkAuthFlow, type LinkAuthAction, type LinkAuthContextValue, type LinkAuthFlowBackButtonProps, type LinkAuthFlowContextValue, type LinkAuthFlowProps, type LinkAuthItemProps, type LinkAuthItemsProps, type LinkAuthMethod, type LinkAuthProps, type LinkAuthState, type LinkAuthTitleProps, };
187
+ export { LinkAuthError, LinkAuthFlow, LinkAuthFlowBackButton, LinkAuthItem, LinkAuthItems, LinkAuthTitle, LinkAuth, useLinkAuthContext, useLinkAuthFlow, type LinkAuthAction, type LinkAuthContextValue, type LinkAuthFlowBackButtonProps, type LinkAuthFlowContextValue, type LinkAuthFlowProps, type LinkAuthItemProps, type LinkAuthItemsProps, type LinkAuthMethod, type LinkAuthProps, type LinkAuthState, type LinkAuthTitleProps, type LinkTransitionName, };
@@ -1,92 +1,93 @@
1
- import { jsx as r, jsxs as h, Fragment as I } from "react/jsx-runtime";
2
- import { useLinkOAuth as N } from "@coinbase/cdp-hooks";
1
+ import { jsx as r, jsxs as d, Fragment as F } from "react/jsx-runtime";
2
+ import { useLinkOAuth as I } from "@coinbase/cdp-hooks";
3
3
  import { u as P } from "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
4
- import { useRef as d, useState as U, useCallback as a } from "react";
5
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
6
- import { useOauthStatusModal as D } from "../OAuthStatusModal/index.js";
7
- import { Banner as H } from "../ui/Banner/index.js";
8
- import { useTimeout as M } from "../../hooks/useTimeout.js";
9
- import { getMessageFromUnknownError as v } from "../../utils/getMessageFromUnknownError.js";
4
+ import { useRef as f, useState as U, useCallback as c } from "react";
5
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
6
+ import { useOauthStatusModal as H } from "../OAuthStatusModal/index.js";
7
+ import { Banner as M } from "../ui/Banner/index.js";
8
+ import { useTimeout as V } from "../../hooks/useTimeout.js";
9
+ import { getMessageFromUnknownError as j } from "../../utils/getMessageFromUnknownError.js";
10
10
  import "libphonenumber-js";
11
- import { toOAuthProviderType as V } from "../../utils/toOAuthProviderType.js";
12
- import { L as j, a as K } from "../../chunks/LinkAuthFlow.S1XbYaG5.js";
13
- import { u as ft } from "../../chunks/LinkAuthFlow.S1XbYaG5.js";
14
- import { LinkAuthFlowBackButton as W } from "./LinkAuthFlowBackButton.js";
15
- import { LinkAuthItem as Lt } from "./LinkAuthItem.js";
16
- import { LinkAuthItems as _t } from "./LinkAuthItems.js";
17
- import { LinkAuthProvider as $, useLinkAuthContext as x } from "./LinkAuthProvider.js";
18
- import { LinkAuthTitle as b } from "./LinkAuthTitle.js";
11
+ import { toOAuthProviderType as D } from "../../utils/toOAuthProviderType.js";
12
+ import { L as K, a as W } from "../../chunks/LinkAuthFlow.0FnIchwa.js";
13
+ import { u as pt } from "../../chunks/LinkAuthFlow.0FnIchwa.js";
14
+ import { LinkAuthFlowBackButton as $ } from "./LinkAuthFlowBackButton.js";
15
+ import { LinkAuthItem as At } from "./LinkAuthItem.js";
16
+ import { LinkAuthItems as Tt } from "./LinkAuthItems.js";
17
+ import { LinkAuthProvider as b, useLinkAuthContext as x } from "./LinkAuthProvider.js";
18
+ import { LinkAuthTitle as G } from "./LinkAuthTitle.js";
19
19
  import { methodToView as O } from "./utils.js";
20
- import '../../assets/LinkAuth.css';const G = "LinkAuth-module__header___0UuxP", J = "LinkAuth-module__error___XUo4W", k = {
20
+ import '../../assets/LinkAuth.css';const J = "LinkAuth-module__header___0UuxP", X = "LinkAuth-module__error___XUo4W", k = {
21
21
  "link-auth": "LinkAuth-module__link-auth___kPJao",
22
- header: G,
23
- error: J
24
- }, X = ({ role: o = "alert", ...c }) => {
25
- const { state: i } = x(), { error: s } = i;
26
- return s ? /* @__PURE__ */ r(H, { variant: "error", role: o, ...c, children: s }) : null;
27
- }, q = ({ children: o, className: c = "", onLinkSuccess: i, ...s }) => {
28
- const { linkOAuth: f } = N(), { persistOAuthState: p, cleanupOAuthState: L } = D(), { state: u, dispatch: n } = x(), { methodToLink: E } = u, A = d(null), l = d(null), { schedule: _ } = M(), S = O(E), T = d(S), [B, m] = U("left"), e = a(
22
+ header: J,
23
+ error: X
24
+ }, q = ({ role: e = "alert", ...l }) => {
25
+ const { state: s } = x(), { error: a } = s;
26
+ return a ? /* @__PURE__ */ r(M, { variant: "error", role: e, ...l, children: a }) : null;
27
+ }, z = ({ children: e, className: l = "", onLinkSuccess: s, ...a }) => {
28
+ const { linkOAuth: p } = I(), { persistOAuthState: L, cleanupOAuthState: A } = H(), { state: u, dispatch: n } = x(), { methodToLink: E } = u, _ = f(null), m = f(null), { schedule: T } = V(), S = O(E), i = f(S), [B, h] = U("slide-left"), o = c(
29
29
  (t) => {
30
- T.current !== t && (T.current = t, A.current?.transition.toggle(t), t === "list" && n({ type: "RESET_STATE" }), (t === "email" || t === "sms") && n({ type: "LINK_AUTH_METHOD", payload: { method: t } }));
30
+ i.current !== t && (i.current = t, _.current?.transition.toggle(t), t === "list" && n({ type: "RESET_STATE" }));
31
31
  },
32
32
  [n]
33
- ), F = a(() => {
34
- if (m("right"), l.current?.canGoBack) {
35
- l.current.goBack();
33
+ ), N = c(() => {
34
+ if (h(i.current === "siwe" ? "fade" : "slide-right"), m.current?.canGoBack) {
35
+ m.current.goBack();
36
36
  return;
37
37
  }
38
- e("list");
39
- }, [e]), R = a(() => {
40
- m("left"), i?.(u.methodToLink), _(() => e("list"), 800);
41
- }, [e, u.methodToLink, i, _]), w = a(
38
+ o("list");
39
+ }, [o]), R = c(() => {
40
+ h(i.current === "siwe" ? "fade" : "slide-left"), s?.(u.methodToLink), T(() => o("list"), 800);
41
+ }, [o, u.methodToLink, s, T]), v = c(
42
42
  async (t) => {
43
- if (m("left"), t?.startsWith("oauth:")) {
44
- const y = V(t);
43
+ const w = O(t);
44
+ if (h(i.current === "siwe" || w === "siwe" ? "fade" : "slide-left"), n({ type: "LINK_AUTH_METHOD", payload: { method: t } }), t?.startsWith("oauth:")) {
45
+ const y = D(t);
45
46
  if (y)
46
47
  try {
47
- p(!0), await f(y);
48
+ L(!0), await p(y);
48
49
  } catch (C) {
49
- L(), n({
50
+ A(), n({
50
51
  type: "LINK_AUTH_METHOD_ERROR",
51
- payload: { error: v(C) }
52
+ payload: { error: j(C) }
52
53
  });
53
54
  }
54
55
  } else
55
- e(O(t));
56
+ o(w);
56
57
  },
57
- [f, e, p, L, n]
58
- ), g = typeof o == "function" ? o(u) : o;
59
- return /* @__PURE__ */ r("div", { className: `${k["link-auth"]} ${c}`, ...s, children: /* @__PURE__ */ h(
60
- j,
58
+ [p, o, L, A, n]
59
+ ), g = typeof e == "function" ? e(u) : e;
60
+ return /* @__PURE__ */ r("div", { className: `${k["link-auth"]} ${l}`, ...a, children: /* @__PURE__ */ d(
61
+ K,
61
62
  {
62
- direction: B,
63
- onBack: F,
64
- onLink: w,
63
+ transitionName: B,
64
+ onBack: N,
65
+ onLink: v,
65
66
  onLinkSuccess: R,
66
- signInRef: l,
67
- transitionRef: A,
67
+ signInRef: m,
68
+ transitionRef: _,
68
69
  children: [
69
70
  g,
70
- !g && /* @__PURE__ */ h(I, { children: [
71
- /* @__PURE__ */ h("div", { className: k.header, children: [
72
- /* @__PURE__ */ r(b, {}),
73
- /* @__PURE__ */ r(W, {})
71
+ !g && /* @__PURE__ */ d(F, { children: [
72
+ /* @__PURE__ */ d("div", { className: k.header, children: [
73
+ /* @__PURE__ */ r(G, {}),
74
+ /* @__PURE__ */ r($, {})
74
75
  ] }),
75
- /* @__PURE__ */ r("div", { className: k.error, children: /* @__PURE__ */ r(X, {}) }),
76
- /* @__PURE__ */ r(K, {})
76
+ /* @__PURE__ */ r("div", { className: k.error, children: /* @__PURE__ */ r(q, {}) }),
77
+ /* @__PURE__ */ r(W, {})
77
78
  ] })
78
79
  ]
79
80
  }
80
81
  ) });
81
- }, ht = (o) => (P("manage_auth"), /* @__PURE__ */ r($, { children: /* @__PURE__ */ r(q, { ...o }) }));
82
+ }, dt = (e) => (P("manage_auth"), /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(z, { ...e }) }));
82
83
  export {
83
- ht as LinkAuth,
84
- X as LinkAuthError,
85
- K as LinkAuthFlow,
86
- W as LinkAuthFlowBackButton,
87
- Lt as LinkAuthItem,
88
- _t as LinkAuthItems,
89
- b as LinkAuthTitle,
84
+ dt as LinkAuth,
85
+ q as LinkAuthError,
86
+ W as LinkAuthFlow,
87
+ $ as LinkAuthFlowBackButton,
88
+ At as LinkAuthItem,
89
+ Tt as LinkAuthItems,
90
+ G as LinkAuthTitle,
90
91
  x as useLinkAuthContext,
91
- ft as useLinkAuthFlow
92
+ pt as useLinkAuthFlow
92
93
  };
@@ -1,4 +1,9 @@
1
1
  import { AuthMethod } from '../CDPReactProvider';
2
+ import { TransitionName } from '../ui/SwitchTransition';
3
+ /**
4
+ * Transition names for the LinkAuthFlow
5
+ */
6
+ export { type TransitionName as LinkTransitionName };
2
7
  /**
3
8
  * Representation of auth method
4
9
  *
@@ -56,7 +61,7 @@ export type LinkAuthAction = {
56
61
  /**
57
62
  * The views of the link auth flow.
58
63
  */
59
- export declare const LINK_AUTH_FLOW_VIEWS: readonly ["list", "email", "sms"];
64
+ export declare const LINK_AUTH_FLOW_VIEWS: readonly ["list", "email", "sms", "siwe"];
60
65
  /**
61
66
  * The view of the link auth flow.
62
67
  */
@@ -1,5 +1,7 @@
1
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
2
- const t = ["list", "email", "sms"];
1
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
2
+ import "react/jsx-runtime";
3
+ import "react";
4
+ const o = ["list", "email", "sms", "siwe"];
3
5
  export {
4
- t as LINK_AUTH_FLOW_VIEWS
6
+ o as LINK_AUTH_FLOW_VIEWS
5
7
  };
@@ -1,7 +1,7 @@
1
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
1
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
2
2
  import { LINK_AUTH_FLOW_VIEWS as i } from "./types.js";
3
- const t = (r) => i.includes(r), o = (r) => r && t(r) ? r : "list";
3
+ const t = (r) => i.includes(r), n = (r) => r ? r.startsWith("siwe:") ? "siwe" : t(r) ? r : "list" : "list";
4
4
  export {
5
5
  t as isView,
6
- o as methodToView
6
+ n as methodToView
7
7
  };
@@ -56,7 +56,7 @@ declare const LinkAuthModalTrigger: ({ children, className, label, ...props }: L
56
56
  *
57
57
  * @group Components
58
58
  */
59
- declare const LinkAuthModalContent: (props: LinkAuthModalContentProps) => import("react/jsx-runtime").JSX.Element;
59
+ declare const LinkAuthModalContent: ({ onInteractOutside, ...props }: LinkAuthModalContentProps) => import("react/jsx-runtime").JSX.Element;
60
60
  /**
61
61
  * A link auth modal component that wraps the {@link LinkAuth} component.
62
62
  *