@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
@@ -0,0 +1,644 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { Modal, Typography, Box, Tabs, Flex, Button, Alert, Grid, Card, Badge, TextInput, SingleSelect, SingleSelectOption, Switch } from "@strapi/design-system";
4
+ import { useIntl } from "react-intl";
5
+ import { useFetchClient } from "@strapi/strapi/admin";
6
+ import { Duplicate, Code, Key, EyeStriked, Eye, Globe } from "@strapi/icons";
7
+ import { P as PLUGIN_ID } from "./index-2Zd_T7bD.mjs";
8
+ const IntegrationModal = ({ onClose, publishableKey }) => {
9
+ const [copied, setCopied] = useState(null);
10
+ const copyToClipboard = (text, type) => {
11
+ navigator.clipboard.writeText(text);
12
+ setCopied(type);
13
+ setTimeout(() => setCopied(null), 2e3);
14
+ };
15
+ const installSnippet = `
16
+ # Install required dependencies in your frontend app
17
+ npm install @stripe/stripe-js @stripe/react-stripe-js
18
+ `.trim();
19
+ const stripeInitCode = `
20
+ import { loadStripe } from '@stripe/stripe-js';
21
+
22
+ // Initialize Stripe with your Publishable Key
23
+ const stripePromise = loadStripe('${publishableKey || "YOUR_PUBLISHABLE_KEY"}');
24
+
25
+ export default stripePromise;
26
+ `.trim();
27
+ const checkoutSnippet = `
28
+ const handlePayment = async (amount) => {
29
+ // 1. Create a Payment Intent on your Strapi backend
30
+ // Replace YOUR_STRAPI_URL and YOUR_JWT_TOKEN
31
+ const STRAPI_URL = 'http://localhost:1337';
32
+
33
+ const response = await fetch(\`\${STRAPI_URL}/api/payment-plugin/payments/create-intent\`, {
34
+ method: 'POST',
35
+ headers: {
36
+ 'Content-Type': 'application/json',
37
+ 'Authorization': 'Bearer YOUR_JWT_TOKEN' // Required for Strapi Content API
38
+ },
39
+ body: JSON.stringify({
40
+ amount: amount, // Amount in cents (e.g., 2500 for $25.00)
41
+ currency: 'usd',
42
+ orderId: 'ORDER_123'
43
+ })
44
+ });
45
+
46
+ const { data, success } = await response.json();
47
+ if (!success) throw new Error('Failed to create PaymentIntent');
48
+
49
+ return data.clientSecret;
50
+ };
51
+ `.trim();
52
+ const elementSnippet = `
53
+ import React, { useState } from 'react';
54
+ import { Elements, PaymentElement, useStripe, useElements } from '@stripe/react-stripe-js';
55
+ import stripePromise from './stripe-init'; // From Step 1
56
+
57
+ const CheckoutForm = ({ clientSecret }) => {
58
+ const stripe = useStripe();
59
+ const elements = useElements();
60
+ const [isProcessing, setIsProcessing] = useState(false);
61
+
62
+ const handleSubmit = async (event) => {
63
+ event.preventDefault();
64
+ if (!stripe || !elements) return;
65
+
66
+ setIsProcessing(true);
67
+ const result = await stripe.confirmPayment({
68
+ elements,
69
+ confirmParams: {
70
+ return_url: window.location.origin + "/payment-success",
71
+ },
72
+ });
73
+
74
+ if (result.error) {
75
+ alert(result.error.message);
76
+ }
77
+ setIsProcessing(false);
78
+ };
79
+
80
+ return (
81
+ <form onSubmit={handleSubmit}>
82
+ <PaymentElement />
83
+ <button disabled={!stripe || isProcessing} style={{ marginTop: '1rem' }}>
84
+ {isProcessing ? 'Processing...' : 'Pay Now'}
85
+ </button>
86
+ </form>
87
+ );
88
+ };
89
+ `.trim();
90
+ return /* @__PURE__ */ jsx(Modal.Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
91
+ /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", textColor: "neutral800", as: "h2", id: "title", children: "Frontend Integration Guide" }) }),
92
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
93
+ /* @__PURE__ */ jsx(Typography, { variant: "epsilon", marginBottom: 4, display: "block", children: "Follow these 4 steps to integrate Stripe payments into your React/Next.js frontend." }),
94
+ /* @__PURE__ */ jsxs(Tabs.Root, { defaultValue: "setup", children: [
95
+ /* @__PURE__ */ jsxs(Tabs.List, { children: [
96
+ /* @__PURE__ */ jsx(Tabs.Trigger, { value: "setup", children: "1. Setup" }),
97
+ /* @__PURE__ */ jsx(Tabs.Trigger, { value: "backend", children: "2. Backend" }),
98
+ /* @__PURE__ */ jsx(Tabs.Trigger, { value: "frontend", children: "3. Frontend" }),
99
+ /* @__PURE__ */ jsx(Tabs.Trigger, { value: "perms", children: "4. Permissions" })
100
+ ] }),
101
+ /* @__PURE__ */ jsxs(Box, { marginTop: 4, children: [
102
+ /* @__PURE__ */ jsx(Tabs.Content, { value: "setup", children: /* @__PURE__ */ jsxs(Box, { padding: 4, background: "neutral100", borderRadius: "4px", children: [
103
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", display: "block", marginBottom: 2, children: "INSTALL DEPENDENCIES" }),
104
+ /* @__PURE__ */ jsx("pre", { style: { marginBottom: "1rem", fontSize: "0.75rem", overflowX: "auto", padding: "10px", background: "#27272a", color: "#f8fafc", borderRadius: "4px" }, children: /* @__PURE__ */ jsx("code", { children: installSnippet }) }),
105
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 2, children: [
106
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: "INITIALIZE STRIPE" }),
107
+ /* @__PURE__ */ jsx(
108
+ Button,
109
+ {
110
+ variant: "ghost",
111
+ startIcon: /* @__PURE__ */ jsx(Duplicate, {}),
112
+ onClick: () => copyToClipboard(stripeInitCode, "init"),
113
+ children: copied === "init" ? "Copied!" : "Copy"
114
+ }
115
+ )
116
+ ] }),
117
+ /* @__PURE__ */ jsx("pre", { style: { margin: 0, fontSize: "0.75rem", overflowX: "auto", padding: "10px", background: "#27272a", color: "#f8fafc", borderRadius: "4px" }, children: /* @__PURE__ */ jsx("code", { children: stripeInitCode }) })
118
+ ] }) }),
119
+ /* @__PURE__ */ jsx(Tabs.Content, { value: "backend", children: /* @__PURE__ */ jsxs(Box, { padding: 4, background: "neutral100", borderRadius: "4px", children: [
120
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 2, children: [
121
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: "GET CLIENT SECRET" }),
122
+ /* @__PURE__ */ jsx(
123
+ Button,
124
+ {
125
+ variant: "ghost",
126
+ startIcon: /* @__PURE__ */ jsx(Duplicate, {}),
127
+ onClick: () => copyToClipboard(checkoutSnippet, "backend"),
128
+ children: copied === "backend" ? "Copied!" : "Copy"
129
+ }
130
+ )
131
+ ] }),
132
+ /* @__PURE__ */ jsx("pre", { style: { margin: 0, fontSize: "0.75rem", overflowX: "auto", padding: "10px", background: "#27272a", color: "#f8fafc", borderRadius: "4px" }, children: /* @__PURE__ */ jsx("code", { children: checkoutSnippet }) })
133
+ ] }) }),
134
+ /* @__PURE__ */ jsx(Tabs.Content, { value: "frontend", children: /* @__PURE__ */ jsxs(Box, { padding: 4, background: "neutral100", borderRadius: "4px", children: [
135
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 2, children: [
136
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: "REACT CHECKOUT FORM" }),
137
+ /* @__PURE__ */ jsx(
138
+ Button,
139
+ {
140
+ variant: "ghost",
141
+ startIcon: /* @__PURE__ */ jsx(Duplicate, {}),
142
+ onClick: () => copyToClipboard(elementSnippet, "frontend"),
143
+ children: copied === "frontend" ? "Copied!" : "Copy"
144
+ }
145
+ )
146
+ ] }),
147
+ /* @__PURE__ */ jsx("pre", { style: { margin: 0, fontSize: "0.75rem", overflowX: "auto", padding: "10px", background: "#27272a", color: "#f8fafc", borderRadius: "4px" }, children: /* @__PURE__ */ jsx("code", { children: elementSnippet }) })
148
+ ] }) }),
149
+ /* @__PURE__ */ jsx(Tabs.Content, { value: "perms", children: /* @__PURE__ */ jsxs(Box, { padding: 6, background: "neutral100", borderRadius: "4px", children: [
150
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", marginBottom: 2, display: "block", tag: "h3", children: "Crucial: API Permissions" }),
151
+ /* @__PURE__ */ jsx(Typography, { variant: "epsilon", marginBottom: 4, display: "block", children: "By default, Strapi blocks all public access to the Content API. You must enable permissions for your frontend to interact with the plugin:" }),
152
+ /* @__PURE__ */ jsxs(Box, { paddingLeft: 4, children: [
153
+ /* @__PURE__ */ jsxs(Typography, { variant: "pi", display: "block", marginBottom: 1, children: [
154
+ "1. Go to ",
155
+ /* @__PURE__ */ jsx("b", { children: "Settings" }),
156
+ " > ",
157
+ /* @__PURE__ */ jsx("b", { children: "Users & Permissions Plugin" }),
158
+ " > ",
159
+ /* @__PURE__ */ jsx("b", { children: "Roles" })
160
+ ] }),
161
+ /* @__PURE__ */ jsxs(Typography, { variant: "pi", display: "block", marginBottom: 1, children: [
162
+ "2. Edit the ",
163
+ /* @__PURE__ */ jsx("b", { children: "Authenticated" }),
164
+ " or ",
165
+ /* @__PURE__ */ jsx("b", { children: "Public" }),
166
+ " role"
167
+ ] }),
168
+ /* @__PURE__ */ jsxs(Typography, { variant: "pi", display: "block", marginBottom: 1, children: [
169
+ "3. Find the ",
170
+ /* @__PURE__ */ jsx("b", { children: "Payment-plugin" }),
171
+ " section"
172
+ ] }),
173
+ /* @__PURE__ */ jsxs(Typography, { variant: "pi", display: "block", marginBottom: 1, children: [
174
+ "4. Enable ",
175
+ /* @__PURE__ */ jsx("b", { children: "createPaymentIntent" }),
176
+ " and ",
177
+ /* @__PURE__ */ jsx("b", { children: "confirmPayment" })
178
+ ] }),
179
+ /* @__PURE__ */ jsxs(Typography, { variant: "pi", display: "block", marginBottom: 1, children: [
180
+ "5. Click ",
181
+ /* @__PURE__ */ jsx("b", { children: "Save" }),
182
+ " at the top right"
183
+ ] })
184
+ ] })
185
+ ] }) })
186
+ ] })
187
+ ] })
188
+ ] }) }),
189
+ /* @__PURE__ */ jsx(Modal.Footer, { children: /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: "Close" }) })
190
+ ] }) });
191
+ };
192
+ const Settings = () => {
193
+ const { formatMessage } = useIntl();
194
+ const { get, put } = useFetchClient();
195
+ const [settings, setSettings] = useState(null);
196
+ const [loading, setLoading] = useState(true);
197
+ const [saving, setSaving] = useState(false);
198
+ const [error, setError] = useState(null);
199
+ const [success, setSuccess] = useState(null);
200
+ const [hasChanges, setHasChanges] = useState(false);
201
+ const [showIntegrationModal, setShowIntegrationModal] = useState(false);
202
+ const [showSecretKey, setShowSecretKey] = useState(false);
203
+ const [showWebhookSecret, setShowWebhookSecret] = useState(false);
204
+ useEffect(() => {
205
+ fetchSettings();
206
+ }, []);
207
+ const fetchSettings = async () => {
208
+ try {
209
+ setLoading(true);
210
+ const { data } = await get(`/${PLUGIN_ID}/admin/config`);
211
+ if (data.success && data.data) {
212
+ const backendConfig = data.data;
213
+ const initialSettings = {
214
+ stripe: {
215
+ publishableKey: backendConfig.stripe?.publishableKey || "",
216
+ secretKey: backendConfig.stripe?.secretKey || "",
217
+ webhookSecret: backendConfig.stripe?.webhookSecret || "",
218
+ apiVersion: backendConfig.stripe?.apiVersion || "2023-10-16",
219
+ enabled: backendConfig.stripe?.enabled ?? true
220
+ },
221
+ payments: {
222
+ defaultCurrency: backendConfig.payment?.defaultCurrency || "usd",
223
+ supportedCurrencies: backendConfig.payment?.supportedCurrencies || ["usd"],
224
+ enableRefunds: backendConfig.payment?.enableRefunds ?? true,
225
+ enablePartialRefunds: backendConfig.payment?.enablePartialRefunds ?? true,
226
+ refundWindow: backendConfig.payment?.refundWindow || 30,
227
+ captureMethod: backendConfig.payment?.captureMethod || "automatic",
228
+ confirmationMethod: backendConfig.payment?.confirmationMethod || "automatic"
229
+ },
230
+ webhooks: {
231
+ enabled: true,
232
+ endpoints: {
233
+ paymentSucceeded: "",
234
+ paymentFailed: "",
235
+ refundCreated: "",
236
+ invoiceCreated: ""
237
+ },
238
+ retries: 3,
239
+ timeout: 30
240
+ },
241
+ ui: {
242
+ showPaymentStatus: true,
243
+ showCustomerInfo: true,
244
+ enableNotifications: true,
245
+ theme: "auto",
246
+ compactView: false
247
+ },
248
+ security: {
249
+ enableIpFiltering: false,
250
+ allowedIps: [],
251
+ requireAuthentication: true,
252
+ enableAuditLog: true,
253
+ sessionTimeout: 60
254
+ }
255
+ };
256
+ setSettings(initialSettings);
257
+ }
258
+ setLoading(false);
259
+ } catch (err) {
260
+ setError("Failed to fetch settings");
261
+ setLoading(false);
262
+ }
263
+ };
264
+ const handleSettingChange = (section, key, value) => {
265
+ if (!settings) return;
266
+ setSettings((prev) => ({
267
+ ...prev,
268
+ [section]: {
269
+ ...prev[section],
270
+ [key]: value
271
+ }
272
+ }));
273
+ setHasChanges(true);
274
+ setSuccess(null);
275
+ };
276
+ const saveSettings = async () => {
277
+ try {
278
+ setSaving(true);
279
+ setError(null);
280
+ if (!settings) return;
281
+ const payload = {
282
+ stripe: settings.stripe,
283
+ payment: settings.payments,
284
+ logging: {
285
+ enableWebhookLogging: true
286
+ }
287
+ };
288
+ await put(`/${PLUGIN_ID}/admin/config`, payload);
289
+ setHasChanges(false);
290
+ setSuccess("Settings saved successfully");
291
+ setTimeout(() => setSuccess(null), 3e3);
292
+ } catch (err) {
293
+ setError("Failed to save settings");
294
+ } finally {
295
+ setSaving(false);
296
+ }
297
+ };
298
+ const resetSettings = () => {
299
+ if (confirm("Are you sure you want to reset all settings to default? This action cannot be undone.")) {
300
+ fetchSettings();
301
+ setHasChanges(false);
302
+ }
303
+ };
304
+ const testConnection = async () => {
305
+ try {
306
+ setSaving(true);
307
+ const { data } = await get(`/${PLUGIN_ID}/admin/config`);
308
+ if (data.success) {
309
+ alert("Connection to backend successful!");
310
+ } else {
311
+ throw new Error("Failed to connect");
312
+ }
313
+ } catch (err) {
314
+ alert("Connection test failed. Please check your API keys and server logs.");
315
+ } finally {
316
+ setSaving(false);
317
+ }
318
+ };
319
+ if (loading) {
320
+ 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..." }) }) }) });
321
+ }
322
+ if (!settings) {
323
+ return /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Alert, { variant: "danger", children: formatMessage({ id: "payment-plugin.settings.error", defaultMessage: "Failed to load settings" }) }) });
324
+ }
325
+ return /* @__PURE__ */ jsxs(Box, { children: [
326
+ /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
327
+ /* @__PURE__ */ jsxs(Box, { children: [
328
+ /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.settings.title", defaultMessage: "Payment Settings" }) }),
329
+ /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
330
+ id: "payment-plugin.settings.subtitle",
331
+ defaultMessage: "Configure your payment plugin settings"
332
+ }) })
333
+ ] }),
334
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
335
+ hasChanges && /* @__PURE__ */ jsx(Box, { marginRight: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "warning600", children: "Unsaved changes" }) }),
336
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: resetSettings, children: formatMessage({ id: "payment-plugin.settings.reset", defaultMessage: "Reset" }) }),
337
+ /* @__PURE__ */ jsx(
338
+ Button,
339
+ {
340
+ variant: "secondary",
341
+ onClick: testConnection,
342
+ disabled: saving,
343
+ children: formatMessage({ id: "payment-plugin.settings.testConnection", defaultMessage: "Test Connection" })
344
+ }
345
+ ),
346
+ /* @__PURE__ */ jsx(
347
+ Button,
348
+ {
349
+ onClick: saveSettings,
350
+ disabled: !hasChanges || saving,
351
+ loading: saving,
352
+ children: formatMessage({ id: "payment-plugin.settings.save", defaultMessage: "Save Settings" })
353
+ }
354
+ ),
355
+ /* @__PURE__ */ jsx(
356
+ Button,
357
+ {
358
+ variant: "tertiary",
359
+ startIcon: /* @__PURE__ */ jsx(Code, {}),
360
+ onClick: () => setShowIntegrationModal(true),
361
+ children: formatMessage({ id: "payment-plugin.settings.integration", defaultMessage: "Integration Guide" })
362
+ }
363
+ )
364
+ ] })
365
+ ] }) }),
366
+ error && /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(Alert, { variant: "danger", onClose: () => setError(null), children: error }) }),
367
+ success && /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(Alert, { variant: "success", onClose: () => setSuccess(null), children: success }) }),
368
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 6, children: [
369
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 5, children: [
370
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, children: [
371
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
372
+ /* @__PURE__ */ jsx(Box, { color: "primary600", children: /* @__PURE__ */ jsx(Key, { width: "1.5rem", height: "1.5rem" }) }),
373
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", children: formatMessage({ id: "payment-plugin.settings.stripe", defaultMessage: "Stripe API Configuration" }) })
374
+ ] }),
375
+ /* @__PURE__ */ jsx(Badge, { variant: settings.stripe.enabled ? "success" : "neutral", children: settings.stripe.enabled ? "Stripe Active" : "Stripe Disabled" })
376
+ ] }),
377
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
378
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
379
+ TextInput,
380
+ {
381
+ label: formatMessage({ id: "payment-plugin.settings.publishableKey", defaultMessage: "Publishable Key" }),
382
+ placeholder: "pk_test_...",
383
+ value: settings.stripe.publishableKey,
384
+ onChange: (e) => handleSettingChange("stripe", "publishableKey", e.target.value),
385
+ endAction: /* @__PURE__ */ jsx(
386
+ Button,
387
+ {
388
+ variant: "ghost",
389
+ onClick: () => {
390
+ navigator.clipboard.writeText(settings.stripe.publishableKey);
391
+ alert("Copied to clipboard");
392
+ },
393
+ children: /* @__PURE__ */ jsx(Duplicate, { width: "1rem", height: "1rem" })
394
+ }
395
+ )
396
+ }
397
+ ) }),
398
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
399
+ TextInput,
400
+ {
401
+ label: formatMessage({ id: "payment-plugin.settings.secretKey", defaultMessage: "Secret Key" }),
402
+ placeholder: "sk_test_...",
403
+ value: settings.stripe.secretKey,
404
+ onChange: (e) => handleSettingChange("stripe", "secretKey", e.target.value),
405
+ type: showSecretKey ? "text" : "password",
406
+ endAction: /* @__PURE__ */ jsxs(Flex, { children: [
407
+ /* @__PURE__ */ jsx(
408
+ Button,
409
+ {
410
+ variant: "ghost",
411
+ onClick: () => setShowSecretKey(!showSecretKey),
412
+ children: showSecretKey ? /* @__PURE__ */ jsx(EyeStriked, { width: "1rem", height: "1rem" }) : /* @__PURE__ */ jsx(Eye, { width: "1rem", height: "1rem" })
413
+ }
414
+ ),
415
+ /* @__PURE__ */ jsx(
416
+ Button,
417
+ {
418
+ variant: "ghost",
419
+ onClick: () => {
420
+ navigator.clipboard.writeText(settings.stripe.secretKey);
421
+ alert("Copied to clipboard");
422
+ },
423
+ children: /* @__PURE__ */ jsx(Duplicate, { width: "1rem", height: "1rem" })
424
+ }
425
+ )
426
+ ] })
427
+ }
428
+ ) }),
429
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
430
+ TextInput,
431
+ {
432
+ label: formatMessage({ id: "payment-plugin.settings.webhookSecret", defaultMessage: "Webhook Secret" }),
433
+ placeholder: "whsec_...",
434
+ value: settings.stripe.webhookSecret,
435
+ onChange: (e) => handleSettingChange("stripe", "webhookSecret", e.target.value),
436
+ type: showWebhookSecret ? "text" : "password",
437
+ endAction: /* @__PURE__ */ jsxs(Flex, { children: [
438
+ /* @__PURE__ */ jsx(
439
+ Button,
440
+ {
441
+ variant: "ghost",
442
+ onClick: () => setShowWebhookSecret(!showWebhookSecret),
443
+ children: showWebhookSecret ? /* @__PURE__ */ jsx(EyeStriked, { width: "1rem", height: "1rem" }) : /* @__PURE__ */ jsx(Eye, { width: "1rem", height: "1rem" })
444
+ }
445
+ ),
446
+ /* @__PURE__ */ jsx(
447
+ Button,
448
+ {
449
+ variant: "ghost",
450
+ onClick: () => {
451
+ navigator.clipboard.writeText(settings.stripe.webhookSecret);
452
+ alert("Copied to clipboard");
453
+ },
454
+ children: /* @__PURE__ */ jsx(Duplicate, { width: "1rem", height: "1rem" })
455
+ }
456
+ )
457
+ ] })
458
+ }
459
+ ) }),
460
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsxs(
461
+ SingleSelect,
462
+ {
463
+ label: formatMessage({ id: "payment-plugin.settings.apiVersion", defaultMessage: "API Version" }),
464
+ value: settings.stripe.apiVersion,
465
+ onChange: (value) => handleSettingChange("stripe", "apiVersion", value),
466
+ children: [
467
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "2024-06-20", children: "2024-06-20 (Latest)" }),
468
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "2023-10-16", children: "2023-10-16" }),
469
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "2023-08-15", children: "2023-08-15" })
470
+ ]
471
+ }
472
+ ) }),
473
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(Box, { padding: 3, background: "neutral100", borderRadius: "4px", children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 4, children: [
474
+ /* @__PURE__ */ jsx(
475
+ Switch,
476
+ {
477
+ label: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Enable Stripe Payments" }),
478
+ selected: settings.stripe.enabled,
479
+ onChange: () => handleSettingChange("stripe", "enabled", !settings.stripe.enabled)
480
+ }
481
+ ),
482
+ /* @__PURE__ */ jsxs(Box, { children: [
483
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Payment Gateway Status" }) }),
484
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: settings.stripe.enabled ? "Your plugin is currently accepting payments through Stripe." : "Stripe payments are disabled. Customers will not be able to checkout." })
485
+ ] })
486
+ ] }) }) })
487
+ ] })
488
+ ] }) }) }),
489
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 5, children: [
490
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", marginBottom: 4, children: [
491
+ /* @__PURE__ */ jsx(Globe, { width: "1.25rem", height: "1.25rem" }),
492
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", children: formatMessage({ id: "payment-plugin.settings.payments", defaultMessage: "Default Rules" }) })
493
+ ] }),
494
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
495
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(
496
+ SingleSelect,
497
+ {
498
+ label: formatMessage({ id: "payment-plugin.settings.defaultCurrency", defaultMessage: "Default Currency" }),
499
+ value: settings.payments.defaultCurrency,
500
+ onChange: (value) => handleSettingChange("payments", "defaultCurrency", value),
501
+ children: [
502
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "usd", children: "USD" }),
503
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "eur", children: "EUR" }),
504
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "gbp", children: "GBP" }),
505
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "cad", children: "CAD" }),
506
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "aud", children: "AUD" })
507
+ ]
508
+ }
509
+ ) }),
510
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(
511
+ SingleSelect,
512
+ {
513
+ label: formatMessage({ id: "payment-plugin.settings.captureMethod", defaultMessage: "Capture Method" }),
514
+ value: settings.payments.captureMethod,
515
+ onChange: (value) => handleSettingChange("payments", "captureMethod", value),
516
+ children: [
517
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "automatic", children: "Automatic (Direct capture)" }),
518
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "manual", children: "Manual (Authorize only)" })
519
+ ]
520
+ }
521
+ ) }),
522
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(
523
+ TextInput,
524
+ {
525
+ label: formatMessage({ id: "payment-plugin.settings.refundWindow", defaultMessage: "Max Refund Window (Days)" }),
526
+ type: "number",
527
+ value: settings.payments.refundWindow.toString(),
528
+ onChange: (e) => handleSettingChange("payments", "refundWindow", parseInt(e.target.value) || 0)
529
+ }
530
+ ) })
531
+ ] })
532
+ ] }) }) }),
533
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 5, children: [
534
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.security", defaultMessage: "Security Settings" }) }),
535
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
536
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 4, children: [
537
+ /* @__PURE__ */ jsx(
538
+ Switch,
539
+ {
540
+ label: formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Require Authentication" }),
541
+ selected: settings.security.requireAuthentication,
542
+ onChange: () => handleSettingChange("security", "requireAuthentication", !settings.security.requireAuthentication)
543
+ }
544
+ ),
545
+ /* @__PURE__ */ jsxs(Box, { children: [
546
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Public Access Restriction" }) }),
547
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: settings.security.requireAuthentication ? "Only authenticated users can initiate payments." : "Public users can initiate payments without login." })
548
+ ] })
549
+ ] }) }),
550
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 4, children: [
551
+ /* @__PURE__ */ jsx(
552
+ Switch,
553
+ {
554
+ label: formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Enable Audit Log" }),
555
+ selected: settings.security.enableAuditLog,
556
+ onChange: () => handleSettingChange("security", "enableAuditLog", !settings.security.enableAuditLog)
557
+ }
558
+ ),
559
+ /* @__PURE__ */ jsxs(Box, { children: [
560
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Activity Logging" }) }),
561
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Detailed logs of all transaction attempts and configuration changes." })
562
+ ] })
563
+ ] }) }),
564
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, marginTop: 2, children: /* @__PURE__ */ jsx(
565
+ TextInput,
566
+ {
567
+ label: formatMessage({ id: "payment-plugin.settings.sessionTimeout", defaultMessage: "Checkout Session Timeout (Minutes)" }),
568
+ type: "number",
569
+ value: settings.security.sessionTimeout.toString(),
570
+ onChange: (e) => handleSettingChange("security", "sessionTimeout", parseInt(e.target.value) || 60)
571
+ }
572
+ ) })
573
+ ] })
574
+ ] }) }) }),
575
+ /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Box, { padding: 5, children: [
576
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.ui", defaultMessage: "Admin Interface Customization" }) }),
577
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
578
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
579
+ /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
580
+ /* @__PURE__ */ jsx(
581
+ Switch,
582
+ {
583
+ checked: settings.ui.showPaymentStatus,
584
+ onChange: (checked) => handleSettingChange("ui", "showPaymentStatus", checked)
585
+ }
586
+ ),
587
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.showStatus", defaultMessage: "Payment Status" }) })
588
+ ] }),
589
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Show status badges in lists" })
590
+ ] }) }),
591
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
592
+ /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
593
+ /* @__PURE__ */ jsx(
594
+ Switch,
595
+ {
596
+ checked: settings.ui.showCustomerInfo,
597
+ onChange: (checked) => handleSettingChange("ui", "showCustomerInfo", checked)
598
+ }
599
+ ),
600
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.showCustomerInfo", defaultMessage: "Customer Data" }) })
601
+ ] }),
602
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Display sensitive customer info" })
603
+ ] }) }),
604
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
605
+ /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
606
+ /* @__PURE__ */ jsx(
607
+ Switch,
608
+ {
609
+ checked: settings.ui.enableNotifications,
610
+ onChange: (checked) => handleSettingChange("ui", "enableNotifications", checked)
611
+ }
612
+ ),
613
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.notifications", defaultMessage: "Notifications" }) })
614
+ ] }),
615
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Browser alerts for success" })
616
+ ] }) }),
617
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
618
+ /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
619
+ /* @__PURE__ */ jsx(
620
+ Switch,
621
+ {
622
+ checked: settings.ui.compactView,
623
+ onChange: (checked) => handleSettingChange("ui", "compactView", checked)
624
+ }
625
+ ),
626
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.compactView", defaultMessage: "Compact Mode" }) })
627
+ ] }),
628
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Dense layout for tables" })
629
+ ] }) })
630
+ ] })
631
+ ] }) }) })
632
+ ] }),
633
+ showIntegrationModal && /* @__PURE__ */ jsx(
634
+ IntegrationModal,
635
+ {
636
+ publishableKey: settings.stripe.publishableKey,
637
+ onClose: () => setShowIntegrationModal(false)
638
+ }
639
+ )
640
+ ] });
641
+ };
642
+ export {
643
+ Settings
644
+ };
@@ -36,7 +36,7 @@ const index = {
36
36
  defaultMessage: "Payment Management"
37
37
  },
38
38
  Component: async () => {
39
- const { App } = await import("./App-BUSTbkyy.mjs");
39
+ const { App } = await import("./App-DXN62SV6.mjs");
40
40
  return App;
41
41
  }
42
42
  });
@@ -37,7 +37,7 @@ const index = {
37
37
  defaultMessage: "Payment Management"
38
38
  },
39
39
  Component: async () => {
40
- const { App } = await Promise.resolve().then(() => require("./App-B83DZ9NG.js"));
40
+ const { App } = await Promise.resolve().then(() => require("./App-Dk7XtjNA.js"));
41
41
  return App;
42
42
  }
43
43
  });