@easypayment/medusa-paypal 0.2.4 → 0.2.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.
@@ -41,17 +41,11 @@ function PayPalTabs() {
41
41
  }) }) });
42
42
  }
43
43
  const DEFAULT_FORM$1 = {
44
- paymentAction: "capture",
45
- brandName: "PayPal",
46
- landingPage: "no_preference",
47
- requireInstantPayment: false,
48
- useShippingAsBilling: true,
49
- sendItemDetails: true,
50
- skipOrderReviewPage: true,
51
- invoicePrefix: "WC-",
52
- creditCardStatementName: "PayPal",
53
- enableLogging: true,
54
- logPath: "/uploads/wc-logs/"
44
+ enabled: true,
45
+ title: "Credit or Debit Card",
46
+ disabledCards: [],
47
+ threeDS: "when_required",
48
+ cardSaveEnabled: false
55
49
  };
56
50
  function mergeWithDefaults$1(saved) {
57
51
  if (!saved) return { ...DEFAULT_FORM$1 };
@@ -61,6 +55,53 @@ function mergeWithDefaults$1(saved) {
61
55
  ...Object.fromEntries(entries)
62
56
  };
63
57
  }
58
+ const CARD_BRANDS = [
59
+ { value: "visa", label: "Visa" },
60
+ { value: "mastercard", label: "Mastercard" },
61
+ { value: "amex", label: "American Express" },
62
+ { value: "discover", label: "Discover" },
63
+ { value: "diners", label: "Diners Club" },
64
+ { value: "jcb", label: "JCB" },
65
+ { value: "unionpay", label: "UnionPay" }
66
+ ];
67
+ const THREE_DS_OPTIONS = [
68
+ {
69
+ value: "when_required",
70
+ label: "3D Secure when required",
71
+ hint: "Triggers 3DS only when the card / issuer requires it."
72
+ },
73
+ {
74
+ value: "sli",
75
+ label: "3D Secure (SCA) / liability shift (recommended)",
76
+ hint: "Attempts to optimize for liability shift while remaining compliant."
77
+ },
78
+ {
79
+ value: "always",
80
+ label: "Always request 3D Secure",
81
+ hint: "Forces 3DS challenge whenever possible (may reduce conversion)."
82
+ }
83
+ ];
84
+ function cx$1(...parts) {
85
+ return parts.filter(Boolean).join(" ");
86
+ }
87
+ function Pill$1({
88
+ children,
89
+ onRemove
90
+ }) {
91
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 rounded-md border border-ui-border-base bg-ui-bg-base px-2 py-1 text-sm text-ui-fg-base", children: [
92
+ children,
93
+ onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
94
+ "button",
95
+ {
96
+ type: "button",
97
+ onClick: onRemove,
98
+ className: "ml-1 rounded px-1 text-ui-fg-subtle hover:text-ui-fg-base",
99
+ "aria-label": "Remove",
100
+ children: "×"
101
+ }
102
+ ) : null
103
+ ] });
104
+ }
64
105
  function SectionCard$2({
65
106
  title,
66
107
  description,
@@ -91,10 +132,12 @@ function FieldRow$2({
91
132
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 md:col-span-8", children })
92
133
  ] });
93
134
  }
94
- function AdditionalSettingsTab() {
135
+ function AdvancedCardPaymentsTab() {
136
+ var _a, _b;
95
137
  const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM$1 }));
96
138
  const [loading, setLoading] = react.useState(false);
97
139
  const [saving, setSaving] = react.useState(false);
140
+ const [toast, setToast] = react.useState(null);
98
141
  const didInit = react.useRef(false);
99
142
  react.useEffect(() => {
100
143
  if (didInit.current) return;
@@ -109,7 +152,7 @@ function AdditionalSettingsTab() {
109
152
  if (!r.ok) return;
110
153
  const json = await r.json();
111
154
  const payload = (json == null ? void 0 : json.data) ?? json;
112
- const saved = payload == null ? void 0 : payload.additional_settings;
155
+ const saved = payload == null ? void 0 : payload.advanced_card_payments;
113
156
  if (saved && typeof saved === "object") {
114
157
  setForm(mergeWithDefaults$1(saved));
115
158
  }
@@ -118,11 +161,9 @@ function AdditionalSettingsTab() {
118
161
  }
119
162
  })();
120
163
  }, []);
121
- const [toast, setToast] = react.useState(null);
122
164
  async function onSave() {
123
165
  try {
124
166
  setSaving(true);
125
- setToast(null);
126
167
  const r = await fetch("/admin/paypal/settings", {
127
168
  method: "POST",
128
169
  credentials: "include",
@@ -130,29 +171,42 @@ function AdditionalSettingsTab() {
130
171
  "Content-Type": "application/json",
131
172
  "Accept": "application/json"
132
173
  },
133
- body: JSON.stringify({
134
- additional_settings: form
135
- })
174
+ body: JSON.stringify({ advanced_card_payments: form })
136
175
  });
137
176
  if (!r.ok) {
138
- const errText = await r.text().catch(() => "");
139
- throw new Error(errText || "Failed to save settings");
177
+ const t = await r.text();
178
+ setToast({ type: "error", message: "Failed to save settings. " + t });
179
+ window.setTimeout(() => setToast(null), 3500);
180
+ return;
140
181
  }
141
- const json = await r.json().catch(() => ({}));
182
+ const json = await r.json().catch(() => null);
142
183
  const payload = (json == null ? void 0 : json.data) ?? json;
143
- const saved = payload == null ? void 0 : payload.additional_settings;
184
+ const saved = payload == null ? void 0 : payload.advanced_card_payments;
144
185
  if (saved && typeof saved === "object") {
145
186
  setForm(mergeWithDefaults$1(saved));
146
187
  }
147
188
  setToast({ type: "success", message: "Settings saved" });
148
189
  window.setTimeout(() => setToast(null), 2500);
149
- } catch (e) {
150
- setToast({ type: "error", message: (e == null ? void 0 : e.message) || "Failed to save settings" });
151
- window.setTimeout(() => setToast(null), 3500);
152
190
  } finally {
153
191
  setSaving(false);
154
192
  }
155
193
  }
194
+ const disabledSet = react.useMemo(() => new Set(form.disabledCards), [form.disabledCards]);
195
+ function toggleDisabledCard(value) {
196
+ setForm((prev) => {
197
+ const exists = prev.disabledCards.includes(value);
198
+ return {
199
+ ...prev,
200
+ disabledCards: exists ? prev.disabledCards.filter((v) => v !== value) : [...prev.disabledCards, value]
201
+ };
202
+ });
203
+ }
204
+ function removeDisabledCard(value) {
205
+ setForm((prev) => ({
206
+ ...prev,
207
+ disabledCards: prev.disabledCards.filter((v) => v !== value)
208
+ }));
209
+ }
156
210
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
157
211
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
158
212
  /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
@@ -168,8 +222,8 @@ function AdditionalSettingsTab() {
168
222
  /* @__PURE__ */ jsxRuntime.jsx(
169
223
  SectionCard$2,
170
224
  {
171
- title: "Additional Settings",
172
- description: "These settings control checkout behavior, PayPal experience, and logging.",
225
+ title: "Advanced Card Payments",
226
+ description: "Control card checkout settings, 3D Secure behavior, and card saving.",
173
227
  right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
174
228
  /* @__PURE__ */ jsxRuntime.jsx(
175
229
  "button",
@@ -184,164 +238,114 @@ function AdditionalSettingsTab() {
184
238
  loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
185
239
  ] }),
186
240
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
187
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Payment action", children: /* @__PURE__ */ jsxRuntime.jsxs(
188
- "select",
189
- {
190
- value: form.paymentAction,
191
- onChange: (e) => setForm((p) => ({ ...p, paymentAction: e.target.value })),
192
- className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
193
- children: [
194
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "capture", children: "Capture" }),
195
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorize", children: "Authorize" })
196
- ]
197
- }
198
- ) }),
199
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Brand Name", children: /* @__PURE__ */ jsxRuntime.jsx(
200
- "input",
201
- {
202
- value: form.brandName,
203
- onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })),
204
- className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
205
- placeholder: "PayPal"
206
- }
207
- ) }),
208
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Landing Page", children: /* @__PURE__ */ jsxRuntime.jsxs(
209
- "select",
210
- {
211
- value: form.landingPage,
212
- onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })),
213
- className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
214
- children: [
215
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "no_preference", children: "No Preference" }),
216
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login" }),
217
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Billing" })
218
- ]
219
- }
220
- ) }),
221
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Instant Payments", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
241
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
222
242
  /* @__PURE__ */ jsxRuntime.jsx(
223
243
  "input",
224
244
  {
225
245
  type: "checkbox",
226
- checked: form.requireInstantPayment,
227
- onChange: (e) => setForm((p) => ({ ...p, requireInstantPayment: e.target.checked })),
246
+ checked: form.enabled,
247
+ onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })),
228
248
  className: "h-4 w-4 rounded border-ui-border-base"
229
249
  }
230
250
  ),
231
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
251
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
232
252
  ] }) }),
233
- /* @__PURE__ */ jsxRuntime.jsx(
234
- FieldRow$2,
253
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Title", children: /* @__PURE__ */ jsxRuntime.jsx(
254
+ "input",
235
255
  {
236
- label: "Billing Address",
237
- hint: "If the billing address is empty and PayPal provides a shipping address, the order will use the shipping address as the billing address.",
238
- children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
239
- /* @__PURE__ */ jsxRuntime.jsx(
240
- "input",
241
- {
242
- type: "checkbox",
243
- checked: form.useShippingAsBilling,
244
- onChange: (e) => setForm((p) => ({ ...p, useShippingAsBilling: e.target.checked })),
245
- className: "h-4 w-4 rounded border-ui-border-base"
246
- }
247
- ),
248
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Use PayPal Shipping Address as Billing" })
249
- ] })
256
+ value: form.title,
257
+ onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })),
258
+ className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
259
+ placeholder: "Credit or Debit Card"
250
260
  }
251
- ),
261
+ ) }),
252
262
  /* @__PURE__ */ jsxRuntime.jsx(
253
263
  FieldRow$2,
254
264
  {
255
- label: "Send Item Details",
256
- hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.",
257
- children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
258
- /* @__PURE__ */ jsxRuntime.jsx(
259
- "input",
260
- {
261
- type: "checkbox",
262
- checked: form.sendItemDetails,
263
- onChange: (e) => setForm((p) => ({ ...p, sendItemDetails: e.target.checked })),
264
- className: "h-4 w-4 rounded border-ui-border-base"
265
- }
266
- ),
267
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
265
+ label: "Disable specific credit cards",
266
+ hint: "Select card brands to hide from the card form.",
267
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
268
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: form.disabledCards.length ? form.disabledCards.map((v) => {
269
+ var _a2;
270
+ const label = ((_a2 = CARD_BRANDS.find((b) => b.value === v)) == null ? void 0 : _a2.label) ?? v;
271
+ return /* @__PURE__ */ jsxRuntime.jsx(Pill$1, { onRemove: () => removeDisabledCard(v), children: label }, v);
272
+ }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No card brands disabled." }) }),
273
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2 md:grid-cols-2", children: CARD_BRANDS.map((b) => {
274
+ const checked = disabledSet.has(b.value);
275
+ return /* @__PURE__ */ jsxRuntime.jsxs(
276
+ "label",
277
+ {
278
+ className: cx$1(
279
+ "flex items-center gap-2 rounded-md p-2",
280
+ "hover:bg-ui-bg-subtle"
281
+ ),
282
+ children: [
283
+ /* @__PURE__ */ jsxRuntime.jsx(
284
+ "input",
285
+ {
286
+ type: "checkbox",
287
+ checked,
288
+ onChange: () => toggleDisabledCard(b.value),
289
+ className: "h-4 w-4 rounded border-ui-border-base"
290
+ }
291
+ ),
292
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: b.label })
293
+ ]
294
+ },
295
+ b.value
296
+ );
297
+ }) }) })
268
298
  ] })
269
299
  }
270
300
  ),
271
301
  /* @__PURE__ */ jsxRuntime.jsx(
272
302
  FieldRow$2,
273
303
  {
274
- label: "Order Review Page",
275
- hint: "Payments from the Product or Cart page skip the review step and go straight to the Thank You page.",
276
- children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
304
+ label: "Contingency for 3D Secure",
305
+ hint: "Choose when 3D Secure should be triggered during card payments.",
306
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
277
307
  /* @__PURE__ */ jsxRuntime.jsx(
278
- "input",
308
+ "select",
279
309
  {
280
- type: "checkbox",
281
- checked: form.skipOrderReviewPage,
282
- onChange: (e) => setForm((p) => ({ ...p, skipOrderReviewPage: e.target.checked })),
283
- className: "h-4 w-4 rounded border-ui-border-base"
310
+ value: form.threeDS,
311
+ onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })),
312
+ className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
313
+ children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
284
314
  }
285
315
  ),
286
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Skip Order Review Page" })
316
+ ((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
287
317
  ] })
288
318
  }
289
319
  ),
290
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Invoice prefix", children: /* @__PURE__ */ jsxRuntime.jsx(
291
- "input",
292
- {
293
- value: form.invoicePrefix,
294
- onChange: (e) => setForm((p) => ({ ...p, invoicePrefix: e.target.value })),
295
- className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
296
- placeholder: "WC-"
297
- }
298
- ) }),
299
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Credit Card Statement Name", children: /* @__PURE__ */ jsxRuntime.jsx(
300
- "input",
301
- {
302
- value: form.creditCardStatementName,
303
- onChange: (e) => setForm((p) => ({ ...p, creditCardStatementName: e.target.value })),
304
- className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
305
- placeholder: "PayPal"
306
- }
307
- ) }),
308
- /* @__PURE__ */ jsxRuntime.jsx(
309
- FieldRow$2,
310
- {
311
- label: "Debug log",
312
- hint: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
313
- "Log PayPal events such as Webhook, Payment, Refund.",
314
- " ",
315
- form.logPath ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
316
- "Log location: ",
317
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: form.logPath })
318
- ] }) : null
319
- ] }),
320
- children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
321
- /* @__PURE__ */ jsxRuntime.jsx(
322
- "input",
323
- {
324
- type: "checkbox",
325
- checked: form.enableLogging,
326
- onChange: (e) => setForm((p) => ({ ...p, enableLogging: e.target.checked })),
327
- className: "h-4 w-4 rounded border-ui-border-base"
328
- }
329
- ),
330
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable logging" })
331
- ] })
332
- }
333
- )
320
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Card Save Enabled", hint: "Allow customers to save a card at checkout for future use.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
321
+ /* @__PURE__ */ jsxRuntime.jsx(
322
+ "input",
323
+ {
324
+ type: "checkbox",
325
+ checked: form.cardSaveEnabled,
326
+ onChange: (e) => setForm((p) => ({ ...p, cardSaveEnabled: e.target.checked })),
327
+ className: "h-4 w-4 rounded border-ui-border-base"
328
+ }
329
+ ),
330
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable card saving at checkout" })
331
+ ] }) })
334
332
  ] })
335
333
  }
336
334
  )
337
335
  ] }) });
338
336
  }
339
337
  const DEFAULT_FORM = {
340
- enabled: true,
341
- title: "Credit or Debit Card",
342
- disabledCards: [],
343
- threeDS: "when_required",
344
- cardSaveEnabled: false
338
+ paymentAction: "capture",
339
+ brandName: "PayPal",
340
+ landingPage: "no_preference",
341
+ requireInstantPayment: false,
342
+ useShippingAsBilling: true,
343
+ sendItemDetails: true,
344
+ skipOrderReviewPage: true,
345
+ invoicePrefix: "WC-",
346
+ creditCardStatementName: "PayPal",
347
+ enableLogging: true,
348
+ logPath: "/uploads/wc-logs/"
345
349
  };
346
350
  function mergeWithDefaults(saved) {
347
351
  if (!saved) return { ...DEFAULT_FORM };
@@ -351,53 +355,6 @@ function mergeWithDefaults(saved) {
351
355
  ...Object.fromEntries(entries)
352
356
  };
353
357
  }
354
- const CARD_BRANDS = [
355
- { value: "visa", label: "Visa" },
356
- { value: "mastercard", label: "Mastercard" },
357
- { value: "amex", label: "American Express" },
358
- { value: "discover", label: "Discover" },
359
- { value: "diners", label: "Diners Club" },
360
- { value: "jcb", label: "JCB" },
361
- { value: "unionpay", label: "UnionPay" }
362
- ];
363
- const THREE_DS_OPTIONS = [
364
- {
365
- value: "when_required",
366
- label: "3D Secure when required",
367
- hint: "Triggers 3DS only when the card / issuer requires it."
368
- },
369
- {
370
- value: "sli",
371
- label: "3D Secure (SCA) / liability shift (recommended)",
372
- hint: "Attempts to optimize for liability shift while remaining compliant."
373
- },
374
- {
375
- value: "always",
376
- label: "Always request 3D Secure",
377
- hint: "Forces 3DS challenge whenever possible (may reduce conversion)."
378
- }
379
- ];
380
- function cx$1(...parts) {
381
- return parts.filter(Boolean).join(" ");
382
- }
383
- function Pill$1({
384
- children,
385
- onRemove
386
- }) {
387
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 rounded-md border border-ui-border-base bg-ui-bg-base px-2 py-1 text-sm text-ui-fg-base", children: [
388
- children,
389
- onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
390
- "button",
391
- {
392
- type: "button",
393
- onClick: onRemove,
394
- className: "ml-1 rounded px-1 text-ui-fg-subtle hover:text-ui-fg-base",
395
- "aria-label": "Remove",
396
- children: "×"
397
- }
398
- ) : null
399
- ] });
400
- }
401
358
  function SectionCard$1({
402
359
  title,
403
360
  description,
@@ -428,12 +385,10 @@ function FieldRow$1({
428
385
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 md:col-span-8", children })
429
386
  ] });
430
387
  }
431
- function AdvancedCardPaymentsTab() {
432
- var _a, _b;
388
+ function AdditionalSettingsTab() {
433
389
  const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM }));
434
390
  const [loading, setLoading] = react.useState(false);
435
391
  const [saving, setSaving] = react.useState(false);
436
- const [toast, setToast] = react.useState(null);
437
392
  const didInit = react.useRef(false);
438
393
  react.useEffect(() => {
439
394
  if (didInit.current) return;
@@ -448,7 +403,7 @@ function AdvancedCardPaymentsTab() {
448
403
  if (!r.ok) return;
449
404
  const json = await r.json();
450
405
  const payload = (json == null ? void 0 : json.data) ?? json;
451
- const saved = payload == null ? void 0 : payload.advanced_card_payments;
406
+ const saved = payload == null ? void 0 : payload.additional_settings;
452
407
  if (saved && typeof saved === "object") {
453
408
  setForm(mergeWithDefaults(saved));
454
409
  }
@@ -457,9 +412,11 @@ function AdvancedCardPaymentsTab() {
457
412
  }
458
413
  })();
459
414
  }, []);
415
+ const [toast, setToast] = react.useState(null);
460
416
  async function onSave() {
461
417
  try {
462
418
  setSaving(true);
419
+ setToast(null);
463
420
  const r = await fetch("/admin/paypal/settings", {
464
421
  method: "POST",
465
422
  credentials: "include",
@@ -467,42 +424,29 @@ function AdvancedCardPaymentsTab() {
467
424
  "Content-Type": "application/json",
468
425
  "Accept": "application/json"
469
426
  },
470
- body: JSON.stringify({ advanced_card_payments: form })
427
+ body: JSON.stringify({
428
+ additional_settings: form
429
+ })
471
430
  });
472
431
  if (!r.ok) {
473
- const t = await r.text();
474
- setToast({ type: "error", message: "Failed to save settings. " + t });
475
- window.setTimeout(() => setToast(null), 3500);
476
- return;
432
+ const errText = await r.text().catch(() => "");
433
+ throw new Error(errText || "Failed to save settings");
477
434
  }
478
- const json = await r.json().catch(() => null);
435
+ const json = await r.json().catch(() => ({}));
479
436
  const payload = (json == null ? void 0 : json.data) ?? json;
480
- const saved = payload == null ? void 0 : payload.advanced_card_payments;
437
+ const saved = payload == null ? void 0 : payload.additional_settings;
481
438
  if (saved && typeof saved === "object") {
482
439
  setForm(mergeWithDefaults(saved));
483
440
  }
484
441
  setToast({ type: "success", message: "Settings saved" });
485
442
  window.setTimeout(() => setToast(null), 2500);
443
+ } catch (e) {
444
+ setToast({ type: "error", message: (e == null ? void 0 : e.message) || "Failed to save settings" });
445
+ window.setTimeout(() => setToast(null), 3500);
486
446
  } finally {
487
447
  setSaving(false);
488
448
  }
489
449
  }
490
- const disabledSet = react.useMemo(() => new Set(form.disabledCards), [form.disabledCards]);
491
- function toggleDisabledCard(value) {
492
- setForm((prev) => {
493
- const exists = prev.disabledCards.includes(value);
494
- return {
495
- ...prev,
496
- disabledCards: exists ? prev.disabledCards.filter((v) => v !== value) : [...prev.disabledCards, value]
497
- };
498
- });
499
- }
500
- function removeDisabledCard(value) {
501
- setForm((prev) => ({
502
- ...prev,
503
- disabledCards: prev.disabledCards.filter((v) => v !== value)
504
- }));
505
- }
506
450
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
507
451
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
508
452
  /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
@@ -518,8 +462,8 @@ function AdvancedCardPaymentsTab() {
518
462
  /* @__PURE__ */ jsxRuntime.jsx(
519
463
  SectionCard$1,
520
464
  {
521
- title: "Advanced Card Payments",
522
- description: "Control card checkout settings, 3D Secure behavior, and card saving.",
465
+ title: "Additional Settings",
466
+ description: "These settings control checkout behavior, PayPal experience, and logging.",
523
467
  right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
524
468
  /* @__PURE__ */ jsxRuntime.jsx(
525
469
  "button",
@@ -531,187 +475,161 @@ function AdvancedCardPaymentsTab() {
531
475
  children: saving ? "Saving..." : "Save settings"
532
476
  }
533
477
  ),
534
- loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
535
- ] }),
536
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
537
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
538
- /* @__PURE__ */ jsxRuntime.jsx(
539
- "input",
540
- {
541
- type: "checkbox",
542
- checked: form.enabled,
543
- onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })),
544
- className: "h-4 w-4 rounded border-ui-border-base"
545
- }
546
- ),
547
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
548
- ] }) }),
549
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Title", children: /* @__PURE__ */ jsxRuntime.jsx(
478
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
479
+ ] }),
480
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
481
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Payment action", children: /* @__PURE__ */ jsxRuntime.jsxs(
482
+ "select",
483
+ {
484
+ value: form.paymentAction,
485
+ onChange: (e) => setForm((p) => ({ ...p, paymentAction: e.target.value })),
486
+ className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
487
+ children: [
488
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "capture", children: "Capture" }),
489
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorize", children: "Authorize" })
490
+ ]
491
+ }
492
+ ) }),
493
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Brand Name", children: /* @__PURE__ */ jsxRuntime.jsx(
494
+ "input",
495
+ {
496
+ value: form.brandName,
497
+ onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })),
498
+ className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
499
+ placeholder: "PayPal"
500
+ }
501
+ ) }),
502
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Landing Page", children: /* @__PURE__ */ jsxRuntime.jsxs(
503
+ "select",
504
+ {
505
+ value: form.landingPage,
506
+ onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })),
507
+ className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
508
+ children: [
509
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "no_preference", children: "No Preference" }),
510
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login" }),
511
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Billing" })
512
+ ]
513
+ }
514
+ ) }),
515
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Instant Payments", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
516
+ /* @__PURE__ */ jsxRuntime.jsx(
517
+ "input",
518
+ {
519
+ type: "checkbox",
520
+ checked: form.requireInstantPayment,
521
+ onChange: (e) => setForm((p) => ({ ...p, requireInstantPayment: e.target.checked })),
522
+ className: "h-4 w-4 rounded border-ui-border-base"
523
+ }
524
+ ),
525
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
526
+ ] }) }),
527
+ /* @__PURE__ */ jsxRuntime.jsx(
528
+ FieldRow$1,
529
+ {
530
+ label: "Billing Address",
531
+ hint: "If the billing address is empty and PayPal provides a shipping address, the order will use the shipping address as the billing address.",
532
+ children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
533
+ /* @__PURE__ */ jsxRuntime.jsx(
534
+ "input",
535
+ {
536
+ type: "checkbox",
537
+ checked: form.useShippingAsBilling,
538
+ onChange: (e) => setForm((p) => ({ ...p, useShippingAsBilling: e.target.checked })),
539
+ className: "h-4 w-4 rounded border-ui-border-base"
540
+ }
541
+ ),
542
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Use PayPal Shipping Address as Billing" })
543
+ ] })
544
+ }
545
+ ),
546
+ /* @__PURE__ */ jsxRuntime.jsx(
547
+ FieldRow$1,
548
+ {
549
+ label: "Send Item Details",
550
+ hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.",
551
+ children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
552
+ /* @__PURE__ */ jsxRuntime.jsx(
553
+ "input",
554
+ {
555
+ type: "checkbox",
556
+ checked: form.sendItemDetails,
557
+ onChange: (e) => setForm((p) => ({ ...p, sendItemDetails: e.target.checked })),
558
+ className: "h-4 w-4 rounded border-ui-border-base"
559
+ }
560
+ ),
561
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
562
+ ] })
563
+ }
564
+ ),
565
+ /* @__PURE__ */ jsxRuntime.jsx(
566
+ FieldRow$1,
567
+ {
568
+ label: "Order Review Page",
569
+ hint: "Payments from the Product or Cart page skip the review step and go straight to the Thank You page.",
570
+ children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
571
+ /* @__PURE__ */ jsxRuntime.jsx(
572
+ "input",
573
+ {
574
+ type: "checkbox",
575
+ checked: form.skipOrderReviewPage,
576
+ onChange: (e) => setForm((p) => ({ ...p, skipOrderReviewPage: e.target.checked })),
577
+ className: "h-4 w-4 rounded border-ui-border-base"
578
+ }
579
+ ),
580
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Skip Order Review Page" })
581
+ ] })
582
+ }
583
+ ),
584
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Invoice prefix", children: /* @__PURE__ */ jsxRuntime.jsx(
550
585
  "input",
551
586
  {
552
- value: form.title,
553
- onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })),
587
+ value: form.invoicePrefix,
588
+ onChange: (e) => setForm((p) => ({ ...p, invoicePrefix: e.target.value })),
554
589
  className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
555
- placeholder: "Credit or Debit Card"
590
+ placeholder: "WC-"
556
591
  }
557
592
  ) }),
558
- /* @__PURE__ */ jsxRuntime.jsx(
559
- FieldRow$1,
593
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Credit Card Statement Name", children: /* @__PURE__ */ jsxRuntime.jsx(
594
+ "input",
560
595
  {
561
- label: "Disable specific credit cards",
562
- hint: "Select card brands to hide from the card form.",
563
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
564
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: form.disabledCards.length ? form.disabledCards.map((v) => {
565
- var _a2;
566
- const label = ((_a2 = CARD_BRANDS.find((b) => b.value === v)) == null ? void 0 : _a2.label) ?? v;
567
- return /* @__PURE__ */ jsxRuntime.jsx(Pill$1, { onRemove: () => removeDisabledCard(v), children: label }, v);
568
- }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No card brands disabled." }) }),
569
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2 md:grid-cols-2", children: CARD_BRANDS.map((b) => {
570
- const checked = disabledSet.has(b.value);
571
- return /* @__PURE__ */ jsxRuntime.jsxs(
572
- "label",
573
- {
574
- className: cx$1(
575
- "flex items-center gap-2 rounded-md p-2",
576
- "hover:bg-ui-bg-subtle"
577
- ),
578
- children: [
579
- /* @__PURE__ */ jsxRuntime.jsx(
580
- "input",
581
- {
582
- type: "checkbox",
583
- checked,
584
- onChange: () => toggleDisabledCard(b.value),
585
- className: "h-4 w-4 rounded border-ui-border-base"
586
- }
587
- ),
588
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: b.label })
589
- ]
590
- },
591
- b.value
592
- );
593
- }) }) })
594
- ] })
596
+ value: form.creditCardStatementName,
597
+ onChange: (e) => setForm((p) => ({ ...p, creditCardStatementName: e.target.value })),
598
+ className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
599
+ placeholder: "PayPal"
595
600
  }
596
- ),
601
+ ) }),
597
602
  /* @__PURE__ */ jsxRuntime.jsx(
598
603
  FieldRow$1,
599
604
  {
600
- label: "Contingency for 3D Secure",
601
- hint: "Choose when 3D Secure should be triggered during card payments.",
602
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
605
+ label: "Debug log",
606
+ hint: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
607
+ "Log PayPal events such as Webhook, Payment, Refund.",
608
+ " ",
609
+ form.logPath ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
610
+ "Log location: ",
611
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: form.logPath })
612
+ ] }) : null
613
+ ] }),
614
+ children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
603
615
  /* @__PURE__ */ jsxRuntime.jsx(
604
- "select",
616
+ "input",
605
617
  {
606
- value: form.threeDS,
607
- onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })),
608
- className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
609
- children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
618
+ type: "checkbox",
619
+ checked: form.enableLogging,
620
+ onChange: (e) => setForm((p) => ({ ...p, enableLogging: e.target.checked })),
621
+ className: "h-4 w-4 rounded border-ui-border-base"
610
622
  }
611
623
  ),
612
- ((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
624
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable logging" })
613
625
  ] })
614
626
  }
615
- ),
616
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Card Save Enabled", hint: "Allow customers to save a card at checkout for future use.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
617
- /* @__PURE__ */ jsxRuntime.jsx(
618
- "input",
619
- {
620
- type: "checkbox",
621
- checked: form.cardSaveEnabled,
622
- onChange: (e) => setForm((p) => ({ ...p, cardSaveEnabled: e.target.checked })),
623
- className: "h-4 w-4 rounded border-ui-border-base"
624
- }
625
- ),
626
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable card saving at checkout" })
627
- ] }) })
627
+ )
628
628
  ] })
629
629
  }
630
630
  )
631
631
  ] }) });
632
632
  }
633
- function PayPalApplePayPage() {
634
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
635
- }
636
- function formatDate$2(value) {
637
- if (!value) {
638
- return "";
639
- }
640
- const parsed = new Date(value);
641
- if (Number.isNaN(parsed.getTime())) {
642
- return value;
643
- }
644
- return parsed.toLocaleString();
645
- }
646
- function PayPalAuditLogsPage() {
647
- const [logs, setLogs] = react.useState([]);
648
- const [loading, setLoading] = react.useState(false);
649
- const [error, setError] = react.useState(null);
650
- const fetchLogs = react.useCallback(async () => {
651
- try {
652
- setLoading(true);
653
- setError(null);
654
- const response = await fetch("/admin/paypal/audit-logs?limit=50", {
655
- credentials: "include",
656
- headers: {
657
- Accept: "application/json"
658
- }
659
- });
660
- if (!response.ok) {
661
- const message = await response.text().catch(() => "");
662
- throw new Error(message || "Failed to load audit logs.");
663
- }
664
- const data = await response.json().catch(() => ({}));
665
- setLogs((data == null ? void 0 : data.logs) || []);
666
- } catch (fetchError) {
667
- setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
668
- setLogs([]);
669
- } finally {
670
- setLoading(false);
671
- }
672
- }, []);
673
- react.useEffect(() => {
674
- fetchLogs();
675
- }, [fetchLogs]);
676
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
677
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
678
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
679
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
680
- ] }),
681
- /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
682
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
683
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
684
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
685
- /* @__PURE__ */ jsxRuntime.jsx(
686
- "button",
687
- {
688
- type: "button",
689
- onClick: fetchLogs,
690
- className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
691
- disabled: loading,
692
- children: loading ? "Refreshing..." : "Refresh"
693
- }
694
- )
695
- ] }) }),
696
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
697
- error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
698
- !error && logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
699
- logs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full text-left text-sm", children: [
700
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
701
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
702
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
703
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
704
- ] }) }),
705
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
706
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
707
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
708
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
709
- ] }, entry.id)) })
710
- ] }) }) : null
711
- ] })
712
- ] })
713
- ] }) });
714
- }
715
633
  const config = adminSdk.defineRouteConfig({
716
634
  label: "PayPal Connection",
717
635
  hide: true
@@ -1296,6 +1214,88 @@ function PayPalConnectionPage() {
1296
1214
  ` })
1297
1215
  ] });
1298
1216
  }
1217
+ function formatDate$2(value) {
1218
+ if (!value) {
1219
+ return "";
1220
+ }
1221
+ const parsed = new Date(value);
1222
+ if (Number.isNaN(parsed.getTime())) {
1223
+ return value;
1224
+ }
1225
+ return parsed.toLocaleString();
1226
+ }
1227
+ function PayPalAuditLogsPage() {
1228
+ const [logs, setLogs] = react.useState([]);
1229
+ const [loading, setLoading] = react.useState(false);
1230
+ const [error, setError] = react.useState(null);
1231
+ const fetchLogs = react.useCallback(async () => {
1232
+ try {
1233
+ setLoading(true);
1234
+ setError(null);
1235
+ const response = await fetch("/admin/paypal/audit-logs?limit=50", {
1236
+ credentials: "include",
1237
+ headers: {
1238
+ Accept: "application/json"
1239
+ }
1240
+ });
1241
+ if (!response.ok) {
1242
+ const message = await response.text().catch(() => "");
1243
+ throw new Error(message || "Failed to load audit logs.");
1244
+ }
1245
+ const data = await response.json().catch(() => ({}));
1246
+ setLogs((data == null ? void 0 : data.logs) || []);
1247
+ } catch (fetchError) {
1248
+ setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
1249
+ setLogs([]);
1250
+ } finally {
1251
+ setLoading(false);
1252
+ }
1253
+ }, []);
1254
+ react.useEffect(() => {
1255
+ fetchLogs();
1256
+ }, [fetchLogs]);
1257
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
1258
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1259
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
1260
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
1261
+ ] }),
1262
+ /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
1263
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1264
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1265
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
1266
+ /* @__PURE__ */ jsxRuntime.jsx(
1267
+ "button",
1268
+ {
1269
+ type: "button",
1270
+ onClick: fetchLogs,
1271
+ className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1272
+ disabled: loading,
1273
+ children: loading ? "Refreshing..." : "Refresh"
1274
+ }
1275
+ )
1276
+ ] }) }),
1277
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1278
+ error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1279
+ !error && logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
1280
+ logs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full text-left text-sm", children: [
1281
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1282
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
1283
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
1284
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
1285
+ ] }) }),
1286
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
1287
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
1288
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
1289
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
1290
+ ] }, entry.id)) })
1291
+ ] }) }) : null
1292
+ ] })
1293
+ ] })
1294
+ ] }) });
1295
+ }
1296
+ function PayPalApplePayPage() {
1297
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1298
+ }
1299
1299
  const EMPTY_FILTERS = {
1300
1300
  dispute_id: "",
1301
1301
  status: "",
@@ -1494,6 +1494,116 @@ function PayPalGooglePayPage() {
1494
1494
  function PayPalPayLaterMessagingPage() {
1495
1495
  return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1496
1496
  }
1497
+ function formatDate(value) {
1498
+ if (!value) {
1499
+ return "—";
1500
+ }
1501
+ const parsed = new Date(value);
1502
+ if (Number.isNaN(parsed.getTime())) {
1503
+ return value;
1504
+ }
1505
+ return parsed.toLocaleString();
1506
+ }
1507
+ function PayPalReconciliationStatusPage() {
1508
+ const [status, setStatus] = react.useState({});
1509
+ const [loading, setLoading] = react.useState(false);
1510
+ const [error, setError] = react.useState(null);
1511
+ const fetchStatus = react.useCallback(async () => {
1512
+ try {
1513
+ setLoading(true);
1514
+ setError(null);
1515
+ const response = await fetch("/admin/paypal/reconciliation-status", {
1516
+ credentials: "include",
1517
+ headers: {
1518
+ Accept: "application/json"
1519
+ }
1520
+ });
1521
+ if (!response.ok) {
1522
+ const message = await response.text().catch(() => "");
1523
+ throw new Error(message || "Failed to load reconciliation status.");
1524
+ }
1525
+ const data = await response.json().catch(() => ({}));
1526
+ setStatus((data == null ? void 0 : data.status) || {});
1527
+ } catch (fetchError) {
1528
+ setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
1529
+ setStatus({});
1530
+ } finally {
1531
+ setLoading(false);
1532
+ }
1533
+ }, []);
1534
+ react.useEffect(() => {
1535
+ fetchStatus();
1536
+ }, [fetchStatus]);
1537
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
1538
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1539
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
1540
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
1541
+ ] }),
1542
+ /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
1543
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1544
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1545
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
1546
+ /* @__PURE__ */ jsxRuntime.jsx(
1547
+ "button",
1548
+ {
1549
+ type: "button",
1550
+ onClick: fetchStatus,
1551
+ className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1552
+ disabled: loading,
1553
+ children: loading ? "Refreshing..." : "Refresh"
1554
+ }
1555
+ )
1556
+ ] }) }),
1557
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1558
+ error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1559
+ !error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
1560
+ Object.keys(status).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
1561
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1562
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
1563
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
1564
+ ] }),
1565
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1566
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
1567
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
1568
+ ] }),
1569
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1570
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
1571
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
1572
+ ] }),
1573
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1574
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
1575
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
1576
+ ] }),
1577
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1578
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
1579
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
1580
+ ] }),
1581
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1582
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
1583
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
1584
+ ] }),
1585
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1586
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
1587
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
1588
+ ] }),
1589
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1590
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
1591
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
1592
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
1593
+ ] }),
1594
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
1595
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
1596
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
1597
+ ] }),
1598
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
1599
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
1600
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
1601
+ ] })
1602
+ ] }) : null
1603
+ ] })
1604
+ ] })
1605
+ ] }) });
1606
+ }
1497
1607
  const DISPLAY_LOCATION_OPTIONS = [
1498
1608
  { value: "product", label: "Product Page" },
1499
1609
  { value: "cart", label: "Cart Page" },
@@ -1931,116 +2041,6 @@ function PayPalSettingsTab() {
1931
2041
  )
1932
2042
  ] }) });
1933
2043
  }
1934
- function formatDate(value) {
1935
- if (!value) {
1936
- return "—";
1937
- }
1938
- const parsed = new Date(value);
1939
- if (Number.isNaN(parsed.getTime())) {
1940
- return value;
1941
- }
1942
- return parsed.toLocaleString();
1943
- }
1944
- function PayPalReconciliationStatusPage() {
1945
- const [status, setStatus] = react.useState({});
1946
- const [loading, setLoading] = react.useState(false);
1947
- const [error, setError] = react.useState(null);
1948
- const fetchStatus = react.useCallback(async () => {
1949
- try {
1950
- setLoading(true);
1951
- setError(null);
1952
- const response = await fetch("/admin/paypal/reconciliation-status", {
1953
- credentials: "include",
1954
- headers: {
1955
- Accept: "application/json"
1956
- }
1957
- });
1958
- if (!response.ok) {
1959
- const message = await response.text().catch(() => "");
1960
- throw new Error(message || "Failed to load reconciliation status.");
1961
- }
1962
- const data = await response.json().catch(() => ({}));
1963
- setStatus((data == null ? void 0 : data.status) || {});
1964
- } catch (fetchError) {
1965
- setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
1966
- setStatus({});
1967
- } finally {
1968
- setLoading(false);
1969
- }
1970
- }, []);
1971
- react.useEffect(() => {
1972
- fetchStatus();
1973
- }, [fetchStatus]);
1974
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
1975
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1976
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
1977
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
1978
- ] }),
1979
- /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
1980
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1981
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1982
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
1983
- /* @__PURE__ */ jsxRuntime.jsx(
1984
- "button",
1985
- {
1986
- type: "button",
1987
- onClick: fetchStatus,
1988
- className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1989
- disabled: loading,
1990
- children: loading ? "Refreshing..." : "Refresh"
1991
- }
1992
- )
1993
- ] }) }),
1994
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1995
- error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1996
- !error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
1997
- Object.keys(status).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
1998
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1999
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
2000
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
2001
- ] }),
2002
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2003
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
2004
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
2005
- ] }),
2006
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2007
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
2008
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
2009
- ] }),
2010
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2011
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
2012
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
2013
- ] }),
2014
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2015
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
2016
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
2017
- ] }),
2018
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2019
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
2020
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
2021
- ] }),
2022
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2023
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
2024
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
2025
- ] }),
2026
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2027
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
2028
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
2029
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
2030
- ] }),
2031
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
2032
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
2033
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
2034
- ] }),
2035
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
2036
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
2037
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
2038
- ] })
2039
- ] }) : null
2040
- ] })
2041
- ] })
2042
- ] }) });
2043
- }
2044
2044
  const widgetModule = { widgets: [] };
2045
2045
  const routeModule = {
2046
2046
  routes: [
@@ -2048,25 +2048,25 @@ const routeModule = {
2048
2048
  Component: PayPalSettingsIndexRoute,
2049
2049
  path: "/settings/paypal"
2050
2050
  },
2051
- {
2052
- Component: AdditionalSettingsTab,
2053
- path: "/settings/paypal/additional-settings"
2054
- },
2055
2051
  {
2056
2052
  Component: AdvancedCardPaymentsTab,
2057
2053
  path: "/settings/paypal/advanced-card-payments"
2058
2054
  },
2059
2055
  {
2060
- Component: PayPalApplePayPage,
2061
- path: "/settings/paypal/apple-pay"
2056
+ Component: AdditionalSettingsTab,
2057
+ path: "/settings/paypal/additional-settings"
2058
+ },
2059
+ {
2060
+ Component: PayPalConnectionPage,
2061
+ path: "/settings/paypal/connection"
2062
2062
  },
2063
2063
  {
2064
2064
  Component: PayPalAuditLogsPage,
2065
2065
  path: "/settings/paypal/audit-logs"
2066
2066
  },
2067
2067
  {
2068
- Component: PayPalConnectionPage,
2069
- path: "/settings/paypal/connection"
2068
+ Component: PayPalApplePayPage,
2069
+ path: "/settings/paypal/apple-pay"
2070
2070
  },
2071
2071
  {
2072
2072
  Component: PayPalDisputesPage,
@@ -2080,13 +2080,13 @@ const routeModule = {
2080
2080
  Component: PayPalPayLaterMessagingPage,
2081
2081
  path: "/settings/paypal/pay-later-messaging"
2082
2082
  },
2083
- {
2084
- Component: PayPalSettingsTab,
2085
- path: "/settings/paypal/paypal-settings"
2086
- },
2087
2083
  {
2088
2084
  Component: PayPalReconciliationStatusPage,
2089
2085
  path: "/settings/paypal/reconciliation-status"
2086
+ },
2087
+ {
2088
+ Component: PayPalSettingsTab,
2089
+ path: "/settings/paypal/paypal-settings"
2090
2090
  }
2091
2091
  ]
2092
2092
  };