@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.d.cts
CHANGED
|
@@ -50,6 +50,8 @@ interface Wallet {
|
|
|
50
50
|
interface Account {
|
|
51
51
|
id: string;
|
|
52
52
|
name: string;
|
|
53
|
+
/** Optional user-chosen display name for this account. */
|
|
54
|
+
nickname?: string | null;
|
|
53
55
|
wallets: Wallet[];
|
|
54
56
|
/** Remaining One-Tap allowance in USD, or null when not configured. */
|
|
55
57
|
remainingAllowance?: number | null;
|
|
@@ -304,6 +306,8 @@ interface CreateAccountParams {
|
|
|
304
306
|
name: string;
|
|
305
307
|
credentialId: string;
|
|
306
308
|
providerId: string;
|
|
309
|
+
/** Optional user-chosen display name. */
|
|
310
|
+
nickname?: string;
|
|
307
311
|
}
|
|
308
312
|
declare function createAccount(apiBaseUrl: string, token: string, params: CreateAccountParams): Promise<Account>;
|
|
309
313
|
interface CreateTransferParams {
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ interface Wallet {
|
|
|
50
50
|
interface Account {
|
|
51
51
|
id: string;
|
|
52
52
|
name: string;
|
|
53
|
+
/** Optional user-chosen display name for this account. */
|
|
54
|
+
nickname?: string | null;
|
|
53
55
|
wallets: Wallet[];
|
|
54
56
|
/** Remaining One-Tap allowance in USD, or null when not configured. */
|
|
55
57
|
remainingAllowance?: number | null;
|
|
@@ -304,6 +306,8 @@ interface CreateAccountParams {
|
|
|
304
306
|
name: string;
|
|
305
307
|
credentialId: string;
|
|
306
308
|
providerId: string;
|
|
309
|
+
/** Optional user-chosen display name. */
|
|
310
|
+
nickname?: string;
|
|
307
311
|
}
|
|
308
312
|
declare function createAccount(apiBaseUrl: string, token: string, params: CreateAccountParams): Promise<Account>;
|
|
309
313
|
interface CreateTransferParams {
|
package/dist/index.js
CHANGED
|
@@ -220,6 +220,9 @@ async function createAccount(apiBaseUrl, token, params) {
|
|
|
220
220
|
credentialId: params.credentialId,
|
|
221
221
|
providerId: params.providerId
|
|
222
222
|
};
|
|
223
|
+
if (params.nickname) {
|
|
224
|
+
body.nickname = params.nickname;
|
|
225
|
+
}
|
|
223
226
|
const res = await fetch(`${apiBaseUrl}/v1/accounts`, {
|
|
224
227
|
method: "POST",
|
|
225
228
|
headers: {
|
|
@@ -2552,36 +2555,165 @@ var KNOWN_LOGOS = {
|
|
|
2552
2555
|
base: BASE_LOGO,
|
|
2553
2556
|
"trust wallet": TRUST_WALLET_LOGO
|
|
2554
2557
|
};
|
|
2555
|
-
function
|
|
2558
|
+
function hasActiveWallet2(account) {
|
|
2559
|
+
return account.wallets.some((w) => w.status === "ACTIVE");
|
|
2560
|
+
}
|
|
2561
|
+
function SourceCard({
|
|
2562
|
+
name,
|
|
2563
|
+
address,
|
|
2564
|
+
verified,
|
|
2565
|
+
accounts,
|
|
2566
|
+
selectedAccountId,
|
|
2567
|
+
onSelectAccount,
|
|
2568
|
+
onAuthorizeAccount,
|
|
2569
|
+
onAddProvider
|
|
2570
|
+
}) {
|
|
2556
2571
|
const { tokens } = useSwypeConfig();
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2572
|
+
const [open, setOpen] = useState(false);
|
|
2573
|
+
const containerRef = useRef(null);
|
|
2574
|
+
const hasDropdown = accounts != null && accounts.length > 0;
|
|
2575
|
+
useEffect(() => {
|
|
2576
|
+
if (!open) return;
|
|
2577
|
+
const handleClick = (e) => {
|
|
2578
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
2579
|
+
setOpen(false);
|
|
2580
|
+
}
|
|
2581
|
+
};
|
|
2582
|
+
document.addEventListener("mousedown", handleClick);
|
|
2583
|
+
return () => document.removeEventListener("mousedown", handleClick);
|
|
2584
|
+
}, [open]);
|
|
2585
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, style: { position: "relative" }, children: [
|
|
2586
|
+
/* @__PURE__ */ jsxs("div", { style: cardContainerStyle(tokens), children: [
|
|
2587
|
+
/* @__PURE__ */ jsxs("div", { style: leftStyle, children: [
|
|
2588
|
+
KNOWN_LOGOS[name.toLowerCase()] ? /* @__PURE__ */ jsx(
|
|
2589
|
+
"img",
|
|
2590
|
+
{
|
|
2591
|
+
src: KNOWN_LOGOS[name.toLowerCase()],
|
|
2592
|
+
alt: name,
|
|
2593
|
+
style: logoImgStyle
|
|
2594
|
+
}
|
|
2595
|
+
) : /* @__PURE__ */ jsx("div", { style: iconStyle3(tokens.textMuted), children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
|
|
2596
|
+
"path",
|
|
2597
|
+
{
|
|
2598
|
+
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",
|
|
2599
|
+
fill: "currentColor"
|
|
2600
|
+
}
|
|
2601
|
+
) }) }),
|
|
2602
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2603
|
+
/* @__PURE__ */ jsxs("div", { style: nameRowStyle, children: [
|
|
2604
|
+
/* @__PURE__ */ jsx("span", { style: nameStyle(tokens.text), children: name }),
|
|
2605
|
+
verified && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.accent }) })
|
|
2606
|
+
] }),
|
|
2607
|
+
address && /* @__PURE__ */ jsx("span", { style: addressStyle(tokens.textMuted), children: address })
|
|
2608
|
+
] })
|
|
2609
|
+
] }),
|
|
2610
|
+
hasDropdown && /* @__PURE__ */ jsxs(
|
|
2611
|
+
"button",
|
|
2568
2612
|
{
|
|
2569
|
-
|
|
2570
|
-
|
|
2613
|
+
type: "button",
|
|
2614
|
+
onClick: () => setOpen(!open),
|
|
2615
|
+
style: changeStyle(tokens.accent),
|
|
2616
|
+
children: [
|
|
2617
|
+
"Change source",
|
|
2618
|
+
/* @__PURE__ */ jsx(
|
|
2619
|
+
"svg",
|
|
2620
|
+
{
|
|
2621
|
+
width: "10",
|
|
2622
|
+
height: "10",
|
|
2623
|
+
viewBox: "0 0 24 24",
|
|
2624
|
+
fill: "none",
|
|
2625
|
+
style: {
|
|
2626
|
+
marginLeft: 4,
|
|
2627
|
+
transform: open ? "rotate(180deg)" : "rotate(0deg)",
|
|
2628
|
+
transition: "transform 0.15s ease"
|
|
2629
|
+
},
|
|
2630
|
+
children: /* @__PURE__ */ jsx(
|
|
2631
|
+
"path",
|
|
2632
|
+
{
|
|
2633
|
+
d: "M7 10l5 5 5-5",
|
|
2634
|
+
stroke: tokens.accent,
|
|
2635
|
+
strokeWidth: "2.5",
|
|
2636
|
+
strokeLinecap: "round",
|
|
2637
|
+
strokeLinejoin: "round"
|
|
2638
|
+
}
|
|
2639
|
+
)
|
|
2640
|
+
}
|
|
2641
|
+
)
|
|
2642
|
+
]
|
|
2571
2643
|
}
|
|
2572
|
-
)
|
|
2573
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2574
|
-
/* @__PURE__ */ jsxs("div", { style: nameRowStyle, children: [
|
|
2575
|
-
/* @__PURE__ */ jsx("span", { style: nameStyle(tokens.text), children: name }),
|
|
2576
|
-
verified && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.accent }) })
|
|
2577
|
-
] }),
|
|
2578
|
-
address && /* @__PURE__ */ jsx("span", { style: addressStyle(tokens.textMuted), children: address })
|
|
2579
|
-
] })
|
|
2644
|
+
)
|
|
2580
2645
|
] }),
|
|
2581
|
-
|
|
2646
|
+
open && hasDropdown && /* @__PURE__ */ jsxs("div", { style: dropdownStyle(tokens), children: [
|
|
2647
|
+
accounts.map((account) => {
|
|
2648
|
+
const active = hasActiveWallet2(account);
|
|
2649
|
+
const isSelected = account.id === selectedAccountId;
|
|
2650
|
+
const displayName = account.nickname ?? account.name;
|
|
2651
|
+
const walletAddress = account.wallets[0]?.name;
|
|
2652
|
+
return /* @__PURE__ */ jsxs(
|
|
2653
|
+
"button",
|
|
2654
|
+
{
|
|
2655
|
+
type: "button",
|
|
2656
|
+
onClick: () => {
|
|
2657
|
+
if (active) {
|
|
2658
|
+
onSelectAccount?.(account.id);
|
|
2659
|
+
} else {
|
|
2660
|
+
onAuthorizeAccount?.(account.id);
|
|
2661
|
+
}
|
|
2662
|
+
setOpen(false);
|
|
2663
|
+
},
|
|
2664
|
+
style: dropdownRowStyle(tokens, active, isSelected),
|
|
2665
|
+
children: [
|
|
2666
|
+
/* @__PURE__ */ jsxs("div", { style: dropdownRowLeftStyle, children: [
|
|
2667
|
+
KNOWN_LOGOS[account.name.toLowerCase()] ? /* @__PURE__ */ jsx(
|
|
2668
|
+
"img",
|
|
2669
|
+
{
|
|
2670
|
+
src: KNOWN_LOGOS[account.name.toLowerCase()],
|
|
2671
|
+
alt: account.name,
|
|
2672
|
+
style: dropdownLogoStyle
|
|
2673
|
+
}
|
|
2674
|
+
) : /* @__PURE__ */ jsx("div", { style: dropdownFallbackIconStyle(active ? tokens.textMuted : tokens.border), children: account.name.charAt(0) }),
|
|
2675
|
+
/* @__PURE__ */ jsxs("div", { style: dropdownNameColumnStyle, children: [
|
|
2676
|
+
/* @__PURE__ */ jsx("span", { style: dropdownNameStyle(active ? tokens.text : tokens.textMuted), children: displayName }),
|
|
2677
|
+
walletAddress && /* @__PURE__ */ jsx("span", { style: dropdownAddressStyle(active ? tokens.textMuted : tokens.border), children: walletAddress })
|
|
2678
|
+
] })
|
|
2679
|
+
] }),
|
|
2680
|
+
/* @__PURE__ */ jsxs("div", { style: dropdownRowRightStyle, children: [
|
|
2681
|
+
active ? /* @__PURE__ */ jsx("span", { style: activeBadgeStyle(tokens), children: "Active" }) : /* @__PURE__ */ jsx("span", { style: inactiveBadgeStyle(tokens), children: "Setup incomplete" }),
|
|
2682
|
+
isSelected && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
|
|
2683
|
+
"path",
|
|
2684
|
+
{
|
|
2685
|
+
d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",
|
|
2686
|
+
fill: tokens.accent
|
|
2687
|
+
}
|
|
2688
|
+
) })
|
|
2689
|
+
] })
|
|
2690
|
+
]
|
|
2691
|
+
},
|
|
2692
|
+
account.id
|
|
2693
|
+
);
|
|
2694
|
+
}),
|
|
2695
|
+
onAddProvider && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2696
|
+
/* @__PURE__ */ jsx("div", { style: dropdownDividerStyle(tokens.border) }),
|
|
2697
|
+
/* @__PURE__ */ jsxs(
|
|
2698
|
+
"button",
|
|
2699
|
+
{
|
|
2700
|
+
type: "button",
|
|
2701
|
+
onClick: () => {
|
|
2702
|
+
onAddProvider();
|
|
2703
|
+
setOpen(false);
|
|
2704
|
+
},
|
|
2705
|
+
style: addProviderStyle(tokens),
|
|
2706
|
+
children: [
|
|
2707
|
+
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) }),
|
|
2708
|
+
"Add Account"
|
|
2709
|
+
]
|
|
2710
|
+
}
|
|
2711
|
+
)
|
|
2712
|
+
] })
|
|
2713
|
+
] })
|
|
2582
2714
|
] });
|
|
2583
2715
|
}
|
|
2584
|
-
var
|
|
2716
|
+
var cardContainerStyle = (tokens) => ({
|
|
2585
2717
|
display: "flex",
|
|
2586
2718
|
alignItems: "center",
|
|
2587
2719
|
justifyContent: "space-between",
|
|
@@ -2622,6 +2754,8 @@ var addressStyle = (color) => ({
|
|
|
2622
2754
|
fontFamily: '"SF Mono", "Fira Code", monospace'
|
|
2623
2755
|
});
|
|
2624
2756
|
var changeStyle = (color) => ({
|
|
2757
|
+
display: "flex",
|
|
2758
|
+
alignItems: "center",
|
|
2625
2759
|
background: "transparent",
|
|
2626
2760
|
border: "none",
|
|
2627
2761
|
color,
|
|
@@ -2631,6 +2765,131 @@ var changeStyle = (color) => ({
|
|
|
2631
2765
|
fontFamily: "inherit",
|
|
2632
2766
|
padding: 0
|
|
2633
2767
|
});
|
|
2768
|
+
var dropdownStyle = (tokens) => ({
|
|
2769
|
+
position: "absolute",
|
|
2770
|
+
top: "100%",
|
|
2771
|
+
left: 0,
|
|
2772
|
+
right: 0,
|
|
2773
|
+
marginTop: 4,
|
|
2774
|
+
background: tokens.bgCard,
|
|
2775
|
+
border: `1px solid ${tokens.border}`,
|
|
2776
|
+
borderRadius: tokens.radiusLg,
|
|
2777
|
+
boxShadow: tokens.shadowLg,
|
|
2778
|
+
zIndex: 50,
|
|
2779
|
+
overflow: "hidden"
|
|
2780
|
+
});
|
|
2781
|
+
var dropdownRowStyle = (tokens, active, isSelected) => ({
|
|
2782
|
+
display: "flex",
|
|
2783
|
+
alignItems: "center",
|
|
2784
|
+
justifyContent: "space-between",
|
|
2785
|
+
width: "100%",
|
|
2786
|
+
padding: "10px 14px",
|
|
2787
|
+
background: isSelected ? tokens.accent + "12" : "transparent",
|
|
2788
|
+
border: "none",
|
|
2789
|
+
borderBottom: `1px solid ${tokens.border}`,
|
|
2790
|
+
cursor: "pointer",
|
|
2791
|
+
fontFamily: "inherit",
|
|
2792
|
+
fontSize: "0.85rem",
|
|
2793
|
+
textAlign: "left",
|
|
2794
|
+
outline: "none",
|
|
2795
|
+
opacity: active ? 1 : 0.55,
|
|
2796
|
+
transition: "background 0.1s ease"
|
|
2797
|
+
});
|
|
2798
|
+
var dropdownRowLeftStyle = {
|
|
2799
|
+
display: "flex",
|
|
2800
|
+
alignItems: "center",
|
|
2801
|
+
gap: 10,
|
|
2802
|
+
minWidth: 0,
|
|
2803
|
+
flex: 1
|
|
2804
|
+
};
|
|
2805
|
+
var dropdownRowRightStyle = {
|
|
2806
|
+
display: "flex",
|
|
2807
|
+
alignItems: "center",
|
|
2808
|
+
gap: 8,
|
|
2809
|
+
flexShrink: 0
|
|
2810
|
+
};
|
|
2811
|
+
var dropdownLogoStyle = {
|
|
2812
|
+
width: 20,
|
|
2813
|
+
height: 20,
|
|
2814
|
+
borderRadius: "50%",
|
|
2815
|
+
objectFit: "contain",
|
|
2816
|
+
flexShrink: 0
|
|
2817
|
+
};
|
|
2818
|
+
var dropdownFallbackIconStyle = (color) => ({
|
|
2819
|
+
width: 20,
|
|
2820
|
+
height: 20,
|
|
2821
|
+
borderRadius: "50%",
|
|
2822
|
+
display: "flex",
|
|
2823
|
+
alignItems: "center",
|
|
2824
|
+
justifyContent: "center",
|
|
2825
|
+
fontSize: "0.72rem",
|
|
2826
|
+
fontWeight: 700,
|
|
2827
|
+
color,
|
|
2828
|
+
flexShrink: 0
|
|
2829
|
+
});
|
|
2830
|
+
var dropdownNameColumnStyle = {
|
|
2831
|
+
display: "flex",
|
|
2832
|
+
flexDirection: "column",
|
|
2833
|
+
gap: 2,
|
|
2834
|
+
minWidth: 0
|
|
2835
|
+
};
|
|
2836
|
+
var dropdownNameStyle = (color) => ({
|
|
2837
|
+
fontWeight: 500,
|
|
2838
|
+
color,
|
|
2839
|
+
whiteSpace: "nowrap",
|
|
2840
|
+
overflow: "hidden",
|
|
2841
|
+
textOverflow: "ellipsis"
|
|
2842
|
+
});
|
|
2843
|
+
var dropdownAddressStyle = (color) => ({
|
|
2844
|
+
fontSize: "0.72rem",
|
|
2845
|
+
color,
|
|
2846
|
+
fontFamily: '"SF Mono", "Fira Code", monospace',
|
|
2847
|
+
whiteSpace: "nowrap",
|
|
2848
|
+
overflow: "hidden",
|
|
2849
|
+
textOverflow: "ellipsis"
|
|
2850
|
+
});
|
|
2851
|
+
var activeBadgeStyle = (tokens) => ({
|
|
2852
|
+
fontSize: "0.6rem",
|
|
2853
|
+
fontWeight: 600,
|
|
2854
|
+
color: tokens.success,
|
|
2855
|
+
background: tokens.successBg,
|
|
2856
|
+
padding: "2px 7px",
|
|
2857
|
+
borderRadius: 999,
|
|
2858
|
+
textTransform: "uppercase",
|
|
2859
|
+
letterSpacing: "0.03em",
|
|
2860
|
+
whiteSpace: "nowrap"
|
|
2861
|
+
});
|
|
2862
|
+
var inactiveBadgeStyle = (tokens) => ({
|
|
2863
|
+
fontSize: "0.6rem",
|
|
2864
|
+
fontWeight: 600,
|
|
2865
|
+
color: tokens.warning,
|
|
2866
|
+
background: tokens.warningBg ?? `${tokens.warning}1a`,
|
|
2867
|
+
padding: "2px 7px",
|
|
2868
|
+
borderRadius: 999,
|
|
2869
|
+
textTransform: "uppercase",
|
|
2870
|
+
letterSpacing: "0.03em",
|
|
2871
|
+
whiteSpace: "nowrap"
|
|
2872
|
+
});
|
|
2873
|
+
var dropdownDividerStyle = (borderColor) => ({
|
|
2874
|
+
height: 0,
|
|
2875
|
+
borderTop: `1px solid ${borderColor}`
|
|
2876
|
+
});
|
|
2877
|
+
var addProviderStyle = (tokens) => ({
|
|
2878
|
+
display: "flex",
|
|
2879
|
+
alignItems: "center",
|
|
2880
|
+
gap: 8,
|
|
2881
|
+
width: "100%",
|
|
2882
|
+
padding: "10px 14px",
|
|
2883
|
+
background: "transparent",
|
|
2884
|
+
border: "none",
|
|
2885
|
+
color: tokens.accent,
|
|
2886
|
+
fontWeight: 600,
|
|
2887
|
+
fontSize: "0.85rem",
|
|
2888
|
+
cursor: "pointer",
|
|
2889
|
+
fontFamily: "inherit",
|
|
2890
|
+
textAlign: "left",
|
|
2891
|
+
outline: "none"
|
|
2892
|
+
});
|
|
2634
2893
|
function StepList({ steps }) {
|
|
2635
2894
|
const { tokens } = useSwypeConfig();
|
|
2636
2895
|
return /* @__PURE__ */ jsx("div", { style: listStyle, children: steps.map((step, i) => {
|
|
@@ -2708,13 +2967,13 @@ function SettingsMenu({ onLogout }) {
|
|
|
2708
2967
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2709
2968
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2710
2969
|
}, [open]);
|
|
2711
|
-
return /* @__PURE__ */ jsxs("div", { ref: menuRef, style:
|
|
2970
|
+
return /* @__PURE__ */ jsxs("div", { ref: menuRef, style: containerStyle6, children: [
|
|
2712
2971
|
/* @__PURE__ */ jsx("button", { type: "button", onClick: toggle, style: triggerStyle(tokens.text), "aria-label": "Settings", children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2713
2972
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "5", r: "2", fill: "currentColor" }),
|
|
2714
2973
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "2", fill: "currentColor" }),
|
|
2715
2974
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "19", r: "2", fill: "currentColor" })
|
|
2716
2975
|
] }) }),
|
|
2717
|
-
open && /* @__PURE__ */ jsx("div", { style:
|
|
2976
|
+
open && /* @__PURE__ */ jsx("div", { style: dropdownStyle2(tokens), children: /* @__PURE__ */ jsxs(
|
|
2718
2977
|
"button",
|
|
2719
2978
|
{
|
|
2720
2979
|
type: "button",
|
|
@@ -2735,7 +2994,7 @@ function SettingsMenu({ onLogout }) {
|
|
|
2735
2994
|
) })
|
|
2736
2995
|
] });
|
|
2737
2996
|
}
|
|
2738
|
-
var
|
|
2997
|
+
var containerStyle6 = {
|
|
2739
2998
|
position: "relative"
|
|
2740
2999
|
};
|
|
2741
3000
|
var triggerStyle = (color) => ({
|
|
@@ -2748,7 +3007,7 @@ var triggerStyle = (color) => ({
|
|
|
2748
3007
|
alignItems: "center",
|
|
2749
3008
|
justifyContent: "center"
|
|
2750
3009
|
});
|
|
2751
|
-
var
|
|
3010
|
+
var dropdownStyle2 = (tokens) => ({
|
|
2752
3011
|
position: "absolute",
|
|
2753
3012
|
right: 0,
|
|
2754
3013
|
top: "100%",
|
|
@@ -3710,12 +3969,16 @@ function DepositScreen({
|
|
|
3710
3969
|
processing,
|
|
3711
3970
|
error,
|
|
3712
3971
|
onDeposit,
|
|
3713
|
-
onChangeSource,
|
|
3714
3972
|
onSwitchWallet,
|
|
3715
3973
|
onBack,
|
|
3716
3974
|
onLogout,
|
|
3717
3975
|
onIncreaseLimit,
|
|
3718
|
-
increasingLimit
|
|
3976
|
+
increasingLimit,
|
|
3977
|
+
accounts,
|
|
3978
|
+
selectedAccountId,
|
|
3979
|
+
onSelectAccount,
|
|
3980
|
+
onAuthorizeAccount,
|
|
3981
|
+
onAddProvider
|
|
3719
3982
|
}) {
|
|
3720
3983
|
const { tokens } = useSwypeConfig();
|
|
3721
3984
|
const amount = initialAmount;
|
|
@@ -3741,7 +4004,11 @@ function DepositScreen({
|
|
|
3741
4004
|
name: sourceName,
|
|
3742
4005
|
address: sourceAddress,
|
|
3743
4006
|
verified: sourceVerified,
|
|
3744
|
-
|
|
4007
|
+
accounts,
|
|
4008
|
+
selectedAccountId,
|
|
4009
|
+
onSelectAccount,
|
|
4010
|
+
onAuthorizeAccount,
|
|
4011
|
+
onAddProvider
|
|
3745
4012
|
}
|
|
3746
4013
|
),
|
|
3747
4014
|
/* @__PURE__ */ jsx("div", { style: amountDisplayStyle, children: /* @__PURE__ */ jsxs("span", { style: amountStyle({ ...tokens, dimmed: true }), children: [
|
|
@@ -3811,7 +4078,11 @@ function DepositScreen({
|
|
|
3811
4078
|
name: sourceName,
|
|
3812
4079
|
address: sourceAddress,
|
|
3813
4080
|
verified: sourceVerified,
|
|
3814
|
-
|
|
4081
|
+
accounts,
|
|
4082
|
+
selectedAccountId,
|
|
4083
|
+
onSelectAccount,
|
|
4084
|
+
onAuthorizeAccount,
|
|
4085
|
+
onAddProvider
|
|
3815
4086
|
}
|
|
3816
4087
|
),
|
|
3817
4088
|
/* @__PURE__ */ jsx("div", { style: amountDisplayStyle, children: /* @__PURE__ */ jsxs("span", { style: amountStyle(tokens), children: [
|
|
@@ -4944,12 +5215,16 @@ function StepRenderer({
|
|
|
4944
5215
|
processing: state.creatingTransfer,
|
|
4945
5216
|
error: state.error,
|
|
4946
5217
|
onDeposit: handlers.onPay,
|
|
4947
|
-
onChangeSource: () => handlers.onNavigate("wallet-picker"),
|
|
4948
5218
|
onSwitchWallet: () => handlers.onNavigate("wallet-picker"),
|
|
4949
5219
|
onBack: onBack ?? (() => handlers.onLogout()),
|
|
4950
5220
|
onLogout: handlers.onLogout,
|
|
4951
5221
|
onIncreaseLimit: handlers.onIncreaseLimit,
|
|
4952
|
-
increasingLimit: state.increasingLimit
|
|
5222
|
+
increasingLimit: state.increasingLimit,
|
|
5223
|
+
accounts: state.accounts,
|
|
5224
|
+
selectedAccountId: state.selectedAccountId,
|
|
5225
|
+
onSelectAccount: handlers.onSelectAccount,
|
|
5226
|
+
onAuthorizeAccount: handlers.onContinueConnection,
|
|
5227
|
+
onAddProvider: () => handlers.onNavigate("wallet-picker")
|
|
4953
5228
|
}
|
|
4954
5229
|
);
|
|
4955
5230
|
}
|
|
@@ -5018,10 +5293,14 @@ function StepRenderer({
|
|
|
5018
5293
|
processing: false,
|
|
5019
5294
|
error: state.error,
|
|
5020
5295
|
onDeposit: handlers.onPay,
|
|
5021
|
-
onChangeSource: () => handlers.onNavigate("wallet-picker"),
|
|
5022
5296
|
onSwitchWallet: () => handlers.onNavigate("wallet-picker"),
|
|
5023
5297
|
onBack: onBack ?? (() => handlers.onLogout()),
|
|
5024
|
-
onLogout: handlers.onLogout
|
|
5298
|
+
onLogout: handlers.onLogout,
|
|
5299
|
+
accounts: state.accounts,
|
|
5300
|
+
selectedAccountId: state.selectedAccountId,
|
|
5301
|
+
onSelectAccount: handlers.onSelectAccount,
|
|
5302
|
+
onAuthorizeAccount: handlers.onContinueConnection,
|
|
5303
|
+
onAddProvider: () => handlers.onNavigate("wallet-picker")
|
|
5025
5304
|
}
|
|
5026
5305
|
);
|
|
5027
5306
|
}
|
|
@@ -5046,7 +5325,7 @@ var PaymentErrorBoundary = class extends Component {
|
|
|
5046
5325
|
if (!this.state.hasError) {
|
|
5047
5326
|
return this.props.children;
|
|
5048
5327
|
}
|
|
5049
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
5328
|
+
return /* @__PURE__ */ jsxs("div", { style: containerStyle7, children: [
|
|
5050
5329
|
/* @__PURE__ */ jsx("div", { style: iconStyle4, children: /* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", children: [
|
|
5051
5330
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "#ef4444", strokeWidth: "1.5" }),
|
|
5052
5331
|
/* @__PURE__ */ jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
@@ -5058,7 +5337,7 @@ var PaymentErrorBoundary = class extends Component {
|
|
|
5058
5337
|
] });
|
|
5059
5338
|
}
|
|
5060
5339
|
};
|
|
5061
|
-
var
|
|
5340
|
+
var containerStyle7 = {
|
|
5062
5341
|
display: "flex",
|
|
5063
5342
|
flexDirection: "column",
|
|
5064
5343
|
alignItems: "center",
|
|
@@ -5656,6 +5935,19 @@ function SwypePaymentInner({
|
|
|
5656
5935
|
},
|
|
5657
5936
|
[state.accounts, state.providers, handleSelectProvider]
|
|
5658
5937
|
);
|
|
5938
|
+
const handleSelectAccount = useCallback(
|
|
5939
|
+
(accountId) => {
|
|
5940
|
+
const acct = state.accounts.find((a) => a.id === accountId);
|
|
5941
|
+
if (!acct) return;
|
|
5942
|
+
const activeWallet = acct.wallets.find((w) => w.status === "ACTIVE") ?? null;
|
|
5943
|
+
dispatch({
|
|
5944
|
+
type: "SELECT_ACCOUNT",
|
|
5945
|
+
accountId,
|
|
5946
|
+
walletId: activeWallet?.id ?? null
|
|
5947
|
+
});
|
|
5948
|
+
},
|
|
5949
|
+
[state.accounts]
|
|
5950
|
+
);
|
|
5659
5951
|
const handleNewPayment = useCallback(() => {
|
|
5660
5952
|
clearMobileFlowState();
|
|
5661
5953
|
processingStartedAtRef.current = null;
|
|
@@ -6123,6 +6415,7 @@ function SwypePaymentInner({
|
|
|
6123
6415
|
onVerifyPasskeyViaPopup: handleVerifyPasskeyViaPopup,
|
|
6124
6416
|
onSelectProvider: handleSelectProvider,
|
|
6125
6417
|
onContinueConnection: handleContinueConnection,
|
|
6418
|
+
onSelectAccount: handleSelectAccount,
|
|
6126
6419
|
onPay: handlePay,
|
|
6127
6420
|
onIncreaseLimit: handleIncreaseLimit,
|
|
6128
6421
|
onConfirmSign: handleConfirmSign,
|
|
@@ -6147,6 +6440,7 @@ function SwypePaymentInner({
|
|
|
6147
6440
|
handleVerifyPasskeyViaPopup,
|
|
6148
6441
|
handleSelectProvider,
|
|
6149
6442
|
handleContinueConnection,
|
|
6443
|
+
handleSelectAccount,
|
|
6150
6444
|
handlePay,
|
|
6151
6445
|
handleIncreaseLimit,
|
|
6152
6446
|
handleConfirmSign,
|