@reeboot/strapi-payment-plugin 0.0.6 → 0.0.8

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 (29) hide show
  1. package/README.md +21 -0
  2. package/dist/_chunks/{Analytics-CQmAVKsq.mjs → Analytics-CncK5kn-.mjs} +6 -7
  3. package/dist/_chunks/{Analytics-CLjtRWYA.js → Analytics-c8KBuG3k.js} +6 -7
  4. package/dist/_chunks/{App-DXN62SV6.mjs → App-B5AB8Omu.mjs} +7 -7
  5. package/dist/_chunks/{App-Dk7XtjNA.js → App-Cih9sWu1.js} +7 -7
  6. package/dist/_chunks/{Customers-BQzVBQDT.mjs → Customers-BVk2gx7w.mjs} +51 -118
  7. package/dist/_chunks/{Customers-BNDi4QBH.js → Customers-CZWOnN26.js} +50 -117
  8. package/dist/_chunks/{Dashboard-UUwohHZa.js → Dashboard-CEif4jQn.js} +60 -84
  9. package/dist/_chunks/{Dashboard-CuHC-dit.mjs → Dashboard-DAjD8Q_6.mjs} +60 -84
  10. package/dist/_chunks/{Orders-CitNCdWE.js → Orders-DZXb54VO.js} +73 -146
  11. package/dist/_chunks/{Orders-65mNfu2i.mjs → Orders-DdJqI1HB.mjs} +74 -147
  12. package/dist/_chunks/{PaymentList-B0CAzInT.mjs → PaymentList-3HWK7PMz.mjs} +14 -39
  13. package/dist/_chunks/{PaymentList-Dy1BAFoD.js → PaymentList-APfyYD1h.js} +14 -39
  14. package/dist/_chunks/{Payments-FnhoV_2B.mjs → Payments-DFL-Cwgy.mjs} +97 -103
  15. package/dist/_chunks/{Payments-TOnygGIW.js → Payments-VzDGbK4W.js} +96 -102
  16. package/dist/_chunks/{Settings-BJtDagUs.js → Settings-B1tR3WOm.js} +157 -161
  17. package/dist/_chunks/{Settings-EoLSuZLe.mjs → Settings-SALxClBu.mjs} +157 -161
  18. package/dist/_chunks/{index-2Zd_T7bD.mjs → index-CB6TMitx.mjs} +1 -1
  19. package/dist/_chunks/{index-CHEgJ7e5.js → index-D-fFikb8.js} +1 -1
  20. package/dist/admin/index.js +1 -1
  21. package/dist/admin/index.mjs +1 -1
  22. package/dist/server/index.js +7 -34
  23. package/dist/server/index.mjs +7 -34
  24. package/package.json +5 -4
  25. /package/dist/server/src/{types → services/types}/api.d.ts +0 -0
  26. /package/dist/server/src/{types → services/types}/customer.d.ts +0 -0
  27. /package/dist/server/src/{types → services/types}/index.d.ts +0 -0
  28. /package/dist/server/src/{types → services/types}/order.d.ts +0 -0
  29. /package/dist/server/src/{types → services/types}/payment.d.ts +0 -0
@@ -6,7 +6,7 @@ const designSystem = require("@strapi/design-system");
6
6
  const reactIntl = require("react-intl");
7
7
  const admin = require("@strapi/strapi/admin");
8
8
  const icons = require("@strapi/icons");
9
- const index = require("./index-CHEgJ7e5.js");
9
+ const index = require("./index-D-fFikb8.js");
10
10
  const IntegrationModal = ({ onClose, publishableKey }) => {
11
11
  const [copied, setCopied] = React.useState(null);
12
12
  const copyToClipboard = (text, type) => {
@@ -199,10 +199,13 @@ const Settings = () => {
199
199
  const [saving, setSaving] = React.useState(false);
200
200
  const [error, setError] = React.useState(null);
201
201
  const [success, setSuccess] = React.useState(null);
202
+ const [testStatus, setTestStatus] = React.useState("idle");
203
+ const [testMessage, setTestMessage] = React.useState("");
202
204
  const [hasChanges, setHasChanges] = React.useState(false);
203
205
  const [showIntegrationModal, setShowIntegrationModal] = React.useState(false);
204
206
  const [showSecretKey, setShowSecretKey] = React.useState(false);
205
207
  const [showWebhookSecret, setShowWebhookSecret] = React.useState(false);
208
+ const [showResetConfirm, setShowResetConfirm] = React.useState(false);
206
209
  React.useEffect(() => {
207
210
  fetchSettings();
208
211
  }, []);
@@ -211,51 +214,34 @@ const Settings = () => {
211
214
  setLoading(true);
212
215
  const { data } = await get(`/${index.PLUGIN_ID}/admin/config`);
213
216
  if (data.success && data.data) {
214
- const backendConfig = data.data;
215
- const initialSettings = {
217
+ const bc = data.data;
218
+ setSettings({
216
219
  stripe: {
217
- publishableKey: backendConfig.stripe?.publishableKey || "",
218
- secretKey: backendConfig.stripe?.secretKey || "",
219
- webhookSecret: backendConfig.stripe?.webhookSecret || "",
220
- apiVersion: backendConfig.stripe?.apiVersion || "2023-10-16",
221
- enabled: backendConfig.stripe?.enabled ?? true
220
+ publishableKey: bc.stripe?.publishableKey || "",
221
+ secretKey: bc.stripe?.secretKey || "",
222
+ webhookSecret: bc.stripe?.webhookSecret || "",
223
+ apiVersion: bc.stripe?.apiVersion || "2024-06-20",
224
+ enabled: bc.stripe?.enabled ?? true
222
225
  },
223
226
  payments: {
224
- defaultCurrency: backendConfig.payment?.defaultCurrency || "usd",
225
- supportedCurrencies: backendConfig.payment?.supportedCurrencies || ["usd"],
226
- enableRefunds: backendConfig.payment?.enableRefunds ?? true,
227
- enablePartialRefunds: backendConfig.payment?.enablePartialRefunds ?? true,
228
- refundWindow: backendConfig.payment?.refundWindow || 30,
229
- captureMethod: backendConfig.payment?.captureMethod || "automatic",
230
- confirmationMethod: backendConfig.payment?.confirmationMethod || "automatic"
231
- },
232
- webhooks: {
233
- enabled: true,
234
- endpoints: {
235
- paymentSucceeded: "",
236
- paymentFailed: "",
237
- refundCreated: "",
238
- invoiceCreated: ""
239
- },
240
- retries: 3,
241
- timeout: 30
227
+ defaultCurrency: bc.payment?.defaultCurrency || "usd",
228
+ enableRefunds: bc.payment?.enableRefunds ?? true,
229
+ enablePartialRefunds: bc.payment?.enablePartialRefunds ?? true,
230
+ refundWindow: bc.payment?.refundWindow || 30,
231
+ captureMethod: bc.payment?.captureMethod || "automatic"
242
232
  },
243
233
  ui: {
244
234
  showPaymentStatus: true,
245
235
  showCustomerInfo: true,
246
236
  enableNotifications: true,
247
- theme: "auto",
248
237
  compactView: false
249
238
  },
250
239
  security: {
251
- enableIpFiltering: false,
252
- allowedIps: [],
253
240
  requireAuthentication: true,
254
241
  enableAuditLog: true,
255
242
  sessionTimeout: 60
256
243
  }
257
- };
258
- setSettings(initialSettings);
244
+ });
259
245
  }
260
246
  setLoading(false);
261
247
  } catch (err) {
@@ -267,10 +253,7 @@ const Settings = () => {
267
253
  if (!settings) return;
268
254
  setSettings((prev) => ({
269
255
  ...prev,
270
- [section]: {
271
- ...prev[section],
272
- [key]: value
273
- }
256
+ [section]: { ...prev[section], [key]: value }
274
257
  }));
275
258
  setHasChanges(true);
276
259
  setSuccess(null);
@@ -280,14 +263,11 @@ const Settings = () => {
280
263
  setSaving(true);
281
264
  setError(null);
282
265
  if (!settings) return;
283
- const payload = {
266
+ await put(`/${index.PLUGIN_ID}/admin/config`, {
284
267
  stripe: settings.stripe,
285
268
  payment: settings.payments,
286
- logging: {
287
- enableWebhookLogging: true
288
- }
289
- };
290
- await put(`/${index.PLUGIN_ID}/admin/config`, payload);
269
+ logging: { enableWebhookLogging: true }
270
+ });
291
271
  setHasChanges(false);
292
272
  setSuccess("Settings saved successfully");
293
273
  setTimeout(() => setSuccess(null), 3e3);
@@ -297,32 +277,41 @@ const Settings = () => {
297
277
  setSaving(false);
298
278
  }
299
279
  };
300
- const resetSettings = () => {
301
- if (confirm("Are you sure you want to reset all settings to default? This action cannot be undone.")) {
302
- fetchSettings();
303
- setHasChanges(false);
304
- }
305
- };
306
280
  const testConnection = async () => {
307
281
  try {
308
282
  setSaving(true);
283
+ setTestStatus("idle");
309
284
  const { data } = await get(`/${index.PLUGIN_ID}/admin/config`);
310
285
  if (data.success) {
311
- alert("Connection to backend successful!");
286
+ setTestStatus("success");
287
+ setTestMessage("Connection to backend successful!");
312
288
  } else {
313
289
  throw new Error("Failed to connect");
314
290
  }
315
291
  } catch (err) {
316
- alert("Connection test failed. Please check your API keys and server logs.");
292
+ setTestStatus("error");
293
+ setTestMessage("Connection test failed. Check your API keys and server logs.");
317
294
  } finally {
318
295
  setSaving(false);
296
+ setTimeout(() => setTestStatus("idle"), 4e3);
319
297
  }
320
298
  };
299
+ const copyToClipboard = (text) => {
300
+ navigator.clipboard.writeText(text);
301
+ };
321
302
  if (loading) {
322
303
  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..." }) }) }) });
323
304
  }
324
305
  if (!settings) {
325
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", children: formatMessage({ id: "payment-plugin.settings.error", defaultMessage: "Failed to load settings" }) }) });
306
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
307
+ designSystem.Alert,
308
+ {
309
+ variant: "danger",
310
+ closeLabel: formatMessage({ id: "payment-plugin.alert.close", defaultMessage: "Close alert" }),
311
+ onClose: () => setError(null),
312
+ children: formatMessage({ id: "payment-plugin.settings.error", defaultMessage: "Failed to load settings" })
313
+ }
314
+ ) });
326
315
  }
327
316
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
328
317
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
@@ -333,45 +322,46 @@ const Settings = () => {
333
322
  defaultMessage: "Configure your payment plugin settings"
334
323
  }) })
335
324
  ] }),
336
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
337
- hasChanges && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "warning600", children: "Unsaved changes" }) }),
338
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: resetSettings, children: formatMessage({ id: "payment-plugin.settings.reset", defaultMessage: "Reset" }) }),
339
- /* @__PURE__ */ jsxRuntime.jsx(
340
- designSystem.Button,
341
- {
342
- variant: "secondary",
343
- onClick: testConnection,
344
- disabled: saving,
345
- children: formatMessage({ id: "payment-plugin.settings.testConnection", defaultMessage: "Test Connection" })
346
- }
347
- ),
348
- /* @__PURE__ */ jsxRuntime.jsx(
349
- designSystem.Button,
350
- {
351
- onClick: saveSettings,
352
- disabled: !hasChanges || saving,
353
- loading: saving,
354
- children: formatMessage({ id: "payment-plugin.settings.save", defaultMessage: "Save Settings" })
355
- }
356
- ),
357
- /* @__PURE__ */ jsxRuntime.jsx(
358
- designSystem.Button,
359
- {
360
- variant: "tertiary",
361
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Code, {}),
362
- onClick: () => setShowIntegrationModal(true),
363
- children: formatMessage({ id: "payment-plugin.settings.integration", defaultMessage: "Integration Guide" })
364
- }
365
- )
325
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
326
+ hasChanges && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "warning600", children: "Unsaved changes" }),
327
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: () => setShowResetConfirm(true), children: formatMessage({ id: "payment-plugin.settings.reset", defaultMessage: "Reset" }) }),
328
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: testConnection, disabled: saving, children: formatMessage({ id: "payment-plugin.settings.testConnection", defaultMessage: "Test Connection" }) }),
329
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: saveSettings, disabled: !hasChanges || saving, loading: saving, children: formatMessage({ id: "payment-plugin.settings.save", defaultMessage: "Save Settings" }) }),
330
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Code, {}), onClick: () => setShowIntegrationModal(true), children: formatMessage({ id: "payment-plugin.settings.integration", defaultMessage: "Integration Guide" }) })
366
331
  ] })
367
332
  ] }) }),
368
- error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", onClose: () => setError(null), children: error }) }),
369
- success && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "success", onClose: () => setSuccess(null), children: success }) }),
333
+ error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
334
+ designSystem.Alert,
335
+ {
336
+ variant: "danger",
337
+ closeLabel: formatMessage({ id: "payment-plugin.alert.close", defaultMessage: "Close alert" }),
338
+ onClose: () => setError(null),
339
+ children: error
340
+ }
341
+ ) }),
342
+ success && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
343
+ designSystem.Alert,
344
+ {
345
+ variant: "success",
346
+ closeLabel: formatMessage({ id: "payment-plugin.alert.close", defaultMessage: "Close alert" }),
347
+ onClose: () => setSuccess(null),
348
+ children: success
349
+ }
350
+ ) }),
351
+ testStatus !== "idle" && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
352
+ designSystem.Alert,
353
+ {
354
+ variant: testStatus === "success" ? "success" : "danger",
355
+ closeLabel: formatMessage({ id: "payment-plugin.alert.close", defaultMessage: "Close alert" }),
356
+ onClose: () => setTestStatus("idle"),
357
+ children: testMessage
358
+ }
359
+ ) }),
370
360
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 6, children: [
371
361
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 5, children: [
372
362
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, children: [
373
363
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
374
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { color: "primary600", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Key, { width: "1.5rem", height: "1.5rem" }) }),
364
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Key, { width: "1.5rem", height: "1.5rem" }),
375
365
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage({ id: "payment-plugin.settings.stripe", defaultMessage: "Stripe API Configuration" }) })
376
366
  ] }),
377
367
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { variant: settings.stripe.enabled ? "success" : "neutral", children: settings.stripe.enabled ? "Stripe Active" : "Stripe Disabled" })
@@ -388,10 +378,8 @@ const Settings = () => {
388
378
  designSystem.Button,
389
379
  {
390
380
  variant: "ghost",
391
- onClick: () => {
392
- navigator.clipboard.writeText(settings.stripe.publishableKey);
393
- alert("Copied to clipboard");
394
- },
381
+ onClick: () => copyToClipboard(settings.stripe.publishableKey),
382
+ "aria-label": "Copy publishable key",
395
383
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, { width: "1rem", height: "1rem" })
396
384
  }
397
385
  )
@@ -411,6 +399,7 @@ const Settings = () => {
411
399
  {
412
400
  variant: "ghost",
413
401
  onClick: () => setShowSecretKey(!showSecretKey),
402
+ "aria-label": showSecretKey ? "Hide secret key" : "Show secret key",
414
403
  children: showSecretKey ? /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { width: "1rem", height: "1rem" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, { width: "1rem", height: "1rem" })
415
404
  }
416
405
  ),
@@ -418,10 +407,8 @@ const Settings = () => {
418
407
  designSystem.Button,
419
408
  {
420
409
  variant: "ghost",
421
- onClick: () => {
422
- navigator.clipboard.writeText(settings.stripe.secretKey);
423
- alert("Copied to clipboard");
424
- },
410
+ onClick: () => copyToClipboard(settings.stripe.secretKey),
411
+ "aria-label": "Copy secret key",
425
412
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, { width: "1rem", height: "1rem" })
426
413
  }
427
414
  )
@@ -442,6 +429,7 @@ const Settings = () => {
442
429
  {
443
430
  variant: "ghost",
444
431
  onClick: () => setShowWebhookSecret(!showWebhookSecret),
432
+ "aria-label": showWebhookSecret ? "Hide webhook secret" : "Show webhook secret",
445
433
  children: showWebhookSecret ? /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { width: "1rem", height: "1rem" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, { width: "1rem", height: "1rem" })
446
434
  }
447
435
  ),
@@ -449,10 +437,8 @@ const Settings = () => {
449
437
  designSystem.Button,
450
438
  {
451
439
  variant: "ghost",
452
- onClick: () => {
453
- navigator.clipboard.writeText(settings.stripe.webhookSecret);
454
- alert("Copied to clipboard");
455
- },
440
+ onClick: () => copyToClipboard(settings.stripe.webhookSecret),
441
+ "aria-label": "Copy webhook secret",
456
442
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, { width: "1rem", height: "1rem" })
457
443
  }
458
444
  )
@@ -476,13 +462,13 @@ const Settings = () => {
476
462
  /* @__PURE__ */ jsxRuntime.jsx(
477
463
  designSystem.Switch,
478
464
  {
479
- label: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Enable Stripe Payments" }),
480
- selected: settings.stripe.enabled,
481
- onChange: () => handleSettingChange("stripe", "enabled", !settings.stripe.enabled)
465
+ checked: settings.stripe.enabled,
466
+ onCheckedChange: (checked) => handleSettingChange("stripe", "enabled", checked),
467
+ "aria-label": formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Enable Stripe Payments" })
482
468
  }
483
469
  ),
484
470
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
485
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.enabled", defaultMessage: "Payment Gateway Status" }) }),
471
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.gatewayStatus", defaultMessage: "Payment Gateway Status" }) }),
486
472
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.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." })
487
473
  ] })
488
474
  ] }) }) })
@@ -539,9 +525,9 @@ const Settings = () => {
539
525
  /* @__PURE__ */ jsxRuntime.jsx(
540
526
  designSystem.Switch,
541
527
  {
542
- label: formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Require Authentication" }),
543
- selected: settings.security.requireAuthentication,
544
- onChange: () => handleSettingChange("security", "requireAuthentication", !settings.security.requireAuthentication)
528
+ checked: settings.security.requireAuthentication,
529
+ onCheckedChange: (checked) => handleSettingChange("security", "requireAuthentication", checked),
530
+ "aria-label": formatMessage({ id: "payment-plugin.settings.requireAuth", defaultMessage: "Require Authentication" })
545
531
  }
546
532
  ),
547
533
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
@@ -553,9 +539,9 @@ const Settings = () => {
553
539
  /* @__PURE__ */ jsxRuntime.jsx(
554
540
  designSystem.Switch,
555
541
  {
556
- label: formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Enable Audit Log" }),
557
- selected: settings.security.enableAuditLog,
558
- onChange: () => handleSettingChange("security", "enableAuditLog", !settings.security.enableAuditLog)
542
+ checked: settings.security.enableAuditLog,
543
+ onCheckedChange: (checked) => handleSettingChange("security", "enableAuditLog", checked),
544
+ "aria-label": formatMessage({ id: "payment-plugin.settings.auditLog", defaultMessage: "Enable Audit Log" })
559
545
  }
560
546
  ),
561
547
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
@@ -563,10 +549,13 @@ const Settings = () => {
563
549
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Detailed logs of all transaction attempts and configuration changes." })
564
550
  ] })
565
551
  ] }) }),
566
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, marginTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
552
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
567
553
  designSystem.TextInput,
568
554
  {
569
- label: formatMessage({ id: "payment-plugin.settings.sessionTimeout", defaultMessage: "Checkout Session Timeout (Minutes)" }),
555
+ label: formatMessage({
556
+ id: "payment-plugin.settings.sessionTimeout",
557
+ defaultMessage: "Checkout Session Timeout (Minutes)"
558
+ }),
570
559
  type: "number",
571
560
  value: settings.security.sessionTimeout.toString(),
572
561
  onChange: (e) => handleSettingChange("security", "sessionTimeout", parseInt(e.target.value) || 60)
@@ -576,62 +565,69 @@ const Settings = () => {
576
565
  ] }) }) }),
577
566
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 5, children: [
578
567
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", marginBottom: 4, children: formatMessage({ id: "payment-plugin.settings.ui", defaultMessage: "Admin Interface Customization" }) }),
579
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
580
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
581
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
582
- /* @__PURE__ */ jsxRuntime.jsx(
583
- designSystem.Switch,
584
- {
585
- checked: settings.ui.showPaymentStatus,
586
- onChange: (checked) => handleSettingChange("ui", "showPaymentStatus", checked)
587
- }
588
- ),
589
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.showStatus", defaultMessage: "Payment Status" }) })
590
- ] }),
591
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Show status badges in lists" })
592
- ] }) }),
593
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
594
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
595
- /* @__PURE__ */ jsxRuntime.jsx(
596
- designSystem.Switch,
597
- {
598
- checked: settings.ui.showCustomerInfo,
599
- onChange: (checked) => handleSettingChange("ui", "showCustomerInfo", checked)
600
- }
601
- ),
602
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.showCustomerInfo", defaultMessage: "Customer Data" }) })
603
- ] }),
604
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Display sensitive customer info" })
605
- ] }) }),
606
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
607
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
608
- /* @__PURE__ */ jsxRuntime.jsx(
609
- designSystem.Switch,
610
- {
611
- checked: settings.ui.enableNotifications,
612
- onChange: (checked) => handleSettingChange("ui", "enableNotifications", checked)
613
- }
614
- ),
615
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.notifications", defaultMessage: "Notifications" }) })
616
- ] }),
617
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Browser alerts for success" })
618
- ] }) }),
619
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
620
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
621
- /* @__PURE__ */ jsxRuntime.jsx(
622
- designSystem.Switch,
623
- {
624
- checked: settings.ui.compactView,
625
- onChange: (checked) => handleSettingChange("ui", "compactView", checked)
626
- }
627
- ),
628
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({ id: "payment-plugin.settings.compactView", defaultMessage: "Compact Mode" }) })
629
- ] }),
630
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Dense layout for tables" })
631
- ] }) })
632
- ] })
568
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: [
569
+ {
570
+ key: "showPaymentStatus",
571
+ label: formatMessage({ id: "payment-plugin.settings.showStatus", defaultMessage: "Payment Status" }),
572
+ hint: "Show status badges in lists",
573
+ value: settings.ui.showPaymentStatus
574
+ },
575
+ {
576
+ key: "showCustomerInfo",
577
+ label: formatMessage({ id: "payment-plugin.settings.showCustomerInfo", defaultMessage: "Customer Data" }),
578
+ hint: "Display sensitive customer info",
579
+ value: settings.ui.showCustomerInfo
580
+ },
581
+ {
582
+ key: "enableNotifications",
583
+ label: formatMessage({ id: "payment-plugin.settings.notifications", defaultMessage: "Notifications" }),
584
+ hint: "Browser alerts for success",
585
+ value: settings.ui.enableNotifications
586
+ },
587
+ {
588
+ key: "compactView",
589
+ label: formatMessage({ id: "payment-plugin.settings.compactView", defaultMessage: "Compact Mode" }),
590
+ hint: "Dense layout for tables",
591
+ value: settings.ui.compactView
592
+ }
593
+ ].map(({ key, label, hint, value }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
594
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
595
+ /* @__PURE__ */ jsxRuntime.jsx(
596
+ designSystem.Switch,
597
+ {
598
+ checked: value,
599
+ onCheckedChange: (checked) => handleSettingChange("ui", key, checked),
600
+ "aria-label": label
601
+ }
602
+ ),
603
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: label })
604
+ ] }),
605
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: hint })
606
+ ] }) }, key)) })
633
607
  ] }) }) })
634
608
  ] }),
609
+ showResetConfirm && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: true, onOpenChange: () => setShowResetConfirm(false), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
610
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", as: "h2", children: formatMessage({ id: "payment-plugin.settings.resetConfirm.title", defaultMessage: "Reset Settings?" }) }) }),
611
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
612
+ id: "payment-plugin.settings.resetConfirm.body",
613
+ defaultMessage: "This will reload settings from the server and discard all unsaved changes."
614
+ }) }) }),
615
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
616
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: () => setShowResetConfirm(false), children: formatMessage({ id: "payment-plugin.settings.cancel", defaultMessage: "Cancel" }) }),
617
+ /* @__PURE__ */ jsxRuntime.jsx(
618
+ designSystem.Button,
619
+ {
620
+ variant: "danger-light",
621
+ onClick: () => {
622
+ setShowResetConfirm(false);
623
+ fetchSettings();
624
+ setHasChanges(false);
625
+ },
626
+ children: formatMessage({ id: "payment-plugin.settings.resetConfirm", defaultMessage: "Reset" })
627
+ }
628
+ )
629
+ ] })
630
+ ] }) }),
635
631
  showIntegrationModal && /* @__PURE__ */ jsxRuntime.jsx(
636
632
  IntegrationModal,
637
633
  {