@cedros/login-react 0.0.46 → 0.0.48
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/README.md +32 -2
- package/dist/AdminWithdrawalHistory-CgYehfMH.js +948 -0
- package/dist/AdminWithdrawalHistory-CgYehfMH.js.map +1 -0
- package/dist/AdminWithdrawalHistory-zDUhPDNi.cjs +1 -0
- package/dist/AdminWithdrawalHistory-zDUhPDNi.cjs.map +1 -0
- package/dist/EmailRegisterForm-ByYQ43yL.cjs +1 -0
- package/dist/EmailRegisterForm-ByYQ43yL.cjs.map +1 -0
- package/dist/EmailRegisterForm-DMUcNQT-.js +781 -0
- package/dist/EmailRegisterForm-DMUcNQT-.js.map +1 -0
- package/dist/GoogleLoginButton-DEwtBp56.cjs +1 -0
- package/dist/GoogleLoginButton-DEwtBp56.cjs.map +1 -0
- package/dist/{GoogleLoginButton-C1WNu7W3.js → GoogleLoginButton-DwyxvhnL.js} +82 -80
- package/dist/GoogleLoginButton-DwyxvhnL.js.map +1 -0
- package/dist/{PermissionsSection-mm9hfp-u.js → PermissionsSection-0oNHPZzL.js} +383 -415
- package/dist/PermissionsSection-0oNHPZzL.js.map +1 -0
- package/dist/PermissionsSection-CZsJuxo4.cjs +1 -0
- package/dist/PermissionsSection-CZsJuxo4.cjs.map +1 -0
- package/dist/SolanaLoginButton-2504p6cr.cjs +1 -0
- package/dist/SolanaLoginButton-2504p6cr.cjs.map +1 -0
- package/dist/SolanaLoginButton-C7Kc_m6n.js +234 -0
- package/dist/SolanaLoginButton-C7Kc_m6n.js.map +1 -0
- package/dist/{TeamSection-Km7EwLWD.cjs → TeamSection-DN8PEHH3.cjs} +1 -1
- package/dist/{TeamSection-Km7EwLWD.cjs.map → TeamSection-DN8PEHH3.cjs.map} +1 -1
- package/dist/{TeamSection-C_eODdLU.js → TeamSection-gUyP4YDM.js} +1 -1
- package/dist/{TeamSection-C_eODdLU.js.map → TeamSection-gUyP4YDM.js.map} +1 -1
- package/dist/{UsersSection-C1Tt0ePx.cjs → UsersSection-8wLuD0fr.cjs} +1 -1
- package/dist/{UsersSection-C1Tt0ePx.cjs.map → UsersSection-8wLuD0fr.cjs.map} +1 -1
- package/dist/{UsersSection-Ct_E-MBF.js → UsersSection-CnsFrG-6.js} +1 -1
- package/dist/{UsersSection-Ct_E-MBF.js.map → UsersSection-CnsFrG-6.js.map} +1 -1
- package/dist/{WithdrawalsSection-BN-FjTEV.js → WithdrawalsSection-BCG_-DAP.js} +1 -1
- package/dist/{WithdrawalsSection-BN-FjTEV.js.map → WithdrawalsSection-BCG_-DAP.js.map} +1 -1
- package/dist/{WithdrawalsSection-BhuCwFat.cjs → WithdrawalsSection-DKpL2mt8.cjs} +1 -1
- package/dist/{WithdrawalsSection-BhuCwFat.cjs.map → WithdrawalsSection-DKpL2mt8.cjs.map} +1 -1
- package/dist/admin-only.cjs +1 -1
- package/dist/admin-only.js +1 -1
- package/dist/email-only.cjs +1 -1
- package/dist/email-only.d.ts +10 -2
- package/dist/email-only.js +2 -2
- package/dist/google-only.cjs +1 -1
- package/dist/google-only.d.ts +7 -2
- package/dist/google-only.js +2 -2
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +182 -11
- package/dist/index.js +5000 -4409
- package/dist/index.js.map +1 -1
- package/dist/login-react.css +1 -1
- package/dist/{plugin-Ci67QMGG.cjs → plugin-C7dru1t-.cjs} +1 -1
- package/dist/{plugin-Ci67QMGG.cjs.map → plugin-C7dru1t-.cjs.map} +1 -1
- package/dist/{plugin-Cm8Q6O4-.js → plugin-DivbaxSZ.js} +1 -1
- package/dist/{plugin-Cm8Q6O4-.js.map → plugin-DivbaxSZ.js.map} +1 -1
- package/dist/solana-only.cjs +1 -1
- package/dist/solana-only.d.ts +6 -1
- package/dist/solana-only.js +2 -2
- package/dist/useAuth-2vgrAH-M.cjs +1 -0
- package/dist/useAuth-2vgrAH-M.cjs.map +1 -0
- package/dist/{useAuth-l-itM5am.js → useAuth-CNflw856.js} +465 -469
- package/dist/useAuth-CNflw856.js.map +1 -0
- package/dist/useServerFeatures-9_aNPaa6.cjs +1 -0
- package/dist/useServerFeatures-9_aNPaa6.cjs.map +1 -0
- package/dist/useServerFeatures-DSkYdan-.js +82 -0
- package/dist/useServerFeatures-DSkYdan-.js.map +1 -0
- package/dist/{useUsersStatsSummary-BGeh3RnI.js → useUsersStatsSummary-B4_RBEYy.js} +504 -442
- package/dist/useUsersStatsSummary-B4_RBEYy.js.map +1 -0
- package/dist/useUsersStatsSummary-CHRMrlk4.cjs +1 -0
- package/dist/useUsersStatsSummary-CHRMrlk4.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/AdminWithdrawalHistory-B2EY2ZmH.cjs +0 -1
- package/dist/AdminWithdrawalHistory-B2EY2ZmH.cjs.map +0 -1
- package/dist/AdminWithdrawalHistory-C76bkbjX.js +0 -916
- package/dist/AdminWithdrawalHistory-C76bkbjX.js.map +0 -1
- package/dist/EmailRegisterForm-p2X5QP58.js +0 -750
- package/dist/EmailRegisterForm-p2X5QP58.js.map +0 -1
- package/dist/EmailRegisterForm-xFb6MaVA.cjs +0 -1
- package/dist/EmailRegisterForm-xFb6MaVA.cjs.map +0 -1
- package/dist/GoogleLoginButton-2zNTIKMm.cjs +0 -1
- package/dist/GoogleLoginButton-2zNTIKMm.cjs.map +0 -1
- package/dist/GoogleLoginButton-C1WNu7W3.js.map +0 -1
- package/dist/PermissionsSection-4zcE9Zs9.cjs +0 -1
- package/dist/PermissionsSection-4zcE9Zs9.cjs.map +0 -1
- package/dist/PermissionsSection-mm9hfp-u.js.map +0 -1
- package/dist/SolanaLoginButton-CqdzSSeJ.cjs +0 -1
- package/dist/SolanaLoginButton-CqdzSSeJ.cjs.map +0 -1
- package/dist/SolanaLoginButton-CyeX35eU.js +0 -232
- package/dist/SolanaLoginButton-CyeX35eU.js.map +0 -1
- package/dist/sanitization-Bo_tn-L2.cjs +0 -1
- package/dist/sanitization-Bo_tn-L2.cjs.map +0 -1
- package/dist/sanitization-CQ-H1MSg.js +0 -39
- package/dist/sanitization-CQ-H1MSg.js.map +0 -1
- package/dist/useAuth-B1yS_YiD.cjs +0 -1
- package/dist/useAuth-B1yS_YiD.cjs.map +0 -1
- package/dist/useAuth-l-itM5am.js.map +0 -1
- package/dist/useUsersStatsSummary-BGeh3RnI.js.map +0 -1
- package/dist/useUsersStatsSummary-DnsYtFGX.cjs +0 -1
- package/dist/useUsersStatsSummary-DnsYtFGX.cjs.map +0 -1
|
@@ -1,916 +0,0 @@
|
|
|
1
|
-
import { jsxs as r, jsx as e, Fragment as J } from "react/jsx-runtime";
|
|
2
|
-
import { useState as h, useCallback as B, useEffect as P, useMemo as se } from "react";
|
|
3
|
-
import { u as Q } from "./useAdminDeposits-C76B2Q_8.js";
|
|
4
|
-
import { S as z } from "./StatsBar-BX-hHtTq.js";
|
|
5
|
-
function fe({
|
|
6
|
-
refreshInterval: t = 0,
|
|
7
|
-
refreshSignal: i,
|
|
8
|
-
className: w = "",
|
|
9
|
-
onLoad: b
|
|
10
|
-
}) {
|
|
11
|
-
const { getStats: p, isLoading: n, error: N, clearError: y } = Q(), [$, j] = h(null), [k, x] = h(null), u = B(async () => {
|
|
12
|
-
try {
|
|
13
|
-
const d = await p();
|
|
14
|
-
j(d), b?.(d), x(null);
|
|
15
|
-
} catch (d) {
|
|
16
|
-
const M = d && typeof d == "object" && "message" in d ? String(d.message) : "Failed to load stats";
|
|
17
|
-
x(M);
|
|
18
|
-
}
|
|
19
|
-
}, [p, b]);
|
|
20
|
-
P(() => {
|
|
21
|
-
u();
|
|
22
|
-
}, [u]), P(() => {
|
|
23
|
-
i !== void 0 && u();
|
|
24
|
-
}, [i, u]), P(() => {
|
|
25
|
-
if (i !== void 0 || t <= 0) return;
|
|
26
|
-
const d = setInterval(u, t);
|
|
27
|
-
return () => clearInterval(d);
|
|
28
|
-
}, [t, i, u]);
|
|
29
|
-
const F = k || N;
|
|
30
|
-
return F ? /* @__PURE__ */ r("div", { className: `cedros-admin-stats ${w}`, children: [
|
|
31
|
-
/* @__PURE__ */ e("p", { className: "cedros-admin-error", children: F }),
|
|
32
|
-
/* @__PURE__ */ e(
|
|
33
|
-
"button",
|
|
34
|
-
{
|
|
35
|
-
type: "button",
|
|
36
|
-
className: "cedros-button cedros-button-outline",
|
|
37
|
-
onClick: () => {
|
|
38
|
-
y(), x(null), u();
|
|
39
|
-
},
|
|
40
|
-
children: "Retry"
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
] }) : n && !$ ? /* @__PURE__ */ e("div", { className: `cedros-admin-stats ${w}`, children: /* @__PURE__ */ e(
|
|
44
|
-
z,
|
|
45
|
-
{
|
|
46
|
-
stats: [
|
|
47
|
-
{ label: "Total Withdrawn", value: 0 },
|
|
48
|
-
{ label: "Pending Withdraw", value: 0 },
|
|
49
|
-
{ label: "In Privacy Period", value: 0 },
|
|
50
|
-
{ label: "Microbatch (SOL)", value: "0.0000" }
|
|
51
|
-
],
|
|
52
|
-
isLoading: !0
|
|
53
|
-
}
|
|
54
|
-
) }) : $ ? /* @__PURE__ */ e("div", { className: `cedros-admin-stats ${w}`, children: /* @__PURE__ */ e(
|
|
55
|
-
z,
|
|
56
|
-
{
|
|
57
|
-
stats: [
|
|
58
|
-
{ label: "Total Withdrawn", value: $.totalWithdrawnCount },
|
|
59
|
-
{ label: "Pending Withdraw", value: $.pendingWithdrawalCount },
|
|
60
|
-
{ label: "In Privacy Period", value: $.inPrivacyPeriodCount ?? 0 },
|
|
61
|
-
{ label: "Microbatch (SOL)", value: $.readyForWithdrawalSol?.toFixed(4) ?? "0.0000" }
|
|
62
|
-
],
|
|
63
|
-
isLoading: n,
|
|
64
|
-
onRefresh: u
|
|
65
|
-
}
|
|
66
|
-
) }) : null;
|
|
67
|
-
}
|
|
68
|
-
function ee(t) {
|
|
69
|
-
return t == null ? "—" : `${(t / 1e9).toFixed(4)} SOL`;
|
|
70
|
-
}
|
|
71
|
-
function te(t) {
|
|
72
|
-
return new Date(t).toLocaleDateString(void 0, {
|
|
73
|
-
year: "numeric",
|
|
74
|
-
month: "short",
|
|
75
|
-
day: "numeric",
|
|
76
|
-
hour: "2-digit",
|
|
77
|
-
minute: "2-digit"
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function ae(t) {
|
|
81
|
-
return t.length <= 12 ? t : `${t.slice(0, 6)}...${t.slice(-4)}`;
|
|
82
|
-
}
|
|
83
|
-
function oe(t) {
|
|
84
|
-
const i = new Date(t), b = (/* @__PURE__ */ new Date()).getTime() - i.getTime(), p = Math.floor(b / 6e4), n = Math.floor(p / 60), N = Math.floor(n / 24);
|
|
85
|
-
return N > 0 ? `${N}d ago` : n > 0 ? `${n}h ago` : p > 0 ? `${p}m ago` : "just now";
|
|
86
|
-
}
|
|
87
|
-
function re(t) {
|
|
88
|
-
return t ? new Date(t) > /* @__PURE__ */ new Date() : !0;
|
|
89
|
-
}
|
|
90
|
-
function Ne({
|
|
91
|
-
pageSize: t = 20,
|
|
92
|
-
refreshInterval: i = 0,
|
|
93
|
-
refreshSignal: w,
|
|
94
|
-
className: b = "",
|
|
95
|
-
onLoad: p,
|
|
96
|
-
onItemClick: n,
|
|
97
|
-
onWithdrawalProcessed: N,
|
|
98
|
-
onAllProcessed: y
|
|
99
|
-
}) {
|
|
100
|
-
const {
|
|
101
|
-
listPendingWithdrawals: $,
|
|
102
|
-
processWithdrawal: j,
|
|
103
|
-
processAllWithdrawals: k,
|
|
104
|
-
isLoading: x,
|
|
105
|
-
error: u,
|
|
106
|
-
clearError: F
|
|
107
|
-
} = Q(), [d, M] = h([]), [R, T] = h(0), [c, q] = h(0), [g, C] = h(null), [v, o] = h("withdrawalAvailableAt"), [l, H] = h("asc"), S = (a) => {
|
|
108
|
-
v === a ? H(l === "asc" ? "desc" : "asc") : (o(a), H(a === "withdrawalAvailableAt" ? "asc" : "desc"));
|
|
109
|
-
}, V = se(() => [...d].sort((a, f) => {
|
|
110
|
-
let A, I;
|
|
111
|
-
switch (v) {
|
|
112
|
-
case "userId":
|
|
113
|
-
A = a.userId.toLowerCase(), I = f.userId.toLowerCase();
|
|
114
|
-
break;
|
|
115
|
-
case "amountLamports":
|
|
116
|
-
A = a.amountLamports ?? 0, I = f.amountLamports ?? 0;
|
|
117
|
-
break;
|
|
118
|
-
case "withdrawalAvailableAt":
|
|
119
|
-
A = a.withdrawalAvailableAt ? new Date(a.withdrawalAvailableAt).getTime() : 0, I = f.withdrawalAvailableAt ? new Date(f.withdrawalAvailableAt).getTime() : 0;
|
|
120
|
-
break;
|
|
121
|
-
default:
|
|
122
|
-
return 0;
|
|
123
|
-
}
|
|
124
|
-
return A < I ? l === "asc" ? -1 : 1 : A > I ? l === "asc" ? 1 : -1 : 0;
|
|
125
|
-
}), [d, v, l]), [_, s] = h(null), [m, E] = h(!1), [L, W] = h(null), [O, K] = h(null), D = B(async () => {
|
|
126
|
-
try {
|
|
127
|
-
const a = await $({ limit: t, offset: c });
|
|
128
|
-
M(a.deposits), T(a.total), p?.(a), C(null);
|
|
129
|
-
} catch (a) {
|
|
130
|
-
const f = a && typeof a == "object" && "message" in a ? String(a.message) : "Failed to load pending withdrawals";
|
|
131
|
-
C(f);
|
|
132
|
-
}
|
|
133
|
-
}, [t, c, $, p]);
|
|
134
|
-
P(() => {
|
|
135
|
-
q(0);
|
|
136
|
-
}, [t]), P(() => {
|
|
137
|
-
D();
|
|
138
|
-
}, [D]), P(() => {
|
|
139
|
-
w !== void 0 && D();
|
|
140
|
-
}, [w, D]), P(() => {
|
|
141
|
-
if (w !== void 0 || i <= 0) return;
|
|
142
|
-
const a = setInterval(D, i);
|
|
143
|
-
return () => clearInterval(a);
|
|
144
|
-
}, [i, w, D]), P(() => {
|
|
145
|
-
if (!L) return;
|
|
146
|
-
const a = setTimeout(() => W(null), 5e3);
|
|
147
|
-
return () => clearTimeout(a);
|
|
148
|
-
}, [L]);
|
|
149
|
-
const G = Math.ceil(R / t), U = Math.floor(c / t) + 1, X = (a) => {
|
|
150
|
-
const f = (a - 1) * t;
|
|
151
|
-
q(Math.max(0, Math.min(f, Math.max(0, R - 1))));
|
|
152
|
-
}, Y = async (a, f = !1) => {
|
|
153
|
-
if (!f && re(a.withdrawalAvailableAt)) {
|
|
154
|
-
K(a);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
s(a.id), W(null);
|
|
158
|
-
try {
|
|
159
|
-
const A = await j(a.id, { force: f });
|
|
160
|
-
A.success ? (W({
|
|
161
|
-
type: "success",
|
|
162
|
-
message: `Withdrawal processed: ${A.txSignature?.slice(0, 12)}...`
|
|
163
|
-
}), N?.(A), await D()) : W({
|
|
164
|
-
type: "error",
|
|
165
|
-
message: A.error || "Failed to process withdrawal"
|
|
166
|
-
});
|
|
167
|
-
} catch (A) {
|
|
168
|
-
W({
|
|
169
|
-
type: "error",
|
|
170
|
-
message: A instanceof Error ? A.message : "Failed to process withdrawal"
|
|
171
|
-
});
|
|
172
|
-
} finally {
|
|
173
|
-
s(null), K(null);
|
|
174
|
-
}
|
|
175
|
-
}, ne = async () => {
|
|
176
|
-
if (d.length !== 0) {
|
|
177
|
-
E(!0), W(null);
|
|
178
|
-
try {
|
|
179
|
-
const a = await k();
|
|
180
|
-
a.totalSucceeded > 0 ? W({
|
|
181
|
-
type: "success",
|
|
182
|
-
message: `Processed ${a.totalSucceeded}/${a.totalProcessed} withdrawals`
|
|
183
|
-
}) : a.totalFailed > 0 && W({
|
|
184
|
-
type: "error",
|
|
185
|
-
message: `Failed to process ${a.totalFailed} withdrawals`
|
|
186
|
-
}), y?.(a), await D();
|
|
187
|
-
} catch (a) {
|
|
188
|
-
W({
|
|
189
|
-
type: "error",
|
|
190
|
-
message: a instanceof Error ? a.message : "Failed to process withdrawals"
|
|
191
|
-
});
|
|
192
|
-
} finally {
|
|
193
|
-
E(!1);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}, Z = g || u;
|
|
197
|
-
return Z ? /* @__PURE__ */ r(
|
|
198
|
-
"div",
|
|
199
|
-
{
|
|
200
|
-
className: `cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-error ${b}`,
|
|
201
|
-
children: [
|
|
202
|
-
/* @__PURE__ */ e("p", { className: "cedros-admin-error", children: Z }),
|
|
203
|
-
/* @__PURE__ */ e(
|
|
204
|
-
"button",
|
|
205
|
-
{
|
|
206
|
-
type: "button",
|
|
207
|
-
className: "cedros-button cedros-button-outline",
|
|
208
|
-
onClick: () => {
|
|
209
|
-
F(), C(null), D();
|
|
210
|
-
},
|
|
211
|
-
children: "Retry"
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
) : x && d.length === 0 && !_ && !m ? /* @__PURE__ */ r(
|
|
217
|
-
"div",
|
|
218
|
-
{
|
|
219
|
-
className: `cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-loading ${b}`,
|
|
220
|
-
children: [
|
|
221
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
|
|
222
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-loading-text", children: "Loading withdrawal queue..." })
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
) : /* @__PURE__ */ r("div", { className: `cedros-admin-withdrawal-queue ${b}`, children: [
|
|
226
|
-
O && /* @__PURE__ */ e(
|
|
227
|
-
"div",
|
|
228
|
-
{
|
|
229
|
-
className: "cedros-admin-modal-overlay",
|
|
230
|
-
onClick: () => K(null),
|
|
231
|
-
onKeyDown: (a) => a.key === "Escape" && K(null),
|
|
232
|
-
role: "dialog",
|
|
233
|
-
"aria-modal": "true",
|
|
234
|
-
"aria-labelledby": "early-withdrawal-title",
|
|
235
|
-
children: /* @__PURE__ */ r(
|
|
236
|
-
"div",
|
|
237
|
-
{
|
|
238
|
-
className: "cedros-admin-modal cedros-admin-modal-warning",
|
|
239
|
-
onClick: (a) => a.stopPropagation(),
|
|
240
|
-
onKeyDown: () => {
|
|
241
|
-
},
|
|
242
|
-
role: "document",
|
|
243
|
-
children: [
|
|
244
|
-
/* @__PURE__ */ e("h3", { id: "early-withdrawal-title", className: "cedros-admin-modal-title", children: "Early Withdrawal Warning" }),
|
|
245
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-modal-content", children: [
|
|
246
|
-
/* @__PURE__ */ e("p", { className: "cedros-admin-modal-warning-text", children: /* @__PURE__ */ e("strong", { children: "This deposit is still within its privacy period." }) }),
|
|
247
|
-
/* @__PURE__ */ e("p", { children: "Processing this withdrawal early may compromise user privacy. The privacy period exists to provide plausible deniability for deposits." }),
|
|
248
|
-
/* @__PURE__ */ r("p", { className: "cedros-admin-modal-details", children: [
|
|
249
|
-
"User: ",
|
|
250
|
-
ae(O.userId),
|
|
251
|
-
/* @__PURE__ */ e("br", {}),
|
|
252
|
-
"Amount: ",
|
|
253
|
-
ee(O.amountLamports),
|
|
254
|
-
/* @__PURE__ */ e("br", {}),
|
|
255
|
-
"Available at:",
|
|
256
|
-
" ",
|
|
257
|
-
O.withdrawalAvailableAt ? te(O.withdrawalAvailableAt) : "—"
|
|
258
|
-
] }),
|
|
259
|
-
/* @__PURE__ */ e("p", { children: "Are you sure you want to process this withdrawal early?" })
|
|
260
|
-
] }),
|
|
261
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-modal-actions", children: [
|
|
262
|
-
/* @__PURE__ */ e(
|
|
263
|
-
"button",
|
|
264
|
-
{
|
|
265
|
-
type: "button",
|
|
266
|
-
className: "cedros-button cedros-button-outline",
|
|
267
|
-
onClick: () => K(null),
|
|
268
|
-
children: "Cancel"
|
|
269
|
-
}
|
|
270
|
-
),
|
|
271
|
-
/* @__PURE__ */ e(
|
|
272
|
-
"button",
|
|
273
|
-
{
|
|
274
|
-
type: "button",
|
|
275
|
-
className: "cedros-button cedros-button-danger",
|
|
276
|
-
onClick: () => Y(O, !0),
|
|
277
|
-
disabled: _ === O.id,
|
|
278
|
-
children: _ === O.id ? "Processing..." : "Process Early"
|
|
279
|
-
}
|
|
280
|
-
)
|
|
281
|
-
] })
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
),
|
|
287
|
-
L && /* @__PURE__ */ e(
|
|
288
|
-
"div",
|
|
289
|
-
{
|
|
290
|
-
className: `cedros-admin-result cedros-admin-result-${L.type}`,
|
|
291
|
-
role: "status",
|
|
292
|
-
"aria-live": "polite",
|
|
293
|
-
children: L.message
|
|
294
|
-
}
|
|
295
|
-
),
|
|
296
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-withdrawal-queue-header", children: [
|
|
297
|
-
/* @__PURE__ */ e("h4", { className: "cedros-admin-withdrawal-queue-title", children: "Pending Withdrawals" }),
|
|
298
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-withdrawal-queue-actions", children: [
|
|
299
|
-
/* @__PURE__ */ r("span", { className: "cedros-admin-queue-count", children: [
|
|
300
|
-
R,
|
|
301
|
-
" pending"
|
|
302
|
-
] }),
|
|
303
|
-
/* @__PURE__ */ e(
|
|
304
|
-
"button",
|
|
305
|
-
{
|
|
306
|
-
type: "button",
|
|
307
|
-
className: "cedros-admin__stats-bar-refresh",
|
|
308
|
-
onClick: D,
|
|
309
|
-
disabled: x || m,
|
|
310
|
-
title: "Refresh queue",
|
|
311
|
-
"aria-label": "Refresh queue",
|
|
312
|
-
children: x && !m ? "..." : "↻"
|
|
313
|
-
}
|
|
314
|
-
),
|
|
315
|
-
/* @__PURE__ */ e(
|
|
316
|
-
"button",
|
|
317
|
-
{
|
|
318
|
-
type: "button",
|
|
319
|
-
className: "cedros-button cedros-button-primary cedros-button-sm",
|
|
320
|
-
onClick: ne,
|
|
321
|
-
disabled: x || m || d.length === 0,
|
|
322
|
-
title: "Process all ready withdrawals",
|
|
323
|
-
children: m ? "Processing..." : "Process All"
|
|
324
|
-
}
|
|
325
|
-
)
|
|
326
|
-
] })
|
|
327
|
-
] }),
|
|
328
|
-
d.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty", children: /* @__PURE__ */ e("p", { className: "cedros-admin-empty-message", children: "No pending withdrawals." }) }) : /* @__PURE__ */ r(J, { children: [
|
|
329
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-withdrawal-table", children: [
|
|
330
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-withdrawal-thead", children: [
|
|
331
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-th", children: /* @__PURE__ */ r(
|
|
332
|
-
"button",
|
|
333
|
-
{
|
|
334
|
-
type: "button",
|
|
335
|
-
className: `cedros-admin-sort-button ${v === "userId" ? "cedros-admin-sort-active" : ""}`,
|
|
336
|
-
onClick: () => S("userId"),
|
|
337
|
-
"aria-label": "Sort by user",
|
|
338
|
-
children: [
|
|
339
|
-
"User",
|
|
340
|
-
" ",
|
|
341
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: v === "userId" ? l === "asc" ? "↑" : "↓" : "↕" })
|
|
342
|
-
]
|
|
343
|
-
}
|
|
344
|
-
) }),
|
|
345
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-th", children: /* @__PURE__ */ r(
|
|
346
|
-
"button",
|
|
347
|
-
{
|
|
348
|
-
type: "button",
|
|
349
|
-
className: `cedros-admin-sort-button ${v === "amountLamports" ? "cedros-admin-sort-active" : ""}`,
|
|
350
|
-
onClick: () => S("amountLamports"),
|
|
351
|
-
"aria-label": "Sort by amount",
|
|
352
|
-
children: [
|
|
353
|
-
"Amount",
|
|
354
|
-
" ",
|
|
355
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: v === "amountLamports" ? l === "asc" ? "↑" : "↓" : "↕" })
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
) }),
|
|
359
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-th", children: /* @__PURE__ */ r(
|
|
360
|
-
"button",
|
|
361
|
-
{
|
|
362
|
-
type: "button",
|
|
363
|
-
className: `cedros-admin-sort-button ${v === "withdrawalAvailableAt" ? "cedros-admin-sort-active" : ""}`,
|
|
364
|
-
onClick: () => S("withdrawalAvailableAt"),
|
|
365
|
-
"aria-label": "Sort by ready since",
|
|
366
|
-
children: [
|
|
367
|
-
"Ready Since",
|
|
368
|
-
" ",
|
|
369
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: v === "withdrawalAvailableAt" ? l === "asc" ? "↑" : "↓" : "↕" })
|
|
370
|
-
]
|
|
371
|
-
}
|
|
372
|
-
) }),
|
|
373
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-th", children: "Waiting" }),
|
|
374
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-th cedros-admin-withdrawal-th-action", children: "Action" })
|
|
375
|
-
] }),
|
|
376
|
-
V.map((a) => {
|
|
377
|
-
const f = re(a.withdrawalAvailableAt), A = _ === a.id;
|
|
378
|
-
return /* @__PURE__ */ r(
|
|
379
|
-
"div",
|
|
380
|
-
{
|
|
381
|
-
className: `cedros-admin-withdrawal-row ${f ? "cedros-admin-withdrawal-row-early" : ""}`,
|
|
382
|
-
onClick: () => n?.(a),
|
|
383
|
-
onKeyDown: (I) => {
|
|
384
|
-
(I.key === "Enter" || I.key === " ") && (I.preventDefault(), n?.(a));
|
|
385
|
-
},
|
|
386
|
-
role: n ? "button" : void 0,
|
|
387
|
-
tabIndex: n ? 0 : void 0,
|
|
388
|
-
children: [
|
|
389
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-td", title: a.userId, children: ae(a.userId) }),
|
|
390
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-td", children: ee(a.amountLamports) }),
|
|
391
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-td", children: a.withdrawalAvailableAt ? te(a.withdrawalAvailableAt) : "—" }),
|
|
392
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-td cedros-admin-withdrawal-waiting", children: a.withdrawalAvailableAt ? f ? "In privacy period" : oe(a.withdrawalAvailableAt) : "—" }),
|
|
393
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-withdrawal-td cedros-admin-withdrawal-td-action", children: /* @__PURE__ */ e(
|
|
394
|
-
"button",
|
|
395
|
-
{
|
|
396
|
-
type: "button",
|
|
397
|
-
className: `cedros-button cedros-button-sm ${f ? "cedros-button-warning" : "cedros-button-primary"}`,
|
|
398
|
-
onClick: (I) => {
|
|
399
|
-
I.stopPropagation(), Y(a);
|
|
400
|
-
},
|
|
401
|
-
disabled: A || m,
|
|
402
|
-
title: f ? "Early withdrawal (requires confirmation)" : "Process this withdrawal",
|
|
403
|
-
children: A ? "..." : f ? "Early" : "Process"
|
|
404
|
-
}
|
|
405
|
-
) })
|
|
406
|
-
]
|
|
407
|
-
},
|
|
408
|
-
a.id
|
|
409
|
-
);
|
|
410
|
-
})
|
|
411
|
-
] }),
|
|
412
|
-
G > 1 && /* @__PURE__ */ r("div", { className: "cedros-admin-pagination", children: [
|
|
413
|
-
/* @__PURE__ */ e(
|
|
414
|
-
"button",
|
|
415
|
-
{
|
|
416
|
-
type: "button",
|
|
417
|
-
className: "cedros-button cedros-button-outline cedros-button-sm",
|
|
418
|
-
onClick: () => X(U - 1),
|
|
419
|
-
disabled: U <= 1,
|
|
420
|
-
children: "Previous"
|
|
421
|
-
}
|
|
422
|
-
),
|
|
423
|
-
/* @__PURE__ */ r("span", { className: "cedros-admin-page-info", children: [
|
|
424
|
-
"Page ",
|
|
425
|
-
U,
|
|
426
|
-
" of ",
|
|
427
|
-
G,
|
|
428
|
-
" (",
|
|
429
|
-
R,
|
|
430
|
-
" total)"
|
|
431
|
-
] }),
|
|
432
|
-
/* @__PURE__ */ e(
|
|
433
|
-
"button",
|
|
434
|
-
{
|
|
435
|
-
type: "button",
|
|
436
|
-
className: "cedros-button cedros-button-outline cedros-button-sm",
|
|
437
|
-
onClick: () => X(U + 1),
|
|
438
|
-
disabled: U >= G,
|
|
439
|
-
children: "Next"
|
|
440
|
-
}
|
|
441
|
-
)
|
|
442
|
-
] })
|
|
443
|
-
] })
|
|
444
|
-
] });
|
|
445
|
-
}
|
|
446
|
-
function ie(t) {
|
|
447
|
-
return t == null ? "—" : `${(t / 1e9).toFixed(4)} SOL`;
|
|
448
|
-
}
|
|
449
|
-
function de(t) {
|
|
450
|
-
return new Date(t).toLocaleDateString(void 0, {
|
|
451
|
-
year: "numeric",
|
|
452
|
-
month: "short",
|
|
453
|
-
day: "numeric",
|
|
454
|
-
hour: "2-digit",
|
|
455
|
-
minute: "2-digit"
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
function ce(t) {
|
|
459
|
-
return t.length <= 12 ? t : `${t.slice(0, 6)}...${t.slice(-4)}`;
|
|
460
|
-
}
|
|
461
|
-
function le(t) {
|
|
462
|
-
const i = new Date(t), w = /* @__PURE__ */ new Date(), b = i.getTime() - w.getTime();
|
|
463
|
-
if (b <= 0) return "Ready";
|
|
464
|
-
const p = Math.floor(b / 6e4), n = Math.floor(p / 60), N = Math.floor(n / 24);
|
|
465
|
-
if (N > 0) {
|
|
466
|
-
const y = n % 24;
|
|
467
|
-
return y > 0 ? `${N}d ${y}h` : `${N}d`;
|
|
468
|
-
}
|
|
469
|
-
if (n > 0) {
|
|
470
|
-
const y = p % 60;
|
|
471
|
-
return y > 0 ? `${n}h ${y}m` : `${n}h`;
|
|
472
|
-
}
|
|
473
|
-
return `${p}m`;
|
|
474
|
-
}
|
|
475
|
-
function ge({
|
|
476
|
-
pageSize: t = 20,
|
|
477
|
-
refreshInterval: i = 0,
|
|
478
|
-
refreshSignal: w,
|
|
479
|
-
className: b = "",
|
|
480
|
-
onLoad: p,
|
|
481
|
-
onItemClick: n
|
|
482
|
-
}) {
|
|
483
|
-
const { listInPrivacyPeriod: N, isLoading: y, error: $, clearError: j } = Q(), [k, x] = h([]), [u, F] = h(0), [d, M] = h(0), [R, T] = h(null), c = B(async () => {
|
|
484
|
-
try {
|
|
485
|
-
const o = await N({ limit: t, offset: d });
|
|
486
|
-
x(o.deposits), F(o.total), p?.(o), T(null);
|
|
487
|
-
} catch (o) {
|
|
488
|
-
const l = o && typeof o == "object" && "message" in o ? String(o.message) : "Failed to load deposits";
|
|
489
|
-
T(l);
|
|
490
|
-
}
|
|
491
|
-
}, [t, d, N, p]);
|
|
492
|
-
P(() => {
|
|
493
|
-
M(0);
|
|
494
|
-
}, [t]), P(() => {
|
|
495
|
-
c();
|
|
496
|
-
}, [c]), P(() => {
|
|
497
|
-
w !== void 0 && c();
|
|
498
|
-
}, [w, c]), P(() => {
|
|
499
|
-
if (w !== void 0 || i <= 0) return;
|
|
500
|
-
const o = setInterval(c, i);
|
|
501
|
-
return () => clearInterval(o);
|
|
502
|
-
}, [i, w, c]);
|
|
503
|
-
const q = Math.ceil(u / t), g = Math.floor(d / t) + 1, C = (o) => {
|
|
504
|
-
const l = (o - 1) * t;
|
|
505
|
-
M(Math.max(0, Math.min(l, Math.max(0, u - 1))));
|
|
506
|
-
}, v = R || $;
|
|
507
|
-
return v ? /* @__PURE__ */ r(
|
|
508
|
-
"div",
|
|
509
|
-
{
|
|
510
|
-
className: `cedros-admin-privacy-deposits cedros-admin-privacy-deposits-error ${b}`,
|
|
511
|
-
children: [
|
|
512
|
-
/* @__PURE__ */ e("p", { className: "cedros-admin-error", children: v }),
|
|
513
|
-
/* @__PURE__ */ e(
|
|
514
|
-
"button",
|
|
515
|
-
{
|
|
516
|
-
type: "button",
|
|
517
|
-
className: "cedros-button cedros-button-outline",
|
|
518
|
-
onClick: () => {
|
|
519
|
-
j(), T(null), c();
|
|
520
|
-
},
|
|
521
|
-
children: "Retry"
|
|
522
|
-
}
|
|
523
|
-
)
|
|
524
|
-
]
|
|
525
|
-
}
|
|
526
|
-
) : y && k.length === 0 ? /* @__PURE__ */ r(
|
|
527
|
-
"div",
|
|
528
|
-
{
|
|
529
|
-
className: `cedros-admin-privacy-deposits cedros-admin-privacy-deposits-loading ${b}`,
|
|
530
|
-
children: [
|
|
531
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
|
|
532
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-loading-text", children: "Loading deposits..." })
|
|
533
|
-
]
|
|
534
|
-
}
|
|
535
|
-
) : /* @__PURE__ */ r("div", { className: `cedros-admin-privacy-deposits ${b}`, children: [
|
|
536
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-privacy-deposits-header", children: [
|
|
537
|
-
/* @__PURE__ */ e("h4", { className: "cedros-admin-privacy-deposits-title", children: "In Privacy Period" }),
|
|
538
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-privacy-deposits-actions", children: [
|
|
539
|
-
/* @__PURE__ */ r("span", { className: "cedros-admin-queue-count", children: [
|
|
540
|
-
u,
|
|
541
|
-
" deposit",
|
|
542
|
-
u !== 1 ? "s" : ""
|
|
543
|
-
] }),
|
|
544
|
-
/* @__PURE__ */ e(
|
|
545
|
-
"button",
|
|
546
|
-
{
|
|
547
|
-
type: "button",
|
|
548
|
-
className: "cedros-admin__stats-bar-refresh",
|
|
549
|
-
onClick: c,
|
|
550
|
-
disabled: y,
|
|
551
|
-
title: "Refresh list",
|
|
552
|
-
"aria-label": "Refresh list",
|
|
553
|
-
children: y ? "..." : "↻"
|
|
554
|
-
}
|
|
555
|
-
)
|
|
556
|
-
] })
|
|
557
|
-
] }),
|
|
558
|
-
k.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty", children: /* @__PURE__ */ e("p", { className: "cedros-admin-empty-message", children: "No deposits in privacy period." }) }) : /* @__PURE__ */ r(J, { children: [
|
|
559
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-privacy-table", children: [
|
|
560
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-privacy-thead", children: [
|
|
561
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-th", children: /* @__PURE__ */ r(
|
|
562
|
-
"button",
|
|
563
|
-
{
|
|
564
|
-
type: "button",
|
|
565
|
-
className: "cedros-admin-sort-button",
|
|
566
|
-
"aria-label": "Sort by user",
|
|
567
|
-
children: [
|
|
568
|
-
"User ",
|
|
569
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: "↕" })
|
|
570
|
-
]
|
|
571
|
-
}
|
|
572
|
-
) }),
|
|
573
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-th", children: /* @__PURE__ */ r(
|
|
574
|
-
"button",
|
|
575
|
-
{
|
|
576
|
-
type: "button",
|
|
577
|
-
className: "cedros-admin-sort-button",
|
|
578
|
-
"aria-label": "Sort by amount",
|
|
579
|
-
children: [
|
|
580
|
-
"Amount ",
|
|
581
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: "↕" })
|
|
582
|
-
]
|
|
583
|
-
}
|
|
584
|
-
) }),
|
|
585
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-th", children: /* @__PURE__ */ r(
|
|
586
|
-
"button",
|
|
587
|
-
{
|
|
588
|
-
type: "button",
|
|
589
|
-
className: "cedros-admin-sort-button",
|
|
590
|
-
"aria-label": "Sort by deposited",
|
|
591
|
-
children: [
|
|
592
|
-
"Deposited ",
|
|
593
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: "↕" })
|
|
594
|
-
]
|
|
595
|
-
}
|
|
596
|
-
) }),
|
|
597
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-th", children: /* @__PURE__ */ r(
|
|
598
|
-
"button",
|
|
599
|
-
{
|
|
600
|
-
type: "button",
|
|
601
|
-
className: "cedros-admin-sort-button",
|
|
602
|
-
"aria-label": "Sort by ready in",
|
|
603
|
-
children: [
|
|
604
|
-
"Ready In ",
|
|
605
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: "↕" })
|
|
606
|
-
]
|
|
607
|
-
}
|
|
608
|
-
) })
|
|
609
|
-
] }),
|
|
610
|
-
k.map((o) => /* @__PURE__ */ r(
|
|
611
|
-
"div",
|
|
612
|
-
{
|
|
613
|
-
className: "cedros-admin-privacy-row",
|
|
614
|
-
onClick: () => n?.(o),
|
|
615
|
-
onKeyDown: (l) => {
|
|
616
|
-
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), n?.(o));
|
|
617
|
-
},
|
|
618
|
-
role: n ? "button" : void 0,
|
|
619
|
-
tabIndex: n ? 0 : void 0,
|
|
620
|
-
children: [
|
|
621
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-td", title: o.userId, children: ce(o.userId) }),
|
|
622
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-td", children: ie(o.amountLamports) }),
|
|
623
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-td", children: o.completedAt ? de(o.completedAt) : "—" }),
|
|
624
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-privacy-td cedros-admin-privacy-remaining", children: o.withdrawalAvailableAt ? le(o.withdrawalAvailableAt) : "—" })
|
|
625
|
-
]
|
|
626
|
-
},
|
|
627
|
-
o.id
|
|
628
|
-
))
|
|
629
|
-
] }),
|
|
630
|
-
q > 1 && /* @__PURE__ */ r("div", { className: "cedros-admin-pagination", children: [
|
|
631
|
-
/* @__PURE__ */ e(
|
|
632
|
-
"button",
|
|
633
|
-
{
|
|
634
|
-
type: "button",
|
|
635
|
-
className: "cedros-button cedros-button-outline cedros-button-sm",
|
|
636
|
-
onClick: () => C(g - 1),
|
|
637
|
-
disabled: g <= 1,
|
|
638
|
-
children: "Previous"
|
|
639
|
-
}
|
|
640
|
-
),
|
|
641
|
-
/* @__PURE__ */ r("span", { className: "cedros-admin-page-info", children: [
|
|
642
|
-
"Page ",
|
|
643
|
-
g,
|
|
644
|
-
" of ",
|
|
645
|
-
q,
|
|
646
|
-
" (",
|
|
647
|
-
u,
|
|
648
|
-
" total)"
|
|
649
|
-
] }),
|
|
650
|
-
/* @__PURE__ */ e(
|
|
651
|
-
"button",
|
|
652
|
-
{
|
|
653
|
-
type: "button",
|
|
654
|
-
className: "cedros-button cedros-button-outline cedros-button-sm",
|
|
655
|
-
onClick: () => C(g + 1),
|
|
656
|
-
disabled: g >= q,
|
|
657
|
-
children: "Next"
|
|
658
|
-
}
|
|
659
|
-
)
|
|
660
|
-
] })
|
|
661
|
-
] })
|
|
662
|
-
] });
|
|
663
|
-
}
|
|
664
|
-
function ue(t) {
|
|
665
|
-
return t == null ? "—" : `${(t / 1e9).toFixed(4)} SOL`;
|
|
666
|
-
}
|
|
667
|
-
function me(t) {
|
|
668
|
-
return new Date(t).toLocaleDateString(void 0, {
|
|
669
|
-
year: "numeric",
|
|
670
|
-
month: "short",
|
|
671
|
-
day: "numeric",
|
|
672
|
-
hour: "2-digit",
|
|
673
|
-
minute: "2-digit"
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
function he(t) {
|
|
677
|
-
return t.length <= 16 ? t : `${t.slice(0, 8)}...${t.slice(-6)}`;
|
|
678
|
-
}
|
|
679
|
-
function we(t) {
|
|
680
|
-
return t.length <= 12 ? t : `${t.slice(0, 6)}...${t.slice(-4)}`;
|
|
681
|
-
}
|
|
682
|
-
function Ae({
|
|
683
|
-
pageSize: t = 20,
|
|
684
|
-
refreshInterval: i = 0,
|
|
685
|
-
refreshSignal: w,
|
|
686
|
-
className: b = "",
|
|
687
|
-
onLoad: p,
|
|
688
|
-
onItemClick: n
|
|
689
|
-
}) {
|
|
690
|
-
const { listDeposits: N, isLoading: y, error: $, clearError: j } = Q(), [k, x] = h([]), [u, F] = h(0), [d, M] = h(0), [R, T] = h(null), [c, q] = h("completedAt"), [g, C] = h("desc"), v = (s) => {
|
|
691
|
-
c === s ? C(g === "asc" ? "desc" : "asc") : (q(s), C("desc"));
|
|
692
|
-
}, o = se(() => [...k].sort((s, m) => {
|
|
693
|
-
let E, L;
|
|
694
|
-
switch (c) {
|
|
695
|
-
case "userId":
|
|
696
|
-
E = s.userId.toLowerCase(), L = m.userId.toLowerCase();
|
|
697
|
-
break;
|
|
698
|
-
case "amountLamports":
|
|
699
|
-
E = s.amountLamports ?? 0, L = m.amountLamports ?? 0;
|
|
700
|
-
break;
|
|
701
|
-
case "completedAt":
|
|
702
|
-
E = s.completedAt ? new Date(s.completedAt).getTime() : 0, L = m.completedAt ? new Date(m.completedAt).getTime() : 0;
|
|
703
|
-
break;
|
|
704
|
-
case "withdrawalTxSignature":
|
|
705
|
-
E = s.withdrawalTxSignature || "", L = m.withdrawalTxSignature || "";
|
|
706
|
-
break;
|
|
707
|
-
default:
|
|
708
|
-
return 0;
|
|
709
|
-
}
|
|
710
|
-
return E < L ? g === "asc" ? -1 : 1 : E > L ? g === "asc" ? 1 : -1 : 0;
|
|
711
|
-
}), [k, c, g]), l = B(async () => {
|
|
712
|
-
try {
|
|
713
|
-
const s = await N({ status: "withdrawn", limit: t, offset: d });
|
|
714
|
-
x(s.deposits), F(s.total), p?.(s), T(null);
|
|
715
|
-
} catch (s) {
|
|
716
|
-
const m = s && typeof s == "object" && "message" in s ? String(s.message) : "Failed to load withdrawal history";
|
|
717
|
-
T(m);
|
|
718
|
-
}
|
|
719
|
-
}, [t, d, N, p]);
|
|
720
|
-
P(() => {
|
|
721
|
-
M(0);
|
|
722
|
-
}, [t]), P(() => {
|
|
723
|
-
l();
|
|
724
|
-
}, [l]), P(() => {
|
|
725
|
-
w !== void 0 && l();
|
|
726
|
-
}, [w, l]), P(() => {
|
|
727
|
-
if (w !== void 0 || i <= 0) return;
|
|
728
|
-
const s = setInterval(l, i);
|
|
729
|
-
return () => clearInterval(s);
|
|
730
|
-
}, [i, w, l]);
|
|
731
|
-
const H = Math.ceil(u / t), S = Math.floor(d / t) + 1, V = (s) => {
|
|
732
|
-
const m = (s - 1) * t;
|
|
733
|
-
M(Math.max(0, Math.min(m, Math.max(0, u - 1))));
|
|
734
|
-
}, _ = R || $;
|
|
735
|
-
return _ ? /* @__PURE__ */ r(
|
|
736
|
-
"div",
|
|
737
|
-
{
|
|
738
|
-
className: `cedros-admin-withdrawal-history cedros-admin-withdrawal-history-error ${b}`,
|
|
739
|
-
children: [
|
|
740
|
-
/* @__PURE__ */ e("p", { className: "cedros-admin-error", children: _ }),
|
|
741
|
-
/* @__PURE__ */ e(
|
|
742
|
-
"button",
|
|
743
|
-
{
|
|
744
|
-
type: "button",
|
|
745
|
-
className: "cedros-button cedros-button-outline",
|
|
746
|
-
onClick: () => {
|
|
747
|
-
j(), T(null), l();
|
|
748
|
-
},
|
|
749
|
-
children: "Retry"
|
|
750
|
-
}
|
|
751
|
-
)
|
|
752
|
-
]
|
|
753
|
-
}
|
|
754
|
-
) : y && k.length === 0 ? /* @__PURE__ */ r(
|
|
755
|
-
"div",
|
|
756
|
-
{
|
|
757
|
-
className: `cedros-admin-withdrawal-history cedros-admin-withdrawal-history-loading ${b}`,
|
|
758
|
-
children: [
|
|
759
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
|
|
760
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-loading-text", children: "Loading withdrawal history..." })
|
|
761
|
-
]
|
|
762
|
-
}
|
|
763
|
-
) : /* @__PURE__ */ r("div", { className: `cedros-admin-withdrawal-history ${b}`, children: [
|
|
764
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-withdrawal-history-header", children: [
|
|
765
|
-
/* @__PURE__ */ e("h4", { className: "cedros-admin-withdrawal-history-title", children: "Withdrawal History" }),
|
|
766
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-withdrawal-history-actions", children: [
|
|
767
|
-
/* @__PURE__ */ r("span", { className: "cedros-admin-queue-count", children: [
|
|
768
|
-
u,
|
|
769
|
-
" withdrawal",
|
|
770
|
-
u !== 1 ? "s" : ""
|
|
771
|
-
] }),
|
|
772
|
-
/* @__PURE__ */ e(
|
|
773
|
-
"button",
|
|
774
|
-
{
|
|
775
|
-
type: "button",
|
|
776
|
-
className: "cedros-admin__stats-bar-refresh",
|
|
777
|
-
onClick: l,
|
|
778
|
-
disabled: y,
|
|
779
|
-
title: "Refresh list",
|
|
780
|
-
"aria-label": "Refresh list",
|
|
781
|
-
children: y ? "..." : "↻"
|
|
782
|
-
}
|
|
783
|
-
)
|
|
784
|
-
] })
|
|
785
|
-
] }),
|
|
786
|
-
k.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty", children: /* @__PURE__ */ e("p", { className: "cedros-admin-empty-message", children: "No withdrawals processed yet." }) }) : /* @__PURE__ */ r(J, { children: [
|
|
787
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-history-table", children: [
|
|
788
|
-
/* @__PURE__ */ r("div", { className: "cedros-admin-history-thead", children: [
|
|
789
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-th", children: /* @__PURE__ */ r(
|
|
790
|
-
"button",
|
|
791
|
-
{
|
|
792
|
-
type: "button",
|
|
793
|
-
className: `cedros-admin-sort-button ${c === "userId" ? "cedros-admin-sort-active" : ""}`,
|
|
794
|
-
onClick: () => v("userId"),
|
|
795
|
-
"aria-label": "Sort by user",
|
|
796
|
-
children: [
|
|
797
|
-
"User",
|
|
798
|
-
" ",
|
|
799
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: c === "userId" ? g === "asc" ? "↑" : "↓" : "↕" })
|
|
800
|
-
]
|
|
801
|
-
}
|
|
802
|
-
) }),
|
|
803
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-th", children: /* @__PURE__ */ r(
|
|
804
|
-
"button",
|
|
805
|
-
{
|
|
806
|
-
type: "button",
|
|
807
|
-
className: `cedros-admin-sort-button ${c === "amountLamports" ? "cedros-admin-sort-active" : ""}`,
|
|
808
|
-
onClick: () => v("amountLamports"),
|
|
809
|
-
"aria-label": "Sort by amount",
|
|
810
|
-
children: [
|
|
811
|
-
"Amount",
|
|
812
|
-
" ",
|
|
813
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: c === "amountLamports" ? g === "asc" ? "↑" : "↓" : "↕" })
|
|
814
|
-
]
|
|
815
|
-
}
|
|
816
|
-
) }),
|
|
817
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-th", children: /* @__PURE__ */ r(
|
|
818
|
-
"button",
|
|
819
|
-
{
|
|
820
|
-
type: "button",
|
|
821
|
-
className: `cedros-admin-sort-button ${c === "completedAt" ? "cedros-admin-sort-active" : ""}`,
|
|
822
|
-
onClick: () => v("completedAt"),
|
|
823
|
-
"aria-label": "Sort by processed",
|
|
824
|
-
children: [
|
|
825
|
-
"Processed",
|
|
826
|
-
" ",
|
|
827
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: c === "completedAt" ? g === "asc" ? "↑" : "↓" : "↕" })
|
|
828
|
-
]
|
|
829
|
-
}
|
|
830
|
-
) }),
|
|
831
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-th", children: /* @__PURE__ */ r(
|
|
832
|
-
"button",
|
|
833
|
-
{
|
|
834
|
-
type: "button",
|
|
835
|
-
className: `cedros-admin-sort-button ${c === "withdrawalTxSignature" ? "cedros-admin-sort-active" : ""}`,
|
|
836
|
-
onClick: () => v("withdrawalTxSignature"),
|
|
837
|
-
"aria-label": "Sort by transaction",
|
|
838
|
-
children: [
|
|
839
|
-
"Transaction",
|
|
840
|
-
" ",
|
|
841
|
-
/* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: c === "withdrawalTxSignature" ? g === "asc" ? "↑" : "↓" : "↕" })
|
|
842
|
-
]
|
|
843
|
-
}
|
|
844
|
-
) })
|
|
845
|
-
] }),
|
|
846
|
-
o.map((s) => /* @__PURE__ */ r(
|
|
847
|
-
"div",
|
|
848
|
-
{
|
|
849
|
-
className: "cedros-admin-history-row",
|
|
850
|
-
onClick: () => n?.(s),
|
|
851
|
-
onKeyDown: (m) => {
|
|
852
|
-
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), n?.(s));
|
|
853
|
-
},
|
|
854
|
-
role: n ? "button" : void 0,
|
|
855
|
-
tabIndex: n ? 0 : void 0,
|
|
856
|
-
children: [
|
|
857
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-td", title: s.userId, children: we(s.userId) }),
|
|
858
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-td", children: ue(s.amountLamports) }),
|
|
859
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-td", children: s.completedAt ? me(s.completedAt) : "—" }),
|
|
860
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-history-td", children: s.withdrawalTxSignature ? /* @__PURE__ */ e(
|
|
861
|
-
"a",
|
|
862
|
-
{
|
|
863
|
-
href: `https://orbmarkets.io/tx/${s.withdrawalTxSignature}`,
|
|
864
|
-
target: "_blank",
|
|
865
|
-
rel: "noopener noreferrer",
|
|
866
|
-
className: "cedros-admin-tx-link",
|
|
867
|
-
onClick: (m) => m.stopPropagation(),
|
|
868
|
-
title: s.withdrawalTxSignature,
|
|
869
|
-
children: he(s.withdrawalTxSignature)
|
|
870
|
-
}
|
|
871
|
-
) : "—" })
|
|
872
|
-
]
|
|
873
|
-
},
|
|
874
|
-
s.id
|
|
875
|
-
))
|
|
876
|
-
] }),
|
|
877
|
-
H > 1 && /* @__PURE__ */ r("div", { className: "cedros-admin-pagination", children: [
|
|
878
|
-
/* @__PURE__ */ e(
|
|
879
|
-
"button",
|
|
880
|
-
{
|
|
881
|
-
type: "button",
|
|
882
|
-
className: "cedros-button cedros-button-outline cedros-button-sm",
|
|
883
|
-
onClick: () => V(S - 1),
|
|
884
|
-
disabled: S <= 1,
|
|
885
|
-
children: "Previous"
|
|
886
|
-
}
|
|
887
|
-
),
|
|
888
|
-
/* @__PURE__ */ r("span", { className: "cedros-admin-page-info", children: [
|
|
889
|
-
"Page ",
|
|
890
|
-
S,
|
|
891
|
-
" of ",
|
|
892
|
-
H,
|
|
893
|
-
" (",
|
|
894
|
-
u,
|
|
895
|
-
" total)"
|
|
896
|
-
] }),
|
|
897
|
-
/* @__PURE__ */ e(
|
|
898
|
-
"button",
|
|
899
|
-
{
|
|
900
|
-
type: "button",
|
|
901
|
-
className: "cedros-button cedros-button-outline cedros-button-sm",
|
|
902
|
-
onClick: () => V(S + 1),
|
|
903
|
-
disabled: S >= H,
|
|
904
|
-
children: "Next"
|
|
905
|
-
}
|
|
906
|
-
)
|
|
907
|
-
] })
|
|
908
|
-
] })
|
|
909
|
-
] });
|
|
910
|
-
}
|
|
911
|
-
export {
|
|
912
|
-
fe as A,
|
|
913
|
-
ge as a,
|
|
914
|
-
Ne as b,
|
|
915
|
-
Ae as c
|
|
916
|
-
};
|