@reeboot/strapi-payment-plugin 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Analytics-nBSdLT2v.js → Analytics-CLjtRWYA.js} +68 -51
- package/dist/_chunks/{Analytics-DSJqY9ng.mjs → Analytics-CQmAVKsq.mjs} +68 -51
- package/dist/_chunks/App-DXN62SV6.mjs +118 -0
- package/dist/_chunks/App-Dk7XtjNA.js +120 -0
- package/dist/_chunks/{Customers-BpFzfglV.js → Customers-BNDi4QBH.js} +113 -51
- package/dist/_chunks/{Customers-C6FH7-zG.mjs → Customers-BQzVBQDT.mjs} +114 -52
- package/dist/_chunks/Dashboard-CuHC-dit.mjs +311 -0
- package/dist/_chunks/Dashboard-UUwohHZa.js +311 -0
- package/dist/_chunks/{Orders-CBkT2YfP.mjs → Orders-65mNfu2i.mjs} +140 -80
- package/dist/_chunks/{Orders-OG-pwV-B.js → Orders-CitNCdWE.js} +139 -79
- package/dist/_chunks/PaymentList-B0CAzInT.mjs +137 -0
- package/dist/_chunks/PaymentList-Dy1BAFoD.js +136 -0
- package/dist/_chunks/{Payments-DSDJ-HWm.mjs → Payments-FnhoV_2B.mjs} +175 -136
- package/dist/_chunks/{Payments-BLen1P9N.js → Payments-TOnygGIW.js} +173 -134
- package/dist/_chunks/Settings-BJtDagUs.js +644 -0
- package/dist/_chunks/Settings-EoLSuZLe.mjs +644 -0
- package/dist/_chunks/{index-DS_PYNkf.mjs → index-2Zd_T7bD.mjs} +1 -1
- package/dist/_chunks/{index-BqqrpI6D.js → index-CHEgJ7e5.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/CustomerList.d.ts +1 -13
- package/dist/admin/src/components/IntegrationModal.d.ts +7 -0
- package/dist/admin/src/components/OrderList.d.ts +1 -19
- package/dist/admin/src/components/PaymentCard.d.ts +2 -33
- package/dist/admin/src/components/PaymentList.d.ts +3 -11
- package/dist/admin/src/components/RefundModal.d.ts +2 -8
- package/dist/admin/src/types/index.d.ts +47 -0
- package/dist/server/index.js +197 -91
- package/dist/server/index.mjs +197 -91
- package/dist/server/src/content-types/index.d.ts +9 -2
- package/dist/server/src/content-types/order/index.d.ts +8 -1
- package/dist/server/src/content-types/payment/index.d.ts +1 -1
- package/dist/server/src/index.d.ts +9 -2
- package/dist/server/src/types/api.d.ts +31 -0
- package/dist/server/src/types/customer.d.ts +2 -0
- package/dist/server/src/types/index.d.ts +4 -179
- package/dist/server/src/types/order.d.ts +2 -0
- package/dist/server/src/types/payment.d.ts +2 -0
- package/package.json +8 -7
- package/dist/_chunks/App-B83DZ9NG.js +0 -70
- package/dist/_chunks/App-BUSTbkyy.mjs +0 -68
- package/dist/_chunks/Dashboard-CNMTzSyc.js +0 -180
- package/dist/_chunks/Dashboard-Dbwl0ZBo.mjs +0 -180
- package/dist/_chunks/Settings-Dq1xy32B.js +0 -357
- package/dist/_chunks/Settings-jmGslDsB.mjs +0 -357
- package/dist/admin/src/pages/HomePage.d.ts +0 -2
|
@@ -1,179 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
amount: number;
|
|
6
|
-
currency: string;
|
|
7
|
-
status: PaymentStatus;
|
|
8
|
-
payment_method?: string;
|
|
9
|
-
metadata?: Record<string, any>;
|
|
10
|
-
customer?: string;
|
|
11
|
-
order?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface OrderInput {
|
|
14
|
-
order_number: string;
|
|
15
|
-
total_amount: number;
|
|
16
|
-
currency: string;
|
|
17
|
-
status: OrderStatus;
|
|
18
|
-
customer?: string;
|
|
19
|
-
items: Record<string, any>;
|
|
20
|
-
metadata?: Record<string, any>;
|
|
21
|
-
}
|
|
22
|
-
export interface CustomerInput {
|
|
23
|
-
email: string;
|
|
24
|
-
stripe_customer_id: string;
|
|
25
|
-
first_name: string;
|
|
26
|
-
last_name: string;
|
|
27
|
-
phone?: string;
|
|
28
|
-
address?: Record<string, any>;
|
|
29
|
-
metadata?: Record<string, any>;
|
|
30
|
-
}
|
|
31
|
-
export interface PaymentDocument {
|
|
32
|
-
documentId: string;
|
|
33
|
-
createdAt: string;
|
|
34
|
-
updatedAt: string;
|
|
35
|
-
publishedAt?: string;
|
|
36
|
-
amount: number;
|
|
37
|
-
currency: string;
|
|
38
|
-
status: PaymentStatus;
|
|
39
|
-
payment_method?: string;
|
|
40
|
-
metadata?: Record<string, any>;
|
|
41
|
-
stripe_payment_intent_id: string;
|
|
42
|
-
customer?: CustomerDocument;
|
|
43
|
-
order?: OrderDocument;
|
|
44
|
-
}
|
|
45
|
-
export interface OrderDocument {
|
|
46
|
-
documentId: string;
|
|
47
|
-
createdAt: string;
|
|
48
|
-
updatedAt: string;
|
|
49
|
-
publishedAt?: string;
|
|
50
|
-
order_number: string;
|
|
51
|
-
total_amount: number;
|
|
52
|
-
currency: string;
|
|
53
|
-
status: OrderStatus;
|
|
54
|
-
items: Record<string, any>;
|
|
55
|
-
metadata?: Record<string, any>;
|
|
56
|
-
customer?: CustomerDocument;
|
|
57
|
-
payments?: PaymentDocument[];
|
|
58
|
-
}
|
|
59
|
-
export interface CustomerDocument {
|
|
60
|
-
documentId: string;
|
|
61
|
-
createdAt: string;
|
|
62
|
-
updatedAt: string;
|
|
63
|
-
publishedAt?: string;
|
|
64
|
-
email: string;
|
|
65
|
-
stripe_customer_id: string;
|
|
66
|
-
first_name: string;
|
|
67
|
-
last_name: string;
|
|
68
|
-
phone?: string;
|
|
69
|
-
address?: Record<string, any>;
|
|
70
|
-
metadata?: Record<string, any>;
|
|
71
|
-
orders?: OrderDocument[];
|
|
72
|
-
payments?: PaymentDocument[];
|
|
73
|
-
}
|
|
74
|
-
export interface PaymentFilters {
|
|
75
|
-
stripe_payment_intent_id?: {
|
|
76
|
-
$eq: string;
|
|
77
|
-
};
|
|
78
|
-
amount?: {
|
|
79
|
-
$eq: number;
|
|
80
|
-
};
|
|
81
|
-
currency?: {
|
|
82
|
-
$eq: string;
|
|
83
|
-
};
|
|
84
|
-
status?: {
|
|
85
|
-
$eq: PaymentStatus;
|
|
86
|
-
};
|
|
87
|
-
payment_method?: {
|
|
88
|
-
$eq: string;
|
|
89
|
-
};
|
|
90
|
-
customer?: {
|
|
91
|
-
$eq: string;
|
|
92
|
-
};
|
|
93
|
-
order?: {
|
|
94
|
-
$eq: string;
|
|
95
|
-
};
|
|
96
|
-
createdAt?: {
|
|
97
|
-
$gte: string;
|
|
98
|
-
$lte: string;
|
|
99
|
-
};
|
|
100
|
-
$or?: PaymentFilters[];
|
|
101
|
-
}
|
|
102
|
-
export interface OrderFilters {
|
|
103
|
-
order_number?: {
|
|
104
|
-
$eq: string;
|
|
105
|
-
};
|
|
106
|
-
total_amount?: {
|
|
107
|
-
$eq: number;
|
|
108
|
-
};
|
|
109
|
-
currency?: {
|
|
110
|
-
$eq: string;
|
|
111
|
-
};
|
|
112
|
-
status?: {
|
|
113
|
-
$eq: OrderStatus;
|
|
114
|
-
};
|
|
115
|
-
customer?: {
|
|
116
|
-
$eq: string;
|
|
117
|
-
};
|
|
118
|
-
createdAt?: {
|
|
119
|
-
$gte: string;
|
|
120
|
-
$lte: string;
|
|
121
|
-
};
|
|
122
|
-
$or?: OrderFilters[];
|
|
123
|
-
}
|
|
124
|
-
export interface CustomerFilters {
|
|
125
|
-
email?: {
|
|
126
|
-
$eq: string;
|
|
127
|
-
$containsi: string;
|
|
128
|
-
};
|
|
129
|
-
stripe_customer_id?: {
|
|
130
|
-
$eq: string;
|
|
131
|
-
};
|
|
132
|
-
first_name?: {
|
|
133
|
-
$eq: string;
|
|
134
|
-
$containsi: string;
|
|
135
|
-
};
|
|
136
|
-
last_name?: {
|
|
137
|
-
$eq: string;
|
|
138
|
-
$containsi: string;
|
|
139
|
-
};
|
|
140
|
-
createdAt?: {
|
|
141
|
-
$gte: string;
|
|
142
|
-
$lte: string;
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
export interface ApiResponse<T> {
|
|
146
|
-
success: boolean;
|
|
147
|
-
data: T;
|
|
148
|
-
meta?: {
|
|
149
|
-
pagination?: {
|
|
150
|
-
page: number;
|
|
151
|
-
pageSize: number;
|
|
152
|
-
pageCount: number;
|
|
153
|
-
total: number;
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
export interface StripePaymentIntent {
|
|
158
|
-
id: string;
|
|
159
|
-
amount: number;
|
|
160
|
-
currency: string;
|
|
161
|
-
status: string;
|
|
162
|
-
created: number;
|
|
163
|
-
metadata: Record<string, string>;
|
|
164
|
-
client_secret?: string;
|
|
165
|
-
}
|
|
166
|
-
export interface StripeCustomer {
|
|
167
|
-
id: string;
|
|
168
|
-
email?: string;
|
|
169
|
-
name?: string;
|
|
170
|
-
created: number;
|
|
171
|
-
metadata: Record<string, string>;
|
|
172
|
-
}
|
|
173
|
-
export interface StripeRefund {
|
|
174
|
-
id: string;
|
|
175
|
-
amount: number;
|
|
176
|
-
currency: string;
|
|
177
|
-
status: string;
|
|
178
|
-
reason?: string;
|
|
179
|
-
}
|
|
1
|
+
export * from './customer';
|
|
2
|
+
export * from './order';
|
|
3
|
+
export * from './payment';
|
|
4
|
+
export * from './api';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.5",
|
|
3
3
|
"keywords": [],
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"exports": {
|
|
@@ -32,27 +32,28 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@strapi/design-system": "^2.1.0",
|
|
35
|
-
"@strapi/ui-primitives": "^2.1.0",
|
|
36
35
|
"@strapi/icons": "^2.1.0",
|
|
36
|
+
"@strapi/ui-primitives": "^2.1.0",
|
|
37
|
+
"@stripe/stripe-js": "^8.6.1",
|
|
37
38
|
"react-intl": "^8.0.9",
|
|
38
39
|
"stripe": "^16.0.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@strapi/strapi": "^5.33.1",
|
|
42
42
|
"@strapi/sdk-plugin": "^5.4.0",
|
|
43
|
+
"@strapi/strapi": "^5.33.1",
|
|
44
|
+
"@strapi/typescript-utils": "^5.33.1",
|
|
45
|
+
"@types/react": "^19.2.7",
|
|
46
|
+
"@types/react-dom": "^19.2.3",
|
|
43
47
|
"prettier": "^3.7.4",
|
|
44
48
|
"react": "^18.3.1",
|
|
45
49
|
"react-dom": "^18.3.1",
|
|
46
50
|
"react-router-dom": "^6.30.2",
|
|
47
51
|
"styled-components": "^6.1.19",
|
|
48
|
-
"@types/react": "^19.2.7",
|
|
49
|
-
"@types/react-dom": "^19.2.3",
|
|
50
|
-
"@strapi/typescript-utils": "^5.33.1",
|
|
51
52
|
"typescript": "^5.9.3"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
|
-
"@strapi/strapi": "^5.33.1",
|
|
55
55
|
"@strapi/sdk-plugin": "^5.4.0",
|
|
56
|
+
"@strapi/strapi": "^5.33.1",
|
|
56
57
|
"react": "^18.3.1",
|
|
57
58
|
"react-dom": "^18.3.1",
|
|
58
59
|
"react-router-dom": "^6.30.2",
|
|
@@ -1,70 +0,0 @@
|
|
|
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;
|
|
@@ -1,68 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,180 +0,0 @@
|
|
|
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 admin = require("@strapi/strapi/admin");
|
|
7
|
-
const reactIntl = require("react-intl");
|
|
8
|
-
const index = require("./index-BqqrpI6D.js");
|
|
9
|
-
const Dashboard = () => {
|
|
10
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
11
|
-
const { get, post } = admin.useFetchClient();
|
|
12
|
-
const [stats, setStats] = React.useState(null);
|
|
13
|
-
const [recentPayments, setRecentPayments] = React.useState([]);
|
|
14
|
-
const [loading, setLoading] = React.useState(true);
|
|
15
|
-
const [error, setError] = React.useState(null);
|
|
16
|
-
const [creatingTest, setCreatingTest] = React.useState(false);
|
|
17
|
-
React.useEffect(() => {
|
|
18
|
-
fetchDashboardData();
|
|
19
|
-
}, []);
|
|
20
|
-
const fetchDashboardData = async () => {
|
|
21
|
-
try {
|
|
22
|
-
setLoading(true);
|
|
23
|
-
const { data } = await get(`/${index.PLUGIN_ID}/admin/dashboard`);
|
|
24
|
-
if (data.success && data.data) {
|
|
25
|
-
setStats({
|
|
26
|
-
totalRevenue: data.data.summary.totalRevenue,
|
|
27
|
-
totalPayments: data.data.summary.totalPayments,
|
|
28
|
-
successfulPayments: data.data.summary.successfulPayments,
|
|
29
|
-
pendingPayments: data.data.summary.totalPayments - data.data.summary.successfulPayments - data.data.summary.failedPayments,
|
|
30
|
-
failedPayments: data.data.summary.failedPayments,
|
|
31
|
-
totalCustomers: data.data.topCustomers.length,
|
|
32
|
-
// Rough estimate
|
|
33
|
-
totalOrders: data.data.summary.totalPayments,
|
|
34
|
-
// Rough estimate
|
|
35
|
-
averageOrderValue: data.data.summary.totalPayments > 0 ? data.data.summary.totalRevenue / data.data.summary.totalPayments : 0
|
|
36
|
-
});
|
|
37
|
-
const formattedPayments = data.data.recentTransactions.map((p) => ({
|
|
38
|
-
id: p.documentId,
|
|
39
|
-
amount: p.amount,
|
|
40
|
-
currency: p.currency,
|
|
41
|
-
status: p.status,
|
|
42
|
-
customerEmail: p.customer?.email || "N/A",
|
|
43
|
-
createdAt: p.createdAt,
|
|
44
|
-
paymentMethod: p.payment_method || "N/A"
|
|
45
|
-
}));
|
|
46
|
-
setRecentPayments(formattedPayments);
|
|
47
|
-
}
|
|
48
|
-
setLoading(false);
|
|
49
|
-
} catch (err) {
|
|
50
|
-
setError("Failed to fetch dashboard data");
|
|
51
|
-
setLoading(false);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const createTestPayment = async () => {
|
|
55
|
-
try {
|
|
56
|
-
setCreatingTest(true);
|
|
57
|
-
const { data } = await post(`/${index.PLUGIN_ID}/admin/create-sample-payment`);
|
|
58
|
-
if (data.success) {
|
|
59
|
-
alert(`Payment flow successfully initialized!
|
|
60
|
-
Customer: ${data.data.customer.email}
|
|
61
|
-
Order: ${data.data.order.documentId}
|
|
62
|
-
Stripe Payment Intent: ${data.data.stripePaymentIntent.id}
|
|
63
|
-
Status: ${data.data.stripePaymentIntent.status}`);
|
|
64
|
-
} else {
|
|
65
|
-
throw new Error(data.error?.message || "Failed to process payment");
|
|
66
|
-
}
|
|
67
|
-
await fetchDashboardData();
|
|
68
|
-
} catch (err) {
|
|
69
|
-
console.error("Failed to process payment", err);
|
|
70
|
-
alert(err instanceof Error ? err.message : "An error occurred during payment initialization");
|
|
71
|
-
} finally {
|
|
72
|
-
setCreatingTest(false);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const formatCurrency = (amount, currency = "USD") => {
|
|
76
|
-
return new Intl.NumberFormat("en-US", {
|
|
77
|
-
style: "currency",
|
|
78
|
-
currency
|
|
79
|
-
}).format(amount);
|
|
80
|
-
};
|
|
81
|
-
const formatDate = (dateString) => {
|
|
82
|
-
return new Date(dateString).toLocaleDateString("en-US", {
|
|
83
|
-
year: "numeric",
|
|
84
|
-
month: "short",
|
|
85
|
-
day: "numeric",
|
|
86
|
-
hour: "2-digit",
|
|
87
|
-
minute: "2-digit"
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
const getStatusBadge = (status) => {
|
|
91
|
-
const statusConfig = {
|
|
92
|
-
succeeded: { color: "success", labelId: "payment-plugin.payments.succeeded", defaultLabel: "Success" },
|
|
93
|
-
pending: { color: "warning", labelId: "payment-plugin.payments.pending", defaultLabel: "Pending" },
|
|
94
|
-
failed: { color: "danger", labelId: "payment-plugin.payments.failed", defaultLabel: "Failed" },
|
|
95
|
-
refunded: { color: "info", labelId: "payment-plugin.payments.refunded", defaultLabel: "Refunded" }
|
|
96
|
-
};
|
|
97
|
-
const config = statusConfig[status] || statusConfig.pending;
|
|
98
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { size: "S", backgroundColor: config.color, children: formatMessage({ id: config.labelId, defaultMessage: config.defaultLabel }) });
|
|
99
|
-
};
|
|
100
|
-
if (loading) {
|
|
101
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }) });
|
|
102
|
-
}
|
|
103
|
-
if (error) {
|
|
104
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
-
designSystem.EmptyStateLayout,
|
|
106
|
-
{
|
|
107
|
-
title: "Error loading dashboard",
|
|
108
|
-
subtitle: error,
|
|
109
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: fetchDashboardData, children: formatMessage({ id: "payment-plugin.dashboard.retry", defaultMessage: "Retry" }) })
|
|
110
|
-
}
|
|
111
|
-
) });
|
|
112
|
-
}
|
|
113
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: [
|
|
114
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
115
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
116
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.dashboard.title", defaultMessage: "Payment Dashboard" }) }),
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
|
|
118
|
-
id: "payment-plugin.dashboard.subtitle",
|
|
119
|
-
defaultMessage: "Overview of your payment operations"
|
|
120
|
-
}) })
|
|
121
|
-
] }),
|
|
122
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
-
designSystem.Button,
|
|
124
|
-
{
|
|
125
|
-
onClick: createTestPayment,
|
|
126
|
-
loading: creatingTest,
|
|
127
|
-
variant: "secondary",
|
|
128
|
-
children: formatMessage({ id: "payment-plugin.dashboard.initPayment", defaultMessage: "Initialize Sample Payment" })
|
|
129
|
-
}
|
|
130
|
-
)
|
|
131
|
-
] }) }),
|
|
132
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, marginBottom: 8, children: [
|
|
133
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
134
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.totalRevenue", defaultMessage: "Total Revenue" }) }),
|
|
135
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: formatCurrency(stats?.totalRevenue || 0) })
|
|
136
|
-
] }) }) }) }),
|
|
137
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
138
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.totalPayments", defaultMessage: "Total Payments" }) }),
|
|
139
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: stats?.totalPayments || 0 })
|
|
140
|
-
] }) }) }) }),
|
|
141
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
142
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.successRate", defaultMessage: "Success Rate" }) }),
|
|
143
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: [
|
|
144
|
-
stats ? Math.round(stats.successfulPayments / stats.totalPayments * 100) : 0,
|
|
145
|
-
"%"
|
|
146
|
-
] })
|
|
147
|
-
] }) }) }) }),
|
|
148
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
149
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.averageOrderValue", defaultMessage: "Average Order Value" }) }),
|
|
150
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: formatCurrency(stats?.averageOrderValue || 0) })
|
|
151
|
-
] }) }) }) })
|
|
152
|
-
] }),
|
|
153
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
|
|
154
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, children: [
|
|
155
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage({ id: "payment-plugin.dashboard.recentPayments", defaultMessage: "Recent Payments" }) }),
|
|
156
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", size: "S", children: formatMessage({ id: "payment-plugin.dashboard.viewAll", defaultMessage: "View All" }) })
|
|
157
|
-
] }),
|
|
158
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { children: [
|
|
159
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
160
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.customer", defaultMessage: "Customer" }) }) }),
|
|
161
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.amount", defaultMessage: "Amount" }) }) }),
|
|
162
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.status", defaultMessage: "Status" }) }) }),
|
|
163
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.paymentMethod", defaultMessage: "Payment Method" }) }) }),
|
|
164
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.date", defaultMessage: "Date" }) }) })
|
|
165
|
-
] }) }),
|
|
166
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: recentPayments.map((payment) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
167
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: payment.customerEmail }) }),
|
|
168
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(payment.amount, payment.currency) }) }),
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getStatusBadge(payment.status) }),
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
171
|
-
id: `payment-plugin.payments.${payment.paymentMethod}`,
|
|
172
|
-
defaultMessage: payment.paymentMethod
|
|
173
|
-
}) }) }),
|
|
174
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatDate(payment.createdAt) }) })
|
|
175
|
-
] }, payment.id)) })
|
|
176
|
-
] })
|
|
177
|
-
] }) })
|
|
178
|
-
] });
|
|
179
|
-
};
|
|
180
|
-
exports.Dashboard = Dashboard;
|