@reeboot/strapi-payment-plugin 0.0.1 → 0.0.2

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-C2GKvPDX.js +355 -0
  3. package/dist/_chunks/Analytics-Chydh3dg.mjs +355 -0
  4. package/dist/_chunks/App-BCbEuN6h.mjs +68 -0
  5. package/dist/_chunks/App-E2k2mo5p.js +70 -0
  6. package/dist/_chunks/Customers-B8BlQ1BO.mjs +273 -0
  7. package/dist/_chunks/Customers-D0O5ET5C.js +273 -0
  8. package/dist/_chunks/Dashboard-CuqclLak.js +180 -0
  9. package/dist/_chunks/Dashboard-D8-ifJqB.mjs +180 -0
  10. package/dist/_chunks/Orders-5WGSzPGo.js +308 -0
  11. package/dist/_chunks/Orders-ClJJaQrX.mjs +308 -0
  12. package/dist/_chunks/Payments-CIMyOC3n.js +489 -0
  13. package/dist/_chunks/Payments-CRnRBf48.mjs +489 -0
  14. package/dist/_chunks/Settings-BXMLePI_.js +357 -0
  15. package/dist/_chunks/Settings-TeAvV4RH.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-BTk7a2T5.js +66 -0
  19. package/dist/_chunks/index-Bz8V_5zH.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 +1746 -984
  37. package/dist/server/index.mjs +1748 -986
  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
@@ -1,1424 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const admin = require("@strapi/strapi/admin");
5
- const reactRouterDom = require("react-router-dom");
6
- const react = require("react");
7
- const designSystem = require("@strapi/design-system");
8
- const formik = require("formik");
9
- const ConfigurationPage = () => {
10
- const [stripeSecretKey, setStripeSecretKey] = react.useState("");
11
- const [stripePublishableKey, setStripePublishableKey] = react.useState("");
12
- const [stripeWebhookSecret, setStripeWebhookSecret] = react.useState("");
13
- const [paypalClientId, setPaypalClientId] = react.useState("");
14
- const [paypalClientSecret, setPaypalClientSecret] = react.useState("");
15
- const [paypalWebhookId, setPaypalWebhookId] = react.useState("");
16
- const [returnURL, setReturnURL] = react.useState(`${window.location.origin}/strapi-payment-plugin/webhook/stripe`);
17
- const [configStatus, setConfigStatus] = react.useState({
18
- stripe: false,
19
- paypal: false
20
- });
21
- react.useEffect(() => {
22
- const fetchConfigStatus = async () => {
23
- try {
24
- const response = await fetch("/strapi-payment-plugin/config-status");
25
- if (response.ok) {
26
- const data = await response.json();
27
- setConfigStatus(data);
28
- }
29
- } catch (error) {
30
- console.error("Failed to fetch config status:", error);
31
- }
32
- };
33
- fetchConfigStatus();
34
- }, []);
35
- const handleSave = async () => {
36
- const response = await fetch("/strapi-payment-plugin/config", {
37
- method: "POST",
38
- headers: {
39
- "Content-Type": "application/json"
40
- },
41
- body: JSON.stringify({
42
- stripe: {
43
- secretKey: stripeSecretKey,
44
- publishableKey: stripePublishableKey,
45
- webhookSecret: stripeWebhookSecret
46
- },
47
- paypal: {
48
- clientId: paypalClientId,
49
- clientSecret: paypalClientSecret,
50
- webhookId: paypalWebhookId
51
- }
52
- })
53
- });
54
- if (response.ok) {
55
- alert("Configuration saved successfully");
56
- } else {
57
- alert("Failed to save configuration");
58
- }
59
- };
60
- async function onclickTest() {
61
- try {
62
- const returnUrl = returnURL;
63
- const response = await fetch("/strapi-payment-plugin/test-payment", {
64
- method: "POST",
65
- headers: {
66
- "Content-Type": "application/json"
67
- },
68
- body: JSON.stringify({
69
- amount: 1e3,
70
- // $10.00
71
- currency: "usd",
72
- paymentMethod: "pm_card_visa",
73
- // Test card
74
- returnUrl
75
- })
76
- });
77
- if (response.ok) {
78
- const result = await response.json();
79
- alert(`Payment successful!
80
- Payment ID: ${result.paymentId}
81
- Return URL: ${returnUrl}`);
82
- } else {
83
- const error = await response.json();
84
- alert(`Payment failed:
85
- ${error.message}`);
86
- }
87
- } catch (err) {
88
- if (err instanceof Error) {
89
- alert(`Error testing payment:
90
- ${err.message}`);
91
- } else {
92
- alert("An unknown error occurred while testing payment");
93
- }
94
- }
95
- }
96
- async function onclickTestWithRedirect() {
97
- try {
98
- const returnUrl = returnURL;
99
- const response = await fetch("/strapi-payment-plugin/test-payment-with-redirect", {
100
- method: "POST",
101
- headers: {
102
- "Content-Type": "application/json"
103
- },
104
- body: JSON.stringify({
105
- productId: "price_1Rryf5FYBY9tFLhrxZRaCvC8"
106
- // Example product ID
107
- })
108
- });
109
- if (response.ok) {
110
- const result = await response.json();
111
- if (result.paymentLink) {
112
- window.location.href = result.paymentLink;
113
- } else {
114
- alert(`Payment successful!
115
- Payment ID: ${result.paymentId}`);
116
- }
117
- } else {
118
- const error = await response.json();
119
- alert(`Payment failed:
120
- ${error.message}`);
121
- }
122
- } catch (err) {
123
- if (err instanceof Error) {
124
- alert(`Error testing payment:
125
- ${err.message}`);
126
- } else {
127
- alert("An unknown error occurred while testing payment");
128
- }
129
- }
130
- }
131
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
132
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { title: "Payment Plugin Configuration" }),
133
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 6, background: "neutral0", children: [
134
- /* @__PURE__ */ jsxRuntime.jsx(
135
- designSystem.Typography,
136
- {
137
- variant: "alpha",
138
- as: "h1",
139
- textColor: "primary600",
140
- style: { marginBottom: "2rem" },
141
- children: "Payment Configuration"
142
- }
143
- ),
144
- /* @__PURE__ */ jsxRuntime.jsxs(
145
- designSystem.Box,
146
- {
147
- padding: 4,
148
- background: "neutral100",
149
- borderRadius: "4px",
150
- border: "1px solid #e0e0e0",
151
- style: { marginBottom: "2rem" },
152
- children: [
153
- /* @__PURE__ */ jsxRuntime.jsx(
154
- designSystem.Typography,
155
- {
156
- variant: "beta",
157
- as: "h2",
158
- textColor: "neutral800",
159
- style: { marginBottom: "1rem" },
160
- children: "Payment Configuration"
161
- }
162
- ),
163
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 6, style: { marginBottom: "2rem" }, children: [
164
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
165
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "gamma", as: "h3", textColor: "neutral800", children: "Stripe Status  " }),
166
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", children: [
167
- /* @__PURE__ */ jsxRuntime.jsx(
168
- "div",
169
- {
170
- style: {
171
- width: "10px",
172
- height: "10px",
173
- borderRadius: "50%",
174
- backgroundColor: configStatus.stripe ? "green" : "red",
175
- marginRight: "8px"
176
- }
177
- }
178
- ),
179
- /* @__PURE__ */ jsxRuntime.jsx(
180
- designSystem.Typography,
181
- {
182
- variant: "pi",
183
- fontWeight: "bold",
184
- textColor: configStatus.stripe ? "success600" : "danger600",
185
- children: configStatus.stripe ? "Connected" : "Not Connected"
186
- }
187
- )
188
- ] })
189
- ] }) }),
190
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
191
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "gamma", as: "h3", textColor: "neutral800", children: "PayPal Status  " }),
192
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", children: [
193
- /* @__PURE__ */ jsxRuntime.jsx(
194
- "div",
195
- {
196
- style: {
197
- width: "10px",
198
- height: "10px",
199
- borderRadius: "50%",
200
- backgroundColor: configStatus.paypal ? "green" : "red",
201
- marginRight: "8px"
202
- }
203
- }
204
- ),
205
- /* @__PURE__ */ jsxRuntime.jsx(
206
- designSystem.Typography,
207
- {
208
- variant: "pi",
209
- fontWeight: "bold",
210
- textColor: configStatus.paypal ? "success600" : "danger600",
211
- children: configStatus.paypal ? "Connected" : "Not Connected"
212
- }
213
- )
214
- ] })
215
- ] }) })
216
- ] }),
217
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 6, children: [
218
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
219
- designSystem.Box,
220
- {
221
- padding: 6,
222
- background: "neutral0",
223
- borderRadius: "4px",
224
- border: "1px solid #e0e0e0",
225
- style: { marginBottom: "1rem", width: "100%" },
226
- children: [
227
- /* @__PURE__ */ jsxRuntime.jsx(
228
- designSystem.Typography,
229
- {
230
- variant: "gamma",
231
- as: "h3",
232
- textColor: "neutral800",
233
- style: { marginBottom: "1rem" },
234
- children: "Stripe Configuration"
235
- }
236
- ),
237
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 8, alignItems: "initial", children: [
238
- /* @__PURE__ */ jsxRuntime.jsx(
239
- designSystem.TextInput,
240
- {
241
- placeholder: "Secret Key",
242
- name: "stripeSecretKey",
243
- value: stripeSecretKey,
244
- onChange: (e) => setStripeSecretKey(e.target.value),
245
- type: "password",
246
- disabled: configStatus.stripe,
247
- style: {
248
- border: configStatus.stripe ? "2px solid #4CAF50" : ""
249
- },
250
- hint: configStatus.stripe ? "This value is controlled by environment variables" : ""
251
- }
252
- ),
253
- /* @__PURE__ */ jsxRuntime.jsx(
254
- designSystem.TextInput,
255
- {
256
- placeholder: "Publishable Key",
257
- name: "stripePublishableKey",
258
- value: stripePublishableKey,
259
- onChange: (e) => setStripePublishableKey(e.target.value),
260
- disabled: configStatus.stripe,
261
- style: {
262
- border: configStatus.stripe ? "2px solid #4CAF50" : ""
263
- },
264
- hint: configStatus.stripe ? "This value is controlled by environment variables" : ""
265
- }
266
- ),
267
- /* @__PURE__ */ jsxRuntime.jsx(
268
- designSystem.TextInput,
269
- {
270
- placeholder: "Webhook Secret",
271
- name: "stripeWebhookSecret",
272
- value: stripeWebhookSecret,
273
- onChange: (e) => setStripeWebhookSecret(e.target.value),
274
- type: "password",
275
- disabled: configStatus.stripe,
276
- style: {
277
- border: configStatus.stripe ? "2px solid #4CAF50" : ""
278
- },
279
- hint: configStatus.stripe ? "This value is controlled by environment variables" : ""
280
- }
281
- )
282
- ] })
283
- ]
284
- }
285
- ) }),
286
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
287
- designSystem.Box,
288
- {
289
- padding: 6,
290
- background: "neutral0",
291
- borderRadius: "4px",
292
- border: "1px solid #e0e0e0",
293
- style: { marginBottom: "1rem", width: "100%" },
294
- children: [
295
- /* @__PURE__ */ jsxRuntime.jsx(
296
- designSystem.Typography,
297
- {
298
- variant: "gamma",
299
- as: "h3",
300
- textColor: "neutral800",
301
- style: { marginBottom: "1rem" },
302
- children: "PayPal Configuration (not implemented for now)"
303
- }
304
- ),
305
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 8, alignItems: "initial", children: [
306
- /* @__PURE__ */ jsxRuntime.jsx(
307
- designSystem.TextInput,
308
- {
309
- placeholder: "Client ID",
310
- name: "paypalClientId",
311
- value: paypalClientId,
312
- onChange: (e) => setPaypalClientId(e.target.value),
313
- disabled: true,
314
- style: {
315
- border: configStatus.paypal ? "2px solid #4CAF50" : "",
316
- width: "100%"
317
- },
318
- hint: configStatus.paypal ? "This value is controlled by environment variables" : ""
319
- }
320
- ),
321
- /* @__PURE__ */ jsxRuntime.jsx(
322
- designSystem.TextInput,
323
- {
324
- placeholder: "Client Secret",
325
- name: "paypalClientSecret",
326
- value: paypalClientSecret,
327
- onChange: (e) => setPaypalClientSecret(e.target.value),
328
- type: "password",
329
- disabled: true,
330
- style: {
331
- border: configStatus.paypal ? "2px solid #4CAF50" : ""
332
- },
333
- width: "80%",
334
- hint: configStatus.paypal ? "This value is controlled by environment variables" : ""
335
- }
336
- ),
337
- /* @__PURE__ */ jsxRuntime.jsx(
338
- designSystem.TextInput,
339
- {
340
- placeholder: "Webhook ID",
341
- name: "paypalWebhookId",
342
- value: paypalWebhookId,
343
- onChange: (e) => setPaypalWebhookId(e.target.value),
344
- disabled: true,
345
- style: {
346
- border: configStatus.paypal ? "2px solid #4CAF50" : ""
347
- },
348
- hint: configStatus.paypal ? "This value is controlled by environment variables" : ""
349
- }
350
- )
351
- ] })
352
- ]
353
- }
354
- ) })
355
- ] }),
356
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleSave, style: { marginTop: "1rem" }, children: "Save Configuration" })
357
- ]
358
- }
359
- ),
360
- /* @__PURE__ */ jsxRuntime.jsxs(
361
- designSystem.Box,
362
- {
363
- padding: 4,
364
- background: "neutral100",
365
- borderRadius: "4px",
366
- border: "1px solid #e0e0e0",
367
- style: { marginTop: "2rem" },
368
- children: [
369
- /* @__PURE__ */ jsxRuntime.jsx(
370
- designSystem.Typography,
371
- {
372
- variant: "beta",
373
- as: "h2",
374
- textColor: "neutral800",
375
- style: { marginBottom: "1rem" },
376
- children: "Stripe Payment Testing"
377
- }
378
- ),
379
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { marginBottom: "1rem" }, children: "Test Stripe payment generation and handling" }),
380
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
381
- designSystem.TextInput,
382
- {
383
- placeholder: "Return URL (e.g., https://example.com/return)",
384
- name: "returnUrl",
385
- id: "returnUrl",
386
- style: { marginBottom: "1rem", width: "100%" },
387
- value: returnURL,
388
- onChange: (e) => setReturnURL(e.target.value),
389
- defaultValue: `${window.location.origin}/strapi-payment-plugin/webhook/stripe`
390
- }
391
- ) }),
392
- /* @__PURE__ */ jsxRuntime.jsx(
393
- designSystem.Button,
394
- {
395
- onClick: onclickTest,
396
- style: { marginBottom: "1rem" },
397
- children: "Test Stripe Payment"
398
- }
399
- ),
400
- /* @__PURE__ */ jsxRuntime.jsx(
401
- designSystem.Button,
402
- {
403
- onClick: onclickTestWithRedirect,
404
- style: { marginBottom: "1rem", marginLeft: "1rem" },
405
- children: "Test Stripe Payment with Redirect"
406
- }
407
- )
408
- ]
409
- }
410
- )
411
- ] }) })
412
- ] });
413
- };
414
- const TransactionList = ({ transactions, onViewDetails, onStatusUpdate }) => {
415
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { style: { fontSize: "14px" }, children: [
416
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
417
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "ID" }),
418
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "Amount" }),
419
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "Currency" }),
420
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "Status" }),
421
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "Date" }),
422
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "Customer" }),
423
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "Gateway" }),
424
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: "Actions" })
425
- ] }) }),
426
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: transactions.map((transaction) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
427
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: transaction.id }),
428
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Td, { children: [
429
- "$",
430
- transaction.amount.toFixed(2)
431
- ] }),
432
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: transaction.currency }),
433
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: onStatusUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(
434
- designSystem.SingleSelect,
435
- {
436
- value: transaction.status,
437
- onChange: (e) => onStatusUpdate(transaction.id, e.target.value),
438
- style: { minWidth: "120px" },
439
- children: [
440
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
441
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "completed", children: "Completed" }),
442
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "failed", children: "Failed" }),
443
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "refunded", children: "Refunded" })
444
- ]
445
- }
446
- ) : transaction.status }),
447
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: new Date(transaction.date).toLocaleDateString() }),
448
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: transaction.customer }),
449
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: transaction.gateway }),
450
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", size: "S", onClick: () => onViewDetails(transaction), children: "View" }) })
451
- ] }, transaction.id)) })
452
- ] });
453
- };
454
- const TransactionDetailsModal = ({
455
- isOpen,
456
- onClose,
457
- transaction,
458
- onRefund
459
- }) => {
460
- if (!transaction) return null;
461
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isOpen, onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { onClick: onClose, children: [
462
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "neutral800", children: "Transaction Details" }) }),
463
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
464
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "neutral800", children: "Details" }),
465
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginTop: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
466
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
467
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Amount:" }),
468
- " $",
469
- transaction.amount.toFixed(2),
470
- " ",
471
- transaction.currency
472
- ] }),
473
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
474
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Status:" }),
475
- " ",
476
- transaction.status
477
- ] }),
478
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
479
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Date:" }),
480
- " ",
481
- new Date(transaction.date).toLocaleString()
482
- ] }),
483
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
484
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Customer:" }),
485
- " ",
486
- transaction.customer
487
- ] }),
488
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
489
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Payment Method:" }),
490
- " ",
491
- transaction.paymentMethod
492
- ] }),
493
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
494
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Gateway:" }),
495
- " ",
496
- transaction.gateway
497
- ] })
498
- ] }) }),
499
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { style: { marginTop: "2rem", gap: "1rem" }, children: [
500
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: onClose, children: "Close" }),
501
- transaction.status === "completed" && transaction.gateway !== "paypal" && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "danger", onClick: onRefund, style: { marginLeft: "auto" }, children: "Refund" })
502
- ] })
503
- ] }) })
504
- ] }) });
505
- };
506
- const TransactionsPage = () => {
507
- const [searchTerm, setSearchTerm] = react.useState("");
508
- const [filter, setFilter] = react.useState("all");
509
- const [transactions, setTransactions] = react.useState([]);
510
- const [loading, setLoading] = react.useState(false);
511
- const [error, setError] = react.useState(null);
512
- const [selectedTransaction, setSelectedTransaction] = react.useState(null);
513
- const [isModalOpen, setIsModalOpen] = react.useState(false);
514
- const handleSearch = (e) => {
515
- setSearchTerm(e.target.value);
516
- };
517
- const handleFilterChange = (value) => {
518
- setFilter(value);
519
- };
520
- const fetchTransactions = async () => {
521
- setLoading(true);
522
- setError(null);
523
- try {
524
- const response = await fetch("/strapi-payment-plugin/transactions?gateway=all&status=all");
525
- if (!response.ok) {
526
- throw new Error("Failed to fetch transactions");
527
- }
528
- const data = await response.json();
529
- setTransactions(data.data);
530
- } catch (err) {
531
- if (err instanceof Error) {
532
- setError(err.message);
533
- } else {
534
- setError("An unknown error occurred");
535
- }
536
- } finally {
537
- setLoading(false);
538
- }
539
- };
540
- react.useEffect(() => {
541
- fetchTransactions();
542
- }, []);
543
- const filteredTransactions = transactions.filter((transaction) => {
544
- const matchesSearch = [
545
- transaction.id,
546
- transaction.customer,
547
- transaction.amount.toString()
548
- ].some(
549
- (field) => field.toLowerCase().includes(searchTerm.toLowerCase())
550
- );
551
- const matchesFilter = filter === "all" || transaction.status === filter;
552
- return matchesSearch && matchesFilter;
553
- });
554
- const handleViewDetails = (transaction) => {
555
- setSelectedTransaction(transaction);
556
- setIsModalOpen(true);
557
- };
558
- const handleRefund = async () => {
559
- if (!selectedTransaction) return;
560
- try {
561
- const response = await fetch("/strapi-payment-plugin/refund", {
562
- method: "POST",
563
- headers: {
564
- "Content-Type": "application/json"
565
- },
566
- body: JSON.stringify({
567
- gateway: selectedTransaction.gateway,
568
- transactionId: selectedTransaction.id,
569
- amount: selectedTransaction.amount
570
- })
571
- });
572
- if (!response.ok) {
573
- throw new Error("Failed to process refund");
574
- }
575
- const result = await response.json();
576
- if (result.success) {
577
- setTransactions(transactions.map(
578
- (t) => t.id === selectedTransaction.id ? { ...t, status: "refunded" } : t
579
- ));
580
- setIsModalOpen(false);
581
- } else {
582
- throw new Error(result.message || "Refund failed");
583
- }
584
- } catch (err) {
585
- if (err instanceof Error) {
586
- setError(err.message);
587
- } else {
588
- setError("An unknown error occurred");
589
- }
590
- }
591
- };
592
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
593
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { title: "Transactions" }),
594
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 6, background: "neutral0", children: [
595
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h1", textColor: "primary600", style: { marginBottom: "2rem" }, children: "Transactions" }),
596
- error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", style: { marginBottom: "1rem" }, children: error }),
597
- /* @__PURE__ */ jsxRuntime.jsxs(
598
- designSystem.Box,
599
- {
600
- padding: 4,
601
- background: "neutral100",
602
- borderRadius: "4px",
603
- border: "1px solid #e0e0e0",
604
- children: [
605
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "neutral800", style: { marginBottom: "1rem" }, children: "Transaction List" }),
606
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "1rem", display: "flex", gap: "1rem", alignItems: "center", flexWrap: "wrap" }, children: [
607
- /* @__PURE__ */ jsxRuntime.jsx(
608
- designSystem.TextInput,
609
- {
610
- label: "Search Transactions",
611
- value: searchTerm,
612
- onChange: handleSearch,
613
- placeholder: "Search by ID, email, or amount",
614
- style: { flex: 1, minWidth: "200px" }
615
- }
616
- ),
617
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelect, { value: filter, onChange: handleFilterChange, style: { minWidth: "150px" }, children: [
618
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "all", children: "All Transactions" }),
619
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "completed", children: "Successful" }),
620
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "failed", children: "Failed" }),
621
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "pending", children: "Pending" }),
622
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "refunded", children: "Refunded" })
623
- ] })
624
- ] }),
625
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
626
- loading && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Loading transactions..." }),
627
- !loading && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: filteredTransactions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
628
- TransactionList,
629
- {
630
- transactions: filteredTransactions,
631
- onViewDetails: handleViewDetails
632
- }
633
- ) : /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No transactions found" }) })
634
- ] })
635
- ]
636
- }
637
- )
638
- ] }),
639
- /* @__PURE__ */ jsxRuntime.jsx(
640
- TransactionDetailsModal,
641
- {
642
- isOpen: isModalOpen,
643
- onClose: () => setIsModalOpen(false),
644
- transaction: selectedTransaction,
645
- onRefund: handleRefund
646
- }
647
- )
648
- ] });
649
- };
650
- const DashboardPage = () => {
651
- const [transactions, setTransactions] = react.useState([]);
652
- const [loading, setLoading] = react.useState(false);
653
- const [error, setError] = react.useState(null);
654
- const [stats, setStats] = react.useState({
655
- totalRevenue: 0,
656
- totalTransactions: 0,
657
- successRate: 0
658
- });
659
- const fetchData = async () => {
660
- setLoading(true);
661
- setError(null);
662
- try {
663
- const response = await fetch("/strapi-payment-plugin/transactions?gateway=all&status=all");
664
- if (!response.ok) {
665
- throw new Error("Failed to fetch transactions");
666
- }
667
- const data = await response.json();
668
- setTransactions(data.data.slice(0, 5));
669
- const totalAmount = data.data.reduce((sum, t) => sum + t.amount, 0);
670
- const successCount = data.data.filter((t) => t.status === "completed").length;
671
- const successRate = data.data.length > 0 ? successCount / data.data.length * 100 : 0;
672
- setStats({
673
- totalRevenue: totalAmount,
674
- totalTransactions: data.data.length,
675
- successRate
676
- });
677
- } catch (err) {
678
- if (err instanceof Error) {
679
- setError(err.message);
680
- } else {
681
- setError("An unknown error occurred");
682
- }
683
- } finally {
684
- setLoading(false);
685
- }
686
- };
687
- react.useEffect(() => {
688
- fetchData();
689
- }, []);
690
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
691
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { title: "Payment Dashboard" }),
692
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 6, background: "neutral0", children: [
693
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h1", textColor: "primary600", style: { marginBottom: "2rem" }, children: "Payment Dashboard" }),
694
- /* @__PURE__ */ jsxRuntime.jsxs(
695
- designSystem.Box,
696
- {
697
- padding: 4,
698
- background: "neutral100",
699
- borderRadius: "4px",
700
- border: "1px solid #e0e0e0",
701
- style: { marginBottom: "2rem" },
702
- children: [
703
- /* @__PURE__ */ jsxRuntime.jsx(
704
- designSystem.Typography,
705
- {
706
- variant: "beta",
707
- as: "h2",
708
- textColor: "neutral800",
709
- style: { marginBottom: "1rem" },
710
- children: "Payment Statistics"
711
- }
712
- ),
713
- loading && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Loading statistics..." }),
714
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "red" }, children: error }),
715
- !loading && !error && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
716
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
717
- designSystem.Box,
718
- {
719
- padding: 4,
720
- background: "neutral0",
721
- borderRadius: "4px",
722
- border: "1px solid #e0e0e0",
723
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", direction: "column", children: [
724
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral800", children: "Total Revenues" }),
725
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "alpha", textColor: "primary600", children: [
726
- "$",
727
- stats.totalRevenue.toFixed(2)
728
- ] })
729
- ] })
730
- }
731
- ) }),
732
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
733
- designSystem.Box,
734
- {
735
- padding: 4,
736
- background: "neutral0",
737
- borderRadius: "4px",
738
- border: "1px solid #e0e0e0",
739
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", direction: "column", children: [
740
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral800", children: "Total Transactions" }),
741
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", textColor: "primary600", children: stats.totalTransactions })
742
- ] })
743
- }
744
- ) }),
745
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
746
- designSystem.Box,
747
- {
748
- padding: 4,
749
- background: "neutral0",
750
- borderRadius: "4px",
751
- border: "1px solid #e0e0e0",
752
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", direction: "column", children: [
753
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral800", children: "Successful Payments" }),
754
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "alpha", textColor: "primary600", children: [
755
- stats.successRate.toFixed(2),
756
- "%"
757
- ] })
758
- ] })
759
- }
760
- ) })
761
- ] })
762
- ]
763
- }
764
- ),
765
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral100", borderRadius: "4px", border: "1px solid #e0e0e0", children: [
766
- /* @__PURE__ */ jsxRuntime.jsx(
767
- designSystem.Typography,
768
- {
769
- variant: "beta",
770
- as: "h2",
771
- textColor: "neutral800",
772
- style: { marginBottom: "1rem" },
773
- children: "Recent Transactions"
774
- }
775
- ),
776
- loading && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Loading transactions..." }),
777
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "red" }, children: error }),
778
- !loading && !error && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: transactions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(TransactionList, { transactions, onViewDetails: () => {
779
- } }) : /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No recent transactions" }) })
780
- ] })
781
- ] })
782
- ] });
783
- };
784
- const ProductsPage = () => {
785
- const [products, setProducts] = react.useState([]);
786
- const [stripeProducts, setStripeProducts] = react.useState([]);
787
- const [loading, setLoading] = react.useState(false);
788
- const [error, setError] = react.useState(null);
789
- const [isModalOpen, setIsModalOpen] = react.useState(false);
790
- const [currentProduct, setCurrentProduct] = react.useState(null);
791
- const fetchProducts = async () => {
792
- setLoading(true);
793
- setError(null);
794
- try {
795
- const response = await fetch("/strapi-payment-plugin/products");
796
- if (!response.ok) {
797
- throw new Error("Failed to fetch products");
798
- }
799
- const data = await response.json();
800
- setProducts(data);
801
- } catch (err) {
802
- if (err instanceof Error) {
803
- setError(err.message);
804
- } else {
805
- setError("An unknown error occurred");
806
- }
807
- } finally {
808
- setLoading(false);
809
- }
810
- };
811
- const fetchStripeProducts = async () => {
812
- setLoading(true);
813
- setError(null);
814
- try {
815
- const response = await fetch("/strapi-payment-plugin/products/stripeProducts");
816
- if (!response.ok) {
817
- throw new Error("Failed to fetch Stripe products");
818
- }
819
- const data = await response.json();
820
- console.log("Stripe Products:", data);
821
- setStripeProducts(data);
822
- } catch (err) {
823
- if (err instanceof Error) {
824
- setError(err.message);
825
- } else {
826
- setError("An unknown error occurred");
827
- }
828
- } finally {
829
- setLoading(false);
830
- }
831
- };
832
- react.useEffect(() => {
833
- fetchProducts();
834
- fetchStripeProducts();
835
- }, []);
836
- const handleCreate = () => {
837
- setCurrentProduct({
838
- documentId: "",
839
- id: 0,
840
- name: "",
841
- description: "",
842
- price: 0,
843
- currency: "USD",
844
- isSubscription: false,
845
- subscriptionInterval: "month"
846
- });
847
- setIsModalOpen(true);
848
- };
849
- const handleEdit = (product) => {
850
- location.href = `/admin/content-manager/collection-types/plugin::strapi-payment-plugin.product/${product.documentId}`;
851
- };
852
- const handleDelete = async (id) => {
853
- if (confirm("Are you sure you want to delete this product?")) {
854
- try {
855
- const response = await fetch(`/strapi-payment-plugin/products/${id}`, {
856
- method: "DELETE"
857
- });
858
- if (!response.ok) {
859
- throw new Error("Failed to delete product");
860
- }
861
- fetchProducts();
862
- } catch (err) {
863
- if (err instanceof Error) {
864
- setError(err.message);
865
- } else {
866
- setError("An unknown error occurred");
867
- }
868
- }
869
- }
870
- };
871
- const handleSync = async (id) => {
872
- try {
873
- const response = await fetch(`/strapi-payment-plugin/products/${id}/sync`, {
874
- method: "POST"
875
- });
876
- if (!response.ok) {
877
- throw new Error("Failed to sync product");
878
- }
879
- const result = await response.json();
880
- alert(result.message);
881
- fetchProducts();
882
- } catch (err) {
883
- if (err instanceof Error) {
884
- setError(err.message);
885
- } else {
886
- setError("An unknown error occurred");
887
- }
888
- }
889
- };
890
- const handleImport = async (stripeProductId) => {
891
- try {
892
- const response = await fetch("/strapi-payment-plugin/products/import", {
893
- method: "POST",
894
- headers: {
895
- "Content-Type": "application/json"
896
- },
897
- body: JSON.stringify({ stripeProductId })
898
- });
899
- if (!response.ok) {
900
- throw new Error("Failed to import product");
901
- }
902
- const result = await response.json();
903
- alert(result.message);
904
- fetchProducts();
905
- fetchStripeProducts();
906
- } catch (err) {
907
- if (err instanceof Error) {
908
- setError(err.message);
909
- } else {
910
- setError("An unknown error occurred");
911
- }
912
- }
913
- };
914
- const handleSubmit = async (values) => {
915
- if (!currentProduct) return;
916
- try {
917
- const method = currentProduct.id ? "PUT" : "POST";
918
- const url = currentProduct.id ? `/strapi-payment-plugin/products/${currentProduct.id}` : "/strapi-payment-plugin/products";
919
- const response = await fetch(url, {
920
- method,
921
- headers: {
922
- "Content-Type": "application/json"
923
- },
924
- body: JSON.stringify({ data: values })
925
- });
926
- if (!response.ok) {
927
- throw new Error(`Failed to ${currentProduct.id ? "update" : "create"} product`);
928
- }
929
- setIsModalOpen(false);
930
- fetchProducts();
931
- } catch (err) {
932
- if (err instanceof Error) {
933
- setError(err.message);
934
- } else {
935
- setError("An unknown error occurred");
936
- }
937
- }
938
- };
939
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 6, background: "neutral0", children: [
940
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h1", textColor: "primary600", style: { marginBottom: "2rem" }, children: "Products" }),
941
- error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", style: { marginBottom: "1rem" }, children: error }),
942
- loading && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Loading products..." }),
943
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Root, { open: isModalOpen, onOpenChange: setIsModalOpen, children: [
944
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleCreate, children: "Create product" }) }),
945
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
946
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: currentProduct ? currentProduct.id ? "Edit Product" : "Create Product" : "Product" }) }),
947
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(
948
- formik.Formik,
949
- {
950
- initialValues: {
951
- documentId: currentProduct?.documentId || "",
952
- id: currentProduct?.id || 0,
953
- name: currentProduct?.name || "",
954
- description: currentProduct?.description || "",
955
- price: currentProduct?.price || 0,
956
- currency: currentProduct?.currency || "USD",
957
- isSubscription: currentProduct?.isSubscription || false,
958
- subscriptionInterval: currentProduct?.subscriptionInterval || "month"
959
- },
960
- onSubmit: handleSubmit,
961
- children: ({ values, handleChange, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsx(formik.Form, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", direction: "column", gap: 4, col: 12, children: [
962
- /* @__PURE__ */ jsxRuntime.jsx(
963
- designSystem.TextInput,
964
- {
965
- label: "Name",
966
- name: "name",
967
- placeHolder: "Product Name",
968
- value: values.name,
969
- onChange: handleChange,
970
- required: true
971
- }
972
- ),
973
- /* @__PURE__ */ jsxRuntime.jsx(
974
- designSystem.Textarea,
975
- {
976
- label: "Description",
977
- name: "description",
978
- placeholder: "Product Description",
979
- value: values.description,
980
- onChange: handleChange
981
- }
982
- ),
983
- /* @__PURE__ */ jsxRuntime.jsx(
984
- designSystem.TextInput,
985
- {
986
- label: "Price",
987
- name: "price",
988
- type: "number",
989
- placeholder: "Product Price",
990
- value: values.price,
991
- onChange: handleChange,
992
- required: true
993
- }
994
- ),
995
- /* @__PURE__ */ jsxRuntime.jsxs(
996
- designSystem.SingleSelect,
997
- {
998
- label: "Currency",
999
- name: "currency",
1000
- placeholder: "Select Currency",
1001
- value: values.currency,
1002
- onChange: handleChange,
1003
- children: [
1004
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "USD", children: "USD" }),
1005
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "EUR", children: "EUR" }),
1006
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "GBP", children: "GBP" })
1007
- ]
1008
- }
1009
- ),
1010
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginTop: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral800", children: [
1011
- /* @__PURE__ */ jsxRuntime.jsx(
1012
- formik.Field,
1013
- {
1014
- type: "checkbox",
1015
- name: "isSubscription",
1016
- checked: values.isSubscription,
1017
- onChange: () => setFieldValue("isSubscription", !values.isSubscription)
1018
- }
1019
- ),
1020
- " Is Subscription"
1021
- ] }) }),
1022
- values.isSubscription && /* @__PURE__ */ jsxRuntime.jsxs(
1023
- designSystem.SingleSelect,
1024
- {
1025
- label: "Subscription Interval",
1026
- name: "subscriptionInterval",
1027
- value: values.subscriptionInterval,
1028
- onChange: handleChange,
1029
- children: [
1030
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "day", children: "Day" }),
1031
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "week", children: "Week" }),
1032
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "month", children: "Month" }),
1033
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "year", children: "Year" })
1034
- ]
1035
- }
1036
- ),
1037
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", style: { marginTop: "1rem" }, children: currentProduct?.id ? "Update" : "Create" })
1038
- ] }) })
1039
- }
1040
- ) })
1041
- ] })
1042
- ] }),
1043
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "primary600", style: { margin: "2rem 0 1rem" }, children: "Local Products" }),
1044
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: products.map((product) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
1045
- designSystem.Box,
1046
- {
1047
- padding: 4,
1048
- background: "neutral100",
1049
- borderRadius: "4px",
1050
- border: "1px solid #e0e0e0",
1051
- children: [
1052
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "neutral800", children: product.name }),
1053
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
1054
- product.price,
1055
- " ",
1056
- product.currency,
1057
- " ",
1058
- product.isSubscription ? `/ ${product.subscriptionInterval}` : ""
1059
- ] }),
1060
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", style: { marginTop: "1rem" }, children: product.description }),
1061
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", style: { marginTop: "1rem" }, children: product.stripeProductId ? "✅ Synced with Stripe" : "⚠️ Not synced with Stripe" }),
1062
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { style: { marginTop: "1rem", gap: "1rem" }, children: [
1063
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: () => handleEdit(product), children: "Edit" }),
1064
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "danger", onClick: () => handleDelete(product.id), children: "Delete" }),
1065
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: () => handleSync(product.id), children: product.stripeProductId ? "Sync" : "Create in Stripe" })
1066
- ] })
1067
- ]
1068
- },
1069
- product.id
1070
- ) }, product.id)) }),
1071
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "primary600", style: { margin: "2rem 0 1rem" }, children: "Stripe Products (Available for Import)" }),
1072
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: stripeProducts.filter(
1073
- (product) => !products.some((localProduct) => localProduct.stripeProductId === product.id)
1074
- ).map((product) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
1075
- designSystem.Box,
1076
- {
1077
- padding: 4,
1078
- background: "neutral100",
1079
- borderRadius: "4px",
1080
- border: "1px solid #e0e0e0",
1081
- children: [
1082
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "neutral800", children: product.name }),
1083
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "red", children: [
1084
- product?.default_price?.unit_amount / 100,
1085
- " ",
1086
- product?.default_price?.currency
1087
- ] }),
1088
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", style: { marginTop: "1rem" }, children: product.description }),
1089
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { style: { marginTop: "1rem", gap: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: () => handleImport(product.id), children: "Import from Stripe" }) })
1090
- ]
1091
- },
1092
- product.id
1093
- ) }, product.id)) })
1094
- ] }) });
1095
- };
1096
- const SubscriptionsPage = () => {
1097
- const [subscriptions, setSubscriptions] = react.useState([]);
1098
- const [products, setProducts] = react.useState([]);
1099
- const [loading, setLoading] = react.useState(false);
1100
- const [error, setError] = react.useState(null);
1101
- const [isModalOpen, setIsModalOpen] = react.useState(false);
1102
- const [currentSubscription, setCurrentSubscription] = react.useState(null);
1103
- const fetchSubscriptions = async () => {
1104
- setLoading(true);
1105
- setError(null);
1106
- try {
1107
- const response = await fetch("/strapi-payment-plugin/subscriptions");
1108
- if (!response.ok) {
1109
- throw new Error("Failed to fetch subscriptions");
1110
- }
1111
- const data = await response.json();
1112
- setSubscriptions(data);
1113
- } catch (err) {
1114
- if (err instanceof Error) {
1115
- setError(err.message);
1116
- } else {
1117
- setError("An unknown error occurred");
1118
- }
1119
- } finally {
1120
- setLoading(false);
1121
- }
1122
- };
1123
- const fetchProducts = async () => {
1124
- try {
1125
- const response = await fetch("/strapi-payment-plugin/products");
1126
- if (!response.ok) {
1127
- throw new Error("Failed to fetch products");
1128
- }
1129
- const data = await response.json();
1130
- setProducts(data);
1131
- } catch (err) {
1132
- console.error("Failed to fetch products:", err);
1133
- }
1134
- };
1135
- react.useEffect(() => {
1136
- fetchSubscriptions();
1137
- fetchProducts();
1138
- }, []);
1139
- const handleEdit = (subscription) => {
1140
- setCurrentSubscription(subscription);
1141
- setIsModalOpen(true);
1142
- };
1143
- const handleDelete = async (id) => {
1144
- if (confirm("Are you sure you want to delete this subscription?")) {
1145
- try {
1146
- const response = await fetch(`/strapi-payment-plugin/subscriptions/${id}`, {
1147
- method: "DELETE"
1148
- });
1149
- if (!response.ok) {
1150
- throw new Error("Failed to delete subscription");
1151
- }
1152
- fetchSubscriptions();
1153
- } catch (err) {
1154
- if (err instanceof Error) {
1155
- setError(err.message);
1156
- } else {
1157
- setError("An unknown error occurred");
1158
- }
1159
- }
1160
- }
1161
- };
1162
- const handleSubmit = async (values) => {
1163
- if (!currentSubscription) return;
1164
- try {
1165
- const method = currentSubscription.id ? "PUT" : "POST";
1166
- const url = currentSubscription.id ? `/strapi-payment-plugin/subscriptions/${currentSubscription.id}` : "/strapi-payment-plugin/subscriptions";
1167
- const response = await fetch(url, {
1168
- method,
1169
- headers: {
1170
- "Content-Type": "application/json"
1171
- },
1172
- body: JSON.stringify({ data: values })
1173
- });
1174
- if (!response.ok) {
1175
- throw new Error(`Failed to ${currentSubscription.id ? "update" : "create"} subscription`);
1176
- }
1177
- setIsModalOpen(false);
1178
- fetchSubscriptions();
1179
- } catch (err) {
1180
- if (err instanceof Error) {
1181
- setError(err.message);
1182
- } else {
1183
- setError("An unknown error occurred");
1184
- }
1185
- }
1186
- };
1187
- const handleSync = async (id) => {
1188
- try {
1189
- const response = await fetch(`/strapi-payment-plugin/subscriptions/${id}/sync`, {
1190
- method: "POST"
1191
- });
1192
- if (!response.ok) {
1193
- throw new Error("Failed to sync subscription");
1194
- }
1195
- const result = await response.json();
1196
- alert(result.message);
1197
- fetchSubscriptions();
1198
- } catch (err) {
1199
- if (err instanceof Error) {
1200
- setError(err.message);
1201
- } else {
1202
- setError("An unknown error occurred");
1203
- }
1204
- }
1205
- };
1206
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 6, background: "neutral0", children: [
1207
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h1", textColor: "primary600", style: { marginBottom: "2rem" }, children: "Subscriptions" }),
1208
- error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", style: { marginBottom: "1rem" }, children: error }),
1209
- loading && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Loading subscriptions..." }),
1210
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Root, { children: [
1211
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { children: "Create subscription" }) }),
1212
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
1213
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: currentSubscription ? currentSubscription.id ? "Edit Subscription" : "Create Subscription" : "Subscription" }) }),
1214
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
1215
- formik.Formik,
1216
- {
1217
- initialValues: {
1218
- id: currentSubscription?.id || 0,
1219
- product: currentSubscription?.product || { documentId: "", name: "", description: "", id: 0 },
1220
- user: currentSubscription?.user || { id: 0, email: "" },
1221
- status: currentSubscription?.status || "active",
1222
- startDate: currentSubscription?.startDate || (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
1223
- endDate: currentSubscription?.endDate || ""
1224
- },
1225
- onSubmit: handleSubmit,
1226
- children: ({ values, handleChange, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsx(formik.Form, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 4, children: [
1227
- /* @__PURE__ */ jsxRuntime.jsxs(
1228
- designSystem.SingleSelect,
1229
- {
1230
- placeholder: "Product",
1231
- name: "product.documentId",
1232
- value: values.product.documentId || "",
1233
- onChange: (selectedDocumentId) => {
1234
- setFieldValue("product", products.find((product) => product.documentId === selectedDocumentId));
1235
- setFieldValue("product.documentId", selectedDocumentId);
1236
- },
1237
- required: true,
1238
- children: [
1239
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "", children: "Select a product" }),
1240
- products.map((product) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: product.documentId, children: product.name }, product.id))
1241
- ]
1242
- }
1243
- ),
1244
- /* @__PURE__ */ jsxRuntime.jsx(
1245
- designSystem.TextInput,
1246
- {
1247
- placeholder: "User Email",
1248
- name: "user.email",
1249
- value: values.user.email,
1250
- onChange: handleChange,
1251
- required: true
1252
- }
1253
- ),
1254
- /* @__PURE__ */ jsxRuntime.jsxs(
1255
- designSystem.SingleSelect,
1256
- {
1257
- placeholder: "Status",
1258
- name: "status",
1259
- value: values.status,
1260
- onChange: (selectedStatus) => {
1261
- setFieldValue("status", selectedStatus);
1262
- },
1263
- children: [
1264
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "active", children: "Active" }),
1265
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "canceled", children: "Canceled" }),
1266
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "past_due", children: "Past Due" }),
1267
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "unpaid", children: "Unpaid" }),
1268
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "trialing", children: "Trialing" })
1269
- ]
1270
- }
1271
- ),
1272
- /* @__PURE__ */ jsxRuntime.jsx(
1273
- designSystem.TextInput,
1274
- {
1275
- placeholder: "Start Date",
1276
- name: "startDate",
1277
- type: "date",
1278
- value: values.startDate,
1279
- onChange: handleChange,
1280
- required: true
1281
- }
1282
- ),
1283
- /* @__PURE__ */ jsxRuntime.jsx(
1284
- designSystem.TextInput,
1285
- {
1286
- placeholder: "End Date",
1287
- name: "endDate",
1288
- type: "date",
1289
- value: values.endDate,
1290
- onChange: handleChange
1291
- }
1292
- ),
1293
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", style: { marginTop: "1rem" }, children: currentSubscription?.id ? "Update" : "Create" })
1294
- ] }) })
1295
- }
1296
- ) }) })
1297
- ] })
1298
- ] }),
1299
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: subscriptions.map((subscription) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
1300
- designSystem.Box,
1301
- {
1302
- padding: 4,
1303
- background: "neutral100",
1304
- borderRadius: "4px",
1305
- border: "1px solid #e0e0e0",
1306
- children: [
1307
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h2", textColor: "neutral800", children: subscription.product.name }),
1308
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
1309
- "User: ",
1310
- subscription.user.email
1311
- ] }),
1312
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
1313
- "Status: ",
1314
- subscription.status
1315
- ] }),
1316
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
1317
- "Start Date: ",
1318
- subscription.startDate
1319
- ] }),
1320
- subscription.endDate && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
1321
- "End Date: ",
1322
- subscription.endDate
1323
- ] }),
1324
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", style: { marginTop: "1rem" }, children: subscription.stripeSubscriptionId ? "✅ Synced with Stripe" : "⚠️ Not synced with Stripe" }),
1325
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { style: { marginTop: "1rem", gap: "1rem" }, children: [
1326
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: () => handleEdit(subscription), children: "Edit" }),
1327
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "danger", onClick: () => handleDelete(subscription.id), children: "Delete" }),
1328
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: () => handleSync(subscription.id), children: subscription.stripeSubscriptionId ? "Sync" : "Create in Stripe" })
1329
- ] })
1330
- ]
1331
- },
1332
- subscription.id
1333
- ) }, subscription.id)) })
1334
- ] }) });
1335
- };
1336
- const NavigationMenu = () => {
1337
- return /* @__PURE__ */ jsxRuntime.jsxs(
1338
- designSystem.Box,
1339
- {
1340
- background: "neutral100",
1341
- padding: 4,
1342
- width: "200px",
1343
- height: "100vh",
1344
- position: "fixed",
1345
- top: 0,
1346
- left: 100,
1347
- children: [
1348
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", as: "h1", style: { marginBottom: "2rem" }, children: "Payment Plugin" }),
1349
- /* @__PURE__ */ jsxRuntime.jsx("nav", { children: /* @__PURE__ */ jsxRuntime.jsxs("ul", { style: { listStyle: "none", padding: 0, fontSize: "14px" }, children: [
1350
- /* @__PURE__ */ jsxRuntime.jsx("li", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1351
- reactRouterDom.NavLink,
1352
- {
1353
- to: "/plugins/strapi-payment-plugin/dashboard",
1354
- style: ({ isActive }) => ({
1355
- color: isActive ? "#7b79ff" : "inherit",
1356
- textDecoration: "none"
1357
- }),
1358
- children: "Dashboard"
1359
- }
1360
- ) }),
1361
- /* @__PURE__ */ jsxRuntime.jsx("li", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1362
- reactRouterDom.NavLink,
1363
- {
1364
- to: "/plugins/strapi-payment-plugin/transactions",
1365
- style: ({ isActive }) => ({
1366
- color: isActive ? "#7b79ff" : "inherit",
1367
- textDecoration: "none"
1368
- }),
1369
- children: "Transactions"
1370
- }
1371
- ) }),
1372
- /* @__PURE__ */ jsxRuntime.jsx("li", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1373
- reactRouterDom.NavLink,
1374
- {
1375
- to: "/plugins/strapi-payment-plugin/products",
1376
- style: ({ isActive }) => ({
1377
- color: isActive ? "#7b79ff" : "inherit",
1378
- textDecoration: "none"
1379
- }),
1380
- children: "Products"
1381
- }
1382
- ) }),
1383
- /* @__PURE__ */ jsxRuntime.jsx("li", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1384
- reactRouterDom.NavLink,
1385
- {
1386
- to: "/plugins/strapi-payment-plugin/subscriptions",
1387
- style: ({ isActive }) => ({
1388
- color: isActive ? "#7b79ff" : "inherit",
1389
- textDecoration: "none"
1390
- }),
1391
- children: "Subscriptions"
1392
- }
1393
- ) }),
1394
- /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
1395
- reactRouterDom.NavLink,
1396
- {
1397
- to: "/plugins/strapi-payment-plugin/configuration",
1398
- style: ({ isActive }) => ({
1399
- color: isActive ? "#7b79ff" : "inherit",
1400
- textDecoration: "none"
1401
- }),
1402
- children: "Configuration"
1403
- }
1404
- ) })
1405
- ] }) })
1406
- ]
1407
- }
1408
- );
1409
- };
1410
- const App = () => {
1411
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex" }, children: [
1412
- /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu, {}),
1413
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginLeft: "200px", flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
1414
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "dashboard" }) }),
1415
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/dashboard", element: /* @__PURE__ */ jsxRuntime.jsx(DashboardPage, {}) }),
1416
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/transactions", element: /* @__PURE__ */ jsxRuntime.jsx(TransactionsPage, {}) }),
1417
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/products", element: /* @__PURE__ */ jsxRuntime.jsx(ProductsPage, {}) }),
1418
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/subscriptions", element: /* @__PURE__ */ jsxRuntime.jsx(SubscriptionsPage, {}) }),
1419
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/configuration", element: /* @__PURE__ */ jsxRuntime.jsx(ConfigurationPage, {}) }),
1420
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
1421
- ] }) })
1422
- ] });
1423
- };
1424
- exports.App = App;