@unifold/connect-react 0.1.50 → 0.1.51

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
@@ -6767,11 +6767,13 @@ function useUserIp() {
6767
6767
  queryKey: ["unifold", "userIpInfo"],
6768
6768
  queryFn: async () => {
6769
6769
  const data = await getIpAddress();
6770
+ const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
6770
6771
  return {
6771
6772
  alpha2: data.alpha2.toLowerCase(),
6772
6773
  alpha3: data.alpha3?.toLowerCase(),
6773
6774
  country: data.country,
6774
- state: data.state?.toLowerCase() ?? null,
6775
+ state: subdivision,
6776
+ subdivisionCode: subdivision,
6775
6777
  ipAddress: data.ip_address
6776
6778
  };
6777
6779
  },
@@ -12264,11 +12266,13 @@ function useUserIp2() {
12264
12266
  queryKey: ["unifold", "userIpInfo"],
12265
12267
  queryFn: async () => {
12266
12268
  const data = await getIpAddress();
12269
+ const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
12267
12270
  return {
12268
12271
  alpha2: data.alpha2.toLowerCase(),
12269
12272
  alpha3: data.alpha3?.toLowerCase(),
12270
12273
  country: data.country,
12271
- state: data.state?.toLowerCase() ?? null,
12274
+ state: subdivision,
12275
+ subdivisionCode: subdivision,
12272
12276
  ipAddress: data.ip_address
12273
12277
  };
12274
12278
  },
@@ -13574,7 +13578,7 @@ function BuyWithCard({
13574
13578
  const response = await getDefaultOnrampToken(
13575
13579
  {
13576
13580
  country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
13577
- subdivision_code: userIpInfo?.state || void 0,
13581
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
13578
13582
  token_address: destinationTokenAddress,
13579
13583
  chain_id: destinationChainId,
13580
13584
  chain_type: destinationChainType
@@ -13657,7 +13661,7 @@ function BuyWithCard({
13657
13661
  source_currency: currency.toLowerCase(),
13658
13662
  destination_currency: defaultToken.destination_currency,
13659
13663
  destination_network: defaultToken.destination_network,
13660
- subdivision_code: userIpInfo?.state || void 0
13664
+ subdivision_code: userIpInfo?.subdivisionCode || void 0
13661
13665
  };
13662
13666
  const response = await getOnrampQuotes(request, publishableKey);
13663
13667
  setQuotes(response.data);
@@ -13764,7 +13768,7 @@ function BuyWithCard({
13764
13768
  destination_currency: selectedProvider.destination_currency,
13765
13769
  destination_network: selectedProvider.destination_network,
13766
13770
  wallet_address: wallet.address,
13767
- subdivision_code: userIpInfo?.state || void 0,
13771
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
13768
13772
  external_id: externalId
13769
13773
  };
13770
13774
  const sessionStartUrl = getOnrampSessionStartUrl(
@@ -17794,10 +17798,12 @@ function useAllowedCountry(publishableKey) {
17794
17798
  });
17795
17799
  isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
17796
17800
  }
17801
+ const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
17797
17802
  return {
17798
17803
  isAllowed,
17799
17804
  alpha2: ipData?.alpha2?.toLowerCase() ?? null,
17800
17805
  country: ipData?.country ?? null,
17806
+ subdivisionCode,
17801
17807
  isLoading,
17802
17808
  error
17803
17809
  };
package/dist/index.mjs CHANGED
@@ -6740,11 +6740,13 @@ function useUserIp() {
6740
6740
  queryKey: ["unifold", "userIpInfo"],
6741
6741
  queryFn: async () => {
6742
6742
  const data = await getIpAddress();
6743
+ const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
6743
6744
  return {
6744
6745
  alpha2: data.alpha2.toLowerCase(),
6745
6746
  alpha3: data.alpha3?.toLowerCase(),
6746
6747
  country: data.country,
6747
- state: data.state?.toLowerCase() ?? null,
6748
+ state: subdivision,
6749
+ subdivisionCode: subdivision,
6748
6750
  ipAddress: data.ip_address
6749
6751
  };
6750
6752
  },
@@ -12250,11 +12252,13 @@ function useUserIp2() {
12250
12252
  queryKey: ["unifold", "userIpInfo"],
12251
12253
  queryFn: async () => {
12252
12254
  const data = await getIpAddress();
12255
+ const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
12253
12256
  return {
12254
12257
  alpha2: data.alpha2.toLowerCase(),
12255
12258
  alpha3: data.alpha3?.toLowerCase(),
12256
12259
  country: data.country,
12257
- state: data.state?.toLowerCase() ?? null,
12260
+ state: subdivision,
12261
+ subdivisionCode: subdivision,
12258
12262
  ipAddress: data.ip_address
12259
12263
  };
12260
12264
  },
@@ -13560,7 +13564,7 @@ function BuyWithCard({
13560
13564
  const response = await getDefaultOnrampToken(
13561
13565
  {
13562
13566
  country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
13563
- subdivision_code: userIpInfo?.state || void 0,
13567
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
13564
13568
  token_address: destinationTokenAddress,
13565
13569
  chain_id: destinationChainId,
13566
13570
  chain_type: destinationChainType
@@ -13643,7 +13647,7 @@ function BuyWithCard({
13643
13647
  source_currency: currency.toLowerCase(),
13644
13648
  destination_currency: defaultToken.destination_currency,
13645
13649
  destination_network: defaultToken.destination_network,
13646
- subdivision_code: userIpInfo?.state || void 0
13650
+ subdivision_code: userIpInfo?.subdivisionCode || void 0
13647
13651
  };
13648
13652
  const response = await getOnrampQuotes(request, publishableKey);
13649
13653
  setQuotes(response.data);
@@ -13750,7 +13754,7 @@ function BuyWithCard({
13750
13754
  destination_currency: selectedProvider.destination_currency,
13751
13755
  destination_network: selectedProvider.destination_network,
13752
13756
  wallet_address: wallet.address,
13753
- subdivision_code: userIpInfo?.state || void 0,
13757
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
13754
13758
  external_id: externalId
13755
13759
  };
13756
13760
  const sessionStartUrl = getOnrampSessionStartUrl(
@@ -17780,10 +17784,12 @@ function useAllowedCountry(publishableKey) {
17780
17784
  });
17781
17785
  isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
17782
17786
  }
17787
+ const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
17783
17788
  return {
17784
17789
  isAllowed,
17785
17790
  alpha2: ipData?.alpha2?.toLowerCase() ?? null,
17786
17791
  country: ipData?.country ?? null,
17792
+ subdivisionCode,
17787
17793
  isLoading,
17788
17794
  error
17789
17795
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/connect-react",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "Unifold Connect React - Complete React SDK with UI components for crypto deposits",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@tanstack/react-query": "^5.90.11",
29
- "@unifold/core": "0.1.50",
30
- "@unifold/react-provider": "0.1.50",
31
- "@unifold/ui-react": "0.1.50"
29
+ "@unifold/core": "0.1.51",
30
+ "@unifold/ui-react": "0.1.51",
31
+ "@unifold/react-provider": "0.1.51"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/react": "^19.0.0",