@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.
Files changed (46) hide show
  1. package/dist/_chunks/{Analytics-nBSdLT2v.js → Analytics-CLjtRWYA.js} +68 -51
  2. package/dist/_chunks/{Analytics-DSJqY9ng.mjs → Analytics-CQmAVKsq.mjs} +68 -51
  3. package/dist/_chunks/App-DXN62SV6.mjs +118 -0
  4. package/dist/_chunks/App-Dk7XtjNA.js +120 -0
  5. package/dist/_chunks/{Customers-BpFzfglV.js → Customers-BNDi4QBH.js} +113 -51
  6. package/dist/_chunks/{Customers-C6FH7-zG.mjs → Customers-BQzVBQDT.mjs} +114 -52
  7. package/dist/_chunks/Dashboard-CuHC-dit.mjs +311 -0
  8. package/dist/_chunks/Dashboard-UUwohHZa.js +311 -0
  9. package/dist/_chunks/{Orders-CBkT2YfP.mjs → Orders-65mNfu2i.mjs} +140 -80
  10. package/dist/_chunks/{Orders-OG-pwV-B.js → Orders-CitNCdWE.js} +139 -79
  11. package/dist/_chunks/PaymentList-B0CAzInT.mjs +137 -0
  12. package/dist/_chunks/PaymentList-Dy1BAFoD.js +136 -0
  13. package/dist/_chunks/{Payments-DSDJ-HWm.mjs → Payments-FnhoV_2B.mjs} +175 -136
  14. package/dist/_chunks/{Payments-BLen1P9N.js → Payments-TOnygGIW.js} +173 -134
  15. package/dist/_chunks/Settings-BJtDagUs.js +644 -0
  16. package/dist/_chunks/Settings-EoLSuZLe.mjs +644 -0
  17. package/dist/_chunks/{index-DS_PYNkf.mjs → index-2Zd_T7bD.mjs} +1 -1
  18. package/dist/_chunks/{index-BqqrpI6D.js → index-CHEgJ7e5.js} +1 -1
  19. package/dist/admin/index.js +1 -1
  20. package/dist/admin/index.mjs +1 -1
  21. package/dist/admin/src/components/CustomerList.d.ts +1 -13
  22. package/dist/admin/src/components/IntegrationModal.d.ts +7 -0
  23. package/dist/admin/src/components/OrderList.d.ts +1 -19
  24. package/dist/admin/src/components/PaymentCard.d.ts +2 -33
  25. package/dist/admin/src/components/PaymentList.d.ts +3 -11
  26. package/dist/admin/src/components/RefundModal.d.ts +2 -8
  27. package/dist/admin/src/types/index.d.ts +47 -0
  28. package/dist/server/index.js +197 -91
  29. package/dist/server/index.mjs +197 -91
  30. package/dist/server/src/content-types/index.d.ts +9 -2
  31. package/dist/server/src/content-types/order/index.d.ts +8 -1
  32. package/dist/server/src/content-types/payment/index.d.ts +1 -1
  33. package/dist/server/src/index.d.ts +9 -2
  34. package/dist/server/src/types/api.d.ts +31 -0
  35. package/dist/server/src/types/customer.d.ts +2 -0
  36. package/dist/server/src/types/index.d.ts +4 -179
  37. package/dist/server/src/types/order.d.ts +2 -0
  38. package/dist/server/src/types/payment.d.ts +2 -0
  39. package/package.json +8 -7
  40. package/dist/_chunks/App-B83DZ9NG.js +0 -70
  41. package/dist/_chunks/App-BUSTbkyy.mjs +0 -68
  42. package/dist/_chunks/Dashboard-CNMTzSyc.js +0 -180
  43. package/dist/_chunks/Dashboard-Dbwl0ZBo.mjs +0 -180
  44. package/dist/_chunks/Settings-Dq1xy32B.js +0 -357
  45. package/dist/_chunks/Settings-jmGslDsB.mjs +0 -357
  46. package/dist/admin/src/pages/HomePage.d.ts +0 -2
@@ -1,357 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { Box, Flex, Typography, Alert, Button, Grid, Card, TextInput, SingleSelect, SingleSelectOption, Switch } from "@strapi/design-system";
4
- import { useIntl } from "react-intl";
5
- import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
- const Settings = () => {
8
- const { formatMessage } = useIntl();
9
- const { get, put } = useFetchClient();
10
- const [settings, setSettings] = useState(null);
11
- const [loading, setLoading] = useState(true);
12
- const [saving, setSaving] = useState(false);
13
- const [error, setError] = useState(null);
14
- const [success, setSuccess] = useState(null);
15
- const [hasChanges, setHasChanges] = useState(false);
16
- useEffect(() => {
17
- fetchSettings();
18
- }, []);
19
- const fetchSettings = async () => {
20
- try {
21
- setLoading(true);
22
- const { data } = await get(`/${PLUGIN_ID}/admin/config`);
23
- if (data.success && data.data) {
24
- const backendConfig = data.data;
25
- const initialSettings = {
26
- stripe: {
27
- publishableKey: backendConfig.stripe?.publishableKey || "",
28
- secretKey: backendConfig.stripe?.secretKey || "",
29
- webhookSecret: backendConfig.stripe?.webhookSecret || "",
30
- apiVersion: backendConfig.stripe?.apiVersion || "2023-10-16",
31
- enabled: backendConfig.stripe?.enabled ?? true
32
- },
33
- payments: {
34
- defaultCurrency: backendConfig.payment?.defaultCurrency || "usd",
35
- supportedCurrencies: backendConfig.payment?.supportedCurrencies || ["usd"],
36
- enableRefunds: backendConfig.payment?.enableRefunds ?? true,
37
- enablePartialRefunds: backendConfig.payment?.enablePartialRefunds ?? true,
38
- refundWindow: backendConfig.payment?.refundWindow || 30,
39
- captureMethod: backendConfig.payment?.captureMethod || "automatic",
40
- confirmationMethod: backendConfig.payment?.confirmationMethod || "automatic"
41
- },
42
- webhooks: {
43
- enabled: true,
44
- endpoints: {
45
- paymentSucceeded: "",
46
- paymentFailed: "",
47
- refundCreated: "",
48
- invoiceCreated: ""
49
- },
50
- retries: 3,
51
- timeout: 30
52
- },
53
- ui: {
54
- showPaymentStatus: true,
55
- showCustomerInfo: true,
56
- enableNotifications: true,
57
- theme: "auto",
58
- compactView: false
59
- },
60
- security: {
61
- enableIpFiltering: false,
62
- allowedIps: [],
63
- requireAuthentication: true,
64
- enableAuditLog: true,
65
- sessionTimeout: 60
66
- }
67
- };
68
- setSettings(initialSettings);
69
- }
70
- setLoading(false);
71
- } catch (err) {
72
- setError("Failed to fetch settings");
73
- setLoading(false);
74
- }
75
- };
76
- const handleSettingChange = (section, key, value) => {
77
- if (!settings) return;
78
- setSettings((prev) => ({
79
- ...prev,
80
- [section]: {
81
- ...prev[section],
82
- [key]: value
83
- }
84
- }));
85
- setHasChanges(true);
86
- setSuccess(null);
87
- };
88
- const saveSettings = async () => {
89
- try {
90
- setSaving(true);
91
- setError(null);
92
- if (!settings) return;
93
- const payload = {
94
- stripe: settings.stripe,
95
- payment: settings.payments,
96
- logging: {
97
- enableWebhookLogging: true
98
- }
99
- };
100
- await put(`/${PLUGIN_ID}/admin/config`, payload);
101
- setHasChanges(false);
102
- setSuccess("Settings saved successfully");
103
- setTimeout(() => setSuccess(null), 3e3);
104
- } catch (err) {
105
- setError("Failed to save settings");
106
- } finally {
107
- setSaving(false);
108
- }
109
- };
110
- const resetSettings = () => {
111
- if (confirm("Are you sure you want to reset all settings to default? This action cannot be undone.")) {
112
- fetchSettings();
113
- setHasChanges(false);
114
- }
115
- };
116
- const testConnection = async () => {
117
- try {
118
- setSaving(true);
119
- const { data } = await get(`/${PLUGIN_ID}/admin/config`);
120
- if (data.success) {
121
- alert("Connection to backend successful!");
122
- } else {
123
- throw new Error("Failed to connect");
124
- }
125
- } catch (err) {
126
- alert("Connection test failed. Please check your API keys and server logs.");
127
- } finally {
128
- setSaving(false);
129
- }
130
- };
131
- if (loading) {
132
- return /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsx(Typography, { variant: "beta", children: formatMessage({ id: "payment-plugin.settings.loading", defaultMessage: "Loading settings..." }) }) }) });
133
- }
134
- if (!settings) {
135
- return /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Alert, { severity: "danger", children: formatMessage({ id: "payment-plugin.settings.error", defaultMessage: "Failed to load settings" }) }) });
136
- }
137
- return /* @__PURE__ */ jsxs(Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: [
138
- /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
139
- /* @__PURE__ */ jsxs(Box, { children: [
140
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.settings.title", defaultMessage: "Payment Settings" }) }),
141
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
142
- id: "payment-plugin.settings.subtitle",
143
- defaultMessage: "Configure your payment plugin settings"
144
- }) })
145
- ] }),
146
- /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
147
- hasChanges && /* @__PURE__ */ jsx(Alert, { variant: "warning", style: { marginRight: "1rem" }, children: formatMessage({ id: "payment-plugin.settings.unsaved", defaultMessage: "You have unsaved changes" }) }),
148
- /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: resetSettings, children: formatMessage({ id: "payment-plugin.settings.reset", defaultMessage: "Reset" }) }),
149
- /* @__PURE__ */ jsx(
150
- Button,
151
- {
152
- variant: "secondary",
153
- onClick: testConnection,
154
- disabled: saving,
155
- children: formatMessage({ id: "payment-plugin.settings.testConnection", defaultMessage: "Test Connection" })
156
- }
157
- ),
158
- /* @__PURE__ */ jsx(
159
- Button,
160
- {
161
- onClick: saveSettings,
162
- disabled: !hasChanges || saving,
163
- loading: saving,
164
- children: formatMessage({ id: "payment-plugin.settings.save", defaultMessage: "Save Settings" })
165
- }
166
- )
167
- ] })
168
- ] }) }),
169
- error && /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(Alert, { variant: "danger", onClose: () => setError(null), children: error }) }),
170
- success && /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(Alert, { variant: "success", onClose: () => setSuccess(null), children: success }) }),
171
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 6, children: [
172
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
173
- /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.stripe", defaultMessage: "Stripe Configuration" }) }),
174
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
175
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
176
- TextInput,
177
- {
178
- label: formatMessage({ id: "payment-plugin.settings.publishableKey", defaultMessage: "Publishable Key" }),
179
- placeholder: "pk_test_...",
180
- value: settings.stripe.publishableKey,
181
- onChange: (e) => handleSettingChange("stripe", "publishableKey", e.target.value)
182
- }
183
- ) }),
184
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
185
- TextInput,
186
- {
187
- label: formatMessage({ id: "payment-plugin.settings.secretKey", defaultMessage: "Secret Key" }),
188
- placeholder: "sk_test_...",
189
- value: settings.stripe.secretKey,
190
- onChange: (e) => handleSettingChange("stripe", "secretKey", e.target.value),
191
- type: "password"
192
- }
193
- ) }),
194
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
195
- TextInput,
196
- {
197
- label: formatMessage({ id: "payment-plugin.settings.webhookSecret", defaultMessage: "Webhook Secret" }),
198
- placeholder: "whsec_...",
199
- value: settings.stripe.webhookSecret,
200
- onChange: (e) => handleSettingChange("stripe", "webhookSecret", e.target.value),
201
- type: "password"
202
- }
203
- ) }),
204
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsxs(
205
- SingleSelect,
206
- {
207
- label: formatMessage({ id: "payment-plugin.settings.apiVersion", defaultMessage: "API Version" }),
208
- value: settings.stripe.apiVersion,
209
- onChange: (value) => handleSettingChange("stripe", "apiVersion", value),
210
- children: [
211
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "2024-06-20", children: "2024-06-20 (Latest)" }),
212
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "2023-10-16", children: "2023-10-16" }),
213
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "2023-08-15", children: "2023-08-15" })
214
- ]
215
- }
216
- ) }),
217
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
218
- /* @__PURE__ */ jsx(
219
- Switch,
220
- {
221
- label: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Enable Stripe Payments" }),
222
- selected: settings.stripe.enabled,
223
- onChange: () => handleSettingChange("stripe", "enabled", !settings.stripe.enabled)
224
- }
225
- ),
226
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Enable Stripe Payments" }) })
227
- ] }) })
228
- ] })
229
- ] }) }) }),
230
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
231
- /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.payments", defaultMessage: "Payment Settings" }) }),
232
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
233
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(
234
- SingleSelect,
235
- {
236
- label: formatMessage({ id: "payment-plugin.settings.defaultCurrency", defaultMessage: "Default Currency" }),
237
- value: settings.payments.defaultCurrency,
238
- onChange: (value) => handleSettingChange("payments", "defaultCurrency", value),
239
- children: [
240
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "usd", children: "USD" }),
241
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "eur", children: "EUR" }),
242
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "gbp", children: "GBP" }),
243
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "cad", children: "CAD" }),
244
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "aud", children: "AUD" })
245
- ]
246
- }
247
- ) }),
248
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(
249
- SingleSelect,
250
- {
251
- label: formatMessage({ id: "payment-plugin.settings.captureMethod", defaultMessage: "Capture Method" }),
252
- value: settings.payments.captureMethod,
253
- onChange: (value) => handleSettingChange("payments", "captureMethod", value),
254
- children: [
255
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "automatic", children: "Automatic" }),
256
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "manual", children: "Manual" })
257
- ]
258
- }
259
- ) }),
260
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(
261
- TextInput,
262
- {
263
- label: formatMessage({ id: "payment-plugin.settings.refundWindow", defaultMessage: "Refund Window (Days)" }),
264
- type: "number",
265
- value: settings.payments.refundWindow.toString(),
266
- onChange: (e) => handleSettingChange("payments", "refundWindow", parseInt(e.target.value) || 0)
267
- }
268
- ) })
269
- ] })
270
- ] }) }) }),
271
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
272
- /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.security", defaultMessage: "Security Settings" }) }),
273
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
274
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
275
- /* @__PURE__ */ jsx(
276
- Switch,
277
- {
278
- label: formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Require Authentication" }),
279
- selected: settings.security.requireAuthentication,
280
- onChange: () => handleSettingChange("security", "requireAuthentication", !settings.security.requireAuthentication)
281
- }
282
- ),
283
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Require Authentication" }) })
284
- ] }) }),
285
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
286
- /* @__PURE__ */ jsx(
287
- Switch,
288
- {
289
- label: formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Enable Audit Log" }),
290
- selected: settings.security.enableAuditLog,
291
- onChange: () => handleSettingChange("security", "enableAuditLog", !settings.security.enableAuditLog)
292
- }
293
- ),
294
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Enable Audit Log" }) })
295
- ] }) }),
296
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(
297
- TextInput,
298
- {
299
- label: formatMessage({ id: "payment-plugin.settings.sessionTimeout", defaultMessage: "Session Timeout (Minutes)" }),
300
- type: "number",
301
- value: settings.security.sessionTimeout.toString(),
302
- onChange: (e) => handleSettingChange("security", "sessionTimeout", parseInt(e.target.value) || 60)
303
- }
304
- ) })
305
- ] })
306
- ] }) }) }),
307
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
308
- /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.ui", defaultMessage: "User Interface Settings" }) }),
309
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
310
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
311
- /* @__PURE__ */ jsx(
312
- Switch,
313
- {
314
- checked: settings.ui.showPaymentStatus,
315
- onChange: (checked) => handleSettingChange("ui", "showPaymentStatus", checked)
316
- }
317
- ),
318
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({ id: "payment-plugin.settings.showStatus", defaultMessage: "Show Payment Status" }) })
319
- ] }) }),
320
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
321
- /* @__PURE__ */ jsx(
322
- Switch,
323
- {
324
- checked: settings.ui.showCustomerInfo,
325
- onChange: (checked) => handleSettingChange("ui", "showCustomerInfo", checked)
326
- }
327
- ),
328
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({ id: "payment-plugin.settings.showCustomerInfo", defaultMessage: "Show Customer Info" }) })
329
- ] }) }),
330
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
331
- /* @__PURE__ */ jsx(
332
- Switch,
333
- {
334
- checked: settings.ui.enableNotifications,
335
- onChange: (checked) => handleSettingChange("ui", "enableNotifications", checked)
336
- }
337
- ),
338
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({ id: "payment-plugin.settings.notifications", defaultMessage: "Enable Notifications" }) })
339
- ] }) }),
340
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
341
- /* @__PURE__ */ jsx(
342
- Switch,
343
- {
344
- checked: settings.ui.compactView,
345
- onChange: (checked) => handleSettingChange("ui", "compactView", checked)
346
- }
347
- ),
348
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({ id: "payment-plugin.settings.compactView", defaultMessage: "Compact View" }) })
349
- ] }) })
350
- ] })
351
- ] }) }) })
352
- ] })
353
- ] });
354
- };
355
- export {
356
- Settings
357
- };
@@ -1,2 +0,0 @@
1
- declare const HomePage: () => import("react/jsx-runtime").JSX.Element;
2
- export { HomePage };