@unifold/ui-web 0.1.50 → 0.1.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.
package/dist/index.js CHANGED
@@ -48906,11 +48906,13 @@ function useUserIp2() {
48906
48906
  queryKey: ["unifold", "userIpInfo"],
48907
48907
  queryFn: async () => {
48908
48908
  const data = await getIpAddress();
48909
+ const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
48909
48910
  return {
48910
48911
  alpha2: data.alpha2.toLowerCase(),
48911
48912
  alpha3: data.alpha3?.toLowerCase(),
48912
48913
  country: data.country,
48913
- state: data.state?.toLowerCase() ?? null,
48914
+ state: subdivision,
48915
+ subdivisionCode: subdivision,
48914
48916
  ipAddress: data.ip_address
48915
48917
  };
48916
48918
  },
@@ -50216,7 +50218,7 @@ function BuyWithCard({
50216
50218
  const response = await getDefaultOnrampToken(
50217
50219
  {
50218
50220
  country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
50219
- subdivision_code: userIpInfo?.state || void 0,
50221
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
50220
50222
  token_address: destinationTokenAddress,
50221
50223
  chain_id: destinationChainId,
50222
50224
  chain_type: destinationChainType
@@ -50299,7 +50301,7 @@ function BuyWithCard({
50299
50301
  source_currency: currency.toLowerCase(),
50300
50302
  destination_currency: defaultToken.destination_currency,
50301
50303
  destination_network: defaultToken.destination_network,
50302
- subdivision_code: userIpInfo?.state || void 0
50304
+ subdivision_code: userIpInfo?.subdivisionCode || void 0
50303
50305
  };
50304
50306
  const response = await getOnrampQuotes(request, publishableKey);
50305
50307
  setQuotes(response.data);
@@ -50406,7 +50408,7 @@ function BuyWithCard({
50406
50408
  destination_currency: selectedProvider.destination_currency,
50407
50409
  destination_network: selectedProvider.destination_network,
50408
50410
  wallet_address: wallet.address,
50409
- subdivision_code: userIpInfo?.state || void 0,
50411
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
50410
50412
  external_id: externalId
50411
50413
  };
50412
50414
  const sessionStartUrl = getOnrampSessionStartUrl(
@@ -54106,8 +54108,11 @@ function BrowserWalletButton({
54106
54108
  solanaProvider.off("accountChanged", handleAccountsChanged);
54107
54109
  }
54108
54110
  for (const provider of ethProviders) {
54109
- provider.removeListener("accountsChanged", handleEthAccountsChanged);
54110
- provider.removeListener("chainChanged", handleAccountsChanged);
54111
+ const off = provider.off?.bind(provider) ?? provider.removeListener?.bind(provider);
54112
+ if (off) {
54113
+ off("accountsChanged", handleEthAccountsChanged);
54114
+ off("chainChanged", handleAccountsChanged);
54115
+ }
54111
54116
  }
54112
54117
  };
54113
54118
  }, [chainType, eip6963ProviderCount]);
@@ -54436,10 +54441,12 @@ function useAllowedCountry(publishableKey) {
54436
54441
  });
54437
54442
  isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
54438
54443
  }
54444
+ const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
54439
54445
  return {
54440
54446
  isAllowed,
54441
54447
  alpha2: ipData?.alpha2?.toLowerCase() ?? null,
54442
54448
  country: ipData?.country ?? null,
54449
+ subdivisionCode,
54443
54450
  isLoading,
54444
54451
  error
54445
54452
  };
package/dist/index.mjs CHANGED
@@ -48893,11 +48893,13 @@ function useUserIp2() {
48893
48893
  queryKey: ["unifold", "userIpInfo"],
48894
48894
  queryFn: async () => {
48895
48895
  const data = await getIpAddress();
48896
+ const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
48896
48897
  return {
48897
48898
  alpha2: data.alpha2.toLowerCase(),
48898
48899
  alpha3: data.alpha3?.toLowerCase(),
48899
48900
  country: data.country,
48900
- state: data.state?.toLowerCase() ?? null,
48901
+ state: subdivision,
48902
+ subdivisionCode: subdivision,
48901
48903
  ipAddress: data.ip_address
48902
48904
  };
48903
48905
  },
@@ -50203,7 +50205,7 @@ function BuyWithCard({
50203
50205
  const response = await getDefaultOnrampToken(
50204
50206
  {
50205
50207
  country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
50206
- subdivision_code: userIpInfo?.state || void 0,
50208
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
50207
50209
  token_address: destinationTokenAddress,
50208
50210
  chain_id: destinationChainId,
50209
50211
  chain_type: destinationChainType
@@ -50286,7 +50288,7 @@ function BuyWithCard({
50286
50288
  source_currency: currency.toLowerCase(),
50287
50289
  destination_currency: defaultToken.destination_currency,
50288
50290
  destination_network: defaultToken.destination_network,
50289
- subdivision_code: userIpInfo?.state || void 0
50291
+ subdivision_code: userIpInfo?.subdivisionCode || void 0
50290
50292
  };
50291
50293
  const response = await getOnrampQuotes(request, publishableKey);
50292
50294
  setQuotes(response.data);
@@ -50393,7 +50395,7 @@ function BuyWithCard({
50393
50395
  destination_currency: selectedProvider.destination_currency,
50394
50396
  destination_network: selectedProvider.destination_network,
50395
50397
  wallet_address: wallet.address,
50396
- subdivision_code: userIpInfo?.state || void 0,
50398
+ subdivision_code: userIpInfo?.subdivisionCode || void 0,
50397
50399
  external_id: externalId
50398
50400
  };
50399
50401
  const sessionStartUrl = getOnrampSessionStartUrl(
@@ -54093,8 +54095,11 @@ function BrowserWalletButton({
54093
54095
  solanaProvider.off("accountChanged", handleAccountsChanged);
54094
54096
  }
54095
54097
  for (const provider of ethProviders) {
54096
- provider.removeListener("accountsChanged", handleEthAccountsChanged);
54097
- provider.removeListener("chainChanged", handleAccountsChanged);
54098
+ const off = provider.off?.bind(provider) ?? provider.removeListener?.bind(provider);
54099
+ if (off) {
54100
+ off("accountsChanged", handleEthAccountsChanged);
54101
+ off("chainChanged", handleAccountsChanged);
54102
+ }
54098
54103
  }
54099
54104
  };
54100
54105
  }, [chainType, eip6963ProviderCount]);
@@ -54423,10 +54428,12 @@ function useAllowedCountry(publishableKey) {
54423
54428
  });
54424
54429
  isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
54425
54430
  }
54431
+ const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
54426
54432
  return {
54427
54433
  isAllowed,
54428
54434
  alpha2: ipData?.alpha2?.toLowerCase() ?? null,
54429
54435
  country: ipData?.country ?? null,
54436
+ subdivisionCode,
54430
54437
  isLoading,
54431
54438
  error
54432
54439
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/ui-web",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Unifold UI Web - Framework-agnostic deposit widget",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -30,10 +30,10 @@
30
30
  "@types/react-dom": "^19.0.0",
31
31
  "tsup": "^8.0.0",
32
32
  "typescript": "^5.0.0",
33
- "@unifold/connect-react": "0.1.50",
34
- "@unifold/ui-react": "0.1.50",
35
- "@unifold/react-provider": "0.1.50",
36
- "@unifold/core": "0.1.50"
33
+ "@unifold/connect-react": "0.1.52",
34
+ "@unifold/core": "0.1.52",
35
+ "@unifold/ui-react": "0.1.52",
36
+ "@unifold/react-provider": "0.1.52"
37
37
  },
38
38
  "keywords": [
39
39
  "unifold",