@openrails/billing-ui 0.268.3 → 0.269.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/admin/context.d.ts +164 -62
  2. package/dist/admin/lib/api/endpoints.d.ts +3 -7
  3. package/dist/admin/lib/api/import-endpoints.d.ts +44 -0
  4. package/dist/admin/lib/api/index.d.ts +17 -7
  5. package/dist/admin/lib/api/types.d.ts +0 -29
  6. package/dist/admin/lib/import-queries.d.ts +66 -0
  7. package/dist/admin/lib/mutations.d.ts +1 -5
  8. package/dist/admin/lib/queries.d.ts +6 -20
  9. package/dist/admin/messages.d.ts +176 -6
  10. package/dist/admin/pages/catalog/index.d.ts +0 -1
  11. package/dist/admin/pages/imports/detail.d.ts +2 -0
  12. package/dist/admin/pages/imports/index.d.ts +2 -0
  13. package/dist/admin/pages/imports/mapping-csv.d.ts +10 -0
  14. package/dist/admin/pages/imports/progress.d.ts +21 -0
  15. package/dist/admin/pages/imports/records.d.ts +2 -0
  16. package/dist/admin/pages/imports/shared.d.ts +22 -0
  17. package/dist/admin/pages/parked/index.d.ts +2 -0
  18. package/dist/admin/pages/proposals/grouping.d.ts +13 -0
  19. package/dist/admin/pages/proposals/index.d.ts +2 -0
  20. package/dist/admin/pages/provider-prices/index.d.ts +2 -0
  21. package/dist/admin/pages/provider-prices/map-dialog.d.ts +11 -0
  22. package/dist/admin/routes.d.ts +1 -1
  23. package/dist/{admin-attempts-BLeeKABa.js → admin-attempts-DQTg0UzZ.js} +82 -82
  24. package/dist/{admin-attempts-BLeeKABa.js.map → admin-attempts-DQTg0UzZ.js.map} +1 -1
  25. package/dist/{admin-auth-DWVWxDup.js → admin-auth-1aZIgXiS.js} +2 -2
  26. package/dist/{admin-auth-DWVWxDup.js.map → admin-auth-1aZIgXiS.js.map} +1 -1
  27. package/dist/{admin-badge-CrEqD9Ew.js → admin-badge-pgG6D9-a.js} +2 -2
  28. package/dist/{admin-badge-CrEqD9Ew.js.map → admin-badge-pgG6D9-a.js.map} +1 -1
  29. package/dist/{admin-button-a7bDFgp0.js → admin-button-CrcYk5r0.js} +2 -2
  30. package/dist/{admin-button-a7bDFgp0.js.map → admin-button-CrcYk5r0.js.map} +1 -1
  31. package/dist/{admin-capabilities-QYUuJXvG.js → admin-capabilities-BDcZeHL_.js} +2 -2
  32. package/dist/{admin-capabilities-QYUuJXvG.js.map → admin-capabilities-BDcZeHL_.js.map} +1 -1
  33. package/dist/{admin-card-D1tz8Lbh.js → admin-card-DvTMc5Se.js} +2 -2
  34. package/dist/{admin-card-D1tz8Lbh.js.map → admin-card-DvTMc5Se.js.map} +1 -1
  35. package/dist/{admin-catalog-ggiDgWsR.js → admin-catalog-BlF5mnu4.js} +285 -382
  36. package/dist/admin-catalog-BlF5mnu4.js.map +1 -0
  37. package/dist/{admin-dom-VkcwevWr.js → admin-cursor-pager-CIb3Jw2F.js} +20 -25
  38. package/dist/admin-cursor-pager-CIb3Jw2F.js.map +1 -0
  39. package/dist/{admin-customers-BVMg-gUv.js → admin-customers-EpfoWDh-.js} +13 -13
  40. package/dist/{admin-customers-BVMg-gUv.js.map → admin-customers-EpfoWDh-.js.map} +1 -1
  41. package/dist/{admin-dashboard-Cc13i8i9.js → admin-dashboard-CJE63yz4.js} +46 -46
  42. package/dist/{admin-dashboard-Cc13i8i9.js.map → admin-dashboard-CJE63yz4.js.map} +1 -1
  43. package/dist/{admin-data-table-BL84xKKF.js → admin-data-table-hvFcJepL.js} +16 -16
  44. package/dist/{admin-data-table-BL84xKKF.js.map → admin-data-table-hvFcJepL.js.map} +1 -1
  45. package/dist/{admin-detail-CaEwBdX9.js → admin-detail-BRP6pL7t.js} +51 -51
  46. package/dist/{admin-detail-CaEwBdX9.js.map → admin-detail-BRP6pL7t.js.map} +1 -1
  47. package/dist/{admin-detail-9YAep3ts.js → admin-detail-CRzFb_pa.js} +232 -232
  48. package/dist/{admin-detail-9YAep3ts.js.map → admin-detail-CRzFb_pa.js.map} +1 -1
  49. package/dist/admin-detail-Ceod8AXy.js +299 -0
  50. package/dist/admin-detail-Ceod8AXy.js.map +1 -0
  51. package/dist/{admin-detail-C8t5jBps.js → admin-detail-QLxU8r-5.js} +62 -62
  52. package/dist/{admin-detail-C8t5jBps.js.map → admin-detail-QLxU8r-5.js.map} +1 -1
  53. package/dist/admin-detail-pPC8Q9l-.js +710 -0
  54. package/dist/{admin-detail-D2zcz_Xm.js.map → admin-detail-pPC8Q9l-.js.map} +1 -1
  55. package/dist/{admin-dialog-CiAw5vx-.js → admin-dialog-BSRf9Zre.js} +24 -24
  56. package/dist/{admin-dialog-CiAw5vx-.js.map → admin-dialog-BSRf9Zre.js.map} +1 -1
  57. package/dist/admin-dom-C7Y7A6Wa.js +8 -0
  58. package/dist/admin-dom-C7Y7A6Wa.js.map +1 -0
  59. package/dist/{admin-dropdown-menu-CYJbmqK2.js → admin-dropdown-menu-D0E5rwmn.js} +2 -2
  60. package/dist/{admin-dropdown-menu-CYJbmqK2.js.map → admin-dropdown-menu-D0E5rwmn.js.map} +1 -1
  61. package/dist/{admin-fact-card-BHTpDlaX.js → admin-fact-card-BPSVhS15.js} +2 -2
  62. package/dist/{admin-fact-card-BHTpDlaX.js.map → admin-fact-card-BPSVhS15.js.map} +1 -1
  63. package/dist/{admin-health-BUnjbvYR.js → admin-health-D0L5Kig7.js} +84 -84
  64. package/dist/{admin-health-BUnjbvYR.js.map → admin-health-D0L5Kig7.js.map} +1 -1
  65. package/dist/admin-imports-TCOljTgw.js +269 -0
  66. package/dist/admin-imports-TCOljTgw.js.map +1 -0
  67. package/dist/{admin-input-C-S_RGGo.js → admin-input-DJAK9nmk.js} +2 -2
  68. package/dist/{admin-input-C-S_RGGo.js.map → admin-input-DJAK9nmk.js.map} +1 -1
  69. package/dist/{admin-label-DPVYDdSO.js → admin-label-aviN9Gng.js} +2 -2
  70. package/dist/{admin-label-DPVYDdSO.js.map → admin-label-aviN9Gng.js.map} +1 -1
  71. package/dist/{admin-linked-table-row-D-gbTT7a.js → admin-linked-table-row-BGr7JXeM.js} +6 -6
  72. package/dist/{admin-linked-table-row-D-gbTT7a.js.map → admin-linked-table-row-BGr7JXeM.js.map} +1 -1
  73. package/dist/admin-map-dialog-DpGaIq52.js +135 -0
  74. package/dist/admin-map-dialog-DpGaIq52.js.map +1 -0
  75. package/dist/admin-mapping-csv-FtkyTBmk.js +56 -0
  76. package/dist/admin-mapping-csv-FtkyTBmk.js.map +1 -0
  77. package/dist/{admin-metering-BjbL0jjT.js → admin-metering-D-e-37Jn.js} +285 -285
  78. package/dist/{admin-metering-BjbL0jjT.js.map → admin-metering-D-e-37Jn.js.map} +1 -1
  79. package/dist/admin-ops-CQP4TzWM.js +235 -0
  80. package/dist/admin-ops-CQP4TzWM.js.map +1 -0
  81. package/dist/{admin-orders-BVW9-Fs9.js → admin-orders-BJ7W5S8P.js} +32 -32
  82. package/dist/{admin-orders-BVW9-Fs9.js.map → admin-orders-BJ7W5S8P.js.map} +1 -1
  83. package/dist/admin-parked-7HL8mOjw.js +193 -0
  84. package/dist/admin-parked-7HL8mOjw.js.map +1 -0
  85. package/dist/{admin-payments-C5MsFFmm.js → admin-payments-CzkzqYA1.js} +17 -17
  86. package/dist/{admin-payments-C5MsFFmm.js.map → admin-payments-CzkzqYA1.js.map} +1 -1
  87. package/dist/{admin-price-detail-D517JYHB.js → admin-price-detail-CSI5oKdb.js} +74 -74
  88. package/dist/{admin-price-detail-D517JYHB.js.map → admin-price-detail-CSI5oKdb.js.map} +1 -1
  89. package/dist/{admin-price-wizard-bj36o3ux.js → admin-price-wizard-CBEcNGvP.js} +38 -38
  90. package/dist/{admin-price-wizard-bj36o3ux.js.map → admin-price-wizard-CBEcNGvP.js.map} +1 -1
  91. package/dist/admin-proposals-dtgijWKz.js +375 -0
  92. package/dist/admin-proposals-dtgijWKz.js.map +1 -0
  93. package/dist/admin-provider-prices-ChuponcZ.js +246 -0
  94. package/dist/admin-provider-prices-ChuponcZ.js.map +1 -0
  95. package/dist/{admin-range-picker-D2aFF8IV.js → admin-range-picker-De36L-AP.js} +12 -12
  96. package/dist/{admin-range-picker-D2aFF8IV.js.map → admin-range-picker-De36L-AP.js.map} +1 -1
  97. package/dist/admin-records-CUHUOXAU.js +391 -0
  98. package/dist/admin-records-CUHUOXAU.js.map +1 -0
  99. package/dist/{admin-reports-D-ob04d4.js → admin-reports-BFGS_PWf.js} +45 -45
  100. package/dist/{admin-reports-D-ob04d4.js.map → admin-reports-BFGS_PWf.js.map} +1 -1
  101. package/dist/{admin-select-C8O7nx72.js → admin-select-BUcEU5Rg.js} +2 -2
  102. package/dist/{admin-select-C8O7nx72.js.map → admin-select-BUcEU5Rg.js.map} +1 -1
  103. package/dist/{admin-settings-Bs6cLcqi.js → admin-settings-DYC-c7mJ.js} +296 -296
  104. package/dist/{admin-settings-Bs6cLcqi.js.map → admin-settings-DYC-c7mJ.js.map} +1 -1
  105. package/dist/admin-shared-CzG8Pan3.js +222 -0
  106. package/dist/admin-shared-CzG8Pan3.js.map +1 -0
  107. package/dist/{admin-skeleton-wfocg2PJ.js → admin-skeleton-B0yzYY_X.js} +2 -2
  108. package/dist/{admin-skeleton-wfocg2PJ.js.map → admin-skeleton-B0yzYY_X.js.map} +1 -1
  109. package/dist/{admin-status-badge-D_gDMrht.js → admin-status-badge-0-K37EfN.js} +7 -2
  110. package/dist/admin-status-badge-0-K37EfN.js.map +1 -0
  111. package/dist/{admin-subscriptions-DYR1RGMO.js → admin-subscriptions-CvW-YFs0.js} +74 -74
  112. package/dist/{admin-subscriptions-DYR1RGMO.js.map → admin-subscriptions-CvW-YFs0.js.map} +1 -1
  113. package/dist/{admin-switch-F5D0AYjT.js → admin-switch-DDorugaw.js} +2 -2
  114. package/dist/{admin-switch-F5D0AYjT.js.map → admin-switch-DDorugaw.js.map} +1 -1
  115. package/dist/{admin-table-nUij5fLc.js → admin-table-BU6Tie69.js} +2 -2
  116. package/dist/{admin-table-nUij5fLc.js.map → admin-table-BU6Tie69.js.map} +1 -1
  117. package/dist/{admin-tabs-C3myjKdr.js → admin-tabs-D5lqdVcC.js} +2 -2
  118. package/dist/{admin-tabs-C3myjKdr.js.map → admin-tabs-D5lqdVcC.js.map} +1 -1
  119. package/dist/{admin-textarea-v-L-PXIc.js → admin-textarea-Dc6lnEub.js} +2 -2
  120. package/dist/{admin-textarea-v-L-PXIc.js.map → admin-textarea-Dc6lnEub.js.map} +1 -1
  121. package/dist/{admin-typed-confirm-dialog-BLgpuikW.js → admin-typed-confirm-dialog-Bk6XxmPb.js} +6 -6
  122. package/dist/{admin-typed-confirm-dialog-BLgpuikW.js.map → admin-typed-confirm-dialog-Bk6XxmPb.js.map} +1 -1
  123. package/dist/{admin-utils-6yE4YIVI.js → admin-utils-B9eEBNsR.js} +398 -146
  124. package/dist/admin-utils-B9eEBNsR.js.map +1 -0
  125. package/dist/{admin-widget-viz-BiEfckd4.js → admin-widget-viz-8aukE3v_.js} +34 -34
  126. package/dist/{admin-widget-viz-BiEfckd4.js.map → admin-widget-viz-8aukE3v_.js.map} +1 -1
  127. package/dist/admin.css +1 -1
  128. package/dist/admin.js +489 -264
  129. package/dist/admin.js.map +1 -1
  130. package/dist/client/generated/error-codes.d.ts +1 -1
  131. package/dist/client/generated/routes.d.ts +94 -22
  132. package/dist/client/generated/wire.d.ts +89 -14
  133. package/dist/index.js +1 -1
  134. package/dist/styles.css +1 -1
  135. package/package.json +2 -2
  136. package/dist/admin-catalog-ggiDgWsR.js.map +0 -1
  137. package/dist/admin-detail-D2zcz_Xm.js +0 -710
  138. package/dist/admin-dom-VkcwevWr.js.map +0 -1
  139. package/dist/admin-ops-DT8epiXg.js +0 -217
  140. package/dist/admin-ops-DT8epiXg.js.map +0 -1
  141. package/dist/admin-status-badge-D_gDMrht.js.map +0 -1
  142. package/dist/admin-utils-6yE4YIVI.js.map +0 -1
@@ -0,0 +1,299 @@
1
+ import { D as e, T as t, c as n, m as r, p as i, r as a } from "./admin-utils-B9eEBNsR.js";
2
+ import { t as o } from "./admin-button-CrcYk5r0.js";
3
+ import { d as s, l as c } from "./admin-capabilities-BDcZeHL_.js";
4
+ import { o as l, u } from "./admin-format-DoohJ7Fg.js";
5
+ import { a as d, n as f, o as p, r as m, s as h, t as g } from "./admin-table-BU6Tie69.js";
6
+ import { t as _ } from "./admin-badge-pgG6D9-a.js";
7
+ import { t as v } from "./admin-status-badge-0-K37EfN.js";
8
+ import { a as y, o as b, r as x, t as S } from "./admin-card-DvTMc5Se.js";
9
+ import { t as C } from "./admin-typed-confirm-dialog-Bk6XxmPb.js";
10
+ import { a as w, c as T, d as E, l as D, r as O, s as k, t as A, u as j } from "./admin-shared-CzG8Pan3.js";
11
+ import { n as M, r as N } from "./admin-map-dialog-DpGaIq52.js";
12
+ import * as P from "react";
13
+ import { useMutation as F, useQuery as I, useQueryClient as L } from "@tanstack/react-query";
14
+ import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
15
+ //#region src/admin/pages/imports/detail.tsx
16
+ var V = [
17
+ "customer",
18
+ "subscription",
19
+ "transaction"
20
+ ], H = [
21
+ "unmatched",
22
+ "conflict",
23
+ "linked",
24
+ "blocked",
25
+ "held",
26
+ "imported"
27
+ ];
28
+ function U() {
29
+ return c() ? /* @__PURE__ */ z(W, {}) : null;
30
+ }
31
+ function W() {
32
+ let { text: r } = e(), { id: o = "" } = n(), { importQueries: s } = i(), c = T(), { data: u, error: C } = I(s.detail(o)), k = D(u);
33
+ if (C) return /* @__PURE__ */ z("p", {
34
+ role: "alert",
35
+ className: "text-destructive",
36
+ children: C.message
37
+ });
38
+ if (!u) return /* @__PURE__ */ z("p", {
39
+ role: "status",
40
+ children: /* @__PURE__ */ z(t, { id: "Loading…" })
41
+ });
42
+ let A = c.byId.get(u.psp);
43
+ return /* @__PURE__ */ B("div", {
44
+ className: "flex flex-col gap-5",
45
+ children: [
46
+ /* @__PURE__ */ B("div", {
47
+ className: "flex flex-wrap items-start justify-between gap-3",
48
+ children: [/* @__PURE__ */ B("div", {
49
+ className: "flex flex-col gap-1",
50
+ children: [/* @__PURE__ */ B("h1", {
51
+ className: "flex items-center gap-2 text-xl font-semibold",
52
+ children: [
53
+ r("Import of "),
54
+ A?.key ?? u.psp,
55
+ /* @__PURE__ */ z(_, {
56
+ variant: "secondary",
57
+ children: u.origin
58
+ }),
59
+ /* @__PURE__ */ z(v, { status: u.status })
60
+ ]
61
+ }), /* @__PURE__ */ B("p", {
62
+ className: "text-sm text-muted-foreground",
63
+ children: [
64
+ r("Started "),
65
+ l(u.created_at),
66
+ u.applied_at && /* @__PURE__ */ B(R, { children: [r(" · applied "), l(u.applied_at)] })
67
+ ]
68
+ })]
69
+ }), /* @__PURE__ */ z(J, {
70
+ imp: u,
71
+ psp: A,
72
+ superseded: !!k
73
+ })]
74
+ }),
75
+ k && /* @__PURE__ */ z(O, { by: k }),
76
+ /* @__PURE__ */ z(G, { imp: u }),
77
+ /* @__PURE__ */ B(S, { children: [/* @__PURE__ */ z(y, { children: /* @__PURE__ */ z(b, {
78
+ className: "text-base",
79
+ children: /* @__PURE__ */ z(t, { id: "Records" })
80
+ }) }), /* @__PURE__ */ B(x, {
81
+ className: "overflow-x-auto",
82
+ children: [/* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(p, { children: /* @__PURE__ */ B(h, {
83
+ className: "hover:bg-transparent",
84
+ children: [/* @__PURE__ */ z(d, {}), H.map((e) => /* @__PURE__ */ z(d, {
85
+ className: "text-muted-foreground",
86
+ children: r(e)
87
+ }, e))]
88
+ }) }), /* @__PURE__ */ z(f, { children: V.map((e) => /* @__PURE__ */ B(h, {
89
+ "data-kind": e,
90
+ children: [/* @__PURE__ */ z(m, {
91
+ className: "font-medium",
92
+ children: r(e)
93
+ }), H.map((t) => {
94
+ let n = E(u, t, e);
95
+ return /* @__PURE__ */ z(m, {
96
+ "data-state": t,
97
+ children: n ? /* @__PURE__ */ z(a, {
98
+ className: "underline",
99
+ to: `/ops/imports/${u.id}/records?state=${t}&kind=${e}`,
100
+ children: n
101
+ }) : "0"
102
+ }, t);
103
+ })]
104
+ }, e)) })] }), /* @__PURE__ */ z(a, {
105
+ className: "mt-3 inline-block text-sm underline",
106
+ to: `/ops/imports/${u.id}/records`,
107
+ children: /* @__PURE__ */ z(t, { id: "Review records" })
108
+ })]
109
+ })] }),
110
+ /* @__PURE__ */ z(K, { imp: u }),
111
+ A && /* @__PURE__ */ z(q, {
112
+ imp: u,
113
+ psp: A
114
+ }),
115
+ /* @__PURE__ */ B(S, { children: [/* @__PURE__ */ z(y, { children: /* @__PURE__ */ z(b, {
116
+ className: "text-base",
117
+ children: /* @__PURE__ */ z(t, { id: "Linking rules" })
118
+ }) }), /* @__PURE__ */ B(x, { children: [/* @__PURE__ */ z("ol", {
119
+ className: "list-decimal pl-5 text-sm",
120
+ children: u.rules.map((e, t) => /* @__PURE__ */ z("li", { children: w(e) }, t))
121
+ }), /* @__PURE__ */ z("p", {
122
+ className: "mt-2 text-xs text-muted-foreground",
123
+ children: /* @__PURE__ */ z(t, { id: "A manual link wins over every rule." })
124
+ })] })] })
125
+ ]
126
+ });
127
+ }
128
+ function G({ imp: e }) {
129
+ let n = j(e);
130
+ return e.status === "failed" ? /* @__PURE__ */ B("div", {
131
+ role: "alert",
132
+ className: "rounded-md border border-destructive/40 p-3 text-sm",
133
+ children: [
134
+ /* @__PURE__ */ B("p", {
135
+ className: "font-medium text-destructive",
136
+ children: [
137
+ e.error_code ?? "failed",
138
+ ": ",
139
+ e.error
140
+ ]
141
+ }),
142
+ e.error_code === "psp_credentials_rejected" && /* @__PURE__ */ B("p", {
143
+ className: "mt-1",
144
+ children: [
145
+ /* @__PURE__ */ z(t, { id: "The provider refused this PSP's credentials. A new pull starts when they change in " }),
146
+ /* @__PURE__ */ z(a, {
147
+ className: "underline",
148
+ to: "/settings?tab=psps",
149
+ children: /* @__PURE__ */ z(t, { id: "Settings › PSPs" })
150
+ }),
151
+ "."
152
+ ]
153
+ }),
154
+ e.error_code === "pull_roster_implausible" && /* @__PURE__ */ z("p", {
155
+ className: "mt-1",
156
+ children: /* @__PURE__ */ z(t, { id: "The provider listed far fewer live subscriptions than OpenRails holds, so nothing was proposed. Check the PSP's account and reconcile again." })
157
+ }),
158
+ e.error_code === "psp_not_readable" && /* @__PURE__ */ z("p", {
159
+ className: "mt-1",
160
+ children: /* @__PURE__ */ z(t, { id: "This PSP cannot be read: it is gone, or a credential the pull needs is not declared." })
161
+ })
162
+ ]
163
+ }) : /* @__PURE__ */ B("div", {
164
+ className: "flex flex-col gap-1",
165
+ "data-testid": "import-progress",
166
+ children: [/* @__PURE__ */ z("p", {
167
+ className: "text-sm",
168
+ children: /* @__PURE__ */ z(A, { imp: e })
169
+ }), n.phase === "history" && n.percent !== void 0 && /* @__PURE__ */ z("div", {
170
+ className: "h-1.5 w-full max-w-md rounded bg-muted",
171
+ children: /* @__PURE__ */ z("div", {
172
+ className: "h-1.5 rounded bg-primary",
173
+ style: { width: `${n.percent}%` }
174
+ })
175
+ })]
176
+ });
177
+ }
178
+ function K({ imp: t }) {
179
+ let { text: n } = e(), r = t.proposals;
180
+ return !r.open && !r.approved && !r.dismissed && !r.superseded ? null : /* @__PURE__ */ B("p", {
181
+ className: "text-sm",
182
+ "data-testid": "import-proposals",
183
+ children: [/* @__PURE__ */ B(a, {
184
+ className: "underline",
185
+ to: `/ops/proposals?pull_id=${t.id}`,
186
+ children: [r.open, n(" open proposals")]
187
+ }), ` (${r.corrections}${n(" corrections Apply approves")}) · ${r.approved}${n(" approved")} · ${r.dismissed}${n(" dismissed")} · ${r.superseded}${n(" superseded")}`]
188
+ });
189
+ }
190
+ function q({ imp: n, psp: r }) {
191
+ let { text: o } = e(), { importQueries: c } = i(), l = s(), [_, v] = P.useState(), C = r.rail === "nmi" || r.rail === "stripe", { data: w } = I({
192
+ ...c.providerCatalog({
193
+ psp: r.id,
194
+ kind: "price",
195
+ import: n.id
196
+ }, 500),
197
+ enabled: C && !!n.pulled_at
198
+ });
199
+ return C ? /* @__PURE__ */ B(S, { children: [
200
+ /* @__PURE__ */ z(y, { children: /* @__PURE__ */ z(b, {
201
+ className: "text-base",
202
+ children: /* @__PURE__ */ z(t, { id: "Plans its subscriptions name" })
203
+ }) }),
204
+ /* @__PURE__ */ z(x, {
205
+ className: "overflow-x-auto",
206
+ children: w?.data.length ? /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(p, { children: /* @__PURE__ */ z(h, {
207
+ className: "hover:bg-transparent",
208
+ children: [
209
+ "Plan",
210
+ "Name",
211
+ "Terms",
212
+ "Subscriptions",
213
+ "Mapped to",
214
+ ""
215
+ ].map((e, t) => /* @__PURE__ */ z(d, {
216
+ className: "text-muted-foreground",
217
+ children: e && o(e)
218
+ }, t))
219
+ }) }), /* @__PURE__ */ z(f, { children: w.data.map((e) => /* @__PURE__ */ B(h, {
220
+ "data-ref": e.ref,
221
+ children: [
222
+ /* @__PURE__ */ z(m, {
223
+ className: "font-mono text-xs",
224
+ children: e.ref
225
+ }),
226
+ /* @__PURE__ */ z(m, { children: e.name ?? "—" }),
227
+ /* @__PURE__ */ z(m, { children: k(e.terms, r.rail) }),
228
+ /* @__PURE__ */ z(m, { children: e.subscriptions ?? "—" }),
229
+ /* @__PURE__ */ z(m, { children: e.price ? /* @__PURE__ */ z(a, {
230
+ className: "underline",
231
+ to: `/catalog/prices/${e.price}`,
232
+ children: u(e.price, 14)
233
+ }) : /* @__PURE__ */ z(t, { id: "Unmapped" }) }),
234
+ /* @__PURE__ */ z(m, {
235
+ className: "text-right",
236
+ children: l && !e.price && /* @__PURE__ */ z(M, { onClick: () => v(e.ref) })
237
+ })
238
+ ]
239
+ }, e.ref)) })] }) : /* @__PURE__ */ z("p", {
240
+ className: "text-sm text-muted-foreground",
241
+ children: /* @__PURE__ */ z(t, { id: "No staged subscription names a plan." })
242
+ })
243
+ }),
244
+ _ && /* @__PURE__ */ z(N, {
245
+ psp: r,
246
+ priceRef: _,
247
+ onClose: () => v(void 0)
248
+ })
249
+ ] }) : null;
250
+ }
251
+ function J({ imp: n, psp: a, superseded: c }) {
252
+ let { text: l } = e(), { importMutations: u, toast: d, toastApiError: f } = i(), p = L(), m = s(), h = F(u.link(p)), g = F(u.apply(p)), [_, v] = P.useState(!1);
253
+ if (!m) return null;
254
+ let y = !c && (n.status === "pulled" || n.status === "applied"), b = n.status === "applied", x = a?.key ?? n.psp;
255
+ return /* @__PURE__ */ B("div", {
256
+ className: "flex gap-2",
257
+ children: [
258
+ /* @__PURE__ */ z(o, {
259
+ variant: "outline",
260
+ disabled: !y || h.isPending || r(n.status),
261
+ onClick: async () => {
262
+ try {
263
+ await h.mutateAsync({
264
+ id: n.id,
265
+ params: {}
266
+ }), d.success(l("Re-link requested"));
267
+ } catch (e) {
268
+ f(e, l("Re-link"));
269
+ }
270
+ },
271
+ children: /* @__PURE__ */ z(t, { id: "Re-link" })
272
+ }),
273
+ /* @__PURE__ */ z(o, {
274
+ disabled: !y || g.isPending,
275
+ onClick: () => v(!0),
276
+ children: l(b ? "Apply again" : "Apply")
277
+ }),
278
+ /* @__PURE__ */ z(C, {
279
+ open: _,
280
+ onOpenChange: v,
281
+ title: l(b ? "Apply again" : "Apply import"),
282
+ description: `${l("Lands the linked records as billing. ")}${E(n, "linked")}${l(" linked; ")}${E(n, "blocked")}${l(" blocked and ")}${E(n, "unmatched") + E(n, "conflict")}${l(" unmatched or conflicting stay staged.")}`,
283
+ confirmationWord: x,
284
+ actionLabel: l(b ? "Apply again" : "Apply"),
285
+ onConfirm: async () => {
286
+ try {
287
+ await g.mutateAsync(n.id), d.success(l("Apply queued"));
288
+ } catch (e) {
289
+ f(e, l("Apply import"));
290
+ }
291
+ }
292
+ })
293
+ ]
294
+ });
295
+ }
296
+ //#endregion
297
+ export { U as ImportDetailPage };
298
+
299
+ //# sourceMappingURL=admin-detail-Ceod8AXy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-detail-Ceod8AXy.js","names":[],"sources":["../src/admin/pages/imports/detail.tsx"],"sourcesContent":["import { AdminMessage, useAdminUI } from \"#orck/admin/ui-context\"\nimport { useAdminServices } from \"#orck/admin/context\"\nimport * as React from \"react\"\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\"\nimport { Link, useParams } from \"#orck/admin/router\"\n\nimport { StatusBadge } from \"#orck/admin/components/status-badge\"\nimport { TypedConfirmDialog } from \"#orck/admin/components/typed-confirm-dialog\"\nimport { Badge } from \"#orck/admin/components/ui/badge\"\nimport { Button } from \"#orck/admin/components/ui/button\"\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from \"#orck/admin/components/ui/card\"\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"#orck/admin/components/ui/table\"\nimport {\n useMerchantConfig,\n useMerchantConfigUpdates,\n} from \"#orck/admin/lib/capabilities\"\nimport { importBusy } from \"#orck/admin/lib/import-queries\"\nimport { formatDate, shortId } from \"#orck/admin/lib/format\"\nimport type { PSP, PSPImport } from \"#orck/client/generated/wire\"\nimport {\n MapButton,\n MapPriceDialog,\n} from \"#orck/admin/pages/provider-prices/map-dialog\"\nimport { importProgress, recordCount } from \"./progress\"\nimport {\n ProgressText,\n Superseded,\n ruleText,\n termsText,\n usePSPs,\n useSuccessor,\n} from \"./shared\"\n\nconst KINDS = [\"customer\", \"subscription\", \"transaction\"] as const\nconst STATES = [\n \"unmatched\",\n \"conflict\",\n \"linked\",\n \"blocked\",\n \"held\",\n \"imported\",\n] as const\n\nexport function ImportDetailPage() {\n return useMerchantConfig() ? <ImportDetail /> : null\n}\n\nfunction ImportDetail() {\n const { text } = useAdminUI()\n const { id = \"\" } = useParams<\"id\">()\n const { importQueries } = useAdminServices()\n const psps = usePSPs()\n const { data: imp, error } = useQuery(importQueries.detail(id))\n const newer = useSuccessor(imp)\n if (error)\n return (\n <p role=\"alert\" className=\"text-destructive\">\n {error.message}\n </p>\n )\n if (!imp)\n return (\n <p role=\"status\">\n <AdminMessage id=\"Loading…\" />\n </p>\n )\n const psp = psps.byId.get(imp.psp)\n return (\n <div className=\"flex flex-col gap-5\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"flex flex-col gap-1\">\n <h1 className=\"flex items-center gap-2 text-xl font-semibold\">\n {text(\"Import of \")}\n {psp?.key ?? imp.psp}\n <Badge variant=\"secondary\">{imp.origin}</Badge>\n <StatusBadge status={imp.status} />\n </h1>\n <p className=\"text-sm text-muted-foreground\">\n {text(\"Started \")}\n {formatDate(imp.created_at)}\n {imp.applied_at && (\n <>\n {text(\" · applied \")}\n {formatDate(imp.applied_at)}\n </>\n )}\n </p>\n </div>\n <ImportActions imp={imp} psp={psp} superseded={Boolean(newer)} />\n </div>\n {newer && <Superseded by={newer} />}\n <Progress imp={imp} />\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n <AdminMessage id=\"Records\" />\n </CardTitle>\n </CardHeader>\n <CardContent className=\"overflow-x-auto\">\n <Table>\n <TableHeader>\n <TableRow className=\"hover:bg-transparent\">\n <TableHead />\n {STATES.map((s) => (\n <TableHead key={s} className=\"text-muted-foreground\">\n {text(s)}\n </TableHead>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {KINDS.map((kind) => (\n <TableRow key={kind} data-kind={kind}>\n <TableCell className=\"font-medium\">{text(kind)}</TableCell>\n {STATES.map((state) => {\n const n = recordCount(imp, state, kind)\n return (\n <TableCell key={state} data-state={state}>\n {n ? (\n <Link\n className=\"underline\"\n to={`/ops/imports/${imp.id}/records?state=${state}&kind=${kind}`}\n >\n {n}\n </Link>\n ) : (\n \"0\"\n )}\n </TableCell>\n )\n })}\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Link\n className=\"mt-3 inline-block text-sm underline\"\n to={`/ops/imports/${imp.id}/records`}\n >\n <AdminMessage id=\"Review records\" />\n </Link>\n </CardContent>\n </Card>\n <ProposalCounts imp={imp} />\n {psp && <Plans imp={imp} psp={psp} />}\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n <AdminMessage id=\"Linking rules\" />\n </CardTitle>\n </CardHeader>\n <CardContent>\n <ol className=\"list-decimal pl-5 text-sm\">\n {imp.rules.map((rule, i) => (\n <li key={i}>{ruleText(rule)}</li>\n ))}\n </ol>\n <p className=\"mt-2 text-xs text-muted-foreground\">\n <AdminMessage id=\"A manual link wins over every rule.\" />\n </p>\n </CardContent>\n </Card>\n </div>\n )\n}\n\nfunction Progress({ imp }: { imp: PSPImport }) {\n const p = importProgress(imp)\n if (imp.status === \"failed\")\n return (\n <div\n role=\"alert\"\n className=\"rounded-md border border-destructive/40 p-3 text-sm\"\n >\n <p className=\"font-medium text-destructive\">\n {imp.error_code ?? \"failed\"}: {imp.error}\n </p>\n {imp.error_code === \"psp_credentials_rejected\" && (\n <p className=\"mt-1\">\n <AdminMessage id=\"The provider refused this PSP's credentials. A new pull starts when they change in \" />\n <Link className=\"underline\" to=\"/settings?tab=psps\">\n <AdminMessage id=\"Settings › PSPs\" />\n </Link>\n .\n </p>\n )}\n {imp.error_code === \"pull_roster_implausible\" && (\n <p className=\"mt-1\">\n <AdminMessage id=\"The provider listed far fewer live subscriptions than OpenRails holds, so nothing was proposed. Check the PSP's account and reconcile again.\" />\n </p>\n )}\n {imp.error_code === \"psp_not_readable\" && (\n <p className=\"mt-1\">\n <AdminMessage id=\"This PSP cannot be read: it is gone, or a credential the pull needs is not declared.\" />\n </p>\n )}\n </div>\n )\n return (\n <div className=\"flex flex-col gap-1\" data-testid=\"import-progress\">\n <p className=\"text-sm\">\n <ProgressText imp={imp} />\n </p>\n {p.phase === \"history\" && p.percent !== undefined && (\n <div className=\"h-1.5 w-full max-w-md rounded bg-muted\">\n <div\n className=\"h-1.5 rounded bg-primary\"\n style={{ width: `${p.percent}%` }}\n />\n </div>\n )}\n </div>\n )\n}\n\n// ProposalCounts are the differences the pull found in what OpenRails holds:\n// Apply approves the corrections; the rest wait in the inbox.\nfunction ProposalCounts({ imp }: { imp: PSPImport }) {\n const { text } = useAdminUI()\n const p = imp.proposals\n if (!p.open && !p.approved && !p.dismissed && !p.superseded) return null\n return (\n <p className=\"text-sm\" data-testid=\"import-proposals\">\n <Link className=\"underline\" to={`/ops/proposals?pull_id=${imp.id}`}>\n {p.open}\n {text(\" open proposals\")}\n </Link>\n {` (${p.corrections}${text(\" corrections Apply approves\")}) · ${p.approved}${text(\" approved\")} · ${p.dismissed}${text(\" dismissed\")} · ${p.superseded}${text(\" superseded\")}`}\n </p>\n )\n}\n\n// Plans are the provider prices the import's subscriptions name: each must\n// map to a product before its subscriptions land.\nfunction Plans({ imp, psp }: { imp: PSPImport; psp: PSP }) {\n const { text } = useAdminUI()\n const { importQueries } = useAdminServices()\n const canUpdate = useMerchantConfigUpdates()\n const [mapping, setMapping] = React.useState<string>()\n const observed = psp.rail === \"nmi\" || psp.rail === \"stripe\"\n const { data } = useQuery({\n ...importQueries.providerCatalog(\n { psp: psp.id, kind: \"price\", import: imp.id },\n 500\n ),\n enabled: observed && Boolean(imp.pulled_at),\n })\n if (!observed) return null\n return (\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n <AdminMessage id=\"Plans its subscriptions name\" />\n </CardTitle>\n </CardHeader>\n <CardContent className=\"overflow-x-auto\">\n {!data?.data.length ? (\n <p className=\"text-sm text-muted-foreground\">\n <AdminMessage id=\"No staged subscription names a plan.\" />\n </p>\n ) : (\n <Table>\n <TableHeader>\n <TableRow className=\"hover:bg-transparent\">\n {[\n \"Plan\",\n \"Name\",\n \"Terms\",\n \"Subscriptions\",\n \"Mapped to\",\n \"\",\n ].map((h, i) => (\n <TableHead key={i} className=\"text-muted-foreground\">\n {h && text(h)}\n </TableHead>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.data.map((o) => (\n <TableRow key={o.ref} data-ref={o.ref}>\n <TableCell className=\"font-mono text-xs\">{o.ref}</TableCell>\n <TableCell>{o.name ?? \"—\"}</TableCell>\n <TableCell>{termsText(o.terms, psp.rail)}</TableCell>\n <TableCell>{o.subscriptions ?? \"—\"}</TableCell>\n <TableCell>\n {o.price ? (\n <Link\n className=\"underline\"\n to={`/catalog/prices/${o.price}`}\n >\n {shortId(o.price, 14)}\n </Link>\n ) : (\n <AdminMessage id=\"Unmapped\" />\n )}\n </TableCell>\n <TableCell className=\"text-right\">\n {canUpdate && !o.price && (\n <MapButton onClick={() => setMapping(o.ref)} />\n )}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n )}\n </CardContent>\n {mapping && (\n <MapPriceDialog\n psp={psp}\n priceRef={mapping}\n onClose={() => setMapping(undefined)}\n />\n )}\n </Card>\n )\n}\n\n// ImportActions re-links (after mappings or a mapped plan) and applies. Apply\n// lands only linked records and is refused while the import's job runs.\nfunction ImportActions({\n imp,\n psp,\n superseded,\n}: {\n imp: PSPImport\n psp?: PSP\n superseded: boolean\n}) {\n const { text } = useAdminUI()\n const { importMutations, toast, toastApiError } = useAdminServices()\n const queryClient = useQueryClient()\n const canUpdate = useMerchantConfigUpdates()\n const relink = useMutation(importMutations.link(queryClient))\n const apply = useMutation(importMutations.apply(queryClient))\n const [confirming, setConfirming] = React.useState(false)\n if (!canUpdate) return null\n const ready =\n !superseded && (imp.status === \"pulled\" || imp.status === \"applied\")\n const again = imp.status === \"applied\"\n const word = psp?.key ?? imp.psp\n return (\n <div className=\"flex gap-2\">\n <Button\n variant=\"outline\"\n disabled={!ready || relink.isPending || importBusy(imp.status)}\n onClick={async () => {\n try {\n await relink.mutateAsync({ id: imp.id, params: {} })\n toast.success(text(\"Re-link requested\"))\n } catch (err) {\n toastApiError(err, text(\"Re-link\"))\n }\n }}\n >\n <AdminMessage id=\"Re-link\" />\n </Button>\n <Button\n disabled={!ready || apply.isPending}\n onClick={() => setConfirming(true)}\n >\n {again ? text(\"Apply again\") : text(\"Apply\")}\n </Button>\n <TypedConfirmDialog\n open={confirming}\n onOpenChange={setConfirming}\n title={again ? text(\"Apply again\") : text(\"Apply import\")}\n description={`${text(\"Lands the linked records as billing. \")}${recordCount(imp, \"linked\")}${text(\" linked; \")}${recordCount(imp, \"blocked\")}${text(\" blocked and \")}${recordCount(imp, \"unmatched\") + recordCount(imp, \"conflict\")}${text(\" unmatched or conflicting stay staged.\")}`}\n confirmationWord={word}\n actionLabel={again ? text(\"Apply again\") : text(\"Apply\")}\n onConfirm={async () => {\n try {\n await apply.mutateAsync(imp.id)\n toast.success(text(\"Apply queued\"))\n } catch (err) {\n toastApiError(err, text(\"Apply import\"))\n }\n }}\n />\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6CA,IAAM,IAAQ;CAAC;CAAY;CAAgB;AAAa,GAClD,IAAS;CACb;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,IAAmB;CACjC,OAAO,EAAkB,IAAI,kBAAC,GAAD,CAAe,CAAA,IAAI;AAClD;AAEA,SAAS,IAAe;CACtB,IAAM,EAAE,YAAS,EAAW,GACtB,EAAE,QAAK,OAAO,EAAgB,GAC9B,EAAE,qBAAkB,EAAiB,GACrC,IAAO,EAAQ,GACf,EAAE,MAAM,GAAK,aAAU,EAAS,EAAc,OAAO,CAAE,CAAC,GACxD,IAAQ,EAAa,CAAG;CAC9B,IAAI,GACF,OACE,kBAAC,KAAD;EAAG,MAAK;EAAQ,WAAU;EACvB,UAAA,EAAM;CACN,CAAA;CAEP,IAAI,CAAC,GACH,OACE,kBAAC,KAAD;EAAG,MAAK;EACN,UAAA,kBAAC,GAAD,EAAc,IAAG,WAAY,CAAA;CAC5B,CAAA;CAEP,IAAM,IAAM,EAAK,KAAK,IAAI,EAAI,GAAG;CACjC,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;MAAd,UAAA;OACG,EAAK,YAAY;OACjB,GAAK,OAAO,EAAI;OACjB,kBAAC,GAAD;QAAO,SAAQ;QAAa,UAAA,EAAI;OAAc,CAAA;OAC9C,k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K,EAAK,SAAS,CAAC;KACpC;IACF;IAEA,UAAA,kBAAC,GAAD,EAAc,IAAG,UAAW,CAAA;GACtB,CAAA;GACR,kBAAC,GAAD;IACE,UAAU,CAAC,KAAS,EAAM;IAC1B,eAAe,EAAc,EAAI;IAEhC,UAAQ,EAAR,IAAa,gBAAsB,OAAO;GACrC,CAAA;GACR,kBAAC,GAAD;IACE,MAAM;IACN,cAAc;IACd,OAAe,EAAR,IAAa,gBAAsB,cAAc;IACxD,aAAa,GAAG,EAAK,uCAAuC,IAAI,EAAY,GAAK,QAAQ,IAAI,EAAK,WAAW,IAAI,EAAY,GAAK,SAAS,IAAI,EAAK,eAAe,IAAI,EAAY,GAAK,WAAW,IAAI,EAAY,GAAK,UAAU,IAAI,EAAK,wCAAwC;IACnR,kBAAkB;IAClB,aAAqB,EAAR,IAAa,gBAAsB,OAAO;IACvD,WAAW,YAAY;KACrB,IAAI;MAEF,AADA,MAAM,EAAM,YAAY,EAAI,EAAE,GAC9B,EAAM,QAAQ,EAAK,cAAc,CAAC;KACpC,SAAS,GAAK;MACZ,EAAc,GAAK,EAAK,cAAc,CAAC;KACzC;IACF;GACD,CAAA;EACE;;AAET"}
@@ -1,15 +1,15 @@
1
- import { E as e, c as t, p as n, r, w as i } from "./admin-utils-6yE4YIVI.js";
2
- import { t as a } from "./admin-button-a7bDFgp0.js";
3
- import { t as o } from "./admin-input-C-S_RGGo.js";
4
- import { a as s } from "./admin-capabilities-QYUuJXvG.js";
1
+ import { D as e, T as t, c as n, p as r, r as i } from "./admin-utils-B9eEBNsR.js";
2
+ import { t as a } from "./admin-button-CrcYk5r0.js";
3
+ import { t as o } from "./admin-input-DJAK9nmk.js";
4
+ import { a as s } from "./admin-capabilities-BDcZeHL_.js";
5
5
  import { n as c, o as l, s as u, t as d, u as f } from "./admin-format-DoohJ7Fg.js";
6
- import { n as p, r as m } from "./admin-dom-VkcwevWr.js";
7
- import { t as h } from "./admin-status-badge-D_gDMrht.js";
8
- import { a as g, i as _, n as v, o as y, r as b, t as x } from "./admin-dialog-CiAw5vx-.js";
9
- import { t as S } from "./admin-label-DPVYDdSO.js";
10
- import { a as C, o as w, r as T, t as E } from "./admin-card-D1tz8Lbh.js";
6
+ import { n as p, t as m } from "./admin-cursor-pager-CIb3Jw2F.js";
7
+ import { t as h } from "./admin-status-badge-0-K37EfN.js";
8
+ import { a as g, i as _, n as v, o as y, r as b, t as x } from "./admin-dialog-BSRf9Zre.js";
9
+ import { t as S } from "./admin-label-aviN9Gng.js";
10
+ import { a as C, o as w, r as T, t as E } from "./admin-card-DvTMc5Se.js";
11
11
  import { r as D } from "./admin-invoice-profile-model-Cgjy3zV8.js";
12
- import { t as O } from "./admin-data-table-BL84xKKF.js";
12
+ import { t as O } from "./admin-data-table-hvFcJepL.js";
13
13
  import { useState as k } from "react";
14
14
  import { useMutation as A, useQuery as j, useQueryClient as M } from "@tanstack/react-query";
15
15
  import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
@@ -70,22 +70,22 @@ var V = [
70
70
  }
71
71
  ];
72
72
  function H() {
73
- let { orderQueries: e } = n(), { id: r = "" } = t(), { data: a, isPending: o, error: s } = j(e.detail(r));
74
- return o ? /* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(i, { id: "Loading order…" }) }) : s ? /* @__PURE__ */ P("p", {
73
+ let { orderQueries: e } = r(), { id: i = "" } = n(), { data: a, isPending: o, error: s } = j(e.detail(i));
74
+ return o ? /* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(t, { id: "Loading order…" }) }) : s ? /* @__PURE__ */ P("p", {
75
75
  role: "alert",
76
76
  className: "text-destructive",
77
77
  children: s.message
78
- }) : a ? /* @__PURE__ */ P(U, { order: a }, a.id) : /* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(i, { id: "Order not found." }) });
78
+ }) : a ? /* @__PURE__ */ P(U, { order: a }, a.id) : /* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(t, { id: "Order not found." }) });
79
79
  }
80
80
  function U({ order: e }) {
81
- let { orderQueries: t } = n(), a = m(e.id, 25), o = j(t.payments(e.id, a.size, a.cursor)), s = e.payment.last_payment_error;
81
+ let { orderQueries: n } = r(), a = p(e.id, 25), o = j(n.payments(e.id, a.size, a.cursor)), s = e.payment.last_payment_error;
82
82
  return /* @__PURE__ */ F("div", {
83
83
  className: "flex flex-col gap-5",
84
84
  children: [
85
- /* @__PURE__ */ P(r, {
85
+ /* @__PURE__ */ P(i, {
86
86
  to: "/orders",
87
87
  className: "text-sm underline",
88
- children: /* @__PURE__ */ P(i, { id: "← Orders" })
88
+ children: /* @__PURE__ */ P(t, { id: "← Orders" })
89
89
  }),
90
90
  /* @__PURE__ */ F("div", {
91
91
  className: "flex flex-wrap items-center gap-3",
@@ -101,9 +101,9 @@ function U({ order: e }) {
101
101
  /* @__PURE__ */ F("p", {
102
102
  className: "text-sm",
103
103
  children: [
104
- /* @__PURE__ */ P(i, { id: "Customer" }),
104
+ /* @__PURE__ */ P(t, { id: "Customer" }),
105
105
  " ",
106
- /* @__PURE__ */ P(r, {
106
+ /* @__PURE__ */ P(i, {
107
107
  className: "underline",
108
108
  to: `/customers/${e.customer_id}`,
109
109
  children: e.customer_id
@@ -123,38 +123,38 @@ function U({ order: e }) {
123
123
  })] }, String(t)))
124
124
  }),
125
125
  e.usage && /* @__PURE__ */ P(W, { usage: e.usage }),
126
- e.renewal && /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(i, { id: "Renewal" }) }) }), /* @__PURE__ */ F(T, {
126
+ e.renewal && /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(t, { id: "Renewal" }) }) }), /* @__PURE__ */ F(T, {
127
127
  className: "grid gap-3 text-sm md:grid-cols-2",
128
128
  children: [
129
129
  /* @__PURE__ */ F("p", { children: [
130
- /* @__PURE__ */ P(i, { id: "Subscription:" }),
130
+ /* @__PURE__ */ P(t, { id: "Subscription:" }),
131
131
  " ",
132
- /* @__PURE__ */ P(r, {
132
+ /* @__PURE__ */ P(i, {
133
133
  className: "underline",
134
134
  to: `/subscriptions/${e.renewal.subscription_id}`,
135
135
  children: f(e.renewal.subscription_id)
136
136
  })
137
137
  ] }),
138
138
  /* @__PURE__ */ F("p", { children: [
139
- /* @__PURE__ */ P(i, { id: "Period: " }),
139
+ /* @__PURE__ */ P(t, { id: "Period: " }),
140
140
  l(e.renewal.period_starts_at),
141
141
  " –",
142
142
  " ",
143
143
  l(e.renewal.period_ends_at)
144
144
  ] }),
145
- /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(i, { id: "Due: " }), l(e.renewal.due_at)] })
145
+ /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(t, { id: "Due: " }), l(e.renewal.due_at)] })
146
146
  ]
147
147
  })] }),
148
- /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(i, { id: "Lines" }) }) }), /* @__PURE__ */ F(T, { children: [/* @__PURE__ */ F("table", {
148
+ /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(t, { id: "Lines" }) }) }), /* @__PURE__ */ F(T, { children: [/* @__PURE__ */ F("table", {
149
149
  className: "w-full text-sm",
150
150
  children: [/* @__PURE__ */ P("thead", { children: /* @__PURE__ */ F("tr", {
151
151
  className: "text-left",
152
152
  children: [
153
- /* @__PURE__ */ P("th", { children: /* @__PURE__ */ P(i, { id: "Description" }) }),
154
- /* @__PURE__ */ P("th", { children: /* @__PURE__ */ P(i, { id: "Quantity" }) }),
153
+ /* @__PURE__ */ P("th", { children: /* @__PURE__ */ P(t, { id: "Description" }) }),
154
+ /* @__PURE__ */ P("th", { children: /* @__PURE__ */ P(t, { id: "Quantity" }) }),
155
155
  /* @__PURE__ */ P("th", {
156
156
  className: "text-right",
157
- children: /* @__PURE__ */ P(i, { id: "Amount" })
157
+ children: /* @__PURE__ */ P(t, { id: "Amount" })
158
158
  })
159
159
  ]
160
160
  }) }), /* @__PURE__ */ P("tbody", { children: e.lines.map((t) => /* @__PURE__ */ F("tr", { children: [
@@ -171,18 +171,18 @@ function U({ order: e }) {
171
171
  children: u(t.amount, e.currency)
172
172
  })
173
173
  ] }, t.id)) })]
174
- }), !e.lines.length && /* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(i, { id: "No lines." }) })] })] }),
175
- /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(i, { id: "Payment" }) }) }), /* @__PURE__ */ F(T, {
174
+ }), !e.lines.length && /* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(t, { id: "No lines." }) })] })] }),
175
+ /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(t, { id: "Payment" }) }) }), /* @__PURE__ */ F(T, {
176
176
  className: "space-y-3 text-sm",
177
177
  children: [
178
- /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(i, { id: "Status: " }), /* @__PURE__ */ P(h, { status: e.payment.status })] }),
178
+ /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(t, { id: "Status: " }), /* @__PURE__ */ P(h, { status: e.payment.status })] }),
179
179
  e.collection_owner !== "engine" && /* @__PURE__ */ P("p", { children: e.collection_owner === "nmi_schedule" ? "Collection follows the NMI schedule. Recovery is coordinated through the subscription." : "The payment provider collects this bill. Payment activity appears in the history below." }),
180
180
  e.provider_bills.map((e, t) => /* @__PURE__ */ F("p", { children: [e.reference || e.kind, e.settled_at ? ` · Settled via ${e.settlement_source} · ${l(e.settled_at)}` : " · Settlement not yet verified"] }, `${e.psp_id}:${e.kind}:${e.reference}:${t}`)),
181
- s && /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(i, { id: "Last failure: " }), s.message] }),
181
+ s && /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(t, { id: "Last failure: " }), s.message] }),
182
182
  e.usage && /* @__PURE__ */ P(G, { order: e })
183
183
  ]
184
184
  })] }),
185
- /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(i, { id: "Payment history" }) }) }), /* @__PURE__ */ P(T, { children: o.error ? /* @__PURE__ */ P("p", {
185
+ /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(t, { id: "Payment history" }) }) }), /* @__PURE__ */ P(T, { children: o.error ? /* @__PURE__ */ P("p", {
186
186
  role: "alert",
187
187
  className: "text-destructive",
188
188
  children: o.error.message
@@ -191,7 +191,7 @@ function U({ order: e }) {
191
191
  data: o.data?.data ?? [],
192
192
  loading: o.isPending,
193
193
  emptyMessage: "No payments recorded."
194
- }), /* @__PURE__ */ P(p, {
194
+ }), /* @__PURE__ */ P(m, {
195
195
  pages: a,
196
196
  rows: o.data?.data?.length ?? 0,
197
197
  nextCursor: o.data?.next_cursor,
@@ -201,32 +201,32 @@ function U({ order: e }) {
201
201
  });
202
202
  }
203
203
  function W({ usage: e }) {
204
- return /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(i, { id: "Usage billed" }) }) }), /* @__PURE__ */ F(T, {
204
+ return /* @__PURE__ */ F(E, { children: [/* @__PURE__ */ P(C, { children: /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(t, { id: "Usage billed" }) }) }), /* @__PURE__ */ F(T, {
205
205
  className: "grid gap-3 text-sm md:grid-cols-2",
206
206
  children: [
207
207
  /* @__PURE__ */ F("p", { children: [
208
- /* @__PURE__ */ P(i, { id: "Period: " }),
208
+ /* @__PURE__ */ P(t, { id: "Period: " }),
209
209
  l(e.period_starts_at),
210
210
  " –",
211
211
  " ",
212
212
  l(e.period_ends_at)
213
213
  ] }),
214
- /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(i, { id: "Due: " }), l(e.due_at)] }),
214
+ /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(t, { id: "Due: " }), l(e.due_at)] }),
215
215
  /* @__PURE__ */ F("p", { children: [
216
- /* @__PURE__ */ P(i, { id: "Collection:" }),
216
+ /* @__PURE__ */ P(t, { id: "Collection:" }),
217
217
  " ",
218
218
  e.collection_method === "send_invoice" ? "Manual remittance" : "Saved payment method"
219
219
  ] }),
220
- /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(i, { id: "Next attempt: " }), l(e.next_collection_attempt_at)] }),
221
- /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(i, { id: "Purchase order: " }), e.po_number ?? "—"] }),
222
- /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(i, { id: "Memo: " }), e.memo ?? "—"] }),
220
+ /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(t, { id: "Next attempt: " }), l(e.next_collection_attempt_at)] }),
221
+ /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(t, { id: "Purchase order: " }), e.po_number ?? "—"] }),
222
+ /* @__PURE__ */ F("p", { children: [/* @__PURE__ */ P(t, { id: "Memo: " }), e.memo ?? "—"] }),
223
223
  /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
224
224
  className: "font-medium",
225
- children: /* @__PURE__ */ P(i, { id: "Billing contacts" })
225
+ children: /* @__PURE__ */ P(t, { id: "Billing contacts" })
226
226
  }), e.billing_contacts.length ? e.billing_contacts.map((e, t) => /* @__PURE__ */ F("p", { children: [e.name ? `${e.name} · ` : "", e.email] }, t)) : /* @__PURE__ */ P("p", { children: "—" })] }),
227
227
  /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
228
228
  className: "font-medium",
229
- children: /* @__PURE__ */ P(i, { id: "Tax details" })
229
+ children: /* @__PURE__ */ P(t, { id: "Tax details" })
230
230
  }), Object.entries(e.tax ?? {}).map(([e, t]) => /* @__PURE__ */ F("p", { children: [
231
231
  e,
232
232
  ": ",
@@ -234,13 +234,13 @@ function W({ usage: e }) {
234
234
  ] }, e))] }),
235
235
  /* @__PURE__ */ P("p", {
236
236
  className: "text-muted-foreground md:col-span-2",
237
- children: /* @__PURE__ */ P(i, { id: "These are the customer&apos;s invoice profile when the order was billed. Editing the profile affects later orders." })
237
+ children: /* @__PURE__ */ P(t, { id: "These are the customer&apos;s invoice profile when the order was billed. Editing the profile affects later orders." })
238
238
  })
239
239
  ]
240
240
  })] });
241
241
  }
242
- function G({ order: t }) {
243
- let { toast: r, usageActionMutation: l } = n(), { id: u } = e(), d = s(), [f, p] = k(null), [m, h] = k(""), [C, w] = k(""), [T, E] = k(null), D = M(), O = A(l(D, t.customer_id)), j = d ? R(t) : [];
242
+ function G({ order: n }) {
243
+ let { toast: i, usageActionMutation: l } = r(), { id: u } = e(), d = s(), [f, p] = k(null), [m, h] = k(""), [C, w] = k(""), [T, E] = k(null), D = M(), O = A(l(D, n.customer_id)), j = d ? R(n) : [];
244
244
  async function V() {
245
245
  if (!(!f || O.isPending)) {
246
246
  E(null);
@@ -249,29 +249,29 @@ function G({ order: t }) {
249
249
  if (f === "record_payment" && !C.trim()) throw Error("Enter the bank or payment reference.");
250
250
  let e;
251
251
  if (f === "record_payment") {
252
- let n = c(t.currency);
253
- if (n === void 0) throw Error(`${t.currency} is not a registered currency.`);
254
- e = B(m, t.usage.amount_due, n);
252
+ let t = c(n.currency);
253
+ if (t === void 0) throw Error(`${n.currency} is not a registered currency.`);
254
+ e = B(m, n.usage.amount_due, t);
255
255
  }
256
- let n = await O.mutateAsync({
257
- id: t.id,
256
+ let t = await O.mutateAsync({
257
+ id: n.id,
258
258
  action: f,
259
259
  amount: e,
260
260
  reference: C.trim()
261
261
  });
262
- r(z(n)), p(null);
262
+ i(z(t)), p(null);
263
263
  } catch (e) {
264
264
  E(e instanceof Error ? e.message : "Order action failed.");
265
265
  }
266
266
  }
267
267
  }
268
268
  return /* @__PURE__ */ F(N, { children: [
269
- t.status === "processing" && /* @__PURE__ */ F("p", {
269
+ n.status === "processing" && /* @__PURE__ */ F("p", {
270
270
  role: "status",
271
271
  children: [
272
- /* @__PURE__ */ P(i, { id: "A collection of this order is in progress. It must finish, or be resolved with " }),
273
- /* @__PURE__ */ P("code", { children: /* @__PURE__ */ P(i, { id: "openrails intents resolve" }) }),
274
- /* @__PURE__ */ P(i, { id: ", before another action." })
272
+ /* @__PURE__ */ P(t, { id: "A collection of this order is in progress. It must finish, or be resolved with " }),
273
+ /* @__PURE__ */ P("code", { children: /* @__PURE__ */ P(t, { id: "openrails intents resolve" }) }),
274
+ /* @__PURE__ */ P(t, { id: ", before another action." })
275
275
  ]
276
276
  }),
277
277
  /* @__PURE__ */ P("div", {
@@ -284,9 +284,9 @@ function G({ order: t }) {
284
284
  children: I[e]
285
285
  }, e))
286
286
  }),
287
- !j.length && t.status !== "processing" && /* @__PURE__ */ P("p", {
287
+ !j.length && n.status !== "processing" && /* @__PURE__ */ P("p", {
288
288
  className: "text-muted-foreground",
289
- children: /* @__PURE__ */ P(i, { id: "No actions are available for your permissions and this order&apos;s state." })
289
+ children: /* @__PURE__ */ P(t, { id: "No actions are available for your permissions and this order&apos;s state." })
290
290
  }),
291
291
  /* @__PURE__ */ P(x, {
292
292
  open: f !== null,
@@ -300,8 +300,8 @@ function G({ order: t }) {
300
300
  children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ F(S, {
301
301
  htmlFor: u("order-payment-amount"),
302
302
  children: [
303
- /* @__PURE__ */ P(i, { id: "Amount (" }),
304
- t.currency,
303
+ /* @__PURE__ */ P(t, { id: "Amount (" }),
304
+ n.currency,
305
305
  ")"
306
306
  ]
307
307
  }), /* @__PURE__ */ P(o, {
@@ -311,7 +311,7 @@ function G({ order: t }) {
311
311
  onChange: (e) => h(e.target.value)
312
312
  })] }), /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(S, {
313
313
  htmlFor: u("order-payment-reference"),
314
- children: /* @__PURE__ */ P(i, { id: "Payment reference" })
314
+ children: /* @__PURE__ */ P(t, { id: "Payment reference" })
315
315
  }), /* @__PURE__ */ P(o, {
316
316
  id: u("order-payment-reference"),
317
317
  maxLength: 255,
@@ -328,7 +328,7 @@ function G({ order: t }) {
328
328
  variant: "outline",
329
329
  disabled: O.isPending,
330
330
  onClick: () => p(null),
331
- children: /* @__PURE__ */ P(i, { id: "Cancel" })
331
+ children: /* @__PURE__ */ P(t, { id: "Cancel" })
332
332
  }), /* @__PURE__ */ P(a, {
333
333
  disabled: O.isPending || !f || !j.includes(f),
334
334
  onClick: () => void V(),
@@ -341,4 +341,4 @@ function G({ order: t }) {
341
341
  //#endregion
342
342
  export { H as OrderDetailPage };
343
343
 
344
- //# sourceMappingURL=admin-detail-C8t5jBps.js.map
344
+ //# sourceMappingURL=admin-detail-QLxU8r-5.js.map