@getpara/react-sdk 2.0.0-alpha.12 → 2.0.0-alpha.14
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/modal/ParaModal.js +29 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +3 -3
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +1 -2
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +12 -19
- package/dist/modal/constants/constants.d.ts +1 -0
- package/dist/modal/constants/constants.js +2 -0
- package/dist/modal/stores/modal/actions.js +0 -3
- package/dist/provider/ParaProvider.js +17 -5
- package/dist/provider/actions/index.d.ts +1 -0
- package/dist/provider/actions/index.js +2 -0
- package/dist/provider/hooks/mutations/index.d.ts +1 -0
- package/dist/provider/hooks/mutations/index.js +2 -0
- package/dist/provider/hooks/utils/useClient.d.ts +1 -1
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
- package/dist/provider/hooks/utils/useInternalClient.js +2 -2
- package/dist/provider/providers/AuthProvider.js +7 -8
- package/dist/provider/stores/slices/analytics.d.ts +3 -0
- package/dist/provider/stores/slices/analytics.js +9 -0
- package/dist/provider/stores/slices/index.d.ts +1 -0
- package/dist/provider/stores/slices/index.js +1 -0
- package/dist/provider/stores/types.d.ts +5 -1
- package/dist/provider/stores/useStore.js +8 -2
- package/dist/provider/types/provider.d.ts +4 -2
- package/package.json +8 -8
package/dist/modal/ParaModal.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
__async,
|
|
4
4
|
__objRest,
|
|
5
|
+
__spreadProps,
|
|
5
6
|
__spreadValues
|
|
6
7
|
} from "../chunk-MMUBH76A.js";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -22,6 +23,7 @@ import { useStore } from "../provider/stores/useStore.js";
|
|
|
22
23
|
import parsePhoneNumberFromString from "libphonenumber-js";
|
|
23
24
|
import { useAuthActions } from "../provider/providers/AuthProvider.js";
|
|
24
25
|
import { validateAuth } from "./utils/authInputHelpers.js";
|
|
26
|
+
import { SDK_VERSION } from "./constants/constants.js";
|
|
25
27
|
defineCustomElements();
|
|
26
28
|
const ParaModal = forwardRef((props, ref) => {
|
|
27
29
|
const storedModalConfig = useStore((state) => state.modalConfig);
|
|
@@ -49,6 +51,7 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
49
51
|
const [isModalMounted, setIsModalMounted] = useState(false);
|
|
50
52
|
const [isInit, setIsInit] = useState(false);
|
|
51
53
|
const externalWallets = useStore((state) => state.externalWallets);
|
|
54
|
+
const providerProps = useStore((state) => state.providerProps);
|
|
52
55
|
const _a = __spreadValues(__spreadValues({}, storedModalConfig), props), {
|
|
53
56
|
isOpen: configIsOpen,
|
|
54
57
|
theme,
|
|
@@ -80,6 +83,32 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
80
83
|
"onClose",
|
|
81
84
|
"defaultAuthIdentifier"
|
|
82
85
|
]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const trackAnalytics = () => __async(void 0, null, function* () {
|
|
88
|
+
try {
|
|
89
|
+
yield para.ctx.client.trackReactSdkAnalytics({
|
|
90
|
+
props: __spreadValues(__spreadProps(__spreadValues({}, providerProps), {
|
|
91
|
+
theme,
|
|
92
|
+
disableEmailLogin,
|
|
93
|
+
disablePhoneLogin,
|
|
94
|
+
isGuestModeEnabled,
|
|
95
|
+
oAuthMethods,
|
|
96
|
+
bareModal,
|
|
97
|
+
className,
|
|
98
|
+
currentStepOverride,
|
|
99
|
+
authLayout,
|
|
100
|
+
embeddedModal,
|
|
101
|
+
onModalStepChange,
|
|
102
|
+
onClose,
|
|
103
|
+
defaultAuthIdentifier
|
|
104
|
+
}), rest),
|
|
105
|
+
reactSdkVersion: SDK_VERSION
|
|
106
|
+
});
|
|
107
|
+
} catch (_) {
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
trackAnalytics();
|
|
111
|
+
}, []);
|
|
83
112
|
const isOpen = configIsOpen != null ? configIsOpen : storedIsOpen;
|
|
84
113
|
useImperativeHandle(ref, () => {
|
|
85
114
|
return {
|
|
@@ -21,9 +21,9 @@ import { useAddFunds } from "./AddFundsContext.js";
|
|
|
21
21
|
import { formatNetworkList } from "../../utils/stringFormatters.js";
|
|
22
22
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
23
23
|
const GENERIC_WALLET = {
|
|
24
|
-
EVM: "Ethereum or EVM-based
|
|
25
|
-
SOLANA: "Solana",
|
|
26
|
-
COSMOS: "Cosmos"
|
|
24
|
+
EVM: "Ethereum or EVM-based networks",
|
|
25
|
+
SOLANA: "Solana or SVM-based networks",
|
|
26
|
+
COSMOS: "Cosmos networks"
|
|
27
27
|
};
|
|
28
28
|
function AddFundsReceive() {
|
|
29
29
|
const [isCopied, copy] = useCopyToClipboard();
|
|
@@ -16,7 +16,6 @@ const BiometricCreationStep = () => {
|
|
|
16
16
|
const { presentSignupUi } = useAuthActions();
|
|
17
17
|
const signupState = useModalStore((state) => state.getSignupState());
|
|
18
18
|
const authStepRoute = useModalStore((state) => state.authStepRoute);
|
|
19
|
-
const isPasskeySupported = useModalStore((state) => state.isPasskeySupported);
|
|
20
19
|
const [isCopied, copy] = useCopyToClipboard();
|
|
21
20
|
const handleCopy = () => {
|
|
22
21
|
if (signupState == null ? void 0 : signupState.passkeyUrl) {
|
|
@@ -37,7 +36,7 @@ const BiometricCreationStep = () => {
|
|
|
37
36
|
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? "Choose a password or set up a passkey" : "Your Passkey keeps your account safe." })
|
|
38
37
|
] }),
|
|
39
38
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
40
|
-
isPasskeySupported ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSKEY), children: [
|
|
39
|
+
(signupState == null ? void 0 : signupState.isPasskeySupported) ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSKEY), children: [
|
|
41
40
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
|
|
42
41
|
isBoth ? "Create Passkey" : "Create"
|
|
43
42
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -14,19 +14,12 @@ const BiometricLoginStep = () => {
|
|
|
14
14
|
const loginState = useModalStore((state) => state.getLoginState());
|
|
15
15
|
const para = useInternalClient();
|
|
16
16
|
const { biometricHints, presentLoginUi } = useAuthActions();
|
|
17
|
-
const isPasskeySupported = useModalStore((state) => state.isPasskeySupported);
|
|
18
|
-
const [isPasskey, isPassword, hasHints, isPasskeyOnKnownDevice] = [
|
|
19
|
-
!!(loginState == null ? void 0 : loginState.passkeyUrl),
|
|
20
|
-
!!(loginState == null ? void 0 : loginState.passwordUrl),
|
|
21
|
-
(_a = loginState == null ? void 0 : loginState.biometricHints) == null ? void 0 : _a.length,
|
|
22
|
-
isPasskeySupported && !!(biometricHints == null ? void 0 : biometricHints.isOnKnownDevice)
|
|
23
|
-
];
|
|
24
|
-
const knownDeviceLink = loginState == null ? void 0 : loginState.passkeyKnownDeviceUrl;
|
|
25
|
-
const isPasskeyUnavailable = hasHints && !(biometricHints == null ? void 0 : biometricHints.isOnKnownDevice) || !isPasskeySupported;
|
|
26
|
-
const displayWelcomeBack = hasHints || isPasskeyOnKnownDevice || isPassword;
|
|
27
17
|
if (!loginState) {
|
|
28
18
|
return null;
|
|
29
19
|
}
|
|
20
|
+
const { passkeyUrl, passkeyKnownDeviceUrl, passwordUrl, isPasskeySupported } = loginState;
|
|
21
|
+
const { isOnKnownDevice = false, formattedHints } = biometricHints || {};
|
|
22
|
+
const isPasskey = !!passkeyUrl, isPassword = !!passwordUrl, isNeither = !isPasskey && !isPassword, hasHints = (_a = formattedHints == null ? void 0 : formattedHints.length) != null ? _a : 0 > 0, isPasskeyOnKnownDevice = isPasskeySupported && isOnKnownDevice, isPasskeyUnavailable = hasHints && !isOnKnownDevice || !isPasskeySupported || isNeither, displayKnownDevices = isPasskeyUnavailable && !!biometricHints && (hasHints || !!passkeyKnownDeviceUrl), displayWelcomeBack = isPasskeyOnKnownDevice || isPassword;
|
|
30
23
|
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
31
24
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
32
25
|
displayWelcomeBack && /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Welcome back," }),
|
|
@@ -34,15 +27,15 @@ const BiometricLoginStep = () => {
|
|
|
34
27
|
] }),
|
|
35
28
|
/* @__PURE__ */ jsxs(MainContainer, { children: [
|
|
36
29
|
isPassword && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(AuthMethod.PASSWORD, loginState), children: "Login" }),
|
|
37
|
-
isPasskey &&
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
] })
|
|
30
|
+
isPasskey && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
+
displayKnownDevices && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(KnownDevices, { hints: biometricHints, link: passkeyKnownDeviceUrl }),
|
|
33
|
+
/* @__PURE__ */ jsx(CpslDivider, { children: "or" })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(AuthMethod.PASSKEY, loginState), children: isPasskeyUnavailable ? "Continue anyway" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
|
|
37
|
+
"Login with passkey"
|
|
38
|
+
] }) })
|
|
46
39
|
] })
|
|
47
40
|
] })
|
|
48
41
|
] });
|
|
@@ -36,4 +36,5 @@ export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
|
36
36
|
export declare const EMAIL_REGEX: RegExp;
|
|
37
37
|
export declare const BODY_MOTION_VARIANTS: Variants;
|
|
38
38
|
export declare const BODY_TRANSITION: Transition;
|
|
39
|
+
export declare const SDK_VERSION: string;
|
|
39
40
|
export {};
|
|
@@ -119,6 +119,7 @@ const BODY_MOTION_VARIANTS = {
|
|
|
119
119
|
const BODY_TRANSITION = {
|
|
120
120
|
duration: 0.2
|
|
121
121
|
};
|
|
122
|
+
const SDK_VERSION = "2.0.0-alpha.13";
|
|
122
123
|
export {
|
|
123
124
|
BODY_MOTION_VARIANTS,
|
|
124
125
|
BODY_TRANSITION,
|
|
@@ -130,6 +131,7 @@ export {
|
|
|
130
131
|
ON_RAMP_PROVIDERS,
|
|
131
132
|
PARA_CONNECT,
|
|
132
133
|
PARA_TERMS_AND_CONDITIONS,
|
|
134
|
+
SDK_VERSION,
|
|
133
135
|
getAssetCode,
|
|
134
136
|
getAssetIcon,
|
|
135
137
|
getAssetName,
|
|
@@ -32,9 +32,6 @@ const getActions = (set, get) => ({
|
|
|
32
32
|
set({ onRampStep: onRampStep - 1 });
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (!flow) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
35
|
const onModalStepChange = get().onModalStepChange;
|
|
39
36
|
const signupState = get().getSignupState();
|
|
40
37
|
const iFrameUrl = get().iFrameUrl;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-MMUBH76A.js";
|
|
3
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
7
|
import { forwardRef, useEffect } from "react";
|
|
5
8
|
import { useStore } from "./stores/useStore.js";
|
|
@@ -26,6 +29,13 @@ const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config
|
|
|
26
29
|
const appName = useStore((state) => state.appName);
|
|
27
30
|
const rpcUrl = useStore((state) => state.rpcUrl);
|
|
28
31
|
const setRpcUrl = useStore((state) => state.setRpcUrl);
|
|
32
|
+
const setProviderProps = useStore((state) => state.setProviderProps);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setProviderProps(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, config), externalWalletConfig), paraModalConfig), {
|
|
35
|
+
// Redacting walletConnect to avoid exposing project id
|
|
36
|
+
walletConnect: void 0
|
|
37
|
+
}));
|
|
38
|
+
}, [config, externalWalletConfig, paraModalConfig]);
|
|
29
39
|
useEffect(() => {
|
|
30
40
|
if (rpcUrl !== config.rpcUrl) setRpcUrl(config.rpcUrl);
|
|
31
41
|
}, [config.rpcUrl]);
|
|
@@ -43,15 +53,17 @@ const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config
|
|
|
43
53
|
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.wallets]);
|
|
44
54
|
useEffect(() => {
|
|
45
55
|
var _a, _b;
|
|
46
|
-
if (externalWalletsWithFullAuth !== (externalWalletConfig == null ? void 0 : externalWalletConfig.
|
|
56
|
+
if (externalWalletsWithFullAuth !== (externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets)) {
|
|
47
57
|
if (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly) {
|
|
48
|
-
console.warn("
|
|
58
|
+
console.warn("createLinkedEmbeddedForExternalWallets has no effect when using externalWalletConnectionOnly");
|
|
49
59
|
setExternalWalletsWithFullAuth([]);
|
|
50
60
|
} else {
|
|
51
|
-
setExternalWalletsWithFullAuth(
|
|
61
|
+
setExternalWalletsWithFullAuth(
|
|
62
|
+
(externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) === "ALL" ? Object.values(ExternalWallet) : (_b = externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) != null ? _b : []
|
|
63
|
+
);
|
|
52
64
|
}
|
|
53
65
|
}
|
|
54
|
-
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.
|
|
66
|
+
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets]);
|
|
55
67
|
useEffect(() => {
|
|
56
68
|
if (!isConfigType(paraClientConfig) && !isParaWeb(paraClientConfig)) {
|
|
57
69
|
throw new Error("Invalid Para config");
|
|
@@ -25,3 +25,4 @@ export declare const createGuestWallets: import("./utils.js").CoreAction<"create
|
|
|
25
25
|
export declare const signMessage: import("./utils.js").CoreAction<"signMessage">;
|
|
26
26
|
export declare const signTransaction: import("./utils.js").CoreAction<"signTransaction">;
|
|
27
27
|
export declare const getWalletBalance: import("./utils.js").CoreAction<"getWalletBalance">;
|
|
28
|
+
export declare const issueJwt: import("./utils.js").CoreAction<"issueJwt">;
|
|
@@ -28,6 +28,7 @@ const createGuestWallets = generateAction("createGuestWallets");
|
|
|
28
28
|
const signMessage = generateAction("signMessage");
|
|
29
29
|
const signTransaction = generateAction("signTransaction");
|
|
30
30
|
const getWalletBalance = generateAction("getWalletBalance");
|
|
31
|
+
const issueJwt = generateAction("issueJwt");
|
|
31
32
|
export {
|
|
32
33
|
claimPregenWallets,
|
|
33
34
|
createGuestWallets,
|
|
@@ -38,6 +39,7 @@ export {
|
|
|
38
39
|
enable2fa,
|
|
39
40
|
getWalletBalance,
|
|
40
41
|
hasPregenWallet,
|
|
42
|
+
issueJwt,
|
|
41
43
|
keepSessionAlive,
|
|
42
44
|
loginExternalWallet,
|
|
43
45
|
logout,
|
|
@@ -24,4 +24,5 @@ export declare const useUpdatePregenWalletIdentifier: () => import("../../types/
|
|
|
24
24
|
export declare const useCreateGuestWallets: () => import("../../types/utils.js").CoreMethodHook<"createGuestWallets">;
|
|
25
25
|
export declare const useSignMessage: () => import("../../types/utils.js").CoreMethodHook<"signMessage">;
|
|
26
26
|
export declare const useSignTransaction: () => import("../../types/utils.js").CoreMethodHook<"signTransaction">;
|
|
27
|
+
export declare const useIssueJwt: () => import("../../types/utils.js").CoreMethodHook<"issueJwt">;
|
|
27
28
|
export declare const useCreateGuestWalletsState: import("../../types/utils.js").CoreMethodStateHook<"createGuestWallets">;
|
|
@@ -31,6 +31,7 @@ const useUpdatePregenWalletIdentifier = generateHook(
|
|
|
31
31
|
const useCreateGuestWallets = generateHook("createGuestWallets", actions.createGuestWallets);
|
|
32
32
|
const useSignMessage = generateHook("signMessage", actions.signMessage);
|
|
33
33
|
const useSignTransaction = generateHook("signTransaction", actions.signTransaction);
|
|
34
|
+
const useIssueJwt = generateHook("issueJwt", actions.issueJwt);
|
|
34
35
|
const useCreateGuestWalletsState = generateStateHook("createGuestWallets");
|
|
35
36
|
export {
|
|
36
37
|
useClaimPregenWallets,
|
|
@@ -42,6 +43,7 @@ export {
|
|
|
42
43
|
useCreateWalletPerType,
|
|
43
44
|
useEnable2fa,
|
|
44
45
|
useHasPregenWallet,
|
|
46
|
+
useIssueJwt,
|
|
45
47
|
useKeepSessionAlive,
|
|
46
48
|
useLoginExternalWallet,
|
|
47
49
|
useLogout,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import { useModalStore } from "../../../modal/stores/index.js";
|
|
7
|
+
import { formatBiometricHints } from "@getpara/react-common";
|
|
8
|
+
import { useClient } from "./useClient.js";
|
|
9
|
+
const queryKey = ["FORMATTED_BIOMETRIC_HINTS"];
|
|
10
|
+
const useFormattedBiometricHints = () => {
|
|
11
|
+
var _a;
|
|
12
|
+
const client = useClient();
|
|
13
|
+
const loginState = useModalStore((state) => state.getLoginState());
|
|
14
|
+
return useQuery({
|
|
15
|
+
queryKey: [...queryKey, (_a = loginState == null ? void 0 : loginState.biometricHints) != null ? _a : "undefined"],
|
|
16
|
+
queryFn: () => __async(void 0, null, function* () {
|
|
17
|
+
if (!client || !(loginState == null ? void 0 : loginState.biometricHints)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const isPasskeySupported = yield client.isPasskeySupported();
|
|
21
|
+
return formatBiometricHints(loginState.biometricHints, isPasskeySupported);
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
useFormattedBiometricHints
|
|
27
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useClient } from "./useClient.js";
|
|
4
4
|
const useInternalClient = () => {
|
|
5
|
-
const client =
|
|
5
|
+
const client = useClient();
|
|
6
6
|
return client;
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__spreadValues
|
|
6
6
|
} from "../../chunk-MMUBH76A.js";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
8
|
+
import { useUserAgent } from "@getpara/react-common";
|
|
9
9
|
import { createContext, useCallback, useContext, useEffect, useMemo } from "react";
|
|
10
10
|
import { useModalStore } from "../../modal/stores/index.js";
|
|
11
11
|
import { ModalStep } from "../../modal/utils/steps.js";
|
|
@@ -33,6 +33,7 @@ import { useGoBack } from "../../modal/hooks/useGoBack.js";
|
|
|
33
33
|
import { isExternalWallet } from "@getpara/user-management-client";
|
|
34
34
|
import { routeMobileExternalWallet } from "../../modal/utils/routeMobileExternalWallet.js";
|
|
35
35
|
import { useStore } from "../stores/useStore.js";
|
|
36
|
+
import { useFormattedBiometricHints } from "../hooks/utils/useFormattedBiometricHints.js";
|
|
36
37
|
const AuthContext = createContext({
|
|
37
38
|
signUpOrLogIn: () => {
|
|
38
39
|
},
|
|
@@ -67,6 +68,7 @@ function AuthProvider({
|
|
|
67
68
|
overrides = {}
|
|
68
69
|
}) {
|
|
69
70
|
const para = useInternalClient();
|
|
71
|
+
const userAgent = useUserAgent();
|
|
70
72
|
const onLoginRef = useStore((state) => state.onLoginRef);
|
|
71
73
|
const setIsOpen = useStore((state) => state.setIsOpen);
|
|
72
74
|
const bareModal = useStore((state) => {
|
|
@@ -89,10 +91,6 @@ function AuthProvider({
|
|
|
89
91
|
const authStepRoute = useModalStore((state) => state.authStepRoute);
|
|
90
92
|
const isIFrameReady = useModalStore((state) => state.isIFrameReady);
|
|
91
93
|
const goBack = useGoBack();
|
|
92
|
-
const biometricHints = useMemo(() => {
|
|
93
|
-
var _a;
|
|
94
|
-
return formatBiometricHints((_a = loginState == null ? void 0 : loginState.biometricHints) != null ? _a : []);
|
|
95
|
-
}, [loginState == null ? void 0 : loginState.biometricHints]);
|
|
96
94
|
const { mutate: mutateSignUpOrLogIn, isPending: isSignUpOrLogInPending } = useSignUpOrLogIn();
|
|
97
95
|
const {
|
|
98
96
|
mutate: mutateVerifyNewAccount,
|
|
@@ -108,6 +106,7 @@ function AuthProvider({
|
|
|
108
106
|
const { mutate: mutateSetup2fa, isPending: isSetup2faPending } = useSetup2fa();
|
|
109
107
|
const { mutate: mutateCreateGuestWallets, isPending: isCreateGuestWalletsPending } = useCreateGuestWallets();
|
|
110
108
|
const { mutate: mutateLogout } = useLogout();
|
|
109
|
+
const { data: biometricHints } = useFormattedBiometricHints();
|
|
111
110
|
const goBackIfPopupClosedOnSteps = (steps) => {
|
|
112
111
|
var _a;
|
|
113
112
|
if (((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) && (!refs.currentStep.current || steps.includes(refs.currentStep.current))) {
|
|
@@ -267,7 +266,7 @@ function AuthProvider({
|
|
|
267
266
|
break;
|
|
268
267
|
case "signup":
|
|
269
268
|
{
|
|
270
|
-
const isPassword = !!authState.passwordUrl, isPasswordOnly = isPassword && !authState.passkeyUrl;
|
|
269
|
+
const isPassword = !!authState.passwordUrl, isPasswordOnly = isPassword && (!authState.passkeyUrl || (userAgent == null ? void 0 : userAgent.device.type) === "mobile" && !authState.isPasskeySupported);
|
|
271
270
|
if (isPassword) {
|
|
272
271
|
setIFrameUrl(authState.passwordUrl);
|
|
273
272
|
}
|
|
@@ -291,7 +290,7 @@ function AuthProvider({
|
|
|
291
290
|
});
|
|
292
291
|
const verifyNewAccount = (verificationCode) => __async(this, null, function* () {
|
|
293
292
|
mutateVerifyNewAccount(
|
|
294
|
-
{ verificationCode },
|
|
293
|
+
{ verificationCode, useShortUrls: true },
|
|
295
294
|
{
|
|
296
295
|
onSuccess: onNewAuthState
|
|
297
296
|
}
|
|
@@ -455,7 +454,7 @@ function AuthProvider({
|
|
|
455
454
|
createGuestWallets,
|
|
456
455
|
isCreateGuestWalletsPending,
|
|
457
456
|
logout,
|
|
458
|
-
biometricHints
|
|
457
|
+
biometricHints: biometricHints || void 0
|
|
459
458
|
}),
|
|
460
459
|
[
|
|
461
460
|
presentSignupUi,
|
|
@@ -14,6 +14,10 @@ export interface ConfigSlice {
|
|
|
14
14
|
appName: string;
|
|
15
15
|
setAppName: (_: string) => void;
|
|
16
16
|
}
|
|
17
|
+
export interface AnalyticsSlice {
|
|
18
|
+
providerProps: object;
|
|
19
|
+
setProviderProps: (_: object) => void;
|
|
20
|
+
}
|
|
17
21
|
export interface ModalSlice {
|
|
18
22
|
modalConfig?: ParaModalProps;
|
|
19
23
|
setModalConfig: (_?: ParaModalProps) => void;
|
|
@@ -61,4 +65,4 @@ export interface ExternalWalletsSlice {
|
|
|
61
65
|
setIsLoadingSolanaLib: (_: boolean) => void;
|
|
62
66
|
onLoginRef: MutableRefObject<(() => Promise<void>) | null>;
|
|
63
67
|
}
|
|
64
|
-
export type Store = ClientSlice & ModalSlice & WalletSlice & ExternalWalletsSlice & ConfigSlice;
|
|
68
|
+
export type Store = ClientSlice & ModalSlice & WalletSlice & ExternalWalletsSlice & ConfigSlice & AnalyticsSlice;
|
|
@@ -3,12 +3,18 @@ import {
|
|
|
3
3
|
__spreadValues
|
|
4
4
|
} from "../../chunk-MMUBH76A.js";
|
|
5
5
|
import { createStore, useStore as useZustandStore } from "zustand";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createAnalyticsSlice,
|
|
8
|
+
createClientSlice,
|
|
9
|
+
createExternalWalletsSlice,
|
|
10
|
+
createModalSlice,
|
|
11
|
+
createWalletSlice
|
|
12
|
+
} from "./slices/index.js";
|
|
7
13
|
import { createJSONStorage, persist } from "zustand/middleware";
|
|
8
14
|
import { createConfigSlice } from "./slices/config.js";
|
|
9
15
|
const vanillaStore = createStore()(
|
|
10
16
|
persist(
|
|
11
|
-
(...a) => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, createClientSlice(...a)), createModalSlice(...a)), createWalletSlice(...a)), createExternalWalletsSlice(...a)), createConfigSlice(...a)),
|
|
17
|
+
(...a) => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, createClientSlice(...a)), createModalSlice(...a)), createWalletSlice(...a)), createExternalWalletsSlice(...a)), createConfigSlice(...a)), createAnalyticsSlice(...a)),
|
|
12
18
|
{
|
|
13
19
|
version: 1,
|
|
14
20
|
name: "@PARA/provider-state",
|
|
@@ -107,9 +107,11 @@ export type ExternalWalletConfig<chains extends readonly [Chain, ...Chain[]], tr
|
|
|
107
107
|
*/
|
|
108
108
|
wallets?: TExternalWallet[];
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* Array of external wallets that will also include linked embedded wallets.
|
|
111
|
+
*
|
|
112
|
+
* You can also pass `ALL` to include linked embedded wallets for all external wallets.
|
|
111
113
|
*/
|
|
112
|
-
|
|
114
|
+
createLinkedEmbeddedForExternalWallets?: TExternalWallet[] | 'ALL';
|
|
113
115
|
};
|
|
114
116
|
export interface ParaProviderProps<chains extends readonly [Chain, ...Chain[]], transports extends Record<chains[number]['id'], Transport>> extends PropsWithChildren {
|
|
115
117
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"*.css"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
19
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
20
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
18
|
+
"@getpara/react-common": "2.0.0-alpha.14",
|
|
19
|
+
"@getpara/react-components": "2.0.0-alpha.14",
|
|
20
|
+
"@getpara/web-sdk": "2.0.0-alpha.14",
|
|
21
21
|
"date-fns": "^3.6.0",
|
|
22
22
|
"framer-motion": "11.3.28",
|
|
23
23
|
"libphonenumber-js": "^1.11.1",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"cli": "node ./dist/cli/cli.mjs"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.
|
|
37
|
-
"@getpara/evm-wallet-connectors": "2.0.0-alpha.
|
|
38
|
-
"@getpara/solana-wallet-connectors": "2.0.0-alpha.
|
|
36
|
+
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.14",
|
|
37
|
+
"@getpara/evm-wallet-connectors": "2.0.0-alpha.14",
|
|
38
|
+
"@getpara/solana-wallet-connectors": "2.0.0-alpha.14",
|
|
39
39
|
"@testing-library/dom": "^10.4.0",
|
|
40
40
|
"@testing-library/react": "^16.3.0",
|
|
41
41
|
"@testing-library/react-hooks": "^8.0.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"resolutions": {
|
|
64
64
|
"styled-components": "^6"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "03898846281bf37536a6ed12dede119e6171ad45"
|
|
67
67
|
}
|