order-management 0.0.97 → 0.0.98

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.
@@ -1,8 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
4
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
5
  import { defineWidgetConfig, defineRouteConfig } from "@medusajs/admin-sdk";
3
6
  import { useState, useEffect, useRef, useMemo, useCallback } from "react";
4
7
  import { Text, Container, Heading, Badge, Button, Label, Select, Textarea, Popover, clx, Input, Copy, Skeleton, Tooltip, toast } from "@medusajs/ui";
5
- import { CashSolid, PencilSquareSolid, Trash, ChevronDownMini, Check, ArrowPath, InformationCircle, ExclamationCircle, MagnifierAlert, ChevronRightMini, Receipt, CreditCard, ArrowLeft, ClockSolid, ShieldCheck, SquareTwoStack, CheckCircle } from "@medusajs/icons";
8
+ import { CashSolid, PencilSquareSolid, Trash, ChevronDownMini, Check, ArrowPath, InformationCircle, ChevronRightMini, MagnifierAlert, ExclamationCircle, Receipt, CreditCard, ArrowLeft, ClockSolid, SquareTwoStack, ShieldCheck, CheckCircle } from "@medusajs/icons";
6
9
  import { useNavigate, useLocation, useSearchParams, useParams } from "react-router-dom";
7
10
  function roundRectPath(ctx, x, y, w, h, r) {
8
11
  ctx.beginPath();
@@ -374,14 +377,15 @@ const s = {
374
377
  const OrderGiftItemsWidget = ({ data }) => {
375
378
  const [fetchedItems, setFetchedItems] = useState(null);
376
379
  useEffect(() => {
377
- if (!data?.id) return;
380
+ if (!(data == null ? void 0 : data.id)) return;
378
381
  fetch(
379
382
  `/admin/orders/${data.id}?fields=*items,items.metadata`
380
- ).then((r) => r.json()).then(({ order }) => setFetchedItems(order?.items ?? [])).catch(() => setFetchedItems(data?.items ?? []));
381
- }, [data?.id]);
382
- const items = fetchedItems ?? data?.items ?? [];
383
+ ).then((r) => r.json()).then(({ order }) => setFetchedItems((order == null ? void 0 : order.items) ?? [])).catch(() => setFetchedItems((data == null ? void 0 : data.items) ?? []));
384
+ }, [data == null ? void 0 : data.id]);
385
+ const items = fetchedItems ?? (data == null ? void 0 : data.items) ?? [];
383
386
  const giftedItems = items.filter((i) => {
384
- const flag = i.metadata?.is_gift;
387
+ var _a;
388
+ const flag = (_a = i.metadata) == null ? void 0 : _a.is_gift;
385
389
  return flag === "true" || flag === true;
386
390
  });
387
391
  return /* @__PURE__ */ jsxs("div", { style: s.widget, children: [
@@ -410,9 +414,9 @@ const OrderGiftItemsWidget = ({ data }) => {
410
414
  ),
411
415
  giftedItems.map((item) => {
412
416
  const meta = item.metadata;
413
- const from = meta?.gift_from;
414
- const to = meta?.gift_to;
415
- const message = meta?.gift_message;
417
+ const from = meta == null ? void 0 : meta.gift_from;
418
+ const to = meta == null ? void 0 : meta.gift_to;
419
+ const message = meta == null ? void 0 : meta.gift_message;
416
420
  return /* @__PURE__ */ jsxs("div", { style: s.card, children: [
417
421
  /* @__PURE__ */ jsxs("div", { style: s.ribbon, children: [
418
422
  /* @__PURE__ */ jsx("span", { style: s.bowCenter, children: "🎀" }),
@@ -476,7 +480,7 @@ function formatRefundCurrency(amount, currencyCode = "inr", options) {
476
480
  minimumFractionDigits: 2,
477
481
  maximumFractionDigits: 2
478
482
  }).format(amount);
479
- if (options?.signed && amount > 0) {
483
+ if ((options == null ? void 0 : options.signed) && amount > 0) {
480
484
  return `−${formatted}`;
481
485
  }
482
486
  return formatted;
@@ -531,7 +535,8 @@ function getOrderIdFromPath() {
531
535
  return m ? m[1] : void 0;
532
536
  }
533
537
  const OrderRefundContextWidget = (props) => {
534
- const orderId = props.order?.id ?? props.data?.order?.id ?? getOrderIdFromPath();
538
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
539
+ const orderId = ((_a = props.order) == null ? void 0 : _a.id) ?? ((_c = (_b = props.data) == null ? void 0 : _b.order) == null ? void 0 : _c.id) ?? getOrderIdFromPath();
535
540
  const [context, setContext] = useState(null);
536
541
  const [loading, setLoading] = useState(!!orderId);
537
542
  const [error, setError] = useState(null);
@@ -569,7 +574,7 @@ const OrderRefundContextWidget = (props) => {
569
574
  };
570
575
  }, [orderId]);
571
576
  const handleMarkRefunded = async () => {
572
- if (!context?.return_id || !context?.refund_mapping || context.refund_mapping.is_refunded || !context.can_process_refund) {
577
+ if (!(context == null ? void 0 : context.return_id) || !(context == null ? void 0 : context.refund_mapping) || context.refund_mapping.is_refunded || !context.can_process_refund) {
573
578
  return;
574
579
  }
575
580
  setMarking(true);
@@ -586,14 +591,17 @@ const OrderRefundContextWidget = (props) => {
586
591
  }
587
592
  const data = await res.json();
588
593
  setContext(
589
- (prev) => prev && prev.refund_mapping ? {
590
- ...prev,
591
- can_process_refund: false,
592
- refund_mapping: {
593
- ...prev.refund_mapping,
594
- is_refunded: data.refund_payment_mapping?.is_refunded ?? true
595
- }
596
- } : prev
594
+ (prev) => {
595
+ var _a2;
596
+ return prev && prev.refund_mapping ? {
597
+ ...prev,
598
+ can_process_refund: false,
599
+ refund_mapping: {
600
+ ...prev.refund_mapping,
601
+ is_refunded: ((_a2 = data.refund_payment_mapping) == null ? void 0 : _a2.is_refunded) ?? true
602
+ }
603
+ } : prev;
604
+ }
597
605
  );
598
606
  } catch (e) {
599
607
  setMarkError(e instanceof Error ? e.message : "Failed to mark refunded");
@@ -602,19 +610,20 @@ const OrderRefundContextWidget = (props) => {
602
610
  }
603
611
  };
604
612
  const handleEditClick = () => {
605
- const mapping = context?.refund_mapping;
606
- const mode = mapping?.refund_mode;
613
+ const mapping = context == null ? void 0 : context.refund_mapping;
614
+ const mode = mapping == null ? void 0 : mapping.refund_mode;
607
615
  setEditRefundMode(
608
616
  mode === "offline" || mode === "online" ? mode : ""
609
617
  );
610
- setEditDetails(mapping?.details ?? "");
611
- setEditImageUrls(mapping?.images ?? []);
618
+ setEditDetails((mapping == null ? void 0 : mapping.details) ?? "");
619
+ setEditImageUrls((mapping == null ? void 0 : mapping.images) ?? []);
612
620
  setSaveError(null);
613
621
  setUploadError(null);
614
622
  setEditing(true);
615
623
  };
616
624
  const handleUploadImage = async (e) => {
617
- const file = e.target.files?.[0];
625
+ var _a2, _b2, _c2;
626
+ const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
618
627
  if (!file) return;
619
628
  setUploading(true);
620
629
  setUploadError(null);
@@ -631,7 +640,7 @@ const OrderRefundContextWidget = (props) => {
631
640
  throw new Error(data2.message || "Upload failed");
632
641
  }
633
642
  const data = await res.json();
634
- const url = data.files?.[0]?.url;
643
+ const url = (_c2 = (_b2 = data.files) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.url;
635
644
  if (url) setEditImageUrls((prev) => [...prev, url]);
636
645
  } catch (err) {
637
646
  setUploadError(err instanceof Error ? err.message : "Upload failed");
@@ -644,7 +653,7 @@ const OrderRefundContextWidget = (props) => {
644
653
  setEditImageUrls((prev) => prev.filter((_, i) => i !== index));
645
654
  };
646
655
  const handleSaveAdminFields = async () => {
647
- if (!context?.return_id) return;
656
+ if (!(context == null ? void 0 : context.return_id)) return;
648
657
  setSaving(true);
649
658
  setSaveError(null);
650
659
  try {
@@ -681,14 +690,14 @@ const OrderRefundContextWidget = (props) => {
681
690
  if (error) {
682
691
  return /* @__PURE__ */ jsx(Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsx("div", { className: "py-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-error", children: error }) }) });
683
692
  }
684
- const hasReturn = !!context?.return_id;
685
- const hasMapping = !!context?.refund_mapping;
686
- const canMarkRefunded = Boolean(context?.can_process_refund);
687
- const returnStatus = context?.return_status ?? null;
688
- const showReceiveFirstHint = hasReturn && !context?.refund_mapping?.is_refunded && returnStatus !== "received" && returnStatus !== "canceled";
689
- const paymentDetail = context?.payment_detail;
690
- const paymentDetails = context?.payment_details && context.payment_details.length > 0 ? context.payment_details : paymentDetail ? [paymentDetail] : [];
691
- const orderPayment = context?.order_payment;
693
+ const hasReturn = !!(context == null ? void 0 : context.return_id);
694
+ const hasMapping = !!(context == null ? void 0 : context.refund_mapping);
695
+ const canMarkRefunded = Boolean(context == null ? void 0 : context.can_process_refund);
696
+ const returnStatus = (context == null ? void 0 : context.return_status) ?? null;
697
+ const showReceiveFirstHint = hasReturn && !((_d = context == null ? void 0 : context.refund_mapping) == null ? void 0 : _d.is_refunded) && returnStatus !== "received" && returnStatus !== "canceled";
698
+ const paymentDetail = context == null ? void 0 : context.payment_detail;
699
+ const paymentDetails = (context == null ? void 0 : context.payment_details) && context.payment_details.length > 0 ? context.payment_details : paymentDetail ? [paymentDetail] : [];
700
+ const orderPayment = context == null ? void 0 : context.order_payment;
692
701
  return /* @__PURE__ */ jsx(Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 py-4", children: [
693
702
  /* @__PURE__ */ jsxs(Heading, { level: "h2", className: "flex items-center gap-2", children: [
694
703
  /* @__PURE__ */ jsx(CashSolid, { className: "text-ui-fg-subtle" }),
@@ -700,7 +709,7 @@ const OrderRefundContextWidget = (props) => {
700
709
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
701
710
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Return" }),
702
711
  /* @__PURE__ */ jsx(Text, { size: "small", children: context.return_id }),
703
- context.refund_mapping?.is_refunded ? /* @__PURE__ */ jsx(Badge, { color: "green", children: "Refunded" }) : /* @__PURE__ */ jsx(Badge, { color: "orange", children: "Not refunded" })
712
+ ((_e = context.refund_mapping) == null ? void 0 : _e.is_refunded) ? /* @__PURE__ */ jsx(Badge, { color: "green", children: "Refunded" }) : /* @__PURE__ */ jsx(Badge, { color: "orange", children: "Not refunded" })
704
713
  ] }),
705
714
  context.refund ? /* @__PURE__ */ jsx("div", { className: "mt-3 border-t border-ui-border-base pt-3", children: /* @__PURE__ */ jsx(RefundCalculationBlock, { refund: context.refund }) }) : null,
706
715
  orderPayment && /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
@@ -714,17 +723,17 @@ const OrderRefundContextWidget = (props) => {
714
723
  /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
715
724
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
716
725
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Payment method (refund destination)" }),
717
- context.refund_mapping?.payment_id ? /* @__PURE__ */ jsx(Badge, { color: "green", children: "Customer specified" }) : paymentDetail ? /* @__PURE__ */ jsx(Badge, { color: "orange", children: "Customer default" }) : orderPayment && !orderPayment.is_cod ? /* @__PURE__ */ jsx(Badge, { color: "blue", children: "Original payment method" }) : null
726
+ ((_f = context.refund_mapping) == null ? void 0 : _f.payment_id) ? /* @__PURE__ */ jsx(Badge, { color: "green", children: "Customer specified" }) : paymentDetail ? /* @__PURE__ */ jsx(Badge, { color: "orange", children: "Customer default" }) : orderPayment && !orderPayment.is_cod ? /* @__PURE__ */ jsx(Badge, { color: "blue", children: "Original payment method" }) : null
718
727
  ] }),
719
- context.refund_mapping?.payment_id && !paymentDetail && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-orange-200 bg-orange-50 px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "The customer specified a payment method for this return, but that payment method has since been removed from their account. Ask the customer to update their refund payment method." }) }),
720
- !context.refund_mapping?.payment_id && paymentDetail?.source === "default" && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "The customer did not specify a payment method for this return. Showing their default payment method." }) }),
721
- !context.refund_mapping?.payment_id && !paymentDetail && orderPayment && !orderPayment.is_cod && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxs(Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
728
+ ((_g = context.refund_mapping) == null ? void 0 : _g.payment_id) && !paymentDetail && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-orange-200 bg-orange-50 px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "The customer specified a payment method for this return, but that payment method has since been removed from their account. Ask the customer to update their refund payment method." }) }),
729
+ !((_h = context.refund_mapping) == null ? void 0 : _h.payment_id) && (paymentDetail == null ? void 0 : paymentDetail.source) === "default" && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "The customer did not specify a payment method for this return. Showing their default payment method." }) }),
730
+ !((_i = context.refund_mapping) == null ? void 0 : _i.payment_id) && !paymentDetail && orderPayment && !orderPayment.is_cod && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxs(Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
722
731
  "Refund will go to the original payment method (",
723
732
  orderPayment.label,
724
733
  ")."
725
734
  ] }) }),
726
- !context.refund_mapping?.payment_id && !paymentDetail && (context.is_cod || orderPayment?.is_cod) && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "This order was paid with Cash on Delivery. No stored bank/UPI refund destination." }) }),
727
- !context.refund_mapping?.payment_id && !paymentDetail && !orderPayment && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "No payment method found for this customer." }) }),
735
+ !((_j = context.refund_mapping) == null ? void 0 : _j.payment_id) && !paymentDetail && (context.is_cod || (orderPayment == null ? void 0 : orderPayment.is_cod)) && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "This order was paid with Cash on Delivery. No stored bank/UPI refund destination." }) }),
736
+ !((_k = context.refund_mapping) == null ? void 0 : _k.payment_id) && !paymentDetail && !orderPayment && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "No payment method found for this customer." }) }),
728
737
  paymentDetails.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-3", children: paymentDetails.map((detail) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
729
738
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
730
739
  /* @__PURE__ */ jsx(Badge, { children: detail.type.toUpperCase() }),
@@ -736,7 +745,7 @@ const OrderRefundContextWidget = (props) => {
736
745
  ] }, `${detail.id}-${k}`)) })
737
746
  ] }, detail.id)) })
738
747
  ] }),
739
- context?.refund_mapping && /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-3 border-t border-ui-border-base pt-3", children: [
748
+ (context == null ? void 0 : context.refund_mapping) && /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-3 border-t border-ui-border-base pt-3", children: [
740
749
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
741
750
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Refund mode, details & images" }),
742
751
  !editing ? /* @__PURE__ */ jsxs(
@@ -824,7 +833,10 @@ const OrderRefundContextWidget = (props) => {
824
833
  variant: "secondary",
825
834
  type: "button",
826
835
  disabled: uploading,
827
- onClick: () => fileInputRef.current?.click(),
836
+ onClick: () => {
837
+ var _a2;
838
+ return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
839
+ },
828
840
  children: uploading ? "Uploading…" : "Upload image"
829
841
  }
830
842
  ),
@@ -875,7 +887,7 @@ const OrderRefundContextWidget = (props) => {
875
887
  ] }),
876
888
  /* @__PURE__ */ jsxs("div", { children: [
877
889
  /* @__PURE__ */ jsx(Text, { size: "xsmall", weight: "plus", className: "text-ui-fg-muted", children: "Images" }),
878
- context.refund_mapping.images?.length ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-2", children: context.refund_mapping.images.map((url, i) => /* @__PURE__ */ jsxs(
890
+ ((_l = context.refund_mapping.images) == null ? void 0 : _l.length) ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-2", children: context.refund_mapping.images.map((url, i) => /* @__PURE__ */ jsxs(
879
891
  "a",
880
892
  {
881
893
  href: url,
@@ -905,10 +917,10 @@ const OrderRefundContextWidget = (props) => {
905
917
  ),
906
918
  markError && /* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-error", children: markError })
907
919
  ] }),
908
- hasMapping && !canMarkRefunded && !context.refund_mapping?.is_refunded && showReceiveFirstHint && /* @__PURE__ */ jsx(Text, { size: "small", className: "mt-4 text-ui-fg-muted", children: "Mark refunded is available after the return is received." })
920
+ hasMapping && !canMarkRefunded && !((_m = context.refund_mapping) == null ? void 0 : _m.is_refunded) && showReceiveFirstHint && /* @__PURE__ */ jsx(Text, { size: "small", className: "mt-4 text-ui-fg-muted", children: "Mark refunded is available after the return is received." })
909
921
  ] }),
910
922
  hasReturn && !hasMapping && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
911
- context?.refund ? /* @__PURE__ */ jsx(RefundCalculationBlock, { refund: context.refund }) : null,
923
+ (context == null ? void 0 : context.refund) ? /* @__PURE__ */ jsx(RefundCalculationBlock, { refund: context.refund }) : null,
912
924
  orderPayment && /* @__PURE__ */ jsxs("div", { className: "mb-3 space-y-1", children: [
913
925
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Order payment method" }),
914
926
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
@@ -1346,7 +1358,7 @@ function getEntityInfo(tableName) {
1346
1358
  const def = ENTITY_DEFINITIONS[tableName];
1347
1359
  return {
1348
1360
  tableName,
1349
- label: def?.label ?? humanizeTableName(tableName),
1361
+ label: (def == null ? void 0 : def.label) ?? humanizeTableName(tableName),
1350
1362
  category: def && CATEGORY_BY_ID.get(def.category) || SYSTEM_CATEGORY
1351
1363
  };
1352
1364
  }
@@ -1371,11 +1383,13 @@ function getTablesForCategory(id) {
1371
1383
  }
1372
1384
  const GROUPS = getEntitiesByCategory();
1373
1385
  function triggerLabel(entity, category) {
1386
+ var _a;
1374
1387
  if (entity) return getEntityInfo(entity).label;
1375
- if (category) return `All ${getCategory(category)?.label ?? category}`;
1388
+ if (category) return `All ${((_a = getCategory(category)) == null ? void 0 : _a.label) ?? category}`;
1376
1389
  return "All entities";
1377
1390
  }
1378
1391
  const EntityPicker = ({ entity, category, onChange }) => {
1392
+ var _a;
1379
1393
  const [open, setOpen] = useState(false);
1380
1394
  const [search, setSearch] = useState("");
1381
1395
  const searchRef = useRef(null);
@@ -1395,7 +1409,7 @@ const EntityPicker = ({ entity, category, onChange }) => {
1395
1409
  setOpen(false);
1396
1410
  setSearch("");
1397
1411
  };
1398
- const firstMatch = filteredGroups[0]?.entities[0];
1412
+ const firstMatch = (_a = filteredGroups[0]) == null ? void 0 : _a.entities[0];
1399
1413
  const isAll = !entity && !category;
1400
1414
  return /* @__PURE__ */ jsxs(
1401
1415
  Popover,
@@ -1428,8 +1442,9 @@ const EntityPicker = ({ entity, category, onChange }) => {
1428
1442
  align: "start",
1429
1443
  className: "w-[min(360px,calc(100vw-2rem))] p-0",
1430
1444
  onOpenAutoFocus: (event) => {
1445
+ var _a2;
1431
1446
  event.preventDefault();
1432
- searchRef.current?.focus();
1447
+ (_a2 = searchRef.current) == null ? void 0 : _a2.focus();
1433
1448
  },
1434
1449
  children: [
1435
1450
  /* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-2", children: /* @__PURE__ */ jsx(
@@ -1569,7 +1584,7 @@ function formatNumber(value) {
1569
1584
  return new Intl.NumberFormat().format(value);
1570
1585
  }
1571
1586
  function formatMoney(amount, currencyCode) {
1572
- const code = currencyCode?.trim().toUpperCase();
1587
+ const code = currencyCode == null ? void 0 : currencyCode.trim().toUpperCase();
1573
1588
  if (code && /^[A-Z]{3}$/.test(code)) {
1574
1589
  try {
1575
1590
  return new Intl.NumberFormat(void 0, { style: "currency", currency: code }).format(amount);
@@ -1636,9 +1651,9 @@ const SummaryCards = ({ stats, loading, failed }) => {
1636
1651
  };
1637
1652
  const BASE = "/admin/deleted-records-audit";
1638
1653
  class AuditApiError extends Error {
1639
- status;
1640
1654
  constructor(message, status) {
1641
1655
  super(message);
1656
+ __publicField(this, "status");
1642
1657
  this.status = status;
1643
1658
  }
1644
1659
  }
@@ -1703,7 +1718,10 @@ const URL_KEYS = {
1703
1718
  const DATE_PRESET_VALUES = new Set(DATE_PRESETS.map((p) => p.value));
1704
1719
  const DAY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
1705
1720
  function filtersFromSearchParams(params) {
1706
- const read = (key) => params.get(URL_KEYS[key])?.trim() ?? "";
1721
+ const read = (key) => {
1722
+ var _a;
1723
+ return ((_a = params.get(URL_KEYS[key])) == null ? void 0 : _a.trim()) ?? "";
1724
+ };
1707
1725
  const date = read("date");
1708
1726
  const from = read("from");
1709
1727
  const to = read("to");
@@ -1857,9 +1875,9 @@ const DeletedRecordsPage = () => {
1857
1875
  try {
1858
1876
  setStats(await fetchAuditStats(signal));
1859
1877
  } catch (e) {
1860
- if (!signal?.aborted) setStatsFailed(true);
1878
+ if (!(signal == null ? void 0 : signal.aborted)) setStatsFailed(true);
1861
1879
  } finally {
1862
- if (!signal?.aborted) setStatsLoading(false);
1880
+ if (!(signal == null ? void 0 : signal.aborted)) setStatsLoading(false);
1863
1881
  }
1864
1882
  }, []);
1865
1883
  useEffect(() => {
@@ -1916,7 +1934,7 @@ const DeletedRecordsPage = () => {
1916
1934
  const visible = Array.from(document.querySelectorAll(`[data-audit-row="${lastViewed}"]`)).find(
1917
1935
  (el) => el.offsetParent !== null
1918
1936
  );
1919
- visible?.scrollIntoView({ block: "center" });
1937
+ visible == null ? void 0 : visible.scrollIntoView({ block: "center" });
1920
1938
  });
1921
1939
  const handle = setTimeout(() => setHighlightId(null), 2500);
1922
1940
  return () => clearTimeout(handle);
@@ -1943,8 +1961,8 @@ const DeletedRecordsPage = () => {
1943
1961
  };
1944
1962
  const refresh = () => setReloadToken((t) => t + 1);
1945
1963
  const hasMore = items.length < count;
1946
- const knownSources = stats?.sources ?? [];
1947
- const knownDeletedBy = stats?.deleted_by ?? [];
1964
+ const knownSources = (stats == null ? void 0 : stats.sources) ?? [];
1965
+ const knownDeletedBy = (stats == null ? void 0 : stats.deleted_by) ?? [];
1948
1966
  const attributionMissing = !!stats && stats.total > 0 && knownSources.length === 0 && knownDeletedBy.length === 0;
1949
1967
  return /* @__PURE__ */ jsx("div", { className: "w-full p-3 md:p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-4 md:p-6", children: [
1950
1968
  /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-start md:justify-between", children: [
@@ -2208,7 +2226,7 @@ const ErrorState = ({ onRetry, detail }) => /* @__PURE__ */ jsxs("div", { classN
2208
2226
  /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "max-w-md font-mono text-ui-fg-muted", children: detail }),
2209
2227
  /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", className: "mt-2", onClick: onRetry, children: "Try again" })
2210
2228
  ] });
2211
- const config$9 = defineRouteConfig({
2229
+ const config$8 = defineRouteConfig({
2212
2230
  label: "Deleted Records",
2213
2231
  icon: Trash
2214
2232
  });
@@ -2503,7 +2521,7 @@ const RefundsPage = () => {
2503
2521
  ) }) : null
2504
2522
  ] }) });
2505
2523
  };
2506
- const config$8 = defineRouteConfig({
2524
+ const config$7 = defineRouteConfig({
2507
2525
  label: "Refunds",
2508
2526
  icon: Receipt
2509
2527
  });
@@ -2516,6 +2534,206 @@ const useDebounce$2 = (value, delay) => {
2516
2534
  return debouncedValue;
2517
2535
  };
2518
2536
  const getStatusBadgeClass$6 = (status) => {
2537
+ const s2 = status.toLowerCase();
2538
+ if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
2539
+ if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
2540
+ if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
2541
+ if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
2542
+ return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
2543
+ };
2544
+ const PaymentsPage = () => {
2545
+ const navigate = useNavigate();
2546
+ const [items, setItems] = useState([]);
2547
+ const [statusFilter, setStatusFilter] = useState("all");
2548
+ const [orderIdSearch, setOrderIdSearch] = useState("");
2549
+ const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
2550
+ const [isLoading, setIsLoading] = useState(true);
2551
+ const [isFetchingMore, setIsFetchingMore] = useState(false);
2552
+ const [error, setError] = useState(null);
2553
+ const [offset, setOffset] = useState(0);
2554
+ const [count, setCount] = useState(0);
2555
+ const limit = 50;
2556
+ const loadTransactions = useCallback(
2557
+ async (nextOffset, replace) => {
2558
+ try {
2559
+ if (replace) setIsLoading(true);
2560
+ else setIsFetchingMore(true);
2561
+ setError(null);
2562
+ const params = new URLSearchParams();
2563
+ params.set("limit", String(limit));
2564
+ params.set("offset", String(nextOffset));
2565
+ if (statusFilter !== "all") params.set("status", statusFilter);
2566
+ if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
2567
+ const response = await fetch(
2568
+ `/admin/payment-transactions?${params.toString()}`,
2569
+ { credentials: "include" }
2570
+ );
2571
+ if (!response.ok) {
2572
+ const text = await response.text();
2573
+ throw new Error(text || "Failed to load payment transactions");
2574
+ }
2575
+ const payload = await response.json();
2576
+ const list = payload.transactions ?? [];
2577
+ setCount(payload.count ?? 0);
2578
+ setOffset(nextOffset + list.length);
2579
+ setItems((prev) => replace ? list : [...prev, ...list]);
2580
+ } catch (e) {
2581
+ setError(e instanceof Error ? e.message : "Failed to load");
2582
+ } finally {
2583
+ setIsLoading(false);
2584
+ setIsFetchingMore(false);
2585
+ }
2586
+ },
2587
+ [statusFilter, debouncedOrderId]
2588
+ );
2589
+ useEffect(() => {
2590
+ void loadTransactions(0, true);
2591
+ }, [loadTransactions]);
2592
+ const hasMore = useMemo(() => offset < count, [offset, count]);
2593
+ const displayStatus = (t) => {
2594
+ const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
2595
+ return s2 !== "" ? s2 : "—";
2596
+ };
2597
+ const displayAmount = (t) => {
2598
+ const code = (t.currency_code ?? "USD").toUpperCase();
2599
+ return `${code} ${Number(t.amount)}`;
2600
+ };
2601
+ return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
2602
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
2603
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
2604
+ /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payments" }),
2605
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
2606
+ ] }),
2607
+ /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
2608
+ ] }),
2609
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
2610
+ /* @__PURE__ */ jsx(
2611
+ Input,
2612
+ {
2613
+ placeholder: "Search by Order ID",
2614
+ value: orderIdSearch,
2615
+ onChange: (e) => setOrderIdSearch(e.target.value),
2616
+ className: "md:max-w-sm",
2617
+ "aria-label": "Search by order ID"
2618
+ }
2619
+ ),
2620
+ /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxs(
2621
+ "select",
2622
+ {
2623
+ value: statusFilter,
2624
+ onChange: (e) => setStatusFilter(e.target.value),
2625
+ className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
2626
+ "aria-label": "Filter by status",
2627
+ children: [
2628
+ /* @__PURE__ */ jsx("option", { value: "all", children: "All statuses" }),
2629
+ /* @__PURE__ */ jsx("option", { value: "pending", children: "Pending" }),
2630
+ /* @__PURE__ */ jsx("option", { value: "requires_more", children: "Requires more" }),
2631
+ /* @__PURE__ */ jsx("option", { value: "error", children: "Error" }),
2632
+ /* @__PURE__ */ jsx("option", { value: "canceled", children: "Canceled" }),
2633
+ /* @__PURE__ */ jsx("option", { value: "authorized", children: "Authorized" }),
2634
+ /* @__PURE__ */ jsx("option", { value: "captured", children: "Captured" })
2635
+ ]
2636
+ }
2637
+ ) })
2638
+ ] }),
2639
+ error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
2640
+ /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
2641
+ /* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
2642
+ ] }) : null,
2643
+ isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
2644
+ /* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
2645
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
2646
+ ] }) : /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
2647
+ /* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
2648
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
2649
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
2650
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
2651
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
2652
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
2653
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
2654
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
2655
+ ] }) }),
2656
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxs(
2657
+ "tr",
2658
+ {
2659
+ className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
2660
+ onClick: () => navigate(`/payments/${t.payment_session_id}`),
2661
+ children: [
2662
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
2663
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
2664
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
2665
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
2666
+ Badge,
2667
+ {
2668
+ size: "2xsmall",
2669
+ className: `uppercase ${getStatusBadgeClass$6(displayStatus(t))}`,
2670
+ children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
2671
+ }
2672
+ ) }),
2673
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
2674
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
2675
+ year: "numeric",
2676
+ month: "short",
2677
+ day: "numeric",
2678
+ hour: "numeric",
2679
+ minute: "2-digit",
2680
+ hour12: true
2681
+ }) }),
2682
+ /* @__PURE__ */ jsxs("td", { className: "px-4 py-4", children: [
2683
+ /* @__PURE__ */ jsx(
2684
+ Button,
2685
+ {
2686
+ variant: "transparent",
2687
+ size: "small",
2688
+ onClick: (e) => {
2689
+ e.stopPropagation();
2690
+ navigate(`/payments/${t.payment_session_id}`);
2691
+ },
2692
+ children: "View details"
2693
+ }
2694
+ ),
2695
+ t.order_id ? /* @__PURE__ */ jsx(
2696
+ Button,
2697
+ {
2698
+ variant: "transparent",
2699
+ size: "small",
2700
+ onClick: (e) => {
2701
+ e.stopPropagation();
2702
+ navigate(`/orders/${t.order_id}`);
2703
+ },
2704
+ children: "Order"
2705
+ }
2706
+ ) : null
2707
+ ] })
2708
+ ]
2709
+ },
2710
+ t.payment_session_id
2711
+ )) })
2712
+ ] }) }),
2713
+ hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
2714
+ Button,
2715
+ {
2716
+ variant: "secondary",
2717
+ isLoading: isFetchingMore,
2718
+ onClick: () => loadTransactions(offset, false),
2719
+ children: "Load more"
2720
+ }
2721
+ ) }) : null
2722
+ ] }) });
2723
+ };
2724
+ const config$6 = defineRouteConfig({
2725
+ label: "Payments",
2726
+ icon: CreditCard
2727
+ });
2728
+ const useDebounce$1 = (value, delay) => {
2729
+ const [debouncedValue, setDebouncedValue] = useState(value);
2730
+ useEffect(() => {
2731
+ const handler = setTimeout(() => setDebouncedValue(value), delay);
2732
+ return () => clearTimeout(handler);
2733
+ }, [value, delay]);
2734
+ return debouncedValue;
2735
+ };
2736
+ const getStatusBadgeClass$5 = (status) => {
2519
2737
  const statusLower = status.toLowerCase();
2520
2738
  if (statusLower === "requested") {
2521
2739
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
@@ -2540,7 +2758,7 @@ const ReturnsPage = () => {
2540
2758
  const [statusFilter, setStatusFilter] = useState("all");
2541
2759
  const [createdByFilter, setCreatedByFilter] = useState("all");
2542
2760
  const [searchQuery, setSearchQuery] = useState("");
2543
- const debouncedSearchQuery = useDebounce$2(searchQuery, 300);
2761
+ const debouncedSearchQuery = useDebounce$1(searchQuery, 300);
2544
2762
  const [isLoading, setIsLoading] = useState(true);
2545
2763
  const [isFetchingMore, setIsFetchingMore] = useState(false);
2546
2764
  const [error, setError] = useState(null);
@@ -2549,6 +2767,7 @@ const ReturnsPage = () => {
2549
2767
  const limit = 50;
2550
2768
  const loadReturns = useCallback(
2551
2769
  async (nextOffset, replace = false) => {
2770
+ var _a;
2552
2771
  try {
2553
2772
  if (replace) {
2554
2773
  setIsLoading(true);
@@ -2579,7 +2798,7 @@ const ReturnsPage = () => {
2579
2798
  }
2580
2799
  const payload = await response.json();
2581
2800
  setCount(payload.count ?? 0);
2582
- setOffset(nextOffset + (payload.returns?.length ?? 0));
2801
+ setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
2583
2802
  setItems(
2584
2803
  (prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
2585
2804
  );
@@ -2685,13 +2904,13 @@ const ReturnsPage = () => {
2685
2904
  Badge,
2686
2905
  {
2687
2906
  size: "2xsmall",
2688
- className: `uppercase ${getStatusBadgeClass$6(returnOrder.status)}`,
2907
+ className: `uppercase ${getStatusBadgeClass$5(returnOrder.status)}`,
2689
2908
  children: returnOrder.status.replace(/_/g, " ")
2690
2909
  }
2691
2910
  ) }),
2692
2911
  /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
2693
2912
  const calc = returnOrder.refund;
2694
- if (calc?.is_processed && calc.final_refund_amount != null) {
2913
+ if ((calc == null ? void 0 : calc.is_processed) && calc.final_refund_amount != null) {
2695
2914
  return formatRefundCurrency(
2696
2915
  calc.final_refund_amount,
2697
2916
  calc.currency_code || returnOrder.currency_code
@@ -2744,11 +2963,11 @@ const ReturnsPage = () => {
2744
2963
  ) }) : null
2745
2964
  ] }) });
2746
2965
  };
2747
- const config$7 = defineRouteConfig({
2966
+ const config$5 = defineRouteConfig({
2748
2967
  label: "Return Orders",
2749
2968
  icon: ArrowPath
2750
2969
  });
2751
- const useDebounce$1 = (value, delay) => {
2970
+ const useDebounce = (value, delay) => {
2752
2971
  const [debouncedValue, setDebouncedValue] = useState(value);
2753
2972
  useEffect(() => {
2754
2973
  const handler = setTimeout(() => setDebouncedValue(value), delay);
@@ -2756,7 +2975,7 @@ const useDebounce$1 = (value, delay) => {
2756
2975
  }, [value, delay]);
2757
2976
  return debouncedValue;
2758
2977
  };
2759
- const getStatusBadgeClass$5 = (status) => {
2978
+ const getStatusBadgeClass$4 = (status) => {
2760
2979
  const statusLower = status.toLowerCase();
2761
2980
  if (statusLower === "requested") {
2762
2981
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
@@ -2781,7 +3000,7 @@ const SwapsPage = () => {
2781
3000
  const [statusFilter, setStatusFilter] = useState("all");
2782
3001
  const [createdByFilter, setCreatedByFilter] = useState("all");
2783
3002
  const [searchQuery, setSearchQuery] = useState("");
2784
- const debouncedSearchQuery = useDebounce$1(searchQuery, 300);
3003
+ const debouncedSearchQuery = useDebounce(searchQuery, 300);
2785
3004
  const [isLoading, setIsLoading] = useState(true);
2786
3005
  const [isFetchingMore, setIsFetchingMore] = useState(false);
2787
3006
  const [error, setError] = useState(null);
@@ -2790,6 +3009,7 @@ const SwapsPage = () => {
2790
3009
  const limit = 50;
2791
3010
  const loadSwaps = useCallback(
2792
3011
  async (nextOffset, replace = false) => {
3012
+ var _a;
2793
3013
  try {
2794
3014
  if (replace) {
2795
3015
  setIsLoading(true);
@@ -2819,7 +3039,7 @@ const SwapsPage = () => {
2819
3039
  }
2820
3040
  const payload = await response.json();
2821
3041
  setCount(payload.count ?? 0);
2822
- setOffset(nextOffset + (payload.swaps?.length ?? 0));
3042
+ setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
2823
3043
  setItems(
2824
3044
  (prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
2825
3045
  );
@@ -2923,7 +3143,7 @@ const SwapsPage = () => {
2923
3143
  Badge,
2924
3144
  {
2925
3145
  size: "2xsmall",
2926
- className: `uppercase ${getStatusBadgeClass$5(swap.status)}`,
3146
+ className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
2927
3147
  children: swap.status.replace(/_/g, " ")
2928
3148
  }
2929
3149
  ) }),
@@ -2973,235 +3193,35 @@ const SwapsPage = () => {
2973
3193
  ) }) : null
2974
3194
  ] }) });
2975
3195
  };
2976
- const config$6 = defineRouteConfig({
3196
+ const config$4 = defineRouteConfig({
2977
3197
  label: "Exchanges",
2978
3198
  icon: ArrowPath
2979
3199
  });
2980
- const useDebounce = (value, delay) => {
2981
- const [debouncedValue, setDebouncedValue] = useState(value);
2982
- useEffect(() => {
2983
- const handler = setTimeout(() => setDebouncedValue(value), delay);
2984
- return () => clearTimeout(handler);
2985
- }, [value, delay]);
2986
- return debouncedValue;
2987
- };
2988
- const getStatusBadgeClass$4 = (status) => {
2989
- const s2 = status.toLowerCase();
2990
- if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
2991
- if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
2992
- if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
2993
- if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
2994
- return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
2995
- };
2996
- const PaymentsPage = () => {
2997
- const navigate = useNavigate();
2998
- const [items, setItems] = useState([]);
2999
- const [statusFilter, setStatusFilter] = useState("all");
3000
- const [orderIdSearch, setOrderIdSearch] = useState("");
3001
- const debouncedOrderId = useDebounce(orderIdSearch, 300);
3002
- const [isLoading, setIsLoading] = useState(true);
3003
- const [isFetchingMore, setIsFetchingMore] = useState(false);
3004
- const [error, setError] = useState(null);
3005
- const [offset, setOffset] = useState(0);
3006
- const [count, setCount] = useState(0);
3007
- const limit = 50;
3008
- const loadTransactions = useCallback(
3009
- async (nextOffset, replace) => {
3010
- try {
3011
- if (replace) setIsLoading(true);
3012
- else setIsFetchingMore(true);
3013
- setError(null);
3014
- const params = new URLSearchParams();
3015
- params.set("limit", String(limit));
3016
- params.set("offset", String(nextOffset));
3017
- if (statusFilter !== "all") params.set("status", statusFilter);
3018
- if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
3019
- const response = await fetch(
3020
- `/admin/payment-transactions?${params.toString()}`,
3021
- { credentials: "include" }
3022
- );
3023
- if (!response.ok) {
3024
- const text = await response.text();
3025
- throw new Error(text || "Failed to load payment transactions");
3026
- }
3027
- const payload = await response.json();
3028
- const list = payload.transactions ?? [];
3029
- setCount(payload.count ?? 0);
3030
- setOffset(nextOffset + list.length);
3031
- setItems((prev) => replace ? list : [...prev, ...list]);
3032
- } catch (e) {
3033
- setError(e instanceof Error ? e.message : "Failed to load");
3034
- } finally {
3035
- setIsLoading(false);
3036
- setIsFetchingMore(false);
3037
- }
3038
- },
3039
- [statusFilter, debouncedOrderId]
3040
- );
3041
- useEffect(() => {
3042
- void loadTransactions(0, true);
3043
- }, [loadTransactions]);
3044
- const hasMore = useMemo(() => offset < count, [offset, count]);
3045
- const displayStatus = (t) => {
3046
- const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
3047
- return s2 !== "" ? s2 : "—";
3048
- };
3049
- const displayAmount = (t) => {
3050
- const code = (t.currency_code ?? "USD").toUpperCase();
3051
- return `${code} ${Number(t.amount)}`;
3052
- };
3053
- return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
3054
- /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
3055
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
3056
- /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payments" }),
3057
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
3058
- ] }),
3059
- /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
3060
- ] }),
3061
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
3062
- /* @__PURE__ */ jsx(
3063
- Input,
3064
- {
3065
- placeholder: "Search by Order ID",
3066
- value: orderIdSearch,
3067
- onChange: (e) => setOrderIdSearch(e.target.value),
3068
- className: "md:max-w-sm",
3069
- "aria-label": "Search by order ID"
3070
- }
3071
- ),
3072
- /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxs(
3073
- "select",
3074
- {
3075
- value: statusFilter,
3076
- onChange: (e) => setStatusFilter(e.target.value),
3077
- className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
3078
- "aria-label": "Filter by status",
3079
- children: [
3080
- /* @__PURE__ */ jsx("option", { value: "all", children: "All statuses" }),
3081
- /* @__PURE__ */ jsx("option", { value: "pending", children: "Pending" }),
3082
- /* @__PURE__ */ jsx("option", { value: "requires_more", children: "Requires more" }),
3083
- /* @__PURE__ */ jsx("option", { value: "error", children: "Error" }),
3084
- /* @__PURE__ */ jsx("option", { value: "canceled", children: "Canceled" }),
3085
- /* @__PURE__ */ jsx("option", { value: "authorized", children: "Authorized" }),
3086
- /* @__PURE__ */ jsx("option", { value: "captured", children: "Captured" })
3087
- ]
3088
- }
3089
- ) })
3090
- ] }),
3091
- error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
3092
- /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
3093
- /* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
3094
- ] }) : null,
3095
- isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
3096
- /* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
3097
- /* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
3098
- ] }) : /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
3099
- /* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
3100
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
3101
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
3102
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
3103
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
3104
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
3105
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
3106
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
3107
- ] }) }),
3108
- /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxs(
3109
- "tr",
3110
- {
3111
- className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
3112
- onClick: () => navigate(`/payments/${t.payment_session_id}`),
3113
- children: [
3114
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
3115
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
3116
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
3117
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
3118
- Badge,
3119
- {
3120
- size: "2xsmall",
3121
- className: `uppercase ${getStatusBadgeClass$4(displayStatus(t))}`,
3122
- children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
3123
- }
3124
- ) }),
3125
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
3126
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
3127
- year: "numeric",
3128
- month: "short",
3129
- day: "numeric",
3130
- hour: "numeric",
3131
- minute: "2-digit",
3132
- hour12: true
3133
- }) }),
3134
- /* @__PURE__ */ jsxs("td", { className: "px-4 py-4", children: [
3135
- /* @__PURE__ */ jsx(
3136
- Button,
3137
- {
3138
- variant: "transparent",
3139
- size: "small",
3140
- onClick: (e) => {
3141
- e.stopPropagation();
3142
- navigate(`/payments/${t.payment_session_id}`);
3143
- },
3144
- children: "View details"
3145
- }
3146
- ),
3147
- t.order_id ? /* @__PURE__ */ jsx(
3148
- Button,
3149
- {
3150
- variant: "transparent",
3151
- size: "small",
3152
- onClick: (e) => {
3153
- e.stopPropagation();
3154
- navigate(`/orders/${t.order_id}`);
3155
- },
3156
- children: "Order"
3157
- }
3158
- ) : null
3159
- ] })
3160
- ]
3161
- },
3162
- t.payment_session_id
3163
- )) })
3164
- ] }) }),
3165
- hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
3166
- Button,
3167
- {
3168
- variant: "secondary",
3169
- isLoading: isFetchingMore,
3170
- onClick: () => loadTransactions(offset, false),
3171
- children: "Load more"
3172
- }
3173
- ) }) : null
3174
- ] }) });
3175
- };
3176
- const config$5 = defineRouteConfig({
3177
- label: "Payments",
3178
- icon: CreditCard
3179
- });
3180
- const MASKED_VALUE = "••••••••••••";
3181
- const SENSITIVE_KEY_PATTERNS = [
3182
- /password|passwd|passphrase/i,
3183
- /secret/i,
3184
- /token/i,
3185
- /api_?key$/i,
3186
- /private_?key/i,
3187
- /access_?key/i,
3188
- /(^|_)hash(ed)?($|_)/i,
3189
- /(^|_)salt$/i,
3190
- /^cvv$|^cvc$|security_code/i,
3191
- /card_?number/i,
3192
- /account_?number/i,
3193
- /credential/i,
3194
- /authorization/i,
3195
- /recovery_?code/i,
3196
- /(^|_)otp($|_)/i,
3197
- /verification_?code/i,
3198
- /^code_hash$/i,
3199
- /webhook_?signature/i
3200
- ];
3201
- const TABLE_SENSITIVE_KEYS = {
3202
- otp_verification: /* @__PURE__ */ new Set(["code", "value"]),
3203
- auth_verification: /* @__PURE__ */ new Set(["code", "value"]),
3204
- auth_mfa_factor: /* @__PURE__ */ new Set(["value", "config"])
3200
+ const MASKED_VALUE = "••••••••••••";
3201
+ const SENSITIVE_KEY_PATTERNS = [
3202
+ /password|passwd|passphrase/i,
3203
+ /secret/i,
3204
+ /token/i,
3205
+ /api_?key$/i,
3206
+ /private_?key/i,
3207
+ /access_?key/i,
3208
+ /(^|_)hash(ed)?($|_)/i,
3209
+ /(^|_)salt$/i,
3210
+ /^cvv$|^cvc$|security_code/i,
3211
+ /card_?number/i,
3212
+ /account_?number/i,
3213
+ /credential/i,
3214
+ /authorization/i,
3215
+ /recovery_?code/i,
3216
+ /(^|_)otp($|_)/i,
3217
+ /verification_?code/i,
3218
+ /^code_hash$/i,
3219
+ /webhook_?signature/i
3220
+ ];
3221
+ const TABLE_SENSITIVE_KEYS = {
3222
+ otp_verification: /* @__PURE__ */ new Set(["code", "value"]),
3223
+ auth_verification: /* @__PURE__ */ new Set(["code", "value"]),
3224
+ auth_mfa_factor: /* @__PURE__ */ new Set(["value", "config"])
3205
3225
  };
3206
3226
  const SAFE_KEYS = /* @__PURE__ */ new Set([
3207
3227
  "token_type",
@@ -3218,12 +3238,13 @@ function isSensitiveKey(key) {
3218
3238
  const FULLY_SECRET_TABLES = /* @__PURE__ */ new Set(["auth_mfa_recovery_code", "auth_password_reset_token"]);
3219
3239
  const ALWAYS_VISIBLE_KEYS = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "deleted_at", "expires_at", "used_at"]);
3220
3240
  function maskValue(value, ctx, depth) {
3241
+ var _a;
3221
3242
  if (Array.isArray(value)) return value.map((item) => maskValue(item, ctx, depth + 1));
3222
3243
  if (value !== null && typeof value === "object") {
3223
3244
  const out = {};
3224
3245
  for (const [key, inner] of Object.entries(value)) {
3225
3246
  const topLevel = depth === 0;
3226
- const secret = inner !== null && inner !== void 0 && inner !== "" && (isSensitiveKey(key) || topLevel && ctx.tableKeys?.has(key.toLowerCase()) === true || topLevel && ctx.maskAll && !ALWAYS_VISIBLE_KEYS.has(key) && !key.endsWith("_id"));
3247
+ const secret = inner !== null && inner !== void 0 && inner !== "" && (isSensitiveKey(key) || topLevel && ((_a = ctx.tableKeys) == null ? void 0 : _a.has(key.toLowerCase())) === true || topLevel && ctx.maskAll && !ALWAYS_VISIBLE_KEYS.has(key) && !key.endsWith("_id"));
3227
3248
  if (secret) {
3228
3249
  ctx.count += 1;
3229
3250
  out[key] = MASKED_VALUE;
@@ -3689,12 +3710,13 @@ function readLastListSearch() {
3689
3710
  }
3690
3711
  }
3691
3712
  const DeletedRecordDetailPage = () => {
3713
+ var _a;
3692
3714
  const navigate = useNavigate();
3693
3715
  const location = useLocation();
3694
3716
  const { id = "" } = useParams();
3695
3717
  const [state, setState] = useState({ status: "loading" });
3696
3718
  const [reloadToken, setReloadToken] = useState(0);
3697
- const cameFromList = location.state?.fromList === true;
3719
+ const cameFromList = ((_a = location.state) == null ? void 0 : _a.fromList) === true;
3698
3720
  const goBack = () => {
3699
3721
  if (cameFromList) navigate(-1);
3700
3722
  else navigate(`/deleted-records-audit${readLastListSearch()}`);
@@ -3918,7 +3940,7 @@ const DetailError = ({
3918
3940
  !notFound ? /* @__PURE__ */ jsx(Button, { variant: "primary", size: "small", onClick: onRetry, children: "Try again" }) : null
3919
3941
  ] })
3920
3942
  ] });
3921
- const config$4 = defineRouteConfig({});
3943
+ defineRouteConfig({});
3922
3944
  const getStatusBadgeClass$3 = (status) => {
3923
3945
  const s2 = status.toLowerCase();
3924
3946
  if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
@@ -3931,9 +3953,10 @@ const formatAmount = (value) => {
3931
3953
  return String(value);
3932
3954
  };
3933
3955
  const RefundDetailPage = () => {
3956
+ var _a, _b, _c;
3934
3957
  const navigate = useNavigate();
3935
3958
  const params = useParams();
3936
- const id = params?.id?.trim();
3959
+ const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
3937
3960
  const [detail, setDetail] = useState(null);
3938
3961
  const [loading, setLoading] = useState(!!id);
3939
3962
  const [error, setError] = useState(null);
@@ -3960,8 +3983,8 @@ const RefundDetailPage = () => {
3960
3983
  cancelled = true;
3961
3984
  };
3962
3985
  }, [id]);
3963
- const paymentStatus = detail?.payment?.status ?? "—";
3964
- const hasGatewayData = detail?.payment?.payment_data && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
3986
+ const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
3987
+ const hasGatewayData = ((_c = detail == null ? void 0 : detail.payment) == null ? void 0 : _c.payment_data) && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
3965
3988
  return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
3966
3989
  /* @__PURE__ */ jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
3967
3990
  /* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
@@ -4111,114 +4134,238 @@ const config$3 = defineRouteConfig({
4111
4134
  icon: Receipt
4112
4135
  });
4113
4136
  const getStatusBadgeClass$2 = (status) => {
4114
- const statusLower = status.toLowerCase();
4115
- if (statusLower === "requested") {
4116
- return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
4117
- }
4118
- if (statusLower === "approved") {
4119
- return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
4120
- }
4121
- if (statusLower === "rejected") {
4122
- return "bg-ui-tag-red-bg text-ui-tag-red-text";
4123
- }
4124
- if (statusLower === "received") {
4125
- return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
4126
- }
4127
- if (statusLower === "refunded") {
4128
- return "bg-ui-tag-green-bg text-ui-tag-green-text";
4129
- }
4130
- if (statusLower === "completed") {
4131
- return "bg-ui-tag-green-bg text-ui-tag-green-text";
4132
- }
4133
- if (statusLower === "cancelled") {
4134
- return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
4135
- }
4137
+ const s2 = status.toLowerCase();
4138
+ if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
4139
+ if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
4140
+ if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
4141
+ if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
4136
4142
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
4137
4143
  };
4138
- const ReturnDetailPage = () => {
4144
+ const PaymentDetailPage = () => {
4145
+ var _a;
4139
4146
  const navigate = useNavigate();
4140
- const { id } = useParams();
4141
- const [returnOrder, setReturnOrder] = useState(null);
4142
- const [isLoading, setIsLoading] = useState(true);
4143
- const [isRejecting, setIsRejecting] = useState(false);
4147
+ const params = useParams();
4148
+ const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
4149
+ const [detail, setDetail] = useState(null);
4150
+ const [loading, setLoading] = useState(!!id);
4144
4151
  const [error, setError] = useState(null);
4145
- const [updateError, setUpdateError] = useState(null);
4146
- const [updateSuccess, setUpdateSuccess] = useState(false);
4147
4152
  useEffect(() => {
4148
4153
  if (!id) {
4149
- navigate("/returns");
4154
+ setLoading(false);
4150
4155
  return;
4151
4156
  }
4152
- const loadReturn = async () => {
4153
- try {
4154
- setIsLoading(true);
4155
- setError(null);
4156
- const response = await fetch(`/admin/return/${id}`, {
4157
- credentials: "include"
4158
- });
4159
- if (!response.ok) {
4160
- const message = await response.text();
4161
- throw new Error(message || "Unable to load return order");
4157
+ let cancelled = false;
4158
+ setLoading(true);
4159
+ setError(null);
4160
+ fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
4161
+ if (!res.ok) throw new Error(res.statusText || "Failed to load");
4162
+ return res.json();
4163
+ }).then((data) => {
4164
+ if (!cancelled) setDetail(data);
4165
+ }).catch((e) => {
4166
+ if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
4167
+ }).finally(() => {
4168
+ if (!cancelled) setLoading(false);
4169
+ });
4170
+ return () => {
4171
+ cancelled = true;
4172
+ };
4173
+ }, [id]);
4174
+ const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
4175
+ const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
4176
+ const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
4177
+ const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
4178
+ return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
4179
+ /* @__PURE__ */ jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
4180
+ /* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
4181
+ /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payment session" }),
4182
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
4183
+ ] }) }),
4184
+ error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
4185
+ /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
4186
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
4187
+ ] }) : loading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
4188
+ /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
4189
+ /* @__PURE__ */ jsxs("div", { children: [
4190
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
4191
+ /* @__PURE__ */ jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsx(
4192
+ Button,
4193
+ {
4194
+ variant: "transparent",
4195
+ size: "small",
4196
+ onClick: () => navigate(`/orders/${detail.order_id}`),
4197
+ children: detail.order_id
4198
+ }
4199
+ ) : /* @__PURE__ */ jsx(Text, { children: "—" }) })
4200
+ ] }),
4201
+ /* @__PURE__ */ jsxs("div", { children: [
4202
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
4203
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: displayAmount })
4204
+ ] }),
4205
+ /* @__PURE__ */ jsxs("div", { children: [
4206
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
4207
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.provider_id })
4208
+ ] }),
4209
+ /* @__PURE__ */ jsxs("div", { children: [
4210
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
4211
+ /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
4212
+ Badge,
4213
+ {
4214
+ size: "2xsmall",
4215
+ className: `uppercase ${getStatusBadgeClass$2(displayStatus)}`,
4216
+ children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
4217
+ }
4218
+ ) })
4219
+ ] }),
4220
+ /* @__PURE__ */ jsxs("div", { children: [
4221
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
4222
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: sessionStatusRaw })
4223
+ ] }),
4224
+ /* @__PURE__ */ jsxs("div", { children: [
4225
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
4226
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: paymentStatusRaw })
4227
+ ] }),
4228
+ /* @__PURE__ */ jsxs("div", { children: [
4229
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
4230
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
4231
+ ] }),
4232
+ /* @__PURE__ */ jsxs("div", { children: [
4233
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
4234
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
4235
+ year: "numeric",
4236
+ month: "short",
4237
+ day: "numeric",
4238
+ hour: "numeric",
4239
+ minute: "2-digit",
4240
+ hour12: true
4241
+ }) })
4242
+ ] })
4243
+ ] }) }),
4244
+ Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
4245
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
4246
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
4247
+ ] }) : /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
4248
+ ] }) : null
4249
+ ] }) });
4250
+ };
4251
+ const config$2 = defineRouteConfig({
4252
+ label: "Payment details",
4253
+ icon: CreditCard
4254
+ });
4255
+ const getStatusBadgeClass$1 = (status) => {
4256
+ const statusLower = status.toLowerCase();
4257
+ if (statusLower === "requested") {
4258
+ return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
4259
+ }
4260
+ if (statusLower === "approved") {
4261
+ return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
4262
+ }
4263
+ if (statusLower === "rejected") {
4264
+ return "bg-ui-tag-red-bg text-ui-tag-red-text";
4265
+ }
4266
+ if (statusLower === "completed") {
4267
+ return "bg-ui-tag-green-bg text-ui-tag-green-text";
4268
+ }
4269
+ if (statusLower === "cancelled" || statusLower === "canceled") {
4270
+ return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
4271
+ }
4272
+ if (statusLower === "pending") {
4273
+ return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
4274
+ }
4275
+ return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
4276
+ };
4277
+ const SwapDetailPage = () => {
4278
+ var _a, _b, _c;
4279
+ const navigate = useNavigate();
4280
+ const { id } = useParams();
4281
+ const [swap, setSwap] = useState(null);
4282
+ const [order, setOrder] = useState(null);
4283
+ const [isLoading, setIsLoading] = useState(true);
4284
+ useState(false);
4285
+ const [isCancelling, setIsCancelling] = useState(false);
4286
+ const [error, setError] = useState(null);
4287
+ const [updateError, setUpdateError] = useState(null);
4288
+ const [updateSuccess, setUpdateSuccess] = useState(false);
4289
+ useEffect(() => {
4290
+ if (!id) {
4291
+ navigate("/swaps");
4292
+ return;
4293
+ }
4294
+ const loadSwap = async () => {
4295
+ try {
4296
+ setIsLoading(true);
4297
+ setError(null);
4298
+ const response = await fetch(`/admin/swaps/${id}`, {
4299
+ credentials: "include"
4300
+ });
4301
+ if (!response.ok) {
4302
+ const message = await response.text();
4303
+ throw new Error(message || "Unable to load swap");
4162
4304
  }
4163
4305
  const payload = await response.json();
4164
- setReturnOrder(payload.return);
4306
+ setSwap(payload.swap);
4307
+ setOrder(payload.order || null);
4165
4308
  } catch (loadError) {
4166
- const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
4309
+ const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
4167
4310
  setError(message);
4168
4311
  } finally {
4169
4312
  setIsLoading(false);
4170
4313
  }
4171
4314
  };
4172
- void loadReturn();
4315
+ void loadSwap();
4173
4316
  }, [id, navigate]);
4174
- const handleReject = async () => {
4317
+ const handleCancelExchange = async () => {
4175
4318
  if (!id) {
4176
4319
  return;
4177
4320
  }
4178
4321
  try {
4179
- setIsRejecting(true);
4322
+ setIsCancelling(true);
4180
4323
  setUpdateError(null);
4181
4324
  setUpdateSuccess(false);
4182
- const response = await fetch(`/admin/return/${id}/reject`, {
4325
+ const response = await fetch(`/admin/swaps/${id}/cancel`, {
4183
4326
  method: "POST",
4184
4327
  headers: {
4185
4328
  "Content-Type": "application/json"
4186
4329
  },
4187
- credentials: "include",
4188
- body: JSON.stringify({ reason: "Rejected by admin" })
4330
+ credentials: "include"
4189
4331
  });
4190
4332
  if (!response.ok) {
4191
4333
  const message = await response.text();
4192
- throw new Error(message || "Unable to reject return");
4334
+ throw new Error(message || "Unable to cancel exchange");
4193
4335
  }
4194
4336
  const payload = await response.json();
4195
- setReturnOrder(payload.return);
4337
+ setSwap(payload.swap);
4196
4338
  setUpdateSuccess(true);
4197
4339
  setTimeout(() => setUpdateSuccess(false), 3e3);
4198
- const detailResponse = await fetch(`/admin/return/${id}`, {
4340
+ const detailResponse = await fetch(`/admin/swaps/${id}`, {
4199
4341
  credentials: "include"
4200
4342
  });
4201
4343
  if (detailResponse.ok) {
4202
4344
  const detailPayload = await detailResponse.json();
4203
- setReturnOrder(detailPayload.return);
4345
+ setSwap(detailPayload.swap);
4346
+ setOrder(detailPayload.order || null);
4204
4347
  }
4205
- } catch (updateErr) {
4206
- const message = updateErr instanceof Error ? updateErr.message : "Unable to reject return";
4348
+ } catch (cancelErr) {
4349
+ const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
4207
4350
  setUpdateError(message);
4208
4351
  } finally {
4209
- setIsRejecting(false);
4352
+ setIsCancelling(false);
4210
4353
  }
4211
4354
  };
4355
+ const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
4356
+ const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
4357
+ ((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
4358
+ );
4212
4359
  if (isLoading) {
4213
- return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsx(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading return order..." }) }) }) });
4360
+ return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsx(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading swap..." }) }) }) });
4214
4361
  }
4215
- if (error || !returnOrder) {
4362
+ if (error || !swap) {
4216
4363
  return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsx(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
4217
- /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
4218
- /* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/returns"), children: "Back to list" }) })
4364
+ /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
4365
+ /* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
4219
4366
  ] }) }) });
4220
4367
  }
4221
- const statusHistory = returnOrder.metadata?.status_history || [];
4368
+ const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
4222
4369
  return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
4223
4370
  /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
4224
4371
  /* @__PURE__ */ jsxs(
@@ -4226,7 +4373,7 @@ const ReturnDetailPage = () => {
4226
4373
  {
4227
4374
  variant: "transparent",
4228
4375
  size: "small",
4229
- onClick: () => navigate("/returns"),
4376
+ onClick: () => navigate("/swaps"),
4230
4377
  className: "w-fit",
4231
4378
  children: [
4232
4379
  /* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2" }),
@@ -4236,82 +4383,67 @@ const ReturnDetailPage = () => {
4236
4383
  ),
4237
4384
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
4238
4385
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
4239
- /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Return Order Details" }),
4240
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
4386
+ /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Exchange Details" }),
4387
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
4241
4388
  ] }),
4242
4389
  /* @__PURE__ */ jsx(
4243
4390
  Badge,
4244
4391
  {
4245
4392
  size: "small",
4246
- className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
4247
- children: returnOrder.status.replace(/_/g, " ")
4393
+ className: `uppercase ${getStatusBadgeClass$1(swap.status)}`,
4394
+ children: swap.status.replace(/_/g, " ")
4248
4395
  }
4249
4396
  )
4250
4397
  ] })
4251
4398
  ] }),
4252
- returnOrder.status === "requested" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
4399
+ canCancelExchange && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
4253
4400
  /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(
4254
4401
  Button,
4255
4402
  {
4256
4403
  variant: "danger",
4257
- onClick: handleReject,
4258
- disabled: isRejecting,
4259
- isLoading: isRejecting,
4260
- children: "Reject (Cancel) Return"
4404
+ onClick: handleCancelExchange,
4405
+ disabled: isCancelling,
4406
+ isLoading: isCancelling,
4407
+ children: "Cancel Exchange"
4261
4408
  }
4262
4409
  ) }),
4263
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: 'Cancel this return request. Use "Mark as received" when items are received.' })
4264
- ] }),
4265
- returnOrder.refund ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: /* @__PURE__ */ jsx(RefundCalculationBlock, { refund: returnOrder.refund }) }) : null,
4266
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4267
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
4268
- /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
4269
- /* @__PURE__ */ jsxs("div", { children: [
4270
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
4271
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
4272
- ] }),
4273
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
4274
- Button,
4275
- {
4276
- variant: "secondary",
4277
- onClick: () => {
4278
- window.open(
4279
- `/app/orders/${returnOrder.order_id}`,
4280
- "_blank"
4281
- );
4282
- },
4283
- children: "View order"
4284
- }
4285
- ) })
4286
- ] })
4410
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
4287
4411
  ] }),
4288
4412
  /* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
4289
4413
  /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4290
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
4414
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
4291
4415
  /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
4292
4416
  /* @__PURE__ */ jsxs("div", { children: [
4293
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
4294
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
4417
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
4418
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.id })
4295
4419
  ] }),
4296
4420
  /* @__PURE__ */ jsxs("div", { children: [
4297
4421
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
4298
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.status })
4422
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.status })
4299
4423
  ] }),
4300
- returnOrder.reason && /* @__PURE__ */ jsxs("div", { children: [
4424
+ /* @__PURE__ */ jsxs("div", { children: [
4425
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
4426
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
4427
+ ] }),
4428
+ swap.reason && /* @__PURE__ */ jsxs("div", { children: [
4301
4429
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
4302
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.reason })
4430
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.reason })
4303
4431
  ] }),
4304
- returnOrder.note && /* @__PURE__ */ jsxs("div", { children: [
4432
+ swap.note && /* @__PURE__ */ jsxs("div", { children: [
4305
4433
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
4306
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.note })
4434
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.note })
4307
4435
  ] }),
4308
4436
  /* @__PURE__ */ jsxs("div", { children: [
4309
4437
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
4310
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
4438
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
4311
4439
  ] }),
4312
4440
  /* @__PURE__ */ jsxs("div", { children: [
4313
4441
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
4314
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
4442
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
4443
+ ] }),
4444
+ swap.exchange_id && /* @__PURE__ */ jsxs("div", { children: [
4445
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
4446
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.exchange_id })
4315
4447
  ] })
4316
4448
  ] })
4317
4449
  ] }),
@@ -4326,7 +4458,7 @@ const ReturnDetailPage = () => {
4326
4458
  Badge,
4327
4459
  {
4328
4460
  size: "2xsmall",
4329
- className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
4461
+ className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
4330
4462
  children: entry.status.replace(/_/g, " ")
4331
4463
  }
4332
4464
  ) }),
@@ -4341,35 +4473,31 @@ const ReturnDetailPage = () => {
4341
4473
  )) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
4342
4474
  ] })
4343
4475
  ] }),
4344
- returnOrder.order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4476
+ order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4345
4477
  /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
4346
4478
  /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
4347
4479
  /* @__PURE__ */ jsxs("div", { children: [
4348
4480
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
4349
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.id })
4481
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.id })
4350
4482
  ] }),
4351
4483
  /* @__PURE__ */ jsxs("div", { children: [
4352
4484
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
4353
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.status || "—" })
4485
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.status || "—" })
4354
4486
  ] }),
4355
4487
  /* @__PURE__ */ jsxs("div", { children: [
4356
4488
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
4357
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.customer?.email || returnOrder.order.email || "—" })
4358
- ] }),
4359
- /* @__PURE__ */ jsxs("div", { children: [
4360
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Payment method" }),
4361
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.order_payment?.label || "—" })
4489
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
4362
4490
  ] }),
4363
- returnOrder.order.total && /* @__PURE__ */ jsxs("div", { children: [
4491
+ order.total && /* @__PURE__ */ jsxs("div", { children: [
4364
4492
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
4365
4493
  /* @__PURE__ */ jsxs(Text, { className: "font-medium", children: [
4366
- returnOrder.order.currency_code || "$",
4367
- (Number(returnOrder.order.total) / 100).toFixed(2)
4494
+ order.currency_code || "$",
4495
+ (Number(order.total) / 100).toFixed(2)
4368
4496
  ] })
4369
4497
  ] })
4370
4498
  ] })
4371
4499
  ] }),
4372
- returnOrder.return_items && returnOrder.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4500
+ swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4373
4501
  /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
4374
4502
  /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
4375
4503
  /* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
@@ -4377,22 +4505,33 @@ const ReturnDetailPage = () => {
4377
4505
  /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
4378
4506
  /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
4379
4507
  ] }) }),
4380
- /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
4508
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
4381
4509
  /* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
4382
4510
  /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
4383
4511
  /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
4384
4512
  ] }, item.id || index)) })
4385
4513
  ] }) })
4386
4514
  ] }),
4387
- updateError && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-error bg-ui-bg-error-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-error", children: updateError }) }),
4388
- updateSuccess && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
4515
+ swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4516
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
4517
+ /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
4518
+ /* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
4519
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
4520
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
4521
+ ] }) }),
4522
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
4523
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
4524
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
4525
+ ] }, item.variant_id || index)) })
4526
+ ] }) })
4527
+ ] })
4389
4528
  ] }) });
4390
4529
  };
4391
- const config$2 = defineRouteConfig({
4392
- label: "Return Order Details",
4393
- icon: CheckCircle
4530
+ const config$1 = defineRouteConfig({
4531
+ label: "Swap Details",
4532
+ icon: ArrowPath
4394
4533
  });
4395
- const getStatusBadgeClass$1 = (status) => {
4534
+ const getStatusBadgeClass = (status) => {
4396
4535
  const statusLower = status.toLowerCase();
4397
4536
  if (statusLower === "requested") {
4398
4537
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
@@ -4403,108 +4542,105 @@ const getStatusBadgeClass$1 = (status) => {
4403
4542
  if (statusLower === "rejected") {
4404
4543
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
4405
4544
  }
4545
+ if (statusLower === "received") {
4546
+ return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
4547
+ }
4548
+ if (statusLower === "refunded") {
4549
+ return "bg-ui-tag-green-bg text-ui-tag-green-text";
4550
+ }
4406
4551
  if (statusLower === "completed") {
4407
4552
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
4408
4553
  }
4409
- if (statusLower === "cancelled" || statusLower === "canceled") {
4554
+ if (statusLower === "cancelled") {
4410
4555
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
4411
4556
  }
4412
- if (statusLower === "pending") {
4413
- return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
4414
- }
4415
4557
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
4416
4558
  };
4417
- const SwapDetailPage = () => {
4559
+ const ReturnDetailPage = () => {
4560
+ var _a, _b, _c;
4418
4561
  const navigate = useNavigate();
4419
4562
  const { id } = useParams();
4420
- const [swap, setSwap] = useState(null);
4421
- const [order, setOrder] = useState(null);
4563
+ const [returnOrder, setReturnOrder] = useState(null);
4422
4564
  const [isLoading, setIsLoading] = useState(true);
4423
4565
  const [isRejecting, setIsRejecting] = useState(false);
4424
- const [isCancelling, setIsCancelling] = useState(false);
4425
4566
  const [error, setError] = useState(null);
4426
4567
  const [updateError, setUpdateError] = useState(null);
4427
4568
  const [updateSuccess, setUpdateSuccess] = useState(false);
4428
4569
  useEffect(() => {
4429
4570
  if (!id) {
4430
- navigate("/swaps");
4571
+ navigate("/returns");
4431
4572
  return;
4432
4573
  }
4433
- const loadSwap = async () => {
4574
+ const loadReturn = async () => {
4434
4575
  try {
4435
4576
  setIsLoading(true);
4436
4577
  setError(null);
4437
- const response = await fetch(`/admin/swaps/${id}`, {
4578
+ const response = await fetch(`/admin/return/${id}`, {
4438
4579
  credentials: "include"
4439
4580
  });
4440
4581
  if (!response.ok) {
4441
4582
  const message = await response.text();
4442
- throw new Error(message || "Unable to load swap");
4583
+ throw new Error(message || "Unable to load return order");
4443
4584
  }
4444
4585
  const payload = await response.json();
4445
- setSwap(payload.swap);
4446
- setOrder(payload.order || null);
4586
+ setReturnOrder(payload.return);
4447
4587
  } catch (loadError) {
4448
- const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
4588
+ const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
4449
4589
  setError(message);
4450
4590
  } finally {
4451
4591
  setIsLoading(false);
4452
4592
  }
4453
4593
  };
4454
- void loadSwap();
4594
+ void loadReturn();
4455
4595
  }, [id, navigate]);
4456
- const handleCancelExchange = async () => {
4596
+ const handleReject = async () => {
4457
4597
  if (!id) {
4458
4598
  return;
4459
4599
  }
4460
4600
  try {
4461
- setIsCancelling(true);
4601
+ setIsRejecting(true);
4462
4602
  setUpdateError(null);
4463
4603
  setUpdateSuccess(false);
4464
- const response = await fetch(`/admin/swaps/${id}/cancel`, {
4604
+ const response = await fetch(`/admin/return/${id}/reject`, {
4465
4605
  method: "POST",
4466
4606
  headers: {
4467
4607
  "Content-Type": "application/json"
4468
4608
  },
4469
- credentials: "include"
4609
+ credentials: "include",
4610
+ body: JSON.stringify({ reason: "Rejected by admin" })
4470
4611
  });
4471
4612
  if (!response.ok) {
4472
4613
  const message = await response.text();
4473
- throw new Error(message || "Unable to cancel exchange");
4614
+ throw new Error(message || "Unable to reject return");
4474
4615
  }
4475
4616
  const payload = await response.json();
4476
- setSwap(payload.swap);
4617
+ setReturnOrder(payload.return);
4477
4618
  setUpdateSuccess(true);
4478
4619
  setTimeout(() => setUpdateSuccess(false), 3e3);
4479
- const detailResponse = await fetch(`/admin/swaps/${id}`, {
4620
+ const detailResponse = await fetch(`/admin/return/${id}`, {
4480
4621
  credentials: "include"
4481
4622
  });
4482
4623
  if (detailResponse.ok) {
4483
4624
  const detailPayload = await detailResponse.json();
4484
- setSwap(detailPayload.swap);
4485
- setOrder(detailPayload.order || null);
4625
+ setReturnOrder(detailPayload.return);
4486
4626
  }
4487
- } catch (cancelErr) {
4488
- const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
4627
+ } catch (updateErr) {
4628
+ const message = updateErr instanceof Error ? updateErr.message : "Unable to reject return";
4489
4629
  setUpdateError(message);
4490
4630
  } finally {
4491
- setIsCancelling(false);
4631
+ setIsRejecting(false);
4492
4632
  }
4493
4633
  };
4494
- const isOrderExchange = Boolean(swap?.exchange_id);
4495
- const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
4496
- swap.status?.toLowerCase() ?? ""
4497
- );
4498
4634
  if (isLoading) {
4499
- return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsx(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading swap..." }) }) }) });
4635
+ return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsx(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading return order..." }) }) }) });
4500
4636
  }
4501
- if (error || !swap) {
4637
+ if (error || !returnOrder) {
4502
4638
  return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsx(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
4503
- /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
4504
- /* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
4639
+ /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
4640
+ /* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/returns"), children: "Back to list" }) })
4505
4641
  ] }) }) });
4506
4642
  }
4507
- const statusHistory = swap.metadata?.status_history || [];
4643
+ const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
4508
4644
  return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
4509
4645
  /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
4510
4646
  /* @__PURE__ */ jsxs(
@@ -4512,7 +4648,7 @@ const SwapDetailPage = () => {
4512
4648
  {
4513
4649
  variant: "transparent",
4514
4650
  size: "small",
4515
- onClick: () => navigate("/swaps"),
4651
+ onClick: () => navigate("/returns"),
4516
4652
  className: "w-fit",
4517
4653
  children: [
4518
4654
  /* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2" }),
@@ -4522,67 +4658,82 @@ const SwapDetailPage = () => {
4522
4658
  ),
4523
4659
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
4524
4660
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
4525
- /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Exchange Details" }),
4526
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
4661
+ /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Return Order Details" }),
4662
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
4527
4663
  ] }),
4528
4664
  /* @__PURE__ */ jsx(
4529
4665
  Badge,
4530
4666
  {
4531
4667
  size: "small",
4532
- className: `uppercase ${getStatusBadgeClass$1(swap.status)}`,
4533
- children: swap.status.replace(/_/g, " ")
4668
+ className: `uppercase ${getStatusBadgeClass(returnOrder.status)}`,
4669
+ children: returnOrder.status.replace(/_/g, " ")
4670
+ }
4671
+ )
4672
+ ] })
4673
+ ] }),
4674
+ returnOrder.status === "requested" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
4675
+ /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(
4676
+ Button,
4677
+ {
4678
+ variant: "danger",
4679
+ onClick: handleReject,
4680
+ disabled: isRejecting,
4681
+ isLoading: isRejecting,
4682
+ children: "Reject (Cancel) Return"
4683
+ }
4684
+ ) }),
4685
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: 'Cancel this return request. Use "Mark as received" when items are received.' })
4686
+ ] }),
4687
+ returnOrder.refund ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: /* @__PURE__ */ jsx(RefundCalculationBlock, { refund: returnOrder.refund }) }) : null,
4688
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4689
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
4690
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
4691
+ /* @__PURE__ */ jsxs("div", { children: [
4692
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
4693
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
4694
+ ] }),
4695
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
4696
+ Button,
4697
+ {
4698
+ variant: "secondary",
4699
+ onClick: () => {
4700
+ window.open(
4701
+ `/app/orders/${returnOrder.order_id}`,
4702
+ "_blank"
4703
+ );
4704
+ },
4705
+ children: "View order"
4534
4706
  }
4535
- )
4707
+ ) })
4536
4708
  ] })
4537
4709
  ] }),
4538
- canCancelExchange && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
4539
- /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(
4540
- Button,
4541
- {
4542
- variant: "danger",
4543
- onClick: handleCancelExchange,
4544
- disabled: isCancelling,
4545
- isLoading: isCancelling,
4546
- children: "Cancel Exchange"
4547
- }
4548
- ) }),
4549
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
4550
- ] }),
4551
4710
  /* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
4552
4711
  /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4553
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
4712
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
4554
4713
  /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
4555
4714
  /* @__PURE__ */ jsxs("div", { children: [
4556
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
4557
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.id })
4715
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
4716
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
4558
4717
  ] }),
4559
4718
  /* @__PURE__ */ jsxs("div", { children: [
4560
4719
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
4561
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.status })
4562
- ] }),
4563
- /* @__PURE__ */ jsxs("div", { children: [
4564
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
4565
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
4720
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.status })
4566
4721
  ] }),
4567
- swap.reason && /* @__PURE__ */ jsxs("div", { children: [
4722
+ returnOrder.reason && /* @__PURE__ */ jsxs("div", { children: [
4568
4723
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
4569
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.reason })
4724
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.reason })
4570
4725
  ] }),
4571
- swap.note && /* @__PURE__ */ jsxs("div", { children: [
4726
+ returnOrder.note && /* @__PURE__ */ jsxs("div", { children: [
4572
4727
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
4573
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.note })
4728
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.note })
4574
4729
  ] }),
4575
4730
  /* @__PURE__ */ jsxs("div", { children: [
4576
4731
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
4577
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
4732
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
4578
4733
  ] }),
4579
4734
  /* @__PURE__ */ jsxs("div", { children: [
4580
4735
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
4581
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
4582
- ] }),
4583
- swap.exchange_id && /* @__PURE__ */ jsxs("div", { children: [
4584
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
4585
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.exchange_id })
4736
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
4586
4737
  ] })
4587
4738
  ] })
4588
4739
  ] }),
@@ -4597,7 +4748,7 @@ const SwapDetailPage = () => {
4597
4748
  Badge,
4598
4749
  {
4599
4750
  size: "2xsmall",
4600
- className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
4751
+ className: `uppercase ${getStatusBadgeClass(entry.status)}`,
4601
4752
  children: entry.status.replace(/_/g, " ")
4602
4753
  }
4603
4754
  ) }),
@@ -4612,31 +4763,35 @@ const SwapDetailPage = () => {
4612
4763
  )) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
4613
4764
  ] })
4614
4765
  ] }),
4615
- order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4766
+ returnOrder.order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4616
4767
  /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
4617
4768
  /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
4618
4769
  /* @__PURE__ */ jsxs("div", { children: [
4619
4770
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
4620
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.id })
4771
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.id })
4621
4772
  ] }),
4622
4773
  /* @__PURE__ */ jsxs("div", { children: [
4623
4774
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
4624
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.status || "—" })
4775
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.status || "—" })
4625
4776
  ] }),
4626
4777
  /* @__PURE__ */ jsxs("div", { children: [
4627
4778
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
4628
- /* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.customer?.email || order.email || "—" })
4779
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
4629
4780
  ] }),
4630
- order.total && /* @__PURE__ */ jsxs("div", { children: [
4781
+ /* @__PURE__ */ jsxs("div", { children: [
4782
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Payment method" }),
4783
+ /* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_c = returnOrder.order.order_payment) == null ? void 0 : _c.label) || "—" })
4784
+ ] }),
4785
+ returnOrder.order.total && /* @__PURE__ */ jsxs("div", { children: [
4631
4786
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
4632
4787
  /* @__PURE__ */ jsxs(Text, { className: "font-medium", children: [
4633
- order.currency_code || "$",
4634
- (Number(order.total) / 100).toFixed(2)
4788
+ returnOrder.order.currency_code || "$",
4789
+ (Number(returnOrder.order.total) / 100).toFixed(2)
4635
4790
  ] })
4636
4791
  ] })
4637
4792
  ] })
4638
4793
  ] }),
4639
- swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4794
+ returnOrder.return_items && returnOrder.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4640
4795
  /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
4641
4796
  /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
4642
4797
  /* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
@@ -4644,290 +4799,131 @@ const SwapDetailPage = () => {
4644
4799
  /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
4645
4800
  /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
4646
4801
  ] }) }),
4647
- /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
4802
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
4648
4803
  /* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
4649
4804
  /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
4650
4805
  /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
4651
4806
  ] }, item.id || index)) })
4652
4807
  ] }) })
4653
4808
  ] }),
4654
- swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
4655
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
4656
- /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
4657
- /* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
4658
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
4659
- /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
4660
- ] }) }),
4661
- /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
4662
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
4663
- /* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
4664
- ] }, item.variant_id || index)) })
4665
- ] }) })
4666
- ] })
4667
- ] }) });
4668
- };
4669
- const config$1 = defineRouteConfig({
4670
- label: "Swap Details",
4671
- icon: ArrowPath
4672
- });
4673
- const getStatusBadgeClass = (status) => {
4674
- const s2 = status.toLowerCase();
4675
- if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
4676
- if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
4677
- if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
4678
- if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
4679
- return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
4680
- };
4681
- const PaymentDetailPage = () => {
4682
- const navigate = useNavigate();
4683
- const params = useParams();
4684
- const id = params?.id?.trim();
4685
- const [detail, setDetail] = useState(null);
4686
- const [loading, setLoading] = useState(!!id);
4687
- const [error, setError] = useState(null);
4688
- useEffect(() => {
4689
- if (!id) {
4690
- setLoading(false);
4691
- return;
4692
- }
4693
- let cancelled = false;
4694
- setLoading(true);
4695
- setError(null);
4696
- fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
4697
- if (!res.ok) throw new Error(res.statusText || "Failed to load");
4698
- return res.json();
4699
- }).then((data) => {
4700
- if (!cancelled) setDetail(data);
4701
- }).catch((e) => {
4702
- if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
4703
- }).finally(() => {
4704
- if (!cancelled) setLoading(false);
4705
- });
4706
- return () => {
4707
- cancelled = true;
4708
- };
4709
- }, [id]);
4710
- const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
4711
- const sessionStatusRaw = detail?.session_status ?? "—";
4712
- const paymentStatusRaw = detail?.payment_id != null ? detail?.payment_status ?? "—" : "—";
4713
- const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
4714
- return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
4715
- /* @__PURE__ */ jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
4716
- /* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
4717
- /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payment session" }),
4718
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
4719
- ] }) }),
4720
- error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
4721
- /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
4722
- /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
4723
- ] }) : loading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
4724
- /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
4725
- /* @__PURE__ */ jsxs("div", { children: [
4726
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
4727
- /* @__PURE__ */ jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsx(
4728
- Button,
4729
- {
4730
- variant: "transparent",
4731
- size: "small",
4732
- onClick: () => navigate(`/orders/${detail.order_id}`),
4733
- children: detail.order_id
4734
- }
4735
- ) : /* @__PURE__ */ jsx(Text, { children: "—" }) })
4736
- ] }),
4737
- /* @__PURE__ */ jsxs("div", { children: [
4738
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
4739
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: displayAmount })
4740
- ] }),
4741
- /* @__PURE__ */ jsxs("div", { children: [
4742
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
4743
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.provider_id })
4744
- ] }),
4745
- /* @__PURE__ */ jsxs("div", { children: [
4746
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
4747
- /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
4748
- Badge,
4749
- {
4750
- size: "2xsmall",
4751
- className: `uppercase ${getStatusBadgeClass(displayStatus)}`,
4752
- children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
4753
- }
4754
- ) })
4755
- ] }),
4756
- /* @__PURE__ */ jsxs("div", { children: [
4757
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
4758
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: sessionStatusRaw })
4759
- ] }),
4760
- /* @__PURE__ */ jsxs("div", { children: [
4761
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
4762
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: paymentStatusRaw })
4763
- ] }),
4764
- /* @__PURE__ */ jsxs("div", { children: [
4765
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
4766
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
4767
- ] }),
4768
- /* @__PURE__ */ jsxs("div", { children: [
4769
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
4770
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
4771
- year: "numeric",
4772
- month: "short",
4773
- day: "numeric",
4774
- hour: "numeric",
4775
- minute: "2-digit",
4776
- hour12: true
4777
- }) })
4778
- ] })
4779
- ] }) }),
4780
- Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
4781
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
4782
- /* @__PURE__ */ jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
4783
- ] }) : /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
4784
- ] }) : null
4809
+ updateError && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-error bg-ui-bg-error-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-error", children: updateError }) }),
4810
+ updateSuccess && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
4785
4811
  ] }) });
4786
4812
  };
4787
4813
  const config = defineRouteConfig({
4788
- label: "Payment details",
4789
- icon: CreditCard
4814
+ label: "Return Order Details",
4815
+ icon: CheckCircle
4790
4816
  });
4791
4817
  const i18nTranslations0 = {};
4792
4818
  const widgetModule = { widgets: [
4793
4819
  {
4794
4820
  Component: OrderGiftItemsWidget,
4795
- zone: ["order.details.side.after"],
4796
- widgetId: "Widget-b753"
4821
+ zone: ["order.details.side.after"]
4797
4822
  },
4798
4823
  {
4799
4824
  Component: OrderRefundContextWidget,
4800
- zone: ["order.details.after"],
4801
- widgetId: "Widget-0606"
4825
+ zone: ["order.details.after"]
4802
4826
  }
4803
4827
  ] };
4804
4828
  const routeModule = {
4805
4829
  routes: [
4806
4830
  {
4807
4831
  Component: DeletedRecordsPage,
4808
- path: "/deleted-records-audit",
4809
- handle: { label: config$9.label, translationNs: config$9.translationNs }
4832
+ path: "/deleted-records-audit"
4810
4833
  },
4811
4834
  {
4812
4835
  Component: RefundsPage,
4813
- path: "/refunds",
4814
- handle: { label: config$8.label, translationNs: config$8.translationNs }
4836
+ path: "/refunds"
4815
4837
  },
4816
4838
  {
4817
- Component: ReturnsPage,
4818
- path: "/returns",
4819
- handle: { label: config$7.label, translationNs: config$7.translationNs }
4839
+ Component: PaymentsPage,
4840
+ path: "/payments"
4820
4841
  },
4821
4842
  {
4822
- Component: SwapsPage,
4823
- path: "/swaps",
4824
- handle: { label: config$6.label, translationNs: config$6.translationNs }
4843
+ Component: ReturnsPage,
4844
+ path: "/returns"
4825
4845
  },
4826
4846
  {
4827
- Component: PaymentsPage,
4828
- path: "/payments",
4829
- handle: { label: config$5.label, translationNs: config$5.translationNs }
4847
+ Component: SwapsPage,
4848
+ path: "/swaps"
4830
4849
  },
4831
4850
  {
4832
4851
  Component: DeletedRecordDetailPage,
4833
- path: "/deleted-records-audit/:id",
4834
- handle: { label: config$4.label, translationNs: config$4.translationNs }
4852
+ path: "/deleted-records-audit/:id"
4835
4853
  },
4836
4854
  {
4837
4855
  Component: RefundDetailPage,
4838
- path: "/refunds/:id",
4839
- handle: { label: config$3.label, translationNs: config$3.translationNs }
4856
+ path: "/refunds/:id"
4840
4857
  },
4841
4858
  {
4842
- Component: ReturnDetailPage,
4843
- path: "/returns/:id",
4844
- handle: { label: config$2.label, translationNs: config$2.translationNs }
4859
+ Component: PaymentDetailPage,
4860
+ path: "/payments/:id"
4845
4861
  },
4846
4862
  {
4847
4863
  Component: SwapDetailPage,
4848
- path: "/swaps/:id",
4849
- handle: { label: config$1.label, translationNs: config$1.translationNs }
4864
+ path: "/swaps/:id"
4850
4865
  },
4851
4866
  {
4852
- Component: PaymentDetailPage,
4853
- path: "/payments/:id",
4854
- handle: { label: config.label, translationNs: config.translationNs }
4867
+ Component: ReturnDetailPage,
4868
+ path: "/returns/:id"
4855
4869
  }
4856
4870
  ]
4857
4871
  };
4858
4872
  const menuItemModule = {
4859
4873
  menuItems: [
4860
4874
  {
4861
- label: config$9.label,
4862
- icon: config$9.icon,
4875
+ label: config$6.label,
4876
+ icon: config$6.icon,
4877
+ path: "/payments",
4878
+ nested: void 0
4879
+ },
4880
+ {
4881
+ label: config$8.label,
4882
+ icon: config$8.icon,
4863
4883
  path: "/deleted-records-audit",
4864
- nested: void 0,
4865
- rank: void 0,
4866
- translationNs: void 0
4884
+ nested: void 0
4867
4885
  },
4868
4886
  {
4869
4887
  label: config$5.label,
4870
4888
  icon: config$5.icon,
4871
- path: "/payments",
4872
- nested: void 0,
4873
- rank: void 0,
4874
- translationNs: void 0
4875
- },
4876
- {
4877
- label: config$6.label,
4878
- icon: config$6.icon,
4879
- path: "/swaps",
4880
- nested: void 0,
4881
- rank: void 0,
4882
- translationNs: void 0
4889
+ path: "/returns",
4890
+ nested: void 0
4883
4891
  },
4884
4892
  {
4885
4893
  label: config$7.label,
4886
4894
  icon: config$7.icon,
4887
- path: "/returns",
4888
- nested: void 0,
4889
- rank: void 0,
4890
- translationNs: void 0
4891
- },
4892
- {
4893
- label: config$8.label,
4894
- icon: config$8.icon,
4895
4895
  path: "/refunds",
4896
- nested: void 0,
4897
- rank: void 0,
4898
- translationNs: void 0
4899
- },
4900
- {
4901
- label: config.label,
4902
- icon: config.icon,
4903
- path: "/payments/:id",
4904
- nested: void 0,
4905
- rank: void 0,
4906
- translationNs: void 0
4896
+ nested: void 0
4907
4897
  },
4908
4898
  {
4909
- label: config$1.label,
4910
- icon: config$1.icon,
4911
- path: "/swaps/:id",
4912
- nested: void 0,
4913
- rank: void 0,
4914
- translationNs: void 0
4899
+ label: config$4.label,
4900
+ icon: config$4.icon,
4901
+ path: "/swaps",
4902
+ nested: void 0
4915
4903
  },
4916
4904
  {
4917
4905
  label: config$2.label,
4918
4906
  icon: config$2.icon,
4907
+ path: "/payments/:id",
4908
+ nested: void 0
4909
+ },
4910
+ {
4911
+ label: config.label,
4912
+ icon: config.icon,
4919
4913
  path: "/returns/:id",
4920
- nested: void 0,
4921
- rank: void 0,
4922
- translationNs: void 0
4914
+ nested: void 0
4923
4915
  },
4924
4916
  {
4925
4917
  label: config$3.label,
4926
4918
  icon: config$3.icon,
4927
4919
  path: "/refunds/:id",
4928
- nested: void 0,
4929
- rank: void 0,
4930
- translationNs: void 0
4920
+ nested: void 0
4921
+ },
4922
+ {
4923
+ label: config$1.label,
4924
+ icon: config$1.icon,
4925
+ path: "/swaps/:id",
4926
+ nested: void 0
4931
4927
  }
4932
4928
  ]
4933
4929
  };
@@ -4936,19 +4932,13 @@ const displayModule = {
4936
4932
  displays: {}
4937
4933
  };
4938
4934
  const i18nModule = { resources: i18nTranslations0 };
4939
- const cellRendererModule = {};
4940
- const layoutModule = { layouts: [] };
4941
- const searchEntityModule = {};
4942
4935
  const plugin = {
4943
4936
  widgetModule,
4944
4937
  routeModule,
4945
4938
  menuItemModule,
4946
4939
  formModule,
4947
4940
  displayModule,
4948
- i18nModule,
4949
- cellRendererModule,
4950
- layoutModule,
4951
- searchEntityModule
4941
+ i18nModule
4952
4942
  };
4953
4943
  export {
4954
4944
  plugin as default