@unifold/connect-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 +1 -40
- package/dist/index.mjs +1 -40
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -6569,7 +6569,7 @@ function generateKSUID() {
|
|
|
6569
6569
|
function generatePrefixedKSUID(prefix) {
|
|
6570
6570
|
return `${prefix}_${generateKSUID()}`;
|
|
6571
6571
|
}
|
|
6572
|
-
var PACKAGE_VERSION = "0.1.
|
|
6572
|
+
var PACKAGE_VERSION = "0.1.73";
|
|
6573
6573
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
6574
6574
|
var DEFAULT_DEDUP_MS = 500;
|
|
6575
6575
|
var SESSION_PREFIX = "asess";
|
|
@@ -25975,15 +25975,10 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
25975
25975
|
setIsLoading(true);
|
|
25976
25976
|
setError(null);
|
|
25977
25977
|
try {
|
|
25978
|
-
console.log("[PayWithStripeLink] Importing @stripe/crypto...");
|
|
25979
25978
|
const { loadCryptoOnrampAndInitialize } = await import(
|
|
25980
25979
|
/* @vite-ignore */
|
|
25981
25980
|
"@stripe/crypto"
|
|
25982
25981
|
);
|
|
25983
|
-
console.log(
|
|
25984
|
-
"[PayWithStripeLink] @stripe/crypto imported, initializing with key:",
|
|
25985
|
-
stripePublishableKey?.slice(0, 12) + "..."
|
|
25986
|
-
);
|
|
25987
25982
|
const initPromise = loadCryptoOnrampAndInitialize(stripePublishableKey, {
|
|
25988
25983
|
theme: theme ? "night" : "stripe"
|
|
25989
25984
|
});
|
|
@@ -26001,7 +25996,6 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
26001
25996
|
if (!instance) {
|
|
26002
25997
|
throw new Error("Stripe SDK returned null.");
|
|
26003
25998
|
}
|
|
26004
|
-
console.log("[PayWithStripeLink] Stripe SDK initialized successfully");
|
|
26005
25999
|
coordinatorRef.current = instance;
|
|
26006
26000
|
coordinatorThemeRef.current = theme;
|
|
26007
26001
|
setCoordinator(instance);
|
|
@@ -26270,12 +26264,7 @@ function PayWithStripeLink({
|
|
|
26270
26264
|
let active = true;
|
|
26271
26265
|
const fetchConfig = async () => {
|
|
26272
26266
|
try {
|
|
26273
|
-
console.log("[PayWithStripeLink] Fetching Stripe config...");
|
|
26274
26267
|
const cfg = await (0, import_core23.stripeGetConfig)(publishableKey);
|
|
26275
|
-
console.log(
|
|
26276
|
-
"[PayWithStripeLink] Got Stripe config:",
|
|
26277
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
26278
|
-
);
|
|
26279
26268
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
26280
26269
|
else if (active) {
|
|
26281
26270
|
console.error("[PayWithStripeLink] Config response missing publishable_key");
|
|
@@ -26297,12 +26286,7 @@ function PayWithStripeLink({
|
|
|
26297
26286
|
let active = true;
|
|
26298
26287
|
const retryConfig = async () => {
|
|
26299
26288
|
try {
|
|
26300
|
-
console.log("[PayWithStripeLink] Retrying Stripe config fetch...");
|
|
26301
26289
|
const cfg = await (0, import_core23.stripeGetConfig)(publishableKey);
|
|
26302
|
-
console.log(
|
|
26303
|
-
"[PayWithStripeLink] Retry got Stripe config:",
|
|
26304
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
26305
|
-
);
|
|
26306
26290
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
26307
26291
|
} catch (err) {
|
|
26308
26292
|
const msg = err instanceof Error ? err.message : t.formErrors.configLoadFailed;
|
|
@@ -26321,17 +26305,6 @@ function PayWithStripeLink({
|
|
|
26321
26305
|
error: sdkError,
|
|
26322
26306
|
initialize
|
|
26323
26307
|
} = useStripeOnramp(resolvedStripeKey, isDark);
|
|
26324
|
-
(0, import_react24.useEffect)(() => {
|
|
26325
|
-
if (step === "auth") {
|
|
26326
|
-
console.log("[PayWithStripeLink] Auth step state:", {
|
|
26327
|
-
resolvedStripeKey: resolvedStripeKey ? resolvedStripeKey.slice(0, 15) + "..." : void 0,
|
|
26328
|
-
coordinator: !!coordinator,
|
|
26329
|
-
sdkLoading,
|
|
26330
|
-
sdkError,
|
|
26331
|
-
configError
|
|
26332
|
-
});
|
|
26333
|
-
}
|
|
26334
|
-
}, [step, resolvedStripeKey, coordinator, sdkLoading, sdkError, configError]);
|
|
26335
26308
|
const [email, setEmail] = (0, import_react24.useState)(emailProp ?? "");
|
|
26336
26309
|
const [phone, setPhone] = (0, import_react24.useState)("");
|
|
26337
26310
|
const [country, setCountry] = (0, import_react24.useState)("US");
|
|
@@ -26433,13 +26406,6 @@ function PayWithStripeLink({
|
|
|
26433
26406
|
);
|
|
26434
26407
|
(0, import_react24.useEffect)(() => {
|
|
26435
26408
|
const stored = getStoredStripeSession(userId);
|
|
26436
|
-
console.log("[PayWithStripeLink] Restore check:", {
|
|
26437
|
-
hasStored: !!stored,
|
|
26438
|
-
hasAccessToken: !!stored?.accessToken,
|
|
26439
|
-
hasRefreshToken: !!stored?.refreshToken,
|
|
26440
|
-
expired: stored ? isTokenExpired(stored) : null,
|
|
26441
|
-
expiresAt: stored?.expiresAt ? new Date(stored.expiresAt).toISOString() : null
|
|
26442
|
-
});
|
|
26443
26409
|
if (!stored || !stored.accessToken) {
|
|
26444
26410
|
setRestoring(false);
|
|
26445
26411
|
return;
|
|
@@ -26450,13 +26416,11 @@ function PayWithStripeLink({
|
|
|
26450
26416
|
let refresh = stored.refreshToken;
|
|
26451
26417
|
if (isTokenExpired(stored)) {
|
|
26452
26418
|
if (!stored.refreshToken) {
|
|
26453
|
-
console.log("[PayWithStripeLink] Token expired, no refresh token \u2014 clearing session");
|
|
26454
26419
|
clearStripeSession(userId);
|
|
26455
26420
|
if (!cancelled) setRestoring(false);
|
|
26456
26421
|
return;
|
|
26457
26422
|
}
|
|
26458
26423
|
try {
|
|
26459
|
-
console.log("[PayWithStripeLink] Token expired, refreshing...");
|
|
26460
26424
|
const res = await (0, import_core23.stripeRefreshToken)(stored.refreshToken, publishableKey);
|
|
26461
26425
|
if (cancelled) return;
|
|
26462
26426
|
token = res.access_token;
|
|
@@ -26635,9 +26599,6 @@ function PayWithStripeLink({
|
|
|
26635
26599
|
}
|
|
26636
26600
|
}, [customerId]);
|
|
26637
26601
|
const [amount, setAmount] = (0, import_react24.useState)("");
|
|
26638
|
-
(0, import_react24.useEffect)(() => {
|
|
26639
|
-
console.log("[PayWithStripeLink] Component mounted/remounted. Amount:", amount, "Step:", step);
|
|
26640
|
-
}, []);
|
|
26641
26602
|
const sourceCurrency = "usd";
|
|
26642
26603
|
const { data: fiatCurrencies } = useFiatCurrencies({ publishableKey });
|
|
26643
26604
|
const minAmount = fiatCurrencies?.data.find((entry) => entry.currency_code.toLowerCase() === sourceCurrency)?.minimum_amount ?? FALLBACK_MIN_USD2;
|
package/dist/index.mjs
CHANGED
|
@@ -6610,7 +6610,7 @@ function generateKSUID() {
|
|
|
6610
6610
|
function generatePrefixedKSUID(prefix) {
|
|
6611
6611
|
return `${prefix}_${generateKSUID()}`;
|
|
6612
6612
|
}
|
|
6613
|
-
var PACKAGE_VERSION = "0.1.
|
|
6613
|
+
var PACKAGE_VERSION = "0.1.73";
|
|
6614
6614
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
6615
6615
|
var DEFAULT_DEDUP_MS = 500;
|
|
6616
6616
|
var SESSION_PREFIX = "asess";
|
|
@@ -26057,15 +26057,10 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
26057
26057
|
setIsLoading(true);
|
|
26058
26058
|
setError(null);
|
|
26059
26059
|
try {
|
|
26060
|
-
console.log("[PayWithStripeLink] Importing @stripe/crypto...");
|
|
26061
26060
|
const { loadCryptoOnrampAndInitialize } = await import(
|
|
26062
26061
|
/* @vite-ignore */
|
|
26063
26062
|
"@stripe/crypto"
|
|
26064
26063
|
);
|
|
26065
|
-
console.log(
|
|
26066
|
-
"[PayWithStripeLink] @stripe/crypto imported, initializing with key:",
|
|
26067
|
-
stripePublishableKey?.slice(0, 12) + "..."
|
|
26068
|
-
);
|
|
26069
26064
|
const initPromise = loadCryptoOnrampAndInitialize(stripePublishableKey, {
|
|
26070
26065
|
theme: theme ? "night" : "stripe"
|
|
26071
26066
|
});
|
|
@@ -26083,7 +26078,6 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
26083
26078
|
if (!instance) {
|
|
26084
26079
|
throw new Error("Stripe SDK returned null.");
|
|
26085
26080
|
}
|
|
26086
|
-
console.log("[PayWithStripeLink] Stripe SDK initialized successfully");
|
|
26087
26081
|
coordinatorRef.current = instance;
|
|
26088
26082
|
coordinatorThemeRef.current = theme;
|
|
26089
26083
|
setCoordinator(instance);
|
|
@@ -26352,12 +26346,7 @@ function PayWithStripeLink({
|
|
|
26352
26346
|
let active = true;
|
|
26353
26347
|
const fetchConfig = async () => {
|
|
26354
26348
|
try {
|
|
26355
|
-
console.log("[PayWithStripeLink] Fetching Stripe config...");
|
|
26356
26349
|
const cfg = await stripeGetConfig(publishableKey);
|
|
26357
|
-
console.log(
|
|
26358
|
-
"[PayWithStripeLink] Got Stripe config:",
|
|
26359
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
26360
|
-
);
|
|
26361
26350
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
26362
26351
|
else if (active) {
|
|
26363
26352
|
console.error("[PayWithStripeLink] Config response missing publishable_key");
|
|
@@ -26379,12 +26368,7 @@ function PayWithStripeLink({
|
|
|
26379
26368
|
let active = true;
|
|
26380
26369
|
const retryConfig = async () => {
|
|
26381
26370
|
try {
|
|
26382
|
-
console.log("[PayWithStripeLink] Retrying Stripe config fetch...");
|
|
26383
26371
|
const cfg = await stripeGetConfig(publishableKey);
|
|
26384
|
-
console.log(
|
|
26385
|
-
"[PayWithStripeLink] Retry got Stripe config:",
|
|
26386
|
-
cfg.publishable_key?.slice(0, 15) + "..."
|
|
26387
|
-
);
|
|
26388
26372
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
26389
26373
|
} catch (err) {
|
|
26390
26374
|
const msg = err instanceof Error ? err.message : t.formErrors.configLoadFailed;
|
|
@@ -26403,17 +26387,6 @@ function PayWithStripeLink({
|
|
|
26403
26387
|
error: sdkError,
|
|
26404
26388
|
initialize
|
|
26405
26389
|
} = useStripeOnramp(resolvedStripeKey, isDark);
|
|
26406
|
-
useEffect272(() => {
|
|
26407
|
-
if (step === "auth") {
|
|
26408
|
-
console.log("[PayWithStripeLink] Auth step state:", {
|
|
26409
|
-
resolvedStripeKey: resolvedStripeKey ? resolvedStripeKey.slice(0, 15) + "..." : void 0,
|
|
26410
|
-
coordinator: !!coordinator,
|
|
26411
|
-
sdkLoading,
|
|
26412
|
-
sdkError,
|
|
26413
|
-
configError
|
|
26414
|
-
});
|
|
26415
|
-
}
|
|
26416
|
-
}, [step, resolvedStripeKey, coordinator, sdkLoading, sdkError, configError]);
|
|
26417
26390
|
const [email, setEmail] = useState31(emailProp ?? "");
|
|
26418
26391
|
const [phone, setPhone] = useState31("");
|
|
26419
26392
|
const [country, setCountry] = useState31("US");
|
|
@@ -26515,13 +26488,6 @@ function PayWithStripeLink({
|
|
|
26515
26488
|
);
|
|
26516
26489
|
useEffect272(() => {
|
|
26517
26490
|
const stored = getStoredStripeSession(userId);
|
|
26518
|
-
console.log("[PayWithStripeLink] Restore check:", {
|
|
26519
|
-
hasStored: !!stored,
|
|
26520
|
-
hasAccessToken: !!stored?.accessToken,
|
|
26521
|
-
hasRefreshToken: !!stored?.refreshToken,
|
|
26522
|
-
expired: stored ? isTokenExpired(stored) : null,
|
|
26523
|
-
expiresAt: stored?.expiresAt ? new Date(stored.expiresAt).toISOString() : null
|
|
26524
|
-
});
|
|
26525
26491
|
if (!stored || !stored.accessToken) {
|
|
26526
26492
|
setRestoring(false);
|
|
26527
26493
|
return;
|
|
@@ -26532,13 +26498,11 @@ function PayWithStripeLink({
|
|
|
26532
26498
|
let refresh = stored.refreshToken;
|
|
26533
26499
|
if (isTokenExpired(stored)) {
|
|
26534
26500
|
if (!stored.refreshToken) {
|
|
26535
|
-
console.log("[PayWithStripeLink] Token expired, no refresh token \u2014 clearing session");
|
|
26536
26501
|
clearStripeSession(userId);
|
|
26537
26502
|
if (!cancelled) setRestoring(false);
|
|
26538
26503
|
return;
|
|
26539
26504
|
}
|
|
26540
26505
|
try {
|
|
26541
|
-
console.log("[PayWithStripeLink] Token expired, refreshing...");
|
|
26542
26506
|
const res = await stripeRefreshToken(stored.refreshToken, publishableKey);
|
|
26543
26507
|
if (cancelled) return;
|
|
26544
26508
|
token = res.access_token;
|
|
@@ -26717,9 +26681,6 @@ function PayWithStripeLink({
|
|
|
26717
26681
|
}
|
|
26718
26682
|
}, [customerId]);
|
|
26719
26683
|
const [amount, setAmount] = useState31("");
|
|
26720
|
-
useEffect272(() => {
|
|
26721
|
-
console.log("[PayWithStripeLink] Component mounted/remounted. Amount:", amount, "Step:", step);
|
|
26722
|
-
}, []);
|
|
26723
26684
|
const sourceCurrency = "usd";
|
|
26724
26685
|
const { data: fiatCurrencies } = useFiatCurrencies({ publishableKey });
|
|
26725
26686
|
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/connect-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.73",
|
|
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",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@tanstack/react-query": "^5.90.11",
|
|
40
|
-
"@unifold/analytics": "0.1.
|
|
41
|
-
"@unifold/core": "0.1.
|
|
42
|
-
"@unifold/headless-react": "0.1.
|
|
43
|
-
"@unifold/react-provider": "0.1.
|
|
44
|
-
"@unifold/ui-react": "0.1.
|
|
40
|
+
"@unifold/analytics": "0.1.73",
|
|
41
|
+
"@unifold/core": "0.1.73",
|
|
42
|
+
"@unifold/headless-react": "0.1.73",
|
|
43
|
+
"@unifold/react-provider": "0.1.73",
|
|
44
|
+
"@unifold/ui-react": "0.1.73"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^19.0.0",
|