@unifold/ui-web 0.1.35 → 0.1.36
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +150 -110
- package/dist/index.mjs +150 -110
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnifoldConnectProviderConfig, DepositConfig, DepositResult } from '@unifold/connect-react';
|
|
2
|
-
export { DepositConfig, DepositError, DepositResult, UnifoldConnectProviderConfig } from '@unifold/connect-react';
|
|
2
|
+
export { DepositConfig, DepositError, DepositInitialScreen, DepositResult, UnifoldConnectProviderConfig } from '@unifold/connect-react';
|
|
3
3
|
|
|
4
4
|
type UnifoldConfig = UnifoldConnectProviderConfig["config"];
|
|
5
5
|
interface UnifoldHandle {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnifoldConnectProviderConfig, DepositConfig, DepositResult } from '@unifold/connect-react';
|
|
2
|
-
export { DepositConfig, DepositError, DepositResult, UnifoldConnectProviderConfig } from '@unifold/connect-react';
|
|
2
|
+
export { DepositConfig, DepositError, DepositInitialScreen, DepositResult, UnifoldConnectProviderConfig } from '@unifold/connect-react';
|
|
3
3
|
|
|
4
4
|
type UnifoldConfig = UnifoldConnectProviderConfig["config"];
|
|
5
5
|
interface UnifoldHandle {
|
package/dist/index.js
CHANGED
|
@@ -38711,18 +38711,18 @@ function composeContextScopes(...scopes) {
|
|
|
38711
38711
|
createScope.scopeName = baseScope.scopeName;
|
|
38712
38712
|
return createScope;
|
|
38713
38713
|
}
|
|
38714
|
-
var
|
|
38714
|
+
var useLayoutEffect23 = globalThis?.document ? React32.useLayoutEffect : () => {
|
|
38715
38715
|
};
|
|
38716
38716
|
var useReactId = React42[" useId ".trim().toString()] || (() => void 0);
|
|
38717
38717
|
var count = 0;
|
|
38718
38718
|
function useId13(deterministicId) {
|
|
38719
38719
|
const [id, setId] = React42.useState(useReactId());
|
|
38720
|
-
|
|
38720
|
+
useLayoutEffect23(() => {
|
|
38721
38721
|
if (!deterministicId) setId((reactId) => reactId ?? String(count++));
|
|
38722
38722
|
}, [deterministicId]);
|
|
38723
38723
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
38724
38724
|
}
|
|
38725
|
-
var useInsertionEffect = React52[" useInsertionEffect ".trim().toString()] ||
|
|
38725
|
+
var useInsertionEffect = React52[" useInsertionEffect ".trim().toString()] || useLayoutEffect23;
|
|
38726
38726
|
function useControllableState({
|
|
38727
38727
|
prop,
|
|
38728
38728
|
defaultProp,
|
|
@@ -39337,7 +39337,7 @@ var PORTAL_NAME = "Portal";
|
|
|
39337
39337
|
var Portal = React12.forwardRef((props, forwardedRef) => {
|
|
39338
39338
|
const { container: containerProp, ...portalProps } = props;
|
|
39339
39339
|
const [mounted, setMounted] = React12.useState(false);
|
|
39340
|
-
|
|
39340
|
+
useLayoutEffect23(() => setMounted(true), []);
|
|
39341
39341
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
39342
39342
|
return container ? import_react_dom.default.createPortal(/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
39343
39343
|
});
|
|
@@ -39380,7 +39380,7 @@ function usePresence(present) {
|
|
|
39380
39380
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
39381
39381
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
39382
39382
|
}, [state]);
|
|
39383
|
-
|
|
39383
|
+
useLayoutEffect23(() => {
|
|
39384
39384
|
const styles = stylesRef.current;
|
|
39385
39385
|
const wasPresent = prevPresentRef.current;
|
|
39386
39386
|
const hasPresentChanged = wasPresent !== present;
|
|
@@ -39402,7 +39402,7 @@ function usePresence(present) {
|
|
|
39402
39402
|
prevPresentRef.current = present;
|
|
39403
39403
|
}
|
|
39404
39404
|
}, [present, send]);
|
|
39405
|
-
|
|
39405
|
+
useLayoutEffect23(() => {
|
|
39406
39406
|
if (node) {
|
|
39407
39407
|
let timeoutId;
|
|
39408
39408
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
@@ -45415,7 +45415,7 @@ Arrow.displayName = NAME;
|
|
|
45415
45415
|
var Root2 = Arrow;
|
|
45416
45416
|
function useSize(element) {
|
|
45417
45417
|
const [size4, setSize] = React27.useState(void 0);
|
|
45418
|
-
|
|
45418
|
+
useLayoutEffect23(() => {
|
|
45419
45419
|
if (element) {
|
|
45420
45420
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
45421
45421
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
@@ -45552,7 +45552,7 @@ var PopperContent = React28.forwardRef(
|
|
|
45552
45552
|
});
|
|
45553
45553
|
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
45554
45554
|
const handlePlaced = useCallbackRef(onPlaced);
|
|
45555
|
-
|
|
45555
|
+
useLayoutEffect23(() => {
|
|
45556
45556
|
if (isPositioned) {
|
|
45557
45557
|
handlePlaced?.();
|
|
45558
45558
|
}
|
|
@@ -45561,7 +45561,7 @@ var PopperContent = React28.forwardRef(
|
|
|
45561
45561
|
const arrowY = middlewareData.arrow?.y;
|
|
45562
45562
|
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
45563
45563
|
const [contentZIndex, setContentZIndex] = React28.useState();
|
|
45564
|
-
|
|
45564
|
+
useLayoutEffect23(() => {
|
|
45565
45565
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
45566
45566
|
}, [content]);
|
|
45567
45567
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -46492,7 +46492,7 @@ var SelectValue = React34.forwardRef(
|
|
|
46492
46492
|
const { onValueNodeHasChildrenChange } = context;
|
|
46493
46493
|
const hasChildren = children !== void 0;
|
|
46494
46494
|
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
46495
|
-
|
|
46495
|
+
useLayoutEffect23(() => {
|
|
46496
46496
|
onValueNodeHasChildrenChange(hasChildren);
|
|
46497
46497
|
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
46498
46498
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -46525,7 +46525,7 @@ var SelectContent = React34.forwardRef(
|
|
|
46525
46525
|
(props, forwardedRef) => {
|
|
46526
46526
|
const context = useSelectContext(CONTENT_NAME4, props.__scopeSelect);
|
|
46527
46527
|
const [fragment, setFragment] = React34.useState();
|
|
46528
|
-
|
|
46528
|
+
useLayoutEffect23(() => {
|
|
46529
46529
|
setFragment(new DocumentFragment());
|
|
46530
46530
|
}, []);
|
|
46531
46531
|
if (!context.open) {
|
|
@@ -46887,9 +46887,9 @@ var SelectItemAlignedPosition = React34.forwardRef((props, forwardedRef) => {
|
|
|
46887
46887
|
context.dir,
|
|
46888
46888
|
onPlaced
|
|
46889
46889
|
]);
|
|
46890
|
-
|
|
46890
|
+
useLayoutEffect23(() => position(), [position]);
|
|
46891
46891
|
const [contentZIndex, setContentZIndex] = React34.useState();
|
|
46892
|
-
|
|
46892
|
+
useLayoutEffect23(() => {
|
|
46893
46893
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
46894
46894
|
}, [content]);
|
|
46895
46895
|
const handleScrollButtonChange = React34.useCallback(
|
|
@@ -47186,7 +47186,7 @@ var SelectItemText = React34.forwardRef(
|
|
|
47186
47186
|
[itemContext.disabled, itemContext.value, textContent]
|
|
47187
47187
|
);
|
|
47188
47188
|
const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;
|
|
47189
|
-
|
|
47189
|
+
useLayoutEffect23(() => {
|
|
47190
47190
|
onNativeOptionAdd(nativeOption);
|
|
47191
47191
|
return () => onNativeOptionRemove(nativeOption);
|
|
47192
47192
|
}, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
|
|
@@ -47212,7 +47212,7 @@ var SelectScrollUpButton = React34.forwardRef((props, forwardedRef) => {
|
|
|
47212
47212
|
const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
47213
47213
|
const [canScrollUp, setCanScrollUp] = React34.useState(false);
|
|
47214
47214
|
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
47215
|
-
|
|
47215
|
+
useLayoutEffect23(() => {
|
|
47216
47216
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
47217
47217
|
let handleScroll22 = function() {
|
|
47218
47218
|
const canScrollUp2 = viewport.scrollTop > 0;
|
|
@@ -47246,7 +47246,7 @@ var SelectScrollDownButton = React34.forwardRef((props, forwardedRef) => {
|
|
|
47246
47246
|
const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
47247
47247
|
const [canScrollDown, setCanScrollDown] = React34.useState(false);
|
|
47248
47248
|
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
47249
|
-
|
|
47249
|
+
useLayoutEffect23(() => {
|
|
47250
47250
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
47251
47251
|
let handleScroll22 = function() {
|
|
47252
47252
|
const maxScroll = viewport.scrollHeight - viewport.clientHeight;
|
|
@@ -47289,7 +47289,7 @@ var SelectScrollButtonImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
47289
47289
|
React34.useEffect(() => {
|
|
47290
47290
|
return () => clearAutoScrollTimer();
|
|
47291
47291
|
}, [clearAutoScrollTimer]);
|
|
47292
|
-
|
|
47292
|
+
useLayoutEffect23(() => {
|
|
47293
47293
|
const activeItem = getItems().find((item) => item.ref.current === document.activeElement);
|
|
47294
47294
|
activeItem?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
47295
47295
|
}, [getItems]);
|
|
@@ -58027,14 +58027,23 @@ function DepositModal({
|
|
|
58027
58027
|
onDepositSuccess,
|
|
58028
58028
|
onDepositError,
|
|
58029
58029
|
theme = "dark",
|
|
58030
|
-
hideOverlay = false
|
|
58030
|
+
hideOverlay = false,
|
|
58031
|
+
initialScreen = "main"
|
|
58031
58032
|
}) {
|
|
58032
58033
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58034
|
+
const effectiveInitialScreen = (0, import_react3.useMemo)(() => {
|
|
58035
|
+
const s = initialScreen ?? "main";
|
|
58036
|
+
if (s === "tracker" && hideDepositTracker) return "main";
|
|
58037
|
+
return s;
|
|
58038
|
+
}, [initialScreen, hideDepositTracker]);
|
|
58033
58039
|
const [containerEl, setContainerEl] = (0, import_react3.useState)(null);
|
|
58034
58040
|
const containerCallbackRef = (0, import_react3.useCallback)((el) => {
|
|
58035
58041
|
setContainerEl(el);
|
|
58036
58042
|
}, []);
|
|
58037
|
-
const [view, setView] = (0, import_react3.useState)(
|
|
58043
|
+
const [view, setView] = (0, import_react3.useState)(
|
|
58044
|
+
effectiveInitialScreen
|
|
58045
|
+
);
|
|
58046
|
+
const resetViewTimeoutRef = (0, import_react3.useRef)(null);
|
|
58038
58047
|
const [cardView, setCardView] = (0, import_react3.useState)(
|
|
58039
58048
|
"amount"
|
|
58040
58049
|
);
|
|
@@ -58154,6 +58163,43 @@ function DepositModal({
|
|
|
58154
58163
|
const template = errors[code] ?? addressValidationMessages.defaultError;
|
|
58155
58164
|
return interpolate(template, metadata);
|
|
58156
58165
|
};
|
|
58166
|
+
const openingScreen = effectiveInitialScreen;
|
|
58167
|
+
const sessionOpenedFromMenu = openingScreen === "main";
|
|
58168
|
+
const standaloneNeedsDepositPrereq = openingScreen !== "main" && (view === "transfer" || view === "card");
|
|
58169
|
+
let depositPrerequisiteBody;
|
|
58170
|
+
if (isCountryLoading || isAddressValidationLoading || tokensLoading || walletsLoading || !projectConfig) {
|
|
58171
|
+
depositPrerequisiteBody = standaloneNeedsDepositPrereq ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, { variant: "with-icons" }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
58172
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, { variant: "with-icons" }),
|
|
58173
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, { variant: "with-icons" }),
|
|
58174
|
+
!hideDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, {})
|
|
58175
|
+
] });
|
|
58176
|
+
} else if (countryError) {
|
|
58177
|
+
depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
58178
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
58179
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: "Unable to Verify Location" }),
|
|
58180
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: "We couldn't verify your location. Please check your connection and try again." })
|
|
58181
|
+
] });
|
|
58182
|
+
} else if (!isAllowed) {
|
|
58183
|
+
depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
58184
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(MapPinOff, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
58185
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: "No Tokens Available" }),
|
|
58186
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: "There are no supported tokens available from your current location." })
|
|
58187
|
+
] });
|
|
58188
|
+
} else if (isAddressValid === false) {
|
|
58189
|
+
depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
58190
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
58191
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: addressValidationMessages.unableToReceiveFunds }),
|
|
58192
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: getAddressValidationErrorMessage(
|
|
58193
|
+
addressFailureCode,
|
|
58194
|
+
addressFailureMetadata
|
|
58195
|
+
) })
|
|
58196
|
+
] });
|
|
58197
|
+
} else {
|
|
58198
|
+
depositPrerequisiteBody = null;
|
|
58199
|
+
}
|
|
58200
|
+
const showBackTransfer = sessionOpenedFromMenu;
|
|
58201
|
+
const showBackCard = cardView !== "amount" || sessionOpenedFromMenu;
|
|
58202
|
+
const showBackTracker = selectedExecution !== null || sessionOpenedFromMenu;
|
|
58157
58203
|
const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
|
|
58158
58204
|
const handleWalletDisconnect = () => {
|
|
58159
58205
|
setUserDisconnectedWallet(true);
|
|
@@ -58164,13 +58210,37 @@ function DepositModal({
|
|
|
58164
58210
|
};
|
|
58165
58211
|
const handleClose = () => {
|
|
58166
58212
|
onOpenChange(false);
|
|
58167
|
-
|
|
58168
|
-
|
|
58213
|
+
if (resetViewTimeoutRef.current) {
|
|
58214
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
58215
|
+
}
|
|
58216
|
+
resetViewTimeoutRef.current = setTimeout(() => {
|
|
58217
|
+
setView(effectiveInitialScreen);
|
|
58169
58218
|
setCardView("amount");
|
|
58170
58219
|
setExchangeView("providers");
|
|
58171
58220
|
setBrowserWalletInfo(null);
|
|
58221
|
+
resetViewTimeoutRef.current = null;
|
|
58172
58222
|
}, 200);
|
|
58173
58223
|
};
|
|
58224
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
58225
|
+
if (!open) return;
|
|
58226
|
+
if (resetViewTimeoutRef.current) {
|
|
58227
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
58228
|
+
resetViewTimeoutRef.current = null;
|
|
58229
|
+
}
|
|
58230
|
+
setView(effectiveInitialScreen);
|
|
58231
|
+
setCardView("amount");
|
|
58232
|
+
setExchangeView("providers");
|
|
58233
|
+
setBrowserWalletInfo(null);
|
|
58234
|
+
setSelectedExecution(null);
|
|
58235
|
+
}, [open, effectiveInitialScreen]);
|
|
58236
|
+
(0, import_react3.useEffect)(
|
|
58237
|
+
() => () => {
|
|
58238
|
+
if (resetViewTimeoutRef.current) {
|
|
58239
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
58240
|
+
}
|
|
58241
|
+
},
|
|
58242
|
+
[]
|
|
58243
|
+
);
|
|
58174
58244
|
const handleBack = () => {
|
|
58175
58245
|
if (view === "card" && cardView === "quotes") {
|
|
58176
58246
|
setCardView("amount");
|
|
@@ -58283,95 +58353,64 @@ function DepositModal({
|
|
|
58283
58353
|
publishableKey
|
|
58284
58354
|
}
|
|
58285
58355
|
),
|
|
58286
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children:
|
|
58287
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58288
|
-
|
|
58289
|
-
|
|
58290
|
-
|
|
58291
|
-
|
|
58292
|
-
|
|
58293
|
-
|
|
58294
|
-
|
|
58295
|
-
|
|
58296
|
-
|
|
58297
|
-
|
|
58298
|
-
|
|
58299
|
-
|
|
58300
|
-
|
|
58301
|
-
|
|
58302
|
-
|
|
58303
|
-
|
|
58304
|
-
|
|
58305
|
-
|
|
58306
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.
|
|
58307
|
-
|
|
58308
|
-
|
|
58309
|
-
|
|
58310
|
-
|
|
58311
|
-
|
|
58312
|
-
|
|
58313
|
-
|
|
58314
|
-
|
|
58315
|
-
/*
|
|
58316
|
-
|
|
58317
|
-
|
|
58318
|
-
|
|
58319
|
-
|
|
58320
|
-
|
|
58321
|
-
|
|
58322
|
-
|
|
58323
|
-
|
|
58324
|
-
|
|
58325
|
-
|
|
58326
|
-
|
|
58327
|
-
|
|
58328
|
-
{
|
|
58329
|
-
|
|
58330
|
-
|
|
58331
|
-
|
|
58332
|
-
|
|
58333
|
-
|
|
58334
|
-
|
|
58335
|
-
|
|
58336
|
-
|
|
58337
|
-
|
|
58338
|
-
{
|
|
58339
|
-
onClick: () => setView("card"),
|
|
58340
|
-
title: t6.depositWithCard.title,
|
|
58341
|
-
subtitle: t6.depositWithCard.subtitle,
|
|
58342
|
-
paymentNetworks: projectConfig.payment_networks.networks
|
|
58343
|
-
}
|
|
58344
|
-
),
|
|
58345
|
-
showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58346
|
-
PayWithExchangeButton,
|
|
58347
|
-
{
|
|
58348
|
-
onClick: () => setView("exchange"),
|
|
58349
|
-
title: t6.payWithExchange.title,
|
|
58350
|
-
subtitle: t6.payWithExchange.subtitle,
|
|
58351
|
-
exchanges,
|
|
58352
|
-
loading: exchangesLoading
|
|
58353
|
-
}
|
|
58354
|
-
),
|
|
58355
|
-
!hideDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58356
|
-
DepositTrackerButton,
|
|
58357
|
-
{
|
|
58358
|
-
onClick: () => {
|
|
58359
|
-
setAllExecutions(depositExecutions);
|
|
58360
|
-
setView("tracker");
|
|
58361
|
-
},
|
|
58362
|
-
title: "Deposit Tracker",
|
|
58363
|
-
subtitle: "Track your deposit progress",
|
|
58364
|
-
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
58365
|
-
}
|
|
58366
|
-
)
|
|
58367
|
-
] })
|
|
58368
|
-
) })
|
|
58356
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody ?? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
58357
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58358
|
+
TransferCryptoButton,
|
|
58359
|
+
{
|
|
58360
|
+
onClick: () => setView("transfer"),
|
|
58361
|
+
title: t6.transferCrypto.title,
|
|
58362
|
+
subtitle: t6.transferCrypto.subtitle,
|
|
58363
|
+
featuredTokens: projectConfig?.transfer_crypto.networks
|
|
58364
|
+
}
|
|
58365
|
+
),
|
|
58366
|
+
enableConnectWallet && !isMobileView && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58367
|
+
BrowserWalletButton,
|
|
58368
|
+
{
|
|
58369
|
+
onClick: handleBrowserWalletClick,
|
|
58370
|
+
onConnectClick: handleWalletConnectClick,
|
|
58371
|
+
onDisconnect: handleWalletDisconnect,
|
|
58372
|
+
chainType: browserWalletChainType,
|
|
58373
|
+
publishableKey
|
|
58374
|
+
}
|
|
58375
|
+
),
|
|
58376
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58377
|
+
DepositWithCardButton,
|
|
58378
|
+
{
|
|
58379
|
+
onClick: () => setView("card"),
|
|
58380
|
+
title: t6.depositWithCard.title,
|
|
58381
|
+
subtitle: t6.depositWithCard.subtitle,
|
|
58382
|
+
paymentNetworks: projectConfig?.payment_networks.networks
|
|
58383
|
+
}
|
|
58384
|
+
),
|
|
58385
|
+
showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58386
|
+
PayWithExchangeButton,
|
|
58387
|
+
{
|
|
58388
|
+
onClick: () => setView("exchange"),
|
|
58389
|
+
title: t6.payWithExchange.title,
|
|
58390
|
+
subtitle: t6.payWithExchange.subtitle,
|
|
58391
|
+
exchanges,
|
|
58392
|
+
loading: exchangesLoading
|
|
58393
|
+
}
|
|
58394
|
+
),
|
|
58395
|
+
!hideDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58396
|
+
DepositTrackerButton,
|
|
58397
|
+
{
|
|
58398
|
+
onClick: () => {
|
|
58399
|
+
setAllExecutions(depositExecutions);
|
|
58400
|
+
setView("tracker");
|
|
58401
|
+
},
|
|
58402
|
+
title: "Deposit Tracker",
|
|
58403
|
+
subtitle: "Track your deposit progress",
|
|
58404
|
+
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
58405
|
+
}
|
|
58406
|
+
)
|
|
58407
|
+
] }) })
|
|
58369
58408
|
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
58370
58409
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58371
58410
|
DepositHeader,
|
|
58372
58411
|
{
|
|
58373
58412
|
title: t6.transferCrypto.title,
|
|
58374
|
-
showBack:
|
|
58413
|
+
showBack: showBackTransfer,
|
|
58375
58414
|
onBack: handleBack,
|
|
58376
58415
|
onClose: handleClose,
|
|
58377
58416
|
showBalance: showBalanceHeader,
|
|
@@ -58383,7 +58422,7 @@ function DepositModal({
|
|
|
58383
58422
|
publishableKey
|
|
58384
58423
|
}
|
|
58385
58424
|
),
|
|
58386
|
-
transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58425
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58387
58426
|
TransferCryptoSingleInput,
|
|
58388
58427
|
{
|
|
58389
58428
|
userId,
|
|
@@ -58419,7 +58458,7 @@ function DepositModal({
|
|
|
58419
58458
|
DepositHeader,
|
|
58420
58459
|
{
|
|
58421
58460
|
title: selectedExecution ? "Deposit Details" : "Deposit Tracker",
|
|
58422
|
-
showBack:
|
|
58461
|
+
showBack: showBackTracker,
|
|
58423
58462
|
onBack: handleBack,
|
|
58424
58463
|
onClose: handleClose
|
|
58425
58464
|
}
|
|
@@ -58444,7 +58483,7 @@ function DepositModal({
|
|
|
58444
58483
|
DepositHeader,
|
|
58445
58484
|
{
|
|
58446
58485
|
title: cardView === "quotes" ? t6.quotes : t6.depositWithCard.title,
|
|
58447
|
-
showBack:
|
|
58486
|
+
showBack: showBackCard,
|
|
58448
58487
|
onBack: handleBack,
|
|
58449
58488
|
onClose: handleClose,
|
|
58450
58489
|
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
@@ -58457,7 +58496,7 @@ function DepositModal({
|
|
|
58457
58496
|
publishableKey
|
|
58458
58497
|
}
|
|
58459
58498
|
),
|
|
58460
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58499
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58461
58500
|
BuyWithCard,
|
|
58462
58501
|
{
|
|
58463
58502
|
userId,
|
|
@@ -58747,7 +58786,8 @@ function UnifoldProvider2({
|
|
|
58747
58786
|
enablePayWithExchange: config?.enablePayWithExchange,
|
|
58748
58787
|
onDepositSuccess: handleDepositSuccess,
|
|
58749
58788
|
onDepositError: handleDepositError,
|
|
58750
|
-
theme: resolvedTheme
|
|
58789
|
+
theme: resolvedTheme,
|
|
58790
|
+
initialScreen: depositConfig.initialScreen ?? config?.defaultInitialScreen
|
|
58751
58791
|
}
|
|
58752
58792
|
)
|
|
58753
58793
|
]
|
package/dist/index.mjs
CHANGED
|
@@ -38698,18 +38698,18 @@ function composeContextScopes(...scopes) {
|
|
|
38698
38698
|
createScope.scopeName = baseScope.scopeName;
|
|
38699
38699
|
return createScope;
|
|
38700
38700
|
}
|
|
38701
|
-
var
|
|
38701
|
+
var useLayoutEffect23 = globalThis?.document ? React32.useLayoutEffect : () => {
|
|
38702
38702
|
};
|
|
38703
38703
|
var useReactId = React42[" useId ".trim().toString()] || (() => void 0);
|
|
38704
38704
|
var count = 0;
|
|
38705
38705
|
function useId13(deterministicId) {
|
|
38706
38706
|
const [id, setId] = React42.useState(useReactId());
|
|
38707
|
-
|
|
38707
|
+
useLayoutEffect23(() => {
|
|
38708
38708
|
if (!deterministicId) setId((reactId) => reactId ?? String(count++));
|
|
38709
38709
|
}, [deterministicId]);
|
|
38710
38710
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
38711
38711
|
}
|
|
38712
|
-
var useInsertionEffect = React52[" useInsertionEffect ".trim().toString()] ||
|
|
38712
|
+
var useInsertionEffect = React52[" useInsertionEffect ".trim().toString()] || useLayoutEffect23;
|
|
38713
38713
|
function useControllableState({
|
|
38714
38714
|
prop,
|
|
38715
38715
|
defaultProp,
|
|
@@ -39324,7 +39324,7 @@ var PORTAL_NAME = "Portal";
|
|
|
39324
39324
|
var Portal = React12.forwardRef((props, forwardedRef) => {
|
|
39325
39325
|
const { container: containerProp, ...portalProps } = props;
|
|
39326
39326
|
const [mounted, setMounted] = React12.useState(false);
|
|
39327
|
-
|
|
39327
|
+
useLayoutEffect23(() => setMounted(true), []);
|
|
39328
39328
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
39329
39329
|
return container ? import_react_dom.default.createPortal(/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
39330
39330
|
});
|
|
@@ -39367,7 +39367,7 @@ function usePresence(present) {
|
|
|
39367
39367
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
39368
39368
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
39369
39369
|
}, [state]);
|
|
39370
|
-
|
|
39370
|
+
useLayoutEffect23(() => {
|
|
39371
39371
|
const styles = stylesRef.current;
|
|
39372
39372
|
const wasPresent = prevPresentRef.current;
|
|
39373
39373
|
const hasPresentChanged = wasPresent !== present;
|
|
@@ -39389,7 +39389,7 @@ function usePresence(present) {
|
|
|
39389
39389
|
prevPresentRef.current = present;
|
|
39390
39390
|
}
|
|
39391
39391
|
}, [present, send]);
|
|
39392
|
-
|
|
39392
|
+
useLayoutEffect23(() => {
|
|
39393
39393
|
if (node) {
|
|
39394
39394
|
let timeoutId;
|
|
39395
39395
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
@@ -45402,7 +45402,7 @@ Arrow.displayName = NAME;
|
|
|
45402
45402
|
var Root2 = Arrow;
|
|
45403
45403
|
function useSize(element) {
|
|
45404
45404
|
const [size4, setSize] = React27.useState(void 0);
|
|
45405
|
-
|
|
45405
|
+
useLayoutEffect23(() => {
|
|
45406
45406
|
if (element) {
|
|
45407
45407
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
45408
45408
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
@@ -45539,7 +45539,7 @@ var PopperContent = React28.forwardRef(
|
|
|
45539
45539
|
});
|
|
45540
45540
|
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
45541
45541
|
const handlePlaced = useCallbackRef(onPlaced);
|
|
45542
|
-
|
|
45542
|
+
useLayoutEffect23(() => {
|
|
45543
45543
|
if (isPositioned) {
|
|
45544
45544
|
handlePlaced?.();
|
|
45545
45545
|
}
|
|
@@ -45548,7 +45548,7 @@ var PopperContent = React28.forwardRef(
|
|
|
45548
45548
|
const arrowY = middlewareData.arrow?.y;
|
|
45549
45549
|
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
45550
45550
|
const [contentZIndex, setContentZIndex] = React28.useState();
|
|
45551
|
-
|
|
45551
|
+
useLayoutEffect23(() => {
|
|
45552
45552
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
45553
45553
|
}, [content]);
|
|
45554
45554
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -46479,7 +46479,7 @@ var SelectValue = React34.forwardRef(
|
|
|
46479
46479
|
const { onValueNodeHasChildrenChange } = context;
|
|
46480
46480
|
const hasChildren = children !== void 0;
|
|
46481
46481
|
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
46482
|
-
|
|
46482
|
+
useLayoutEffect23(() => {
|
|
46483
46483
|
onValueNodeHasChildrenChange(hasChildren);
|
|
46484
46484
|
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
46485
46485
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -46512,7 +46512,7 @@ var SelectContent = React34.forwardRef(
|
|
|
46512
46512
|
(props, forwardedRef) => {
|
|
46513
46513
|
const context = useSelectContext(CONTENT_NAME4, props.__scopeSelect);
|
|
46514
46514
|
const [fragment, setFragment] = React34.useState();
|
|
46515
|
-
|
|
46515
|
+
useLayoutEffect23(() => {
|
|
46516
46516
|
setFragment(new DocumentFragment());
|
|
46517
46517
|
}, []);
|
|
46518
46518
|
if (!context.open) {
|
|
@@ -46874,9 +46874,9 @@ var SelectItemAlignedPosition = React34.forwardRef((props, forwardedRef) => {
|
|
|
46874
46874
|
context.dir,
|
|
46875
46875
|
onPlaced
|
|
46876
46876
|
]);
|
|
46877
|
-
|
|
46877
|
+
useLayoutEffect23(() => position(), [position]);
|
|
46878
46878
|
const [contentZIndex, setContentZIndex] = React34.useState();
|
|
46879
|
-
|
|
46879
|
+
useLayoutEffect23(() => {
|
|
46880
46880
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
46881
46881
|
}, [content]);
|
|
46882
46882
|
const handleScrollButtonChange = React34.useCallback(
|
|
@@ -47173,7 +47173,7 @@ var SelectItemText = React34.forwardRef(
|
|
|
47173
47173
|
[itemContext.disabled, itemContext.value, textContent]
|
|
47174
47174
|
);
|
|
47175
47175
|
const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;
|
|
47176
|
-
|
|
47176
|
+
useLayoutEffect23(() => {
|
|
47177
47177
|
onNativeOptionAdd(nativeOption);
|
|
47178
47178
|
return () => onNativeOptionRemove(nativeOption);
|
|
47179
47179
|
}, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
|
|
@@ -47199,7 +47199,7 @@ var SelectScrollUpButton = React34.forwardRef((props, forwardedRef) => {
|
|
|
47199
47199
|
const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
47200
47200
|
const [canScrollUp, setCanScrollUp] = React34.useState(false);
|
|
47201
47201
|
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
47202
|
-
|
|
47202
|
+
useLayoutEffect23(() => {
|
|
47203
47203
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
47204
47204
|
let handleScroll22 = function() {
|
|
47205
47205
|
const canScrollUp2 = viewport.scrollTop > 0;
|
|
@@ -47233,7 +47233,7 @@ var SelectScrollDownButton = React34.forwardRef((props, forwardedRef) => {
|
|
|
47233
47233
|
const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
47234
47234
|
const [canScrollDown, setCanScrollDown] = React34.useState(false);
|
|
47235
47235
|
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
47236
|
-
|
|
47236
|
+
useLayoutEffect23(() => {
|
|
47237
47237
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
47238
47238
|
let handleScroll22 = function() {
|
|
47239
47239
|
const maxScroll = viewport.scrollHeight - viewport.clientHeight;
|
|
@@ -47276,7 +47276,7 @@ var SelectScrollButtonImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
47276
47276
|
React34.useEffect(() => {
|
|
47277
47277
|
return () => clearAutoScrollTimer();
|
|
47278
47278
|
}, [clearAutoScrollTimer]);
|
|
47279
|
-
|
|
47279
|
+
useLayoutEffect23(() => {
|
|
47280
47280
|
const activeItem = getItems().find((item) => item.ref.current === document.activeElement);
|
|
47281
47281
|
activeItem?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
47282
47282
|
}, [getItems]);
|
|
@@ -58014,14 +58014,23 @@ function DepositModal({
|
|
|
58014
58014
|
onDepositSuccess,
|
|
58015
58015
|
onDepositError,
|
|
58016
58016
|
theme = "dark",
|
|
58017
|
-
hideOverlay = false
|
|
58017
|
+
hideOverlay = false,
|
|
58018
|
+
initialScreen = "main"
|
|
58018
58019
|
}) {
|
|
58019
58020
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58021
|
+
const effectiveInitialScreen = (0, import_react3.useMemo)(() => {
|
|
58022
|
+
const s = initialScreen ?? "main";
|
|
58023
|
+
if (s === "tracker" && hideDepositTracker) return "main";
|
|
58024
|
+
return s;
|
|
58025
|
+
}, [initialScreen, hideDepositTracker]);
|
|
58020
58026
|
const [containerEl, setContainerEl] = (0, import_react3.useState)(null);
|
|
58021
58027
|
const containerCallbackRef = (0, import_react3.useCallback)((el) => {
|
|
58022
58028
|
setContainerEl(el);
|
|
58023
58029
|
}, []);
|
|
58024
|
-
const [view, setView] = (0, import_react3.useState)(
|
|
58030
|
+
const [view, setView] = (0, import_react3.useState)(
|
|
58031
|
+
effectiveInitialScreen
|
|
58032
|
+
);
|
|
58033
|
+
const resetViewTimeoutRef = (0, import_react3.useRef)(null);
|
|
58025
58034
|
const [cardView, setCardView] = (0, import_react3.useState)(
|
|
58026
58035
|
"amount"
|
|
58027
58036
|
);
|
|
@@ -58141,6 +58150,43 @@ function DepositModal({
|
|
|
58141
58150
|
const template = errors[code] ?? addressValidationMessages.defaultError;
|
|
58142
58151
|
return interpolate(template, metadata);
|
|
58143
58152
|
};
|
|
58153
|
+
const openingScreen = effectiveInitialScreen;
|
|
58154
|
+
const sessionOpenedFromMenu = openingScreen === "main";
|
|
58155
|
+
const standaloneNeedsDepositPrereq = openingScreen !== "main" && (view === "transfer" || view === "card");
|
|
58156
|
+
let depositPrerequisiteBody;
|
|
58157
|
+
if (isCountryLoading || isAddressValidationLoading || tokensLoading || walletsLoading || !projectConfig) {
|
|
58158
|
+
depositPrerequisiteBody = standaloneNeedsDepositPrereq ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, { variant: "with-icons" }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
58159
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, { variant: "with-icons" }),
|
|
58160
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, { variant: "with-icons" }),
|
|
58161
|
+
!hideDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonButton, {})
|
|
58162
|
+
] });
|
|
58163
|
+
} else if (countryError) {
|
|
58164
|
+
depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
58165
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
58166
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: "Unable to Verify Location" }),
|
|
58167
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: "We couldn't verify your location. Please check your connection and try again." })
|
|
58168
|
+
] });
|
|
58169
|
+
} else if (!isAllowed) {
|
|
58170
|
+
depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
58171
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(MapPinOff, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
58172
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: "No Tokens Available" }),
|
|
58173
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: "There are no supported tokens available from your current location." })
|
|
58174
|
+
] });
|
|
58175
|
+
} else if (isAddressValid === false) {
|
|
58176
|
+
depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
58177
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
58178
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: addressValidationMessages.unableToReceiveFunds }),
|
|
58179
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: getAddressValidationErrorMessage(
|
|
58180
|
+
addressFailureCode,
|
|
58181
|
+
addressFailureMetadata
|
|
58182
|
+
) })
|
|
58183
|
+
] });
|
|
58184
|
+
} else {
|
|
58185
|
+
depositPrerequisiteBody = null;
|
|
58186
|
+
}
|
|
58187
|
+
const showBackTransfer = sessionOpenedFromMenu;
|
|
58188
|
+
const showBackCard = cardView !== "amount" || sessionOpenedFromMenu;
|
|
58189
|
+
const showBackTracker = selectedExecution !== null || sessionOpenedFromMenu;
|
|
58144
58190
|
const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
|
|
58145
58191
|
const handleWalletDisconnect = () => {
|
|
58146
58192
|
setUserDisconnectedWallet(true);
|
|
@@ -58151,13 +58197,37 @@ function DepositModal({
|
|
|
58151
58197
|
};
|
|
58152
58198
|
const handleClose = () => {
|
|
58153
58199
|
onOpenChange(false);
|
|
58154
|
-
|
|
58155
|
-
|
|
58200
|
+
if (resetViewTimeoutRef.current) {
|
|
58201
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
58202
|
+
}
|
|
58203
|
+
resetViewTimeoutRef.current = setTimeout(() => {
|
|
58204
|
+
setView(effectiveInitialScreen);
|
|
58156
58205
|
setCardView("amount");
|
|
58157
58206
|
setExchangeView("providers");
|
|
58158
58207
|
setBrowserWalletInfo(null);
|
|
58208
|
+
resetViewTimeoutRef.current = null;
|
|
58159
58209
|
}, 200);
|
|
58160
58210
|
};
|
|
58211
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
58212
|
+
if (!open) return;
|
|
58213
|
+
if (resetViewTimeoutRef.current) {
|
|
58214
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
58215
|
+
resetViewTimeoutRef.current = null;
|
|
58216
|
+
}
|
|
58217
|
+
setView(effectiveInitialScreen);
|
|
58218
|
+
setCardView("amount");
|
|
58219
|
+
setExchangeView("providers");
|
|
58220
|
+
setBrowserWalletInfo(null);
|
|
58221
|
+
setSelectedExecution(null);
|
|
58222
|
+
}, [open, effectiveInitialScreen]);
|
|
58223
|
+
(0, import_react3.useEffect)(
|
|
58224
|
+
() => () => {
|
|
58225
|
+
if (resetViewTimeoutRef.current) {
|
|
58226
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
58227
|
+
}
|
|
58228
|
+
},
|
|
58229
|
+
[]
|
|
58230
|
+
);
|
|
58161
58231
|
const handleBack = () => {
|
|
58162
58232
|
if (view === "card" && cardView === "quotes") {
|
|
58163
58233
|
setCardView("amount");
|
|
@@ -58270,95 +58340,64 @@ function DepositModal({
|
|
|
58270
58340
|
publishableKey
|
|
58271
58341
|
}
|
|
58272
58342
|
),
|
|
58273
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children:
|
|
58274
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58275
|
-
|
|
58276
|
-
|
|
58277
|
-
|
|
58278
|
-
|
|
58279
|
-
|
|
58280
|
-
|
|
58281
|
-
|
|
58282
|
-
|
|
58283
|
-
|
|
58284
|
-
|
|
58285
|
-
|
|
58286
|
-
|
|
58287
|
-
|
|
58288
|
-
|
|
58289
|
-
|
|
58290
|
-
|
|
58291
|
-
|
|
58292
|
-
|
|
58293
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.
|
|
58294
|
-
|
|
58295
|
-
|
|
58296
|
-
|
|
58297
|
-
|
|
58298
|
-
|
|
58299
|
-
|
|
58300
|
-
|
|
58301
|
-
|
|
58302
|
-
/*
|
|
58303
|
-
|
|
58304
|
-
|
|
58305
|
-
|
|
58306
|
-
|
|
58307
|
-
|
|
58308
|
-
|
|
58309
|
-
|
|
58310
|
-
|
|
58311
|
-
|
|
58312
|
-
|
|
58313
|
-
|
|
58314
|
-
|
|
58315
|
-
{
|
|
58316
|
-
|
|
58317
|
-
|
|
58318
|
-
|
|
58319
|
-
|
|
58320
|
-
|
|
58321
|
-
|
|
58322
|
-
|
|
58323
|
-
|
|
58324
|
-
|
|
58325
|
-
{
|
|
58326
|
-
onClick: () => setView("card"),
|
|
58327
|
-
title: t6.depositWithCard.title,
|
|
58328
|
-
subtitle: t6.depositWithCard.subtitle,
|
|
58329
|
-
paymentNetworks: projectConfig.payment_networks.networks
|
|
58330
|
-
}
|
|
58331
|
-
),
|
|
58332
|
-
showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58333
|
-
PayWithExchangeButton,
|
|
58334
|
-
{
|
|
58335
|
-
onClick: () => setView("exchange"),
|
|
58336
|
-
title: t6.payWithExchange.title,
|
|
58337
|
-
subtitle: t6.payWithExchange.subtitle,
|
|
58338
|
-
exchanges,
|
|
58339
|
-
loading: exchangesLoading
|
|
58340
|
-
}
|
|
58341
|
-
),
|
|
58342
|
-
!hideDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58343
|
-
DepositTrackerButton,
|
|
58344
|
-
{
|
|
58345
|
-
onClick: () => {
|
|
58346
|
-
setAllExecutions(depositExecutions);
|
|
58347
|
-
setView("tracker");
|
|
58348
|
-
},
|
|
58349
|
-
title: "Deposit Tracker",
|
|
58350
|
-
subtitle: "Track your deposit progress",
|
|
58351
|
-
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
58352
|
-
}
|
|
58353
|
-
)
|
|
58354
|
-
] })
|
|
58355
|
-
) })
|
|
58343
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody ?? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
58344
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58345
|
+
TransferCryptoButton,
|
|
58346
|
+
{
|
|
58347
|
+
onClick: () => setView("transfer"),
|
|
58348
|
+
title: t6.transferCrypto.title,
|
|
58349
|
+
subtitle: t6.transferCrypto.subtitle,
|
|
58350
|
+
featuredTokens: projectConfig?.transfer_crypto.networks
|
|
58351
|
+
}
|
|
58352
|
+
),
|
|
58353
|
+
enableConnectWallet && !isMobileView && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58354
|
+
BrowserWalletButton,
|
|
58355
|
+
{
|
|
58356
|
+
onClick: handleBrowserWalletClick,
|
|
58357
|
+
onConnectClick: handleWalletConnectClick,
|
|
58358
|
+
onDisconnect: handleWalletDisconnect,
|
|
58359
|
+
chainType: browserWalletChainType,
|
|
58360
|
+
publishableKey
|
|
58361
|
+
}
|
|
58362
|
+
),
|
|
58363
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58364
|
+
DepositWithCardButton,
|
|
58365
|
+
{
|
|
58366
|
+
onClick: () => setView("card"),
|
|
58367
|
+
title: t6.depositWithCard.title,
|
|
58368
|
+
subtitle: t6.depositWithCard.subtitle,
|
|
58369
|
+
paymentNetworks: projectConfig?.payment_networks.networks
|
|
58370
|
+
}
|
|
58371
|
+
),
|
|
58372
|
+
showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58373
|
+
PayWithExchangeButton,
|
|
58374
|
+
{
|
|
58375
|
+
onClick: () => setView("exchange"),
|
|
58376
|
+
title: t6.payWithExchange.title,
|
|
58377
|
+
subtitle: t6.payWithExchange.subtitle,
|
|
58378
|
+
exchanges,
|
|
58379
|
+
loading: exchangesLoading
|
|
58380
|
+
}
|
|
58381
|
+
),
|
|
58382
|
+
!hideDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58383
|
+
DepositTrackerButton,
|
|
58384
|
+
{
|
|
58385
|
+
onClick: () => {
|
|
58386
|
+
setAllExecutions(depositExecutions);
|
|
58387
|
+
setView("tracker");
|
|
58388
|
+
},
|
|
58389
|
+
title: "Deposit Tracker",
|
|
58390
|
+
subtitle: "Track your deposit progress",
|
|
58391
|
+
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
58392
|
+
}
|
|
58393
|
+
)
|
|
58394
|
+
] }) })
|
|
58356
58395
|
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
58357
58396
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58358
58397
|
DepositHeader,
|
|
58359
58398
|
{
|
|
58360
58399
|
title: t6.transferCrypto.title,
|
|
58361
|
-
showBack:
|
|
58400
|
+
showBack: showBackTransfer,
|
|
58362
58401
|
onBack: handleBack,
|
|
58363
58402
|
onClose: handleClose,
|
|
58364
58403
|
showBalance: showBalanceHeader,
|
|
@@ -58370,7 +58409,7 @@ function DepositModal({
|
|
|
58370
58409
|
publishableKey
|
|
58371
58410
|
}
|
|
58372
58411
|
),
|
|
58373
|
-
transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58412
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58374
58413
|
TransferCryptoSingleInput,
|
|
58375
58414
|
{
|
|
58376
58415
|
userId,
|
|
@@ -58406,7 +58445,7 @@ function DepositModal({
|
|
|
58406
58445
|
DepositHeader,
|
|
58407
58446
|
{
|
|
58408
58447
|
title: selectedExecution ? "Deposit Details" : "Deposit Tracker",
|
|
58409
|
-
showBack:
|
|
58448
|
+
showBack: showBackTracker,
|
|
58410
58449
|
onBack: handleBack,
|
|
58411
58450
|
onClose: handleClose
|
|
58412
58451
|
}
|
|
@@ -58431,7 +58470,7 @@ function DepositModal({
|
|
|
58431
58470
|
DepositHeader,
|
|
58432
58471
|
{
|
|
58433
58472
|
title: cardView === "quotes" ? t6.quotes : t6.depositWithCard.title,
|
|
58434
|
-
showBack:
|
|
58473
|
+
showBack: showBackCard,
|
|
58435
58474
|
onBack: handleBack,
|
|
58436
58475
|
onClose: handleClose,
|
|
58437
58476
|
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
@@ -58444,7 +58483,7 @@ function DepositModal({
|
|
|
58444
58483
|
publishableKey
|
|
58445
58484
|
}
|
|
58446
58485
|
),
|
|
58447
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58486
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
58448
58487
|
BuyWithCard,
|
|
58449
58488
|
{
|
|
58450
58489
|
userId,
|
|
@@ -58734,7 +58773,8 @@ function UnifoldProvider2({
|
|
|
58734
58773
|
enablePayWithExchange: config?.enablePayWithExchange,
|
|
58735
58774
|
onDepositSuccess: handleDepositSuccess,
|
|
58736
58775
|
onDepositError: handleDepositError,
|
|
58737
|
-
theme: resolvedTheme
|
|
58776
|
+
theme: resolvedTheme,
|
|
58777
|
+
initialScreen: depositConfig.initialScreen ?? config?.defaultInitialScreen
|
|
58738
58778
|
}
|
|
58739
58779
|
)
|
|
58740
58780
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/ui-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"description": "Unifold UI Web - Framework-agnostic deposit widget",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@types/react-dom": "^19.0.0",
|
|
28
28
|
"tsup": "^8.0.0",
|
|
29
29
|
"typescript": "^5.0.0",
|
|
30
|
-
"@unifold/connect-react": "0.1.
|
|
31
|
-
"@unifold/
|
|
32
|
-
"@unifold/react
|
|
33
|
-
"@unifold/
|
|
30
|
+
"@unifold/connect-react": "0.1.36",
|
|
31
|
+
"@unifold/core": "0.1.36",
|
|
32
|
+
"@unifold/ui-react": "0.1.36",
|
|
33
|
+
"@unifold/react-provider": "0.1.36"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"unifold",
|