@unifold/ui-react 0.1.72 → 0.1.73
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 +0 -39
- package/dist/index.mjs +0 -39
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -13703,15 +13703,10 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
13703
13703
|
setIsLoading(true);
|
|
13704
13704
|
setError(null);
|
|
13705
13705
|
try {
|
|
13706
|
-
console.log("[PayWithStripeLink] Importing @stripe/crypto...");
|
|
13707
13706
|
const { loadCryptoOnrampAndInitialize } = await import(
|
|
13708
13707
|
/* @vite-ignore */
|
|
13709
13708
|
"@stripe/crypto"
|
|
13710
13709
|
);
|
|
13711
|
-
console.log(
|
|
13712
|
-
"[PayWithStripeLink] @stripe/crypto imported, initializing with key:",
|
|
13713
|
-
stripePublishableKey?.slice(0, 12) + "..."
|
|
13714
|
-
);
|
|
13715
13710
|
const initPromise = loadCryptoOnrampAndInitialize(stripePublishableKey, {
|
|
13716
13711
|
theme: theme ? "night" : "stripe"
|
|
13717
13712
|
});
|
|
@@ -13729,7 +13724,6 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
13729
13724
|
if (!instance) {
|
|
13730
13725
|
throw new Error("Stripe SDK returned null.");
|
|
13731
13726
|
}
|
|
13732
|
-
console.log("[PayWithStripeLink] Stripe SDK initialized successfully");
|
|
13733
13727
|
coordinatorRef.current = instance;
|
|
13734
13728
|
coordinatorThemeRef.current = theme;
|
|
13735
13729
|
setCoordinator(instance);
|
|
@@ -14003,12 +13997,7 @@ function PayWithStripeLink({
|
|
|
14003
13997
|
let active = true;
|
|
14004
13998
|
const fetchConfig = async () => {
|
|
14005
13999
|
try {
|
|
14006
|
-
console.log("[PayWithStripeLink] Fetching Stripe config...");
|
|
14007
14000
|
const cfg = await (0, import_core22.stripeGetConfig)(publishableKey);
|
|
14008
|
-
console.log(
|
|
14009
|
-
"[PayWithStripeLink] Got Stripe config:",
|
|
14010
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
14011
|
-
);
|
|
14012
14001
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
14013
14002
|
else if (active) {
|
|
14014
14003
|
console.error("[PayWithStripeLink] Config response missing publishable_key");
|
|
@@ -14030,12 +14019,7 @@ function PayWithStripeLink({
|
|
|
14030
14019
|
let active = true;
|
|
14031
14020
|
const retryConfig = async () => {
|
|
14032
14021
|
try {
|
|
14033
|
-
console.log("[PayWithStripeLink] Retrying Stripe config fetch...");
|
|
14034
14022
|
const cfg = await (0, import_core22.stripeGetConfig)(publishableKey);
|
|
14035
|
-
console.log(
|
|
14036
|
-
"[PayWithStripeLink] Retry got Stripe config:",
|
|
14037
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
14038
|
-
);
|
|
14039
14023
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
14040
14024
|
} catch (err) {
|
|
14041
14025
|
const msg = err instanceof Error ? err.message : t.formErrors.configLoadFailed;
|
|
@@ -14054,17 +14038,6 @@ function PayWithStripeLink({
|
|
|
14054
14038
|
error: sdkError,
|
|
14055
14039
|
initialize
|
|
14056
14040
|
} = useStripeOnramp(resolvedStripeKey, isDark);
|
|
14057
|
-
(0, import_react18.useEffect)(() => {
|
|
14058
|
-
if (step === "auth") {
|
|
14059
|
-
console.log("[PayWithStripeLink] Auth step state:", {
|
|
14060
|
-
resolvedStripeKey: resolvedStripeKey ? resolvedStripeKey.slice(0, 15) + "..." : void 0,
|
|
14061
|
-
coordinator: !!coordinator,
|
|
14062
|
-
sdkLoading,
|
|
14063
|
-
sdkError,
|
|
14064
|
-
configError
|
|
14065
|
-
});
|
|
14066
|
-
}
|
|
14067
|
-
}, [step, resolvedStripeKey, coordinator, sdkLoading, sdkError, configError]);
|
|
14068
14041
|
const [email, setEmail] = (0, import_react18.useState)(emailProp ?? "");
|
|
14069
14042
|
const [phone, setPhone] = (0, import_react18.useState)("");
|
|
14070
14043
|
const [country, setCountry] = (0, import_react18.useState)("US");
|
|
@@ -14166,13 +14139,6 @@ function PayWithStripeLink({
|
|
|
14166
14139
|
);
|
|
14167
14140
|
(0, import_react18.useEffect)(() => {
|
|
14168
14141
|
const stored = getStoredStripeSession(userId);
|
|
14169
|
-
console.log("[PayWithStripeLink] Restore check:", {
|
|
14170
|
-
hasStored: !!stored,
|
|
14171
|
-
hasAccessToken: !!stored?.accessToken,
|
|
14172
|
-
hasRefreshToken: !!stored?.refreshToken,
|
|
14173
|
-
expired: stored ? isTokenExpired(stored) : null,
|
|
14174
|
-
expiresAt: stored?.expiresAt ? new Date(stored.expiresAt).toISOString() : null
|
|
14175
|
-
});
|
|
14176
14142
|
if (!stored || !stored.accessToken) {
|
|
14177
14143
|
setRestoring(false);
|
|
14178
14144
|
return;
|
|
@@ -14183,13 +14149,11 @@ function PayWithStripeLink({
|
|
|
14183
14149
|
let refresh = stored.refreshToken;
|
|
14184
14150
|
if (isTokenExpired(stored)) {
|
|
14185
14151
|
if (!stored.refreshToken) {
|
|
14186
|
-
console.log("[PayWithStripeLink] Token expired, no refresh token \u2014 clearing session");
|
|
14187
14152
|
clearStripeSession(userId);
|
|
14188
14153
|
if (!cancelled) setRestoring(false);
|
|
14189
14154
|
return;
|
|
14190
14155
|
}
|
|
14191
14156
|
try {
|
|
14192
|
-
console.log("[PayWithStripeLink] Token expired, refreshing...");
|
|
14193
14157
|
const res = await (0, import_core22.stripeRefreshToken)(stored.refreshToken, publishableKey);
|
|
14194
14158
|
if (cancelled) return;
|
|
14195
14159
|
token = res.access_token;
|
|
@@ -14368,9 +14332,6 @@ function PayWithStripeLink({
|
|
|
14368
14332
|
}
|
|
14369
14333
|
}, [customerId]);
|
|
14370
14334
|
const [amount, setAmount] = (0, import_react18.useState)("");
|
|
14371
|
-
(0, import_react18.useEffect)(() => {
|
|
14372
|
-
console.log("[PayWithStripeLink] Component mounted/remounted. Amount:", amount, "Step:", step);
|
|
14373
|
-
}, []);
|
|
14374
14335
|
const sourceCurrency = "usd";
|
|
14375
14336
|
const { data: fiatCurrencies } = useFiatCurrencies({ publishableKey });
|
|
14376
14337
|
const minAmount = fiatCurrencies?.data.find((entry) => entry.currency_code.toLowerCase() === sourceCurrency)?.minimum_amount ?? FALLBACK_MIN_USD2;
|
package/dist/index.mjs
CHANGED
|
@@ -13646,15 +13646,10 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
13646
13646
|
setIsLoading(true);
|
|
13647
13647
|
setError(null);
|
|
13648
13648
|
try {
|
|
13649
|
-
console.log("[PayWithStripeLink] Importing @stripe/crypto...");
|
|
13650
13649
|
const { loadCryptoOnrampAndInitialize } = await import(
|
|
13651
13650
|
/* @vite-ignore */
|
|
13652
13651
|
"@stripe/crypto"
|
|
13653
13652
|
);
|
|
13654
|
-
console.log(
|
|
13655
|
-
"[PayWithStripeLink] @stripe/crypto imported, initializing with key:",
|
|
13656
|
-
stripePublishableKey?.slice(0, 12) + "..."
|
|
13657
|
-
);
|
|
13658
13653
|
const initPromise = loadCryptoOnrampAndInitialize(stripePublishableKey, {
|
|
13659
13654
|
theme: theme ? "night" : "stripe"
|
|
13660
13655
|
});
|
|
@@ -13672,7 +13667,6 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
13672
13667
|
if (!instance) {
|
|
13673
13668
|
throw new Error("Stripe SDK returned null.");
|
|
13674
13669
|
}
|
|
13675
|
-
console.log("[PayWithStripeLink] Stripe SDK initialized successfully");
|
|
13676
13670
|
coordinatorRef.current = instance;
|
|
13677
13671
|
coordinatorThemeRef.current = theme;
|
|
13678
13672
|
setCoordinator(instance);
|
|
@@ -13946,12 +13940,7 @@ function PayWithStripeLink({
|
|
|
13946
13940
|
let active = true;
|
|
13947
13941
|
const fetchConfig = async () => {
|
|
13948
13942
|
try {
|
|
13949
|
-
console.log("[PayWithStripeLink] Fetching Stripe config...");
|
|
13950
13943
|
const cfg = await stripeGetConfig(publishableKey);
|
|
13951
|
-
console.log(
|
|
13952
|
-
"[PayWithStripeLink] Got Stripe config:",
|
|
13953
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
13954
|
-
);
|
|
13955
13944
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
13956
13945
|
else if (active) {
|
|
13957
13946
|
console.error("[PayWithStripeLink] Config response missing publishable_key");
|
|
@@ -13973,12 +13962,7 @@ function PayWithStripeLink({
|
|
|
13973
13962
|
let active = true;
|
|
13974
13963
|
const retryConfig = async () => {
|
|
13975
13964
|
try {
|
|
13976
|
-
console.log("[PayWithStripeLink] Retrying Stripe config fetch...");
|
|
13977
13965
|
const cfg = await stripeGetConfig(publishableKey);
|
|
13978
|
-
console.log(
|
|
13979
|
-
"[PayWithStripeLink] Retry got Stripe config:",
|
|
13980
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
13981
|
-
);
|
|
13982
13966
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
13983
13967
|
} catch (err) {
|
|
13984
13968
|
const msg = err instanceof Error ? err.message : t.formErrors.configLoadFailed;
|
|
@@ -13997,17 +13981,6 @@ function PayWithStripeLink({
|
|
|
13997
13981
|
error: sdkError,
|
|
13998
13982
|
initialize
|
|
13999
13983
|
} = useStripeOnramp(resolvedStripeKey, isDark);
|
|
14000
|
-
useEffect27(() => {
|
|
14001
|
-
if (step === "auth") {
|
|
14002
|
-
console.log("[PayWithStripeLink] Auth step state:", {
|
|
14003
|
-
resolvedStripeKey: resolvedStripeKey ? resolvedStripeKey.slice(0, 15) + "..." : void 0,
|
|
14004
|
-
coordinator: !!coordinator,
|
|
14005
|
-
sdkLoading,
|
|
14006
|
-
sdkError,
|
|
14007
|
-
configError
|
|
14008
|
-
});
|
|
14009
|
-
}
|
|
14010
|
-
}, [step, resolvedStripeKey, coordinator, sdkLoading, sdkError, configError]);
|
|
14011
13984
|
const [email, setEmail] = useState31(emailProp ?? "");
|
|
14012
13985
|
const [phone, setPhone] = useState31("");
|
|
14013
13986
|
const [country, setCountry] = useState31("US");
|
|
@@ -14109,13 +14082,6 @@ function PayWithStripeLink({
|
|
|
14109
14082
|
);
|
|
14110
14083
|
useEffect27(() => {
|
|
14111
14084
|
const stored = getStoredStripeSession(userId);
|
|
14112
|
-
console.log("[PayWithStripeLink] Restore check:", {
|
|
14113
|
-
hasStored: !!stored,
|
|
14114
|
-
hasAccessToken: !!stored?.accessToken,
|
|
14115
|
-
hasRefreshToken: !!stored?.refreshToken,
|
|
14116
|
-
expired: stored ? isTokenExpired(stored) : null,
|
|
14117
|
-
expiresAt: stored?.expiresAt ? new Date(stored.expiresAt).toISOString() : null
|
|
14118
|
-
});
|
|
14119
14085
|
if (!stored || !stored.accessToken) {
|
|
14120
14086
|
setRestoring(false);
|
|
14121
14087
|
return;
|
|
@@ -14126,13 +14092,11 @@ function PayWithStripeLink({
|
|
|
14126
14092
|
let refresh = stored.refreshToken;
|
|
14127
14093
|
if (isTokenExpired(stored)) {
|
|
14128
14094
|
if (!stored.refreshToken) {
|
|
14129
|
-
console.log("[PayWithStripeLink] Token expired, no refresh token \u2014 clearing session");
|
|
14130
14095
|
clearStripeSession(userId);
|
|
14131
14096
|
if (!cancelled) setRestoring(false);
|
|
14132
14097
|
return;
|
|
14133
14098
|
}
|
|
14134
14099
|
try {
|
|
14135
|
-
console.log("[PayWithStripeLink] Token expired, refreshing...");
|
|
14136
14100
|
const res = await stripeRefreshToken(stored.refreshToken, publishableKey);
|
|
14137
14101
|
if (cancelled) return;
|
|
14138
14102
|
token = res.access_token;
|
|
@@ -14311,9 +14275,6 @@ function PayWithStripeLink({
|
|
|
14311
14275
|
}
|
|
14312
14276
|
}, [customerId]);
|
|
14313
14277
|
const [amount, setAmount] = useState31("");
|
|
14314
|
-
useEffect27(() => {
|
|
14315
|
-
console.log("[PayWithStripeLink] Component mounted/remounted. Amount:", amount, "Step:", step);
|
|
14316
|
-
}, []);
|
|
14317
14278
|
const sourceCurrency = "usd";
|
|
14318
14279
|
const { data: fiatCurrencies } = useFiatCurrencies({ publishableKey });
|
|
14319
14280
|
const minAmount = fiatCurrencies?.data.find((entry) => entry.currency_code.toLowerCase() === sourceCurrency)?.minimum_amount ?? FALLBACK_MIN_USD2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/ui-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.73",
|
|
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",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"mipd": "^0.0.7",
|
|
43
43
|
"qr-code-styling": "^1.6.0-rc.1",
|
|
44
44
|
"tailwind-merge": "^2.0.0",
|
|
45
|
-
"@unifold/analytics": "0.1.
|
|
46
|
-
"@unifold/core": "0.1.
|
|
45
|
+
"@unifold/analytics": "0.1.73",
|
|
46
|
+
"@unifold/core": "0.1.73"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@solana/web3.js": "^1.87.0",
|