@reeboot/strapi-payment-plugin 0.0.1 → 0.0.3

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.
Files changed (84) hide show
  1. package/README.md +378 -119
  2. package/dist/_chunks/Analytics-DSJqY9ng.mjs +355 -0
  3. package/dist/_chunks/Analytics-nBSdLT2v.js +355 -0
  4. package/dist/_chunks/App-B83DZ9NG.js +70 -0
  5. package/dist/_chunks/App-BUSTbkyy.mjs +68 -0
  6. package/dist/_chunks/Customers-BpFzfglV.js +273 -0
  7. package/dist/_chunks/Customers-C6FH7-zG.mjs +273 -0
  8. package/dist/_chunks/Dashboard-CNMTzSyc.js +180 -0
  9. package/dist/_chunks/Dashboard-Dbwl0ZBo.mjs +180 -0
  10. package/dist/_chunks/Orders-CBkT2YfP.mjs +308 -0
  11. package/dist/_chunks/Orders-OG-pwV-B.js +308 -0
  12. package/dist/_chunks/Payments-BLen1P9N.js +489 -0
  13. package/dist/_chunks/Payments-DSDJ-HWm.mjs +489 -0
  14. package/dist/_chunks/Settings-Dq1xy32B.js +357 -0
  15. package/dist/_chunks/Settings-jmGslDsB.mjs +357 -0
  16. package/dist/_chunks/en-BJocyOVu.mjs +240 -0
  17. package/dist/_chunks/en-BkVAf_R4.js +240 -0
  18. package/dist/_chunks/index-BqqrpI6D.js +66 -0
  19. package/dist/_chunks/index-DS_PYNkf.mjs +67 -0
  20. package/dist/admin/index.js +2 -63
  21. package/dist/admin/index.mjs +2 -63
  22. package/dist/admin/src/components/AnalyticsChart.d.ts +19 -0
  23. package/dist/admin/src/components/CustomerList.d.ts +21 -0
  24. package/dist/admin/src/components/OrderList.d.ts +27 -0
  25. package/dist/admin/src/components/PaymentCard.d.ts +39 -0
  26. package/dist/admin/src/components/PaymentList.d.ts +19 -0
  27. package/dist/admin/src/components/RefundModal.d.ts +15 -0
  28. package/dist/admin/src/pages/Analytics.d.ts +2 -0
  29. package/dist/admin/src/pages/Customers.d.ts +2 -0
  30. package/dist/admin/src/pages/Dashboard.d.ts +2 -0
  31. package/dist/admin/src/pages/HomePage.d.ts +1 -1
  32. package/dist/admin/src/pages/Orders.d.ts +2 -0
  33. package/dist/admin/src/pages/Payments.d.ts +2 -0
  34. package/dist/admin/src/pages/Settings.d.ts +2 -0
  35. package/dist/admin/src/pluginId.d.ts +1 -1
  36. package/dist/server/index.js +1770 -992
  37. package/dist/server/index.mjs +1773 -995
  38. package/dist/server/src/bootstrap.d.ts +5 -11
  39. package/dist/server/src/config/index.d.ts +0 -10
  40. package/dist/server/src/content-types/customer/index.d.ts +69 -0
  41. package/dist/server/src/content-types/index.d.ts +123 -39
  42. package/dist/server/src/content-types/{product.d.ts → order/index.d.ts} +26 -19
  43. package/dist/server/src/content-types/{subscription.d.ts → payment/index.d.ts} +30 -21
  44. package/dist/server/src/controllers/controller.d.ts +5 -12
  45. package/dist/server/src/controllers/index.d.ts +29 -34
  46. package/dist/server/src/controllers/stripe.d.ts +104 -0
  47. package/dist/server/src/index.d.ts +179 -139
  48. package/dist/server/src/middlewares/index.d.ts +19 -1
  49. package/dist/server/src/policies/index.d.ts +3 -1
  50. package/dist/server/src/routes/{admin-routes.d.ts → admin/index.d.ts} +4 -4
  51. package/dist/server/src/routes/content-api/index.d.ts +21 -0
  52. package/dist/server/src/routes/index.d.ts +11 -16
  53. package/dist/server/src/services/index.d.ts +2 -38
  54. package/dist/server/src/services/{stripeDriver.d.ts → stripe.d.ts} +52 -59
  55. package/dist/server/src/types/index.d.ts +179 -0
  56. package/package.json +20 -25
  57. package/dist/_chunks/App-DD7GyuRr.mjs +0 -1424
  58. package/dist/_chunks/App-KZVBFRwo.js +0 -1424
  59. package/dist/_chunks/en-B4KWt_jN.js +0 -4
  60. package/dist/_chunks/en-Byx4XI2L.mjs +0 -4
  61. package/dist/admin/src/components/Header.d.ts +0 -2
  62. package/dist/admin/src/components/NavigationMenu.d.ts +0 -2
  63. package/dist/admin/src/components/Sidebar.d.ts +0 -2
  64. package/dist/admin/src/components/TransactionDetailsModal.d.ts +0 -18
  65. package/dist/admin/src/components/TransactionList.d.ts +0 -18
  66. package/dist/admin/src/pages/ConfigurationPage.d.ts +0 -2
  67. package/dist/admin/src/pages/DashboardPage.d.ts +0 -2
  68. package/dist/admin/src/pages/ProductsPage.d.ts +0 -2
  69. package/dist/admin/src/pages/SubscriptionsPage.d.ts +0 -2
  70. package/dist/admin/src/pages/TransactionsPage.d.ts +0 -2
  71. package/dist/server/src/controllers/product.d.ts +0 -18
  72. package/dist/server/src/controllers/subscription.d.ts +0 -16
  73. package/dist/server/src/controllers/webhook.d.ts +0 -10
  74. package/dist/server/src/routes/content-api.d.ts +0 -12
  75. package/dist/server/src/routes/product.d.ts +0 -2
  76. package/dist/server/src/routes/refund-routes.d.ts +0 -13
  77. package/dist/server/src/routes/subscription.d.ts +0 -5
  78. package/dist/server/src/routes/webhook.d.ts +0 -15
  79. package/dist/server/src/services/paypalDriver.d.ts +0 -47
  80. package/dist/server/src/services/product.d.ts +0 -7
  81. package/dist/server/src/services/service.d.ts +0 -26
  82. package/dist/server/src/services/subscription.d.ts +0 -9
  83. package/dist/server/src/services/sync.d.ts +0 -13
  84. package/jest.config.js +0 -13
@@ -0,0 +1,355 @@
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 designSystem = require("@strapi/design-system");
6
+ const reactIntl = require("react-intl");
7
+ const admin = require("@strapi/strapi/admin");
8
+ const index = require("./index-BqqrpI6D.js");
9
+ const AnalyticsChart = ({ data, currency = "usd", type }) => {
10
+ const formatCurrency = (amount) => {
11
+ return new Intl.NumberFormat("en-US", {
12
+ style: "currency",
13
+ currency: currency.toUpperCase()
14
+ }).format(amount);
15
+ };
16
+ const formatNumber = (num) => {
17
+ return new Intl.NumberFormat("en-US").format(num);
18
+ };
19
+ const renderLineChart = (trendData) => {
20
+ const maxRevenue = Math.max(...trendData.revenue);
21
+ const maxPayments = Math.max(...trendData.payments);
22
+ const maxCustomers = Math.max(...trendData.customers);
23
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
24
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 4, children: [
25
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", fontWeight: "bold", children: "Revenue Trend" }),
26
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "row", gap: 8, children: trendData.labels.map((label, index2) => {
27
+ const revenueValue = trendData.revenue[index2];
28
+ const percentage = revenueValue / maxRevenue * 100;
29
+ console.log("Revenue Value:", revenueValue, "Percentage:", percentage);
30
+ console.log("trend data:", trendData);
31
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
32
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", marginBottom: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "bold", children: formatCurrency(revenueValue) }) }),
33
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.ProgressBar, { value: percentage })
34
+ ] }, index2);
35
+ }) })
36
+ ] }) }),
37
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 4, children: [
38
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", fontWeight: "bold", children: "Payments Trend" }),
39
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 2, children: trendData.labels.map((label, index2) => {
40
+ const paymentsValue = trendData.payments[index2];
41
+ const percentage = paymentsValue / maxPayments * 100;
42
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
43
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", marginBottom: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "bold", children: formatNumber(paymentsValue) }) }),
44
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.ProgressBar, { value: percentage })
45
+ ] }, index2);
46
+ }) })
47
+ ] }) }),
48
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 4, children: [
49
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", fontWeight: "bold", children: "Customer Growth" }),
50
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 2, children: trendData.labels.map((label, index2) => {
51
+ const customersValue = trendData.customers[index2];
52
+ const percentage = customersValue / maxCustomers * 100;
53
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
54
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", marginBottom: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "bold", children: formatNumber(customersValue) }) }),
55
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.ProgressBar, { value: percentage })
56
+ ] }, index2);
57
+ }) })
58
+ ] }) })
59
+ ] }) });
60
+ };
61
+ const renderPieChart = (paymentData) => {
62
+ const colors = ["#4945FF", "#0F9D58", "#FF6B35", "#9C27B0", "#FF9800"];
63
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 3, children: paymentData.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
64
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 2, children: [
65
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
66
+ /* @__PURE__ */ jsxRuntime.jsx(
67
+ designSystem.Box,
68
+ {
69
+ style: {
70
+ width: "12px",
71
+ height: "12px",
72
+ backgroundColor: colors[index2 % colors.length],
73
+ borderRadius: "50%"
74
+ }
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "bold", children: item.method })
78
+ ] }),
79
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: [
80
+ item.percentage,
81
+ "%"
82
+ ] })
83
+ ] }),
84
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.ProgressBar, { value: item.percentage }),
85
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", marginTop: 1, children: [
86
+ formatNumber(item.count),
87
+ " transactions"
88
+ ] })
89
+ ] }, index2)) }) });
90
+ };
91
+ const renderBarChart = (chartData) => {
92
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: "Bar chart visualization coming soon..." }) });
93
+ };
94
+ const renderChart = () => {
95
+ switch (type) {
96
+ case "line":
97
+ return renderLineChart(data);
98
+ case "pie":
99
+ return renderPieChart(data);
100
+ case "bar":
101
+ return renderBarChart();
102
+ default:
103
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "danger500", children: "Invalid chart type" });
104
+ }
105
+ };
106
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: renderChart() });
107
+ };
108
+ const Analytics = () => {
109
+ const { formatMessage } = reactIntl.useIntl();
110
+ const { get } = admin.useFetchClient();
111
+ const [analyticsData, setAnalyticsData] = React.useState(null);
112
+ const [loading, setLoading] = React.useState(true);
113
+ const [error, setError] = React.useState(null);
114
+ const [dateRange, setDateRange] = React.useState("30d");
115
+ const [currency, setCurrency] = React.useState("usd");
116
+ React.useEffect(() => {
117
+ fetchAnalyticsData();
118
+ }, [dateRange, currency]);
119
+ const fetchAnalyticsData = async () => {
120
+ try {
121
+ setLoading(true);
122
+ const { data } = await get(`/${index.PLUGIN_ID}/admin/analytics?period=${dateRange}`);
123
+ if (data.success && data.data) {
124
+ const dailyStats = data.data.dailyStats || {};
125
+ const labels = Object.keys(dailyStats).sort();
126
+ const revenue = labels.map((label) => dailyStats[label].amount);
127
+ const payments = labels.map((label) => dailyStats[label].count);
128
+ setAnalyticsData({
129
+ revenue: {
130
+ total: data.data.totalVolume,
131
+ growth: 0,
132
+ period: `Last ${dateRange}`
133
+ },
134
+ payments: {
135
+ total: data.data.totalTransactions,
136
+ successRate: 100,
137
+ averageAmount: data.data.averageTransaction,
138
+ period: `Last ${dateRange}`
139
+ },
140
+ customers: {
141
+ total: 0,
142
+ newCustomers: 0,
143
+ returningCustomers: 0,
144
+ period: `Last ${dateRange}`
145
+ },
146
+ trends: {
147
+ labels,
148
+ revenue,
149
+ payments,
150
+ customers: Array(labels.length).fill(0)
151
+ },
152
+ topProducts: [],
153
+ paymentMethods: [],
154
+ geographicData: []
155
+ });
156
+ }
157
+ setLoading(false);
158
+ } catch (err) {
159
+ setError("Failed to fetch analytics data");
160
+ setLoading(false);
161
+ }
162
+ };
163
+ const formatCurrency = (amount, currency2 = "usd") => {
164
+ return new Intl.NumberFormat("en-US", {
165
+ style: "currency",
166
+ currency: currency2.toUpperCase()
167
+ }).format(amount);
168
+ };
169
+ const exportReport = () => {
170
+ if (!analyticsData) return;
171
+ const csvContent = [
172
+ ["Analytics Report", (/* @__PURE__ */ new Date()).toLocaleDateString()],
173
+ [""],
174
+ ["SUMMARY"],
175
+ ["Total Revenue", formatCurrency(analyticsData.revenue.total, currency)],
176
+ ["Revenue Growth", `${analyticsData.revenue.growth}%`],
177
+ ["Total Payments", analyticsData.payments.total.toString()],
178
+ ["Success Rate", `${analyticsData.payments.successRate}%`],
179
+ ["Average Amount", formatCurrency(analyticsData.payments.averageAmount, currency)],
180
+ ["Total Customers", analyticsData.customers.total.toString()],
181
+ ["New Customers", analyticsData.customers.newCustomers.toString()],
182
+ [""],
183
+ ["TOP PRODUCTS"],
184
+ ["Product Name", "Revenue", "Quantity Sold"],
185
+ ...analyticsData.topProducts.map((product) => [
186
+ product.name,
187
+ formatCurrency(product.revenue, currency),
188
+ product.quantity.toString()
189
+ ]),
190
+ [""],
191
+ ["PAYMENT METHODS"],
192
+ ["Method", "Count", "Percentage"],
193
+ ...analyticsData.paymentMethods.map((method) => [
194
+ method.method,
195
+ method.count.toString(),
196
+ `${method.percentage}%`
197
+ ]),
198
+ [""],
199
+ ["GEOGRAPHIC DATA"],
200
+ ["Country", "Revenue", "Transactions"],
201
+ ...analyticsData.geographicData.map((geo) => [
202
+ geo.country,
203
+ formatCurrency(geo.revenue, currency),
204
+ geo.transactions.toString()
205
+ ])
206
+ ].map((row) => row.join(",")).join("\n");
207
+ const blob = new Blob([csvContent], { type: "text/csv" });
208
+ const url = window.URL.createObjectURL(blob);
209
+ const a = document.createElement("a");
210
+ a.href = url;
211
+ a.download = `payment-analytics-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
212
+ a.click();
213
+ window.URL.revokeObjectURL(url);
214
+ };
215
+ if (loading) {
216
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }) });
217
+ }
218
+ if (error) {
219
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
220
+ designSystem.EmptyStateLayout,
221
+ {
222
+ title: "Error loading analytics",
223
+ subtitle: error,
224
+ action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: fetchAnalyticsData, children: formatMessage({ id: "payment-plugin.analytics.retry", defaultMessage: "Retry" }) })
225
+ }
226
+ ) });
227
+ }
228
+ if (!analyticsData) return null;
229
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, children: [
230
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
231
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
232
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.analytics.title", defaultMessage: "Analytics" }) }),
233
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
234
+ id: "payment-plugin.analytics.subtitle",
235
+ defaultMessage: "Payment insights and performance metrics"
236
+ }) })
237
+ ] }),
238
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
239
+ /* @__PURE__ */ jsxRuntime.jsxs(
240
+ designSystem.SingleSelect,
241
+ {
242
+ value: dateRange,
243
+ onChange: (value) => setDateRange(value),
244
+ children: [
245
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "7d", children: "Last 7 days" }),
246
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "30d", children: "Last 30 days" }),
247
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "90d", children: "Last 90 days" }),
248
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "1y", children: "Last year" })
249
+ ]
250
+ }
251
+ ),
252
+ /* @__PURE__ */ jsxRuntime.jsxs(
253
+ designSystem.SingleSelect,
254
+ {
255
+ value: currency,
256
+ onChange: (value) => setCurrency(value),
257
+ children: [
258
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "usd", children: "USD" }),
259
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "eur", children: "EUR" }),
260
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "gbp", children: "GBP" })
261
+ ]
262
+ }
263
+ ),
264
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: exportReport, children: formatMessage({ id: "payment-plugin.analytics.export", defaultMessage: "Export Report" }) }),
265
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: fetchAnalyticsData, children: formatMessage({ id: "payment-plugin.analytics.refresh", defaultMessage: "Refresh" }) })
266
+ ] })
267
+ ] }) }),
268
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, marginBottom: 4, children: [
269
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
270
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.analytics.totalRevenue", defaultMessage: "Total Revenue" }) }),
271
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: formatCurrency(analyticsData.revenue.total, currency) }),
272
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
273
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { size: "S", backgroundColor: "success", children: [
274
+ "+",
275
+ analyticsData.revenue.growth,
276
+ "%"
277
+ ] }),
278
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: analyticsData.revenue.period })
279
+ ] })
280
+ ] }) }) }) }),
281
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
282
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.analytics.successRate", defaultMessage: "Success Rate" }) }),
283
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: [
284
+ analyticsData.payments.successRate,
285
+ "%"
286
+ ] }),
287
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage(
288
+ { id: "payment-plugin.analytics.outOfPayments", defaultMessage: "{total} payments" },
289
+ { total: analyticsData.payments.total }
290
+ ) })
291
+ ] }) }) }) }),
292
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
293
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.analytics.averageAmount", defaultMessage: "Average Amount" }) }),
294
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: formatCurrency(analyticsData.payments.averageAmount, currency) }),
295
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: analyticsData.payments.period })
296
+ ] }) }) }) })
297
+ ] }),
298
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, marginBottom: 4, children: [
299
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, style: { width: "100%" }, children: [
300
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.analytics.trends", defaultMessage: "Revenue Trends" }) }),
301
+ /* @__PURE__ */ jsxRuntime.jsx(
302
+ AnalyticsChart,
303
+ {
304
+ data: analyticsData.trends,
305
+ currency,
306
+ type: "line"
307
+ }
308
+ )
309
+ ] }) }) }),
310
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
311
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.analytics.paymentMethods", defaultMessage: "Payment Methods" }) }),
312
+ /* @__PURE__ */ jsxRuntime.jsx(
313
+ AnalyticsChart,
314
+ {
315
+ data: analyticsData.paymentMethods,
316
+ type: "pie"
317
+ }
318
+ )
319
+ ] }) }) })
320
+ ] }),
321
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
322
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
323
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.analytics.topProducts", defaultMessage: "Top Products" }) }),
324
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { children: [
325
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
326
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.analytics.product", defaultMessage: "Product" }) }) }),
327
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.analytics.revenue", defaultMessage: "Revenue" }) }) }),
328
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.analytics.quantity", defaultMessage: "Quantity" }) }) })
329
+ ] }) }),
330
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: analyticsData.topProducts.map((product, index2) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
331
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: product.name }) }),
332
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatCurrency(product.revenue, currency) }) }),
333
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: product.quantity }) })
334
+ ] }, index2)) })
335
+ ] })
336
+ ] }) }) }),
337
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
338
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.analytics.geographic", defaultMessage: "Geographic Distribution" }) }),
339
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { children: [
340
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
341
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.analytics.country", defaultMessage: "Country" }) }) }),
342
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.analytics.revenue", defaultMessage: "Revenue" }) }) }),
343
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.analytics.transactions", defaultMessage: "Transactions" }) }) })
344
+ ] }) }),
345
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: analyticsData.geographicData.map((geo, index2) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
346
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: geo.country }) }),
347
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatCurrency(geo.revenue, currency) }) }),
348
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: geo.transactions }) })
349
+ ] }, index2)) })
350
+ ] })
351
+ ] }) }) })
352
+ ] })
353
+ ] });
354
+ };
355
+ exports.Analytics = Analytics;
@@ -0,0 +1,70 @@
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 index = require("./index-BqqrpI6D.js");
9
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
+ const React__default = /* @__PURE__ */ _interopDefault(React);
11
+ const Dashboard = React__default.default.lazy(() => Promise.resolve().then(() => require("./Dashboard-CNMTzSyc.js")).then((m) => ({ default: m.Dashboard })));
12
+ const Payments = React__default.default.lazy(() => Promise.resolve().then(() => require("./Payments-BLen1P9N.js")).then((m) => ({ default: m.Payments })));
13
+ const Orders = React__default.default.lazy(() => Promise.resolve().then(() => require("./Orders-OG-pwV-B.js")).then((m) => ({ default: m.Orders })));
14
+ const Customers = React__default.default.lazy(() => Promise.resolve().then(() => require("./Customers-BpFzfglV.js")).then((m) => ({ default: m.Customers })));
15
+ const Analytics = React__default.default.lazy(() => Promise.resolve().then(() => require("./Analytics-nBSdLT2v.js")).then((m) => ({ default: m.Analytics })));
16
+ const Settings = React__default.default.lazy(() => Promise.resolve().then(() => require("./Settings-Dq1xy32B.js")).then((m) => ({ default: m.Settings })));
17
+ const App = () => {
18
+ const { formatMessage } = reactIntl.useIntl();
19
+ const links = [
20
+ {
21
+ to: `/plugins/${index.PLUGIN_ID}/dashboard`,
22
+ label: formatMessage({ id: "payment-plugin.dashboard.title", defaultMessage: "Dashboard" })
23
+ },
24
+ {
25
+ to: `/plugins/${index.PLUGIN_ID}/payments`,
26
+ label: formatMessage({ id: "payment-plugin.payments.title", defaultMessage: "Payments" })
27
+ },
28
+ {
29
+ to: `/plugins/${index.PLUGIN_ID}/orders`,
30
+ label: formatMessage({ id: "payment-plugin.orders.title", defaultMessage: "Orders" })
31
+ },
32
+ {
33
+ to: `/plugins/${index.PLUGIN_ID}/customers`,
34
+ label: formatMessage({ id: "payment-plugin.customers.title", defaultMessage: "Customers" })
35
+ },
36
+ {
37
+ to: `/plugins/${index.PLUGIN_ID}/analytics`,
38
+ label: formatMessage({ id: "payment-plugin.analytics.title", defaultMessage: "Analytics" })
39
+ },
40
+ {
41
+ to: `/plugins/${index.PLUGIN_ID}/settings`,
42
+ label: formatMessage({ id: "payment-plugin.settings.title", defaultMessage: "Settings" })
43
+ }
44
+ ];
45
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", children: [
46
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNav, { "aria-label": formatMessage({ id: "payment-plugin.nav.aria", defaultMessage: "Payment navigation" }), children: [
47
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavHeader, { title: formatMessage({ id: "payment-plugin.plugin.name", defaultMessage: "Payment Plugin" }) }),
48
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavSections, { children: links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavSection, { children: /* @__PURE__ */ jsxRuntime.jsx(
49
+ designSystem.SubNavLink,
50
+ {
51
+ as: reactRouterDom.NavLink,
52
+ to: link.to,
53
+ icon: null,
54
+ children: link.label
55
+ },
56
+ link.to
57
+ ) })) })
58
+ ] }),
59
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { flex: "1", 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: [
60
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "dashboard", element: /* @__PURE__ */ jsxRuntime.jsx(Dashboard, {}) }),
61
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "payments", element: /* @__PURE__ */ jsxRuntime.jsx(Payments, {}) }),
62
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "orders", element: /* @__PURE__ */ jsxRuntime.jsx(Orders, {}) }),
63
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "customers", element: /* @__PURE__ */ jsxRuntime.jsx(Customers, {}) }),
64
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "analytics", element: /* @__PURE__ */ jsxRuntime.jsx(Analytics, {}) }),
65
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "settings", element: /* @__PURE__ */ jsxRuntime.jsx(Settings, {}) }),
66
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "dashboard", replace: true }) })
67
+ ] }) }) })
68
+ ] });
69
+ };
70
+ exports.App = App;
@@ -0,0 +1,68 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import React, { Suspense } from "react";
3
+ import { NavLink, Routes, Route, Navigate } from "react-router-dom";
4
+ import { useIntl } from "react-intl";
5
+ import { Flex, SubNav, SubNavHeader, SubNavSections, SubNavSection, SubNavLink, Box, Loader } from "@strapi/design-system";
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
+ const Dashboard = React.lazy(() => import("./Dashboard-Dbwl0ZBo.mjs").then((m) => ({ default: m.Dashboard })));
8
+ const Payments = React.lazy(() => import("./Payments-DSDJ-HWm.mjs").then((m) => ({ default: m.Payments })));
9
+ const Orders = React.lazy(() => import("./Orders-CBkT2YfP.mjs").then((m) => ({ default: m.Orders })));
10
+ const Customers = React.lazy(() => import("./Customers-C6FH7-zG.mjs").then((m) => ({ default: m.Customers })));
11
+ const Analytics = React.lazy(() => import("./Analytics-DSJqY9ng.mjs").then((m) => ({ default: m.Analytics })));
12
+ const Settings = React.lazy(() => import("./Settings-jmGslDsB.mjs").then((m) => ({ default: m.Settings })));
13
+ const App = () => {
14
+ const { formatMessage } = useIntl();
15
+ const links = [
16
+ {
17
+ to: `/plugins/${PLUGIN_ID}/dashboard`,
18
+ label: formatMessage({ id: "payment-plugin.dashboard.title", defaultMessage: "Dashboard" })
19
+ },
20
+ {
21
+ to: `/plugins/${PLUGIN_ID}/payments`,
22
+ label: formatMessage({ id: "payment-plugin.payments.title", defaultMessage: "Payments" })
23
+ },
24
+ {
25
+ to: `/plugins/${PLUGIN_ID}/orders`,
26
+ label: formatMessage({ id: "payment-plugin.orders.title", defaultMessage: "Orders" })
27
+ },
28
+ {
29
+ to: `/plugins/${PLUGIN_ID}/customers`,
30
+ label: formatMessage({ id: "payment-plugin.customers.title", defaultMessage: "Customers" })
31
+ },
32
+ {
33
+ to: `/plugins/${PLUGIN_ID}/analytics`,
34
+ label: formatMessage({ id: "payment-plugin.analytics.title", defaultMessage: "Analytics" })
35
+ },
36
+ {
37
+ to: `/plugins/${PLUGIN_ID}/settings`,
38
+ label: formatMessage({ id: "payment-plugin.settings.title", defaultMessage: "Settings" })
39
+ }
40
+ ];
41
+ return /* @__PURE__ */ jsxs(Flex, { alignItems: "stretch", children: [
42
+ /* @__PURE__ */ jsxs(SubNav, { "aria-label": formatMessage({ id: "payment-plugin.nav.aria", defaultMessage: "Payment navigation" }), children: [
43
+ /* @__PURE__ */ jsx(SubNavHeader, { title: formatMessage({ id: "payment-plugin.plugin.name", defaultMessage: "Payment Plugin" }) }),
44
+ /* @__PURE__ */ jsx(SubNavSections, { children: links.map((link) => /* @__PURE__ */ jsx(SubNavSection, { children: /* @__PURE__ */ jsx(
45
+ SubNavLink,
46
+ {
47
+ as: NavLink,
48
+ to: link.to,
49
+ icon: null,
50
+ children: link.label
51
+ },
52
+ link.to
53
+ ) })) })
54
+ ] }),
55
+ /* @__PURE__ */ jsx(Box, { flex: "1", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 12, children: /* @__PURE__ */ jsx(Loader, {}) }), children: /* @__PURE__ */ jsxs(Routes, { children: [
56
+ /* @__PURE__ */ jsx(Route, { path: "dashboard", element: /* @__PURE__ */ jsx(Dashboard, {}) }),
57
+ /* @__PURE__ */ jsx(Route, { path: "payments", element: /* @__PURE__ */ jsx(Payments, {}) }),
58
+ /* @__PURE__ */ jsx(Route, { path: "orders", element: /* @__PURE__ */ jsx(Orders, {}) }),
59
+ /* @__PURE__ */ jsx(Route, { path: "customers", element: /* @__PURE__ */ jsx(Customers, {}) }),
60
+ /* @__PURE__ */ jsx(Route, { path: "analytics", element: /* @__PURE__ */ jsx(Analytics, {}) }),
61
+ /* @__PURE__ */ jsx(Route, { path: "settings", element: /* @__PURE__ */ jsx(Settings, {}) }),
62
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Navigate, { to: "dashboard", replace: true }) })
63
+ ] }) }) })
64
+ ] });
65
+ };
66
+ export {
67
+ App
68
+ };