@reeboot/strapi-payment-plugin 0.0.6 → 0.0.8
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 +21 -0
- package/dist/_chunks/{Analytics-CQmAVKsq.mjs → Analytics-CncK5kn-.mjs} +6 -7
- package/dist/_chunks/{Analytics-CLjtRWYA.js → Analytics-c8KBuG3k.js} +6 -7
- package/dist/_chunks/{App-DXN62SV6.mjs → App-B5AB8Omu.mjs} +7 -7
- package/dist/_chunks/{App-Dk7XtjNA.js → App-Cih9sWu1.js} +7 -7
- package/dist/_chunks/{Customers-BQzVBQDT.mjs → Customers-BVk2gx7w.mjs} +51 -118
- package/dist/_chunks/{Customers-BNDi4QBH.js → Customers-CZWOnN26.js} +50 -117
- package/dist/_chunks/{Dashboard-UUwohHZa.js → Dashboard-CEif4jQn.js} +60 -84
- package/dist/_chunks/{Dashboard-CuHC-dit.mjs → Dashboard-DAjD8Q_6.mjs} +60 -84
- package/dist/_chunks/{Orders-CitNCdWE.js → Orders-DZXb54VO.js} +73 -146
- package/dist/_chunks/{Orders-65mNfu2i.mjs → Orders-DdJqI1HB.mjs} +74 -147
- package/dist/_chunks/{PaymentList-B0CAzInT.mjs → PaymentList-3HWK7PMz.mjs} +14 -39
- package/dist/_chunks/{PaymentList-Dy1BAFoD.js → PaymentList-APfyYD1h.js} +14 -39
- package/dist/_chunks/{Payments-FnhoV_2B.mjs → Payments-DFL-Cwgy.mjs} +97 -103
- package/dist/_chunks/{Payments-TOnygGIW.js → Payments-VzDGbK4W.js} +96 -102
- package/dist/_chunks/{Settings-BJtDagUs.js → Settings-B1tR3WOm.js} +157 -161
- package/dist/_chunks/{Settings-EoLSuZLe.mjs → Settings-SALxClBu.mjs} +157 -161
- package/dist/_chunks/{index-2Zd_T7bD.mjs → index-CB6TMitx.mjs} +1 -1
- package/dist/_chunks/{index-CHEgJ7e5.js → index-D-fFikb8.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +7 -34
- package/dist/server/index.mjs +7 -34
- package/package.json +5 -4
- /package/dist/server/src/{types → services/types}/api.d.ts +0 -0
- /package/dist/server/src/{types → services/types}/customer.d.ts +0 -0
- /package/dist/server/src/{types → services/types}/index.d.ts +0 -0
- /package/dist/server/src/{types → services/types}/order.d.ts +0 -0
- /package/dist/server/src/{types → services/types}/payment.d.ts +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import { Modal, Typography, Flex, Box, Button, TextInput, SingleSelect, SingleSelectOption, Textarea, Alert, Grid, Divider, Table, Tbody, Tr, Td, Badge, Loader, EmptyStateLayout, Card, Pagination } from "@strapi/design-system";
|
|
3
|
+
import { Modal, Typography, Flex, Box, Button, TextInput, SingleSelect, SingleSelectOption, Textarea, Alert, Grid, Divider, Table, Tbody, Tr, Td, Badge, Loader, EmptyStateLayout, Card, Pagination, PreviousLink, PageLink, NextLink } from "@strapi/design-system";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
5
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
6
|
-
import { P as PLUGIN_ID } from "./index-
|
|
7
|
-
import {
|
|
6
|
+
import { P as PLUGIN_ID } from "./index-CB6TMitx.mjs";
|
|
7
|
+
import { Duplicate } from "@strapi/icons";
|
|
8
|
+
import { P as PaymentList } from "./PaymentList-3HWK7PMz.mjs";
|
|
8
9
|
const RefundModal = ({ payment, onClose, onSuccess }) => {
|
|
9
10
|
const { formatMessage } = useIntl();
|
|
10
11
|
const { post } = useFetchClient();
|
|
@@ -34,9 +35,7 @@ const RefundModal = ({ payment, onClose, onSuccess }) => {
|
|
|
34
35
|
const { data } = await post(`/${PLUGIN_ID}/admin/payments/${payment.id}/refund`, {
|
|
35
36
|
amount: refundAmount,
|
|
36
37
|
reason,
|
|
37
|
-
metadata: {
|
|
38
|
-
admin_notes: notes
|
|
39
|
-
}
|
|
38
|
+
metadata: { admin_notes: notes }
|
|
40
39
|
});
|
|
41
40
|
if (data.success) {
|
|
42
41
|
onSuccess();
|
|
@@ -86,7 +85,7 @@ const RefundModal = ({ payment, onClose, onSuccess }) => {
|
|
|
86
85
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => handlePartialRefund(25), children: formatMessage({ id: "payment-plugin.refund.quarter", defaultMessage: "25% Refund" }) })
|
|
87
86
|
] })
|
|
88
87
|
] }),
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
90
89
|
TextInput,
|
|
91
90
|
{
|
|
92
91
|
label: formatMessage({ id: "payment-plugin.refund.amount", defaultMessage: "Refund Amount" }),
|
|
@@ -102,8 +101,8 @@ const RefundModal = ({ payment, onClose, onSuccess }) => {
|
|
|
102
101
|
{ amount: formatCurrency(payment.amount, payment.currency) }
|
|
103
102
|
)
|
|
104
103
|
}
|
|
105
|
-
)
|
|
106
|
-
/* @__PURE__ */
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsxs(
|
|
107
106
|
SingleSelect,
|
|
108
107
|
{
|
|
109
108
|
label: formatMessage({ id: "payment-plugin.refund.reason", defaultMessage: "Reason" }),
|
|
@@ -115,8 +114,8 @@ const RefundModal = ({ payment, onClose, onSuccess }) => {
|
|
|
115
114
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "fraudulent", children: formatMessage({ id: "payment-plugin.refund.reason.fraudulent", defaultMessage: "Fraudulent" }) })
|
|
116
115
|
]
|
|
117
116
|
}
|
|
118
|
-
)
|
|
119
|
-
/* @__PURE__ */ jsx(
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
120
119
|
Textarea,
|
|
121
120
|
{
|
|
122
121
|
label: formatMessage({ id: "payment-plugin.refund.notes", defaultMessage: "Internal Notes (Optional)" }),
|
|
@@ -125,12 +124,29 @@ const RefundModal = ({ payment, onClose, onSuccess }) => {
|
|
|
125
124
|
onChange: (e) => setNotes(e.target.value),
|
|
126
125
|
rows: 3
|
|
127
126
|
}
|
|
128
|
-
)
|
|
129
|
-
error && /* @__PURE__ */ jsx(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
),
|
|
128
|
+
error && /* @__PURE__ */ jsx(
|
|
129
|
+
Alert,
|
|
130
|
+
{
|
|
131
|
+
variant: "danger",
|
|
132
|
+
title: formatMessage({ id: "payment-plugin.refund.error", defaultMessage: "Error" }),
|
|
133
|
+
closeLabel: formatMessage({ id: "payment-plugin.alert.close", defaultMessage: "Close alert" }),
|
|
134
|
+
onClose: () => setError(null),
|
|
135
|
+
children: error
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
Alert,
|
|
140
|
+
{
|
|
141
|
+
variant: "warning",
|
|
142
|
+
title: formatMessage({ id: "payment-plugin.refund.warning", defaultMessage: "Warning" }),
|
|
143
|
+
closeLabel: formatMessage({ id: "payment-plugin.alert.dismiss", defaultMessage: "Dismiss" }),
|
|
144
|
+
children: formatMessage({
|
|
145
|
+
id: "payment-plugin.refund.warningMessage",
|
|
146
|
+
defaultMessage: "This action cannot be undone. The refund will be processed immediately."
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
)
|
|
134
150
|
] }) }),
|
|
135
151
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
136
152
|
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: onClose, disabled: loading, children: formatMessage({ id: "payment-plugin.refund.cancel", defaultMessage: "Cancel" }) }),
|
|
@@ -149,7 +165,7 @@ const RefundModal = ({ payment, onClose, onSuccess }) => {
|
|
|
149
165
|
};
|
|
150
166
|
const PaymentCard = ({ payment, onClose }) => {
|
|
151
167
|
const { formatMessage } = useIntl();
|
|
152
|
-
|
|
168
|
+
const [copied, setCopied] = useState(false);
|
|
153
169
|
const formatCurrency = (amount, currency = "usd") => {
|
|
154
170
|
return new Intl.NumberFormat("en-US", {
|
|
155
171
|
style: "currency",
|
|
@@ -168,14 +184,19 @@ const PaymentCard = ({ payment, onClose }) => {
|
|
|
168
184
|
};
|
|
169
185
|
const getStatusBadge = (status) => {
|
|
170
186
|
const statusConfig = {
|
|
171
|
-
succeeded: {
|
|
172
|
-
pending: {
|
|
173
|
-
failed: {
|
|
174
|
-
refunded: {
|
|
175
|
-
canceled: {
|
|
187
|
+
succeeded: { variant: "success", label: "Success" },
|
|
188
|
+
pending: { variant: "warning", label: "Pending" },
|
|
189
|
+
failed: { variant: "danger", label: "Failed" },
|
|
190
|
+
refunded: { variant: "secondary", label: "Refunded" },
|
|
191
|
+
canceled: { variant: "neutral", label: "Canceled" }
|
|
176
192
|
};
|
|
177
193
|
const config = statusConfig[status] || statusConfig.pending;
|
|
178
|
-
return /* @__PURE__ */ jsx(Badge, {
|
|
194
|
+
return /* @__PURE__ */ jsx(Badge, { variant: config.variant, children: config.label });
|
|
195
|
+
};
|
|
196
|
+
const handleCopyStripeId = () => {
|
|
197
|
+
navigator.clipboard.writeText(payment.stripe_payment_intent_id || "");
|
|
198
|
+
setCopied(true);
|
|
199
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
179
200
|
};
|
|
180
201
|
return /* @__PURE__ */ jsx(Modal.Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
|
181
202
|
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", textColor: "neutral800", as: "h2", id: "title", children: formatMessage({ id: "payment-plugin.paymentDetails.title", defaultMessage: "Payment Details" }) }) }),
|
|
@@ -225,15 +246,14 @@ const PaymentCard = ({ payment, onClose }) => {
|
|
|
225
246
|
] })
|
|
226
247
|
] }) }),
|
|
227
248
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
228
|
-
/* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: "Close" }),
|
|
249
|
+
/* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({ id: "payment-plugin.paymentDetails.close", defaultMessage: "Close" }) }),
|
|
229
250
|
/* @__PURE__ */ jsx(
|
|
230
251
|
Button,
|
|
231
252
|
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
},
|
|
236
|
-
children: "Copy Stripe ID"
|
|
253
|
+
startIcon: /* @__PURE__ */ jsx(Duplicate, {}),
|
|
254
|
+
onClick: handleCopyStripeId,
|
|
255
|
+
variant: copied ? "success" : "default",
|
|
256
|
+
children: copied ? formatMessage({ id: "payment-plugin.paymentDetails.copied", defaultMessage: "Copied!" }) : formatMessage({ id: "payment-plugin.paymentDetails.copyStripeId", defaultMessage: "Copy Stripe ID" })
|
|
237
257
|
}
|
|
238
258
|
)
|
|
239
259
|
] })
|
|
@@ -243,36 +263,32 @@ const Payments = () => {
|
|
|
243
263
|
const { formatMessage } = useIntl();
|
|
244
264
|
const { get } = useFetchClient();
|
|
245
265
|
const [payments, setPayments] = useState([]);
|
|
246
|
-
const [filteredPayments, setFilteredPayments] = useState([]);
|
|
247
266
|
const [loading, setLoading] = useState(true);
|
|
248
267
|
const [error, setError] = useState(null);
|
|
249
268
|
const [selectedPayment, setSelectedPayment] = useState(null);
|
|
250
269
|
const [showRefundModal, setShowRefundModal] = useState(false);
|
|
251
270
|
const [showPaymentCard, setShowPaymentCard] = useState(false);
|
|
252
|
-
console.log("payments:", payments);
|
|
253
271
|
const [currentPage, setCurrentPage] = useState(1);
|
|
254
|
-
const
|
|
272
|
+
const pageSize = 25;
|
|
255
273
|
const [totalCount, setTotalCount] = useState(0);
|
|
256
274
|
const [filters, setFilters] = useState({
|
|
257
275
|
payment_status: "",
|
|
258
276
|
paymentMethod: "",
|
|
259
|
-
dateRange: { from: null, to: null },
|
|
260
277
|
search: "",
|
|
261
278
|
currency: ""
|
|
262
279
|
});
|
|
263
280
|
useEffect(() => {
|
|
264
281
|
fetchPayments();
|
|
265
|
-
}, [currentPage,
|
|
266
|
-
useEffect(() => {
|
|
267
|
-
applyFilters();
|
|
268
|
-
}, [payments, filters]);
|
|
282
|
+
}, [currentPage, filters]);
|
|
269
283
|
const fetchPayments = async () => {
|
|
270
284
|
try {
|
|
271
285
|
setLoading(true);
|
|
272
286
|
const queryParams = new URLSearchParams({
|
|
273
287
|
page: currentPage.toString(),
|
|
274
288
|
pageSize: pageSize.toString(),
|
|
275
|
-
...filters.payment_status && { payment_status: filters.payment_status }
|
|
289
|
+
...filters.payment_status && { payment_status: filters.payment_status },
|
|
290
|
+
...filters.search && { search: filters.search },
|
|
291
|
+
...filters.currency && { currency: filters.currency }
|
|
276
292
|
});
|
|
277
293
|
const { data } = await get(`/${PLUGIN_ID}/admin/payments?${queryParams}`);
|
|
278
294
|
if (data.success && data.data) {
|
|
@@ -284,7 +300,7 @@ const Payments = () => {
|
|
|
284
300
|
orderId: p.order?.documentId
|
|
285
301
|
}));
|
|
286
302
|
setPayments(formattedPayments);
|
|
287
|
-
setTotalCount(data.meta
|
|
303
|
+
setTotalCount(data.meta?.pagination?.total || 0);
|
|
288
304
|
}
|
|
289
305
|
setLoading(false);
|
|
290
306
|
} catch (err) {
|
|
@@ -292,35 +308,7 @@ const Payments = () => {
|
|
|
292
308
|
setLoading(false);
|
|
293
309
|
}
|
|
294
310
|
};
|
|
295
|
-
const
|
|
296
|
-
let filtered = [...payments];
|
|
297
|
-
if (filters.search) {
|
|
298
|
-
const searchLower = filters.search.toLowerCase();
|
|
299
|
-
filtered = filtered.filter(
|
|
300
|
-
(payment) => payment.customerEmail.toLowerCase().includes(searchLower) || payment.customerName?.toLowerCase().includes(searchLower) || payment.stripe_payment_intent_id && payment.stripe_payment_intent_id.toLowerCase().includes(searchLower) || payment.description?.toLowerCase().includes(searchLower)
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
if (filters.payment_status) {
|
|
304
|
-
filtered = filtered.filter((payment) => payment.payment_status === filters.payment_status);
|
|
305
|
-
}
|
|
306
|
-
if (filters.paymentMethod) {
|
|
307
|
-
filtered = filtered.filter((payment) => payment.payment_method === filters.paymentMethod);
|
|
308
|
-
}
|
|
309
|
-
if (filters.currency) {
|
|
310
|
-
filtered = filtered.filter((payment) => payment.currency === filters.currency);
|
|
311
|
-
}
|
|
312
|
-
if (filters.dateRange.from) {
|
|
313
|
-
filtered = filtered.filter(
|
|
314
|
-
(payment) => new Date(payment.createdAt) >= filters.dateRange.from
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
if (filters.dateRange.to) {
|
|
318
|
-
filtered = filtered.filter(
|
|
319
|
-
(payment) => new Date(payment.createdAt) <= filters.dateRange.to
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
setFilteredPayments(filtered);
|
|
323
|
-
};
|
|
311
|
+
const totalPages = Math.max(1, Math.ceil(totalCount / pageSize));
|
|
324
312
|
const formatDate = (dateString) => {
|
|
325
313
|
return new Date(dateString).toLocaleDateString("en-US", {
|
|
326
314
|
year: "numeric",
|
|
@@ -343,19 +331,13 @@ const Payments = () => {
|
|
|
343
331
|
setCurrentPage(1);
|
|
344
332
|
};
|
|
345
333
|
const clearFilters = () => {
|
|
346
|
-
setFilters({
|
|
347
|
-
payment_status: "",
|
|
348
|
-
paymentMethod: "",
|
|
349
|
-
dateRange: { from: null, to: null },
|
|
350
|
-
search: "",
|
|
351
|
-
currency: ""
|
|
352
|
-
});
|
|
334
|
+
setFilters({ payment_status: "", paymentMethod: "", search: "", currency: "" });
|
|
353
335
|
setCurrentPage(1);
|
|
354
336
|
};
|
|
355
337
|
const exportPayments = () => {
|
|
356
338
|
const csvContent = [
|
|
357
339
|
["ID", "Stripe Payment ID", "Customer Email", "Amount", "Currency", "Status", "Payment Method", "Date"],
|
|
358
|
-
...
|
|
340
|
+
...payments.map((payment) => [
|
|
359
341
|
payment.id,
|
|
360
342
|
payment.stripe_payment_intent_id || "",
|
|
361
343
|
payment.customerEmail || "",
|
|
@@ -374,19 +356,14 @@ const Payments = () => {
|
|
|
374
356
|
a.click();
|
|
375
357
|
window.URL.revokeObjectURL(url);
|
|
376
358
|
};
|
|
377
|
-
const startIndex = (currentPage - 1) * pageSize;
|
|
378
|
-
const endIndex = startIndex + pageSize;
|
|
379
|
-
const paginatedPayments = filteredPayments.slice(startIndex, endIndex);
|
|
380
|
-
const totalPages = Math.ceil(filteredPayments.length / pageSize);
|
|
381
359
|
if (loading && payments.length === 0) {
|
|
382
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
360
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
383
361
|
}
|
|
384
362
|
if (error) {
|
|
385
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
363
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
386
364
|
EmptyStateLayout,
|
|
387
365
|
{
|
|
388
|
-
|
|
389
|
-
subtitle: error,
|
|
366
|
+
content: error,
|
|
390
367
|
action: /* @__PURE__ */ jsx(Button, { onClick: fetchPayments, children: formatMessage({ id: "payment-plugin.payments.retry", defaultMessage: "Retry" }) })
|
|
391
368
|
}
|
|
392
369
|
) });
|
|
@@ -402,13 +379,14 @@ const Payments = () => {
|
|
|
402
379
|
] }),
|
|
403
380
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
404
381
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: exportPayments, children: formatMessage({ id: "payment-plugin.payments.export", defaultMessage: "Export" }) }),
|
|
405
|
-
/* @__PURE__ */ jsx(Button, { onClick:
|
|
382
|
+
/* @__PURE__ */ jsx(Button, { onClick: fetchPayments, children: formatMessage({ id: "payment-plugin.payments.refresh", defaultMessage: "Refresh" }) })
|
|
406
383
|
] })
|
|
407
384
|
] }) }),
|
|
408
385
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
409
386
|
/* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(
|
|
410
387
|
TextInput,
|
|
411
388
|
{
|
|
389
|
+
label: formatMessage({ id: "payment-plugin.payments.search.label", defaultMessage: "Search" }),
|
|
412
390
|
placeholder: formatMessage({
|
|
413
391
|
id: "payment-plugin.payments.search.placeholder",
|
|
414
392
|
defaultMessage: "Search payments..."
|
|
@@ -420,6 +398,7 @@ const Payments = () => {
|
|
|
420
398
|
/* @__PURE__ */ jsx(Grid.Item, { col: 2, children: /* @__PURE__ */ jsxs(
|
|
421
399
|
SingleSelect,
|
|
422
400
|
{
|
|
401
|
+
label: formatMessage({ id: "payment-plugin.payments.status.label", defaultMessage: "Status" }),
|
|
423
402
|
placeholder: formatMessage({
|
|
424
403
|
id: "payment-plugin.payments.status.placeholder",
|
|
425
404
|
defaultMessage: "All Statuses"
|
|
@@ -438,9 +417,10 @@ const Payments = () => {
|
|
|
438
417
|
/* @__PURE__ */ jsx(Grid.Item, { col: 2, children: /* @__PURE__ */ jsxs(
|
|
439
418
|
SingleSelect,
|
|
440
419
|
{
|
|
420
|
+
label: formatMessage({ id: "payment-plugin.payments.method.label", defaultMessage: "Method" }),
|
|
441
421
|
placeholder: formatMessage({
|
|
442
422
|
id: "payment-plugin.payments.paymentMethod.placeholder",
|
|
443
|
-
defaultMessage: "All
|
|
423
|
+
defaultMessage: "All Methods"
|
|
444
424
|
}),
|
|
445
425
|
value: filters.paymentMethod,
|
|
446
426
|
onChange: (value) => handleFilterChange("paymentMethod", value),
|
|
@@ -455,6 +435,7 @@ const Payments = () => {
|
|
|
455
435
|
/* @__PURE__ */ jsx(Grid.Item, { col: 2, children: /* @__PURE__ */ jsxs(
|
|
456
436
|
SingleSelect,
|
|
457
437
|
{
|
|
438
|
+
label: formatMessage({ id: "payment-plugin.payments.currency.label", defaultMessage: "Currency" }),
|
|
458
439
|
placeholder: formatMessage({
|
|
459
440
|
id: "payment-plugin.payments.currency.placeholder",
|
|
460
441
|
defaultMessage: "All Currencies"
|
|
@@ -469,33 +450,46 @@ const Payments = () => {
|
|
|
469
450
|
]
|
|
470
451
|
}
|
|
471
452
|
) }),
|
|
472
|
-
/* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(Flex, { gap: 2, children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: clearFilters, children: formatMessage({ id: "payment-plugin.payments.clearFilters", defaultMessage: "Clear" }) }) }) })
|
|
453
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(Flex, { gap: 2, alignItems: "flex-end", height: "100%", children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: clearFilters, children: formatMessage({ id: "payment-plugin.payments.clearFilters", defaultMessage: "Clear" }) }) }) })
|
|
473
454
|
] }) }) }),
|
|
474
455
|
/* @__PURE__ */ jsx(Box, { marginTop: 4, marginBottom: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage(
|
|
475
|
-
{ id: "payment-plugin.payments.results", defaultMessage: "
|
|
476
|
-
{
|
|
477
|
-
start: startIndex + 1,
|
|
478
|
-
end: Math.min(endIndex, filteredPayments.length),
|
|
479
|
-
total: filteredPayments.length
|
|
480
|
-
}
|
|
456
|
+
{ id: "payment-plugin.payments.results", defaultMessage: "{total} payments" },
|
|
457
|
+
{ total: totalCount }
|
|
481
458
|
) }) }),
|
|
482
459
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(
|
|
483
460
|
PaymentList,
|
|
484
461
|
{
|
|
485
|
-
payments
|
|
462
|
+
payments,
|
|
486
463
|
onPaymentClick: (payment) => handleViewDetails(payment),
|
|
487
464
|
onRefund: (payment) => handleRefund(payment),
|
|
488
465
|
onViewDetails: (payment) => handleViewDetails(payment)
|
|
489
466
|
}
|
|
490
467
|
) }),
|
|
491
|
-
totalPages > 1 && /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
468
|
+
totalPages > 1 && /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxs(Pagination, { activePage: currentPage, pageCount: totalPages, label: "Payments pagination", children: [
|
|
469
|
+
/* @__PURE__ */ jsx(
|
|
470
|
+
PreviousLink,
|
|
471
|
+
{
|
|
472
|
+
as: "button",
|
|
473
|
+
onClick: () => setCurrentPage((p) => Math.max(1, p - 1))
|
|
474
|
+
}
|
|
475
|
+
),
|
|
476
|
+
Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ jsx(
|
|
477
|
+
PageLink,
|
|
478
|
+
{
|
|
479
|
+
number: page,
|
|
480
|
+
as: "button",
|
|
481
|
+
onClick: () => setCurrentPage(page)
|
|
482
|
+
},
|
|
483
|
+
page
|
|
484
|
+
)),
|
|
485
|
+
/* @__PURE__ */ jsx(
|
|
486
|
+
NextLink,
|
|
487
|
+
{
|
|
488
|
+
as: "button",
|
|
489
|
+
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1))
|
|
490
|
+
}
|
|
491
|
+
)
|
|
492
|
+
] }) }) }),
|
|
499
493
|
showRefundModal && selectedPayment && /* @__PURE__ */ jsx(
|
|
500
494
|
RefundModal,
|
|
501
495
|
{
|