@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,180 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { Box, Flex, Loader, EmptyStateLayout, Button, Typography, Grid, Card, Table, Thead, Tr, Th, Tbody, Td, Badge } from "@strapi/design-system";
4
- import { useFetchClient } from "@strapi/strapi/admin";
5
- import { useIntl } from "react-intl";
6
- import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
- const Dashboard = () => {
8
- const { formatMessage } = useIntl();
9
- const { get, post } = useFetchClient();
10
- const [stats, setStats] = useState(null);
11
- const [recentPayments, setRecentPayments] = useState([]);
12
- const [loading, setLoading] = useState(true);
13
- const [error, setError] = useState(null);
14
- const [creatingTest, setCreatingTest] = useState(false);
15
- useEffect(() => {
16
- fetchDashboardData();
17
- }, []);
18
- const fetchDashboardData = async () => {
19
- try {
20
- setLoading(true);
21
- const { data } = await get(`/${PLUGIN_ID}/admin/dashboard`);
22
- if (data.success && data.data) {
23
- setStats({
24
- totalRevenue: data.data.summary.totalRevenue,
25
- totalPayments: data.data.summary.totalPayments,
26
- successfulPayments: data.data.summary.successfulPayments,
27
- pendingPayments: data.data.summary.totalPayments - data.data.summary.successfulPayments - data.data.summary.failedPayments,
28
- failedPayments: data.data.summary.failedPayments,
29
- totalCustomers: data.data.topCustomers.length,
30
- // Rough estimate
31
- totalOrders: data.data.summary.totalPayments,
32
- // Rough estimate
33
- averageOrderValue: data.data.summary.totalPayments > 0 ? data.data.summary.totalRevenue / data.data.summary.totalPayments : 0
34
- });
35
- const formattedPayments = data.data.recentTransactions.map((p) => ({
36
- id: p.documentId,
37
- amount: p.amount,
38
- currency: p.currency,
39
- status: p.status,
40
- customerEmail: p.customer?.email || "N/A",
41
- createdAt: p.createdAt,
42
- paymentMethod: p.payment_method || "N/A"
43
- }));
44
- setRecentPayments(formattedPayments);
45
- }
46
- setLoading(false);
47
- } catch (err) {
48
- setError("Failed to fetch dashboard data");
49
- setLoading(false);
50
- }
51
- };
52
- const createTestPayment = async () => {
53
- try {
54
- setCreatingTest(true);
55
- const { data } = await post(`/${PLUGIN_ID}/admin/create-sample-payment`);
56
- if (data.success) {
57
- alert(`Payment flow successfully initialized!
58
- Customer: ${data.data.customer.email}
59
- Order: ${data.data.order.documentId}
60
- Stripe Payment Intent: ${data.data.stripePaymentIntent.id}
61
- Status: ${data.data.stripePaymentIntent.status}`);
62
- } else {
63
- throw new Error(data.error?.message || "Failed to process payment");
64
- }
65
- await fetchDashboardData();
66
- } catch (err) {
67
- console.error("Failed to process payment", err);
68
- alert(err instanceof Error ? err.message : "An error occurred during payment initialization");
69
- } finally {
70
- setCreatingTest(false);
71
- }
72
- };
73
- const formatCurrency = (amount, currency = "USD") => {
74
- return new Intl.NumberFormat("en-US", {
75
- style: "currency",
76
- currency
77
- }).format(amount);
78
- };
79
- const formatDate = (dateString) => {
80
- return new Date(dateString).toLocaleDateString("en-US", {
81
- year: "numeric",
82
- month: "short",
83
- day: "numeric",
84
- hour: "2-digit",
85
- minute: "2-digit"
86
- });
87
- };
88
- const getStatusBadge = (status) => {
89
- const statusConfig = {
90
- succeeded: { color: "success", labelId: "payment-plugin.payments.succeeded", defaultLabel: "Success" },
91
- pending: { color: "warning", labelId: "payment-plugin.payments.pending", defaultLabel: "Pending" },
92
- failed: { color: "danger", labelId: "payment-plugin.payments.failed", defaultLabel: "Failed" },
93
- refunded: { color: "info", labelId: "payment-plugin.payments.refunded", defaultLabel: "Refunded" }
94
- };
95
- const config = statusConfig[status] || statusConfig.pending;
96
- return /* @__PURE__ */ jsx(Badge, { size: "S", backgroundColor: config.color, children: formatMessage({ id: config.labelId, defaultMessage: config.defaultLabel }) });
97
- };
98
- if (loading) {
99
- return /* @__PURE__ */ jsx(Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsx(Loader, {}) }) });
100
- }
101
- if (error) {
102
- return /* @__PURE__ */ jsx(Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: /* @__PURE__ */ jsx(
103
- EmptyStateLayout,
104
- {
105
- title: "Error loading dashboard",
106
- subtitle: error,
107
- action: /* @__PURE__ */ jsx(Button, { onClick: fetchDashboardData, children: formatMessage({ id: "payment-plugin.dashboard.retry", defaultMessage: "Retry" }) })
108
- }
109
- ) });
110
- }
111
- return /* @__PURE__ */ jsxs(Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: [
112
- /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
113
- /* @__PURE__ */ jsxs(Box, { children: [
114
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.dashboard.title", defaultMessage: "Payment Dashboard" }) }),
115
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
116
- id: "payment-plugin.dashboard.subtitle",
117
- defaultMessage: "Overview of your payment operations"
118
- }) })
119
- ] }),
120
- /* @__PURE__ */ jsx(
121
- Button,
122
- {
123
- onClick: createTestPayment,
124
- loading: creatingTest,
125
- variant: "secondary",
126
- children: formatMessage({ id: "payment-plugin.dashboard.initPayment", defaultMessage: "Initialize Sample Payment" })
127
- }
128
- )
129
- ] }) }),
130
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, marginBottom: 8, children: [
131
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
132
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.totalRevenue", defaultMessage: "Total Revenue" }) }),
133
- /* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", children: formatCurrency(stats?.totalRevenue || 0) })
134
- ] }) }) }) }),
135
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
136
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.totalPayments", defaultMessage: "Total Payments" }) }),
137
- /* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", children: stats?.totalPayments || 0 })
138
- ] }) }) }) }),
139
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
140
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.successRate", defaultMessage: "Success Rate" }) }),
141
- /* @__PURE__ */ jsxs(Typography, { variant: "delta", fontWeight: "bold", children: [
142
- stats ? Math.round(stats.successfulPayments / stats.totalPayments * 100) : 0,
143
- "%"
144
- ] })
145
- ] }) }) }) }),
146
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
147
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.dashboard.averageOrderValue", defaultMessage: "Average Order Value" }) }),
148
- /* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", children: formatCurrency(stats?.averageOrderValue || 0) })
149
- ] }) }) }) })
150
- ] }),
151
- /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
152
- /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, children: [
153
- /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", children: formatMessage({ id: "payment-plugin.dashboard.recentPayments", defaultMessage: "Recent Payments" }) }),
154
- /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "S", children: formatMessage({ id: "payment-plugin.dashboard.viewAll", defaultMessage: "View All" }) })
155
- ] }),
156
- /* @__PURE__ */ jsxs(Table, { children: [
157
- /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
158
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.customer", defaultMessage: "Customer" }) }) }),
159
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.amount", defaultMessage: "Amount" }) }) }),
160
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.status", defaultMessage: "Status" }) }) }),
161
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.paymentMethod", defaultMessage: "Payment Method" }) }) }),
162
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.dashboard.date", defaultMessage: "Date" }) }) })
163
- ] }) }),
164
- /* @__PURE__ */ jsx(Tbody, { children: recentPayments.map((payment) => /* @__PURE__ */ jsxs(Tr, { children: [
165
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: payment.customerEmail }) }),
166
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(payment.amount, payment.currency) }) }),
167
- /* @__PURE__ */ jsx(Td, { children: getStatusBadge(payment.status) }),
168
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
169
- id: `payment-plugin.payments.${payment.paymentMethod}`,
170
- defaultMessage: payment.paymentMethod
171
- }) }) }),
172
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatDate(payment.createdAt) }) })
173
- ] }, payment.id)) })
174
- ] })
175
- ] }) })
176
- ] });
177
- };
178
- export {
179
- Dashboard
180
- };
@@ -1,357 +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 reactIntl = require("react-intl");
7
- const admin = require("@strapi/strapi/admin");
8
- const index = require("./index-BqqrpI6D.js");
9
- const Settings = () => {
10
- const { formatMessage } = reactIntl.useIntl();
11
- const { get, put } = admin.useFetchClient();
12
- const [settings, setSettings] = React.useState(null);
13
- const [loading, setLoading] = React.useState(true);
14
- const [saving, setSaving] = React.useState(false);
15
- const [error, setError] = React.useState(null);
16
- const [success, setSuccess] = React.useState(null);
17
- const [hasChanges, setHasChanges] = React.useState(false);
18
- React.useEffect(() => {
19
- fetchSettings();
20
- }, []);
21
- const fetchSettings = async () => {
22
- try {
23
- setLoading(true);
24
- const { data } = await get(`/${index.PLUGIN_ID}/admin/config`);
25
- if (data.success && data.data) {
26
- const backendConfig = data.data;
27
- const initialSettings = {
28
- stripe: {
29
- publishableKey: backendConfig.stripe?.publishableKey || "",
30
- secretKey: backendConfig.stripe?.secretKey || "",
31
- webhookSecret: backendConfig.stripe?.webhookSecret || "",
32
- apiVersion: backendConfig.stripe?.apiVersion || "2023-10-16",
33
- enabled: backendConfig.stripe?.enabled ?? true
34
- },
35
- payments: {
36
- defaultCurrency: backendConfig.payment?.defaultCurrency || "usd",
37
- supportedCurrencies: backendConfig.payment?.supportedCurrencies || ["usd"],
38
- enableRefunds: backendConfig.payment?.enableRefunds ?? true,
39
- enablePartialRefunds: backendConfig.payment?.enablePartialRefunds ?? true,
40
- refundWindow: backendConfig.payment?.refundWindow || 30,
41
- captureMethod: backendConfig.payment?.captureMethod || "automatic",
42
- confirmationMethod: backendConfig.payment?.confirmationMethod || "automatic"
43
- },
44
- webhooks: {
45
- enabled: true,
46
- endpoints: {
47
- paymentSucceeded: "",
48
- paymentFailed: "",
49
- refundCreated: "",
50
- invoiceCreated: ""
51
- },
52
- retries: 3,
53
- timeout: 30
54
- },
55
- ui: {
56
- showPaymentStatus: true,
57
- showCustomerInfo: true,
58
- enableNotifications: true,
59
- theme: "auto",
60
- compactView: false
61
- },
62
- security: {
63
- enableIpFiltering: false,
64
- allowedIps: [],
65
- requireAuthentication: true,
66
- enableAuditLog: true,
67
- sessionTimeout: 60
68
- }
69
- };
70
- setSettings(initialSettings);
71
- }
72
- setLoading(false);
73
- } catch (err) {
74
- setError("Failed to fetch settings");
75
- setLoading(false);
76
- }
77
- };
78
- const handleSettingChange = (section, key, value) => {
79
- if (!settings) return;
80
- setSettings((prev) => ({
81
- ...prev,
82
- [section]: {
83
- ...prev[section],
84
- [key]: value
85
- }
86
- }));
87
- setHasChanges(true);
88
- setSuccess(null);
89
- };
90
- const saveSettings = async () => {
91
- try {
92
- setSaving(true);
93
- setError(null);
94
- if (!settings) return;
95
- const payload = {
96
- stripe: settings.stripe,
97
- payment: settings.payments,
98
- logging: {
99
- enableWebhookLogging: true
100
- }
101
- };
102
- await put(`/${index.PLUGIN_ID}/admin/config`, payload);
103
- setHasChanges(false);
104
- setSuccess("Settings saved successfully");
105
- setTimeout(() => setSuccess(null), 3e3);
106
- } catch (err) {
107
- setError("Failed to save settings");
108
- } finally {
109
- setSaving(false);
110
- }
111
- };
112
- const resetSettings = () => {
113
- if (confirm("Are you sure you want to reset all settings to default? This action cannot be undone.")) {
114
- fetchSettings();
115
- setHasChanges(false);
116
- }
117
- };
118
- const testConnection = async () => {
119
- try {
120
- setSaving(true);
121
- const { data } = await get(`/${index.PLUGIN_ID}/admin/config`);
122
- if (data.success) {
123
- alert("Connection to backend successful!");
124
- } else {
125
- throw new Error("Failed to connect");
126
- }
127
- } catch (err) {
128
- alert("Connection test failed. Please check your API keys and server logs.");
129
- } finally {
130
- setSaving(false);
131
- }
132
- };
133
- if (loading) {
134
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", children: formatMessage({ id: "payment-plugin.settings.loading", defaultMessage: "Loading settings..." }) }) }) });
135
- }
136
- if (!settings) {
137
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { severity: "danger", children: formatMessage({ id: "payment-plugin.settings.error", defaultMessage: "Failed to load settings" }) }) });
138
- }
139
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingLeft: 10, paddingRight: 10, paddingTop: 4, paddingBottom: 10, children: [
140
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
141
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
142
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.settings.title", defaultMessage: "Payment Settings" }) }),
143
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
144
- id: "payment-plugin.settings.subtitle",
145
- defaultMessage: "Configure your payment plugin settings"
146
- }) })
147
- ] }),
148
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
149
- hasChanges && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "warning", style: { marginRight: "1rem" }, children: formatMessage({ id: "payment-plugin.settings.unsaved", defaultMessage: "You have unsaved changes" }) }),
150
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: resetSettings, children: formatMessage({ id: "payment-plugin.settings.reset", defaultMessage: "Reset" }) }),
151
- /* @__PURE__ */ jsxRuntime.jsx(
152
- designSystem.Button,
153
- {
154
- variant: "secondary",
155
- onClick: testConnection,
156
- disabled: saving,
157
- children: formatMessage({ id: "payment-plugin.settings.testConnection", defaultMessage: "Test Connection" })
158
- }
159
- ),
160
- /* @__PURE__ */ jsxRuntime.jsx(
161
- designSystem.Button,
162
- {
163
- onClick: saveSettings,
164
- disabled: !hasChanges || saving,
165
- loading: saving,
166
- children: formatMessage({ id: "payment-plugin.settings.save", defaultMessage: "Save Settings" })
167
- }
168
- )
169
- ] })
170
- ] }) }),
171
- error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", onClose: () => setError(null), children: error }) }),
172
- success && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "success", onClose: () => setSuccess(null), children: success }) }),
173
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 6, children: [
174
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
175
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.stripe", defaultMessage: "Stripe Configuration" }) }),
176
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
177
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
178
- designSystem.TextInput,
179
- {
180
- label: formatMessage({ id: "payment-plugin.settings.publishableKey", defaultMessage: "Publishable Key" }),
181
- placeholder: "pk_test_...",
182
- value: settings.stripe.publishableKey,
183
- onChange: (e) => handleSettingChange("stripe", "publishableKey", e.target.value)
184
- }
185
- ) }),
186
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
187
- designSystem.TextInput,
188
- {
189
- label: formatMessage({ id: "payment-plugin.settings.secretKey", defaultMessage: "Secret Key" }),
190
- placeholder: "sk_test_...",
191
- value: settings.stripe.secretKey,
192
- onChange: (e) => handleSettingChange("stripe", "secretKey", e.target.value),
193
- type: "password"
194
- }
195
- ) }),
196
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
197
- designSystem.TextInput,
198
- {
199
- label: formatMessage({ id: "payment-plugin.settings.webhookSecret", defaultMessage: "Webhook Secret" }),
200
- placeholder: "whsec_...",
201
- value: settings.stripe.webhookSecret,
202
- onChange: (e) => handleSettingChange("stripe", "webhookSecret", e.target.value),
203
- type: "password"
204
- }
205
- ) }),
206
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(
207
- designSystem.SingleSelect,
208
- {
209
- label: formatMessage({ id: "payment-plugin.settings.apiVersion", defaultMessage: "API Version" }),
210
- value: settings.stripe.apiVersion,
211
- onChange: (value) => handleSettingChange("stripe", "apiVersion", value),
212
- children: [
213
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "2024-06-20", children: "2024-06-20 (Latest)" }),
214
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "2023-10-16", children: "2023-10-16" }),
215
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "2023-08-15", children: "2023-08-15" })
216
- ]
217
- }
218
- ) }),
219
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
220
- /* @__PURE__ */ jsxRuntime.jsx(
221
- designSystem.Switch,
222
- {
223
- label: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Enable Stripe Payments" }),
224
- selected: settings.stripe.enabled,
225
- onChange: () => handleSettingChange("stripe", "enabled", !settings.stripe.enabled)
226
- }
227
- ),
228
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Enable Stripe Payments" }) })
229
- ] }) })
230
- ] })
231
- ] }) }) }),
232
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
233
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.payments", defaultMessage: "Payment Settings" }) }),
234
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
235
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
236
- designSystem.SingleSelect,
237
- {
238
- label: formatMessage({ id: "payment-plugin.settings.defaultCurrency", defaultMessage: "Default Currency" }),
239
- value: settings.payments.defaultCurrency,
240
- onChange: (value) => handleSettingChange("payments", "defaultCurrency", value),
241
- children: [
242
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "usd", children: "USD" }),
243
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "eur", children: "EUR" }),
244
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "gbp", children: "GBP" }),
245
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "cad", children: "CAD" }),
246
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "aud", children: "AUD" })
247
- ]
248
- }
249
- ) }),
250
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
251
- designSystem.SingleSelect,
252
- {
253
- label: formatMessage({ id: "payment-plugin.settings.captureMethod", defaultMessage: "Capture Method" }),
254
- value: settings.payments.captureMethod,
255
- onChange: (value) => handleSettingChange("payments", "captureMethod", value),
256
- children: [
257
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "automatic", children: "Automatic" }),
258
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "manual", children: "Manual" })
259
- ]
260
- }
261
- ) }),
262
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
263
- designSystem.TextInput,
264
- {
265
- label: formatMessage({ id: "payment-plugin.settings.refundWindow", defaultMessage: "Refund Window (Days)" }),
266
- type: "number",
267
- value: settings.payments.refundWindow.toString(),
268
- onChange: (e) => handleSettingChange("payments", "refundWindow", parseInt(e.target.value) || 0)
269
- }
270
- ) })
271
- ] })
272
- ] }) }) }),
273
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
274
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.security", defaultMessage: "Security Settings" }) }),
275
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
276
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
277
- /* @__PURE__ */ jsxRuntime.jsx(
278
- designSystem.Switch,
279
- {
280
- label: formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Require Authentication" }),
281
- selected: settings.security.requireAuthentication,
282
- onChange: () => handleSettingChange("security", "requireAuthentication", !settings.security.requireAuthentication)
283
- }
284
- ),
285
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Require Authentication" }) })
286
- ] }) }),
287
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
288
- /* @__PURE__ */ jsxRuntime.jsx(
289
- designSystem.Switch,
290
- {
291
- label: formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Enable Audit Log" }),
292
- selected: settings.security.enableAuditLog,
293
- onChange: () => handleSettingChange("security", "enableAuditLog", !settings.security.enableAuditLog)
294
- }
295
- ),
296
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Enable Audit Log" }) })
297
- ] }) }),
298
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
299
- designSystem.TextInput,
300
- {
301
- label: formatMessage({ id: "payment-plugin.settings.sessionTimeout", defaultMessage: "Session Timeout (Minutes)" }),
302
- type: "number",
303
- value: settings.security.sessionTimeout.toString(),
304
- onChange: (e) => handleSettingChange("security", "sessionTimeout", parseInt(e.target.value) || 60)
305
- }
306
- ) })
307
- ] })
308
- ] }) }) }),
309
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
310
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.ui", defaultMessage: "User Interface Settings" }) }),
311
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
312
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
313
- /* @__PURE__ */ jsxRuntime.jsx(
314
- designSystem.Switch,
315
- {
316
- checked: settings.ui.showPaymentStatus,
317
- onChange: (checked) => handleSettingChange("ui", "showPaymentStatus", checked)
318
- }
319
- ),
320
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({ id: "payment-plugin.settings.showStatus", defaultMessage: "Show Payment Status" }) })
321
- ] }) }),
322
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
323
- /* @__PURE__ */ jsxRuntime.jsx(
324
- designSystem.Switch,
325
- {
326
- checked: settings.ui.showCustomerInfo,
327
- onChange: (checked) => handleSettingChange("ui", "showCustomerInfo", checked)
328
- }
329
- ),
330
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({ id: "payment-plugin.settings.showCustomerInfo", defaultMessage: "Show Customer Info" }) })
331
- ] }) }),
332
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
333
- /* @__PURE__ */ jsxRuntime.jsx(
334
- designSystem.Switch,
335
- {
336
- checked: settings.ui.enableNotifications,
337
- onChange: (checked) => handleSettingChange("ui", "enableNotifications", checked)
338
- }
339
- ),
340
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({ id: "payment-plugin.settings.notifications", defaultMessage: "Enable Notifications" }) })
341
- ] }) }),
342
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
343
- /* @__PURE__ */ jsxRuntime.jsx(
344
- designSystem.Switch,
345
- {
346
- checked: settings.ui.compactView,
347
- onChange: (checked) => handleSettingChange("ui", "compactView", checked)
348
- }
349
- ),
350
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({ id: "payment-plugin.settings.compactView", defaultMessage: "Compact View" }) })
351
- ] }) })
352
- ] })
353
- ] }) }) })
354
- ] })
355
- ] });
356
- };
357
- exports.Settings = Settings;