@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.
- 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
|
@@ -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.
|
|
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.
|
|
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
|
-
},
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
3
|
+
import "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
4
4
|
import "../SignIn/index.js";
|
|
5
5
|
import "@coinbase/cdp-hooks";
|
|
6
|
-
import "../ui/
|
|
6
|
+
import "../ui/SwitchTransition/index.js";
|
|
7
7
|
import "../ui/VisuallyHidden/index.js";
|
|
8
|
-
import { a as
|
|
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 "../
|
|
19
|
+
import "../SiweStatusView/toSiweProvider.js";
|
|
20
|
+
import "../SiweStatusView/useSiweFlow.js";
|
|
17
21
|
export {
|
|
18
|
-
|
|
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.
|
|
6
|
+
import { b as w } from "../../chunks/LinkAuthFlow.0FnIchwa.js";
|
|
7
7
|
import { useLinkAuthContext as _ } from "./LinkAuthProvider.js";
|
|
8
|
-
import "../../chunks/CDPReactProvider.
|
|
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 {
|
|
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
|
-
/**
|
|
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<
|
|
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
|
|
41
|
-
|
|
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
|
-
/**
|
|
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: ({
|
|
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.
|
|
4
|
-
import { L as e, u as n, b as s } from "../../chunks/LinkAuthFlow.
|
|
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.
|
|
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
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import "../../chunks/CDPReactProvider.
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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",
|
|
14
|
+
import '../../assets/LinkAuthItems.css';const x = "LinkAuthItems-module__list___5AimM", E = {
|
|
14
15
|
list: x
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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:
|
|
28
|
-
label:
|
|
34
|
+
icon: a,
|
|
35
|
+
label: b,
|
|
29
36
|
onLink: async () => {
|
|
30
|
-
|
|
37
|
+
r({ type: "LINK_AUTH_METHOD", payload: { method: o.method } }), await t?.(o.method);
|
|
31
38
|
}
|
|
32
39
|
};
|
|
33
|
-
}), [
|
|
34
|
-
return /* @__PURE__ */ e("ul", { className:
|
|
35
|
-
...
|
|
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:
|
|
44
|
+
isPending: m && s === o
|
|
38
45
|
}) || /* @__PURE__ */ e(
|
|
39
46
|
T,
|
|
40
47
|
{
|
|
41
|
-
...
|
|
48
|
+
...a,
|
|
42
49
|
authMethod: o,
|
|
43
|
-
isPending:
|
|
50
|
+
isPending: m && s === o
|
|
44
51
|
}
|
|
45
52
|
) }, o)) });
|
|
46
53
|
};
|
|
47
54
|
export {
|
|
48
|
-
|
|
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
|
|
4
|
-
import { u as L } from "../../chunks/CDPReactProvider.
|
|
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
|
-
},
|
|
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:
|
|
80
|
-
const
|
|
81
|
-
return
|
|
86
|
+
const { currentUser: t } = c(), { authMethods: o } = L(), i = d(() => {
|
|
87
|
+
const a = [];
|
|
88
|
+
return o.forEach((n) => {
|
|
82
89
|
if (!t) {
|
|
83
|
-
|
|
90
|
+
a.push({
|
|
84
91
|
userAlias: "",
|
|
85
92
|
isLinked: !1,
|
|
86
|
-
method:
|
|
93
|
+
method: n
|
|
87
94
|
});
|
|
88
95
|
return;
|
|
89
96
|
}
|
|
90
|
-
const u = T(t,
|
|
91
|
-
|
|
97
|
+
const u = T(t, n);
|
|
98
|
+
a.push({
|
|
92
99
|
userAlias: u?.userAlias ?? "",
|
|
93
100
|
isLinked: u?.isLinked ?? !1,
|
|
94
|
-
method:
|
|
101
|
+
method: n
|
|
95
102
|
});
|
|
96
|
-
}),
|
|
97
|
-
}, [t,
|
|
103
|
+
}), a;
|
|
104
|
+
}, [t, o]), [h, s] = A(E, {
|
|
98
105
|
...g,
|
|
99
|
-
authMethods:
|
|
100
|
-
}), l =
|
|
106
|
+
authMethods: i
|
|
107
|
+
}), l = d(() => ({ state: h, dispatch: s }), [h, s]);
|
|
101
108
|
return f(() => {
|
|
102
|
-
|
|
103
|
-
}, [
|
|
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(
|
|
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
|
|
2
|
-
import { useLinkOAuth as
|
|
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
|
|
5
|
-
import "../../chunks/CDPReactProvider.
|
|
6
|
-
import { useOauthStatusModal as
|
|
7
|
-
import { Banner as
|
|
8
|
-
import { useTimeout as
|
|
9
|
-
import { getMessageFromUnknownError as
|
|
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
|
|
12
|
-
import { L as
|
|
13
|
-
import { u as
|
|
14
|
-
import { LinkAuthFlowBackButton as
|
|
15
|
-
import { LinkAuthItem as
|
|
16
|
-
import { LinkAuthItems as
|
|
17
|
-
import { LinkAuthProvider as
|
|
18
|
-
import { LinkAuthTitle as
|
|
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
|
|
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:
|
|
23
|
-
error:
|
|
24
|
-
},
|
|
25
|
-
const { state:
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
const { linkOAuth:
|
|
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
|
-
|
|
30
|
+
i.current !== t && (i.current = t, _.current?.transition.toggle(t), t === "list" && n({ type: "RESET_STATE" }));
|
|
31
31
|
},
|
|
32
32
|
[n]
|
|
33
|
-
),
|
|
34
|
-
if (
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
}, [
|
|
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
|
-
|
|
44
|
-
|
|
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
|
-
|
|
48
|
+
L(!0), await p(y);
|
|
48
49
|
} catch (C) {
|
|
49
|
-
|
|
50
|
+
A(), n({
|
|
50
51
|
type: "LINK_AUTH_METHOD_ERROR",
|
|
51
|
-
payload: { error:
|
|
52
|
+
payload: { error: j(C) }
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
} else
|
|
55
|
-
|
|
56
|
+
o(w);
|
|
56
57
|
},
|
|
57
|
-
[
|
|
58
|
-
), g = typeof
|
|
59
|
-
return /* @__PURE__ */ r("div", { className: `${k["link-auth"]} ${
|
|
60
|
-
|
|
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
|
-
|
|
63
|
-
onBack:
|
|
64
|
-
onLink:
|
|
63
|
+
transitionName: B,
|
|
64
|
+
onBack: N,
|
|
65
|
+
onLink: v,
|
|
65
66
|
onLinkSuccess: R,
|
|
66
|
-
signInRef:
|
|
67
|
-
transitionRef:
|
|
67
|
+
signInRef: m,
|
|
68
|
+
transitionRef: _,
|
|
68
69
|
children: [
|
|
69
70
|
g,
|
|
70
|
-
!g && /* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */ r(
|
|
73
|
-
/* @__PURE__ */ r(
|
|
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(
|
|
76
|
-
/* @__PURE__ */ r(
|
|
76
|
+
/* @__PURE__ */ r("div", { className: k.error, children: /* @__PURE__ */ r(q, {}) }),
|
|
77
|
+
/* @__PURE__ */ r(W, {})
|
|
77
78
|
] })
|
|
78
79
|
]
|
|
79
80
|
}
|
|
80
81
|
) });
|
|
81
|
-
},
|
|
82
|
+
}, dt = (e) => (P("manage_auth"), /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(z, { ...e }) }));
|
|
82
83
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
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.
|
|
2
|
-
|
|
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
|
-
|
|
6
|
+
o as LINK_AUTH_FLOW_VIEWS
|
|
5
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../../chunks/CDPReactProvider.
|
|
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),
|
|
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
|
-
|
|
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
|
*
|