@coinbase/cdp-react 0.0.109 → 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.
- package/dist/assets/OAuthStatusModal.css +1 -1
- package/dist/assets/SignIn.css +1 -1
- package/dist/assets/SignInImage.css +1 -1
- package/dist/assets/StatusView.css +1 -0
- package/dist/assets/SwitchTransition.css +1 -1
- package/dist/chunks/{CDPReactProvider.CFWIUvzR.js → CDPReactProvider.BWInVuNJ.js} +89 -86
- package/dist/chunks/LinkAuthFlow.0FnIchwa.js +144 -0
- package/dist/chunks/index.Du1vsLh6.js +23 -0
- package/dist/components/CDPReactProvider/index.d.ts +7 -1
- package/dist/components/CDPReactProvider/index.js +11 -7
- package/dist/components/EnrollMfa/index.js +1 -1
- package/dist/components/EnrollMfaModal/index.js +1 -1
- package/dist/components/ExportWallet/index.js +6 -4
- package/dist/components/ExportWalletModal/index.js +1 -1
- package/dist/components/Fund/index.js +1 -1
- package/dist/components/FundModal/index.js +1 -1
- package/dist/components/LinkAuth/LinkAuthFlow.js +9 -5
- package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +2 -2
- package/dist/components/LinkAuth/LinkAuthFlowProvider.d.ts +22 -8
- package/dist/components/LinkAuth/LinkAuthFlowProvider.js +2 -2
- package/dist/components/LinkAuth/LinkAuthItem.js +1 -1
- package/dist/components/LinkAuth/LinkAuthItems.js +35 -28
- package/dist/components/LinkAuth/LinkAuthProvider.js +25 -18
- package/dist/components/LinkAuth/index.d.ts +2 -2
- package/dist/components/LinkAuth/index.js +63 -62
- package/dist/components/LinkAuth/types.d.ts +6 -1
- package/dist/components/LinkAuth/types.js +5 -3
- package/dist/components/LinkAuth/utils.js +3 -3
- package/dist/components/LinkAuthModal/index.d.ts +1 -1
- package/dist/components/LinkAuthModal/index.js +56 -46
- package/dist/components/OAuthStatusModal/index.js +113 -135
- package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +5 -2
- package/dist/components/SignIn/SignInAuthMethodButtons.js +83 -52
- package/dist/components/SignIn/SignInBackButton.js +1 -1
- package/dist/components/SignIn/SignInDescription.js +2 -2
- package/dist/components/SignIn/SignInForm.js +2 -2
- package/dist/components/SignIn/SignInImage.d.ts +12 -3
- package/dist/components/SignIn/SignInImage.js +36 -13
- package/dist/components/SignIn/SignInProvider.js +5 -4
- package/dist/components/SignIn/SignInTitle.js +2 -2
- package/dist/components/SignIn/flows/SignInWithEmail.d.ts +0 -4
- package/dist/components/SignIn/flows/SignInWithEmail.js +73 -74
- package/dist/components/SignIn/flows/SignInWithOAuth.js +1 -1
- package/dist/components/SignIn/flows/SignInWithSiwe.d.ts +27 -0
- package/dist/components/SignIn/flows/SignInWithSiwe.js +63 -0
- package/dist/components/SignIn/flows/SignInWithSms.d.ts +0 -6
- package/dist/components/SignIn/flows/SignInWithSms.js +85 -86
- package/dist/components/SignIn/hooks/useEmailForm.js +13 -13
- package/dist/components/SignIn/hooks/useFlowTransition.d.ts +14 -0
- package/dist/components/SignIn/hooks/useFlowTransition.js +13 -0
- package/dist/components/SignIn/hooks/useOTPForm.js +29 -29
- package/dist/components/SignIn/hooks/usePhoneNumberForm.js +10 -10
- package/dist/components/SignIn/hooks/useStartSiwe.d.ts +10 -0
- package/dist/components/SignIn/hooks/useStartSiwe.js +24 -0
- package/dist/components/SignIn/index.d.ts +2 -2
- package/dist/components/SignIn/index.js +29 -29
- package/dist/components/SignIn/types.d.ts +24 -2
- package/dist/components/SignIn/types.js +5 -1
- package/dist/components/SignIn/useSignInReducer.js +67 -46
- package/dist/components/SignInModal/index.d.ts +1 -1
- package/dist/components/SignInModal/index.js +77 -67
- package/dist/components/SiweStatusView/connectors/baseAccount.d.ts +22 -0
- package/dist/components/SiweStatusView/connectors/baseAccount.js +49 -0
- package/dist/components/SiweStatusView/connectors/siweConnectors.d.ts +6 -0
- package/dist/components/SiweStatusView/connectors/siweConnectors.js +9 -0
- package/dist/components/SiweStatusView/connectors/types.d.ts +45 -0
- package/dist/components/SiweStatusView/connectors/types.js +2 -0
- package/dist/components/SiweStatusView/getSiweErrorMessage.d.ts +13 -0
- package/dist/components/SiweStatusView/getSiweErrorMessage.js +15 -0
- package/dist/components/SiweStatusView/index.d.ts +36 -0
- package/dist/components/SiweStatusView/index.js +71 -0
- package/dist/components/SiweStatusView/toSiweProvider.d.ts +10 -0
- package/dist/components/SiweStatusView/toSiweProvider.js +13 -0
- package/dist/components/SiweStatusView/useSiweFlow.d.ts +37 -0
- package/dist/components/SiweStatusView/useSiweFlow.js +35 -0
- package/dist/components/VerifyMfa/index.js +1 -1
- package/dist/components/VerifyMfaInline/index.js +1 -1
- package/dist/components/VerifyMfaModal/index.js +1 -1
- package/dist/components/ui/StatusView/index.d.ts +35 -0
- package/dist/components/ui/StatusView/index.js +55 -0
- package/dist/components/ui/SwitchFadeTransition/index.d.ts +1 -1
- package/dist/components/ui/SwitchFadeTransition/index.js +8 -12
- package/dist/components/ui/SwitchSlideTransition/index.d.ts +1 -1
- package/dist/components/ui/SwitchSlideTransition/index.js +8 -12
- package/dist/components/ui/SwitchTransition/index.d.ts +10 -3
- package/dist/components/ui/SwitchTransition/index.js +99 -98
- package/dist/hooks/useVerifyMfaModal.js +1 -1
- package/dist/icons/IconBaseColorLogo.d.ts +10 -0
- package/dist/icons/IconBaseColorLogo.js +13 -0
- package/dist/icons/IconBaseLogo.d.ts +24 -0
- package/dist/icons/IconBaseLogo.js +13 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +36 -32
- package/dist/index.js +230 -225
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +13 -6
- package/dist/assets/SwitchFadeTransition.css +0 -1
- package/dist/assets/SwitchSlideTransition.css +0 -1
- package/dist/chunks/LinkAuthFlow.S1XbYaG5.js +0 -111
- package/dist/chunks/index.IrJ_irKX.js +0 -17
|
@@ -1,69 +1,79 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
1
|
+
import { jsx as o, jsxs as l, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { u as p } from "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { c as
|
|
5
|
-
import "../../chunks/CDPReactProvider.
|
|
6
|
-
import { LinkAuth as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { createContext as M, useMemo as g, useCallback as L, useContext as A } from "react";
|
|
4
|
+
import { c as C } from "../../chunks/lite.1fxw3LjI.js";
|
|
5
|
+
import "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
6
|
+
import { LinkAuth as x, LinkAuthError as b } from "../LinkAuth/index.js";
|
|
7
|
+
import { isWithinBaseAccountDialog as v } from "../SiweStatusView/connectors/baseAccount.js";
|
|
8
|
+
import { Button as h } from "../ui/Button/index.js";
|
|
9
|
+
import { Modal as w, ModalContent as N, ModalTitle as T, ModalClose as y, ModalTrigger as B } from "../ui/Modal/index.js";
|
|
10
|
+
import { VisuallyHidden as D } from "../ui/VisuallyHidden/index.js";
|
|
10
11
|
import { IconXMark as F } from "../../icons/IconXMark.js";
|
|
11
|
-
import { childrenHasComponent as
|
|
12
|
+
import { childrenHasComponent as u } from "../../utils/childrenHasComponent.js";
|
|
12
13
|
import { LinkAuthTitle as H } from "../LinkAuth/LinkAuthTitle.js";
|
|
13
14
|
import { LinkAuthFlowBackButton as j } from "../LinkAuth/LinkAuthFlowBackButton.js";
|
|
14
|
-
import { a as
|
|
15
|
-
import '../../assets/LinkAuthModal.css';const
|
|
16
|
-
header:
|
|
17
|
-
error:
|
|
15
|
+
import { a as E } from "../../chunks/LinkAuthFlow.0FnIchwa.js";
|
|
16
|
+
import '../../assets/LinkAuthModal.css';const O = "LinkAuthModal-module__header___qoco6", S = "LinkAuthModal-module__error___Srl7H", I = "LinkAuthModal-module__trigger___aHDfG", i = {
|
|
17
|
+
header: O,
|
|
18
|
+
error: S,
|
|
18
19
|
"close-icon": "LinkAuthModal-module__close-icon___Fe02C",
|
|
19
20
|
"close-button": "LinkAuthModal-module__close-button___x6j3c",
|
|
20
|
-
trigger:
|
|
21
|
-
},
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
21
|
+
trigger: I
|
|
22
|
+
}, _ = M(null), V = () => {
|
|
23
|
+
const t = A(_);
|
|
24
|
+
if (!t)
|
|
24
25
|
throw new Error("useLinkAuthModalContext must be used within a LinkAuthModal");
|
|
25
|
-
return
|
|
26
|
-
},
|
|
27
|
-
children:
|
|
28
|
-
className:
|
|
29
|
-
label:
|
|
30
|
-
...
|
|
31
|
-
}) => /* @__PURE__ */ o(
|
|
32
|
-
const { onLinkSuccess:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
return t;
|
|
27
|
+
}, m = ({
|
|
28
|
+
children: t,
|
|
29
|
+
className: r = "",
|
|
30
|
+
label: n,
|
|
31
|
+
...e
|
|
32
|
+
}) => /* @__PURE__ */ o(B, { asChild: !0, children: t || /* @__PURE__ */ o(h, { className: C(i.trigger, r), ...e, children: n || "Link accounts" }) }), s = ({ onInteractOutside: t, ...r }) => {
|
|
33
|
+
const { onLinkSuccess: n } = V(), e = L(
|
|
34
|
+
(a) => {
|
|
35
|
+
if (v(a.detail.originalEvent.target)) {
|
|
36
|
+
a.preventDefault();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
t?.(a);
|
|
40
|
+
},
|
|
41
|
+
[t]
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ l(N, { "aria-describedby": void 0, ...r, onInteractOutside: e, children: [
|
|
44
|
+
/* @__PURE__ */ o(D, { children: /* @__PURE__ */ o(T, { children: "Link a profile" }) }),
|
|
45
|
+
/* @__PURE__ */ l(x, { onLinkSuccess: n, children: [
|
|
46
|
+
/* @__PURE__ */ l("div", { className: i.header, children: [
|
|
37
47
|
/* @__PURE__ */ o(H, {}),
|
|
38
48
|
/* @__PURE__ */ o(j, {}),
|
|
39
|
-
/* @__PURE__ */ o(
|
|
40
|
-
|
|
49
|
+
/* @__PURE__ */ o(y, { asChild: !0, children: /* @__PURE__ */ o(
|
|
50
|
+
h,
|
|
41
51
|
{
|
|
42
|
-
className:
|
|
52
|
+
className: i["close-button"],
|
|
43
53
|
"aria-label": "Close",
|
|
44
54
|
size: "md",
|
|
45
55
|
variant: "transparentSecondary",
|
|
46
|
-
children: /* @__PURE__ */ o(F, { className:
|
|
56
|
+
children: /* @__PURE__ */ o(F, { className: i["close-icon"] })
|
|
47
57
|
}
|
|
48
58
|
) })
|
|
49
59
|
] }),
|
|
50
|
-
/* @__PURE__ */ o("div", { className:
|
|
51
|
-
/* @__PURE__ */ o(
|
|
60
|
+
/* @__PURE__ */ o("div", { className: i.error, children: /* @__PURE__ */ o(b, {}) }),
|
|
61
|
+
/* @__PURE__ */ o(E, {})
|
|
52
62
|
] })
|
|
53
63
|
] });
|
|
54
|
-
},
|
|
64
|
+
}, to = ({ children: t, open: r, setIsOpen: n, onLinkSuccess: e }) => {
|
|
55
65
|
p("manage_auth_modal");
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */ o(
|
|
58
|
-
/* @__PURE__ */ o(
|
|
59
|
-
/* @__PURE__ */ o(
|
|
60
|
-
] }) : /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
!
|
|
66
|
+
const a = t ? u(t, m) : !1, c = t ? u(t, s) : !1, f = !a && !c, k = g(() => ({ onLinkSuccess: e }), [e]);
|
|
67
|
+
return /* @__PURE__ */ o(_.Provider, { value: k, children: /* @__PURE__ */ o(w, { open: r, onOpenChange: n, children: f ? /* @__PURE__ */ l(d, { children: [
|
|
68
|
+
/* @__PURE__ */ o(m, { children: t }),
|
|
69
|
+
/* @__PURE__ */ o(s, {})
|
|
70
|
+
] }) : /* @__PURE__ */ l(d, { children: [
|
|
71
|
+
t,
|
|
72
|
+
!c && /* @__PURE__ */ o(s, {})
|
|
63
73
|
] }) }) });
|
|
64
74
|
};
|
|
65
75
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
to as LinkAuthModal,
|
|
77
|
+
s as LinkAuthModalContent,
|
|
78
|
+
m as LinkAuthModalTrigger
|
|
69
79
|
};
|
|
@@ -1,162 +1,140 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import "@coinbase/cdp-core";
|
|
3
|
-
import { useOAuthState as
|
|
4
|
-
import { u as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { a as v } from "../../chunks/CDPReactProvider.
|
|
3
|
+
import { useOAuthState as w } from "@coinbase/cdp-hooks";
|
|
4
|
+
import { u as N } from "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
|
|
5
|
+
import { useState as T, useEffect as f, useRef as S, useCallback as _ } from "react";
|
|
6
|
+
import { a as v } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
7
7
|
import { CoinbaseFooter as k } from "../ui/CoinbaseFooter/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { SwitchFadeTransition as
|
|
11
|
-
import { VisuallyHidden as
|
|
8
|
+
import { Modal as y, ModalContent as R, ModalTitle as $, ModalDescription as P } from "../ui/Modal/index.js";
|
|
9
|
+
import { StatusView as O } from "../ui/StatusView/index.js";
|
|
10
|
+
import { SwitchFadeTransition as H } from "../ui/SwitchFadeTransition/index.js";
|
|
11
|
+
import { VisuallyHidden as C } from "../ui/VisuallyHidden/index.js";
|
|
12
12
|
import { useTimer as U } from "../../hooks/useTimer.js";
|
|
13
|
-
import { IconAppleLogo as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import { capitalize as _ } from "../../utils/capitalize.js";
|
|
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 = {
|
|
13
|
+
import { IconAppleLogo as x } from "../../icons/IconAppleLogo.js";
|
|
14
|
+
import { IconGoogleColorLogo as K } from "../../icons/IconGoogleColorLogo.js";
|
|
15
|
+
import { IconTelegramLogo as D } from "../../icons/IconTelegramLogo.js";
|
|
16
|
+
import { IconXLogo as G } from "../../icons/IconXLogo.js";
|
|
17
|
+
import { capitalize as m } from "../../utils/capitalize.js";
|
|
18
|
+
import '../../assets/OAuthStatusModal.css';const V = "OAuthStatusModal-module__status___vU6x7", g = {
|
|
21
19
|
"oauth-status-modal": "OAuthStatusModal-module__oauth-status-modal___I69Ii",
|
|
22
20
|
"transition-wrapper": "OAuthStatusModal-module__transition-wrapper___TmPRh",
|
|
23
|
-
status:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
subhead: W,
|
|
31
|
-
description: X,
|
|
32
|
-
ring: J,
|
|
33
|
-
"ring-success": "OAuthStatusModal-module__ring-success___unyM9",
|
|
34
|
-
"ring-error": "OAuthStatusModal-module__ring-error___OsgqU",
|
|
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 = S(
|
|
38
|
-
(a) => {
|
|
39
|
-
sessionStorage.setItem(p, n), sessionStorage.setItem(
|
|
40
|
-
h,
|
|
41
|
-
a ? "true" : "false"
|
|
21
|
+
status: V
|
|
22
|
+
}, d = "cdp-react-sign-in-with-oauth-provider-name", p = "cdp-react-sign-in-with-oauth-is-account-link", b = ["pending", "success", "error"], dt = () => {
|
|
23
|
+
const o = v() || "", s = _(
|
|
24
|
+
(n) => {
|
|
25
|
+
sessionStorage.setItem(d, o), sessionStorage.setItem(
|
|
26
|
+
p,
|
|
27
|
+
n ? "true" : "false"
|
|
42
28
|
);
|
|
43
29
|
},
|
|
44
|
-
[
|
|
45
|
-
),
|
|
46
|
-
sessionStorage.removeItem(
|
|
30
|
+
[o]
|
|
31
|
+
), t = _(() => {
|
|
32
|
+
sessionStorage.removeItem(d), sessionStorage.removeItem(p);
|
|
47
33
|
}, []);
|
|
48
|
-
return { persistOAuthState:
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
const [
|
|
52
|
-
return
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
34
|
+
return { persistOAuthState: s, cleanupOAuthState: t };
|
|
35
|
+
}, pt = () => {
|
|
36
|
+
N("oauth_status_modal");
|
|
37
|
+
const [o, s] = T(!1), { oauthState: t } = w(), [n, r] = T(!1), a = v(), u = t?.providerType || "google";
|
|
38
|
+
return f(() => {
|
|
39
|
+
if (t?.status === "pending" || t?.status === "error" || t?.status === "success") {
|
|
40
|
+
const c = sessionStorage.getItem(d);
|
|
41
|
+
if (c === null || c !== a)
|
|
56
42
|
return;
|
|
57
|
-
sessionStorage.removeItem(
|
|
58
|
-
const
|
|
59
|
-
sessionStorage.removeItem(
|
|
43
|
+
sessionStorage.removeItem(d), s(!0);
|
|
44
|
+
const l = sessionStorage.getItem(p) === "true";
|
|
45
|
+
sessionStorage.removeItem(p), r(l);
|
|
60
46
|
}
|
|
61
|
-
}, [
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
47
|
+
}, [t?.status, a]), /* @__PURE__ */ e(y, { open: o, onOpenChange: s, children: /* @__PURE__ */ h(R, { children: [
|
|
48
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e($, { children: "OAuth Status" }) }),
|
|
49
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ h(P, { children: [
|
|
50
|
+
n ? `Linking your ${u} account` : `Signing in with ${u}`,
|
|
65
51
|
" ",
|
|
66
|
-
|
|
52
|
+
t?.status ? `${t?.status === "success" ? "successful" : t?.status === "error" ? "failed" : "pending"}` : ""
|
|
67
53
|
] }) }),
|
|
68
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ e(j, { isAccountLink: n, handleClose: () => s(!1) })
|
|
69
55
|
] }) });
|
|
70
|
-
},
|
|
71
|
-
isAccountLink:
|
|
72
|
-
handleClose:
|
|
56
|
+
}, j = ({
|
|
57
|
+
isAccountLink: o,
|
|
58
|
+
handleClose: s
|
|
73
59
|
}) => {
|
|
74
|
-
const { oauthState:
|
|
75
|
-
|
|
60
|
+
const { oauthState: t } = w(), n = t?.providerType || "google", { timeRemaining: r, start: a, reset: u } = U(), c = S(null), l = S(t?.status ?? null), E = 250, A = S(t?.status).current, I = _((i) => {
|
|
61
|
+
l.current === i || i === void 0 || (l.current = i, c.current?.transition.toggle(i));
|
|
76
62
|
}, []);
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
63
|
+
return f(() => {
|
|
64
|
+
I(t?.status), t?.status === "success" && a(1);
|
|
65
|
+
}, [t?.status, I, a]), f(() => {
|
|
66
|
+
r !== null && r <= 0 && (u(), s());
|
|
67
|
+
}, [r, u, s]), /* @__PURE__ */ h("div", { className: g["oauth-status-modal"], children: [
|
|
68
|
+
/* @__PURE__ */ e(
|
|
69
|
+
H,
|
|
84
70
|
{
|
|
85
71
|
animateHeight: !1,
|
|
86
|
-
timeout:
|
|
87
|
-
items:
|
|
88
|
-
initialEntered:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
72
|
+
timeout: E,
|
|
73
|
+
items: b,
|
|
74
|
+
initialEntered: !!A,
|
|
75
|
+
initialItem: A,
|
|
76
|
+
transitionRef: c,
|
|
77
|
+
className: g["transition-wrapper"],
|
|
78
|
+
children: ({ itemKey: i, ...L }) => {
|
|
79
|
+
const M = J[i];
|
|
80
|
+
return /* @__PURE__ */ e("div", { ...L, className: g.status, children: /* @__PURE__ */ e(
|
|
81
|
+
M,
|
|
95
82
|
{
|
|
96
|
-
isAccountLink:
|
|
97
|
-
timeRemaining:
|
|
98
|
-
provider:
|
|
83
|
+
isAccountLink: o,
|
|
84
|
+
timeRemaining: r,
|
|
85
|
+
provider: n
|
|
99
86
|
}
|
|
100
87
|
) });
|
|
101
88
|
}
|
|
102
89
|
}
|
|
103
90
|
),
|
|
104
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ e(k, {})
|
|
105
92
|
] });
|
|
106
|
-
},
|
|
107
|
-
const
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
] }), ot = {
|
|
146
|
-
pending: tt,
|
|
147
|
-
success: st,
|
|
148
|
-
error: et
|
|
149
|
-
}, nt = {
|
|
150
|
-
google: G,
|
|
151
|
-
apple: K,
|
|
152
|
-
x: q,
|
|
153
|
-
telegram: H
|
|
93
|
+
}, F = ({ isAccountLink: o, provider: s }) => {
|
|
94
|
+
const t = X[s];
|
|
95
|
+
return /* @__PURE__ */ e(
|
|
96
|
+
O,
|
|
97
|
+
{
|
|
98
|
+
status: "pending",
|
|
99
|
+
icon: t ? /* @__PURE__ */ e(t, { width: "32", height: "32" }) : void 0,
|
|
100
|
+
title: o ? `Linking your ${m(s)} account` : `Signing in with ${m(s)}`,
|
|
101
|
+
description: "Just a moment..."
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}, Y = ({
|
|
105
|
+
isAccountLink: o,
|
|
106
|
+
timeRemaining: s,
|
|
107
|
+
provider: t
|
|
108
|
+
}) => /* @__PURE__ */ e(
|
|
109
|
+
O,
|
|
110
|
+
{
|
|
111
|
+
status: "success",
|
|
112
|
+
title: o ? `${m(t)} account linked` : `Signed in with ${m(t)}`,
|
|
113
|
+
description: `This window will automatically close in ${s ?? "soon"}`,
|
|
114
|
+
descriptionHidden: s === null
|
|
115
|
+
}
|
|
116
|
+
), z = ({ isAccountLink: o }) => /* @__PURE__ */ e(
|
|
117
|
+
O,
|
|
118
|
+
{
|
|
119
|
+
status: "error",
|
|
120
|
+
title: o ? "Account linking failed" : "Sign in failed",
|
|
121
|
+
description: "Something went wrong. Please try again."
|
|
122
|
+
}
|
|
123
|
+
), J = {
|
|
124
|
+
pending: F,
|
|
125
|
+
success: Y,
|
|
126
|
+
error: z
|
|
127
|
+
}, X = {
|
|
128
|
+
google: K,
|
|
129
|
+
apple: x,
|
|
130
|
+
x: G,
|
|
131
|
+
telegram: D
|
|
154
132
|
};
|
|
155
133
|
export {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
134
|
+
p as OAUTH_IS_ACCOUNT_LINK_SESSION_STORAGE_KEY,
|
|
135
|
+
d as OAUTH_PROVIDER_SESSION_STORAGE_KEY,
|
|
136
|
+
pt as OAuthStatusModal,
|
|
137
|
+
j as OAuthStatusModalContent,
|
|
138
|
+
pt as default,
|
|
139
|
+
dt as useOauthStatusModal
|
|
162
140
|
};
|
|
@@ -27,14 +27,17 @@ export interface SignInAuthMethodButtonProps {
|
|
|
27
27
|
export interface SignInAuthMethodButtonsProps {
|
|
28
28
|
/** The active auth method. */
|
|
29
29
|
activeMethod?: AuthMethod;
|
|
30
|
+
/** Called when an auth method (e.g. SIWE) completes successfully from this surface. */
|
|
31
|
+
onSuccess?: () => void;
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
34
|
* The AuthMethodButtons component.
|
|
33
35
|
*
|
|
34
|
-
* @param {
|
|
36
|
+
* @param {SignInAuthMethodButtonsProps} props - The props for the AuthMethodButtons component.
|
|
35
37
|
* @param {AuthMethod} [props.activeMethod] - The active auth method.
|
|
38
|
+
* @param {() => void} [props.onSuccess] - Called when an auth method completes successfully.
|
|
36
39
|
* @returns {JSX.Element} The AuthMethodButtons component.
|
|
37
40
|
*
|
|
38
41
|
* @group Components
|
|
39
42
|
*/
|
|
40
|
-
export declare const SignInAuthMethodButtons: ({ activeMethod }: SignInAuthMethodButtonsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
43
|
+
export declare const SignInAuthMethodButtons: ({ activeMethod, onSuccess, }: SignInAuthMethodButtonsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,98 +1,129 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "../../chunks/CDPReactProvider.
|
|
4
|
-
import { useSignInWithOAuth as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
1
|
+
import { jsx as n, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as S, useCallback as w } from "react";
|
|
3
|
+
import "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
4
|
+
import { useSignInWithOAuth as B } from "./hooks/useSignInWithOAuth.js";
|
|
5
|
+
import { useStartSiwe as M } from "./hooks/useStartSiwe.js";
|
|
6
|
+
import { useSignInContext as E } from "./SignInProvider.js";
|
|
7
|
+
import "@coinbase/cdp-hooks";
|
|
8
|
+
import { Button as O } from "../ui/Button/index.js";
|
|
9
|
+
import { siweConnectors as P } from "../SiweStatusView/connectors/siweConnectors.js";
|
|
10
|
+
import "libphonenumber-js";
|
|
11
|
+
import { toSiweProvider as k } from "../SiweStatusView/toSiweProvider.js";
|
|
12
|
+
import { ServerError as W } from "../ui/ServerError/index.js";
|
|
13
|
+
import { IconAppleLogo as j } from "../../icons/IconAppleLogo.js";
|
|
14
|
+
import { IconEnvelope as T } from "../../icons/IconEnvelope.js";
|
|
15
|
+
import { IconGoogleLogo as x } from "../../icons/IconGoogleLogo.js";
|
|
16
|
+
import { IconPhone as L } from "../../icons/IconPhone.js";
|
|
17
|
+
import { IconTelegramLogo as N } from "../../icons/IconTelegramLogo.js";
|
|
18
|
+
import { IconXLogo as D } from "../../icons/IconXLogo.js";
|
|
19
|
+
import { toOAuthProviderType as I } from "../../utils/toOAuthProviderType.js";
|
|
20
|
+
import '../../assets/SignInAuthMethodButtons.css';const H = "SignInAuthMethodButtons-module__divider___zphEh", e = {
|
|
16
21
|
"auth-method-buttons": "SignInAuthMethodButtons-module__auth-method-buttons___jYEH7",
|
|
17
22
|
"auth-btn": "SignInAuthMethodButtons-module__auth-btn___o1a09",
|
|
18
23
|
"auth-btn-icon": "SignInAuthMethodButtons-module__auth-btn-icon___VjvFY",
|
|
19
24
|
"auth-btn-label": "SignInAuthMethodButtons-module__auth-btn-label___mEWd3",
|
|
20
|
-
divider:
|
|
21
|
-
},
|
|
25
|
+
divider: H
|
|
26
|
+
}, G = Object.fromEntries(
|
|
27
|
+
Object.entries(P).map(([r, i]) => {
|
|
28
|
+
const a = i.icon;
|
|
29
|
+
return [`siwe:${r}`, { label: `Continue with ${i.label}`, icon: /* @__PURE__ */ n(a, {}) }];
|
|
30
|
+
})
|
|
31
|
+
), A = {
|
|
22
32
|
email: {
|
|
23
33
|
label: "Continue with email",
|
|
24
|
-
icon: /* @__PURE__ */ n(
|
|
34
|
+
icon: /* @__PURE__ */ n(T, {})
|
|
25
35
|
},
|
|
26
36
|
sms: {
|
|
27
37
|
label: "Continue with phone",
|
|
28
|
-
icon: /* @__PURE__ */ n(
|
|
38
|
+
icon: /* @__PURE__ */ n(L, {})
|
|
29
39
|
},
|
|
30
40
|
"oauth:google": {
|
|
31
41
|
label: "Continue with Google",
|
|
32
|
-
icon: /* @__PURE__ */ n(
|
|
42
|
+
icon: /* @__PURE__ */ n(x, {})
|
|
33
43
|
},
|
|
34
44
|
"oauth:apple": {
|
|
35
45
|
label: "Continue with Apple",
|
|
36
|
-
icon: /* @__PURE__ */ n(
|
|
46
|
+
icon: /* @__PURE__ */ n(j, {})
|
|
37
47
|
},
|
|
38
48
|
"oauth:x": {
|
|
39
49
|
label: "Continue with X",
|
|
40
|
-
icon: /* @__PURE__ */ n(
|
|
50
|
+
icon: /* @__PURE__ */ n(D, {})
|
|
41
51
|
},
|
|
42
52
|
"oauth:telegram": {
|
|
43
53
|
label: "Continue with Telegram",
|
|
44
|
-
icon: /* @__PURE__ */ n(
|
|
45
|
-
}
|
|
46
|
-
|
|
54
|
+
icon: /* @__PURE__ */ n(N, {})
|
|
55
|
+
},
|
|
56
|
+
...G
|
|
57
|
+
}, st = ({
|
|
58
|
+
activeMethod: r,
|
|
59
|
+
onSuccess: i
|
|
60
|
+
}) => {
|
|
47
61
|
const {
|
|
48
|
-
state: { authMethods:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
state: { authMethods: a },
|
|
63
|
+
dispatch: u
|
|
64
|
+
} = E(), {
|
|
65
|
+
signInWithOAuth: h,
|
|
66
|
+
isPending: c,
|
|
67
|
+
error: m,
|
|
68
|
+
oauthProvider: p
|
|
69
|
+
} = B(), d = M("base"), b = S(
|
|
70
|
+
() => ({ base: d }),
|
|
71
|
+
[d]
|
|
72
|
+
), g = w(
|
|
55
73
|
async (t) => {
|
|
56
|
-
const
|
|
57
|
-
|
|
74
|
+
const o = I(t);
|
|
75
|
+
o && h(o);
|
|
76
|
+
},
|
|
77
|
+
[h]
|
|
78
|
+
), _ = w(
|
|
79
|
+
(t) => {
|
|
80
|
+
const o = k(t);
|
|
81
|
+
o && b[o](i);
|
|
58
82
|
},
|
|
59
|
-
[
|
|
60
|
-
),
|
|
61
|
-
if (!
|
|
83
|
+
[b, i]
|
|
84
|
+
), s = S(() => (a || ["email"]).map((t) => {
|
|
85
|
+
if (!A[t])
|
|
62
86
|
return null;
|
|
63
|
-
const { label:
|
|
87
|
+
const { label: o, icon: v } = A[t], f = t.startsWith("oauth:"), C = t.startsWith("siwe:") ? () => _(t) : f ? () => g(t) : () => u({ type: "SET_AUTH_METHOD", payload: { authMethod: t } }), y = f && p.current === I(t) && c;
|
|
64
88
|
return {
|
|
65
89
|
key: t,
|
|
66
|
-
label:
|
|
67
|
-
icon:
|
|
68
|
-
onClick:
|
|
69
|
-
isPending:
|
|
90
|
+
label: o,
|
|
91
|
+
icon: v,
|
|
92
|
+
onClick: C,
|
|
93
|
+
isPending: y
|
|
70
94
|
};
|
|
71
|
-
}).filter((t) => t !== null), [
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
}).filter((t) => t !== null), [
|
|
96
|
+
a,
|
|
97
|
+
u,
|
|
98
|
+
g,
|
|
99
|
+
_,
|
|
100
|
+
c,
|
|
101
|
+
p
|
|
102
|
+
]);
|
|
103
|
+
return !s.length || s.length === 1 && s[0].key === r ? null : /* @__PURE__ */ l("div", { className: e["auth-method-buttons"], children: [
|
|
104
|
+
/* @__PURE__ */ l("div", { className: e.divider, children: [
|
|
74
105
|
/* @__PURE__ */ n("hr", {}),
|
|
75
106
|
/* @__PURE__ */ n("span", { children: "or" })
|
|
76
107
|
] }),
|
|
77
|
-
|
|
78
|
-
|
|
108
|
+
s.map((t) => t.key === r ? null : /* @__PURE__ */ l(
|
|
109
|
+
O,
|
|
79
110
|
{
|
|
80
111
|
"aria-label": t.ariaLabel,
|
|
81
|
-
className:
|
|
112
|
+
className: e["auth-btn"],
|
|
82
113
|
type: "button",
|
|
83
114
|
variant: "secondary",
|
|
84
115
|
onClick: t.onClick,
|
|
85
116
|
isPending: t.isPending,
|
|
86
117
|
children: [
|
|
87
|
-
/* @__PURE__ */ n("span", { className:
|
|
88
|
-
/* @__PURE__ */ n("span", { className:
|
|
118
|
+
/* @__PURE__ */ n("span", { className: e["auth-btn-icon"], children: t.icon }),
|
|
119
|
+
/* @__PURE__ */ n("span", { className: e["auth-btn-label"], children: t.label })
|
|
89
120
|
]
|
|
90
121
|
},
|
|
91
122
|
t.key
|
|
92
123
|
)),
|
|
93
|
-
|
|
124
|
+
m && /* @__PURE__ */ n(W, { error: m })
|
|
94
125
|
] });
|
|
95
126
|
};
|
|
96
127
|
export {
|
|
97
|
-
|
|
128
|
+
st as SignInAuthMethodButtons
|
|
98
129
|
};
|
|
@@ -5,7 +5,7 @@ import { IconArrowLeft as S } from "../../icons/IconArrowLeft.js";
|
|
|
5
5
|
import "../../theme/theme.js";
|
|
6
6
|
import { useSignInContext as d } from "./SignInProvider.js";
|
|
7
7
|
import "@coinbase/cdp-hooks";
|
|
8
|
-
import "../../chunks/CDPReactProvider.
|
|
8
|
+
import "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
9
9
|
import '../../assets/SignInBackButton.css';const B = "SignInBackButton-module__icon___stNFS", k = {
|
|
10
10
|
icon: B
|
|
11
11
|
}, E = ({
|