@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
@@ -1,9 +1,9 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import "react";
3
- import { a as d } from "../../chunks/index.IrJ_irKX.js";
3
+ import { a as d } from "../../chunks/index.Du1vsLh6.js";
4
4
  import { useSignInContext as h } from "./SignInProvider.js";
5
5
  import "@coinbase/cdp-hooks";
6
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
6
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
7
7
  import '../../assets/SignInDescription.css';const u = "SignInDescription-module__description___jZLc6", _ = {
8
8
  description: u
9
9
  }, M = ({
@@ -1,8 +1,8 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
2
  import { useRef as d, useState as I, useLayoutEffect as p } from "react";
3
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
3
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
4
4
  import { SwitchFadeTransition as T } from "../ui/SwitchFadeTransition/index.js";
5
- import { a as y } from "../../chunks/index.IrJ_irKX.js";
5
+ import { a as y } from "../../chunks/index.Du1vsLh6.js";
6
6
  import { useSignInContext as v } from "./SignInProvider.js";
7
7
  import "@coinbase/cdp-hooks";
8
8
  import '../../assets/SignInForm.css';const E = {
@@ -1,3 +1,5 @@
1
+ import { AuthMethod } from '../CDPReactProvider';
2
+ import { SignInState } from './types';
1
3
  /**
2
4
  * Props for the SignInImage component.
3
5
  *
@@ -10,15 +12,22 @@ export interface SignInImageProps {
10
12
  alt?: string;
11
13
  /** The source URL for the image. Uses the app logo by default. */
12
14
  src?: string;
15
+ /** The active auth method. On the verification step, its method icon is shown. */
16
+ authMethod?: AuthMethod;
17
+ /** The current step. On `"verification"`, a method icon is shown instead of the app logo. */
18
+ step?: SignInState["step"];
13
19
  }
14
20
  /**
15
- * A logo or success icon for the SignIn component.
21
+ * The image shown at the top of the SignIn component: the app logo on the credentials step, and a
22
+ * method-specific icon on the verification step (when `authMethod`/`step` are provided).
16
23
  *
17
24
  * @param {SignInImageProps} props - The props for the component.
18
25
  * @param {string} [props.className] - The class name to apply to the component.
19
26
  * @param {string} [props.alt] - The alt text for the image.
20
27
  * @param {string} [props.src] - The source URL for the image. Uses the app logo by default.
21
- * @returns {JSX.Element} The rendered component.
28
+ * @param {AuthMethod} [props.authMethod] - The active auth method (drives the verification icon).
29
+ * @param {SignInState["step"]} [props.step] - The current step.
30
+ * @returns {JSX.Element | null} The rendered component.
22
31
  *
23
32
  * @group Components
24
33
  *
@@ -41,4 +50,4 @@ export interface SignInImageProps {
41
50
  * }
42
51
  * ```
43
52
  */
44
- export declare const SignInImage: ({ className, alt, src }: SignInImageProps) => import("react/jsx-runtime").JSX.Element | null;
53
+ export declare const SignInImage: ({ className, alt, src, authMethod: authMethodFromProps, step: stepFromProps, }: SignInImageProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,20 +1,43 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { u as a } from "../../chunks/CDPReactProvider.CFWIUvzR.js";
3
- import '../../assets/SignInImage.css';const e = "SignInImage-module__logo___rlzt-", m = {
4
- logo: e
5
- }, p = (t) => /^https?:\/\//.test(t), f = ({ className: t = "", alt: s, src: g }) => {
6
- const o = a(), n = o.appLogoUrl && p(o.appLogoUrl) ? o.appLogoUrl : void 0, l = g && p(g) ? g : n, r = s || o.appName || "";
7
- return l ? /* @__PURE__ */ i(
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import "react";
3
+ import { u as h } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
4
+ import { Badge as I } from "../ui/Badge/index.js";
5
+ import { IconEnvelope as _ } from "../../icons/IconEnvelope.js";
6
+ import { IconPhone as v } from "../../icons/IconPhone.js";
7
+ import "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
8
+ import "./SignInAuthMethodButtons.js";
9
+ import "../ui/Button/index.js";
10
+ import "../../theme/theme.js";
11
+ import { useSignInContext as b } from "./SignInProvider.js";
12
+ import "@coinbase/cdp-hooks";
13
+ import '../../assets/SignInImage.css';const S = "SignInImage-module__logo___rlzt-", U = "SignInImage-module__badge___PjB19", a = {
14
+ logo: S,
15
+ badge: U
16
+ }, L = {
17
+ email: /* @__PURE__ */ n(_, {}),
18
+ sms: /* @__PURE__ */ n(v, {})
19
+ }, m = (o) => /^https?:\/\//.test(o), E = ({
20
+ className: o = "",
21
+ alt: g,
22
+ src: i,
23
+ authMethod: c,
24
+ step: l
25
+ }) => {
26
+ const t = h(), { state: e } = b(), d = l || e.step, r = c || e.authMethod, s = r ? L[r] : void 0;
27
+ if (d === "verification" && s)
28
+ return /* @__PURE__ */ n(I, { className: `${a.badge} ${o}`, variant: "secondary", children: s });
29
+ const f = t.appLogoUrl && m(t.appLogoUrl) ? t.appLogoUrl : void 0, p = i && m(i) ? i : f, u = g || t.appName || "";
30
+ return p ? /* @__PURE__ */ n(
8
31
  "img",
9
32
  {
10
- src: l,
11
- alt: r || "",
12
- className: `${m.logo} ${t}`,
13
- width: 64,
14
- height: 64
33
+ src: p,
34
+ alt: u || "",
35
+ className: `${a.logo} ${o}`,
36
+ width: 48,
37
+ height: 48
15
38
  }
16
39
  ) : null;
17
40
  };
18
41
  export {
19
- f as SignInImage
42
+ E as SignInImage
20
43
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as h } from "react/jsx-runtime";
2
- import { createContext as m, useContext as l, useMemo as i } from "react";
3
- import { u as f } from "../../chunks/CDPReactProvider.CFWIUvzR.js";
2
+ import { createContext as l, useContext as m, useMemo as i } from "react";
3
+ import { u as f } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
4
4
  import "@coinbase/cdp-hooks";
5
5
  import { useSignInReducer as p } from "./useSignInReducer.js";
6
6
  const a = {
@@ -14,13 +14,14 @@ const a = {
14
14
  isSuccess: !1,
15
15
  otp: "",
16
16
  phoneNumber: "",
17
+ status: "idle",
17
18
  step: "credentials"
18
- }, u = m({
19
+ }, u = l({
19
20
  state: a,
20
21
  dispatch: () => {
21
22
  }
22
23
  }), M = () => {
23
- const t = l(u);
24
+ const t = m(u);
24
25
  if (!t)
25
26
  throw new Error("useSignInContext must be used within a SignInProvider");
26
27
  return t;
@@ -1,9 +1,9 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import "react";
3
- import { a as c } from "../../chunks/index.IrJ_irKX.js";
3
+ import { a as c } from "../../chunks/index.Du1vsLh6.js";
4
4
  import { useSignInContext as d } from "./SignInProvider.js";
5
5
  import "@coinbase/cdp-hooks";
6
- import "../../chunks/CDPReactProvider.CFWIUvzR.js";
6
+ import "../../chunks/CDPReactProvider.BWInVuNJ.js";
7
7
  import '../../assets/SignInTitle.css';const l = "SignInTitle-module__heading___QJ071", g = {
8
8
  heading: l
9
9
  }, S = ({
@@ -1,8 +1,4 @@
1
1
  import { SignInFlowProps, SignInTitleAndDescriptionProps, SignInFlowConfig } from '../types';
2
- /**
3
- * The step of the email OTP flow.
4
- */
5
- export type Step = "email" | "otp";
6
2
  /**
7
3
  * A component that renders the sign in with email flow.
8
4
  *
@@ -1,95 +1,94 @@
1
- import { jsxs as a, Fragment as m, jsx as r } from "react/jsx-runtime";
2
- import { useIsSignedIn as L, useSignInWithEmail as j, useLinkEmail as k, useVerifyEmailOTP as H } from "@coinbase/cdp-hooks";
3
- import { useRef as S, useLayoutEffect as M } from "react";
4
- import { EmailForm as V } from "../../forms/EmailForm/index.js";
5
- import { OTPForm as q } from "../../forms/OTPForm/index.js";
6
- import { SwitchSlideTransition as z } from "../../ui/SwitchSlideTransition/index.js";
7
- import { useEmailForm as A } from "../hooks/useEmailForm.js";
8
- import { useOTPForm as B } from "../hooks/useOTPForm.js";
9
- import { SignInCredentials as G } from "../SignInCredentials.js";
10
- import { useSignInContext as E } from "../SignInProvider.js";
11
- import "../../../chunks/CDPReactProvider.CFWIUvzR.js";
12
- const J = ["email", "otp"], N = ({
13
- step: n,
14
- autoFocus: s,
15
- onSuccess: h,
16
- children: c
1
+ import { jsxs as m, Fragment as c, jsx as o } from "react/jsx-runtime";
2
+ import { useIsSignedIn as C, useSignInWithEmail as x, useLinkEmail as L, useVerifyEmailOTP as j } from "@coinbase/cdp-hooks";
3
+ import "react";
4
+ import { EmailForm as k } from "../../forms/EmailForm/index.js";
5
+ import { OTPForm as M } from "../../forms/OTPForm/index.js";
6
+ import { SwitchSlideTransition as A } from "../../ui/SwitchSlideTransition/index.js";
7
+ import { useEmailForm as H } from "../hooks/useEmailForm.js";
8
+ import { useFlowTransition as V } from "../hooks/useFlowTransition.js";
9
+ import { useOTPForm as q } from "../hooks/useOTPForm.js";
10
+ import { SignInCredentials as z } from "../SignInCredentials.js";
11
+ import { useSignInContext as p } from "../SignInProvider.js";
12
+ import { STEPS as B } from "../types.js";
13
+ const G = ({
14
+ step: e,
15
+ autoFocus: a,
16
+ onSuccess: g,
17
+ children: l
17
18
  }) => {
18
- const l = S(null), P = 6, { isSignedIn: T } = L(), { state: t } = E(), { signInWithEmail: O } = j(), { linkEmail: I } = k(), { verifyEmailOTP: v } = H(), u = n || t.step, i = u === "credentials" ? "email" : "otp", d = S(i), { setEmail: b, submitEmail: f } = A({
19
- submit: (e) => T ? I(e) : O({ email: e })
20
- }), { resendCountdown: w, resetOTP: F, setOTP: R, startResendTimer: D, submitOtp: W } = B({
21
- passwordLength: P,
22
- submit: (e) => v({ flowId: t.flowId, otp: e })
23
- }), p = () => {
24
- D(60);
25
- }, C = () => {
26
- F(), f({ email: t.email, onSuccess: p });
27
- }, x = (e) => {
28
- e.preventDefault(), f({ email: t.email, onSuccess: p });
29
- }, y = (e) => {
30
- e.preventDefault();
31
- const o = new FormData(e.currentTarget).get("otp") || t.otp;
32
- W({ otp: o, onSuccess: h });
19
+ const { isSignedIn: h } = C(), { state: t } = p(), { signInWithEmail: S } = x(), { linkEmail: E } = L(), { verifyEmailOTP: T } = j(), s = e || t.step, r = t.authMethod === "email", { transitionRef: P } = V(s, r), { setEmail: v, submitEmail: d } = H({
20
+ submit: (i) => h ? E(i) : S({ email: i })
21
+ }), { resendCountdown: O, resetOTP: I, setOTP: b, startResendTimer: w, submitOtp: F } = q({
22
+ passwordLength: 6,
23
+ submit: (i) => T({ flowId: t.flowId, otp: i })
24
+ }), u = () => {
25
+ w(60);
26
+ }, D = () => {
27
+ I(), d({ email: t.email, onSuccess: u });
28
+ }, R = (i) => {
29
+ i.preventDefault(), d({ email: t.email, onSuccess: u });
30
+ }, W = (i) => {
31
+ i.preventDefault();
32
+ const n = new FormData(i.currentTarget).get("otp") || t.otp;
33
+ F({ otp: n, onSuccess: g });
33
34
  };
34
- return M(() => {
35
- d.current !== i && (l.current?.transition.toggle(i), d.current = i);
36
- }, [i]), /* @__PURE__ */ r(
37
- z,
35
+ return /* @__PURE__ */ o(
36
+ A,
38
37
  {
39
- autoFocus: s,
38
+ autoFocus: a,
40
39
  animateHeight: !1,
41
- items: J,
40
+ items: B,
42
41
  initialEntered: !0,
43
- direction: i === "otp" ? "left" : "right",
44
- transitionRef: l,
45
- children: ({ itemKey: e, ...g }) => {
46
- let o = null;
47
- return e === "email" && (o = /* @__PURE__ */ r(
48
- V,
42
+ direction: s === "verification" ? "left" : "right",
43
+ transitionRef: P,
44
+ children: ({ itemKey: i, ...f }) => {
45
+ let n = null;
46
+ return i === "credentials" && (n = /* @__PURE__ */ o(
47
+ k,
49
48
  {
50
49
  email: t.email,
51
- error: i === "email" && t.error || "",
52
- isPending: t.isPending,
53
- onEmailChange: b,
54
- onSubmit: x
50
+ error: s === i && t.error || "",
51
+ isPending: r && t.status === "pending",
52
+ onEmailChange: v,
53
+ onSubmit: R
55
54
  }
56
- )), e === "otp" && (o = /* @__PURE__ */ r(
57
- q,
55
+ )), i === "verification" && (n = /* @__PURE__ */ o(
56
+ M,
58
57
  {
59
58
  canResetOTP: t.canResetOTP,
60
- error: i === "otp" && t.error || "",
61
- isPending: t.isPending,
62
- onOTPChange: R,
63
- onResendOTP: C,
64
- onSubmit: y,
59
+ error: s === i && t.error || "",
60
+ isPending: r && t.status === "pending",
61
+ onOTPChange: b,
62
+ onResendOTP: D,
63
+ onSubmit: W,
65
64
  otp: t.otp,
66
- resendCountdown: w,
67
- successMessage: t.isSuccess ? "Success!" : void 0
65
+ resendCountdown: O,
66
+ successMessage: r && t.status === "success" ? "Success!" : void 0
68
67
  }
69
- )), /* @__PURE__ */ r("div", { ...g, children: c ? c({ step: u, Form: o }) : o });
68
+ )), /* @__PURE__ */ o("div", { ...f, children: l ? l({ step: i, Form: n }) : n });
70
69
  }
71
70
  }
72
71
  );
73
- }, Q = ({ step: n }) => /* @__PURE__ */ a(m, { children: [
74
- n === "credentials" && "Sign in",
75
- n === "verification" && "Enter verification code"
76
- ] }), U = ({ step: n }) => {
77
- const { state: s } = E();
78
- return /* @__PURE__ */ a(m, { children: [
79
- n === "credentials" && "We’ll send you a verification code via email.",
80
- n === "verification" && /* @__PURE__ */ a(m, { children: [
72
+ }, J = ({ step: e }) => /* @__PURE__ */ m(c, { children: [
73
+ e === "credentials" && "Sign in",
74
+ e === "verification" && "Enter verification code"
75
+ ] }), N = ({ step: e }) => {
76
+ const { state: a } = p();
77
+ return /* @__PURE__ */ m(c, { children: [
78
+ e === "credentials" && "We’ll send you a verification code via email.",
79
+ e === "verification" && /* @__PURE__ */ m(c, { children: [
81
80
  "Enter the 6 digit code sent to ",
82
- /* @__PURE__ */ r(G, { children: s.email })
81
+ /* @__PURE__ */ o(z, { children: a.email })
83
82
  ] })
84
83
  ] });
85
- }, rt = {
86
- description: U,
87
- forms: N,
88
- title: Q
84
+ }, oi = {
85
+ description: N,
86
+ forms: G,
87
+ title: J
89
88
  };
90
89
  export {
91
- N as SignInWithEmail,
92
- U as SignInWithEmailDescription,
93
- Q as SignInWithEmailTitle,
94
- rt as config
90
+ G as SignInWithEmail,
91
+ N as SignInWithEmailDescription,
92
+ J as SignInWithEmailTitle,
93
+ oi as config
95
94
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as h, Fragment as a, jsx as e } from "react/jsx-runtime";
2
2
  import "@coinbase/cdp-hooks";
3
3
  import { useRef as A, useCallback as S, useEffect as v } from "react";
4
- import { u as m } from "../../../chunks/CDPReactProvider.CFWIUvzR.js";
4
+ import { u as m } from "../../../chunks/CDPReactProvider.BWInVuNJ.js";
5
5
  import { useSignInWithOAuth as O } from "../hooks/useSignInWithOAuth.js";
6
6
  import { Button as W } from "../../ui/Button/index.js";
7
7
  import { ServerError as I } from "../../ui/ServerError/index.js";
@@ -0,0 +1,27 @@
1
+ import { SignInFlowConfig, SignInFlowProps } from '../types';
2
+ /**
3
+ * A generic flow component for SIWE sign-in (e.g. "Sign in with Base"). It renders the entry button
4
+ * when idle and the shared {@link SiweStatusView} once the flow starts, fading between the two via
5
+ * its own per-flow transition (the same pattern email/SMS use for their step slide, but a fade).
6
+ *
7
+ * @param {SignInFlowProps} props - The props for the sign in with SIWE flow.
8
+ * @param {SignInFlowProps["autoFocus"]} [props.autoFocus] - Whether to auto focus on transition.
9
+ * @param {SignInFlowProps["children"]} [props.children] - A function to render the children.
10
+ * @param {SignInFlowProps["onSuccess"]} [props.onSuccess] - The callback to call on success.
11
+ * @param {SignInFlowProps["step"]} props.step - The step to render the flow for.
12
+ * @returns {JSX.Element} The SignInWithSiwe component.
13
+ */
14
+ export declare const SignInWithSiwe: ({ step: stepFromProps, autoFocus, children, onSuccess, }: SignInFlowProps) => import("react/jsx-runtime").JSX.Element | null;
15
+ /**
16
+ * A component that renders the title for the sign in with SIWE flow.
17
+ *
18
+ * @returns {JSX.Element} The rendered component.
19
+ */
20
+ export declare const SignInWithSiweTitle: () => string;
21
+ /**
22
+ * A component that renders the description for the sign in with SIWE flow.
23
+ *
24
+ * @returns {JSX.Element} The rendered component.
25
+ */
26
+ export declare const SignInWithSiweDescription: () => string;
27
+ export declare const config: SignInFlowConfig;
@@ -0,0 +1,63 @@
1
+ import { jsx as n, jsxs as v } from "react/jsx-runtime";
2
+ import { useRef as p, useCallback as I } from "react";
3
+ import { SiweStatusView as M } from "../../SiweStatusView/index.js";
4
+ import { Button as x } from "../../ui/Button/index.js";
5
+ import { SwitchFadeTransition as C } from "../../ui/SwitchFadeTransition/index.js";
6
+ import { getMessageFromUnknownError as F } from "../../../utils/getMessageFromUnknownError.js";
7
+ import "@coinbase/cdp-hooks";
8
+ import "libphonenumber-js";
9
+ import { useFlowTransition as T } from "../hooks/useFlowTransition.js";
10
+ import { useStartSiwe as W } from "../hooks/useStartSiwe.js";
11
+ import { useSignInContext as f } from "../SignInProvider.js";
12
+ import { STEPS as k } from "../types.js";
13
+ import { toSiweProvider as S } from "../../SiweStatusView/toSiweProvider.js";
14
+ import { siweConnectors as h } from "../../SiweStatusView/connectors/siweConnectors.js";
15
+ const E = ({
16
+ step: r,
17
+ autoFocus: o,
18
+ children: s,
19
+ onSuccess: a
20
+ }) => {
21
+ const { state: t } = f(), i = p(S(t.authMethod)).current, m = W(i ?? "base"), c = I(() => m(a), [m, a]), u = r || t.step, d = t.authMethod === `siwe:${i}`, w = p(u).current, { transitionRef: g } = T(u, d);
22
+ return i ? /* @__PURE__ */ n(
23
+ C,
24
+ {
25
+ autoFocus: o,
26
+ animateHeight: !1,
27
+ timeout: 250,
28
+ items: k,
29
+ initialItem: w,
30
+ initialEntered: !0,
31
+ transitionRef: g,
32
+ children: ({ itemKey: l, ...b }) => {
33
+ let e;
34
+ return l === "credentials" ? e = /* @__PURE__ */ v(x, { fullWidth: !0, type: "button", onClick: c, children: [
35
+ "Sign in with ",
36
+ h[i].label
37
+ ] }) : e = /* @__PURE__ */ n(
38
+ M,
39
+ {
40
+ provider: i,
41
+ status: t.status,
42
+ onRetry: c,
43
+ errorMessage: t.error ? F(t.error) : void 0,
44
+ animateHeight: !1
45
+ }
46
+ ), /* @__PURE__ */ n("div", { ...b, children: s ? s({ step: l, Form: e }) : e });
47
+ }
48
+ }
49
+ ) : null;
50
+ }, R = () => "Sign in", j = () => {
51
+ const { state: r } = f(), o = S(r.authMethod) ?? "base";
52
+ return `Sign in with your ${h[o].label} account.`;
53
+ }, N = {
54
+ description: j,
55
+ forms: E,
56
+ title: R
57
+ };
58
+ export {
59
+ E as SignInWithSiwe,
60
+ j as SignInWithSiweDescription,
61
+ R as SignInWithSiweTitle,
62
+ N as config
63
+ };
@@ -1,9 +1,4 @@
1
1
  import { SignInFlowProps, SignInTitleAndDescriptionProps, SignInFlowConfig } from '../types';
2
- declare const STEPS: readonly ["phoneNumber", "otp"];
3
- /**
4
- * The step of the phone number OTP flow.
5
- */
6
- export type Step = (typeof STEPS)[number];
7
2
  /**
8
3
  * A component that renders the sign in with email flow.
9
4
  *
@@ -31,4 +26,3 @@ export declare const SignInWithSmsTitle: ({ step }: SignInTitleAndDescriptionPro
31
26
  */
32
27
  export declare const SignInWithSmsDescription: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
33
28
  export declare const config: SignInFlowConfig;
34
- export {};