@getpara/react-sdk 1.4.4-dev.1 → 1.4.4

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 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
@@ -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(DEFAULT_COUNTRY);
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((cc) => cc.value === newIdentifier);
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
- if (["AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */, "AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */].includes(currentStep) && (webAuthURLForLogin || passwordUrlForLogin)) {
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 useMemo13 } from "react";
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: useMemo13(
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 useMemo14 } from "react";
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: useMemo14(() => ({ wallets, disconnect }), [wallets, disconnect]), children });
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 useMemo15 } from "react";
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: useMemo15(
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.4.4-dev.1",
3
+ "version": "1.4.4",
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.4.3",
16
- "@getpara/react-components": "1.4.3",
17
- "@getpara/web-sdk": "1.4.3",
15
+ "@getpara/react-common": "1.4.4",
16
+ "@getpara/react-components": "1.4.4",
17
+ "@getpara/web-sdk": "1.4.4",
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": "e6e791d4e4f9afd94f2093d6045d686b85e5a682"
52
+ "gitHead": "9a4086c4b352fff2143d3b931d288c5ebaf127fb"
53
53
  }