@getpara/react-sdk-lite 2.0.0-alpha.40 → 2.0.0-alpha.42

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.
@@ -42,6 +42,7 @@ const AccountHeader = ({ withBalance = false } = {}) => {
42
42
  size: "48px",
43
43
  inset: "8px",
44
44
  border: "1px solid var(--cpsl-color-background-8)",
45
+ color: "var(--cpsl-color-foreground-0)",
45
46
  radius: "theme",
46
47
  icon,
47
48
  src
@@ -6,7 +6,7 @@ import {
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { AccountTypeIcon, GradientScroll, StepContainer, WalletTypeIcon } from "../common.js";
8
8
  import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
9
- import { useClient } from "../../../provider/index.js";
9
+ import { useAccount, useClient } from "../../../provider/index.js";
10
10
  import { useLinkedAccounts } from "../../../provider/hooks/index.js";
11
11
  import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
12
12
  import { truncateAddress } from "@getpara/web-sdk";
@@ -53,6 +53,7 @@ const AccountProfile = ({
53
53
  }) => {
54
54
  var _a, _b, _c, _d, _e, _f;
55
55
  const para = useClient();
56
+ const { connectionType, embedded } = useAccount();
56
57
  const { data: linkedAccounts } = useLinkedAccounts();
57
58
  const { wallets } = useExternalWallets();
58
59
  const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
@@ -81,7 +82,7 @@ const AccountProfile = ({
81
82
  ] }),
82
83
  /* @__PURE__ */ jsxs(Section, { children: [
83
84
  /* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Connected Wallets" }),
84
- /* @__PURE__ */ jsx(Content, { children: externalWallet ? /* @__PURE__ */ jsx(
85
+ /* @__PURE__ */ jsx(Content, { children: externalWallet && connectionType === "external" ? /* @__PURE__ */ jsx(
85
86
  Entry,
86
87
  {
87
88
  icon: /* @__PURE__ */ jsx(
@@ -114,10 +115,9 @@ const AccountProfile = ({
114
115
  isEnabled && /* @__PURE__ */ jsxs(Section, { children: [
115
116
  /* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Linked Accounts" }),
116
117
  /* @__PURE__ */ jsxs(Content, { children: [
117
- /* @__PURE__ */ jsx(GradientScroll, { gap: "12px", height: "360px", children: [
118
- ...((linkedAccounts == null ? void 0 : linkedAccounts.primary) || []).map((p) => __spreadProps(__spreadValues({}, p), { isPrimary: true })),
119
- ...(linkedAccounts == null ? void 0 : linkedAccounts.linked) || []
120
- ].map((linkedAccount) => {
118
+ /* @__PURE__ */ jsx(GradientScroll, { gap: "12px", height: "360px", children: [...((linkedAccounts == null ? void 0 : linkedAccounts.primary) || []).map((p) => __spreadProps(__spreadValues({}, p), { isPrimary: true })), ...(linkedAccounts == null ? void 0 : linkedAccounts.linked) || []].filter(({ externalWallet: externalWallet2 }) => {
119
+ return !externalWallet2 || externalWallet2.address !== (embedded == null ? void 0 : embedded.externalWalletAddress);
120
+ }).map((linkedAccount) => {
121
121
  var _a2, _b2, _c2, _d2, _e2;
122
122
  const { identifier, displayName, type, isPrimary = false, externalWallet: externalWallet2 } = linkedAccount;
123
123
  const externalWalletConnector = wallets.find((wallet) => wallet.id === (externalWallet2 == null ? void 0 : externalWallet2.providerId));
@@ -37,7 +37,9 @@ function AccountProfileLink() {
37
37
  } = useTelegramLogin(
38
38
  isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink } : { isActive: false }
39
39
  ), status = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.isComplete) ? "success" : isTelegram ? telegramStatus : linkAccountStatus, commonWallet = useMemo(() => {
40
- const wallet = wallets.find((w) => w.internalId === externalWalletProvider && w.type === externalWalletType);
40
+ const wallet = wallets.find(
41
+ (w) => [w.name, w.internalId, w.id].includes(externalWalletProvider != null ? externalWalletProvider : "") && w.type === externalWalletType
42
+ );
41
43
  return wallet;
42
44
  }, [wallets]), walletDisplayHelpers = useWalletDisplayHelpers(commonWallet);
43
45
  const { upper, lower } = useMemo(() => {
@@ -24,7 +24,7 @@ const ExternalWalletNetworkSelectStep = () => {
24
24
  const firstWallet = availableWallets[0];
25
25
  const handleWalletClick = (wallet) => () => {
26
26
  if (accountLinkInProgress) {
27
- linkAccount({ externalWallet: { provider: wallet.id } });
27
+ linkAccount({ externalWallet: { provider: wallet.id, type: wallet.type } });
28
28
  return;
29
29
  }
30
30
  setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
@@ -209,7 +209,17 @@ function AccountTypeIcon({
209
209
  return ((_b = (_a2 = state.modalConfig) == null ? void 0 : _a2.theme) == null ? void 0 : _b.mode) === "dark";
210
210
  });
211
211
  const data = accountType ? ACCOUNT_TYPES[accountType] : null;
212
- return data || src ? /* @__PURE__ */ jsx(CpslIcon, { size, inset, icon: (_a = data == null ? void 0 : data.iconBranded) != null ? _a : data == null ? void 0 : data.icon, src, invert: isDark && (data == null ? void 0 : data.isDark) }) : null;
212
+ return data || src ? /* @__PURE__ */ jsx(
213
+ CpslIcon,
214
+ {
215
+ size,
216
+ inset,
217
+ icon: (_a = data == null ? void 0 : data.iconBranded) != null ? _a : data == null ? void 0 : data.icon,
218
+ color: (data == null ? void 0 : data.isPlain) ? "var(--cpsl-color-text-contrast)" : void 0,
219
+ src,
220
+ invert: isDark && (data == null ? void 0 : data.isDark)
221
+ }
222
+ ) : null;
213
223
  }
214
224
  function HeroAccountTypeIcon({ accountType, src }) {
215
225
  if (accountType === "EMAIL" || accountType === "PHONE") {
@@ -126,7 +126,7 @@ const BODY_MOTION_VARIANTS = {
126
126
  const BODY_TRANSITION = {
127
127
  duration: 0.2
128
128
  };
129
- const SDK_VERSION = "2.0.0-alpha.40";
129
+ const SDK_VERSION = "2.0.0-alpha.42";
130
130
  export {
131
131
  BODY_MOTION_VARIANTS,
132
132
  BODY_TRANSITION,
@@ -5,19 +5,19 @@ const ACCOUNT_TYPES = {
5
5
  icon: "mail",
6
6
  name: "Email",
7
7
  inlineText: "email address",
8
- isDark: true
8
+ isPlain: true
9
9
  },
10
10
  "PHONE": {
11
11
  icon: "phone",
12
12
  name: "Phone",
13
13
  inlineText: "phone number",
14
- isDark: true
14
+ isPlain: true
15
15
  },
16
16
  "EXTERNAL_WALLET": {
17
17
  icon: "wallet",
18
18
  name: "External Wallet",
19
19
  inlineText: "external wallet",
20
- isDark: true
20
+ isPlain: true
21
21
  },
22
22
  "GOOGLE": {
23
23
  icon: "google",
@@ -11,4 +11,5 @@ export type DisplayMetadata = {
11
11
  iconBranded?: IconType;
12
12
  isDark?: boolean;
13
13
  isCircular?: boolean;
14
+ isPlain?: boolean;
14
15
  };
@@ -1,3 +1,4 @@
1
+ import { Compute } from '../../types/utils.js';
1
2
  export declare const VERIFY_EXTERNAL_WALLET_KEY = "VERIFY_EXTERNAL_WALLET";
2
3
  /**
3
4
  * React hook for the `verifyExternalWallet` mutation.
@@ -15,22 +16,7 @@ export declare const VERIFY_EXTERNAL_WALLET_KEY = "VERIFY_EXTERNAL_WALLET";
15
16
  */
16
17
  export declare const useVerifyExternalWallet: () => {
17
18
  status: "error" | "idle" | "pending" | "success";
18
- data: {
19
- username?: string | undefined;
20
- displayName?: string | undefined;
21
- pfpUrl?: string | undefined;
22
- externalWallet?: import("@getpara/web-sdk").ExternalWalletInfo | undefined;
23
- auth: import("@getpara/user-management-client").PrimaryAuth;
24
- userId: string;
25
- stage: "signup";
26
- isPasskeySupported: boolean;
27
- passkeyUrl?: string | undefined;
28
- passwordUrl?: string | undefined;
29
- pinUrl?: string | undefined;
30
- passkeyId?: string | undefined;
31
- passwordId?: string | undefined;
32
- pinId?: string | undefined;
33
- } | undefined;
19
+ data: Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin> | undefined;
34
20
  isSuccess: boolean;
35
21
  variables: {
36
22
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
@@ -50,22 +36,7 @@ export declare const useVerifyExternalWallet: () => {
50
36
  failureReason: Error | null;
51
37
  isPaused: boolean;
52
38
  submittedAt: number;
53
- verifyExternalWallet: import("@tanstack/react-query").UseMutateFunction<{
54
- username?: string | undefined;
55
- displayName?: string | undefined;
56
- pfpUrl?: string | undefined;
57
- externalWallet?: import("@getpara/web-sdk").ExternalWalletInfo | undefined;
58
- auth: import("@getpara/user-management-client").PrimaryAuth;
59
- userId: string;
60
- stage: "signup";
61
- isPasskeySupported: boolean;
62
- passkeyUrl?: string | undefined;
63
- passwordUrl?: string | undefined;
64
- pinUrl?: string | undefined;
65
- passkeyId?: string | undefined;
66
- passwordId?: string | undefined;
67
- pinId?: string | undefined;
68
- }, Error, {
39
+ verifyExternalWallet: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin>, Error, {
69
40
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
70
41
  useShortUrls?: boolean | undefined;
71
42
  externalWallet: import("@getpara/web-sdk").ExternalWalletInfo;
@@ -73,22 +44,7 @@ export declare const useVerifyExternalWallet: () => {
73
44
  cosmosPublicKeyHex?: string | undefined;
74
45
  cosmosSigner?: string | undefined;
75
46
  }, unknown>;
76
- verifyExternalWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
77
- username?: string | undefined;
78
- displayName?: string | undefined;
79
- pfpUrl?: string | undefined;
80
- externalWallet?: import("@getpara/web-sdk").ExternalWalletInfo | undefined;
81
- auth: import("@getpara/user-management-client").PrimaryAuth;
82
- userId: string;
83
- stage: "signup";
84
- isPasskeySupported: boolean;
85
- passkeyUrl?: string | undefined;
86
- passwordUrl?: string | undefined;
87
- pinUrl?: string | undefined;
88
- passkeyId?: string | undefined;
89
- passwordId?: string | undefined;
90
- pinId?: string | undefined;
91
- }, Error, {
47
+ verifyExternalWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin>, Error, {
92
48
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
93
49
  useShortUrls?: boolean | undefined;
94
50
  externalWallet: import("@getpara/web-sdk").ExternalWalletInfo;
@@ -20,6 +20,7 @@ import { generateInternalMutation } from "../hooks/mutations/utils.js";
20
20
  import { validateAuth } from "../../modal/utils/authInputHelpers.js";
21
21
  import { EXTERNAL_WALLET_TYPES, extractAuthInfo } from "@getpara/user-management-client";
22
22
  import { useStore } from "../stores/useStore.js";
23
+ import { LINKED_ACCOUNTS_BASE_KEY } from "../hooks/queries/useLinkedAccounts.js";
23
24
  const AccountLinkContext = createContext({
24
25
  isEnabled: false,
25
26
  accountLinkInProgress: void 0,
@@ -66,10 +67,10 @@ const useVerifyFarcasterLink = generateInternalMutation("verifyFarcasterLink", a
66
67
  const useVerifyTelegramLink = generateInternalMutation("verifyTelegramLink", actions.verifyTelegramLink);
67
68
  const useVerifyExternalWalletLink = generateInternalMutation("verifyExternalWalletLink", actions.verifyExternalWalletLink);
68
69
  const AccountLinkProvider = ({ children }) => {
69
- var _a;
70
+ var _a, _b, _c;
70
71
  const para = useInternalClient();
71
72
  const queryClient = useQueryClient();
72
- const { embedded } = useAccount();
73
+ const account = useAccount();
73
74
  const { data: coreAccountLinkInProgress } = useAccountLinkInProgress();
74
75
  const {
75
76
  wallet: connectedWallet,
@@ -87,6 +88,7 @@ const AccountLinkProvider = ({ children }) => {
87
88
  const externalWalletError = useModalStore((state) => state.externalWalletError);
88
89
  const accountLinkOptions = useModalStore((state) => state.accountLinkOptions) || [...LINKED_ACCOUNT_TYPES];
89
90
  const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
91
+ const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
90
92
  const goBack = useGoBack();
91
93
  const { mutateAsync: mutateLinkAccountAsync, isPending: isLinkAccountPending } = useLinkAccount();
92
94
  const { mutate: mutateUnlinkAccount, isPending: isUnlinkAccountPending } = useUnlinkAccount();
@@ -111,7 +113,8 @@ const AccountLinkProvider = ({ children }) => {
111
113
  status: statusVerifyExternalWalletLink,
112
114
  reset: resetVerifyExternalWalletLink
113
115
  } = useVerifyExternalWalletLink();
114
- const isEnabled = !!(embedded == null ? void 0 : embedded.isConnected) && !(embedded == null ? void 0 : embedded.isGuestMode) && (!((_a = para.authInfo) == null ? void 0 : _a.externalWallet) || includeWalletVerification);
116
+ const { embedded } = account;
117
+ const isEnabled = (embedded == null ? void 0 : embedded.isConnected) || !(embedded == null ? void 0 : embedded.isGuestMode) && (!((_a = para.authInfo) == null ? void 0 : _a.externalWallet) || includeWalletVerification || externalWalletsWithFullAuth.includes((_c = (_b = para.authInfo) == null ? void 0 : _b.externalWallet) == null ? void 0 : _c.providerId));
115
118
  const [accountLinkInProgress, setAccountLinkInProgress] = useState(
116
119
  coreAccountLinkInProgress || void 0
117
120
  );
@@ -187,7 +190,7 @@ const AccountLinkProvider = ({ children }) => {
187
190
  yield onAccountLinkVerified(updatedAccounts);
188
191
  } catch (e) {
189
192
  console.error(e);
190
- setLinkAccountError(`Error authenticating external wallet: ${e.message}`);
193
+ setLinkAccountError(e.message);
191
194
  } finally {
192
195
  if (linkWallet.type === "EVM" || linkWallet.type === "SOLANA") {
193
196
  yield disconnectBase(providerId, linkWallet.type);
@@ -314,6 +317,7 @@ const AccountLinkProvider = ({ children }) => {
314
317
  }
315
318
  };
316
319
  const onAccountLinkVerified = (updatedAccounts) => {
320
+ queryClient.invalidateQueries({ queryKey: [LINKED_ACCOUNTS_BASE_KEY] });
317
321
  queryClient.setQueryData(["getLinkedAccounts"], () => updatedAccounts);
318
322
  setTimeout(() => {
319
323
  setStep(ModalStep.ACCOUNT_PROFILE);
@@ -317,7 +317,11 @@ function AuthProvider({
317
317
  }
318
318
  break;
319
319
  case "login":
320
- login(authState);
320
+ if (authState.pinUrl && authState.signatureVerificationMessage) {
321
+ setStep(ModalStep.EXTERNAL_WALLET_VERIFICATION);
322
+ } else {
323
+ login(authState);
324
+ }
321
325
  break;
322
326
  case "signup":
323
327
  {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.40",
3
+ "version": "2.0.0-alpha.42",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.40",
9
- "@getpara/react-components": "2.0.0-alpha.40",
10
- "@getpara/web-sdk": "2.0.0-alpha.40",
8
+ "@getpara/react-common": "2.0.0-alpha.42",
9
+ "@getpara/react-components": "2.0.0-alpha.42",
10
+ "@getpara/web-sdk": "2.0.0-alpha.42",
11
11
  "date-fns": "^3.6.0",
12
12
  "framer-motion": "^11.3.31",
13
13
  "libphonenumber-js": "^1.11.7",
@@ -16,9 +16,9 @@
16
16
  "zustand-sync-tabs": "^0.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.40",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.40",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.40",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.42",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.42",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.42",
22
22
  "@tanstack/react-query": "^5.74.0",
23
23
  "@testing-library/dom": "^10.4.0",
24
24
  "@testing-library/react": "^16.3.0",
@@ -38,7 +38,7 @@
38
38
  "package.json",
39
39
  "styles.css"
40
40
  ],
41
- "gitHead": "2506044cd3ed127774fb7d537ae850b43acfe8b7",
41
+ "gitHead": "6f44dc050550a1f567088c81b3ae06c7f1f8ebcb",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",