@coinbase/cdp-react 0.0.87 → 0.0.89

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 (60) hide show
  1. package/dist/chunks/{CDPReactProvider.C38bKQ2x.js → CDPReactProvider.BkmtXUv1.js} +1 -1
  2. package/dist/chunks/{LinkAuthFlow.CLubKoY0.js → LinkAuthFlow.B4FAtf4V.js} +1 -1
  3. package/dist/chunks/{index.BN39qScu.js → index.DgrgIsTX.js} +1 -1
  4. package/dist/chunks/useSendComponentCallOnce.DGjALrnZ.js +278 -0
  5. package/dist/components/AuthButton/index.js +1 -1
  6. package/dist/components/CDPReactProvider/index.js +1 -1
  7. package/dist/components/CopyEvmKeyButton/index.js +1 -1
  8. package/dist/components/CopySolanaKeyButton/index.js +1 -1
  9. package/dist/components/EnrollMfa/index.js +2 -2
  10. package/dist/components/EnrollMfaModal/index.js +2 -2
  11. package/dist/components/ExportWallet/index.js +6 -5
  12. package/dist/components/ExportWalletModal/index.js +2 -2
  13. package/dist/components/Fund/index.js +2 -2
  14. package/dist/components/FundModal/index.js +2 -2
  15. package/dist/components/LinkAuth/LinkAuthFlow.js +2 -2
  16. package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +2 -2
  17. package/dist/components/LinkAuth/LinkAuthFlowProvider.js +2 -2
  18. package/dist/components/LinkAuth/LinkAuthItem.js +1 -1
  19. package/dist/components/LinkAuth/LinkAuthItems.js +30 -28
  20. package/dist/components/LinkAuth/LinkAuthProvider.js +28 -23
  21. package/dist/components/LinkAuth/index.js +57 -57
  22. package/dist/components/LinkAuth/types.js +1 -1
  23. package/dist/components/LinkAuth/utils.js +1 -1
  24. package/dist/components/LinkAuthModal/index.js +3 -3
  25. package/dist/components/OAuthStatusModal/index.d.ts +1 -0
  26. package/dist/components/OAuthStatusModal/index.js +74 -70
  27. package/dist/components/SendEvmTransactionButton/index.js +1 -1
  28. package/dist/components/SendSolanaTransactionButton/index.js +1 -1
  29. package/dist/components/SignIn/SignInAuthMethodButtons.js +30 -25
  30. package/dist/components/SignIn/SignInBackButton.js +1 -1
  31. package/dist/components/SignIn/SignInDescription.js +2 -2
  32. package/dist/components/SignIn/SignInForm.js +2 -2
  33. package/dist/components/SignIn/SignInImage.js +1 -1
  34. package/dist/components/SignIn/SignInProvider.js +1 -1
  35. package/dist/components/SignIn/SignInTitle.js +2 -2
  36. package/dist/components/SignIn/flows/SignInWithEmail.js +1 -1
  37. package/dist/components/SignIn/flows/SignInWithOAuth.js +1 -1
  38. package/dist/components/SignIn/flows/SignInWithSms.js +1 -1
  39. package/dist/components/SignIn/hooks/useSignInWithOAuth.js +16 -13
  40. package/dist/components/SignIn/index.js +2 -2
  41. package/dist/components/SignIn/types.js +1 -1
  42. package/dist/components/SignIn/useSignInReducer.js +1 -1
  43. package/dist/components/SignInModal/index.js +2 -2
  44. package/dist/components/SignOutButton/index.js +1 -1
  45. package/dist/components/VerifyMfa/index.js +2 -2
  46. package/dist/components/VerifyMfaInline/index.js +2 -2
  47. package/dist/components/VerifyMfaModal/index.js +2 -2
  48. package/dist/components/forms/PhoneNumberForm/index.d.ts +1 -1
  49. package/dist/components/forms/PhoneNumberInput/index.d.ts +1 -1
  50. package/dist/components/ui/Badge/index.d.ts +1 -2
  51. package/dist/components/ui/Banner/index.d.ts +1 -2
  52. package/dist/hooks/useVerifyMfaModal.js +2 -2
  53. package/dist/icons/IconTelegramLogo.d.ts +2 -0
  54. package/dist/icons/IconTelegramLogo.js +13 -0
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.js +107 -105
  57. package/dist/version.d.ts +1 -1
  58. package/dist/version.js +1 -1
  59. package/package.json +5 -5
  60. package/dist/chunks/useSendComponentCallOnce.BHZMuo6E.js +0 -273
@@ -1,14 +1,14 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import { useCurrentUser as c } from "@coinbase/cdp-hooks";
3
- import { createContext as p, useContext as M, useMemo as r, useReducer as A, useEffect as f } from "react";
4
- import { u as L } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
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.BkmtXUv1.js";
5
5
  import { formatPhoneNumber as k } from "../../utils/formatPhoneNumber.js";
6
- const T = {
6
+ const g = {
7
7
  methodToLink: null,
8
8
  authMethods: [],
9
9
  error: null,
10
10
  isPending: !1
11
- }, d = p(void 0), E = (e, t) => {
11
+ }, d = M(void 0), T = (e, t) => {
12
12
  switch (t) {
13
13
  case "email":
14
14
  return {
@@ -35,11 +35,16 @@ const T = {
35
35
  userAlias: (e.authenticationMethods.x?.username ? `@${e.authenticationMethods.x.username}` : e.authenticationMethods.x?.email) ?? "",
36
36
  isLinked: !!e.authenticationMethods.x
37
37
  };
38
+ case "oauth:telegram":
39
+ return {
40
+ userAlias: e.authenticationMethods.telegram?.username ? `@${e.authenticationMethods.telegram.username}` : "",
41
+ isLinked: !!e.authenticationMethods.telegram
42
+ };
38
43
  default:
39
44
  return null;
40
45
  }
41
46
  };
42
- function g(e, t) {
47
+ function E(e, t) {
43
48
  switch (t.type) {
44
49
  case "LINK_AUTH_METHOD":
45
50
  return {
@@ -71,33 +76,33 @@ function g(e, t) {
71
76
  }
72
77
  }
73
78
  const y = ({ children: e }) => {
74
- const { currentUser: t } = c(), { authMethods: a } = L(), s = r(() => {
75
- const n = [];
76
- return a.forEach((i) => {
79
+ const { currentUser: t } = c(), { authMethods: n } = L(), a = r(() => {
80
+ const i = [];
81
+ return n.forEach((s) => {
77
82
  if (!t) {
78
- n.push({
83
+ i.push({
79
84
  userAlias: "",
80
85
  isLinked: !1,
81
- method: i
86
+ method: s
82
87
  });
83
88
  return;
84
89
  }
85
- const h = E(t, i);
86
- n.push({
87
- userAlias: h?.userAlias ?? "",
88
- isLinked: h?.isLinked ?? !1,
89
- method: i
90
+ const u = T(t, s);
91
+ i.push({
92
+ userAlias: u?.userAlias ?? "",
93
+ isLinked: u?.isLinked ?? !1,
94
+ method: s
90
95
  });
91
- }), n;
92
- }, [t, a]), [u, o] = A(g, {
93
- ...T,
94
- authMethods: s
95
- }), l = r(() => ({ state: u, dispatch: o }), [u, o]);
96
+ }), i;
97
+ }, [t, n]), [h, o] = A(E, {
98
+ ...g,
99
+ authMethods: a
100
+ }), l = r(() => ({ state: h, dispatch: o }), [h, o]);
96
101
  return f(() => {
97
- o({ type: "SET_AUTH_METHODS", payload: { methods: s } });
98
- }, [o, s]), /* @__PURE__ */ m(d.Provider, { value: l, children: e });
102
+ o({ type: "SET_AUTH_METHODS", payload: { methods: a } });
103
+ }, [o, a]), /* @__PURE__ */ m(d.Provider, { value: l, children: e });
99
104
  }, C = () => {
100
- const e = M(d);
105
+ const e = p(d);
101
106
  if (!e)
102
107
  throw new Error("useLinkAuthContext must be used within a LinkAuthProvider");
103
108
  return e;
@@ -1,33 +1,33 @@
1
- import { jsx as r, jsxs as h, Fragment as C } from "react/jsx-runtime";
2
- import { useLinkOAuth as I } from "@coinbase/cdp-hooks";
3
- import { u as N } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
4
- import { useRef as d, useState as P, useCallback as a } from "react";
5
- import "../../chunks/CDPReactProvider.C38bKQ2x.js";
6
- import { useOauthStatusModal as U } from "../OAuthStatusModal/index.js";
7
- import { Banner as D } from "../ui/Banner/index.js";
8
- import { useTimeout as H } from "../../hooks/useTimeout.js";
9
- import { getMessageFromUnknownError as M } from "../../utils/getMessageFromUnknownError.js";
1
+ import { jsx as r, jsxs as h, Fragment as I } from "react/jsx-runtime";
2
+ import { useLinkOAuth as N } from "@coinbase/cdp-hooks";
3
+ import { u as P } from "../../chunks/useSendComponentCallOnce.DGjALrnZ.js";
4
+ import { useRef as d, useState as U, useCallback as a } from "react";
5
+ import "../../chunks/CDPReactProvider.BkmtXUv1.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";
10
10
  import "libphonenumber-js";
11
- import { toOAuthProviderType as v } from "../../utils/toOAuthProviderType.js";
12
- import { L as V, a as j } from "../../chunks/LinkAuthFlow.CLubKoY0.js";
13
- import { u as kt } from "../../chunks/LinkAuthFlow.CLubKoY0.js";
14
- import { LinkAuthFlowBackButton as K } from "./LinkAuthFlowBackButton.js";
15
- import { LinkAuthItem as pt } from "./LinkAuthItem.js";
16
- import { LinkAuthItems as At } from "./LinkAuthItems.js";
17
- import { useLinkAuthContext as O, LinkAuthProvider as W } from "./LinkAuthProvider.js";
18
- import { LinkAuthTitle as $ } from "./LinkAuthTitle.js";
19
- import { methodToView as y } from "./utils.js";
20
- import '../../assets/LinkAuth.css';const b = "LinkAuth-module__header___0UuxP", G = "LinkAuth-module__error___XUo4W", k = {
11
+ import { toOAuthProviderType as V } from "../../utils/toOAuthProviderType.js";
12
+ import { L as j, a as K } from "../../chunks/LinkAuthFlow.B4FAtf4V.js";
13
+ import { u as ft } from "../../chunks/LinkAuthFlow.B4FAtf4V.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 { useLinkAuthContext as x, LinkAuthProvider as $ } from "./LinkAuthProvider.js";
18
+ import { LinkAuthTitle as b } from "./LinkAuthTitle.js";
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 = {
21
21
  "link-auth": "LinkAuth-module__link-auth___kPJao",
22
- header: b,
23
- error: G
24
- }, J = ({ role: o = "alert", ...c }) => {
25
- const { state: i } = O(), { error: s } = i;
26
- return s ? /* @__PURE__ */ r(D, { variant: "error", role: o, ...c, children: s }) : null;
27
- }, X = ({ children: o, className: c = "", onLinkSuccess: i, ...s }) => {
28
- const { linkOAuth: f } = I(), { persistOAuthState: p } = U(), { state: u, dispatch: n } = O(), { methodToLink: x } = u, L = d(null), l = d(null), { schedule: A } = H(), E = y(x), _ = d(E), [B, m] = P("left"), e = a(
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(
29
29
  (t) => {
30
- _.current !== t && (_.current = t, L.current?.transition.toggle(t), t === "list" && n({ type: "RESET_STATE" }), (t === "email" || t === "sms") && n({ type: "LINK_AUTH_METHOD", payload: { method: 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 } }));
31
31
  },
32
32
  [n]
33
33
  ), F = a(() => {
@@ -37,56 +37,56 @@ import '../../assets/LinkAuth.css';const b = "LinkAuth-module__header___0UuxP",
37
37
  }
38
38
  e("list");
39
39
  }, [e]), R = a(() => {
40
- m("left"), i?.(u.methodToLink), A(() => e("list"), 800);
41
- }, [e, u.methodToLink, i, A]), S = a(
40
+ m("left"), i?.(u.methodToLink), _(() => e("list"), 800);
41
+ }, [e, u.methodToLink, i, _]), w = a(
42
42
  async (t) => {
43
43
  if (m("left"), t?.startsWith("oauth:")) {
44
- const g = v(t);
45
- if (g)
44
+ const y = V(t);
45
+ if (y)
46
46
  try {
47
- await f(g), p(!0);
48
- } catch (w) {
49
- n({
47
+ p(!0), await f(y);
48
+ } catch (C) {
49
+ L(), n({
50
50
  type: "LINK_AUTH_METHOD_ERROR",
51
- payload: { error: M(w) }
51
+ payload: { error: v(C) }
52
52
  });
53
53
  }
54
54
  } else
55
- e(y(t));
55
+ e(O(t));
56
56
  },
57
- [f, e, p, n]
58
- ), T = typeof o == "function" ? o(u) : o;
57
+ [f, e, p, L, n]
58
+ ), g = typeof o == "function" ? o(u) : o;
59
59
  return /* @__PURE__ */ r("div", { className: `${k["link-auth"]} ${c}`, ...s, children: /* @__PURE__ */ h(
60
- V,
60
+ j,
61
61
  {
62
62
  direction: B,
63
63
  onBack: F,
64
- onLink: S,
64
+ onLink: w,
65
65
  onLinkSuccess: R,
66
66
  signInRef: l,
67
- transitionRef: L,
67
+ transitionRef: A,
68
68
  children: [
69
- T,
70
- !T && /* @__PURE__ */ h(C, { children: [
69
+ g,
70
+ !g && /* @__PURE__ */ h(I, { children: [
71
71
  /* @__PURE__ */ h("div", { className: k.header, children: [
72
- /* @__PURE__ */ r($, {}),
73
- /* @__PURE__ */ r(K, {})
72
+ /* @__PURE__ */ r(b, {}),
73
+ /* @__PURE__ */ r(W, {})
74
74
  ] }),
75
- /* @__PURE__ */ r("div", { className: k.error, children: /* @__PURE__ */ r(J, {}) }),
76
- /* @__PURE__ */ r(j, {})
75
+ /* @__PURE__ */ r("div", { className: k.error, children: /* @__PURE__ */ r(X, {}) }),
76
+ /* @__PURE__ */ r(K, {})
77
77
  ] })
78
78
  ]
79
79
  }
80
80
  ) });
81
- }, mt = (o) => (N("manage_auth"), /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(X, { ...o }) }));
81
+ }, ht = (o) => (P("manage_auth"), /* @__PURE__ */ r($, { children: /* @__PURE__ */ r(q, { ...o }) }));
82
82
  export {
83
- mt as LinkAuth,
84
- J as LinkAuthError,
85
- j as LinkAuthFlow,
86
- K as LinkAuthFlowBackButton,
87
- pt as LinkAuthItem,
88
- At as LinkAuthItems,
89
- $ as LinkAuthTitle,
90
- O as useLinkAuthContext,
91
- kt as useLinkAuthFlow
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,
90
+ x as useLinkAuthContext,
91
+ ft as useLinkAuthFlow
92
92
  };
@@ -1,4 +1,4 @@
1
- import "../../chunks/CDPReactProvider.C38bKQ2x.js";
1
+ import "../../chunks/CDPReactProvider.BkmtXUv1.js";
2
2
  const t = ["list", "email", "sms"];
3
3
  export {
4
4
  t as LINK_AUTH_FLOW_VIEWS
@@ -1,4 +1,4 @@
1
- import "../../chunks/CDPReactProvider.C38bKQ2x.js";
1
+ import "../../chunks/CDPReactProvider.BkmtXUv1.js";
2
2
  import { LINK_AUTH_FLOW_VIEWS as i } from "./types.js";
3
3
  const t = (r) => i.includes(r), o = (r) => r && t(r) ? r : "list";
4
4
  export {
@@ -1,8 +1,8 @@
1
1
  import { jsx as o, jsxs as n, Fragment as d } from "react/jsx-runtime";
2
- import { u as p } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
2
+ import { u as p } from "../../chunks/useSendComponentCallOnce.DGjALrnZ.js";
3
3
  import { createContext as f, useMemo as L, useContext as g } from "react";
4
4
  import { c as A } from "../../chunks/lite.1fxw3LjI.js";
5
- import "../../chunks/CDPReactProvider.C38bKQ2x.js";
5
+ import "../../chunks/CDPReactProvider.BkmtXUv1.js";
6
6
  import { LinkAuth as C, LinkAuthError as x } from "../LinkAuth/index.js";
7
7
  import { Button as m } from "../ui/Button/index.js";
8
8
  import { Modal as b, ModalContent as v, ModalTitle as w, ModalClose as N, ModalTrigger as T } from "../ui/Modal/index.js";
@@ -11,7 +11,7 @@ import { IconXMark as F } from "../../icons/IconXMark.js";
11
11
  import { childrenHasComponent as c } from "../../utils/childrenHasComponent.js";
12
12
  import { LinkAuthTitle as H } from "../LinkAuth/LinkAuthTitle.js";
13
13
  import { LinkAuthFlowBackButton as j } from "../LinkAuth/LinkAuthFlowBackButton.js";
14
- import { a as B } from "../../chunks/LinkAuthFlow.CLubKoY0.js";
14
+ import { a as B } from "../../chunks/LinkAuthFlow.B4FAtf4V.js";
15
15
  import '../../assets/LinkAuthModal.css';const S = "LinkAuthModal-module__header___qoco6", D = "LinkAuthModal-module__error___Srl7H", E = "LinkAuthModal-module__trigger___aHDfG", r = {
16
16
  header: S,
17
17
  error: D,
@@ -6,6 +6,7 @@ type OAuthStatusModalContentProps = {
6
6
  };
7
7
  export declare const useOauthStatusModal: () => {
8
8
  persistOAuthState: (isAccountLink?: boolean) => void;
9
+ cleanupOAuthState: () => void;
9
10
  };
10
11
  export declare const OAuthStatusModal: () => import("react/jsx-runtime").JSX.Element;
11
12
  export declare const OAuthStatusModalContent: ({ isAccountLink, handleClose, }: OAuthStatusModalContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,98 +1,101 @@
1
- import { jsx as s, jsxs as r, Fragment as S } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as r, Fragment as f } from "react/jsx-runtime";
2
2
  import "@coinbase/cdp-core";
3
- import { useOAuthState as I } from "@coinbase/cdp-hooks";
4
- import { u as b } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
5
- import { useCallback as N, useState as O, useEffect as h, useRef as A } from "react";
6
- import { a as $ } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
3
+ import { useOAuthState as N } from "@coinbase/cdp-hooks";
4
+ import { u as b } from "../../chunks/useSendComponentCallOnce.DGjALrnZ.js";
5
+ import { useCallback as g, useState as A, useEffect as S, useRef as I } from "react";
6
+ import { a as v } from "../../chunks/CDPReactProvider.BkmtXUv1.js";
7
7
  import { CoinbaseFooter as k } from "../ui/CoinbaseFooter/index.js";
8
8
  import { LoadingSpinner as w } from "../ui/LoadingSpinner/index.js";
9
- import { Modal as E, ModalContent as L, ModalTitle as y, ModalDescription as R } from "../ui/Modal/index.js";
9
+ import { Modal as L, ModalContent as E, ModalTitle as y, ModalDescription as R } from "../ui/Modal/index.js";
10
10
  import { SwitchFadeTransition as P } from "../ui/SwitchFadeTransition/index.js";
11
11
  import { VisuallyHidden as M } from "../ui/VisuallyHidden/index.js";
12
12
  import { useTimer as U } from "../../hooks/useTimer.js";
13
13
  import { IconAppleLogo as K } from "../../icons/IconAppleLogo.js";
14
14
  import { IconCheck as x } from "../../icons/IconCheck.js";
15
15
  import { IconGoogleColorLogo as G } from "../../icons/IconGoogleColorLogo.js";
16
- import { IconXLogo as H } from "../../icons/IconXLogo.js";
17
- import { IconXMark as q } from "../../icons/IconXMark.js";
16
+ import { IconTelegramLogo as H } from "../../icons/IconTelegramLogo.js";
17
+ import { IconXLogo as q } from "../../icons/IconXLogo.js";
18
+ import { IconXMark as Y } from "../../icons/IconXMark.js";
18
19
  import { capitalize as _ } from "../../utils/capitalize.js";
19
- import '../../assets/OAuthStatusModal.css';const Y = "OAuthStatusModal-module__status___vU6x7", j = "OAuthStatusModal-module__graphic___2fKoa", D = "OAuthStatusModal-module__pad___oooMz", F = "OAuthStatusModal-module__spinner___Q3dYq", z = "OAuthStatusModal-module__icon___Lj5Gf", V = "OAuthStatusModal-module__subhead___Pg9GI", W = "OAuthStatusModal-module__description___0qOZY", X = "OAuthStatusModal-module__ring___mKwSb", J = "OAuthStatusModal-module__invisible___IeRd0", t = {
20
+ import '../../assets/OAuthStatusModal.css';const j = "OAuthStatusModal-module__status___vU6x7", D = "OAuthStatusModal-module__graphic___2fKoa", F = "OAuthStatusModal-module__pad___oooMz", z = "OAuthStatusModal-module__spinner___Q3dYq", V = "OAuthStatusModal-module__icon___Lj5Gf", W = "OAuthStatusModal-module__subhead___Pg9GI", X = "OAuthStatusModal-module__description___0qOZY", J = "OAuthStatusModal-module__ring___mKwSb", Q = "OAuthStatusModal-module__invisible___IeRd0", t = {
20
21
  "oauth-status-modal": "OAuthStatusModal-module__oauth-status-modal___I69Ii",
21
22
  "transition-wrapper": "OAuthStatusModal-module__transition-wrapper___TmPRh",
22
- status: Y,
23
- graphic: j,
24
- pad: D,
25
- spinner: F,
26
- icon: z,
23
+ status: j,
24
+ graphic: D,
25
+ pad: F,
26
+ spinner: z,
27
+ icon: V,
27
28
  "icon-success": "OAuthStatusModal-module__icon-success___gqMWr",
28
29
  "icon-error": "OAuthStatusModal-module__icon-error___psI7m",
29
- subhead: V,
30
- description: W,
31
- ring: X,
30
+ subhead: W,
31
+ description: X,
32
+ ring: J,
32
33
  "ring-success": "OAuthStatusModal-module__ring-success___unyM9",
33
34
  "ring-error": "OAuthStatusModal-module__ring-error___OsgqU",
34
- invisible: J
35
- }, p = "cdp-react-sign-in-with-oauth-provider-name", g = "cdp-react-sign-in-with-oauth-is-account-link", Q = ["pending", "success", "error"], It = () => {
36
- const n = $() || "";
37
- return { persistOAuthState: N(
38
- (e) => {
35
+ invisible: Q
36
+ }, p = "cdp-react-sign-in-with-oauth-provider-name", h = "cdp-react-sign-in-with-oauth-is-account-link", Z = ["pending", "success", "error"], vt = () => {
37
+ const n = v() || "", o = g(
38
+ (a) => {
39
39
  sessionStorage.setItem(p, n), sessionStorage.setItem(
40
- g,
41
- e ? "true" : "false"
40
+ h,
41
+ a ? "true" : "false"
42
42
  );
43
43
  },
44
44
  [n]
45
- ) };
46
- }, Nt = () => {
45
+ ), e = g(() => {
46
+ sessionStorage.removeItem(p), sessionStorage.removeItem(h);
47
+ }, []);
48
+ return { persistOAuthState: o, cleanupOAuthState: e };
49
+ }, $t = () => {
47
50
  b("oauth_status_modal");
48
- const [n, o] = O(!1), { oauthState: e } = I(), [d, a] = O(!1), c = $(), u = e?.providerType || "google";
49
- return h(() => {
51
+ const [n, o] = A(!1), { oauthState: e } = N(), [a, i] = A(!1), u = v(), l = e?.providerType || "google";
52
+ return S(() => {
50
53
  if (e?.status === "pending" || e?.status === "error" || e?.status === "success") {
51
- const l = sessionStorage.getItem(p);
52
- if (l === null || l !== c)
54
+ const d = sessionStorage.getItem(p);
55
+ if (d === null || d !== u)
53
56
  return;
54
57
  sessionStorage.removeItem(p), o(!0);
55
- const m = sessionStorage.getItem(g) === "true";
56
- sessionStorage.removeItem(g), a(m);
58
+ const m = sessionStorage.getItem(h) === "true";
59
+ sessionStorage.removeItem(h), i(m);
57
60
  }
58
- }, [e?.status, c]), /* @__PURE__ */ s(E, { open: n, onOpenChange: o, children: /* @__PURE__ */ r(L, { children: [
61
+ }, [e?.status, u]), /* @__PURE__ */ s(L, { open: n, onOpenChange: o, children: /* @__PURE__ */ r(E, { children: [
59
62
  /* @__PURE__ */ s(M, { children: /* @__PURE__ */ s(y, { children: "OAuth Status" }) }),
60
63
  /* @__PURE__ */ s(M, { children: /* @__PURE__ */ r(R, { children: [
61
- d ? `Linking your ${u} account` : `Signing in with ${u}`,
64
+ a ? `Linking your ${l} account` : `Signing in with ${l}`,
62
65
  " ",
63
66
  e?.status ? `${e?.status === "success" ? "successful" : e?.status === "error" ? "failed" : "pending"}` : ""
64
67
  ] }) }),
65
- /* @__PURE__ */ s(Z, { isAccountLink: d, handleClose: () => o(!1) })
68
+ /* @__PURE__ */ s(B, { isAccountLink: a, handleClose: () => o(!1) })
66
69
  ] }) });
67
- }, Z = ({
70
+ }, B = ({
68
71
  isAccountLink: n,
69
72
  handleClose: o
70
73
  }) => {
71
- const { oauthState: e } = I(), d = e?.providerType || "google", { timeRemaining: a, start: c, reset: u } = U(), l = A(null), m = A(null), v = 250, f = N((i) => {
72
- m.current === i || i === void 0 || (m.current = i, l.current?.transition.toggle(i));
74
+ const { oauthState: e } = N(), a = e?.providerType || "google", { timeRemaining: i, start: u, reset: l } = U(), d = I(null), m = I(null), $ = 250, O = g((c) => {
75
+ m.current === c || c === void 0 || (m.current = c, d.current?.transition.toggle(c));
73
76
  }, []);
74
- return h(() => {
75
- f(e?.status), e?.status === "success" && c(3);
76
- }, [e?.status, f, c]), h(() => {
77
- a !== null && a <= 0 && (u(), o());
78
- }, [a, u, o]), /* @__PURE__ */ r("div", { className: t["oauth-status-modal"], children: [
77
+ return S(() => {
78
+ O(e?.status), e?.status === "success" && u(3);
79
+ }, [e?.status, O, u]), S(() => {
80
+ i !== null && i <= 0 && (l(), o());
81
+ }, [i, l, o]), /* @__PURE__ */ r("div", { className: t["oauth-status-modal"], children: [
79
82
  /* @__PURE__ */ s(
80
83
  P,
81
84
  {
82
85
  animateHeight: !1,
83
- timeout: v,
84
- items: Q,
86
+ timeout: $,
87
+ items: Z,
85
88
  initialEntered: !1,
86
- transitionRef: l,
89
+ transitionRef: d,
87
90
  className: t["transition-wrapper"],
88
- children: ({ itemKey: i, ...C }) => {
89
- const T = et[i];
90
- return /* @__PURE__ */ s("div", { ...C, className: t.status, children: /* @__PURE__ */ s(
91
- T,
91
+ children: ({ itemKey: c, ...T }) => {
92
+ const C = ot[c];
93
+ return /* @__PURE__ */ s("div", { ...T, className: t.status, children: /* @__PURE__ */ s(
94
+ C,
92
95
  {
93
96
  isAccountLink: n,
94
- timeRemaining: a,
95
- provider: d
97
+ timeRemaining: i,
98
+ provider: a
96
99
  }
97
100
  ) });
98
101
  }
@@ -100,9 +103,9 @@ import '../../assets/OAuthStatusModal.css';const Y = "OAuthStatusModal-module__s
100
103
  ),
101
104
  /* @__PURE__ */ s(k, {})
102
105
  ] });
103
- }, B = ({ isAccountLink: n, provider: o }) => {
104
- const e = ot[o];
105
- return /* @__PURE__ */ r(S, { children: [
106
+ }, tt = ({ isAccountLink: n, provider: o }) => {
107
+ const e = nt[o];
108
+ return /* @__PURE__ */ r(f, { children: [
106
109
  /* @__PURE__ */ r("div", { className: t.graphic, children: [
107
110
  /* @__PURE__ */ s(
108
111
  w,
@@ -118,11 +121,11 @@ import '../../assets/OAuthStatusModal.css';const Y = "OAuthStatusModal-module__s
118
121
  /* @__PURE__ */ s("p", { className: t.subhead, children: n ? `Linking your ${_(o)} account` : `Signing in with ${_(o)}` }),
119
122
  /* @__PURE__ */ s("p", { className: t.description, children: "Just a moment..." })
120
123
  ] });
121
- }, tt = ({
124
+ }, st = ({
122
125
  isAccountLink: n,
123
126
  timeRemaining: o,
124
127
  provider: e
125
- }) => /* @__PURE__ */ r(S, { children: [
128
+ }) => /* @__PURE__ */ r(f, { children: [
126
129
  /* @__PURE__ */ r("div", { className: t.graphic, children: [
127
130
  /* @__PURE__ */ s("span", { className: `${t.ring} ${t["ring-success"]}` }),
128
131
  /* @__PURE__ */ s("span", { className: `${t.icon} ${t["icon-success"]}`, children: /* @__PURE__ */ s(x, {}) })
@@ -132,27 +135,28 @@ import '../../assets/OAuthStatusModal.css';const Y = "OAuthStatusModal-module__s
132
135
  "This window will automatically close in ",
133
136
  o ?? "soon"
134
137
  ] })
135
- ] }), st = ({ isAccountLink: n }) => /* @__PURE__ */ r(S, { children: [
138
+ ] }), et = ({ isAccountLink: n }) => /* @__PURE__ */ r(f, { children: [
136
139
  /* @__PURE__ */ r("div", { className: `${t.graphic} ${t.pad}`, children: [
137
140
  /* @__PURE__ */ s("span", { className: `${t.ring} ${t["ring-error"]}` }),
138
- /* @__PURE__ */ s("span", { className: `${t.icon} ${t["icon-error"]}`, children: /* @__PURE__ */ s(q, {}) })
141
+ /* @__PURE__ */ s("span", { className: `${t.icon} ${t["icon-error"]}`, children: /* @__PURE__ */ s(Y, {}) })
139
142
  ] }),
140
143
  /* @__PURE__ */ s("p", { className: t.subhead, children: n ? "Account linking failed" : "Sign in failed" }),
141
144
  /* @__PURE__ */ s("p", { className: t.description, children: "Something went wrong. Please try again." })
142
- ] }), et = {
143
- pending: B,
144
- success: tt,
145
- error: st
146
- }, ot = {
145
+ ] }), ot = {
146
+ pending: tt,
147
+ success: st,
148
+ error: et
149
+ }, nt = {
147
150
  google: G,
148
151
  apple: K,
149
- x: H
152
+ x: q,
153
+ telegram: H
150
154
  };
151
155
  export {
152
- g as OAUTH_IS_ACCOUNT_LINK_SESSION_STORAGE_KEY,
156
+ h as OAUTH_IS_ACCOUNT_LINK_SESSION_STORAGE_KEY,
153
157
  p as OAUTH_PROVIDER_SESSION_STORAGE_KEY,
154
- Nt as OAuthStatusModal,
155
- Z as OAuthStatusModalContent,
156
- Nt as default,
157
- It as useOauthStatusModal
158
+ $t as OAuthStatusModal,
159
+ B as OAuthStatusModalContent,
160
+ $t as default,
161
+ vt as useOauthStatusModal
158
162
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  import { useSendEvmTransaction as _, APIError as S } from "@coinbase/cdp-hooks";
3
- import { u as b } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
3
+ import { u as b } from "../../chunks/useSendComponentCallOnce.DGjALrnZ.js";
4
4
  import { useState as T, useCallback as y } from "react";
5
5
  import { c as C } from "../../chunks/lite.1fxw3LjI.js";
6
6
  import { Button as w } from "../ui/Button/index.js";
@@ -1,6 +1,6 @@
1
1
  import { jsx as _ } from "react/jsx-runtime";
2
2
  import { useSendSolanaTransaction as b, APIError as T } from "@coinbase/cdp-hooks";
3
- import { u as w } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
3
+ import { u as w } from "../../chunks/useSendComponentCallOnce.DGjALrnZ.js";
4
4
  import { useState as x, useCallback as y } from "react";
5
5
  import { c as B } from "../../chunks/lite.1fxw3LjI.js";
6
6
  import { Button as C } from "../ui/Button/index.js";
@@ -1,23 +1,24 @@
1
1
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
2
2
  import { useCallback as v, useMemo as y } from "react";
3
- import "../../chunks/CDPReactProvider.C38bKQ2x.js";
4
- import { useSignInWithOAuth as S } from "./hooks/useSignInWithOAuth.js";
5
- import { useSignInContext as _ } from "./SignInProvider.js";
6
- import { Button as C } from "../ui/Button/index.js";
3
+ import "../../chunks/CDPReactProvider.BkmtXUv1.js";
4
+ import { useSignInWithOAuth as C } from "./hooks/useSignInWithOAuth.js";
5
+ import { useSignInContext as g } from "./SignInProvider.js";
6
+ import { Button as S } from "../ui/Button/index.js";
7
7
  import { ServerError as M } from "../ui/ServerError/index.js";
8
8
  import { IconAppleLogo as k } from "../../icons/IconAppleLogo.js";
9
9
  import { IconEnvelope as B } from "../../icons/IconEnvelope.js";
10
10
  import { IconGoogleLogo as E } from "../../icons/IconGoogleLogo.js";
11
11
  import { IconPhone as P } from "../../icons/IconPhone.js";
12
- import { IconXLogo as O } from "../../icons/IconXLogo.js";
12
+ import { IconTelegramLogo as O } from "../../icons/IconTelegramLogo.js";
13
+ import { IconXLogo as w } from "../../icons/IconXLogo.js";
13
14
  import { toOAuthProviderType as b } from "../../utils/toOAuthProviderType.js";
14
- import '../../assets/SignInAuthMethodButtons.css';const w = "SignInAuthMethodButtons-module__divider___zphEh", o = {
15
+ import '../../assets/SignInAuthMethodButtons.css';const T = "SignInAuthMethodButtons-module__divider___zphEh", o = {
15
16
  "auth-method-buttons": "SignInAuthMethodButtons-module__auth-method-buttons___jYEH7",
16
17
  "auth-btn": "SignInAuthMethodButtons-module__auth-btn___o1a09",
17
18
  "auth-btn-icon": "SignInAuthMethodButtons-module__auth-btn-icon___VjvFY",
18
19
  "auth-btn-label": "SignInAuthMethodButtons-module__auth-btn-label___mEWd3",
19
- divider: w
20
- }, g = {
20
+ divider: T
21
+ }, _ = {
21
22
  email: {
22
23
  label: "Continue with email",
23
24
  icon: /* @__PURE__ */ n(B, {})
@@ -36,41 +37,45 @@ import '../../assets/SignInAuthMethodButtons.css';const w = "SignInAuthMethodBut
36
37
  },
37
38
  "oauth:x": {
38
39
  label: "Continue with X",
40
+ icon: /* @__PURE__ */ n(w, {})
41
+ },
42
+ "oauth:telegram": {
43
+ label: "Continue with Telegram",
39
44
  icon: /* @__PURE__ */ n(O, {})
40
45
  }
41
- }, U = ({ activeMethod: u }) => {
46
+ }, q = ({ activeMethod: a }) => {
42
47
  const {
43
- state: { authMethods: a }
44
- } = _(), {
45
- signInWithOAuth: l,
48
+ state: { authMethods: l }
49
+ } = g(), {
50
+ signInWithOAuth: u,
46
51
  isPending: s,
47
52
  error: h,
48
53
  oauthProvider: c
49
- } = S(), m = v(
54
+ } = C(), m = v(
50
55
  async (t) => {
51
- const e = b(t);
52
- e && l(e);
56
+ const i = b(t);
57
+ i && u(i);
53
58
  },
54
- [l]
55
- ), { dispatch: d } = _(), i = y(() => (a || ["email"]).map((t) => {
56
- if (!g[t])
59
+ [u]
60
+ ), { dispatch: p } = g(), e = y(() => (l || ["email"]).map((t) => {
61
+ if (!_[t])
57
62
  return null;
58
- const { label: e, icon: f } = g[t], p = t.startsWith("oauth:"), A = p ? () => m(t) : () => d({ type: "SET_AUTH_METHOD", payload: { authMethod: t } }), I = p && c.current === b(t) && s;
63
+ const { label: i, icon: f } = _[t], d = t.startsWith("oauth:"), A = d ? () => m(t) : () => p({ type: "SET_AUTH_METHOD", payload: { authMethod: t } }), I = d && c.current === b(t) && s;
59
64
  return {
60
65
  key: t,
61
- label: e,
66
+ label: i,
62
67
  icon: f,
63
68
  onClick: A,
64
69
  isPending: I
65
70
  };
66
- }).filter((t) => t !== null), [a, d, m, s, c]);
67
- return !i.length || i.length === 1 && i[0].key === u ? null : /* @__PURE__ */ r("div", { className: o["auth-method-buttons"], children: [
71
+ }).filter((t) => t !== null), [l, p, m, s, c]);
72
+ return !e.length || e.length === 1 && e[0].key === a ? null : /* @__PURE__ */ r("div", { className: o["auth-method-buttons"], children: [
68
73
  /* @__PURE__ */ r("div", { className: o.divider, children: [
69
74
  /* @__PURE__ */ n("hr", {}),
70
75
  /* @__PURE__ */ n("span", { children: "or" })
71
76
  ] }),
72
- i.map((t) => t.key === u ? null : /* @__PURE__ */ r(
73
- C,
77
+ e.map((t) => t.key === a ? null : /* @__PURE__ */ r(
78
+ S,
74
79
  {
75
80
  "aria-label": t.ariaLabel,
76
81
  className: o["auth-btn"],
@@ -89,5 +94,5 @@ import '../../assets/SignInAuthMethodButtons.css';const w = "SignInAuthMethodBut
89
94
  ] });
90
95
  };
91
96
  export {
92
- U as SignInAuthMethodButtons
97
+ q as SignInAuthMethodButtons
93
98
  };