@getpara/react-sdk 1.4.4-dev.1 → 1.5.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/index.js +34 -18
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
import { CpslAuthModal, defineCustomElements, generateTheme } from "@getpara/react-components";
|
|
5
5
|
|
|
6
6
|
// src/modal/components/ModalContent/ModalContent.tsx
|
|
7
|
-
import { forwardRef, useEffect as useEffect22, useImperativeHandle, useState as useState17 } from "react";
|
|
7
|
+
import { forwardRef, useEffect as useEffect22, useImperativeHandle, useMemo as useMemo13, useState as useState17 } from "react";
|
|
8
8
|
import {
|
|
9
9
|
entityToWallet,
|
|
10
10
|
OnRampProvider as OnRampProvider4,
|
|
11
11
|
OnRampAsset as OnRampAsset3,
|
|
12
12
|
Network as Network3,
|
|
13
|
-
EnabledFlow as EnabledFlow3
|
|
13
|
+
EnabledFlow as EnabledFlow3,
|
|
14
|
+
isPasskeySupported as isPasskeySupported3
|
|
14
15
|
} from "@getpara/web-sdk";
|
|
15
16
|
|
|
16
17
|
// src/modal/stores/modal/useModalStore.ts
|
|
@@ -1749,7 +1750,7 @@ var LoginDoneStep = ({ onClose }) => {
|
|
|
1749
1750
|
return /* @__PURE__ */ jsxs5(StepContainer, { children: [
|
|
1750
1751
|
/* @__PURE__ */ jsx5(HeroIcon, { icon: "checkCircleFilled" }),
|
|
1751
1752
|
/* @__PURE__ */ jsx5(Heading, { variant: "headingS", weight: "bold", children: "Connected" }),
|
|
1752
|
-
!hideWallets && /* @__PURE__ */ jsx5(WalletCards, { children: para.isUsingExternalWallet() ? /* @__PURE__ */ jsx5(ExternalWalletCard, { address: para.
|
|
1753
|
+
!hideWallets && /* @__PURE__ */ jsx5(WalletCards, { children: para.isUsingExternalWallet() ? /* @__PURE__ */ jsx5(ExternalWalletCard, { address: Object.values(para.externalWallets || {})[0]?.address }) : para.currentWalletIdsArray.map(([id, type]) => {
|
|
1753
1754
|
return /* @__PURE__ */ jsx5(WalletCard, { id, type }, `${id}-${type}`);
|
|
1754
1755
|
}) })
|
|
1755
1756
|
] });
|
|
@@ -2075,7 +2076,7 @@ function ExternalWalletProvider({
|
|
|
2075
2076
|
}
|
|
2076
2077
|
}, [wallet]);
|
|
2077
2078
|
const chains = useMemo2(() => {
|
|
2078
|
-
const walletType = para.externalWallets[
|
|
2079
|
+
const walletType = Object.values(para.externalWallets || {})[0]?.type;
|
|
2079
2080
|
switch (walletType) {
|
|
2080
2081
|
case WalletType2.COSMOS: {
|
|
2081
2082
|
return cosmosChains;
|
|
@@ -2089,7 +2090,7 @@ function ExternalWalletProvider({
|
|
|
2089
2090
|
}
|
|
2090
2091
|
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
2091
2092
|
const chainId = useMemo2(() => {
|
|
2092
|
-
const walletType = para.externalWallets[
|
|
2093
|
+
const walletType = Object.values(para.externalWallets || {})[0]?.type;
|
|
2093
2094
|
switch (walletType) {
|
|
2094
2095
|
case WalletType2.COSMOS: {
|
|
2095
2096
|
return cosmosChainId;
|
|
@@ -2104,7 +2105,7 @@ function ExternalWalletProvider({
|
|
|
2104
2105
|
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
2105
2106
|
const switchChain = useCallback(
|
|
2106
2107
|
async (chainId2) => {
|
|
2107
|
-
const walletType = para.externalWallets[
|
|
2108
|
+
const walletType = Object.values(para.externalWallets || {})[0]?.type;
|
|
2108
2109
|
if (walletType) {
|
|
2109
2110
|
let resp;
|
|
2110
2111
|
setExternalWalletError();
|
|
@@ -2183,7 +2184,7 @@ function ExternalWalletProvider({
|
|
|
2183
2184
|
};
|
|
2184
2185
|
const username = useMemo2(() => {
|
|
2185
2186
|
let username2;
|
|
2186
|
-
const storedExternalWallet = para.externalWallets[
|
|
2187
|
+
const storedExternalWallet = Object.values(para.externalWallets || {})[0];
|
|
2187
2188
|
if (storedExternalWallet) {
|
|
2188
2189
|
const walletType = storedExternalWallet?.type;
|
|
2189
2190
|
switch (walletType) {
|
|
@@ -2200,7 +2201,7 @@ function ExternalWalletProvider({
|
|
|
2200
2201
|
return username2;
|
|
2201
2202
|
}, [evmUsername, wallet]);
|
|
2202
2203
|
const avatar = useMemo2(() => {
|
|
2203
|
-
const walletType = para.externalWallets[
|
|
2204
|
+
const walletType = Object.values(para.externalWallets || {})[0]?.type;
|
|
2204
2205
|
if (walletType) {
|
|
2205
2206
|
switch (walletType) {
|
|
2206
2207
|
case WalletType2.EVM: {
|
|
@@ -3749,6 +3750,9 @@ var phoneMasks = {
|
|
|
3749
3750
|
import { AuthMethod as AuthMethod5 } from "@getpara/web-sdk";
|
|
3750
3751
|
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3751
3752
|
var DEFAULT_COUNTRY = { label: "United States", value: "+1", selectedLabel: "US", icon: "US" };
|
|
3753
|
+
function isCcMatch(countryCode, option) {
|
|
3754
|
+
return countryCode === "+1" ? option.selectedLabel === "US" : option.value === countryCode;
|
|
3755
|
+
}
|
|
3752
3756
|
var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
3753
3757
|
const inputRef = useRef5(null);
|
|
3754
3758
|
const { dropdownMaxHeight, dropdownWidth } = useDropdownPosition(inputRef);
|
|
@@ -3760,7 +3764,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3760
3764
|
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
3761
3765
|
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
3762
3766
|
const [countryCode, setCountryCode] = useState11(
|
|
3763
|
-
authInfo?.authType === "phone" ? authInfo.auth.countryCode : "+1"
|
|
3767
|
+
authInfo?.authType === "phone" ? authInfo.auth.countryCode || "+1" : "+1"
|
|
3764
3768
|
);
|
|
3765
3769
|
const [identifier, setIdentifier] = useState11(
|
|
3766
3770
|
(() => {
|
|
@@ -3776,7 +3780,9 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3776
3780
|
const [identifierType, setIdentifierType] = useState11(
|
|
3777
3781
|
authInfo && (authInfo.authType === "email" || authInfo.authType === "phone") ? authInfo.authType : void 0
|
|
3778
3782
|
);
|
|
3779
|
-
const [matchedCountryCode, setMatchedCountryCode] = useState11(
|
|
3783
|
+
const [matchedCountryCode, setMatchedCountryCode] = useState11(
|
|
3784
|
+
countryCodes_default.find((option) => isCcMatch(countryCode, option)) ?? DEFAULT_COUNTRY
|
|
3785
|
+
);
|
|
3780
3786
|
const [isLoggingIn, setIsLoggingIn] = useState11(false);
|
|
3781
3787
|
const [error, setError] = useState11("");
|
|
3782
3788
|
const [search, setSearch] = useState11("");
|
|
@@ -3793,7 +3799,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3793
3799
|
const newIdentifier = ev.detail.value;
|
|
3794
3800
|
let isNewPhone = false, isNewEmail = false;
|
|
3795
3801
|
if (!disablePhoneLogin) {
|
|
3796
|
-
const countryCodeInputMatch = countryCodes_default.find((
|
|
3802
|
+
const countryCodeInputMatch = countryCodes_default.find((option) => isCcMatch(newIdentifier, option));
|
|
3797
3803
|
if (countryCodeInputMatch) {
|
|
3798
3804
|
setCountryCode(countryCodeInputMatch.value);
|
|
3799
3805
|
setMatchedCountryCode(countryCodeInputMatch);
|
|
@@ -5422,6 +5428,7 @@ var useEmbeddedExternalConnection = () => {
|
|
|
5422
5428
|
};
|
|
5423
5429
|
|
|
5424
5430
|
// src/modal/components/ModalContent/ModalContent.tsx
|
|
5431
|
+
import { formatBiometricHints as formatBiometricHints2 } from "@getpara/react-common";
|
|
5425
5432
|
import { Fragment as Fragment21, jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5426
5433
|
function isRampConfig(config) {
|
|
5427
5434
|
return "hostApiKey" in config;
|
|
@@ -5476,6 +5483,10 @@ var ModalContent = forwardRef(
|
|
|
5476
5483
|
const isIFrameReady = useModalStore((state) => state.isIFrameReady);
|
|
5477
5484
|
const goBack = useGoBack();
|
|
5478
5485
|
const createAccount = useCreateAccount();
|
|
5486
|
+
const biometricLocationHints = useModalStore((state) => state.biometricLocationHints ?? []);
|
|
5487
|
+
const formattedHints = useMemo13(() => formatBiometricHints2(biometricLocationHints), [biometricLocationHints]);
|
|
5488
|
+
const passkeysSupported = isPasskeySupported3();
|
|
5489
|
+
const [hasHints, isOnKnownDevice] = [biometricLocationHints?.length > 0, formattedHints?.isOnKnownDevice ?? false];
|
|
5479
5490
|
const [walletCreationInProgress, setWalletCreationInProgress] = useState17(false);
|
|
5480
5491
|
const connectEmbeddedToExternalConnectors = useEmbeddedExternalConnection();
|
|
5481
5492
|
useEffect22(() => {
|
|
@@ -5571,7 +5582,12 @@ var ModalContent = forwardRef(
|
|
|
5571
5582
|
genWallet();
|
|
5572
5583
|
}, [isLogin, currentStep]);
|
|
5573
5584
|
useEffect22(() => {
|
|
5574
|
-
|
|
5585
|
+
const isAwaitingLogin = ["AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */, "AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */].includes(currentStep);
|
|
5586
|
+
const isUnknownDeviceWithHints = hasHints && !isOnKnownDevice;
|
|
5587
|
+
const isPasskeyUnsupported = !passkeysSupported;
|
|
5588
|
+
const hasLoginURLs = webAuthURLForLogin || passwordUrlForLogin;
|
|
5589
|
+
const userNeedsToLogin = isAwaitingLogin || isUnknownDeviceWithHints || isPasskeyUnsupported;
|
|
5590
|
+
if (userNeedsToLogin && hasLoginURLs) {
|
|
5575
5591
|
if (loginTransitionOverride) {
|
|
5576
5592
|
async function loginOverride() {
|
|
5577
5593
|
await loginTransitionOverride(para);
|
|
@@ -5691,7 +5707,7 @@ import { ParaEvent as ParaEvent2 } from "@getpara/web-sdk";
|
|
|
5691
5707
|
import { useEffect as useEffect23, useState as useState18 } from "react";
|
|
5692
5708
|
|
|
5693
5709
|
// src/modal/providers/EvmExternalWalletContextStub.tsx
|
|
5694
|
-
import { createContext as createContext2, useMemo as
|
|
5710
|
+
import { createContext as createContext2, useMemo as useMemo14 } from "react";
|
|
5695
5711
|
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
5696
5712
|
var defaultEvmExternalWallet = {
|
|
5697
5713
|
wallets: [],
|
|
@@ -5714,7 +5730,7 @@ function EvmExternalWalletProvider({ children }) {
|
|
|
5714
5730
|
return /* @__PURE__ */ jsx40(
|
|
5715
5731
|
EvmExternalWalletContext.Provider,
|
|
5716
5732
|
{
|
|
5717
|
-
value:
|
|
5733
|
+
value: useMemo14(
|
|
5718
5734
|
() => ({ wallets, chains, chainId, username, avatar, disconnect, switchChain }),
|
|
5719
5735
|
[wallets, chains, chainId, username, avatar, disconnect, switchChain]
|
|
5720
5736
|
),
|
|
@@ -5751,7 +5767,7 @@ var ExternalWallet = {
|
|
|
5751
5767
|
};
|
|
5752
5768
|
|
|
5753
5769
|
// src/modal/providers/SolanaExternalWalletContextStub.tsx
|
|
5754
|
-
import { createContext as createContext3, useMemo as
|
|
5770
|
+
import { createContext as createContext3, useMemo as useMemo15 } from "react";
|
|
5755
5771
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
5756
5772
|
var defaultSolanaExternalWallet = {
|
|
5757
5773
|
wallets: [],
|
|
@@ -5761,11 +5777,11 @@ var SolanaExternalWalletContext = createContext3(defaultSolanaExternalWallet);
|
|
|
5761
5777
|
function SolanaExternalWalletProvider({ children }) {
|
|
5762
5778
|
const wallets = [];
|
|
5763
5779
|
const disconnect = () => Promise.resolve();
|
|
5764
|
-
return /* @__PURE__ */ jsx41(SolanaExternalWalletContext.Provider, { value:
|
|
5780
|
+
return /* @__PURE__ */ jsx41(SolanaExternalWalletContext.Provider, { value: useMemo15(() => ({ wallets, disconnect }), [wallets, disconnect]), children });
|
|
5765
5781
|
}
|
|
5766
5782
|
|
|
5767
5783
|
// src/modal/providers/CosmosExternalWalletContextStub.tsx
|
|
5768
|
-
import { createContext as createContext4, useMemo as
|
|
5784
|
+
import { createContext as createContext4, useMemo as useMemo16 } from "react";
|
|
5769
5785
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
5770
5786
|
var defaultCosmosExternalWallet = {
|
|
5771
5787
|
wallets: [],
|
|
@@ -5784,7 +5800,7 @@ function CosmosExternalWalletProvider({ children }) {
|
|
|
5784
5800
|
return /* @__PURE__ */ jsx42(
|
|
5785
5801
|
CosmosExternalWalletContext.Provider,
|
|
5786
5802
|
{
|
|
5787
|
-
value:
|
|
5803
|
+
value: useMemo16(
|
|
5788
5804
|
() => ({ wallets, chains, chainId, disconnect, switchChain }),
|
|
5789
5805
|
[wallets, chains, chainId, disconnect, switchChain]
|
|
5790
5806
|
),
|
package/dist/index.js.br
CHANGED
|
Binary file
|
package/dist/index.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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.5.0",
|
|
16
|
+
"@getpara/react-components": "1.5.0",
|
|
17
|
+
"@getpara/web-sdk": "1.5.0",
|
|
18
18
|
"@tanstack/react-query": "^5.0.0",
|
|
19
19
|
"date-fns": "^3.6.0",
|
|
20
20
|
"framer-motion": "11.3.28",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"resolutions": {
|
|
50
50
|
"styled-components": "^6"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "0e3c1401b4f1da60b288cdde7695077c9bcbc48f"
|
|
53
53
|
}
|