order-management 0.0.95 → 0.0.96

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.
@@ -2007,197 +2007,6 @@ const config$3 = defineRouteConfig({
2007
2007
  icon: CreditCard
2008
2008
  });
2009
2009
  const getStatusBadgeClass$2 = (status) => {
2010
- const s2 = status.toLowerCase();
2011
- if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
2012
- if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
2013
- if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
2014
- if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
2015
- return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
2016
- };
2017
- const formatAmount = (value) => {
2018
- return String(value);
2019
- };
2020
- const RefundDetailPage = () => {
2021
- const navigate = useNavigate();
2022
- const params = useParams();
2023
- const id = params?.id?.trim();
2024
- const [detail, setDetail] = useState(null);
2025
- const [loading, setLoading] = useState(!!id);
2026
- const [error, setError] = useState(null);
2027
- const [gatewayExpanded, setGatewayExpanded] = useState(false);
2028
- useEffect(() => {
2029
- if (!id) {
2030
- setLoading(false);
2031
- return;
2032
- }
2033
- let cancelled = false;
2034
- setLoading(true);
2035
- setError(null);
2036
- fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
2037
- if (!res.ok) throw new Error(res.statusText || "Failed to load");
2038
- return res.json();
2039
- }).then((data) => {
2040
- if (!cancelled) setDetail(data);
2041
- }).catch((e) => {
2042
- if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
2043
- }).finally(() => {
2044
- if (!cancelled) setLoading(false);
2045
- });
2046
- return () => {
2047
- cancelled = true;
2048
- };
2049
- }, [id]);
2050
- const paymentStatus = detail?.payment?.status ?? "—";
2051
- const hasGatewayData = detail?.payment?.payment_data && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
2052
- 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: [
2053
- /* @__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: [
2054
- /* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
2055
- /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Refund details" }),
2056
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
2057
- ] }) }),
2058
- error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
2059
- /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
2060
- /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
2061
- ] }) : 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: [
2062
- /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2063
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
2064
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
2065
- /* @__PURE__ */ jsxs("div", { children: [
2066
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
2067
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
2068
- ] }),
2069
- /* @__PURE__ */ jsxs("div", { children: [
2070
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
2071
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
2072
- ] }),
2073
- /* @__PURE__ */ jsxs("div", { children: [
2074
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
2075
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
2076
- ] }),
2077
- /* @__PURE__ */ jsxs("div", { children: [
2078
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
2079
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
2080
- year: "numeric",
2081
- month: "short",
2082
- day: "numeric",
2083
- hour: "numeric",
2084
- minute: "2-digit",
2085
- hour12: true
2086
- }) })
2087
- ] }),
2088
- detail.refund.created_by ? /* @__PURE__ */ jsxs("div", { children: [
2089
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
2090
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
2091
- ] }) : null
2092
- ] })
2093
- ] }),
2094
- /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2095
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
2096
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
2097
- /* @__PURE__ */ jsxs("div", { children: [
2098
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
2099
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
2100
- ] }),
2101
- /* @__PURE__ */ jsxs("div", { children: [
2102
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
2103
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
2104
- ] }),
2105
- /* @__PURE__ */ jsxs("div", { children: [
2106
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
2107
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
2108
- ] }),
2109
- /* @__PURE__ */ jsxs("div", { children: [
2110
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
2111
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
2112
- ] }),
2113
- /* @__PURE__ */ jsxs("div", { children: [
2114
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
2115
- /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
2116
- Badge,
2117
- {
2118
- size: "2xsmall",
2119
- className: `uppercase ${getStatusBadgeClass$2(paymentStatus)}`,
2120
- children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
2121
- }
2122
- ) })
2123
- ] }),
2124
- detail.computed ? /* @__PURE__ */ jsxs(Fragment, { children: [
2125
- /* @__PURE__ */ jsxs("div", { children: [
2126
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
2127
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
2128
- ] }),
2129
- /* @__PURE__ */ jsxs("div", { children: [
2130
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
2131
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
2132
- ] }),
2133
- /* @__PURE__ */ jsxs("div", { children: [
2134
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
2135
- /* @__PURE__ */ jsxs(Text, { className: "mt-1 block", children: [
2136
- detail.computed.refund_percentage.toFixed(1),
2137
- "%"
2138
- ] })
2139
- ] })
2140
- ] }) : null
2141
- ] })
2142
- ] }),
2143
- /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2144
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
2145
- detail.order ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
2146
- /* @__PURE__ */ jsxs("div", { children: [
2147
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
2148
- /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
2149
- Button,
2150
- {
2151
- variant: "transparent",
2152
- size: "small",
2153
- onClick: () => navigate(`/orders/${detail.order.order_id}`),
2154
- children: detail.order.order_number ?? detail.order.order_id
2155
- }
2156
- ) })
2157
- ] }),
2158
- detail.order.total != null ? /* @__PURE__ */ jsxs("div", { children: [
2159
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
2160
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
2161
- ] }) : null,
2162
- detail.order.customer_id ? /* @__PURE__ */ jsxs("div", { children: [
2163
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
2164
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
2165
- ] }) : null,
2166
- detail.order.region ? /* @__PURE__ */ jsxs("div", { children: [
2167
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
2168
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.region })
2169
- ] }) : null,
2170
- detail.order.fulfillment_status ? /* @__PURE__ */ jsxs("div", { children: [
2171
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
2172
- /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
2173
- ] }) : null
2174
- ] }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
2175
- ] }),
2176
- /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2177
- /* @__PURE__ */ jsxs(
2178
- "button",
2179
- {
2180
- type: "button",
2181
- className: "flex w-full items-center justify-between text-left",
2182
- onClick: () => setGatewayExpanded((prev) => !prev),
2183
- "aria-expanded": gatewayExpanded,
2184
- "aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
2185
- children: [
2186
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
2187
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
2188
- ]
2189
- }
2190
- ),
2191
- gatewayExpanded && /* @__PURE__ */ jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
2192
- ] })
2193
- ] }) : null
2194
- ] }) });
2195
- };
2196
- const config$2 = defineRouteConfig({
2197
- label: "Refund details",
2198
- icon: Receipt
2199
- });
2200
- const getStatusBadgeClass$1 = (status) => {
2201
2010
  const statusLower = status.toLowerCase();
2202
2011
  if (statusLower === "requested") {
2203
2012
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
@@ -2330,7 +2139,7 @@ const ReturnDetailPage = () => {
2330
2139
  Badge,
2331
2140
  {
2332
2141
  size: "small",
2333
- className: `uppercase ${getStatusBadgeClass$1(returnOrder.status)}`,
2142
+ className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
2334
2143
  children: returnOrder.status.replace(/_/g, " ")
2335
2144
  }
2336
2145
  )
@@ -2413,7 +2222,7 @@ const ReturnDetailPage = () => {
2413
2222
  Badge,
2414
2223
  {
2415
2224
  size: "2xsmall",
2416
- className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
2225
+ className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
2417
2226
  children: entry.status.replace(/_/g, " ")
2418
2227
  }
2419
2228
  ) }),
@@ -2475,10 +2284,201 @@ const ReturnDetailPage = () => {
2475
2284
  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" }) })
2476
2285
  ] }) });
2477
2286
  };
2478
- const config$1 = defineRouteConfig({
2287
+ const config$2 = defineRouteConfig({
2479
2288
  label: "Return Order Details",
2480
2289
  icon: CheckCircle
2481
2290
  });
2291
+ const getStatusBadgeClass$1 = (status) => {
2292
+ const s2 = status.toLowerCase();
2293
+ if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
2294
+ if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
2295
+ if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
2296
+ if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
2297
+ return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
2298
+ };
2299
+ const formatAmount = (value) => {
2300
+ return String(value);
2301
+ };
2302
+ const RefundDetailPage = () => {
2303
+ const navigate = useNavigate();
2304
+ const params = useParams();
2305
+ const id = params?.id?.trim();
2306
+ const [detail, setDetail] = useState(null);
2307
+ const [loading, setLoading] = useState(!!id);
2308
+ const [error, setError] = useState(null);
2309
+ const [gatewayExpanded, setGatewayExpanded] = useState(false);
2310
+ useEffect(() => {
2311
+ if (!id) {
2312
+ setLoading(false);
2313
+ return;
2314
+ }
2315
+ let cancelled = false;
2316
+ setLoading(true);
2317
+ setError(null);
2318
+ fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
2319
+ if (!res.ok) throw new Error(res.statusText || "Failed to load");
2320
+ return res.json();
2321
+ }).then((data) => {
2322
+ if (!cancelled) setDetail(data);
2323
+ }).catch((e) => {
2324
+ if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
2325
+ }).finally(() => {
2326
+ if (!cancelled) setLoading(false);
2327
+ });
2328
+ return () => {
2329
+ cancelled = true;
2330
+ };
2331
+ }, [id]);
2332
+ const paymentStatus = detail?.payment?.status ?? "—";
2333
+ const hasGatewayData = detail?.payment?.payment_data && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
2334
+ 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: [
2335
+ /* @__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: [
2336
+ /* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
2337
+ /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Refund details" }),
2338
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
2339
+ ] }) }),
2340
+ error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
2341
+ /* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
2342
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
2343
+ ] }) : 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: [
2344
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2345
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
2346
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
2347
+ /* @__PURE__ */ jsxs("div", { children: [
2348
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
2349
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
2350
+ ] }),
2351
+ /* @__PURE__ */ jsxs("div", { children: [
2352
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
2353
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
2354
+ ] }),
2355
+ /* @__PURE__ */ jsxs("div", { children: [
2356
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
2357
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
2358
+ ] }),
2359
+ /* @__PURE__ */ jsxs("div", { children: [
2360
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
2361
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
2362
+ year: "numeric",
2363
+ month: "short",
2364
+ day: "numeric",
2365
+ hour: "numeric",
2366
+ minute: "2-digit",
2367
+ hour12: true
2368
+ }) })
2369
+ ] }),
2370
+ detail.refund.created_by ? /* @__PURE__ */ jsxs("div", { children: [
2371
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
2372
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
2373
+ ] }) : null
2374
+ ] })
2375
+ ] }),
2376
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2377
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
2378
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
2379
+ /* @__PURE__ */ jsxs("div", { children: [
2380
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
2381
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
2382
+ ] }),
2383
+ /* @__PURE__ */ jsxs("div", { children: [
2384
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
2385
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
2386
+ ] }),
2387
+ /* @__PURE__ */ jsxs("div", { children: [
2388
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
2389
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
2390
+ ] }),
2391
+ /* @__PURE__ */ jsxs("div", { children: [
2392
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
2393
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
2394
+ ] }),
2395
+ /* @__PURE__ */ jsxs("div", { children: [
2396
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
2397
+ /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
2398
+ Badge,
2399
+ {
2400
+ size: "2xsmall",
2401
+ className: `uppercase ${getStatusBadgeClass$1(paymentStatus)}`,
2402
+ children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
2403
+ }
2404
+ ) })
2405
+ ] }),
2406
+ detail.computed ? /* @__PURE__ */ jsxs(Fragment, { children: [
2407
+ /* @__PURE__ */ jsxs("div", { children: [
2408
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
2409
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
2410
+ ] }),
2411
+ /* @__PURE__ */ jsxs("div", { children: [
2412
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
2413
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
2414
+ ] }),
2415
+ /* @__PURE__ */ jsxs("div", { children: [
2416
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
2417
+ /* @__PURE__ */ jsxs(Text, { className: "mt-1 block", children: [
2418
+ detail.computed.refund_percentage.toFixed(1),
2419
+ "%"
2420
+ ] })
2421
+ ] })
2422
+ ] }) : null
2423
+ ] })
2424
+ ] }),
2425
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2426
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
2427
+ detail.order ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
2428
+ /* @__PURE__ */ jsxs("div", { children: [
2429
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
2430
+ /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
2431
+ Button,
2432
+ {
2433
+ variant: "transparent",
2434
+ size: "small",
2435
+ onClick: () => navigate(`/orders/${detail.order.order_id}`),
2436
+ children: detail.order.order_number ?? detail.order.order_id
2437
+ }
2438
+ ) })
2439
+ ] }),
2440
+ detail.order.total != null ? /* @__PURE__ */ jsxs("div", { children: [
2441
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
2442
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
2443
+ ] }) : null,
2444
+ detail.order.customer_id ? /* @__PURE__ */ jsxs("div", { children: [
2445
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
2446
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
2447
+ ] }) : null,
2448
+ detail.order.region ? /* @__PURE__ */ jsxs("div", { children: [
2449
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
2450
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.region })
2451
+ ] }) : null,
2452
+ detail.order.fulfillment_status ? /* @__PURE__ */ jsxs("div", { children: [
2453
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
2454
+ /* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
2455
+ ] }) : null
2456
+ ] }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
2457
+ ] }),
2458
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
2459
+ /* @__PURE__ */ jsxs(
2460
+ "button",
2461
+ {
2462
+ type: "button",
2463
+ className: "flex w-full items-center justify-between text-left",
2464
+ onClick: () => setGatewayExpanded((prev) => !prev),
2465
+ "aria-expanded": gatewayExpanded,
2466
+ "aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
2467
+ children: [
2468
+ /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
2469
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
2470
+ ]
2471
+ }
2472
+ ),
2473
+ gatewayExpanded && /* @__PURE__ */ jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
2474
+ ] })
2475
+ ] }) : null
2476
+ ] }) });
2477
+ };
2478
+ const config$1 = defineRouteConfig({
2479
+ label: "Refund details",
2480
+ icon: Receipt
2481
+ });
2482
2482
  const getStatusBadgeClass = (status) => {
2483
2483
  const statusLower = status.toLowerCase();
2484
2484
  if (statusLower === "requested") {
@@ -2798,13 +2798,13 @@ const routeModule = {
2798
2798
  handle: { label: config$3.label, translationNs: config$3.translationNs }
2799
2799
  },
2800
2800
  {
2801
- Component: RefundDetailPage,
2802
- path: "/refunds/:id",
2801
+ Component: ReturnDetailPage,
2802
+ path: "/returns/:id",
2803
2803
  handle: { label: config$2.label, translationNs: config$2.translationNs }
2804
2804
  },
2805
2805
  {
2806
- Component: ReturnDetailPage,
2807
- path: "/returns/:id",
2806
+ Component: RefundDetailPage,
2807
+ path: "/refunds/:id",
2808
2808
  handle: { label: config$1.label, translationNs: config$1.translationNs }
2809
2809
  },
2810
2810
  {
@@ -2817,17 +2817,17 @@ const routeModule = {
2817
2817
  const menuItemModule = {
2818
2818
  menuItems: [
2819
2819
  {
2820
- label: config$7.label,
2821
- icon: config$7.icon,
2822
- path: "/payments",
2820
+ label: config$6.label,
2821
+ icon: config$6.icon,
2822
+ path: "/refunds",
2823
2823
  nested: void 0,
2824
2824
  rank: void 0,
2825
2825
  translationNs: void 0
2826
2826
  },
2827
2827
  {
2828
- label: config$6.label,
2829
- icon: config$6.icon,
2830
- path: "/refunds",
2828
+ label: config$7.label,
2829
+ icon: config$7.icon,
2830
+ path: "/payments",
2831
2831
  nested: void 0,
2832
2832
  rank: void 0,
2833
2833
  translationNs: void 0
@@ -2849,24 +2849,24 @@ const menuItemModule = {
2849
2849
  translationNs: void 0
2850
2850
  },
2851
2851
  {
2852
- label: config$3.label,
2853
- icon: config$3.icon,
2854
- path: "/payments/:id",
2852
+ label: config$1.label,
2853
+ icon: config$1.icon,
2854
+ path: "/refunds/:id",
2855
2855
  nested: void 0,
2856
2856
  rank: void 0,
2857
2857
  translationNs: void 0
2858
2858
  },
2859
2859
  {
2860
- label: config$2.label,
2861
- icon: config$2.icon,
2862
- path: "/refunds/:id",
2860
+ label: config$3.label,
2861
+ icon: config$3.icon,
2862
+ path: "/payments/:id",
2863
2863
  nested: void 0,
2864
2864
  rank: void 0,
2865
2865
  translationNs: void 0
2866
2866
  },
2867
2867
  {
2868
- label: config$1.label,
2869
- icon: config$1.icon,
2868
+ label: config$2.label,
2869
+ icon: config$2.icon,
2870
2870
  path: "/returns/:id",
2871
2871
  nested: void 0,
2872
2872
  rank: void 0,