@reeboot/strapi-payment-plugin 0.0.4 → 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 +197 -91
- package/dist/server/index.mjs +197 -91
- 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,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const reactRouterDom = require("react-router-dom");
|
|
6
|
+
const reactIntl = require("react-intl");
|
|
7
|
+
const designSystem = require("@strapi/design-system");
|
|
8
|
+
const admin = require("@strapi/strapi/admin");
|
|
9
|
+
const index = require("./index-CHEgJ7e5.js");
|
|
10
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
11
|
+
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
12
|
+
const Dashboard = React__default.default.lazy(() => Promise.resolve().then(() => require("./Dashboard-UUwohHZa.js")).then((m) => ({ default: m.Dashboard })));
|
|
13
|
+
const Payments = React__default.default.lazy(() => Promise.resolve().then(() => require("./Payments-TOnygGIW.js")).then((m) => ({ default: m.Payments })));
|
|
14
|
+
const Orders = React__default.default.lazy(() => Promise.resolve().then(() => require("./Orders-CitNCdWE.js")).then((m) => ({ default: m.Orders })));
|
|
15
|
+
const Customers = React__default.default.lazy(() => Promise.resolve().then(() => require("./Customers-BNDi4QBH.js")).then((m) => ({ default: m.Customers })));
|
|
16
|
+
const Analytics = React__default.default.lazy(() => Promise.resolve().then(() => require("./Analytics-CLjtRWYA.js")).then((m) => ({ default: m.Analytics })));
|
|
17
|
+
const Settings = React__default.default.lazy(() => Promise.resolve().then(() => require("./Settings-BJtDagUs.js")).then((m) => ({ default: m.Settings })));
|
|
18
|
+
const App = () => {
|
|
19
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
20
|
+
const [searchValue, setSearchValue] = React.useState("");
|
|
21
|
+
const managementLinks = [
|
|
22
|
+
{
|
|
23
|
+
to: `/plugins/${index.PLUGIN_ID}/dashboard`,
|
|
24
|
+
label: formatMessage({ id: "payment-plugin.dashboard.title", defaultMessage: "Dashboard" })
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
to: `/plugins/${index.PLUGIN_ID}/payments`,
|
|
28
|
+
label: formatMessage({ id: "payment-plugin.payments.title", defaultMessage: "Payments" })
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
to: `/plugins/${index.PLUGIN_ID}/orders`,
|
|
32
|
+
label: formatMessage({ id: "payment-plugin.orders.title", defaultMessage: "Orders" })
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
to: `/plugins/${index.PLUGIN_ID}/customers`,
|
|
36
|
+
label: formatMessage({ id: "payment-plugin.customers.title", defaultMessage: "Customers" })
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
const insightLinks = [
|
|
40
|
+
{
|
|
41
|
+
to: `/plugins/${index.PLUGIN_ID}/analytics`,
|
|
42
|
+
label: formatMessage({ id: "payment-plugin.analytics.title", defaultMessage: "Analytics" })
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
const configLinks = [
|
|
46
|
+
{
|
|
47
|
+
to: `/plugins/${index.PLUGIN_ID}/settings`,
|
|
48
|
+
label: formatMessage({ id: "payment-plugin.settings.title", defaultMessage: "Settings" })
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
const filterLinks = (links) => {
|
|
52
|
+
return links.filter(
|
|
53
|
+
(link) => link.label.toLowerCase().includes(searchValue.toLowerCase())
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
const filteredManagementLinks = filterLinks(managementLinks);
|
|
57
|
+
const filteredInsightLinks = filterLinks(insightLinks);
|
|
58
|
+
const filteredConfigLinks = filterLinks(configLinks);
|
|
59
|
+
const pluginName = formatMessage({
|
|
60
|
+
id: "payment-plugin.plugin.name",
|
|
61
|
+
defaultMessage: "Payment Plugin"
|
|
62
|
+
});
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", children: [
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsxs(admin.SubNav.Main, { "aria-label": formatMessage({ id: "payment-plugin.nav.aria", defaultMessage: "Payment navigation" }), children: [
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsx(admin.SubNav.Header, { label: pluginName }),
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { background: "neutral150" }),
|
|
67
|
+
/* @__PURE__ */ jsxRuntime.jsxs(admin.SubNav.Content, { children: [
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
designSystem.Searchbar,
|
|
70
|
+
{
|
|
71
|
+
name: "searchbar",
|
|
72
|
+
onClear: () => setSearchValue(""),
|
|
73
|
+
value: searchValue,
|
|
74
|
+
onChange: (e) => setSearchValue(e.target.value),
|
|
75
|
+
clearLabel: formatMessage({ id: "clearLabel", defaultMessage: "Clear" }),
|
|
76
|
+
placeholder: formatMessage({ id: "payment-plugin.nav.search.placeholder", defaultMessage: "Search..." }),
|
|
77
|
+
size: "S",
|
|
78
|
+
children: formatMessage({ id: "payment-plugin.nav.search.placeholder", defaultMessage: "Search..." })
|
|
79
|
+
}
|
|
80
|
+
) }),
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsxs(admin.SubNav.Sections, { children: [
|
|
82
|
+
filteredManagementLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(admin.SubNav.Section, { label: formatMessage({ id: "payment-plugin.nav.management", defaultMessage: "Management" }), children: filteredManagementLinks.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
+
admin.SubNav.Link,
|
|
84
|
+
{
|
|
85
|
+
to: link.to,
|
|
86
|
+
label: link.label
|
|
87
|
+
},
|
|
88
|
+
link.to
|
|
89
|
+
)) }),
|
|
90
|
+
filteredInsightLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(admin.SubNav.Section, { label: formatMessage({ id: "payment-plugin.nav.insights", defaultMessage: "Insights" }), children: filteredInsightLinks.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
admin.SubNav.Link,
|
|
92
|
+
{
|
|
93
|
+
to: link.to,
|
|
94
|
+
label: link.label
|
|
95
|
+
},
|
|
96
|
+
link.to
|
|
97
|
+
)) }),
|
|
98
|
+
filteredConfigLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(admin.SubNav.Section, { label: formatMessage({ id: "payment-plugin.nav.configuration", defaultMessage: "Configuration" }), children: filteredConfigLinks.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
+
admin.SubNav.Link,
|
|
100
|
+
{
|
|
101
|
+
to: link.to,
|
|
102
|
+
label: link.label
|
|
103
|
+
},
|
|
104
|
+
link.to
|
|
105
|
+
)) })
|
|
106
|
+
] })
|
|
107
|
+
] })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { flex: "1", padding: 5, children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }), children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "dashboard", element: /* @__PURE__ */ jsxRuntime.jsx(Dashboard, {}) }),
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "payments", element: /* @__PURE__ */ jsxRuntime.jsx(Payments, {}) }),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "orders", element: /* @__PURE__ */ jsxRuntime.jsx(Orders, {}) }),
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "customers", element: /* @__PURE__ */ jsxRuntime.jsx(Customers, {}) }),
|
|
114
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "analytics", element: /* @__PURE__ */ jsxRuntime.jsx(Analytics, {}) }),
|
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "settings", element: /* @__PURE__ */ jsxRuntime.jsx(Settings, {}) }),
|
|
116
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "dashboard", replace: true }) })
|
|
117
|
+
] }) }) })
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
exports.App = App;
|
|
@@ -5,7 +5,98 @@ const React = require("react");
|
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
|
6
6
|
const reactIntl = require("react-intl");
|
|
7
7
|
const admin = require("@strapi/strapi/admin");
|
|
8
|
-
const index = require("./index-
|
|
8
|
+
const index = require("./index-CHEgJ7e5.js");
|
|
9
|
+
const CustomerList = ({ customers, onCustomerClick, compact = false }) => {
|
|
10
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
11
|
+
const formatCurrency = (amount, currency = "usd") => {
|
|
12
|
+
return new Intl.NumberFormat("en-US", {
|
|
13
|
+
style: "currency",
|
|
14
|
+
currency: currency.toUpperCase()
|
|
15
|
+
}).format(amount);
|
|
16
|
+
};
|
|
17
|
+
const formatDate = (dateString) => {
|
|
18
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
19
|
+
year: "numeric",
|
|
20
|
+
month: "short",
|
|
21
|
+
day: "numeric"
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const getCustomerStatusBadge = (isActive) => {
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { size: compact ? "S" : "M", backgroundColor: isActive ? "success" : "neutral", children: isActive ? "Active" : "Inactive" });
|
|
26
|
+
};
|
|
27
|
+
const getCustomerName = (customer) => {
|
|
28
|
+
if (customer.first_name && customer.last_name) {
|
|
29
|
+
return `${customer.first_name} ${customer.last_name}`;
|
|
30
|
+
}
|
|
31
|
+
return customer.email;
|
|
32
|
+
};
|
|
33
|
+
const handleCustomerClick = (customer) => {
|
|
34
|
+
if (onCustomerClick) {
|
|
35
|
+
onCustomerClick(customer);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (customers.length === 0) {
|
|
39
|
+
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.customerList.empty", defaultMessage: "No customers found" }) }) });
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.customer", defaultMessage: "Customer" }) }) }),
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.totalSpent", defaultMessage: "Total Spent" }) }) }),
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.payments", defaultMessage: "Payments" }) }) }),
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.lastPayment", defaultMessage: "Last Payment" }) }) }),
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.status", defaultMessage: "Status" }) }) })
|
|
48
|
+
] }) }),
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: customers.map((customer) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
50
|
+
designSystem.Tr,
|
|
51
|
+
{
|
|
52
|
+
onClick: () => handleCustomerClick(customer),
|
|
53
|
+
style: { cursor: onCustomerClick ? "pointer" : "default" },
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, children: [
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
designSystem.Typography,
|
|
58
|
+
{
|
|
59
|
+
textColor: "neutral800",
|
|
60
|
+
fontWeight: compact ? "normal" : "bold",
|
|
61
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
62
|
+
children: getCustomerName(customer)
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", fontFamily: "monospace", fontSize: "0.75rem", children: customer.stripe_customer_id }),
|
|
66
|
+
!compact && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: customer.email })
|
|
67
|
+
] }) }),
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
designSystem.Typography,
|
|
70
|
+
{
|
|
71
|
+
textColor: "neutral800",
|
|
72
|
+
fontWeight: "bold",
|
|
73
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
74
|
+
children: formatCurrency(customer.totalSpent, customer.currency)
|
|
75
|
+
}
|
|
76
|
+
) }),
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
designSystem.Typography,
|
|
79
|
+
{
|
|
80
|
+
textColor: "neutral600",
|
|
81
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
82
|
+
children: customer.paymentCount
|
|
83
|
+
}
|
|
84
|
+
) }),
|
|
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: customer.lastPaymentDate ? formatDate(customer.lastPaymentDate) : "Never"
|
|
91
|
+
}
|
|
92
|
+
) }),
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getCustomerStatusBadge(customer.isActive) })
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
customer.id
|
|
97
|
+
)) })
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
9
100
|
const Customers = () => {
|
|
10
101
|
const { formatMessage } = reactIntl.useIntl();
|
|
11
102
|
const { get } = admin.useFetchClient();
|
|
@@ -39,12 +130,8 @@ const Customers = () => {
|
|
|
39
130
|
const { data } = await get(`/${index.PLUGIN_ID}/admin/customers?${queryParams}`);
|
|
40
131
|
if (data.success && data.data) {
|
|
41
132
|
const formattedCustomers = data.data.map((c) => ({
|
|
133
|
+
...c,
|
|
42
134
|
id: c.documentId,
|
|
43
|
-
stripeCustomerId: c.stripe_customer_id,
|
|
44
|
-
email: c.email,
|
|
45
|
-
firstName: c.firstName,
|
|
46
|
-
lastName: c.lastName,
|
|
47
|
-
phone: c.phone,
|
|
48
135
|
totalSpent: c.totalSpent || 0,
|
|
49
136
|
currency: "usd",
|
|
50
137
|
paymentCount: c.paymentCount || 0,
|
|
@@ -66,7 +153,7 @@ const Customers = () => {
|
|
|
66
153
|
if (filters.search) {
|
|
67
154
|
const searchLower = filters.search.toLowerCase();
|
|
68
155
|
filtered = filtered.filter(
|
|
69
|
-
(customer) => customer.email.toLowerCase().includes(searchLower) || `${customer.
|
|
156
|
+
(customer) => customer.email.toLowerCase().includes(searchLower) || `${customer.first_name} ${customer.last_name}`.toLowerCase().includes(searchLower) || customer.stripe_customer_id && customer.stripe_customer_id.toLowerCase().includes(searchLower)
|
|
70
157
|
);
|
|
71
158
|
}
|
|
72
159
|
if (filters.isActive) {
|
|
@@ -90,11 +177,8 @@ const Customers = () => {
|
|
|
90
177
|
}
|
|
91
178
|
setFilteredCustomers(filtered);
|
|
92
179
|
};
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
style: "currency",
|
|
96
|
-
currency: currency.toUpperCase()
|
|
97
|
-
}).format(amount);
|
|
180
|
+
const handleCustomerClick = (customer) => {
|
|
181
|
+
console.log("Clicked customer:", customer);
|
|
98
182
|
};
|
|
99
183
|
const formatDate = (dateString) => {
|
|
100
184
|
try {
|
|
@@ -107,9 +191,6 @@ const Customers = () => {
|
|
|
107
191
|
return "Invalid Date";
|
|
108
192
|
}
|
|
109
193
|
};
|
|
110
|
-
const getCustomerStatusBadge = (isActive) => {
|
|
111
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { size: "S", backgroundColor: isActive ? "success" : "neutral", children: isActive ? "Active" : "Inactive" });
|
|
112
|
-
};
|
|
113
194
|
const handleFilterChange = (key, value) => {
|
|
114
195
|
setFilters((prev) => ({ ...prev, [key]: value }));
|
|
115
196
|
setCurrentPage(1);
|
|
@@ -127,15 +208,15 @@ const Customers = () => {
|
|
|
127
208
|
const csvContent = [
|
|
128
209
|
["Customer ID", "Email", "First Name", "Last Name", "Total Spent", "Payment Count", "Last Payment", "Status", "Registration Date"],
|
|
129
210
|
...filteredCustomers.map((customer) => [
|
|
130
|
-
customer.
|
|
211
|
+
customer.stripe_customer_id || "",
|
|
131
212
|
customer.email,
|
|
132
|
-
customer.
|
|
133
|
-
customer.
|
|
134
|
-
(customer.totalSpent / 100).toString(),
|
|
135
|
-
customer.paymentCount.toString(),
|
|
213
|
+
customer.first_name || "",
|
|
214
|
+
customer.last_name || "",
|
|
215
|
+
(customer.totalSpent || 0 / 100).toString(),
|
|
216
|
+
(customer.paymentCount || 0).toString(),
|
|
136
217
|
customer.lastPaymentDate ? formatDate(customer.lastPaymentDate) : "Never",
|
|
137
218
|
customer.isActive ? "Active" : "Inactive",
|
|
138
|
-
formatDate(customer.registrationDate)
|
|
219
|
+
customer.registrationDate ? formatDate(customer.registrationDate) : ""
|
|
139
220
|
])
|
|
140
221
|
].map((row) => row.join(",")).join("\n");
|
|
141
222
|
const blob = new Blob([csvContent], { type: "text/csv" });
|
|
@@ -151,10 +232,10 @@ const Customers = () => {
|
|
|
151
232
|
const paginatedCustomers = filteredCustomers.slice(startIndex, endIndex);
|
|
152
233
|
const totalPages = Math.ceil(filteredCustomers.length / pageSize);
|
|
153
234
|
if (loading && customers.length === 0) {
|
|
154
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, {
|
|
235
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }) });
|
|
155
236
|
}
|
|
156
237
|
if (error) {
|
|
157
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, {
|
|
238
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
158
239
|
designSystem.EmptyStateLayout,
|
|
159
240
|
{
|
|
160
241
|
title: "Error loading customers",
|
|
@@ -163,7 +244,7 @@ const Customers = () => {
|
|
|
163
244
|
}
|
|
164
245
|
) });
|
|
165
246
|
}
|
|
166
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, {
|
|
247
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
167
248
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
168
249
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
169
250
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.customers.title", defaultMessage: "Customers" }) }),
|
|
@@ -174,7 +255,7 @@ const Customers = () => {
|
|
|
174
255
|
] }),
|
|
175
256
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
176
257
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: exportCustomers, children: formatMessage({ id: "payment-plugin.customers.export", defaultMessage: "Export" }) }),
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick:
|
|
258
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: fetchCustomers, children: formatMessage({ id: "payment-plugin.customers.refresh", defaultMessage: "Refresh" }) })
|
|
178
259
|
] })
|
|
179
260
|
] }) }),
|
|
180
261
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
|
|
@@ -234,32 +315,13 @@ const Customers = () => {
|
|
|
234
315
|
total: filteredCustomers.length
|
|
235
316
|
}
|
|
236
317
|
) }) }),
|
|
237
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.customers.status", defaultMessage: "Status" }) }) }),
|
|
245
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.customers.registration", defaultMessage: "Registered" }) }) })
|
|
246
|
-
] }) }),
|
|
247
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: paginatedCustomers.map((customer) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
248
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
249
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: customer.firstName && customer.lastName ? `${customer.firstName} ${customer.lastName}` : customer.email }),
|
|
250
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", fontFamily: "monospace", children: customer.stripeCustomerId })
|
|
251
|
-
] }) }),
|
|
252
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
253
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: customer.email }),
|
|
254
|
-
customer.phone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: customer.phone })
|
|
255
|
-
] }) }),
|
|
256
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(customer.totalSpent, customer.currency) }) }),
|
|
257
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: customer.paymentCount }) }),
|
|
258
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: customer.lastPaymentDate ? formatDate(customer.lastPaymentDate) : "Never" }) }),
|
|
259
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getCustomerStatusBadge(customer.isActive) }),
|
|
260
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatDate(customer.registrationDate) }) })
|
|
261
|
-
] }, customer.id)) })
|
|
262
|
-
] }) }) }),
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
319
|
+
CustomerList,
|
|
320
|
+
{
|
|
321
|
+
customers: paginatedCustomers,
|
|
322
|
+
onCustomerClick: handleCustomerClick
|
|
323
|
+
}
|
|
324
|
+
) }),
|
|
263
325
|
totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
264
326
|
designSystem.Pagination,
|
|
265
327
|
{
|
|
@@ -1,9 +1,100 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import { Box,
|
|
3
|
+
import { Box, Typography, Table, Thead, Tr, Th, Tbody, Td, Flex, Badge, Loader, EmptyStateLayout, Button, Card, Grid, TextInput, SingleSelect, SingleSelectOption, Pagination } 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-
|
|
6
|
+
import { P as PLUGIN_ID } from "./index-2Zd_T7bD.mjs";
|
|
7
|
+
const CustomerList = ({ customers, onCustomerClick, compact = false }) => {
|
|
8
|
+
const { formatMessage } = useIntl();
|
|
9
|
+
const formatCurrency = (amount, currency = "usd") => {
|
|
10
|
+
return new Intl.NumberFormat("en-US", {
|
|
11
|
+
style: "currency",
|
|
12
|
+
currency: currency.toUpperCase()
|
|
13
|
+
}).format(amount);
|
|
14
|
+
};
|
|
15
|
+
const formatDate = (dateString) => {
|
|
16
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
17
|
+
year: "numeric",
|
|
18
|
+
month: "short",
|
|
19
|
+
day: "numeric"
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const getCustomerStatusBadge = (isActive) => {
|
|
23
|
+
return /* @__PURE__ */ jsx(Badge, { size: compact ? "S" : "M", backgroundColor: isActive ? "success" : "neutral", children: isActive ? "Active" : "Inactive" });
|
|
24
|
+
};
|
|
25
|
+
const getCustomerName = (customer) => {
|
|
26
|
+
if (customer.first_name && customer.last_name) {
|
|
27
|
+
return `${customer.first_name} ${customer.last_name}`;
|
|
28
|
+
}
|
|
29
|
+
return customer.email;
|
|
30
|
+
};
|
|
31
|
+
const handleCustomerClick = (customer) => {
|
|
32
|
+
if (onCustomerClick) {
|
|
33
|
+
onCustomerClick(customer);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
if (customers.length === 0) {
|
|
37
|
+
return /* @__PURE__ */ jsx(Box, { padding: 4, textAlign: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.customerList.empty", defaultMessage: "No customers found" }) }) });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsxs(Table, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.customer", defaultMessage: "Customer" }) }) }),
|
|
42
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.totalSpent", defaultMessage: "Total Spent" }) }) }),
|
|
43
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.payments", defaultMessage: "Payments" }) }) }),
|
|
44
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.lastPayment", defaultMessage: "Last Payment" }) }) }),
|
|
45
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.customerList.status", defaultMessage: "Status" }) }) })
|
|
46
|
+
] }) }),
|
|
47
|
+
/* @__PURE__ */ jsx(Tbody, { children: customers.map((customer) => /* @__PURE__ */ jsxs(
|
|
48
|
+
Tr,
|
|
49
|
+
{
|
|
50
|
+
onClick: () => handleCustomerClick(customer),
|
|
51
|
+
style: { cursor: onCustomerClick ? "pointer" : "default" },
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
Typography,
|
|
56
|
+
{
|
|
57
|
+
textColor: "neutral800",
|
|
58
|
+
fontWeight: compact ? "normal" : "bold",
|
|
59
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
60
|
+
children: getCustomerName(customer)
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", fontFamily: "monospace", fontSize: "0.75rem", children: customer.stripe_customer_id }),
|
|
64
|
+
!compact && /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: customer.email })
|
|
65
|
+
] }) }),
|
|
66
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
67
|
+
Typography,
|
|
68
|
+
{
|
|
69
|
+
textColor: "neutral800",
|
|
70
|
+
fontWeight: "bold",
|
|
71
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
72
|
+
children: formatCurrency(customer.totalSpent, customer.currency)
|
|
73
|
+
}
|
|
74
|
+
) }),
|
|
75
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
76
|
+
Typography,
|
|
77
|
+
{
|
|
78
|
+
textColor: "neutral600",
|
|
79
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
80
|
+
children: customer.paymentCount
|
|
81
|
+
}
|
|
82
|
+
) }),
|
|
83
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
84
|
+
Typography,
|
|
85
|
+
{
|
|
86
|
+
textColor: "neutral600",
|
|
87
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
88
|
+
children: customer.lastPaymentDate ? formatDate(customer.lastPaymentDate) : "Never"
|
|
89
|
+
}
|
|
90
|
+
) }),
|
|
91
|
+
/* @__PURE__ */ jsx(Td, { children: getCustomerStatusBadge(customer.isActive) })
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
customer.id
|
|
95
|
+
)) })
|
|
96
|
+
] });
|
|
97
|
+
};
|
|
7
98
|
const Customers = () => {
|
|
8
99
|
const { formatMessage } = useIntl();
|
|
9
100
|
const { get } = useFetchClient();
|
|
@@ -37,12 +128,8 @@ const Customers = () => {
|
|
|
37
128
|
const { data } = await get(`/${PLUGIN_ID}/admin/customers?${queryParams}`);
|
|
38
129
|
if (data.success && data.data) {
|
|
39
130
|
const formattedCustomers = data.data.map((c) => ({
|
|
131
|
+
...c,
|
|
40
132
|
id: c.documentId,
|
|
41
|
-
stripeCustomerId: c.stripe_customer_id,
|
|
42
|
-
email: c.email,
|
|
43
|
-
firstName: c.firstName,
|
|
44
|
-
lastName: c.lastName,
|
|
45
|
-
phone: c.phone,
|
|
46
133
|
totalSpent: c.totalSpent || 0,
|
|
47
134
|
currency: "usd",
|
|
48
135
|
paymentCount: c.paymentCount || 0,
|
|
@@ -64,7 +151,7 @@ const Customers = () => {
|
|
|
64
151
|
if (filters.search) {
|
|
65
152
|
const searchLower = filters.search.toLowerCase();
|
|
66
153
|
filtered = filtered.filter(
|
|
67
|
-
(customer) => customer.email.toLowerCase().includes(searchLower) || `${customer.
|
|
154
|
+
(customer) => customer.email.toLowerCase().includes(searchLower) || `${customer.first_name} ${customer.last_name}`.toLowerCase().includes(searchLower) || customer.stripe_customer_id && customer.stripe_customer_id.toLowerCase().includes(searchLower)
|
|
68
155
|
);
|
|
69
156
|
}
|
|
70
157
|
if (filters.isActive) {
|
|
@@ -88,11 +175,8 @@ const Customers = () => {
|
|
|
88
175
|
}
|
|
89
176
|
setFilteredCustomers(filtered);
|
|
90
177
|
};
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
style: "currency",
|
|
94
|
-
currency: currency.toUpperCase()
|
|
95
|
-
}).format(amount);
|
|
178
|
+
const handleCustomerClick = (customer) => {
|
|
179
|
+
console.log("Clicked customer:", customer);
|
|
96
180
|
};
|
|
97
181
|
const formatDate = (dateString) => {
|
|
98
182
|
try {
|
|
@@ -105,9 +189,6 @@ const Customers = () => {
|
|
|
105
189
|
return "Invalid Date";
|
|
106
190
|
}
|
|
107
191
|
};
|
|
108
|
-
const getCustomerStatusBadge = (isActive) => {
|
|
109
|
-
return /* @__PURE__ */ jsx(Badge, { size: "S", backgroundColor: isActive ? "success" : "neutral", children: isActive ? "Active" : "Inactive" });
|
|
110
|
-
};
|
|
111
192
|
const handleFilterChange = (key, value) => {
|
|
112
193
|
setFilters((prev) => ({ ...prev, [key]: value }));
|
|
113
194
|
setCurrentPage(1);
|
|
@@ -125,15 +206,15 @@ const Customers = () => {
|
|
|
125
206
|
const csvContent = [
|
|
126
207
|
["Customer ID", "Email", "First Name", "Last Name", "Total Spent", "Payment Count", "Last Payment", "Status", "Registration Date"],
|
|
127
208
|
...filteredCustomers.map((customer) => [
|
|
128
|
-
customer.
|
|
209
|
+
customer.stripe_customer_id || "",
|
|
129
210
|
customer.email,
|
|
130
|
-
customer.
|
|
131
|
-
customer.
|
|
132
|
-
(customer.totalSpent / 100).toString(),
|
|
133
|
-
customer.paymentCount.toString(),
|
|
211
|
+
customer.first_name || "",
|
|
212
|
+
customer.last_name || "",
|
|
213
|
+
(customer.totalSpent || 0 / 100).toString(),
|
|
214
|
+
(customer.paymentCount || 0).toString(),
|
|
134
215
|
customer.lastPaymentDate ? formatDate(customer.lastPaymentDate) : "Never",
|
|
135
216
|
customer.isActive ? "Active" : "Inactive",
|
|
136
|
-
formatDate(customer.registrationDate)
|
|
217
|
+
customer.registrationDate ? formatDate(customer.registrationDate) : ""
|
|
137
218
|
])
|
|
138
219
|
].map((row) => row.join(",")).join("\n");
|
|
139
220
|
const blob = new Blob([csvContent], { type: "text/csv" });
|
|
@@ -149,10 +230,10 @@ const Customers = () => {
|
|
|
149
230
|
const paginatedCustomers = filteredCustomers.slice(startIndex, endIndex);
|
|
150
231
|
const totalPages = Math.ceil(filteredCustomers.length / pageSize);
|
|
151
232
|
if (loading && customers.length === 0) {
|
|
152
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
233
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
153
234
|
}
|
|
154
235
|
if (error) {
|
|
155
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
236
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
156
237
|
EmptyStateLayout,
|
|
157
238
|
{
|
|
158
239
|
title: "Error loading customers",
|
|
@@ -161,7 +242,7 @@ const Customers = () => {
|
|
|
161
242
|
}
|
|
162
243
|
) });
|
|
163
244
|
}
|
|
164
|
-
return /* @__PURE__ */ jsxs(Box, {
|
|
245
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
165
246
|
/* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
166
247
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
167
248
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.customers.title", defaultMessage: "Customers" }) }),
|
|
@@ -172,7 +253,7 @@ const Customers = () => {
|
|
|
172
253
|
] }),
|
|
173
254
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
174
255
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: exportCustomers, children: formatMessage({ id: "payment-plugin.customers.export", defaultMessage: "Export" }) }),
|
|
175
|
-
/* @__PURE__ */ jsx(Button, { onClick:
|
|
256
|
+
/* @__PURE__ */ jsx(Button, { onClick: fetchCustomers, children: formatMessage({ id: "payment-plugin.customers.refresh", defaultMessage: "Refresh" }) })
|
|
176
257
|
] })
|
|
177
258
|
] }) }),
|
|
178
259
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
@@ -232,32 +313,13 @@ const Customers = () => {
|
|
|
232
313
|
total: filteredCustomers.length
|
|
233
314
|
}
|
|
234
315
|
) }) }),
|
|
235
|
-
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.customers.status", defaultMessage: "Status" }) }) }),
|
|
243
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.customers.registration", defaultMessage: "Registered" }) }) })
|
|
244
|
-
] }) }),
|
|
245
|
-
/* @__PURE__ */ jsx(Tbody, { children: paginatedCustomers.map((customer) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
246
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
247
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: customer.firstName && customer.lastName ? `${customer.firstName} ${customer.lastName}` : customer.email }),
|
|
248
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", fontFamily: "monospace", children: customer.stripeCustomerId })
|
|
249
|
-
] }) }),
|
|
250
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
251
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: customer.email }),
|
|
252
|
-
customer.phone && /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: customer.phone })
|
|
253
|
-
] }) }),
|
|
254
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(customer.totalSpent, customer.currency) }) }),
|
|
255
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: customer.paymentCount }) }),
|
|
256
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: customer.lastPaymentDate ? formatDate(customer.lastPaymentDate) : "Never" }) }),
|
|
257
|
-
/* @__PURE__ */ jsx(Td, { children: getCustomerStatusBadge(customer.isActive) }),
|
|
258
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatDate(customer.registrationDate) }) })
|
|
259
|
-
] }, customer.id)) })
|
|
260
|
-
] }) }) }),
|
|
316
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(
|
|
317
|
+
CustomerList,
|
|
318
|
+
{
|
|
319
|
+
customers: paginatedCustomers,
|
|
320
|
+
onCustomerClick: handleCustomerClick
|
|
321
|
+
}
|
|
322
|
+
) }),
|
|
261
323
|
totalPages > 1 && /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(
|
|
262
324
|
Pagination,
|
|
263
325
|
{
|