@easypayment/medusa-paypal 0.1.9 → 0.2.0
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 +199 -199
- package/.medusa/server/src/admin/index.mjs +199 -199
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts +1 -1
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js +0 -6
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts +1 -1
- 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 +0 -8
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/package.json +1 -1
- package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +0 -7
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +0 -9
|
@@ -1217,92 +1217,13 @@ function PayPalConnectionPage() {
|
|
|
1217
1217
|
` })
|
|
1218
1218
|
] });
|
|
1219
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
1220
|
const EMPTY_FILTERS = {
|
|
1300
1221
|
dispute_id: "",
|
|
1301
1222
|
status: "",
|
|
1302
1223
|
order_id: "",
|
|
1303
1224
|
cart_id: ""
|
|
1304
1225
|
};
|
|
1305
|
-
function formatDate$
|
|
1226
|
+
function formatDate$2(value) {
|
|
1306
1227
|
if (!value) {
|
|
1307
1228
|
return "";
|
|
1308
1229
|
}
|
|
@@ -1481,19 +1402,208 @@ function PayPalDisputesPage() {
|
|
|
1481
1402
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.amount ? `${dispute.amount} ${dispute.currency_code || ""}` : "-" }),
|
|
1482
1403
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.order_id || "-" }),
|
|
1483
1404
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.cart_id || "-" }),
|
|
1484
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$
|
|
1405
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$2(dispute.updated_at || dispute.created_at) })
|
|
1485
1406
|
] }, dispute.id)) })
|
|
1486
1407
|
] }) }),
|
|
1487
1408
|
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
|
|
1488
1409
|
] })
|
|
1489
1410
|
] }) });
|
|
1490
1411
|
}
|
|
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
1491
|
function PayPalGooglePayPage() {
|
|
1492
1492
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1493
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
|
+
}
|
|
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: [
|
|
@@ -2064,14 +2064,14 @@ const routeModule = {
|
|
|
2064
2064
|
Component: PayPalConnectionPage,
|
|
2065
2065
|
path: "/settings/paypal/connection"
|
|
2066
2066
|
},
|
|
2067
|
-
{
|
|
2068
|
-
Component: PayPalAuditLogsPage,
|
|
2069
|
-
path: "/settings/paypal/audit-logs"
|
|
2070
|
-
},
|
|
2071
2067
|
{
|
|
2072
2068
|
Component: PayPalDisputesPage,
|
|
2073
2069
|
path: "/settings/paypal/disputes"
|
|
2074
2070
|
},
|
|
2071
|
+
{
|
|
2072
|
+
Component: PayPalAuditLogsPage,
|
|
2073
|
+
path: "/settings/paypal/audit-logs"
|
|
2074
|
+
},
|
|
2075
2075
|
{
|
|
2076
2076
|
Component: PayPalGooglePayPage,
|
|
2077
2077
|
path: "/settings/paypal/google-pay"
|
|
@@ -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
|
};
|
|
@@ -1216,92 +1216,13 @@ function PayPalConnectionPage() {
|
|
|
1216
1216
|
` })
|
|
1217
1217
|
] });
|
|
1218
1218
|
}
|
|
1219
|
-
function formatDate$2(value) {
|
|
1220
|
-
if (!value) {
|
|
1221
|
-
return "";
|
|
1222
|
-
}
|
|
1223
|
-
const parsed = new Date(value);
|
|
1224
|
-
if (Number.isNaN(parsed.getTime())) {
|
|
1225
|
-
return value;
|
|
1226
|
-
}
|
|
1227
|
-
return parsed.toLocaleString();
|
|
1228
|
-
}
|
|
1229
|
-
function PayPalAuditLogsPage() {
|
|
1230
|
-
const [logs, setLogs] = useState([]);
|
|
1231
|
-
const [loading, setLoading] = useState(false);
|
|
1232
|
-
const [error, setError] = useState(null);
|
|
1233
|
-
const fetchLogs = useCallback(async () => {
|
|
1234
|
-
try {
|
|
1235
|
-
setLoading(true);
|
|
1236
|
-
setError(null);
|
|
1237
|
-
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
1238
|
-
credentials: "include",
|
|
1239
|
-
headers: {
|
|
1240
|
-
Accept: "application/json"
|
|
1241
|
-
}
|
|
1242
|
-
});
|
|
1243
|
-
if (!response.ok) {
|
|
1244
|
-
const message = await response.text().catch(() => "");
|
|
1245
|
-
throw new Error(message || "Failed to load audit logs.");
|
|
1246
|
-
}
|
|
1247
|
-
const data = await response.json().catch(() => ({}));
|
|
1248
|
-
setLogs((data == null ? void 0 : data.logs) || []);
|
|
1249
|
-
} catch (fetchError) {
|
|
1250
|
-
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
1251
|
-
setLogs([]);
|
|
1252
|
-
} finally {
|
|
1253
|
-
setLoading(false);
|
|
1254
|
-
}
|
|
1255
|
-
}, []);
|
|
1256
|
-
useEffect(() => {
|
|
1257
|
-
fetchLogs();
|
|
1258
|
-
}, [fetchLogs]);
|
|
1259
|
-
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1260
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1261
|
-
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
1262
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
1263
|
-
] }),
|
|
1264
|
-
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
1265
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1266
|
-
/* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1267
|
-
/* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
1268
|
-
/* @__PURE__ */ jsx(
|
|
1269
|
-
"button",
|
|
1270
|
-
{
|
|
1271
|
-
type: "button",
|
|
1272
|
-
onClick: fetchLogs,
|
|
1273
|
-
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1274
|
-
disabled: loading,
|
|
1275
|
-
children: loading ? "Refreshing..." : "Refresh"
|
|
1276
|
-
}
|
|
1277
|
-
)
|
|
1278
|
-
] }) }),
|
|
1279
|
-
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
1280
|
-
error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
|
|
1281
|
-
!error && logs.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
|
|
1282
|
-
logs.length > 0 ? /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full text-left text-sm", children: [
|
|
1283
|
-
/* @__PURE__ */ jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1284
|
-
/* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
1285
|
-
/* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
1286
|
-
/* @__PURE__ */ jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
1287
|
-
] }) }),
|
|
1288
|
-
/* @__PURE__ */ jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
1289
|
-
/* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
|
|
1290
|
-
/* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
1291
|
-
/* @__PURE__ */ jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ 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) }) })
|
|
1292
|
-
] }, entry.id)) })
|
|
1293
|
-
] }) }) : null
|
|
1294
|
-
] })
|
|
1295
|
-
] })
|
|
1296
|
-
] }) });
|
|
1297
|
-
}
|
|
1298
1219
|
const EMPTY_FILTERS = {
|
|
1299
1220
|
dispute_id: "",
|
|
1300
1221
|
status: "",
|
|
1301
1222
|
order_id: "",
|
|
1302
1223
|
cart_id: ""
|
|
1303
1224
|
};
|
|
1304
|
-
function formatDate$
|
|
1225
|
+
function formatDate$2(value) {
|
|
1305
1226
|
if (!value) {
|
|
1306
1227
|
return "";
|
|
1307
1228
|
}
|
|
@@ -1480,19 +1401,208 @@ function PayPalDisputesPage() {
|
|
|
1480
1401
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: dispute.amount ? `${dispute.amount} ${dispute.currency_code || ""}` : "-" }),
|
|
1481
1402
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: dispute.order_id || "-" }),
|
|
1482
1403
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: dispute.cart_id || "-" }),
|
|
1483
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$
|
|
1404
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$2(dispute.updated_at || dispute.created_at) })
|
|
1484
1405
|
] }, dispute.id)) })
|
|
1485
1406
|
] }) }),
|
|
1486
1407
|
error ? /* @__PURE__ */ jsx("div", { className: "border-t border-ui-border-base px-4 py-3 text-sm text-ui-fg-error", children: error }) : null
|
|
1487
1408
|
] })
|
|
1488
1409
|
] }) });
|
|
1489
1410
|
}
|
|
1411
|
+
function formatDate$1(value) {
|
|
1412
|
+
if (!value) {
|
|
1413
|
+
return "";
|
|
1414
|
+
}
|
|
1415
|
+
const parsed = new Date(value);
|
|
1416
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
1417
|
+
return value;
|
|
1418
|
+
}
|
|
1419
|
+
return parsed.toLocaleString();
|
|
1420
|
+
}
|
|
1421
|
+
function PayPalAuditLogsPage() {
|
|
1422
|
+
const [logs, setLogs] = useState([]);
|
|
1423
|
+
const [loading, setLoading] = useState(false);
|
|
1424
|
+
const [error, setError] = useState(null);
|
|
1425
|
+
const fetchLogs = useCallback(async () => {
|
|
1426
|
+
try {
|
|
1427
|
+
setLoading(true);
|
|
1428
|
+
setError(null);
|
|
1429
|
+
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
1430
|
+
credentials: "include",
|
|
1431
|
+
headers: {
|
|
1432
|
+
Accept: "application/json"
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
if (!response.ok) {
|
|
1436
|
+
const message = await response.text().catch(() => "");
|
|
1437
|
+
throw new Error(message || "Failed to load audit logs.");
|
|
1438
|
+
}
|
|
1439
|
+
const data = await response.json().catch(() => ({}));
|
|
1440
|
+
setLogs((data == null ? void 0 : data.logs) || []);
|
|
1441
|
+
} catch (fetchError) {
|
|
1442
|
+
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
1443
|
+
setLogs([]);
|
|
1444
|
+
} finally {
|
|
1445
|
+
setLoading(false);
|
|
1446
|
+
}
|
|
1447
|
+
}, []);
|
|
1448
|
+
useEffect(() => {
|
|
1449
|
+
fetchLogs();
|
|
1450
|
+
}, [fetchLogs]);
|
|
1451
|
+
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1452
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1453
|
+
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
1454
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
1455
|
+
] }),
|
|
1456
|
+
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
1457
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1458
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1459
|
+
/* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
1460
|
+
/* @__PURE__ */ jsx(
|
|
1461
|
+
"button",
|
|
1462
|
+
{
|
|
1463
|
+
type: "button",
|
|
1464
|
+
onClick: fetchLogs,
|
|
1465
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1466
|
+
disabled: loading,
|
|
1467
|
+
children: loading ? "Refreshing..." : "Refresh"
|
|
1468
|
+
}
|
|
1469
|
+
)
|
|
1470
|
+
] }) }),
|
|
1471
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
1472
|
+
error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
|
|
1473
|
+
!error && logs.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
|
|
1474
|
+
logs.length > 0 ? /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full text-left text-sm", children: [
|
|
1475
|
+
/* @__PURE__ */ jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1476
|
+
/* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
1477
|
+
/* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
1478
|
+
/* @__PURE__ */ jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
1479
|
+
] }) }),
|
|
1480
|
+
/* @__PURE__ */ jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
1481
|
+
/* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$1(entry.created_at) || "—" }),
|
|
1482
|
+
/* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
1483
|
+
/* @__PURE__ */ jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ 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) }) })
|
|
1484
|
+
] }, entry.id)) })
|
|
1485
|
+
] }) }) : null
|
|
1486
|
+
] })
|
|
1487
|
+
] })
|
|
1488
|
+
] }) });
|
|
1489
|
+
}
|
|
1490
1490
|
function PayPalGooglePayPage() {
|
|
1491
1491
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1492
1492
|
}
|
|
1493
1493
|
function PayPalPayLaterMessagingPage() {
|
|
1494
1494
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1495
1495
|
}
|
|
1496
|
+
function formatDate(value) {
|
|
1497
|
+
if (!value) {
|
|
1498
|
+
return "—";
|
|
1499
|
+
}
|
|
1500
|
+
const parsed = new Date(value);
|
|
1501
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
1502
|
+
return value;
|
|
1503
|
+
}
|
|
1504
|
+
return parsed.toLocaleString();
|
|
1505
|
+
}
|
|
1506
|
+
function PayPalReconciliationStatusPage() {
|
|
1507
|
+
const [status, setStatus] = useState({});
|
|
1508
|
+
const [loading, setLoading] = useState(false);
|
|
1509
|
+
const [error, setError] = useState(null);
|
|
1510
|
+
const fetchStatus = useCallback(async () => {
|
|
1511
|
+
try {
|
|
1512
|
+
setLoading(true);
|
|
1513
|
+
setError(null);
|
|
1514
|
+
const response = await fetch("/admin/paypal/reconciliation-status", {
|
|
1515
|
+
credentials: "include",
|
|
1516
|
+
headers: {
|
|
1517
|
+
Accept: "application/json"
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
if (!response.ok) {
|
|
1521
|
+
const message = await response.text().catch(() => "");
|
|
1522
|
+
throw new Error(message || "Failed to load reconciliation status.");
|
|
1523
|
+
}
|
|
1524
|
+
const data = await response.json().catch(() => ({}));
|
|
1525
|
+
setStatus((data == null ? void 0 : data.status) || {});
|
|
1526
|
+
} catch (fetchError) {
|
|
1527
|
+
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
|
|
1528
|
+
setStatus({});
|
|
1529
|
+
} finally {
|
|
1530
|
+
setLoading(false);
|
|
1531
|
+
}
|
|
1532
|
+
}, []);
|
|
1533
|
+
useEffect(() => {
|
|
1534
|
+
fetchStatus();
|
|
1535
|
+
}, [fetchStatus]);
|
|
1536
|
+
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1537
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1538
|
+
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
|
|
1539
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
|
|
1540
|
+
] }),
|
|
1541
|
+
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
1542
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1543
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1544
|
+
/* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
|
|
1545
|
+
/* @__PURE__ */ jsx(
|
|
1546
|
+
"button",
|
|
1547
|
+
{
|
|
1548
|
+
type: "button",
|
|
1549
|
+
onClick: fetchStatus,
|
|
1550
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1551
|
+
disabled: loading,
|
|
1552
|
+
children: loading ? "Refreshing..." : "Refresh"
|
|
1553
|
+
}
|
|
1554
|
+
)
|
|
1555
|
+
] }) }),
|
|
1556
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
1557
|
+
error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
|
|
1558
|
+
!error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
|
|
1559
|
+
Object.keys(status).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
|
|
1560
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1561
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
|
|
1562
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
|
|
1563
|
+
] }),
|
|
1564
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1565
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
|
|
1566
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
|
|
1567
|
+
] }),
|
|
1568
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1569
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
|
|
1570
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
|
|
1571
|
+
] }),
|
|
1572
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1573
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
|
|
1574
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
|
|
1575
|
+
] }),
|
|
1576
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1577
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
|
|
1578
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
|
|
1579
|
+
] }),
|
|
1580
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1581
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
|
|
1582
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
|
|
1583
|
+
] }),
|
|
1584
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1585
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
|
|
1586
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
|
|
1587
|
+
] }),
|
|
1588
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1589
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
|
|
1590
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
|
|
1591
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
|
|
1592
|
+
] }),
|
|
1593
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
|
|
1594
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
|
|
1595
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
|
|
1596
|
+
] }),
|
|
1597
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
|
|
1598
|
+
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
|
|
1599
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
|
|
1600
|
+
] })
|
|
1601
|
+
] }) : null
|
|
1602
|
+
] })
|
|
1603
|
+
] })
|
|
1604
|
+
] }) });
|
|
1605
|
+
}
|
|
1496
1606
|
const DISPLAY_LOCATION_OPTIONS = [
|
|
1497
1607
|
{ value: "product", label: "Product Page" },
|
|
1498
1608
|
{ value: "cart", label: "Cart Page" },
|
|
@@ -1930,116 +2040,6 @@ function PayPalSettingsTab() {
|
|
|
1930
2040
|
)
|
|
1931
2041
|
] }) });
|
|
1932
2042
|
}
|
|
1933
|
-
function formatDate(value) {
|
|
1934
|
-
if (!value) {
|
|
1935
|
-
return "—";
|
|
1936
|
-
}
|
|
1937
|
-
const parsed = new Date(value);
|
|
1938
|
-
if (Number.isNaN(parsed.getTime())) {
|
|
1939
|
-
return value;
|
|
1940
|
-
}
|
|
1941
|
-
return parsed.toLocaleString();
|
|
1942
|
-
}
|
|
1943
|
-
function PayPalReconciliationStatusPage() {
|
|
1944
|
-
const [status, setStatus] = useState({});
|
|
1945
|
-
const [loading, setLoading] = useState(false);
|
|
1946
|
-
const [error, setError] = useState(null);
|
|
1947
|
-
const fetchStatus = useCallback(async () => {
|
|
1948
|
-
try {
|
|
1949
|
-
setLoading(true);
|
|
1950
|
-
setError(null);
|
|
1951
|
-
const response = await fetch("/admin/paypal/reconciliation-status", {
|
|
1952
|
-
credentials: "include",
|
|
1953
|
-
headers: {
|
|
1954
|
-
Accept: "application/json"
|
|
1955
|
-
}
|
|
1956
|
-
});
|
|
1957
|
-
if (!response.ok) {
|
|
1958
|
-
const message = await response.text().catch(() => "");
|
|
1959
|
-
throw new Error(message || "Failed to load reconciliation status.");
|
|
1960
|
-
}
|
|
1961
|
-
const data = await response.json().catch(() => ({}));
|
|
1962
|
-
setStatus((data == null ? void 0 : data.status) || {});
|
|
1963
|
-
} catch (fetchError) {
|
|
1964
|
-
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
|
|
1965
|
-
setStatus({});
|
|
1966
|
-
} finally {
|
|
1967
|
-
setLoading(false);
|
|
1968
|
-
}
|
|
1969
|
-
}, []);
|
|
1970
|
-
useEffect(() => {
|
|
1971
|
-
fetchStatus();
|
|
1972
|
-
}, [fetchStatus]);
|
|
1973
|
-
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1974
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1975
|
-
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
|
|
1976
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
|
|
1977
|
-
] }),
|
|
1978
|
-
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
1979
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1980
|
-
/* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1981
|
-
/* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
|
|
1982
|
-
/* @__PURE__ */ jsx(
|
|
1983
|
-
"button",
|
|
1984
|
-
{
|
|
1985
|
-
type: "button",
|
|
1986
|
-
onClick: fetchStatus,
|
|
1987
|
-
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1988
|
-
disabled: loading,
|
|
1989
|
-
children: loading ? "Refreshing..." : "Refresh"
|
|
1990
|
-
}
|
|
1991
|
-
)
|
|
1992
|
-
] }) }),
|
|
1993
|
-
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
1994
|
-
error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
|
|
1995
|
-
!error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
|
|
1996
|
-
Object.keys(status).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
|
|
1997
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
1998
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
|
|
1999
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
|
|
2000
|
-
] }),
|
|
2001
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
2002
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
|
|
2003
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
|
|
2004
|
-
] }),
|
|
2005
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
2006
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
|
|
2007
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
|
|
2008
|
-
] }),
|
|
2009
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
2010
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
|
|
2011
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
|
|
2012
|
-
] }),
|
|
2013
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
2014
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
|
|
2015
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
|
|
2016
|
-
] }),
|
|
2017
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
2018
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
|
|
2019
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
|
|
2020
|
-
] }),
|
|
2021
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
2022
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
|
|
2023
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
|
|
2024
|
-
] }),
|
|
2025
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
|
|
2026
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
|
|
2027
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
|
|
2028
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
|
|
2029
|
-
] }),
|
|
2030
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
|
|
2031
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
|
|
2032
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
|
|
2033
|
-
] }),
|
|
2034
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
|
|
2035
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
|
|
2036
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
|
|
2037
|
-
] })
|
|
2038
|
-
] }) : null
|
|
2039
|
-
] })
|
|
2040
|
-
] })
|
|
2041
|
-
] }) });
|
|
2042
|
-
}
|
|
2043
2043
|
const widgetModule = { widgets: [] };
|
|
2044
2044
|
const routeModule = {
|
|
2045
2045
|
routes: [
|
|
@@ -2063,14 +2063,14 @@ const routeModule = {
|
|
|
2063
2063
|
Component: PayPalConnectionPage,
|
|
2064
2064
|
path: "/settings/paypal/connection"
|
|
2065
2065
|
},
|
|
2066
|
-
{
|
|
2067
|
-
Component: PayPalAuditLogsPage,
|
|
2068
|
-
path: "/settings/paypal/audit-logs"
|
|
2069
|
-
},
|
|
2070
2066
|
{
|
|
2071
2067
|
Component: PayPalDisputesPage,
|
|
2072
2068
|
path: "/settings/paypal/disputes"
|
|
2073
2069
|
},
|
|
2070
|
+
{
|
|
2071
|
+
Component: PayPalAuditLogsPage,
|
|
2072
|
+
path: "/settings/paypal/audit-logs"
|
|
2073
|
+
},
|
|
2074
2074
|
{
|
|
2075
2075
|
Component: PayPalGooglePayPage,
|
|
2076
2076
|
path: "/settings/paypal/google-pay"
|
|
@@ -2079,13 +2079,13 @@ const routeModule = {
|
|
|
2079
2079
|
Component: PayPalPayLaterMessagingPage,
|
|
2080
2080
|
path: "/settings/paypal/pay-later-messaging"
|
|
2081
2081
|
},
|
|
2082
|
-
{
|
|
2083
|
-
Component: PayPalSettingsTab,
|
|
2084
|
-
path: "/settings/paypal/paypal-settings"
|
|
2085
|
-
},
|
|
2086
2082
|
{
|
|
2087
2083
|
Component: PayPalReconciliationStatusPage,
|
|
2088
2084
|
path: "/settings/paypal/reconciliation-status"
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
Component: PayPalSettingsTab,
|
|
2088
|
+
path: "/settings/paypal/paypal-settings"
|
|
2089
2089
|
}
|
|
2090
2090
|
]
|
|
2091
2091
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
-
export declare function POST(req: MedusaRequest, res: MedusaResponse): Promise<
|
|
2
|
+
export declare function POST(req: MedusaRequest, res: MedusaResponse): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=route.d.ts.map
|
package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAQxE,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,iBAcjE"}
|
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.POST = POST;
|
|
4
4
|
const core_flows_1 = require("@medusajs/core-flows");
|
|
5
|
-
const provider_ids_1 = require("../../../../../modules/paypal/utils/provider-ids");
|
|
6
5
|
async function POST(req, res) {
|
|
7
6
|
const collectionId = req.params.id;
|
|
8
7
|
const { provider_id, data, customer_id } = req.body;
|
|
9
|
-
if (!(0, provider_ids_1.isPayPalProviderId)(provider_id)) {
|
|
10
|
-
return res.status(400).json({
|
|
11
|
-
message: `Provider ${provider_id} is not a valid PayPal provider`,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
8
|
const { result } = await (0, core_flows_1.createPaymentSessionsWorkflow)(req.scope).run({
|
|
15
9
|
input: {
|
|
16
10
|
payment_collection_id: collectionId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;AASA,oBAcC;AAvBD,qDAAoE;AAS7D,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC,IAAgC,CAAA;IAE/E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,0CAA6B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QACpE,KAAK,EAAE;YACL,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,WAAW;YACX,IAAI;SACL;KACF,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MedusaResponse, MedusaStoreRequest } from "@medusajs/framework/http";
|
|
2
|
-
export declare function POST(req: MedusaStoreRequest, res: MedusaResponse): Promise<
|
|
2
|
+
export declare function POST(req: MedusaStoreRequest, res: MedusaResponse): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=route.d.ts.map
|
package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAiB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAiB,MAAM,0BAA0B,CAAA;AAO5F,wBAAsB,IAAI,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,cAAc,iBAuBtE"}
|
|
@@ -3,17 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.POST = POST;
|
|
4
4
|
const core_flows_1 = require("@medusajs/core-flows");
|
|
5
5
|
const http_1 = require("@medusajs/framework/http");
|
|
6
|
-
const provider_ids_1 = require("../../../../../modules/paypal/utils/provider-ids");
|
|
7
6
|
async function POST(req, res) {
|
|
8
7
|
const collectionId = req.params.id;
|
|
9
8
|
const { provider_id, data } = req.body;
|
|
10
|
-
if (!(0, provider_ids_1.isPayPalProviderId)(provider_id)) {
|
|
11
|
-
return res.status(400).json({
|
|
12
|
-
code: "paypal_payment_session_error",
|
|
13
|
-
type: "paypal_payment_session_error",
|
|
14
|
-
message: `Provider ${provider_id} is not a valid PayPal provider`,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
9
|
await (0, core_flows_1.createPaymentSessionsWorkflow)(req.scope).run({
|
|
18
10
|
input: {
|
|
19
11
|
payment_collection_id: collectionId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;AAQA,oBAuBC;AA/BD,qDAAoE;AACpE,mDAA4F;AAOrF,KAAK,UAAU,IAAI,CAAC,GAAuB,EAAE,GAAmB;IACrE,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAgC,CAAA;IAElE,MAAM,IAAA,0CAA6B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QACjD,KAAK,EAAE;YACL,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,WAAW,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ;YACvC,IAAI;SACL;KACF,CAAC,CAAA;IAEF,MAAM,iBAAiB,GAAG,MAAM,IAAA,oBAAa,EAAC;QAC5C,MAAM,EAAE,oBAAoB;QAC5B,UAAU,EAAE,YAAY;QACxB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM;KAC/B,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,kBAAkB,EAAE,iBAAiB;KACtC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createPaymentSessionsWorkflow } from "@medusajs/core-flows"
|
|
2
2
|
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
3
|
-
import { isPayPalProviderId } from "../../../../../modules/paypal/utils/provider-ids"
|
|
4
3
|
|
|
5
4
|
type CreatePaymentSessionBody = {
|
|
6
5
|
provider_id: string
|
|
@@ -12,12 +11,6 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
|
12
11
|
const collectionId = req.params.id
|
|
13
12
|
const { provider_id, data, customer_id } = req.body as CreatePaymentSessionBody
|
|
14
13
|
|
|
15
|
-
if (!isPayPalProviderId(provider_id)) {
|
|
16
|
-
return res.status(400).json({
|
|
17
|
-
message: `Provider ${provider_id} is not a valid PayPal provider`,
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
|
|
21
14
|
const { result } = await createPaymentSessionsWorkflow(req.scope).run({
|
|
22
15
|
input: {
|
|
23
16
|
payment_collection_id: collectionId,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createPaymentSessionsWorkflow } from "@medusajs/core-flows"
|
|
2
2
|
import { MedusaResponse, MedusaStoreRequest, refetchEntity } from "@medusajs/framework/http"
|
|
3
|
-
import { isPayPalProviderId } from "../../../../../modules/paypal/utils/provider-ids"
|
|
4
3
|
|
|
5
4
|
type CreatePaymentSessionBody = {
|
|
6
5
|
provider_id: string
|
|
@@ -11,14 +10,6 @@ export async function POST(req: MedusaStoreRequest, res: MedusaResponse) {
|
|
|
11
10
|
const collectionId = req.params.id
|
|
12
11
|
const { provider_id, data } = req.body as CreatePaymentSessionBody
|
|
13
12
|
|
|
14
|
-
if (!isPayPalProviderId(provider_id)) {
|
|
15
|
-
return res.status(400).json({
|
|
16
|
-
code: "paypal_payment_session_error",
|
|
17
|
-
type: "paypal_payment_session_error",
|
|
18
|
-
message: `Provider ${provider_id} is not a valid PayPal provider`,
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
13
|
await createPaymentSessionsWorkflow(req.scope).run({
|
|
23
14
|
input: {
|
|
24
15
|
payment_collection_id: collectionId,
|