@unifold/ui-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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -4
- package/dist/index.mjs +8 -4
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -773,12 +773,14 @@ declare const TooltipContent: React$1.ForwardRefExoticComponent<Omit<TooltipPrim
|
|
|
773
773
|
* Result of the useAllowedCountry hook
|
|
774
774
|
*/
|
|
775
775
|
interface AllowedCountryResult {
|
|
776
|
-
/** Whether the user is in an allowed country. null while loading. */
|
|
776
|
+
/** Whether the user is in an allowed country/subdivision. null while loading. */
|
|
777
777
|
isAllowed: boolean | null;
|
|
778
778
|
/** ISO 3166-1 alpha-2 country code in lowercase (e.g., "us", "pt") */
|
|
779
779
|
alpha2: string | null;
|
|
780
780
|
/** Full country name (e.g., "United States", "Portugal") */
|
|
781
781
|
country: string | null;
|
|
782
|
+
/** ISO 3166-2 subdivision code in lowercase (e.g., "ny", "43"), null if unavailable */
|
|
783
|
+
subdivisionCode: string | null;
|
|
782
784
|
/** Whether the hook is still loading data */
|
|
783
785
|
isLoading: boolean;
|
|
784
786
|
/** Error if either API call failed */
|
package/dist/index.d.ts
CHANGED
|
@@ -773,12 +773,14 @@ declare const TooltipContent: React$1.ForwardRefExoticComponent<Omit<TooltipPrim
|
|
|
773
773
|
* Result of the useAllowedCountry hook
|
|
774
774
|
*/
|
|
775
775
|
interface AllowedCountryResult {
|
|
776
|
-
/** Whether the user is in an allowed country. null while loading. */
|
|
776
|
+
/** Whether the user is in an allowed country/subdivision. null while loading. */
|
|
777
777
|
isAllowed: boolean | null;
|
|
778
778
|
/** ISO 3166-1 alpha-2 country code in lowercase (e.g., "us", "pt") */
|
|
779
779
|
alpha2: string | null;
|
|
780
780
|
/** Full country name (e.g., "United States", "Portugal") */
|
|
781
781
|
country: string | null;
|
|
782
|
+
/** ISO 3166-2 subdivision code in lowercase (e.g., "ny", "43"), null if unavailable */
|
|
783
|
+
subdivisionCode: string | null;
|
|
782
784
|
/** Whether the hook is still loading data */
|
|
783
785
|
isLoading: boolean;
|
|
784
786
|
/** Error if either API call failed */
|
package/dist/index.js
CHANGED
|
@@ -1327,11 +1327,13 @@ function useUserIp() {
|
|
|
1327
1327
|
queryKey: ["unifold", "userIpInfo"],
|
|
1328
1328
|
queryFn: async () => {
|
|
1329
1329
|
const data = await (0, import_core5.getIpAddress)();
|
|
1330
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
1330
1331
|
return {
|
|
1331
1332
|
alpha2: data.alpha2.toLowerCase(),
|
|
1332
1333
|
alpha3: data.alpha3?.toLowerCase(),
|
|
1333
1334
|
country: data.country,
|
|
1334
|
-
state:
|
|
1335
|
+
state: subdivision,
|
|
1336
|
+
subdivisionCode: subdivision,
|
|
1335
1337
|
ipAddress: data.ip_address
|
|
1336
1338
|
};
|
|
1337
1339
|
},
|
|
@@ -2668,7 +2670,7 @@ function BuyWithCard({
|
|
|
2668
2670
|
const response = await (0, import_core9.getDefaultOnrampToken)(
|
|
2669
2671
|
{
|
|
2670
2672
|
country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
|
|
2671
|
-
subdivision_code: userIpInfo?.
|
|
2673
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
2672
2674
|
token_address: destinationTokenAddress,
|
|
2673
2675
|
chain_id: destinationChainId,
|
|
2674
2676
|
chain_type: destinationChainType
|
|
@@ -2751,7 +2753,7 @@ function BuyWithCard({
|
|
|
2751
2753
|
source_currency: currency.toLowerCase(),
|
|
2752
2754
|
destination_currency: defaultToken.destination_currency,
|
|
2753
2755
|
destination_network: defaultToken.destination_network,
|
|
2754
|
-
subdivision_code: userIpInfo?.
|
|
2756
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0
|
|
2755
2757
|
};
|
|
2756
2758
|
const response = await (0, import_core9.getOnrampQuotes)(request, publishableKey);
|
|
2757
2759
|
setQuotes(response.data);
|
|
@@ -2858,7 +2860,7 @@ function BuyWithCard({
|
|
|
2858
2860
|
destination_currency: selectedProvider.destination_currency,
|
|
2859
2861
|
destination_network: selectedProvider.destination_network,
|
|
2860
2862
|
wallet_address: wallet.address,
|
|
2861
|
-
subdivision_code: userIpInfo?.
|
|
2863
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
2862
2864
|
external_id: externalId
|
|
2863
2865
|
};
|
|
2864
2866
|
const sessionStartUrl = (0, import_core9.getOnrampSessionStartUrl)(
|
|
@@ -7008,10 +7010,12 @@ function useAllowedCountry(publishableKey) {
|
|
|
7008
7010
|
});
|
|
7009
7011
|
isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
|
|
7010
7012
|
}
|
|
7013
|
+
const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
|
|
7011
7014
|
return {
|
|
7012
7015
|
isAllowed,
|
|
7013
7016
|
alpha2: ipData?.alpha2?.toLowerCase() ?? null,
|
|
7014
7017
|
country: ipData?.country ?? null,
|
|
7018
|
+
subdivisionCode,
|
|
7015
7019
|
isLoading,
|
|
7016
7020
|
error
|
|
7017
7021
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1236,11 +1236,13 @@ function useUserIp() {
|
|
|
1236
1236
|
queryKey: ["unifold", "userIpInfo"],
|
|
1237
1237
|
queryFn: async () => {
|
|
1238
1238
|
const data = await getIpAddress();
|
|
1239
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
1239
1240
|
return {
|
|
1240
1241
|
alpha2: data.alpha2.toLowerCase(),
|
|
1241
1242
|
alpha3: data.alpha3?.toLowerCase(),
|
|
1242
1243
|
country: data.country,
|
|
1243
|
-
state:
|
|
1244
|
+
state: subdivision,
|
|
1245
|
+
subdivisionCode: subdivision,
|
|
1244
1246
|
ipAddress: data.ip_address
|
|
1245
1247
|
};
|
|
1246
1248
|
},
|
|
@@ -2591,7 +2593,7 @@ function BuyWithCard({
|
|
|
2591
2593
|
const response = await getDefaultOnrampToken(
|
|
2592
2594
|
{
|
|
2593
2595
|
country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
|
|
2594
|
-
subdivision_code: userIpInfo?.
|
|
2596
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
2595
2597
|
token_address: destinationTokenAddress,
|
|
2596
2598
|
chain_id: destinationChainId,
|
|
2597
2599
|
chain_type: destinationChainType
|
|
@@ -2674,7 +2676,7 @@ function BuyWithCard({
|
|
|
2674
2676
|
source_currency: currency.toLowerCase(),
|
|
2675
2677
|
destination_currency: defaultToken.destination_currency,
|
|
2676
2678
|
destination_network: defaultToken.destination_network,
|
|
2677
|
-
subdivision_code: userIpInfo?.
|
|
2679
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0
|
|
2678
2680
|
};
|
|
2679
2681
|
const response = await getOnrampQuotes(request, publishableKey);
|
|
2680
2682
|
setQuotes(response.data);
|
|
@@ -2781,7 +2783,7 @@ function BuyWithCard({
|
|
|
2781
2783
|
destination_currency: selectedProvider.destination_currency,
|
|
2782
2784
|
destination_network: selectedProvider.destination_network,
|
|
2783
2785
|
wallet_address: wallet.address,
|
|
2784
|
-
subdivision_code: userIpInfo?.
|
|
2786
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
2785
2787
|
external_id: externalId
|
|
2786
2788
|
};
|
|
2787
2789
|
const sessionStartUrl = getOnrampSessionStartUrl(
|
|
@@ -6944,10 +6946,12 @@ function useAllowedCountry(publishableKey) {
|
|
|
6944
6946
|
});
|
|
6945
6947
|
isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
|
|
6946
6948
|
}
|
|
6949
|
+
const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
|
|
6947
6950
|
return {
|
|
6948
6951
|
isAllowed,
|
|
6949
6952
|
alpha2: ipData?.alpha2?.toLowerCase() ?? null,
|
|
6950
6953
|
country: ipData?.country ?? null,
|
|
6954
|
+
subdivisionCode,
|
|
6951
6955
|
isLoading,
|
|
6952
6956
|
error
|
|
6953
6957
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/ui-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
4
4
|
"description": "Unifold UI React - Deposit and onramp components for React applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"lucide-react": "^0.454.0",
|
|
35
35
|
"qr-code-styling": "^1.6.0-rc.1",
|
|
36
36
|
"tailwind-merge": "^2.0.0",
|
|
37
|
-
"@unifold/core": "0.1.
|
|
37
|
+
"@unifold/core": "0.1.51"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@solana/web3.js": "^1.87.0",
|