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