@reeboot/strapi-payment-plugin 0.0.3 → 0.0.5
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/_chunks/{Analytics-nBSdLT2v.js → Analytics-CLjtRWYA.js} +68 -51
- package/dist/_chunks/{Analytics-DSJqY9ng.mjs → Analytics-CQmAVKsq.mjs} +68 -51
- package/dist/_chunks/App-DXN62SV6.mjs +118 -0
- package/dist/_chunks/App-Dk7XtjNA.js +120 -0
- package/dist/_chunks/{Customers-BpFzfglV.js → Customers-BNDi4QBH.js} +113 -51
- package/dist/_chunks/{Customers-C6FH7-zG.mjs → Customers-BQzVBQDT.mjs} +114 -52
- package/dist/_chunks/Dashboard-CuHC-dit.mjs +311 -0
- package/dist/_chunks/Dashboard-UUwohHZa.js +311 -0
- package/dist/_chunks/{Orders-CBkT2YfP.mjs → Orders-65mNfu2i.mjs} +140 -80
- package/dist/_chunks/{Orders-OG-pwV-B.js → Orders-CitNCdWE.js} +139 -79
- package/dist/_chunks/PaymentList-B0CAzInT.mjs +137 -0
- package/dist/_chunks/PaymentList-Dy1BAFoD.js +136 -0
- package/dist/_chunks/{Payments-DSDJ-HWm.mjs → Payments-FnhoV_2B.mjs} +175 -136
- package/dist/_chunks/{Payments-BLen1P9N.js → Payments-TOnygGIW.js} +173 -134
- package/dist/_chunks/Settings-BJtDagUs.js +644 -0
- package/dist/_chunks/Settings-EoLSuZLe.mjs +644 -0
- package/dist/_chunks/{index-DS_PYNkf.mjs → index-2Zd_T7bD.mjs} +1 -1
- package/dist/_chunks/{index-BqqrpI6D.js → index-CHEgJ7e5.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/CustomerList.d.ts +1 -13
- package/dist/admin/src/components/IntegrationModal.d.ts +7 -0
- package/dist/admin/src/components/OrderList.d.ts +1 -19
- package/dist/admin/src/components/PaymentCard.d.ts +2 -33
- package/dist/admin/src/components/PaymentList.d.ts +3 -11
- package/dist/admin/src/components/RefundModal.d.ts +2 -8
- package/dist/admin/src/types/index.d.ts +47 -0
- package/dist/server/index.js +198 -92
- package/dist/server/index.mjs +198 -92
- package/dist/server/src/content-types/index.d.ts +9 -2
- package/dist/server/src/content-types/order/index.d.ts +8 -1
- package/dist/server/src/content-types/payment/index.d.ts +1 -1
- package/dist/server/src/index.d.ts +9 -2
- package/dist/server/src/types/api.d.ts +31 -0
- package/dist/server/src/types/customer.d.ts +2 -0
- package/dist/server/src/types/index.d.ts +4 -179
- package/dist/server/src/types/order.d.ts +2 -0
- package/dist/server/src/types/payment.d.ts +2 -0
- package/package.json +8 -7
- package/dist/_chunks/App-B83DZ9NG.js +0 -70
- package/dist/_chunks/App-BUSTbkyy.mjs +0 -68
- package/dist/_chunks/Dashboard-CNMTzSyc.js +0 -180
- package/dist/_chunks/Dashboard-Dbwl0ZBo.mjs +0 -180
- package/dist/_chunks/Settings-Dq1xy32B.js +0 -357
- package/dist/_chunks/Settings-jmGslDsB.mjs +0 -357
- package/dist/admin/src/pages/HomePage.d.ts +0 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography, Table, Thead, Tr, Th, Tbody, Td, Flex, Button, Badge } from "@strapi/design-system";
|
|
3
|
+
import { Eye, ArrowClockwise } from "@strapi/icons";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
const PaymentList = ({
|
|
6
|
+
payments,
|
|
7
|
+
onPaymentClick,
|
|
8
|
+
onRefund,
|
|
9
|
+
onViewDetails,
|
|
10
|
+
compact = false
|
|
11
|
+
}) => {
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
console.log("Payments:", payments);
|
|
14
|
+
const formatCurrency = (amount, currency = "usd") => {
|
|
15
|
+
return new Intl.NumberFormat("en-US", {
|
|
16
|
+
style: "currency",
|
|
17
|
+
currency: currency.toUpperCase()
|
|
18
|
+
}).format(amount);
|
|
19
|
+
};
|
|
20
|
+
const formatDate = (dateString) => {
|
|
21
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
22
|
+
year: "numeric",
|
|
23
|
+
month: "short",
|
|
24
|
+
day: "numeric"
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const getStatusBadge = (status) => {
|
|
28
|
+
const statusConfig = {
|
|
29
|
+
succeeded: { color: "success", label: "Success" },
|
|
30
|
+
pending: { color: "warning", label: "Pending" },
|
|
31
|
+
failed: { color: "danger", label: "Failed" },
|
|
32
|
+
refunded: { color: "info", label: "Refunded" },
|
|
33
|
+
canceled: { color: "neutral", label: "Canceled" }
|
|
34
|
+
};
|
|
35
|
+
const config = statusConfig[status] || statusConfig.pending;
|
|
36
|
+
return /* @__PURE__ */ jsx(Badge, { size: compact ? "S" : "M", backgroundColor: config.color, children: config.label });
|
|
37
|
+
};
|
|
38
|
+
const handlePaymentClick = (payment) => {
|
|
39
|
+
if (onPaymentClick) {
|
|
40
|
+
onPaymentClick(payment);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
if (payments.length === 0) {
|
|
44
|
+
return /* @__PURE__ */ jsx(Box, { padding: 4, textAlign: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.paymentList.empty", defaultMessage: "No payments found" }) }) });
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsxs(Table, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.customer", defaultMessage: "Customer" }) }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.amount", defaultMessage: "Amount" }) }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.status", defaultMessage: "Status" }) }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.method", defaultMessage: "Method" }) }) }),
|
|
52
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.date", defaultMessage: "Date" }) }) }),
|
|
53
|
+
!compact && /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "delta", children: formatMessage({ id: "payment-plugin.paymentList.actions", defaultMessage: "Actions" }) }) })
|
|
54
|
+
] }) }),
|
|
55
|
+
/* @__PURE__ */ jsx(Tbody, { children: payments.map((payment) => /* @__PURE__ */ jsxs(
|
|
56
|
+
Tr,
|
|
57
|
+
{
|
|
58
|
+
onClick: () => handlePaymentClick(payment),
|
|
59
|
+
style: { cursor: onPaymentClick ? "pointer" : "default" },
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
Typography,
|
|
64
|
+
{
|
|
65
|
+
textColor: "neutral800",
|
|
66
|
+
fontWeight: compact ? "normal" : "bold",
|
|
67
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
68
|
+
children: payment.customerName || "Unknown -"
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
!compact && /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: payment.customerEmail }),
|
|
72
|
+
compact && /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", fontSize: "0.75rem", children: payment.customerEmail })
|
|
73
|
+
] }) }),
|
|
74
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
75
|
+
Typography,
|
|
76
|
+
{
|
|
77
|
+
textColor: "neutral800",
|
|
78
|
+
fontWeight: "bold",
|
|
79
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
80
|
+
children: formatCurrency(payment.amount, payment.currency)
|
|
81
|
+
}
|
|
82
|
+
) }),
|
|
83
|
+
/* @__PURE__ */ jsx(Td, { children: getStatusBadge(payment.payment_status) }),
|
|
84
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
85
|
+
Typography,
|
|
86
|
+
{
|
|
87
|
+
textColor: "neutral600",
|
|
88
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
89
|
+
children: formatMessage({
|
|
90
|
+
id: `payment-plugin.paymentList.${payment.payment_method}`,
|
|
91
|
+
defaultMessage: payment.payment_method
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
) }),
|
|
95
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
96
|
+
Typography,
|
|
97
|
+
{
|
|
98
|
+
textColor: "neutral600",
|
|
99
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
100
|
+
children: formatDate(payment.createdAt)
|
|
101
|
+
}
|
|
102
|
+
) }),
|
|
103
|
+
!compact && /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
Button,
|
|
106
|
+
{
|
|
107
|
+
onClick: (e) => {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
if (onViewDetails) onViewDetails(payment);
|
|
110
|
+
},
|
|
111
|
+
variant: "ghost",
|
|
112
|
+
startIcon: /* @__PURE__ */ jsx(Eye, {}),
|
|
113
|
+
children: formatMessage({ id: "payment-plugin.paymentList.view", defaultMessage: "View" })
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
payment.payment_status === "succeeded" && /* @__PURE__ */ jsx(
|
|
117
|
+
Button,
|
|
118
|
+
{
|
|
119
|
+
onClick: (e) => {
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
if (onRefund) onRefund(payment);
|
|
122
|
+
},
|
|
123
|
+
variant: "ghost",
|
|
124
|
+
startIcon: /* @__PURE__ */ jsx(ArrowClockwise, {}),
|
|
125
|
+
children: formatMessage({ id: "payment-plugin.paymentList.refund", defaultMessage: "Refund" })
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] }) })
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
payment.id
|
|
132
|
+
)) })
|
|
133
|
+
] });
|
|
134
|
+
};
|
|
135
|
+
export {
|
|
136
|
+
PaymentList as P
|
|
137
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const designSystem = require("@strapi/design-system");
|
|
4
|
+
const icons = require("@strapi/icons");
|
|
5
|
+
const reactIntl = require("react-intl");
|
|
6
|
+
const PaymentList = ({
|
|
7
|
+
payments,
|
|
8
|
+
onPaymentClick,
|
|
9
|
+
onRefund,
|
|
10
|
+
onViewDetails,
|
|
11
|
+
compact = false
|
|
12
|
+
}) => {
|
|
13
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
14
|
+
console.log("Payments:", payments);
|
|
15
|
+
const formatCurrency = (amount, currency = "usd") => {
|
|
16
|
+
return new Intl.NumberFormat("en-US", {
|
|
17
|
+
style: "currency",
|
|
18
|
+
currency: currency.toUpperCase()
|
|
19
|
+
}).format(amount);
|
|
20
|
+
};
|
|
21
|
+
const formatDate = (dateString) => {
|
|
22
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
23
|
+
year: "numeric",
|
|
24
|
+
month: "short",
|
|
25
|
+
day: "numeric"
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const getStatusBadge = (status) => {
|
|
29
|
+
const statusConfig = {
|
|
30
|
+
succeeded: { color: "success", label: "Success" },
|
|
31
|
+
pending: { color: "warning", label: "Pending" },
|
|
32
|
+
failed: { color: "danger", label: "Failed" },
|
|
33
|
+
refunded: { color: "info", label: "Refunded" },
|
|
34
|
+
canceled: { color: "neutral", label: "Canceled" }
|
|
35
|
+
};
|
|
36
|
+
const config = statusConfig[status] || statusConfig.pending;
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { size: compact ? "S" : "M", backgroundColor: config.color, children: config.label });
|
|
38
|
+
};
|
|
39
|
+
const handlePaymentClick = (payment) => {
|
|
40
|
+
if (onPaymentClick) {
|
|
41
|
+
onPaymentClick(payment);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
if (payments.length === 0) {
|
|
45
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, textAlign: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.paymentList.empty", defaultMessage: "No payments found" }) }) });
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { children: [
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.customer", defaultMessage: "Customer" }) }) }),
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.amount", defaultMessage: "Amount" }) }) }),
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.status", defaultMessage: "Status" }) }) }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.method", defaultMessage: "Method" }) }) }),
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.paymentList.date", defaultMessage: "Date" }) }) }),
|
|
54
|
+
!compact && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", children: formatMessage({ id: "payment-plugin.paymentList.actions", defaultMessage: "Actions" }) }) })
|
|
55
|
+
] }) }),
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: payments.map((payment) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
57
|
+
designSystem.Tr,
|
|
58
|
+
{
|
|
59
|
+
onClick: () => handlePaymentClick(payment),
|
|
60
|
+
style: { cursor: onPaymentClick ? "pointer" : "default" },
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
designSystem.Typography,
|
|
65
|
+
{
|
|
66
|
+
textColor: "neutral800",
|
|
67
|
+
fontWeight: compact ? "normal" : "bold",
|
|
68
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
69
|
+
children: payment.customerName || "Unknown -"
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
!compact && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: payment.customerEmail }),
|
|
73
|
+
compact && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", fontSize: "0.75rem", children: payment.customerEmail })
|
|
74
|
+
] }) }),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
76
|
+
designSystem.Typography,
|
|
77
|
+
{
|
|
78
|
+
textColor: "neutral800",
|
|
79
|
+
fontWeight: "bold",
|
|
80
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
81
|
+
children: formatCurrency(payment.amount, payment.currency)
|
|
82
|
+
}
|
|
83
|
+
) }),
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getStatusBadge(payment.payment_status) }),
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
|
+
designSystem.Typography,
|
|
87
|
+
{
|
|
88
|
+
textColor: "neutral600",
|
|
89
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
90
|
+
children: formatMessage({
|
|
91
|
+
id: `payment-plugin.paymentList.${payment.payment_method}`,
|
|
92
|
+
defaultMessage: payment.payment_method
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
) }),
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
+
designSystem.Typography,
|
|
98
|
+
{
|
|
99
|
+
textColor: "neutral600",
|
|
100
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
101
|
+
children: formatDate(payment.createdAt)
|
|
102
|
+
}
|
|
103
|
+
) }),
|
|
104
|
+
!compact && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
designSystem.Button,
|
|
107
|
+
{
|
|
108
|
+
onClick: (e) => {
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
if (onViewDetails) onViewDetails(payment);
|
|
111
|
+
},
|
|
112
|
+
variant: "ghost",
|
|
113
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, {}),
|
|
114
|
+
children: formatMessage({ id: "payment-plugin.paymentList.view", defaultMessage: "View" })
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
payment.payment_status === "succeeded" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
designSystem.Button,
|
|
119
|
+
{
|
|
120
|
+
onClick: (e) => {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
if (onRefund) onRefund(payment);
|
|
123
|
+
},
|
|
124
|
+
variant: "ghost",
|
|
125
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
|
|
126
|
+
children: formatMessage({ id: "payment-plugin.paymentList.refund", defaultMessage: "Refund" })
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }) })
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
payment.id
|
|
133
|
+
)) })
|
|
134
|
+
] });
|
|
135
|
+
};
|
|
136
|
+
exports.PaymentList = PaymentList;
|