@getpara/react-sdk-lite 2.0.0-alpha.50 → 2.0.0-alpha.52

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.
@@ -17,6 +17,7 @@ import { AnimatePresence } from "framer-motion";
17
17
  import { AddFundsSettings } from "./AddFundsSettings.js";
18
18
  import { WalletSelectOld } from "../WalletSelectOld/WalletSelectOld.js";
19
19
  const AddFunds = () => {
20
+ var _a;
20
21
  const step = useModalStore((state) => state.step);
21
22
  const onRampConfig = useModalStore((state) => state.onRampConfig);
22
23
  const onRampStep = useModalStore((state) => state.onRampStep);
@@ -26,11 +27,10 @@ const AddFunds = () => {
26
27
  const { data: activeWallet } = useWallet();
27
28
  const { embedded } = useAccount();
28
29
  const isGuestMode = (embedded == null ? void 0 : embedded.isConnected) && embedded.isGuestMode;
29
- console.log(onRampConfig);
30
30
  const tabs = TABS.filter(
31
31
  ([enabledFlow, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (!isGuestMode || enabledFlow === EnabledFlow.RECEIVE)
32
32
  );
33
- const tab = storedTab != null ? storedTab : tabs[0][0];
33
+ const tab = storedTab != null ? storedTab : (_a = tabs[0]) == null ? void 0 : _a[0];
34
34
  const isMultiFlow = (tab === EnabledFlow.BUY || tab === EnabledFlow.RECEIVE) && (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) && (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled);
35
35
  const onSetTab = (event) => {
36
36
  setModalStep(getAddFundsStep(event.detail.tab));
@@ -53,7 +53,7 @@ const AddFunds = () => {
53
53
  useEffect(() => {
54
54
  setOnRampPurchase(void 0);
55
55
  }, []);
56
- if (!onRampConfig || !activeWallet) {
56
+ if (!onRampConfig || !activeWallet || !tab) {
57
57
  return /* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, {}) });
58
58
  }
59
59
  return /* @__PURE__ */ jsxs(StepContainer, { children: [
@@ -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.48";
129
+ const SDK_VERSION = "2.0.0-alpha.52";
130
130
  export {
131
131
  BODY_MOTION_VARIANTS,
132
132
  BODY_TRANSITION,
@@ -88,9 +88,7 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
88
88
  console.warn("createLinkedEmbeddedForExternalWallets has no effect when using connection only external wallets");
89
89
  setExternalWalletsWithFullAuth([]);
90
90
  } else {
91
- setExternalWalletsWithFullAuth(
92
- (externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) === "ALL" ? [...EXTERNAL_WALLET_TYPES] : (_b = externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) != null ? _b : []
93
- );
91
+ setExternalWalletsWithFullAuth((_b = externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) != null ? _b : []);
94
92
  }
95
93
  }
96
94
  }, [externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets]);
@@ -114,7 +114,7 @@ const AccountLinkProvider = ({ children }) => {
114
114
  reset: resetVerifyExternalWalletLink
115
115
  } = useVerifyExternalWalletLink();
116
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));
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 === "ALL" || externalWalletsWithFullAuth.includes((_c = (_b = para.authInfo) == null ? void 0 : _b.externalWallet) == null ? void 0 : _c.providerId));
118
118
  const [accountLinkInProgress, setAccountLinkInProgress] = useState(
119
119
  coreAccountLinkInProgress || void 0
120
120
  );
@@ -124,11 +124,11 @@ function ExternalWalletProvider({ children }) {
124
124
  (w) => (w.internalId !== "FARCASTER" || (para == null ? void 0 : para.isFarcasterMiniApp)) && externalWallets.includes(w.internalId)
125
125
  ).sort(
126
126
  (a, b) => externalWallets.indexOf(a.internalId) - externalWallets.indexOf(b.internalId)
127
- ).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
127
+ );
128
128
  const injectedWallets = allWallets.filter(
129
129
  (w) => (w == null ? void 0 : w.id) !== "Para" && !wallets.some((wallet2) => wallet2.id === w.id) && w.installed
130
130
  );
131
- wallets = [...wallets, ...injectedWallets];
131
+ wallets = [...wallets, ...injectedWallets].sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
132
132
  const wallet = useMemo(
133
133
  () => wallets.find((w) => w.id === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.id) && w.type === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.type)),
134
134
  [wallets, selectedExternalWallet]
@@ -147,6 +147,15 @@ function ExternalWalletProvider({ children }) {
147
147
  setQrUri(void 0);
148
148
  }
149
149
  }, [wallet]);
150
+ const isWithFullAuth = (wallet2) => {
151
+ if (connectionOnly) {
152
+ return false;
153
+ }
154
+ if (externalWalletsWithFullAuth === "ALL") {
155
+ return true;
156
+ }
157
+ return !!wallet2.name && externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase());
158
+ };
150
159
  const getWalletBalance = useCallback(() => __async(this, null, function* () {
151
160
  var _a;
152
161
  const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
@@ -237,14 +246,13 @@ function ExternalWalletProvider({ children }) {
237
246
  [evmSwitchChain, cosmosSwitchChain]
238
247
  );
239
248
  const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
240
- var _a;
241
249
  setExternalWalletError();
242
250
  const wallet2 = Object.values(para.externalWallets)[0];
243
251
  const walletType = wallet2 == null ? void 0 : wallet2.type;
244
252
  let verifyExternalWalletParams;
245
253
  const withVerification = includeWalletVerification;
246
254
  const isConnectionOnly = connectionOnly;
247
- const withFullParaAuth = (wallet2 == null ? void 0 : wallet2.name) ? externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase()) : false;
255
+ const withFullParaAuth = (wallet2 == null ? void 0 : wallet2.name) ? isWithFullAuth(wallet2) : false;
248
256
  const defaultWalletInfo = {
249
257
  withVerification,
250
258
  isConnectionOnly,
@@ -322,7 +330,7 @@ function ExternalWalletProvider({ children }) {
322
330
  try {
323
331
  const d = yield verifyExternalWalletAsync(verifyExternalWalletParams);
324
332
  yield queryClient.refetchQueries({ queryKey: [IS_FULLY_LOGGED_IN_BASE_KEY] });
325
- if (wallet2 && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes((_a = wallet2.name) == null ? void 0 : _a.toUpperCase()))) {
333
+ if (wallet2 && isWithFullAuth(wallet2)) {
326
334
  yield onNewAuthState(d);
327
335
  } else {
328
336
  setStep(ModalStep.LOGIN_DONE);
@@ -412,7 +420,7 @@ function ExternalWalletProvider({ children }) {
412
420
  return;
413
421
  }
414
422
  } else if (address) {
415
- if (!!authState && ((externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase())) || includeWalletVerification)) {
423
+ if (!!authState && (isWithFullAuth(wallet2) || includeWalletVerification)) {
416
424
  onNewAuthState(authState);
417
425
  } else {
418
426
  setStep(ModalStep.LOGIN_DONE);
@@ -53,8 +53,8 @@ export interface ExternalWalletsSlice {
53
53
  setConnectionOnly: (_: boolean) => void;
54
54
  includeWalletVerification: boolean;
55
55
  setIncludeWalletVerification: (_: boolean) => void;
56
- externalWalletsWithFullAuth: TExternalWallet[];
57
- setExternalWalletsWithFullAuth: (_: TExternalWallet[]) => void;
56
+ externalWalletsWithFullAuth: TExternalWallet[] | 'ALL';
57
+ setExternalWalletsWithFullAuth: (_: TExternalWallet[] | 'ALL') => void;
58
58
  evmLib: typeof paraEvmLib | undefined;
59
59
  setEvmLib: (_: typeof paraEvmLib) => void;
60
60
  evmContext: Context<EvmExternalWalletContextType>;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.50",
3
+ "version": "2.0.0-alpha.52",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.50",
9
- "@getpara/react-components": "2.0.0-alpha.50",
10
- "@getpara/web-sdk": "2.0.0-alpha.50",
8
+ "@getpara/react-common": "2.0.0-alpha.52",
9
+ "@getpara/react-components": "2.0.0-alpha.52",
10
+ "@getpara/web-sdk": "2.0.0-alpha.52",
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.50",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.50",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.50",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.52",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.52",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.52",
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": "688b92a7ca207593a4a3be09cb5cc580092614fc",
41
+ "gitHead": "a63dba8c230e9ff2d73b275d3e40091b93aecf1c",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",