@easypayment/medusa-paypal 0.2.0 → 0.2.2
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.
- package/.medusa/server/src/admin/index.js +207 -207
- package/.medusa/server/src/admin/index.mjs +207 -207
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js +7 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +27 -4
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
- package/package.json +1 -1
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +8 -1
- package/src/modules/paypal/payment-provider/service.ts +32 -4
|
@@ -630,9 +630,6 @@ function AdvancedCardPaymentsTab() {
|
|
|
630
630
|
)
|
|
631
631
|
] }) });
|
|
632
632
|
}
|
|
633
|
-
function PayPalApplePayPage() {
|
|
634
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
635
|
-
}
|
|
636
633
|
const config = adminSdk.defineRouteConfig({
|
|
637
634
|
label: "PayPal Connection",
|
|
638
635
|
hide: true
|
|
@@ -1217,13 +1214,98 @@ function PayPalConnectionPage() {
|
|
|
1217
1214
|
` })
|
|
1218
1215
|
] });
|
|
1219
1216
|
}
|
|
1217
|
+
function PayPalApplePayPage() {
|
|
1218
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1219
|
+
}
|
|
1220
|
+
function formatDate$2(value) {
|
|
1221
|
+
if (!value) {
|
|
1222
|
+
return "";
|
|
1223
|
+
}
|
|
1224
|
+
const parsed = new Date(value);
|
|
1225
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
1226
|
+
return value;
|
|
1227
|
+
}
|
|
1228
|
+
return parsed.toLocaleString();
|
|
1229
|
+
}
|
|
1230
|
+
function PayPalAuditLogsPage() {
|
|
1231
|
+
const [logs, setLogs] = react.useState([]);
|
|
1232
|
+
const [loading, setLoading] = react.useState(false);
|
|
1233
|
+
const [error, setError] = react.useState(null);
|
|
1234
|
+
const fetchLogs = react.useCallback(async () => {
|
|
1235
|
+
try {
|
|
1236
|
+
setLoading(true);
|
|
1237
|
+
setError(null);
|
|
1238
|
+
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
1239
|
+
credentials: "include",
|
|
1240
|
+
headers: {
|
|
1241
|
+
Accept: "application/json"
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
if (!response.ok) {
|
|
1245
|
+
const message = await response.text().catch(() => "");
|
|
1246
|
+
throw new Error(message || "Failed to load audit logs.");
|
|
1247
|
+
}
|
|
1248
|
+
const data = await response.json().catch(() => ({}));
|
|
1249
|
+
setLogs((data == null ? void 0 : data.logs) || []);
|
|
1250
|
+
} catch (fetchError) {
|
|
1251
|
+
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
1252
|
+
setLogs([]);
|
|
1253
|
+
} finally {
|
|
1254
|
+
setLoading(false);
|
|
1255
|
+
}
|
|
1256
|
+
}, []);
|
|
1257
|
+
react.useEffect(() => {
|
|
1258
|
+
fetchLogs();
|
|
1259
|
+
}, [fetchLogs]);
|
|
1260
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1261
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1262
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
1263
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
1264
|
+
] }),
|
|
1265
|
+
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
1266
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1267
|
+
/* @__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: [
|
|
1268
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1270
|
+
"button",
|
|
1271
|
+
{
|
|
1272
|
+
type: "button",
|
|
1273
|
+
onClick: fetchLogs,
|
|
1274
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1275
|
+
disabled: loading,
|
|
1276
|
+
children: loading ? "Refreshing..." : "Refresh"
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
] }) }),
|
|
1280
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
|
|
1281
|
+
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,
|
|
1282
|
+
!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,
|
|
1283
|
+
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: [
|
|
1284
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1285
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
1286
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
1287
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
1288
|
+
] }) }),
|
|
1289
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
|
|
1291
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
1292
|
+
/* @__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) }) })
|
|
1293
|
+
] }, entry.id)) })
|
|
1294
|
+
] }) }) : null
|
|
1295
|
+
] })
|
|
1296
|
+
] })
|
|
1297
|
+
] }) });
|
|
1298
|
+
}
|
|
1299
|
+
function PayPalGooglePayPage() {
|
|
1300
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1301
|
+
}
|
|
1220
1302
|
const EMPTY_FILTERS = {
|
|
1221
1303
|
dispute_id: "",
|
|
1222
1304
|
status: "",
|
|
1223
1305
|
order_id: "",
|
|
1224
1306
|
cart_id: ""
|
|
1225
1307
|
};
|
|
1226
|
-
function formatDate$
|
|
1308
|
+
function formatDate$1(value) {
|
|
1227
1309
|
if (!value) {
|
|
1228
1310
|
return "";
|
|
1229
1311
|
}
|
|
@@ -1402,208 +1484,16 @@ function PayPalDisputesPage() {
|
|
|
1402
1484
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.amount ? `${dispute.amount} ${dispute.currency_code || ""}` : "-" }),
|
|
1403
1485
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.order_id || "-" }),
|
|
1404
1486
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.cart_id || "-" }),
|
|
1405
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$
|
|
1487
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$1(dispute.updated_at || dispute.created_at) })
|
|
1406
1488
|
] }, dispute.id)) })
|
|
1407
1489
|
] }) }),
|
|
1408
1490
|
error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-ui-border-base px-4 py-3 text-sm text-ui-fg-error", children: error }) : null
|
|
1409
1491
|
] })
|
|
1410
1492
|
] }) });
|
|
1411
1493
|
}
|
|
1412
|
-
function formatDate$1(value) {
|
|
1413
|
-
if (!value) {
|
|
1414
|
-
return "";
|
|
1415
|
-
}
|
|
1416
|
-
const parsed = new Date(value);
|
|
1417
|
-
if (Number.isNaN(parsed.getTime())) {
|
|
1418
|
-
return value;
|
|
1419
|
-
}
|
|
1420
|
-
return parsed.toLocaleString();
|
|
1421
|
-
}
|
|
1422
|
-
function PayPalAuditLogsPage() {
|
|
1423
|
-
const [logs, setLogs] = react.useState([]);
|
|
1424
|
-
const [loading, setLoading] = react.useState(false);
|
|
1425
|
-
const [error, setError] = react.useState(null);
|
|
1426
|
-
const fetchLogs = react.useCallback(async () => {
|
|
1427
|
-
try {
|
|
1428
|
-
setLoading(true);
|
|
1429
|
-
setError(null);
|
|
1430
|
-
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
1431
|
-
credentials: "include",
|
|
1432
|
-
headers: {
|
|
1433
|
-
Accept: "application/json"
|
|
1434
|
-
}
|
|
1435
|
-
});
|
|
1436
|
-
if (!response.ok) {
|
|
1437
|
-
const message = await response.text().catch(() => "");
|
|
1438
|
-
throw new Error(message || "Failed to load audit logs.");
|
|
1439
|
-
}
|
|
1440
|
-
const data = await response.json().catch(() => ({}));
|
|
1441
|
-
setLogs((data == null ? void 0 : data.logs) || []);
|
|
1442
|
-
} catch (fetchError) {
|
|
1443
|
-
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
1444
|
-
setLogs([]);
|
|
1445
|
-
} finally {
|
|
1446
|
-
setLoading(false);
|
|
1447
|
-
}
|
|
1448
|
-
}, []);
|
|
1449
|
-
react.useEffect(() => {
|
|
1450
|
-
fetchLogs();
|
|
1451
|
-
}, [fetchLogs]);
|
|
1452
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1453
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1454
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
1455
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
1456
|
-
] }),
|
|
1457
|
-
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
1458
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1459
|
-
/* @__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: [
|
|
1460
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
1461
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1462
|
-
"button",
|
|
1463
|
-
{
|
|
1464
|
-
type: "button",
|
|
1465
|
-
onClick: fetchLogs,
|
|
1466
|
-
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1467
|
-
disabled: loading,
|
|
1468
|
-
children: loading ? "Refreshing..." : "Refresh"
|
|
1469
|
-
}
|
|
1470
|
-
)
|
|
1471
|
-
] }) }),
|
|
1472
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
|
|
1473
|
-
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,
|
|
1474
|
-
!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,
|
|
1475
|
-
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: [
|
|
1476
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1477
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
1478
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
1479
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
1480
|
-
] }) }),
|
|
1481
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
1482
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$1(entry.created_at) || "—" }),
|
|
1483
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
1484
|
-
/* @__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) }) })
|
|
1485
|
-
] }, entry.id)) })
|
|
1486
|
-
] }) }) : null
|
|
1487
|
-
] })
|
|
1488
|
-
] })
|
|
1489
|
-
] }) });
|
|
1490
|
-
}
|
|
1491
|
-
function PayPalGooglePayPage() {
|
|
1492
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1493
|
-
}
|
|
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
|
-
}
|
|
1607
1497
|
const DISPLAY_LOCATION_OPTIONS = [
|
|
1608
1498
|
{ value: "product", label: "Product Page" },
|
|
1609
1499
|
{ value: "cart", label: "Cart Page" },
|
|
@@ -2041,6 +1931,116 @@ function PayPalSettingsTab() {
|
|
|
2041
1931
|
)
|
|
2042
1932
|
] }) });
|
|
2043
1933
|
}
|
|
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: [
|
|
@@ -2056,17 +2056,13 @@ const routeModule = {
|
|
|
2056
2056
|
Component: AdvancedCardPaymentsTab,
|
|
2057
2057
|
path: "/settings/paypal/advanced-card-payments"
|
|
2058
2058
|
},
|
|
2059
|
-
{
|
|
2060
|
-
Component: PayPalApplePayPage,
|
|
2061
|
-
path: "/settings/paypal/apple-pay"
|
|
2062
|
-
},
|
|
2063
2059
|
{
|
|
2064
2060
|
Component: PayPalConnectionPage,
|
|
2065
2061
|
path: "/settings/paypal/connection"
|
|
2066
2062
|
},
|
|
2067
2063
|
{
|
|
2068
|
-
Component:
|
|
2069
|
-
path: "/settings/paypal/
|
|
2064
|
+
Component: PayPalApplePayPage,
|
|
2065
|
+
path: "/settings/paypal/apple-pay"
|
|
2070
2066
|
},
|
|
2071
2067
|
{
|
|
2072
2068
|
Component: PayPalAuditLogsPage,
|
|
@@ -2077,16 +2073,20 @@ const routeModule = {
|
|
|
2077
2073
|
path: "/settings/paypal/google-pay"
|
|
2078
2074
|
},
|
|
2079
2075
|
{
|
|
2080
|
-
Component:
|
|
2081
|
-
path: "/settings/paypal/
|
|
2076
|
+
Component: PayPalDisputesPage,
|
|
2077
|
+
path: "/settings/paypal/disputes"
|
|
2082
2078
|
},
|
|
2083
2079
|
{
|
|
2084
|
-
Component:
|
|
2085
|
-
path: "/settings/paypal/
|
|
2080
|
+
Component: PayPalPayLaterMessagingPage,
|
|
2081
|
+
path: "/settings/paypal/pay-later-messaging"
|
|
2086
2082
|
},
|
|
2087
2083
|
{
|
|
2088
2084
|
Component: PayPalSettingsTab,
|
|
2089
2085
|
path: "/settings/paypal/paypal-settings"
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
Component: PayPalReconciliationStatusPage,
|
|
2089
|
+
path: "/settings/paypal/reconciliation-status"
|
|
2090
2090
|
}
|
|
2091
2091
|
]
|
|
2092
2092
|
};
|