@swype-org/react-sdk 0.1.102 → 0.1.104
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.cjs +332 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +332 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -223,6 +223,9 @@ async function createAccount(apiBaseUrl, token, params) {
|
|
|
223
223
|
credentialId: params.credentialId,
|
|
224
224
|
providerId: params.providerId
|
|
225
225
|
};
|
|
226
|
+
if (params.nickname) {
|
|
227
|
+
body.nickname = params.nickname;
|
|
228
|
+
}
|
|
226
229
|
const res = await fetch(`${apiBaseUrl}/v1/accounts`, {
|
|
227
230
|
method: "POST",
|
|
228
231
|
headers: {
|
|
@@ -2555,36 +2558,165 @@ var KNOWN_LOGOS = {
|
|
|
2555
2558
|
base: BASE_LOGO,
|
|
2556
2559
|
"trust wallet": TRUST_WALLET_LOGO
|
|
2557
2560
|
};
|
|
2558
|
-
function
|
|
2561
|
+
function hasActiveWallet2(account) {
|
|
2562
|
+
return account.wallets.some((w) => w.status === "ACTIVE");
|
|
2563
|
+
}
|
|
2564
|
+
function SourceCard({
|
|
2565
|
+
name,
|
|
2566
|
+
address,
|
|
2567
|
+
verified,
|
|
2568
|
+
accounts,
|
|
2569
|
+
selectedAccountId,
|
|
2570
|
+
onSelectAccount,
|
|
2571
|
+
onAuthorizeAccount,
|
|
2572
|
+
onAddProvider
|
|
2573
|
+
}) {
|
|
2559
2574
|
const { tokens } = useSwypeConfig();
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2575
|
+
const [open, setOpen] = react.useState(false);
|
|
2576
|
+
const containerRef = react.useRef(null);
|
|
2577
|
+
const hasDropdown = accounts != null && accounts.length > 0;
|
|
2578
|
+
react.useEffect(() => {
|
|
2579
|
+
if (!open) return;
|
|
2580
|
+
const handleClick = (e) => {
|
|
2581
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
2582
|
+
setOpen(false);
|
|
2583
|
+
}
|
|
2584
|
+
};
|
|
2585
|
+
document.addEventListener("mousedown", handleClick);
|
|
2586
|
+
return () => document.removeEventListener("mousedown", handleClick);
|
|
2587
|
+
}, [open]);
|
|
2588
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, style: { position: "relative" }, children: [
|
|
2589
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: cardContainerStyle(tokens), children: [
|
|
2590
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: leftStyle, children: [
|
|
2591
|
+
KNOWN_LOGOS[name.toLowerCase()] ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2592
|
+
"img",
|
|
2593
|
+
{
|
|
2594
|
+
src: KNOWN_LOGOS[name.toLowerCase()],
|
|
2595
|
+
alt: name,
|
|
2596
|
+
style: logoImgStyle
|
|
2597
|
+
}
|
|
2598
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: iconStyle3(tokens.textMuted), children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2599
|
+
"path",
|
|
2600
|
+
{
|
|
2601
|
+
d: "M21 7H3c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zm0 8H3V9h18v6z",
|
|
2602
|
+
fill: "currentColor"
|
|
2603
|
+
}
|
|
2604
|
+
) }) }),
|
|
2605
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2606
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: nameRowStyle, children: [
|
|
2607
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: nameStyle(tokens.text), children: name }),
|
|
2608
|
+
verified && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.accent }) })
|
|
2609
|
+
] }),
|
|
2610
|
+
address && /* @__PURE__ */ jsxRuntime.jsx("span", { style: addressStyle(tokens.textMuted), children: address })
|
|
2611
|
+
] })
|
|
2612
|
+
] }),
|
|
2613
|
+
hasDropdown && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2614
|
+
"button",
|
|
2571
2615
|
{
|
|
2572
|
-
|
|
2573
|
-
|
|
2616
|
+
type: "button",
|
|
2617
|
+
onClick: () => setOpen(!open),
|
|
2618
|
+
style: changeStyle(tokens.accent),
|
|
2619
|
+
children: [
|
|
2620
|
+
"Change source",
|
|
2621
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2622
|
+
"svg",
|
|
2623
|
+
{
|
|
2624
|
+
width: "10",
|
|
2625
|
+
height: "10",
|
|
2626
|
+
viewBox: "0 0 24 24",
|
|
2627
|
+
fill: "none",
|
|
2628
|
+
style: {
|
|
2629
|
+
marginLeft: 4,
|
|
2630
|
+
transform: open ? "rotate(180deg)" : "rotate(0deg)",
|
|
2631
|
+
transition: "transform 0.15s ease"
|
|
2632
|
+
},
|
|
2633
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2634
|
+
"path",
|
|
2635
|
+
{
|
|
2636
|
+
d: "M7 10l5 5 5-5",
|
|
2637
|
+
stroke: tokens.accent,
|
|
2638
|
+
strokeWidth: "2.5",
|
|
2639
|
+
strokeLinecap: "round",
|
|
2640
|
+
strokeLinejoin: "round"
|
|
2641
|
+
}
|
|
2642
|
+
)
|
|
2643
|
+
}
|
|
2644
|
+
)
|
|
2645
|
+
]
|
|
2574
2646
|
}
|
|
2575
|
-
)
|
|
2576
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2577
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: nameRowStyle, children: [
|
|
2578
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: nameStyle(tokens.text), children: name }),
|
|
2579
|
-
verified && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.accent }) })
|
|
2580
|
-
] }),
|
|
2581
|
-
address && /* @__PURE__ */ jsxRuntime.jsx("span", { style: addressStyle(tokens.textMuted), children: address })
|
|
2582
|
-
] })
|
|
2647
|
+
)
|
|
2583
2648
|
] }),
|
|
2584
|
-
|
|
2649
|
+
open && hasDropdown && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownStyle(tokens), children: [
|
|
2650
|
+
accounts.map((account) => {
|
|
2651
|
+
const active = hasActiveWallet2(account);
|
|
2652
|
+
const isSelected = account.id === selectedAccountId;
|
|
2653
|
+
const displayName = account.nickname ?? account.name;
|
|
2654
|
+
const walletAddress = account.wallets[0]?.name;
|
|
2655
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2656
|
+
"button",
|
|
2657
|
+
{
|
|
2658
|
+
type: "button",
|
|
2659
|
+
onClick: () => {
|
|
2660
|
+
if (active) {
|
|
2661
|
+
onSelectAccount?.(account.id);
|
|
2662
|
+
} else {
|
|
2663
|
+
onAuthorizeAccount?.(account.id);
|
|
2664
|
+
}
|
|
2665
|
+
setOpen(false);
|
|
2666
|
+
},
|
|
2667
|
+
style: dropdownRowStyle(tokens, active, isSelected),
|
|
2668
|
+
children: [
|
|
2669
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownRowLeftStyle, children: [
|
|
2670
|
+
KNOWN_LOGOS[account.name.toLowerCase()] ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2671
|
+
"img",
|
|
2672
|
+
{
|
|
2673
|
+
src: KNOWN_LOGOS[account.name.toLowerCase()],
|
|
2674
|
+
alt: account.name,
|
|
2675
|
+
style: dropdownLogoStyle
|
|
2676
|
+
}
|
|
2677
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownFallbackIconStyle(active ? tokens.textMuted : tokens.border), children: account.name.charAt(0) }),
|
|
2678
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownNameColumnStyle, children: [
|
|
2679
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dropdownNameStyle(active ? tokens.text : tokens.textMuted), children: displayName }),
|
|
2680
|
+
walletAddress && /* @__PURE__ */ jsxRuntime.jsx("span", { style: dropdownAddressStyle(active ? tokens.textMuted : tokens.border), children: walletAddress })
|
|
2681
|
+
] })
|
|
2682
|
+
] }),
|
|
2683
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownRowRightStyle, children: [
|
|
2684
|
+
active ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: activeBadgeStyle(tokens), children: "Active" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: inactiveBadgeStyle(tokens), children: "Setup incomplete" }),
|
|
2685
|
+
isSelected && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2686
|
+
"path",
|
|
2687
|
+
{
|
|
2688
|
+
d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",
|
|
2689
|
+
fill: tokens.accent
|
|
2690
|
+
}
|
|
2691
|
+
) })
|
|
2692
|
+
] })
|
|
2693
|
+
]
|
|
2694
|
+
},
|
|
2695
|
+
account.id
|
|
2696
|
+
);
|
|
2697
|
+
}),
|
|
2698
|
+
onAddProvider && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2699
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownDividerStyle(tokens.border) }),
|
|
2700
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2701
|
+
"button",
|
|
2702
|
+
{
|
|
2703
|
+
type: "button",
|
|
2704
|
+
onClick: () => {
|
|
2705
|
+
onAddProvider();
|
|
2706
|
+
setOpen(false);
|
|
2707
|
+
},
|
|
2708
|
+
style: addProviderStyle(tokens),
|
|
2709
|
+
children: [
|
|
2710
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) }),
|
|
2711
|
+
"Add Account"
|
|
2712
|
+
]
|
|
2713
|
+
}
|
|
2714
|
+
)
|
|
2715
|
+
] })
|
|
2716
|
+
] })
|
|
2585
2717
|
] });
|
|
2586
2718
|
}
|
|
2587
|
-
var
|
|
2719
|
+
var cardContainerStyle = (tokens) => ({
|
|
2588
2720
|
display: "flex",
|
|
2589
2721
|
alignItems: "center",
|
|
2590
2722
|
justifyContent: "space-between",
|
|
@@ -2625,6 +2757,8 @@ var addressStyle = (color) => ({
|
|
|
2625
2757
|
fontFamily: '"SF Mono", "Fira Code", monospace'
|
|
2626
2758
|
});
|
|
2627
2759
|
var changeStyle = (color) => ({
|
|
2760
|
+
display: "flex",
|
|
2761
|
+
alignItems: "center",
|
|
2628
2762
|
background: "transparent",
|
|
2629
2763
|
border: "none",
|
|
2630
2764
|
color,
|
|
@@ -2634,6 +2768,131 @@ var changeStyle = (color) => ({
|
|
|
2634
2768
|
fontFamily: "inherit",
|
|
2635
2769
|
padding: 0
|
|
2636
2770
|
});
|
|
2771
|
+
var dropdownStyle = (tokens) => ({
|
|
2772
|
+
position: "absolute",
|
|
2773
|
+
top: "100%",
|
|
2774
|
+
left: 0,
|
|
2775
|
+
right: 0,
|
|
2776
|
+
marginTop: 4,
|
|
2777
|
+
background: tokens.bgCard,
|
|
2778
|
+
border: `1px solid ${tokens.border}`,
|
|
2779
|
+
borderRadius: tokens.radiusLg,
|
|
2780
|
+
boxShadow: tokens.shadowLg,
|
|
2781
|
+
zIndex: 50,
|
|
2782
|
+
overflow: "hidden"
|
|
2783
|
+
});
|
|
2784
|
+
var dropdownRowStyle = (tokens, active, isSelected) => ({
|
|
2785
|
+
display: "flex",
|
|
2786
|
+
alignItems: "center",
|
|
2787
|
+
justifyContent: "space-between",
|
|
2788
|
+
width: "100%",
|
|
2789
|
+
padding: "10px 14px",
|
|
2790
|
+
background: isSelected ? tokens.accent + "12" : "transparent",
|
|
2791
|
+
border: "none",
|
|
2792
|
+
borderBottom: `1px solid ${tokens.border}`,
|
|
2793
|
+
cursor: "pointer",
|
|
2794
|
+
fontFamily: "inherit",
|
|
2795
|
+
fontSize: "0.85rem",
|
|
2796
|
+
textAlign: "left",
|
|
2797
|
+
outline: "none",
|
|
2798
|
+
opacity: active ? 1 : 0.55,
|
|
2799
|
+
transition: "background 0.1s ease"
|
|
2800
|
+
});
|
|
2801
|
+
var dropdownRowLeftStyle = {
|
|
2802
|
+
display: "flex",
|
|
2803
|
+
alignItems: "center",
|
|
2804
|
+
gap: 10,
|
|
2805
|
+
minWidth: 0,
|
|
2806
|
+
flex: 1
|
|
2807
|
+
};
|
|
2808
|
+
var dropdownRowRightStyle = {
|
|
2809
|
+
display: "flex",
|
|
2810
|
+
alignItems: "center",
|
|
2811
|
+
gap: 8,
|
|
2812
|
+
flexShrink: 0
|
|
2813
|
+
};
|
|
2814
|
+
var dropdownLogoStyle = {
|
|
2815
|
+
width: 20,
|
|
2816
|
+
height: 20,
|
|
2817
|
+
borderRadius: "50%",
|
|
2818
|
+
objectFit: "contain",
|
|
2819
|
+
flexShrink: 0
|
|
2820
|
+
};
|
|
2821
|
+
var dropdownFallbackIconStyle = (color) => ({
|
|
2822
|
+
width: 20,
|
|
2823
|
+
height: 20,
|
|
2824
|
+
borderRadius: "50%",
|
|
2825
|
+
display: "flex",
|
|
2826
|
+
alignItems: "center",
|
|
2827
|
+
justifyContent: "center",
|
|
2828
|
+
fontSize: "0.72rem",
|
|
2829
|
+
fontWeight: 700,
|
|
2830
|
+
color,
|
|
2831
|
+
flexShrink: 0
|
|
2832
|
+
});
|
|
2833
|
+
var dropdownNameColumnStyle = {
|
|
2834
|
+
display: "flex",
|
|
2835
|
+
flexDirection: "column",
|
|
2836
|
+
gap: 2,
|
|
2837
|
+
minWidth: 0
|
|
2838
|
+
};
|
|
2839
|
+
var dropdownNameStyle = (color) => ({
|
|
2840
|
+
fontWeight: 500,
|
|
2841
|
+
color,
|
|
2842
|
+
whiteSpace: "nowrap",
|
|
2843
|
+
overflow: "hidden",
|
|
2844
|
+
textOverflow: "ellipsis"
|
|
2845
|
+
});
|
|
2846
|
+
var dropdownAddressStyle = (color) => ({
|
|
2847
|
+
fontSize: "0.72rem",
|
|
2848
|
+
color,
|
|
2849
|
+
fontFamily: '"SF Mono", "Fira Code", monospace',
|
|
2850
|
+
whiteSpace: "nowrap",
|
|
2851
|
+
overflow: "hidden",
|
|
2852
|
+
textOverflow: "ellipsis"
|
|
2853
|
+
});
|
|
2854
|
+
var activeBadgeStyle = (tokens) => ({
|
|
2855
|
+
fontSize: "0.6rem",
|
|
2856
|
+
fontWeight: 600,
|
|
2857
|
+
color: tokens.success,
|
|
2858
|
+
background: tokens.successBg,
|
|
2859
|
+
padding: "2px 7px",
|
|
2860
|
+
borderRadius: 999,
|
|
2861
|
+
textTransform: "uppercase",
|
|
2862
|
+
letterSpacing: "0.03em",
|
|
2863
|
+
whiteSpace: "nowrap"
|
|
2864
|
+
});
|
|
2865
|
+
var inactiveBadgeStyle = (tokens) => ({
|
|
2866
|
+
fontSize: "0.6rem",
|
|
2867
|
+
fontWeight: 600,
|
|
2868
|
+
color: tokens.warning,
|
|
2869
|
+
background: tokens.warningBg ?? `${tokens.warning}1a`,
|
|
2870
|
+
padding: "2px 7px",
|
|
2871
|
+
borderRadius: 999,
|
|
2872
|
+
textTransform: "uppercase",
|
|
2873
|
+
letterSpacing: "0.03em",
|
|
2874
|
+
whiteSpace: "nowrap"
|
|
2875
|
+
});
|
|
2876
|
+
var dropdownDividerStyle = (borderColor) => ({
|
|
2877
|
+
height: 0,
|
|
2878
|
+
borderTop: `1px solid ${borderColor}`
|
|
2879
|
+
});
|
|
2880
|
+
var addProviderStyle = (tokens) => ({
|
|
2881
|
+
display: "flex",
|
|
2882
|
+
alignItems: "center",
|
|
2883
|
+
gap: 8,
|
|
2884
|
+
width: "100%",
|
|
2885
|
+
padding: "10px 14px",
|
|
2886
|
+
background: "transparent",
|
|
2887
|
+
border: "none",
|
|
2888
|
+
color: tokens.accent,
|
|
2889
|
+
fontWeight: 600,
|
|
2890
|
+
fontSize: "0.85rem",
|
|
2891
|
+
cursor: "pointer",
|
|
2892
|
+
fontFamily: "inherit",
|
|
2893
|
+
textAlign: "left",
|
|
2894
|
+
outline: "none"
|
|
2895
|
+
});
|
|
2637
2896
|
function StepList({ steps }) {
|
|
2638
2897
|
const { tokens } = useSwypeConfig();
|
|
2639
2898
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: listStyle, children: steps.map((step, i) => {
|
|
@@ -2711,13 +2970,13 @@ function SettingsMenu({ onLogout }) {
|
|
|
2711
2970
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2712
2971
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2713
2972
|
}, [open]);
|
|
2714
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: menuRef, style:
|
|
2973
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: menuRef, style: containerStyle6, children: [
|
|
2715
2974
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: toggle, style: triggerStyle(tokens.text), "aria-label": "Settings", children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2716
2975
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "5", r: "2", fill: "currentColor" }),
|
|
2717
2976
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "2", fill: "currentColor" }),
|
|
2718
2977
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "19", r: "2", fill: "currentColor" })
|
|
2719
2978
|
] }) }),
|
|
2720
|
-
open && /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
2979
|
+
open && /* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownStyle2(tokens), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2721
2980
|
"button",
|
|
2722
2981
|
{
|
|
2723
2982
|
type: "button",
|
|
@@ -2738,7 +2997,7 @@ function SettingsMenu({ onLogout }) {
|
|
|
2738
2997
|
) })
|
|
2739
2998
|
] });
|
|
2740
2999
|
}
|
|
2741
|
-
var
|
|
3000
|
+
var containerStyle6 = {
|
|
2742
3001
|
position: "relative"
|
|
2743
3002
|
};
|
|
2744
3003
|
var triggerStyle = (color) => ({
|
|
@@ -2751,7 +3010,7 @@ var triggerStyle = (color) => ({
|
|
|
2751
3010
|
alignItems: "center",
|
|
2752
3011
|
justifyContent: "center"
|
|
2753
3012
|
});
|
|
2754
|
-
var
|
|
3013
|
+
var dropdownStyle2 = (tokens) => ({
|
|
2755
3014
|
position: "absolute",
|
|
2756
3015
|
right: 0,
|
|
2757
3016
|
top: "100%",
|
|
@@ -3713,12 +3972,16 @@ function DepositScreen({
|
|
|
3713
3972
|
processing,
|
|
3714
3973
|
error,
|
|
3715
3974
|
onDeposit,
|
|
3716
|
-
onChangeSource,
|
|
3717
3975
|
onSwitchWallet,
|
|
3718
3976
|
onBack,
|
|
3719
3977
|
onLogout,
|
|
3720
3978
|
onIncreaseLimit,
|
|
3721
|
-
increasingLimit
|
|
3979
|
+
increasingLimit,
|
|
3980
|
+
accounts,
|
|
3981
|
+
selectedAccountId,
|
|
3982
|
+
onSelectAccount,
|
|
3983
|
+
onAuthorizeAccount,
|
|
3984
|
+
onAddProvider
|
|
3722
3985
|
}) {
|
|
3723
3986
|
const { tokens } = useSwypeConfig();
|
|
3724
3987
|
const amount = initialAmount;
|
|
@@ -3744,7 +4007,11 @@ function DepositScreen({
|
|
|
3744
4007
|
name: sourceName,
|
|
3745
4008
|
address: sourceAddress,
|
|
3746
4009
|
verified: sourceVerified,
|
|
3747
|
-
|
|
4010
|
+
accounts,
|
|
4011
|
+
selectedAccountId,
|
|
4012
|
+
onSelectAccount,
|
|
4013
|
+
onAuthorizeAccount,
|
|
4014
|
+
onAddProvider
|
|
3748
4015
|
}
|
|
3749
4016
|
),
|
|
3750
4017
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: amountDisplayStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: amountStyle({ ...tokens, dimmed: true }), children: [
|
|
@@ -3814,7 +4081,11 @@ function DepositScreen({
|
|
|
3814
4081
|
name: sourceName,
|
|
3815
4082
|
address: sourceAddress,
|
|
3816
4083
|
verified: sourceVerified,
|
|
3817
|
-
|
|
4084
|
+
accounts,
|
|
4085
|
+
selectedAccountId,
|
|
4086
|
+
onSelectAccount,
|
|
4087
|
+
onAuthorizeAccount,
|
|
4088
|
+
onAddProvider
|
|
3818
4089
|
}
|
|
3819
4090
|
),
|
|
3820
4091
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: amountDisplayStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: amountStyle(tokens), children: [
|
|
@@ -4947,12 +5218,16 @@ function StepRenderer({
|
|
|
4947
5218
|
processing: state.creatingTransfer,
|
|
4948
5219
|
error: state.error,
|
|
4949
5220
|
onDeposit: handlers.onPay,
|
|
4950
|
-
onChangeSource: () => handlers.onNavigate("wallet-picker"),
|
|
4951
5221
|
onSwitchWallet: () => handlers.onNavigate("wallet-picker"),
|
|
4952
5222
|
onBack: onBack ?? (() => handlers.onLogout()),
|
|
4953
5223
|
onLogout: handlers.onLogout,
|
|
4954
5224
|
onIncreaseLimit: handlers.onIncreaseLimit,
|
|
4955
|
-
increasingLimit: state.increasingLimit
|
|
5225
|
+
increasingLimit: state.increasingLimit,
|
|
5226
|
+
accounts: state.accounts,
|
|
5227
|
+
selectedAccountId: state.selectedAccountId,
|
|
5228
|
+
onSelectAccount: handlers.onSelectAccount,
|
|
5229
|
+
onAuthorizeAccount: handlers.onContinueConnection,
|
|
5230
|
+
onAddProvider: () => handlers.onNavigate("wallet-picker")
|
|
4956
5231
|
}
|
|
4957
5232
|
);
|
|
4958
5233
|
}
|
|
@@ -5021,10 +5296,14 @@ function StepRenderer({
|
|
|
5021
5296
|
processing: false,
|
|
5022
5297
|
error: state.error,
|
|
5023
5298
|
onDeposit: handlers.onPay,
|
|
5024
|
-
onChangeSource: () => handlers.onNavigate("wallet-picker"),
|
|
5025
5299
|
onSwitchWallet: () => handlers.onNavigate("wallet-picker"),
|
|
5026
5300
|
onBack: onBack ?? (() => handlers.onLogout()),
|
|
5027
|
-
onLogout: handlers.onLogout
|
|
5301
|
+
onLogout: handlers.onLogout,
|
|
5302
|
+
accounts: state.accounts,
|
|
5303
|
+
selectedAccountId: state.selectedAccountId,
|
|
5304
|
+
onSelectAccount: handlers.onSelectAccount,
|
|
5305
|
+
onAuthorizeAccount: handlers.onContinueConnection,
|
|
5306
|
+
onAddProvider: () => handlers.onNavigate("wallet-picker")
|
|
5028
5307
|
}
|
|
5029
5308
|
);
|
|
5030
5309
|
}
|
|
@@ -5049,7 +5328,7 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
5049
5328
|
if (!this.state.hasError) {
|
|
5050
5329
|
return this.props.children;
|
|
5051
5330
|
}
|
|
5052
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
5331
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle7, children: [
|
|
5053
5332
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: iconStyle4, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", children: [
|
|
5054
5333
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "#ef4444", strokeWidth: "1.5" }),
|
|
5055
5334
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
@@ -5061,7 +5340,7 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
5061
5340
|
] });
|
|
5062
5341
|
}
|
|
5063
5342
|
};
|
|
5064
|
-
var
|
|
5343
|
+
var containerStyle7 = {
|
|
5065
5344
|
display: "flex",
|
|
5066
5345
|
flexDirection: "column",
|
|
5067
5346
|
alignItems: "center",
|
|
@@ -5659,6 +5938,19 @@ function SwypePaymentInner({
|
|
|
5659
5938
|
},
|
|
5660
5939
|
[state.accounts, state.providers, handleSelectProvider]
|
|
5661
5940
|
);
|
|
5941
|
+
const handleSelectAccount = react.useCallback(
|
|
5942
|
+
(accountId) => {
|
|
5943
|
+
const acct = state.accounts.find((a) => a.id === accountId);
|
|
5944
|
+
if (!acct) return;
|
|
5945
|
+
const activeWallet = acct.wallets.find((w) => w.status === "ACTIVE") ?? null;
|
|
5946
|
+
dispatch({
|
|
5947
|
+
type: "SELECT_ACCOUNT",
|
|
5948
|
+
accountId,
|
|
5949
|
+
walletId: activeWallet?.id ?? null
|
|
5950
|
+
});
|
|
5951
|
+
},
|
|
5952
|
+
[state.accounts]
|
|
5953
|
+
);
|
|
5662
5954
|
const handleNewPayment = react.useCallback(() => {
|
|
5663
5955
|
clearMobileFlowState();
|
|
5664
5956
|
processingStartedAtRef.current = null;
|
|
@@ -6126,6 +6418,7 @@ function SwypePaymentInner({
|
|
|
6126
6418
|
onVerifyPasskeyViaPopup: handleVerifyPasskeyViaPopup,
|
|
6127
6419
|
onSelectProvider: handleSelectProvider,
|
|
6128
6420
|
onContinueConnection: handleContinueConnection,
|
|
6421
|
+
onSelectAccount: handleSelectAccount,
|
|
6129
6422
|
onPay: handlePay,
|
|
6130
6423
|
onIncreaseLimit: handleIncreaseLimit,
|
|
6131
6424
|
onConfirmSign: handleConfirmSign,
|
|
@@ -6150,6 +6443,7 @@ function SwypePaymentInner({
|
|
|
6150
6443
|
handleVerifyPasskeyViaPopup,
|
|
6151
6444
|
handleSelectProvider,
|
|
6152
6445
|
handleContinueConnection,
|
|
6446
|
+
handleSelectAccount,
|
|
6153
6447
|
handlePay,
|
|
6154
6448
|
handleIncreaseLimit,
|
|
6155
6449
|
handleConfirmSign,
|