@getpara/react-sdk 1.15.1 → 1.17.0
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 +44 -31
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +2 -2
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +6 -2
- package/dist/modal/constants/constants.js +1 -1
- package/dist/modal/providers/ExternalWalletContext.d.ts +2 -2
- package/dist/modal/providers/ExternalWalletContext.js +3 -3
- package/dist/modal/types/externalWallets.d.ts +3 -1
- package/dist/modal/types/externalWallets.js +1 -0
- package/dist/modal/types/modalProps.d.ts +8 -0
- package/package.json +5 -5
package/dist/modal/ParaModal.js
CHANGED
|
@@ -26,7 +26,7 @@ import { SDK_VERSION } from "./constants/constants.js";
|
|
|
26
26
|
defineCustomElements();
|
|
27
27
|
const ParaModal = forwardRef(
|
|
28
28
|
(_a, ref) => {
|
|
29
|
-
var _b = _a, { para, isOpen, externalWalletsWithParaAuth, rpcUrl: rpcUrlFromProps } = _b, rest = __objRest(_b, ["para", "isOpen", "externalWalletsWithParaAuth", "rpcUrl"]);
|
|
29
|
+
var _b = _a, { para, isOpen, createLinkedEmbeddedForExternalWallets, externalWalletsWithParaAuth, rpcUrl: rpcUrlFromProps } = _b, rest = __objRest(_b, ["para", "isOpen", "createLinkedEmbeddedForExternalWallets", "externalWalletsWithParaAuth", "rpcUrl"]);
|
|
30
30
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
31
31
|
const setClient = useStore((state) => state.setClient);
|
|
32
32
|
const client = useStore((state) => state.client);
|
|
@@ -38,10 +38,7 @@ const ParaModal = forwardRef(
|
|
|
38
38
|
const trackAnalytics = () => __async(void 0, null, function* () {
|
|
39
39
|
try {
|
|
40
40
|
yield para.ctx.client.trackReactSdkAnalytics({
|
|
41
|
-
props: __spreadValues({
|
|
42
|
-
externalWalletsWithParaAuth,
|
|
43
|
-
rpcUrlFromProps
|
|
44
|
-
}, rest),
|
|
41
|
+
props: __spreadValues({ externalWalletsWithParaAuth, createLinkedEmbeddedForExternalWallets, rpcUrlFromProps }, rest),
|
|
45
42
|
reactSdkVersion: SDK_VERSION
|
|
46
43
|
});
|
|
47
44
|
} catch (_) {
|
|
@@ -50,8 +47,10 @@ const ParaModal = forwardRef(
|
|
|
50
47
|
trackAnalytics();
|
|
51
48
|
}, []);
|
|
52
49
|
useEffect(() => {
|
|
53
|
-
updateExternalWalletProviderState({
|
|
54
|
-
|
|
50
|
+
updateExternalWalletProviderState({
|
|
51
|
+
fullAuthWallets: createLinkedEmbeddedForExternalWallets || externalWalletsWithParaAuth
|
|
52
|
+
});
|
|
53
|
+
}, [createLinkedEmbeddedForExternalWallets, externalWalletsWithParaAuth]);
|
|
55
54
|
useEffect(() => {
|
|
56
55
|
if (!client) {
|
|
57
56
|
setClient(para);
|
|
@@ -74,7 +73,14 @@ const ParaModal = forwardRef(
|
|
|
74
73
|
if (!isInitialized) {
|
|
75
74
|
return null;
|
|
76
75
|
}
|
|
77
|
-
return /* @__PURE__ */ jsx(
|
|
76
|
+
return /* @__PURE__ */ jsx(
|
|
77
|
+
ParaModalInner,
|
|
78
|
+
__spreadValues({
|
|
79
|
+
ref,
|
|
80
|
+
para,
|
|
81
|
+
createLinkedEmbeddedForExternalWallets: createLinkedEmbeddedForExternalWallets || externalWalletsWithParaAuth
|
|
82
|
+
}, rest)
|
|
83
|
+
);
|
|
78
84
|
}
|
|
79
85
|
);
|
|
80
86
|
const ParaModalInner = forwardRef(
|
|
@@ -95,7 +101,7 @@ const ParaModalInner = forwardRef(
|
|
|
95
101
|
onModalStepChange,
|
|
96
102
|
hideWallets = false,
|
|
97
103
|
onClose,
|
|
98
|
-
|
|
104
|
+
createLinkedEmbeddedForExternalWallets
|
|
99
105
|
} = _d, rest = __objRest(_d, [
|
|
100
106
|
"theme",
|
|
101
107
|
"appName",
|
|
@@ -112,7 +118,7 @@ const ParaModalInner = forwardRef(
|
|
|
112
118
|
"onModalStepChange",
|
|
113
119
|
"hideWallets",
|
|
114
120
|
"onClose",
|
|
115
|
-
"
|
|
121
|
+
"createLinkedEmbeddedForExternalWallets"
|
|
116
122
|
]);
|
|
117
123
|
const modalContentRef = useRef(null);
|
|
118
124
|
const updateThemeState = useThemeStore((state) => state.updateState);
|
|
@@ -337,30 +343,37 @@ const ParaModalInner = forwardRef(
|
|
|
337
343
|
}
|
|
338
344
|
return null;
|
|
339
345
|
}
|
|
340
|
-
return /* @__PURE__ */ jsx(
|
|
341
|
-
|
|
346
|
+
return /* @__PURE__ */ jsx(
|
|
347
|
+
ExternalWalletsWrapper,
|
|
342
348
|
{
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
349
|
+
wallets: externalWallets,
|
|
350
|
+
createLinkedEmbeddedForExternalWallets,
|
|
351
|
+
children: /* @__PURE__ */ jsx(
|
|
352
|
+
StyledAuthModal,
|
|
353
|
+
{
|
|
354
|
+
enterTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
355
|
+
exitTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
356
|
+
open: isOpen,
|
|
357
|
+
onCpslModalExited: handleModalExited,
|
|
358
|
+
onCpslModalEntering: handleModalEntering,
|
|
359
|
+
onCpslModalRequestClose: handleClose,
|
|
360
|
+
noOverlay: bareModal,
|
|
361
|
+
className,
|
|
362
|
+
"data-testid": "modal",
|
|
363
|
+
$embeddedModal: embeddedModal,
|
|
364
|
+
children: isModalMounted && (isInit && embeddedModal || !embeddedModal) && /* @__PURE__ */ jsx(
|
|
365
|
+
ModalContent,
|
|
366
|
+
__spreadValues({
|
|
367
|
+
oAuthMethods,
|
|
368
|
+
disableEmailLogin,
|
|
369
|
+
disablePhoneLogin,
|
|
370
|
+
onClose: handleClose
|
|
371
|
+
}, rest)
|
|
372
|
+
)
|
|
373
|
+
}
|
|
361
374
|
)
|
|
362
375
|
}
|
|
363
|
-
)
|
|
376
|
+
);
|
|
364
377
|
}
|
|
365
378
|
);
|
|
366
379
|
const StyledAuthModal = styled(CpslAuthModal)`
|
|
@@ -2,7 +2,7 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { TExternalWallet } from '../../types/externalWallets.js';
|
|
3
3
|
interface ExternalWalletsWrapperProps extends PropsWithChildren {
|
|
4
4
|
wallets?: TExternalWallet[];
|
|
5
|
-
|
|
5
|
+
createLinkedEmbeddedForExternalWallets?: TExternalWallet[];
|
|
6
6
|
}
|
|
7
|
-
export declare const ExternalWalletsWrapper: ({ children, wallets,
|
|
7
|
+
export declare const ExternalWalletsWrapper: ({ children, wallets, createLinkedEmbeddedForExternalWallets, }: ExternalWalletsWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -21,7 +21,11 @@ import {
|
|
|
21
21
|
import { useModalStore, useUserInfoStore } from "../../stores/index.js";
|
|
22
22
|
import { useExternalWalletProviderStore } from "../../stores/externalWalletProvider/useExternalWalletProviderStore.js";
|
|
23
23
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
24
|
-
const ExternalWalletsWrapper = ({
|
|
24
|
+
const ExternalWalletsWrapper = ({
|
|
25
|
+
children,
|
|
26
|
+
wallets,
|
|
27
|
+
createLinkedEmbeddedForExternalWallets
|
|
28
|
+
}) => {
|
|
25
29
|
const para = useInternalClient();
|
|
26
30
|
const resetModalState = useModalStore((state) => state.resetState);
|
|
27
31
|
const resetUserInfoState = useUserInfoStore((state) => state.resetState);
|
|
@@ -114,7 +118,7 @@ const ExternalWalletsWrapper = ({ children, wallets, externalWalletsWithFullAuth
|
|
|
114
118
|
solanaContext,
|
|
115
119
|
cosmosContext,
|
|
116
120
|
walletSort: wallets,
|
|
117
|
-
|
|
121
|
+
createLinkedEmbeddedForExternalWallets,
|
|
118
122
|
children
|
|
119
123
|
}
|
|
120
124
|
) }) }) });
|
|
@@ -59,9 +59,9 @@ interface ExternalWalletProviderProps {
|
|
|
59
59
|
evmContext: Context<EvmExternalWalletContextType>;
|
|
60
60
|
solanaContext: Context<SolanaExternalWalletContextType>;
|
|
61
61
|
cosmosContext: Context<CosmosExternalWalletContextType>;
|
|
62
|
-
|
|
62
|
+
createLinkedEmbeddedForExternalWallets?: TExternalWallet[];
|
|
63
63
|
}
|
|
64
|
-
export declare function ExternalWalletProvider({ children, evmContext, solanaContext, cosmosContext, walletSort,
|
|
64
|
+
export declare function ExternalWalletProvider({ children, evmContext, solanaContext, cosmosContext, walletSort, createLinkedEmbeddedForExternalWallets, }: ExternalWalletProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
65
65
|
export declare const useExternalWallets: () => {
|
|
66
66
|
wallets: CommonWallet[];
|
|
67
67
|
chains: CommonChain[];
|
|
@@ -41,7 +41,7 @@ function ExternalWalletProvider({
|
|
|
41
41
|
solanaContext,
|
|
42
42
|
cosmosContext,
|
|
43
43
|
walletSort,
|
|
44
|
-
|
|
44
|
+
createLinkedEmbeddedForExternalWallets
|
|
45
45
|
}) {
|
|
46
46
|
const {
|
|
47
47
|
wallets: evmWallets,
|
|
@@ -283,7 +283,7 @@ function ExternalWalletProvider({
|
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
} else if (address) {
|
|
286
|
-
if (!para.externalWalletConnectionOnly && (
|
|
286
|
+
if (!para.externalWalletConnectionOnly && (createLinkedEmbeddedForExternalWallets == null ? void 0 : createLinkedEmbeddedForExternalWallets.includes(wallet2.id.toUpperCase()))) {
|
|
287
287
|
yield completeFullAuth(address, wallet2.type, userExists, isVerified, bufferAddress);
|
|
288
288
|
} else {
|
|
289
289
|
setStep(ModalStep.LOGIN_DONE);
|
|
@@ -292,7 +292,7 @@ function ExternalWalletProvider({
|
|
|
292
292
|
setIsExternalWalletConnecting(false);
|
|
293
293
|
}
|
|
294
294
|
}),
|
|
295
|
-
[isExternalWalletConnecting,
|
|
295
|
+
[isExternalWalletConnecting, createLinkedEmbeddedForExternalWallets]
|
|
296
296
|
);
|
|
297
297
|
const disconnectExternalWallet = () => __async(this, null, function* () {
|
|
298
298
|
yield para.logout();
|
|
@@ -11,7 +11,8 @@ export declare enum EvmWallet {
|
|
|
11
11
|
export declare enum SolanaWallet {
|
|
12
12
|
PHANTOM = "PHANTOM",
|
|
13
13
|
GLOW = "GLOW",
|
|
14
|
-
BACKPACK = "BACKPACK"
|
|
14
|
+
BACKPACK = "BACKPACK",
|
|
15
|
+
SOLFLARE = "SOLFLARE"
|
|
15
16
|
}
|
|
16
17
|
export declare enum CosmosWallet {
|
|
17
18
|
KEPLR = "KEPLR",
|
|
@@ -23,6 +24,7 @@ export declare const ExternalWallet: {
|
|
|
23
24
|
PHANTOM: SolanaWallet.PHANTOM;
|
|
24
25
|
GLOW: SolanaWallet.GLOW;
|
|
25
26
|
BACKPACK: SolanaWallet.BACKPACK;
|
|
27
|
+
SOLFLARE: SolanaWallet.SOLFLARE;
|
|
26
28
|
METAMASK: EvmWallet.METAMASK;
|
|
27
29
|
RAINBOW: EvmWallet.RAINBOW;
|
|
28
30
|
COINBASE: EvmWallet.COINBASE;
|
|
@@ -17,6 +17,7 @@ var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
|
|
|
17
17
|
SolanaWallet2["PHANTOM"] = "PHANTOM";
|
|
18
18
|
SolanaWallet2["GLOW"] = "GLOW";
|
|
19
19
|
SolanaWallet2["BACKPACK"] = "BACKPACK";
|
|
20
|
+
SolanaWallet2["SOLFLARE"] = "SOLFLARE";
|
|
20
21
|
return SolanaWallet2;
|
|
21
22
|
})(SolanaWallet || {});
|
|
22
23
|
var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
|
|
@@ -117,11 +117,19 @@ export interface ParaModalProps {
|
|
|
117
117
|
*/
|
|
118
118
|
externalWallets?: TExternalWallet[];
|
|
119
119
|
/**
|
|
120
|
+
* @deprecated Use `createLinkedEmbeddedForExternalWallets` instead.
|
|
121
|
+
*
|
|
120
122
|
* Which external wallets to include full Para authentication for.
|
|
121
123
|
*
|
|
122
124
|
* These wallets should also be included in the externalWallets list in order to be displayed in the modal.
|
|
123
125
|
*/
|
|
124
126
|
externalWalletsWithParaAuth?: TExternalWallet[];
|
|
127
|
+
/**
|
|
128
|
+
* Which external wallets to include full Para authentication for.
|
|
129
|
+
*
|
|
130
|
+
* These wallets should also be included in the externalWallets list in order to be displayed in the modal.
|
|
131
|
+
*/
|
|
132
|
+
createLinkedEmbeddedForExternalWallets?: TExternalWallet[];
|
|
125
133
|
/**
|
|
126
134
|
* How the modal should order the components on the main auth screen.
|
|
127
135
|
* Only the first method of each type (auth or external) will be used.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"*.css"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@getpara/react-common": "1.
|
|
16
|
-
"@getpara/react-components": "1.
|
|
17
|
-
"@getpara/web-sdk": "1.
|
|
15
|
+
"@getpara/react-common": "1.17.0",
|
|
16
|
+
"@getpara/react-components": "1.17.0",
|
|
17
|
+
"@getpara/web-sdk": "1.17.0",
|
|
18
18
|
"@tanstack/react-query": "^5.0.0",
|
|
19
19
|
"date-fns": "^3.6.0",
|
|
20
20
|
"framer-motion": "11.3.28",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"resolutions": {
|
|
52
52
|
"styled-components": "^6"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "857cb45a49040c475fa7431f36134b0d5cb630f5"
|
|
55
55
|
}
|