@openrails/billing-ui 0.281.0 → 0.283.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 (221) hide show
  1. package/README.md +108 -364
  2. package/dist/account/format.d.ts +6 -2
  3. package/dist/admin/context.d.ts +38 -46
  4. package/dist/admin/lib/api/endpoints.d.ts +4 -4
  5. package/dist/admin/lib/api/index.d.ts +4 -4
  6. package/dist/admin/lib/api/metrics.d.ts +15 -6
  7. package/dist/admin/lib/capabilities.d.ts +2 -0
  8. package/dist/admin/lib/duration.d.ts +4 -0
  9. package/dist/admin/lib/format.d.ts +29 -1
  10. package/dist/admin/lib/mutations.d.ts +0 -10
  11. package/dist/admin/lib/queries.d.ts +16 -10
  12. package/dist/admin/messages.d.ts +61 -20
  13. package/dist/admin/pages/catalog/price-wizard-logic.d.ts +2 -0
  14. package/dist/admin/pages/catalog/price-wizard.d.ts +1 -3
  15. package/dist/admin/pages/customers/credits.d.ts +4 -1
  16. package/dist/admin/pages/dashboard/levels.d.ts +8 -0
  17. package/dist/admin/pages/dashboard/lib.d.ts +16 -7
  18. package/dist/admin/pages/dashboard/programs.d.ts +3 -0
  19. package/dist/admin/pages/dashboard/query-builder.d.ts +20 -0
  20. package/dist/admin/pages/dashboard/range.d.ts +8 -2
  21. package/dist/admin/pages/dashboard/registry.d.ts +14 -0
  22. package/dist/admin/pages/dashboard/reports-model.d.ts +8 -4
  23. package/dist/admin/pages/dashboard/reports.d.ts +1 -1
  24. package/dist/admin/pages/dashboard/units.d.ts +5 -0
  25. package/dist/admin/pages/dashboard/use-range.d.ts +5 -1
  26. package/dist/admin/pages/dashboard/widget-editor.d.ts +7 -2
  27. package/dist/admin/pages/dashboard/widget-tile.d.ts +10 -4
  28. package/dist/admin/pages/dashboard/widget-viz.d.ts +10 -5
  29. package/dist/admin/pages/ops/signals.d.ts +4 -0
  30. package/dist/admin/pages/payments/attempts.d.ts +2 -2
  31. package/dist/admin/pages/payments/health-model.d.ts +20 -20
  32. package/dist/admin/pages/subscriptions/views.d.ts +4 -0
  33. package/dist/admin-attempts-CRkxeVfQ.js +417 -0
  34. package/dist/admin-attempts-CRkxeVfQ.js.map +1 -0
  35. package/dist/{admin-auth-BUUdvmqC.js → admin-auth-C0pBH3kp.js} +2 -2
  36. package/dist/{admin-auth-BUUdvmqC.js.map → admin-auth-C0pBH3kp.js.map} +1 -1
  37. package/dist/{admin-badge-CAlUmS2s.js → admin-badge-C_-j7ANF.js} +2 -2
  38. package/dist/{admin-badge-CAlUmS2s.js.map → admin-badge-C_-j7ANF.js.map} +1 -1
  39. package/dist/{admin-button-Bn4otsuw.js → admin-button-BV5MAL2H.js} +2 -2
  40. package/dist/{admin-button-Bn4otsuw.js.map → admin-button-BV5MAL2H.js.map} +1 -1
  41. package/dist/{admin-capabilities-DS-X-__V.js → admin-capabilities-B3ZfkA49.js} +21 -13
  42. package/dist/admin-capabilities-B3ZfkA49.js.map +1 -0
  43. package/dist/{admin-card-BHKW1dfB.js → admin-card-DQ61c-kV.js} +2 -2
  44. package/dist/{admin-card-BHKW1dfB.js.map → admin-card-DQ61c-kV.js.map} +1 -1
  45. package/dist/admin-catalog-DAnsClai.js +867 -0
  46. package/dist/admin-catalog-DAnsClai.js.map +1 -0
  47. package/dist/{admin-cursor-pager-Qo9Sq6lN.js → admin-cursor-pager-dkNj-gb6.js} +22 -22
  48. package/dist/{admin-cursor-pager-Qo9Sq6lN.js.map → admin-cursor-pager-dkNj-gb6.js.map} +1 -1
  49. package/dist/admin-customer-search-DDMn_5Us.js +115 -0
  50. package/dist/admin-customer-search-DDMn_5Us.js.map +1 -0
  51. package/dist/{admin-customers-BZP6Jv-i.js → admin-customers-BMaugwpg.js} +24 -25
  52. package/dist/admin-customers-BMaugwpg.js.map +1 -0
  53. package/dist/admin-dashboard-DbbfrIOq.js +510 -0
  54. package/dist/admin-dashboard-DbbfrIOq.js.map +1 -0
  55. package/dist/{admin-data-table-BiFmcf0Z.js → admin-data-table-BjA8cBsr.js} +5 -5
  56. package/dist/{admin-data-table-BiFmcf0Z.js.map → admin-data-table-BjA8cBsr.js.map} +1 -1
  57. package/dist/admin-detail-BVJcnTO-.js +1361 -0
  58. package/dist/admin-detail-BVJcnTO-.js.map +1 -0
  59. package/dist/{admin-detail-cijme9Lc.js → admin-detail-DO9wd12I.js} +130 -107
  60. package/dist/admin-detail-DO9wd12I.js.map +1 -0
  61. package/dist/{admin-detail-CQws8363.js → admin-detail-M7YFYOGN.js} +211 -210
  62. package/dist/{admin-detail-CQws8363.js.map → admin-detail-M7YFYOGN.js.map} +1 -1
  63. package/dist/admin-detail-sOLj-K-Y.js +336 -0
  64. package/dist/{admin-detail-NApy5bio.js.map → admin-detail-sOLj-K-Y.js.map} +1 -1
  65. package/dist/admin-detail-uZ-eR2TT.js +292 -0
  66. package/dist/{admin-detail-C6VH3i2v.js.map → admin-detail-uZ-eR2TT.js.map} +1 -1
  67. package/dist/{admin-dialog-CgYGInHi.js → admin-dialog-BxRcYcQM.js} +3 -3
  68. package/dist/{admin-dialog-CgYGInHi.js.map → admin-dialog-BxRcYcQM.js.map} +1 -1
  69. package/dist/{admin-dropdown-menu-CU9RxoEJ.js → admin-dropdown-menu-DlyaKwyU.js} +2 -2
  70. package/dist/{admin-dropdown-menu-CU9RxoEJ.js.map → admin-dropdown-menu-DlyaKwyU.js.map} +1 -1
  71. package/dist/{admin-dunning-D8lAP7OA.js → admin-dunning-CDy6aMAj.js} +2 -2
  72. package/dist/{admin-dunning-D8lAP7OA.js.map → admin-dunning-CDy6aMAj.js.map} +1 -1
  73. package/dist/{admin-fact-card-lN-MsuSp.js → admin-fact-card-2DujC_r3.js} +2 -2
  74. package/dist/{admin-fact-card-lN-MsuSp.js.map → admin-fact-card-2DujC_r3.js.map} +1 -1
  75. package/dist/{admin-utils-CX097OR7.js → admin-format-Bc4NWK0F.js} +495 -328
  76. package/dist/admin-format-Bc4NWK0F.js.map +1 -0
  77. package/dist/{admin-health-CnagC763.js → admin-health-DePsyIlc.js} +217 -196
  78. package/dist/admin-health-DePsyIlc.js.map +1 -0
  79. package/dist/{admin-imports-SM_fKKgW.js → admin-imports-BrQH3u9M.js} +85 -86
  80. package/dist/{admin-imports-SM_fKKgW.js.map → admin-imports-BrQH3u9M.js.map} +1 -1
  81. package/dist/{admin-input-B_EUzCAE.js → admin-input-BZ2ExV_5.js} +2 -2
  82. package/dist/{admin-input-B_EUzCAE.js.map → admin-input-BZ2ExV_5.js.map} +1 -1
  83. package/dist/{admin-label-DQsOkp1p.js → admin-label-DecDO0oV.js} +2 -2
  84. package/dist/{admin-label-DQsOkp1p.js.map → admin-label-DecDO0oV.js.map} +1 -1
  85. package/dist/{admin-linked-table-row-BFsgc9tz.js → admin-linked-table-row-ChxhVptQ.js} +3 -3
  86. package/dist/{admin-linked-table-row-BFsgc9tz.js.map → admin-linked-table-row-ChxhVptQ.js.map} +1 -1
  87. package/dist/{admin-map-dialog-Dt3gTuTD.js → admin-map-dialog-CQmGOBMw.js} +12 -12
  88. package/dist/{admin-map-dialog-Dt3gTuTD.js.map → admin-map-dialog-CQmGOBMw.js.map} +1 -1
  89. package/dist/admin-metering-OXGOVQ7e.js +1716 -0
  90. package/dist/{admin-metering-DM4KhjOq.js.map → admin-metering-OXGOVQ7e.js.map} +1 -1
  91. package/dist/{admin-missing-record-G2Jz-VUn.js → admin-missing-record-B_9LpSIW.js} +4 -4
  92. package/dist/{admin-missing-record-G2Jz-VUn.js.map → admin-missing-record-B_9LpSIW.js.map} +1 -1
  93. package/dist/admin-ops-BTSunx1i.js +357 -0
  94. package/dist/{admin-ops-mwzj-jpg.js.map → admin-ops-BTSunx1i.js.map} +1 -1
  95. package/dist/{admin-orders-D_aqV66h.js → admin-orders-LqlpQVFo.js} +59 -60
  96. package/dist/{admin-orders-D_aqV66h.js.map → admin-orders-LqlpQVFo.js.map} +1 -1
  97. package/dist/{admin-parked-2FjIfyMg.js → admin-parked-Ch6mlS5f.js} +61 -62
  98. package/dist/{admin-parked-2FjIfyMg.js.map → admin-parked-Ch6mlS5f.js.map} +1 -1
  99. package/dist/{admin-payments-B4hh31PR.js → admin-payments-yNntF4i4.js} +42 -42
  100. package/dist/{admin-payments-B4hh31PR.js.map → admin-payments-yNntF4i4.js.map} +1 -1
  101. package/dist/{admin-price-detail--5Bovz20.js → admin-price-detail-DvmcYr8B.js} +131 -132
  102. package/dist/admin-price-detail-DvmcYr8B.js.map +1 -0
  103. package/dist/{admin-price-format-C-pus9FL.js → admin-price-format-Btdg11-J.js} +14 -5
  104. package/dist/admin-price-format-Btdg11-J.js.map +1 -0
  105. package/dist/admin-price-wizard-EFO3nBV8.js +376 -0
  106. package/dist/admin-price-wizard-EFO3nBV8.js.map +1 -0
  107. package/dist/{admin-proposals-DPRFoWel.js → admin-proposals-CO0LKHM8.js} +119 -120
  108. package/dist/{admin-proposals-DPRFoWel.js.map → admin-proposals-CO0LKHM8.js.map} +1 -1
  109. package/dist/admin-provider-prices-ZjQeEV1n.js +239 -0
  110. package/dist/{admin-provider-prices-B8Oc86dP.js.map → admin-provider-prices-ZjQeEV1n.js.map} +1 -1
  111. package/dist/admin-query-builder-DedekYUU.js +252 -0
  112. package/dist/admin-query-builder-DedekYUU.js.map +1 -0
  113. package/dist/{admin-range-picker-CSWcCYkg.js → admin-range-picker-1WGFlYYw.js} +46 -24
  114. package/dist/admin-range-picker-1WGFlYYw.js.map +1 -0
  115. package/dist/admin-records-A2R52prt.js +389 -0
  116. package/dist/{admin-records-CWbfqyT8.js.map → admin-records-A2R52prt.js.map} +1 -1
  117. package/dist/admin-reports-ySY9v463.js +420 -0
  118. package/dist/admin-reports-ySY9v463.js.map +1 -0
  119. package/dist/{admin-select-DSGCZFiZ.js → admin-select-CgZq2j0G.js} +2 -2
  120. package/dist/{admin-select-DSGCZFiZ.js.map → admin-select-CgZq2j0G.js.map} +1 -1
  121. package/dist/admin-settings-kOW1nPGB.js +1818 -0
  122. package/dist/admin-settings-kOW1nPGB.js.map +1 -0
  123. package/dist/{admin-shared-DdN2hyaR.js → admin-shared-DoBOSwkv.js} +33 -34
  124. package/dist/{admin-shared-DdN2hyaR.js.map → admin-shared-DoBOSwkv.js.map} +1 -1
  125. package/dist/admin-signals-D_iWk2r5.js +124 -0
  126. package/dist/admin-signals-D_iWk2r5.js.map +1 -0
  127. package/dist/{admin-skeleton-DOfsDIu0.js → admin-skeleton-DdqwXcr4.js} +2 -2
  128. package/dist/{admin-skeleton-DOfsDIu0.js.map → admin-skeleton-DdqwXcr4.js.map} +1 -1
  129. package/dist/{admin-status-badge-BLEGt2Fw.js → admin-status-badge-B8rjk6QR.js} +5 -3
  130. package/dist/admin-status-badge-B8rjk6QR.js.map +1 -0
  131. package/dist/{admin-subscriptions-PL5G3f0O.js → admin-subscriptions-CjYPSPs-.js} +43 -38
  132. package/dist/admin-subscriptions-CjYPSPs-.js.map +1 -0
  133. package/dist/{admin-switch-aOiQQzST.js → admin-switch-CyYmt8wi.js} +2 -2
  134. package/dist/{admin-switch-aOiQQzST.js.map → admin-switch-CyYmt8wi.js.map} +1 -1
  135. package/dist/{admin-table-DIKl2rpV.js → admin-table-ByPfWNq8.js} +2 -2
  136. package/dist/{admin-table-DIKl2rpV.js.map → admin-table-ByPfWNq8.js.map} +1 -1
  137. package/dist/admin-tabs-DKa6QljL.js +45 -0
  138. package/dist/admin-tabs-DKa6QljL.js.map +1 -0
  139. package/dist/{admin-textarea-W52-l_0n.js → admin-textarea-CQg__KGc.js} +2 -2
  140. package/dist/{admin-textarea-W52-l_0n.js.map → admin-textarea-CQg__KGc.js.map} +1 -1
  141. package/dist/{admin-typed-confirm-dialog-B_00EHlT.js → admin-typed-confirm-dialog-BvAYEh3H.js} +6 -6
  142. package/dist/{admin-typed-confirm-dialog-B_00EHlT.js.map → admin-typed-confirm-dialog-BvAYEh3H.js.map} +1 -1
  143. package/dist/admin-widget-tile-DDI3eaRy.js +290 -0
  144. package/dist/admin-widget-tile-DDI3eaRy.js.map +1 -0
  145. package/dist/admin-widget-viz-Db9CQ2Sx.js +1084 -0
  146. package/dist/admin-widget-viz-Db9CQ2Sx.js.map +1 -0
  147. package/dist/admin.css +1 -1
  148. package/dist/admin.js +660 -609
  149. package/dist/admin.js.map +1 -1
  150. package/dist/buy-button.d.ts +4 -2
  151. package/dist/cart.d.ts +4 -2
  152. package/dist/client/client.d.ts +16 -3
  153. package/dist/client/generated/error-codes.d.ts +1 -1
  154. package/dist/client/generated/routes.d.ts +296 -181
  155. package/dist/client/generated/wire.d.ts +514 -277
  156. package/dist/client/index.d.ts +1 -1
  157. package/dist/client/types.d.ts +76 -8
  158. package/dist/{client-DwsFGm4M.js → client-D8qT6xjo.js} +86 -44
  159. package/dist/client-D8qT6xjo.js.map +1 -0
  160. package/dist/client.js +1 -1
  161. package/dist/components/billing-fields.d.ts +5 -3
  162. package/dist/components/platform-card-form.d.ts +3 -1
  163. package/dist/{hooks-C-MhXjQh.js → hooks-CX09fAJA.js} +86 -60
  164. package/dist/hooks-CX09fAJA.js.map +1 -0
  165. package/dist/index.d.ts +1 -1
  166. package/dist/index.js +847 -779
  167. package/dist/index.js.map +1 -1
  168. package/dist/lib/billing-fields.d.ts +15 -0
  169. package/dist/lib/billing.d.ts +23 -5
  170. package/dist/lib/price-label.d.ts +1 -1
  171. package/dist/locales/en.d.ts +4 -0
  172. package/dist/locales/en.js +4 -0
  173. package/dist/locales/en.js.map +1 -1
  174. package/dist/product-list.d.ts +4 -2
  175. package/dist/react/config.d.ts +10 -2
  176. package/dist/react/index.d.ts +1 -1
  177. package/dist/react.js +1 -1
  178. package/dist/styles.css +1 -1
  179. package/dist/tokenized-card-form.d.ts +10 -2
  180. package/docs/payment-form-contract.md +6 -15
  181. package/package.json +6 -6
  182. package/dist/admin/lib/api/copilot.d.ts +0 -6
  183. package/dist/admin/pages/catalog/copilot-panel.d.ts +0 -4
  184. package/dist/admin-attempts-DjgBAbx9.js +0 -418
  185. package/dist/admin-attempts-DjgBAbx9.js.map +0 -1
  186. package/dist/admin-capabilities-DS-X-__V.js.map +0 -1
  187. package/dist/admin-catalog-BdLDhr8R.js +0 -1096
  188. package/dist/admin-catalog-BdLDhr8R.js.map +0 -1
  189. package/dist/admin-customers-BZP6Jv-i.js.map +0 -1
  190. package/dist/admin-dashboard-BJSonknv.js +0 -461
  191. package/dist/admin-dashboard-BJSonknv.js.map +0 -1
  192. package/dist/admin-detail-C03O0R6e.js +0 -1351
  193. package/dist/admin-detail-C03O0R6e.js.map +0 -1
  194. package/dist/admin-detail-C6VH3i2v.js +0 -293
  195. package/dist/admin-detail-NApy5bio.js +0 -337
  196. package/dist/admin-detail-cijme9Lc.js.map +0 -1
  197. package/dist/admin-format-D9Ablh0P.js +0 -169
  198. package/dist/admin-format-D9Ablh0P.js.map +0 -1
  199. package/dist/admin-health-CnagC763.js.map +0 -1
  200. package/dist/admin-metering-DM4KhjOq.js +0 -1717
  201. package/dist/admin-ops-mwzj-jpg.js +0 -358
  202. package/dist/admin-price-detail--5Bovz20.js.map +0 -1
  203. package/dist/admin-price-format-C-pus9FL.js.map +0 -1
  204. package/dist/admin-price-wizard-Cj_Bgh-V.js +0 -354
  205. package/dist/admin-price-wizard-Cj_Bgh-V.js.map +0 -1
  206. package/dist/admin-provider-prices-B8Oc86dP.js +0 -240
  207. package/dist/admin-range-picker-CSWcCYkg.js.map +0 -1
  208. package/dist/admin-records-CWbfqyT8.js +0 -390
  209. package/dist/admin-reports-CAHWO_d6.js +0 -319
  210. package/dist/admin-reports-CAHWO_d6.js.map +0 -1
  211. package/dist/admin-settings-BrvNTJlM.js +0 -1818
  212. package/dist/admin-settings-BrvNTJlM.js.map +0 -1
  213. package/dist/admin-status-badge-BLEGt2Fw.js.map +0 -1
  214. package/dist/admin-subscriptions-PL5G3f0O.js.map +0 -1
  215. package/dist/admin-tabs-DR74xX0-.js +0 -156
  216. package/dist/admin-tabs-DR74xX0-.js.map +0 -1
  217. package/dist/admin-utils-CX097OR7.js.map +0 -1
  218. package/dist/admin-widget-viz-DVV9aTQp.js +0 -643
  219. package/dist/admin-widget-viz-DVV9aTQp.js.map +0 -1
  220. package/dist/client-DwsFGm4M.js.map +0 -1
  221. package/dist/hooks-C-MhXjQh.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { E as e, O as t, l as n, p as r, r as i, t as a } from "./admin-utils-CX097OR7.js";
1
+ import { A as e, J as t, P as n, S as r, X as i, w as a } from "./admin-format-Bc4NWK0F.js";
2
2
  import { r as o } from "./admin-tile-grids-Gc67MtA6.js";
3
- import { u as s } from "./admin-capabilities-DS-X-__V.js";
4
- import { t as c } from "./admin-badge-CAlUmS2s.js";
5
- import { a as l, o as u, r as d, t as f } from "./admin-card-BHKW1dfB.js";
6
- import { a as p, i as m, n as h, r as g, t as ee } from "./admin-select-DSGCZFiZ.js";
7
- import { t as _ } from "./admin-skeleton-DOfsDIu0.js";
8
- import { a as v, n as y, o as b, r as x, s as S, t as C } from "./admin-table-DIKl2rpV.js";
9
- import { a as w, i as T, r as E, t as te } from "./admin-widget-viz-DVV9aTQp.js";
3
+ import { u as s } from "./admin-capabilities-B3ZfkA49.js";
4
+ import { t as c } from "./admin-badge-C_-j7ANF.js";
5
+ import { a as l, o as u, r as d, t as f } from "./admin-card-DQ61c-kV.js";
6
+ import { a as p, i as m, n as h, r as g, t as ee } from "./admin-select-CgZq2j0G.js";
7
+ import { t as _ } from "./admin-skeleton-DdqwXcr4.js";
8
+ import { a as v, n as y, o as b, r as x, s as S, t as C } from "./admin-table-ByPfWNq8.js";
9
+ import { a as w, i as T, o as E, t as te } from "./admin-widget-viz-Db9CQ2Sx.js";
10
10
  import * as ne from "react";
11
11
  import { useQuery as D } from "@tanstack/react-query";
12
12
  import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
@@ -45,14 +45,12 @@ var j = [
45
45
  kind: ["verify", "initial"],
46
46
  card_entry: ["new"]
47
47
  }, N = [
48
- "card_data",
49
- "issuer_soft",
50
- "issuer_hard",
51
- "gateway_rule",
52
- "system_error",
53
- "unknown"
48
+ "declined",
49
+ "refused",
50
+ "error"
54
51
  ], P = [
55
52
  "declined",
53
+ "refused",
56
54
  "error",
57
55
  "missed"
58
56
  ];
@@ -66,37 +64,42 @@ var I = (e, t, n = {}) => ({
66
64
  filters: F(t, n),
67
65
  compare: "previous_period"
68
66
  }), ie = [
69
- "rebill_first_failure_rate",
70
- "rebills_missed",
67
+ "first_try_rebill_approval_rate",
71
68
  "dunning_recovery_rate",
72
- "rebill_collection_rate"
69
+ "rebill_rate"
73
70
  ], L = (e) => I(ie, e), ae = [
74
71
  {
75
- id: "new-card-decline",
76
- title: "New-card decline rate",
77
- measure: "attempt_failure_rate",
78
- better: "lower",
79
- query: (e) => I(["attempt_failure_rate"], e, M),
72
+ id: "new-card-authorization",
73
+ title: "New-card authorization rate",
74
+ measure: "authorization_rate",
75
+ better: "higher",
76
+ query: (e) => I(["authorization_rate"], e, M),
80
77
  list: "attempts",
81
78
  listFilters: {
82
79
  ...M,
83
- category: N
80
+ outcome: N
84
81
  }
85
82
  },
86
83
  {
87
84
  id: "purchase-failure",
88
- title: "New-card purchase failure rate",
89
- measure: "purchase_failure_rate",
85
+ title: "Failed new-card purchases",
86
+ measure: "purchases",
90
87
  better: "lower",
91
- query: (e) => I(["purchase_failure_rate"], e),
88
+ query: (e) => I(["purchases"], e, {
89
+ card_entry: ["new"],
90
+ outcome: ["failed"]
91
+ }),
92
92
  list: "attempts",
93
- listFilters: { card_entry: ["new"] }
93
+ listFilters: {
94
+ card_entry: ["new"],
95
+ outcome: N
96
+ }
94
97
  },
95
98
  {
96
- id: "rebill-first-failure",
97
- title: "Rebill first-attempt failure rate",
98
- measure: "rebill_first_failure_rate",
99
- better: "lower",
99
+ id: "first-try-rebill",
100
+ title: "First-try rebill approval",
101
+ measure: "first_try_rebill_approval_rate",
102
+ better: "higher",
100
103
  query: L,
101
104
  list: "cycles",
102
105
  listFilters: { first_outcome: P }
@@ -104,9 +107,9 @@ var I = (e, t, n = {}) => ({
104
107
  {
105
108
  id: "missed",
106
109
  title: "Missed rebills",
107
- measure: "rebills_missed",
110
+ measure: "rebills",
108
111
  better: "lower",
109
- query: L,
112
+ query: (e) => I(["rebills"], e, { first_outcome: ["missed"] }),
110
113
  list: "cycles",
111
114
  listFilters: { first_outcome: ["missed"] }
112
115
  },
@@ -124,8 +127,8 @@ var I = (e, t, n = {}) => ({
124
127
  },
125
128
  {
126
129
  id: "collection",
127
- title: "Rebill collection rate",
128
- measure: "rebill_collection_rate",
130
+ title: "Rebill rate",
131
+ measure: "rebill_rate",
129
132
  better: "higher",
130
133
  query: L,
131
134
  list: "cycles",
@@ -134,7 +137,7 @@ var I = (e, t, n = {}) => ({
134
137
  ];
135
138
  function oe(e, t) {
136
139
  if (!e) return;
137
- let n = w(e.columns).measures.find((e) => e.name === t.measure);
140
+ let n = E(e.columns).measures.find((e) => e.name === t.measure);
138
141
  if (!n) return;
139
142
  let r = e.rows[0]?.[n.index] ?? null, i = e.compare_rows?.[0]?.[n.index] ?? null, a = null;
140
143
  r !== null && i !== null && (a = Number(r) - Number(i), Number.isFinite(a) || (a = null));
@@ -160,24 +163,24 @@ var R = (e) => {
160
163
  filters: F(e, n)
161
164
  });
162
165
  return {
163
- newCard: t("attempt_failure_rate", M),
164
- rebill: t("rebill_first_failure_rate")
166
+ newCard: t("authorization_rate", M),
167
+ rebill: t("first_try_rebill_approval_rate")
165
168
  };
166
169
  }, ce = (e) => ({
167
- measures: ["failed_attempts"],
170
+ measures: ["attempts"],
168
171
  by: [
169
- "category",
172
+ "decline_cause",
170
173
  "reason",
171
174
  "response_code"
172
175
  ],
173
176
  range: { last: e.last },
174
- filters: F(e),
177
+ filters: F(e, { outcome: N }),
175
178
  compare: "previous_period"
176
179
  });
177
180
  function le(e) {
178
181
  if (!e) return [];
179
- let t = w(e.columns), n = (e) => t.dims.find((t) => t.name === e)?.index ?? -1, [r, i, a] = [
180
- n("category"),
182
+ let t = E(e.columns), n = (e) => t.dims.find((t) => t.name === e)?.index ?? -1, [r, i, a] = [
183
+ n("decline_cause"),
181
184
  n("reason"),
182
185
  n("response_code")
183
186
  ], o = t.measures[0]?.index ?? -1;
@@ -189,7 +192,7 @@ function le(e) {
189
192
  ]), c = /* @__PURE__ */ new Map();
190
193
  for (let t of e.compare_rows ?? []) c.set(s(t), Number(t[o] ?? 0));
191
194
  let l = e.rows.map((e) => ({
192
- category: String(e[r] ?? ""),
195
+ cause: String(e[r] ?? ""),
193
196
  reason: String(e[i] ?? ""),
194
197
  code: String(e[a] ?? ""),
195
198
  count: Number(e[o] ?? 0),
@@ -198,13 +201,13 @@ function le(e) {
198
201
  })), u = l.reduce((e, t) => e + t.count, 0), d = /* @__PURE__ */ new Map();
199
202
  for (let e of l) {
200
203
  e.share = u ? e.count / u : 0;
201
- let t = d.get(e.category);
204
+ let t = d.get(e.cause);
202
205
  t || (t = {
203
- category: e.category,
206
+ cause: e.cause,
204
207
  count: 0,
205
208
  share: 0,
206
209
  rows: []
207
- }, d.set(e.category, t)), t.count += e.count, t.rows.push(e);
210
+ }, d.set(e.cause, t)), t.count += e.count, t.rows.push(e);
208
211
  }
209
212
  return [...d.values()].map((e) => ({
210
213
  ...e,
@@ -214,8 +217,8 @@ function le(e) {
214
217
  }
215
218
  var ue = (e) => {
216
219
  let t = (t) => ({
217
- measures: ["attempts", "attempt_failure_rate"],
218
- by: [t],
220
+ measures: ["attempts"],
221
+ by: [t, "outcome"],
219
222
  range: { last: e.last },
220
223
  filters: F(e, M)
221
224
  });
@@ -226,11 +229,20 @@ var ue = (e) => {
226
229
  };
227
230
  function de(e) {
228
231
  if (!e) return [];
229
- let t = w(e.columns), n = t.dims[0]?.index ?? -1, r = t.measures.find((e) => e.name === "attempts")?.index ?? -1, i = t.measures.find((e) => e.name === "attempt_failure_rate")?.index ?? -1;
230
- return n < 0 || r < 0 || i < 0 ? [] : e.rows.map((e) => ({
231
- result: String(e[n] ?? ""),
232
- attempts: Number(e[r] ?? 0),
233
- failureRate: e[i] === null ? null : Number(e[i])
232
+ let t = E(e.columns), n = t.dims[0]?.index ?? -1, r = t.dims.find((e) => e.name === "outcome")?.index ?? -1, i = t.measures.find((e) => e.name === "attempts")?.index ?? -1;
233
+ if (n < 0 || r < 0 || i < 0) return [];
234
+ let a = /* @__PURE__ */ new Map();
235
+ for (let t of e.rows) {
236
+ let e = String(t[n] ?? ""), o = Number(t[i] ?? 0), s = a.get(e) ?? {
237
+ attempts: 0,
238
+ failed: 0
239
+ };
240
+ s.attempts += o, N.includes(String(t[r])) && (s.failed += o), a.set(e, s);
241
+ }
242
+ return [...a].map(([e, t]) => ({
243
+ result: e,
244
+ attempts: t.attempts,
245
+ failureRate: t.attempts ? t.failed / t.attempts : null
234
246
  })).sort((e, t) => t.attempts - e.attempts);
235
247
  }
236
248
  var z = [
@@ -246,61 +258,63 @@ var z = [
246
258
  14,
247
259
  30
248
260
  ], V = (e) => {
249
- let t = (t, n) => ({
261
+ let t = (t, n, r) => ({
250
262
  measures: t,
251
263
  by: n,
252
264
  range: { last: e.last },
253
- filters: F(e)
254
- });
265
+ filters: F(e, r)
266
+ }), n = { outcome: ["recovered"] };
255
267
  return {
256
- rate: t(["dunning_recovery_rate", "dunning_recovered"], ["owner"]),
257
- byAttempt: t(["dunning_recovered"], ["owner", "recovery_attempt"]),
258
- byDays: t(["dunning_recovered"], ["owner", "days_to_recover"])
268
+ rate: t(["rebills"], ["owner"], {
269
+ outcome: ["recovered", "lost"],
270
+ first_outcome: P
271
+ }),
272
+ byAttempt: t(["rebills"], ["owner", "recovery_attempt"], n),
273
+ byDays: t(["rebills"], ["owner", "days_to_recover"], n)
259
274
  };
260
275
  };
261
276
  function H(e, t, n) {
262
277
  if (!e || !t) return [];
263
- let r = w(e.columns), i = w(t.columns), a = r.dims.find((e) => e.name === "owner")?.index ?? -1, o = r.measures.find((e) => e.name === "dunning_recovery_rate")?.index ?? -1, s = r.measures.find((e) => e.name === "dunning_recovered")?.index ?? -1, c = i.dims.find((e) => e.name === "owner")?.index ?? -1, l = i.dims.find((e) => e.name === n)?.index ?? -1, u = i.measures[0]?.index ?? -1;
278
+ let r = E(e.columns), i = E(t.columns), a = r.dims.find((e) => e.name === "owner")?.index ?? -1, o = r.measures[0]?.index ?? -1, s = i.dims.find((e) => e.name === "owner")?.index ?? -1, c = i.dims.find((e) => e.name === n)?.index ?? -1, l = i.measures[0]?.index ?? -1;
264
279
  if ([
265
280
  a,
266
281
  o,
267
282
  s,
268
283
  c,
269
- l,
270
- u
284
+ l
271
285
  ].includes(-1)) return [];
272
- let d = /* @__PURE__ */ new Map();
286
+ let u = /* @__PURE__ */ new Map();
273
287
  for (let t of e.rows) {
274
- let e = Number(t[s] ?? 0), n = Number(t[o] ?? 0);
275
- e > 0 && n > 0 && d.set(String(t[a]), e / n);
288
+ let e = Number(t[o] ?? 0);
289
+ e > 0 && u.set(String(t[a]), e);
276
290
  }
277
- let f = n === "recovery_attempt" ? z : B, p = [];
278
- for (let [e, r] of d) {
279
- let i = f.map((i) => {
291
+ let d = n === "recovery_attempt" ? z : B, f = [];
292
+ for (let [e, r] of u) {
293
+ let i = d.map((i) => {
280
294
  let a = 0;
281
295
  for (let r of t.rows) {
282
- if (String(r[c]) !== e || r[l] === "") continue;
283
- let t = String(r[l]);
284
- (n === "recovery_attempt" ? z.indexOf(t) <= z.indexOf(String(i)) : Number(t) <= Number(i)) && (a += Number(r[u] ?? 0));
296
+ if (String(r[s]) !== e || r[c] === "") continue;
297
+ let t = String(r[c]);
298
+ (n === "recovery_attempt" ? z.indexOf(t) <= z.indexOf(String(i)) : Number(t) <= Number(i)) && (a += Number(r[l] ?? 0));
285
299
  }
286
300
  return a / r;
287
301
  });
288
- p.push({
302
+ f.push({
289
303
  owner: e,
290
304
  points: i
291
305
  });
292
306
  }
293
- return p.sort((e, t) => e.owner.localeCompare(t.owner));
307
+ return f.sort((e, t) => e.owner.localeCompare(t.owner));
294
308
  }
295
309
  var fe = (e) => ({
296
- measures: ["rebills_missed"],
310
+ measures: ["rebills"],
297
311
  by: ["miss_reason", "psp"],
298
312
  range: { last: e.last },
299
- filters: F(e)
313
+ filters: F(e, { first_outcome: ["missed"] })
300
314
  });
301
315
  function pe(e) {
302
316
  if (!e) return [];
303
- let t = w(e.columns), n = t.dims.find((e) => e.name === "miss_reason")?.index ?? -1, r = t.dims.find((e) => e.name === "psp")?.index ?? -1, i = t.measures[0]?.index ?? -1;
317
+ let t = E(e.columns), n = t.dims.find((e) => e.name === "miss_reason")?.index ?? -1, r = t.dims.find((e) => e.name === "psp")?.index ?? -1, i = t.measures[0]?.index ?? -1;
304
318
  return n < 0 || r < 0 || i < 0 ? [] : e.rows.map((e) => ({
305
319
  reason: String(e[n] ?? ""),
306
320
  psp: String(e[r] ?? ""),
@@ -315,7 +329,7 @@ var me = (e) => ({
315
329
  });
316
330
  function he(e) {
317
331
  if (!e) return [];
318
- let t = w(e.columns), n = t.dims.find((e) => e.name === "psp")?.index ?? -1, r = t.dims.find((e) => e.name === "observed_via")?.index ?? -1, i = t.measures[0]?.index ?? -1;
332
+ let t = E(e.columns), n = t.dims.find((e) => e.name === "psp")?.index ?? -1, r = t.dims.find((e) => e.name === "observed_via")?.index ?? -1, i = t.measures[0]?.index ?? -1;
319
333
  if (n < 0 || r < 0 || i < 0) return [];
320
334
  let a = /* @__PURE__ */ new Map();
321
335
  for (let t of e.rows) {
@@ -361,23 +375,27 @@ var W = [
361
375
  let t = e.psp ? { psp: [e.psp.id] } : {}, n = { last: "25m" };
362
376
  return {
363
377
  months: {
364
- measures: ["nmi_history_authorizations", "nmi_history_refusal_rate"],
365
- by: ["time", "nmi_kind"],
378
+ measures: ["nmi_history_authorizations"],
379
+ by: [
380
+ "time",
381
+ "nmi_kind",
382
+ "outcome"
383
+ ],
366
384
  grain: "month",
367
385
  range: n,
368
386
  filters: e.psp ? t : void 0
369
387
  },
370
388
  reasons: {
371
- measures: ["nmi_history_refused"],
389
+ measures: ["nmi_history_authorizations"],
372
390
  by: [
373
391
  "nmi_kind",
374
- "category",
392
+ "decline_cause",
375
393
  "reason"
376
394
  ],
377
395
  range: n,
378
396
  filters: {
379
397
  ...t,
380
- category: N
398
+ outcome: N
381
399
  }
382
400
  },
383
401
  recorded: {
@@ -394,39 +412,42 @@ var W = [
394
412
  };
395
413
  function ge(e) {
396
414
  if (!e) return null;
397
- let t = w(e.columns), n = t.measures[0]?.index ?? -1;
415
+ let t = E(e.columns), n = t.measures[0]?.index ?? -1;
398
416
  return t.time < 0 || n < 0 ? null : e.rows.filter((e) => Number(e[n] ?? 0) > 0).map((e) => String(e[t.time])).sort()[0] ?? null;
399
417
  }
400
418
  function _e(e, t) {
401
419
  if (!e) return [];
402
- let n = w(e.columns), r = n.dims.find((e) => e.name === "nmi_kind")?.index ?? -1, i = n.measures.find((e) => e.name === "nmi_history_authorizations")?.index ?? -1, a = n.measures.find((e) => e.name === "nmi_history_refusal_rate")?.index ?? -1;
420
+ let n = E(e.columns), r = n.dims.find((e) => e.name === "nmi_kind")?.index ?? -1, i = n.dims.find((e) => e.name === "outcome")?.index ?? -1, a = n.measures.find((e) => e.name === "nmi_history_authorizations")?.index ?? -1;
403
421
  if ([
404
422
  n.time,
405
423
  r,
406
424
  i,
407
425
  a
408
426
  ].includes(-1)) return [];
409
- let o = /* @__PURE__ */ new Map();
410
- for (let s of e.rows) {
411
- let e = Number(s[i] ?? 0);
427
+ let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
428
+ for (let c of e.rows) {
429
+ let e = Number(c[a] ?? 0);
412
430
  if (e === 0) continue;
413
- let c = String(s[n.time]), l = o.get(c);
414
- l || (l = {
415
- month: c,
431
+ let l = String(c[n.time]), u = o.get(l);
432
+ u || (u = {
433
+ month: l,
416
434
  kinds: {},
417
- recorded: t !== null && c >= t
418
- }, o.set(c, l)), l.kinds[String(s[r])] = {
419
- authorizations: e,
420
- refusalRate: s[a] === null ? null : Number(s[a])
435
+ recorded: t !== null && l >= t
436
+ }, o.set(l, u));
437
+ let d = u.kinds[String(c[r])] ??= {
438
+ authorizations: 0,
439
+ refusalRate: null
421
440
  };
441
+ d.authorizations += e, c[i] !== "approved" && s.set(d, (s.get(d) ?? 0) + e);
422
442
  }
443
+ for (let e of o.values()) for (let t of Object.values(e.kinds)) t.refusalRate = (s.get(t) ?? 0) / t.authorizations;
423
444
  return [...o.values()].sort((e, t) => t.month.localeCompare(e.month));
424
445
  }
425
446
  function ve(e) {
426
447
  if (!e) return [];
427
- let t = w(e.columns), n = (e) => t.dims.find((t) => t.name === e)?.index ?? -1, [r, i, a] = [
448
+ let t = E(e.columns), n = (e) => t.dims.find((t) => t.name === e)?.index ?? -1, [r, i, a] = [
428
449
  n("nmi_kind"),
429
- n("category"),
450
+ n("decline_cause"),
430
451
  n("reason")
431
452
  ], o = t.measures[0]?.index ?? -1;
432
453
  if ([
@@ -437,7 +458,7 @@ function ve(e) {
437
458
  ].includes(-1)) return [];
438
459
  let s = e.rows.map((e) => ({
439
460
  kind: String(e[r] ?? ""),
440
- category: String(e[i] ?? ""),
461
+ cause: String(e[i] ?? ""),
441
462
  reason: String(e[a] ?? ""),
442
463
  count: Number(e[o] ?? 0),
443
464
  share: 0
@@ -448,9 +469,9 @@ function ve(e) {
448
469
  })).sort((e, t) => t.count - e.count);
449
470
  }
450
471
  // src/admin/pages/payments/health.tsx
451
- var K = (e) => e === null ? "—" : T(e, "ratio"), ye = (e) => j.find((t) => t.value === e)?.label ?? e;
472
+ var K = (e) => e === null ? "—" : w(e, "ratio"), ye = (e) => j.find((t) => t.value === e)?.label ?? e;
452
473
  function be() {
453
- let { text: i } = t(), { adminQueries: a } = r(), [o, c] = n(), l = s(), u = D({
474
+ let { text: r } = i(), { adminQueries: a } = n(), [o, c] = e(), l = s(), u = D({
454
475
  ...a.psps(),
455
476
  enabled: l
456
477
  }).data?.data, d = o.get("psp_id") ?? "", f = u?.find((e) => e.id === d), p = {
@@ -468,12 +489,12 @@ function be() {
468
489
  className: "flex flex-wrap items-center justify-between gap-3",
469
490
  children: [/* @__PURE__ */ k("h1", {
470
491
  className: "text-2xl font-semibold tracking-tight",
471
- children: /* @__PURE__ */ k(e, { id: "Payment health" })
492
+ children: /* @__PURE__ */ k(t, { id: "Payment health" })
472
493
  }), /* @__PURE__ */ A("div", {
473
494
  className: "flex flex-wrap items-center gap-3",
474
495
  children: [
475
496
  /* @__PURE__ */ k(q, {
476
- label: i("Owner"),
497
+ label: r("Owner"),
477
498
  value: p.owner,
478
499
  options: j.map((e) => ({
479
500
  value: e.value,
@@ -482,7 +503,7 @@ function be() {
482
503
  onChange: (e) => m("owner", e)
483
504
  }),
484
505
  /* @__PURE__ */ k(q, {
485
- label: i("PSP"),
506
+ label: r("PSP"),
486
507
  value: d,
487
508
  options: [{
488
509
  value: "",
@@ -494,7 +515,7 @@ function be() {
494
515
  onChange: (e) => m("psp_id", e)
495
516
  }),
496
517
  /* @__PURE__ */ k(q, {
497
- label: i("Range"),
518
+ label: r("Range"),
498
519
  value: p.last,
499
520
  options: re.map((e) => ({
500
521
  value: e.value,
@@ -509,10 +530,10 @@ function be() {
509
530
  /* @__PURE__ */ A("div", {
510
531
  className: "grid gap-4 @min-[48rem]/page:grid-cols-2",
511
532
  children: [/* @__PURE__ */ k(Z, {
512
- title: i("New-card decline rate by week"),
533
+ title: r("New-card authorization rate by week"),
513
534
  query: R(p).newCard
514
535
  }), /* @__PURE__ */ k(Z, {
515
- title: i("Rebill first-attempt failure rate by week"),
536
+ title: r("First-try rebill approval by week"),
516
537
  query: R(p).rebill
517
538
  })]
518
539
  }),
@@ -580,8 +601,8 @@ function xe({ scope: e }) {
580
601
  });
581
602
  }
582
603
  function Se({ tile: e, scope: t }) {
583
- let n = r().adminQueries.widgetMetrics, { data: o, isPending: s } = D(n(e.query(t))), c = oe(o, e);
584
- return /* @__PURE__ */ k(i, {
604
+ let i = n().adminQueries.widgetMetrics, { data: o, isPending: s } = D(i(e.query(t))), c = oe(o, e);
605
+ return /* @__PURE__ */ k(a, {
585
606
  to: U(e.list, e.listFilters, t, o?.range),
586
607
  className: "rounded-xl focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
587
608
  children: /* @__PURE__ */ A(f, {
@@ -593,9 +614,9 @@ function Se({ tile: e, scope: t }) {
593
614
  className: "flex flex-col gap-1",
594
615
  children: s || !c ? /* @__PURE__ */ k(_, { className: "h-8 w-20" }) : /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("span", {
595
616
  className: "text-2xl font-semibold tabular-nums",
596
- children: T(c.value, c.unit)
617
+ children: w(c.value, c.unit)
597
618
  }), /* @__PURE__ */ k("span", {
598
- className: a("text-xs", c.change === null || c.change === 0 ? "text-muted-foreground" : c.worse ? "text-failed" : "text-settled"),
619
+ className: r("text-xs", c.change === null || c.change === 0 ? "text-muted-foreground" : c.worse ? "text-failed" : "text-settled"),
599
620
  children: se(c)
600
621
  })] })
601
622
  })]
@@ -603,7 +624,7 @@ function Se({ tile: e, scope: t }) {
603
624
  });
604
625
  }
605
626
  function Z({ title: e, query: t }) {
606
- let n = r().adminQueries.widgetMetrics, { data: i, isPending: a } = D(n(t));
627
+ let r = n().adminQueries.widgetMetrics, { data: i, isPending: a } = D(r(t));
607
628
  return /* @__PURE__ */ k(J, {
608
629
  title: e,
609
630
  children: /* @__PURE__ */ k("div", {
@@ -616,26 +637,26 @@ function Z({ title: e, query: t }) {
616
637
  })
617
638
  });
618
639
  }
619
- function Ce({ scope: n }) {
620
- let { text: o } = t(), s = r().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(ce(n))), u = le(c), d = (e) => U("attempts", e, n, c?.range);
640
+ function Ce({ scope: e }) {
641
+ let { text: o } = i(), s = n().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(ce(e))), u = le(c), d = (t) => U("attempts", t, e, c?.range);
621
642
  return /* @__PURE__ */ k(J, {
622
643
  title: o("Decline reasons"),
623
644
  children: l ? /* @__PURE__ */ k(Y, {}) : u.length === 0 ? /* @__PURE__ */ k(X, { label: o("No declines in this range.") }) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
624
645
  className: "hover:bg-transparent",
625
646
  children: [
626
- /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(e, { id: "Category / reason" }) }),
627
- /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(e, { id: "Code" }) }),
647
+ /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(t, { id: "Category / reason" }) }),
648
+ /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(t, { id: "Code" }) }),
628
649
  /* @__PURE__ */ k(v, {
629
650
  className: "text-right",
630
- children: /* @__PURE__ */ k(e, { id: "Declines" })
651
+ children: /* @__PURE__ */ k(t, { id: "Declines" })
631
652
  }),
632
653
  /* @__PURE__ */ k(v, {
633
654
  className: "text-right",
634
- children: /* @__PURE__ */ k(e, { id: "Share" })
655
+ children: /* @__PURE__ */ k(t, { id: "Share" })
635
656
  }),
636
657
  /* @__PURE__ */ k(v, {
637
658
  className: "text-right",
638
- children: /* @__PURE__ */ k(e, { id: "Previous period" })
659
+ children: /* @__PURE__ */ k(t, { id: "Previous period" })
639
660
  })
640
661
  ]
641
662
  }) }), /* @__PURE__ */ k(y, { children: u.map((e) => /* @__PURE__ */ A(ne.Fragment, { children: [/* @__PURE__ */ A(S, {
@@ -644,10 +665,10 @@ function Ce({ scope: n }) {
644
665
  /* @__PURE__ */ k(x, {
645
666
  colSpan: 2,
646
667
  className: "font-medium",
647
- children: /* @__PURE__ */ k(i, {
668
+ children: /* @__PURE__ */ k(a, {
648
669
  className: "hover:underline",
649
- to: d({ category: [e.category] }),
650
- children: e.category
670
+ to: d({ decline_cause: [e.cause] }),
671
+ children: e.cause
651
672
  })
652
673
  }),
653
674
  /* @__PURE__ */ k(x, {
@@ -663,19 +684,19 @@ function Ce({ scope: n }) {
663
684
  }), e.rows.map((e) => /* @__PURE__ */ A(S, { children: [
664
685
  /* @__PURE__ */ k(x, {
665
686
  className: "pl-6",
666
- children: /* @__PURE__ */ k(i, {
687
+ children: /* @__PURE__ */ k(a, {
667
688
  className: "hover:underline",
668
689
  to: d({
669
- category: [e.category],
690
+ decline_cause: [e.cause],
670
691
  reason: e.reason ? [e.reason] : []
671
692
  }),
672
693
  children: e.reason || "—"
673
694
  })
674
695
  }),
675
- /* @__PURE__ */ k(x, { children: e.code ? /* @__PURE__ */ k(i, {
696
+ /* @__PURE__ */ k(x, { children: e.code ? /* @__PURE__ */ k(a, {
676
697
  className: "font-mono text-xs hover:underline",
677
698
  to: d({
678
- category: [e.category],
699
+ decline_cause: [e.cause],
679
700
  response_code: [e.code]
680
701
  }),
681
702
  children: e.code
@@ -689,44 +710,44 @@ function Ce({ scope: n }) {
689
710
  children: K(e.share)
690
711
  }),
691
712
  /* @__PURE__ */ k(x, {
692
- className: a("text-right tabular-nums", e.count > e.previous ? "text-failed" : "text-muted-foreground"),
713
+ className: r("text-right tabular-nums", e.count > e.previous ? "text-failed" : "text-muted-foreground"),
693
714
  children: e.previous
694
715
  })
695
- ] }, `${e.reason}|${e.code}`))] }, e.category)) })] })
716
+ ] }, `${e.reason}|${e.code}`))] }, e.cause)) })] })
696
717
  });
697
718
  }
698
719
  function we({ scope: e }) {
699
- let { text: n } = t(), r = ue(e);
720
+ let { text: t } = i(), n = ue(e);
700
721
  return /* @__PURE__ */ A("div", {
701
722
  className: "grid gap-4 @min-[48rem]/page:grid-cols-2",
702
723
  children: [/* @__PURE__ */ k(Q, {
703
- title: n("New cards by AVS result"),
724
+ title: t("New cards by AVS result"),
704
725
  dimension: "avs_result",
705
- query: r.avs,
726
+ query: n.avs,
706
727
  scope: e
707
728
  }), /* @__PURE__ */ k(Q, {
708
- title: n("New cards by CVV result"),
729
+ title: t("New cards by CVV result"),
709
730
  dimension: "cvv_result",
710
- query: r.cvv,
731
+ query: n.cvv,
711
732
  scope: e
712
733
  })]
713
734
  });
714
735
  }
715
- function Q({ title: t, dimension: n, query: a, scope: o }) {
716
- let s = r().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(a)), u = de(c);
736
+ function Q({ title: e, dimension: r, query: i, scope: o }) {
737
+ let s = n().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(i)), u = de(c);
717
738
  return /* @__PURE__ */ k(J, {
718
- title: t,
739
+ title: e,
719
740
  children: l ? /* @__PURE__ */ k(Y, {}) : u.length === 0 ? /* @__PURE__ */ k(X, {}) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
720
741
  className: "hover:bg-transparent",
721
742
  children: [
722
- /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(e, { id: "Result" }) }),
743
+ /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(t, { id: "Result" }) }),
723
744
  /* @__PURE__ */ k(v, {
724
745
  className: "text-right",
725
- children: /* @__PURE__ */ k(e, { id: "Attempts" })
746
+ children: /* @__PURE__ */ k(t, { id: "Attempts" })
726
747
  }),
727
748
  /* @__PURE__ */ k(v, {
728
749
  className: "text-right",
729
- children: /* @__PURE__ */ k(e, { id: "Declined" })
750
+ children: /* @__PURE__ */ k(t, { id: "Declined" })
730
751
  })
731
752
  ]
732
753
  }) }), /* @__PURE__ */ k(y, { children: u.map((e) => /* @__PURE__ */ A(S, { children: [
@@ -736,23 +757,23 @@ function Q({ title: t, dimension: n, query: a, scope: o }) {
736
757
  }),
737
758
  /* @__PURE__ */ k(x, {
738
759
  className: "text-right tabular-nums",
739
- children: /* @__PURE__ */ k(i, {
760
+ children: /* @__PURE__ */ k(a, {
740
761
  className: "hover:underline",
741
762
  to: U("attempts", {
742
763
  ...M,
743
- [n]: e.result ? [e.result] : []
764
+ [r]: e.result ? [e.result] : []
744
765
  }, o, c?.range),
745
766
  children: e.attempts
746
767
  })
747
768
  }),
748
769
  /* @__PURE__ */ k(x, {
749
770
  className: "text-right tabular-nums",
750
- children: /* @__PURE__ */ k(i, {
771
+ children: /* @__PURE__ */ k(a, {
751
772
  className: "hover:underline",
752
773
  to: U("attempts", {
753
774
  ...M,
754
- [n]: e.result ? [e.result] : [],
755
- category: N
775
+ [r]: e.result ? [e.result] : [],
776
+ outcome: N
756
777
  }, o, c?.range),
757
778
  children: K(e.failureRate)
758
779
  })
@@ -761,11 +782,11 @@ function Q({ title: t, dimension: n, query: a, scope: o }) {
761
782
  });
762
783
  }
763
784
  function Te({ scope: e }) {
764
- let { text: n } = t(), i = r().adminQueries.widgetMetrics, a = V(e), o = D(i(a.rate)), s = D(i(a.byAttempt)), c = D(i(a.byDays)), l = o.isPending || s.isPending || c.isPending;
785
+ let { text: t } = i(), r = n().adminQueries.widgetMetrics, a = V(e), o = D(r(a.rate)), s = D(r(a.byAttempt)), c = D(r(a.byDays)), l = o.isPending || s.isPending || c.isPending;
765
786
  return /* @__PURE__ */ A("div", {
766
787
  className: "grid gap-4 @min-[48rem]/page:grid-cols-2",
767
788
  children: [/* @__PURE__ */ k(J, {
768
- title: n("Dunning recovery by retry (share of failed cycles)"),
789
+ title: t("Dunning recovery by retry (share of failed cycles)"),
769
790
  children: l ? /* @__PURE__ */ k(Y, {}) : /* @__PURE__ */ k($, {
770
791
  curves: H(o.data, s.data, "recovery_attempt"),
771
792
  steps: z.map((e) => `#${e}`),
@@ -773,7 +794,7 @@ function Te({ scope: e }) {
773
794
  range: o.data?.range
774
795
  })
775
796
  }), /* @__PURE__ */ k(J, {
776
- title: n("Dunning recovery by days since the first failure"),
797
+ title: t("Dunning recovery by days since the first failure"),
777
798
  children: l ? /* @__PURE__ */ k(Y, {}) : /* @__PURE__ */ k($, {
778
799
  curves: H(o.data, c.data, "days_to_recover"),
779
800
  steps: B.map((e) => `≤ ${e}d`),
@@ -783,66 +804,66 @@ function Te({ scope: e }) {
783
804
  })]
784
805
  });
785
806
  }
786
- function $({ curves: n, steps: r, scope: a, range: o }) {
787
- let { text: s } = t();
788
- return n.length === 0 ? /* @__PURE__ */ k(X, { label: s("No recovered cycles.") }) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
807
+ function $({ curves: e, steps: n, scope: r, range: o }) {
808
+ let { text: s } = i();
809
+ return e.length === 0 ? /* @__PURE__ */ k(X, { label: s("No recovered cycles.") }) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
789
810
  className: "hover:bg-transparent",
790
- children: [/* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(e, { id: "Owner" }) }), r.map((e) => /* @__PURE__ */ k(v, {
811
+ children: [/* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(t, { id: "Owner" }) }), n.map((e) => /* @__PURE__ */ k(v, {
791
812
  className: "text-right",
792
813
  children: e
793
814
  }, e))]
794
- }) }), /* @__PURE__ */ k(y, { children: n.map((e) => /* @__PURE__ */ A(S, { children: [/* @__PURE__ */ k(x, { children: /* @__PURE__ */ k(i, {
815
+ }) }), /* @__PURE__ */ k(y, { children: e.map((e) => /* @__PURE__ */ A(S, { children: [/* @__PURE__ */ k(x, { children: /* @__PURE__ */ k(a, {
795
816
  className: "hover:underline",
796
817
  to: U("cycles", {
797
818
  owner: [e.owner],
798
819
  first_outcome: P,
799
820
  outcome: ["collected"]
800
- }, a, o),
821
+ }, r, o),
801
822
  children: ye(e.owner)
802
823
  }) }), e.points.map((e, t) => /* @__PURE__ */ k(x, {
803
824
  className: "text-right tabular-nums",
804
825
  children: K(e)
805
- }, r[t]))] }, e.owner)) })] });
826
+ }, n[t]))] }, e.owner)) })] });
806
827
  }
807
- function Ee({ scope: n, pspKey: a }) {
808
- let { text: o } = t(), s = r().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(fe(n))), u = pe(c);
828
+ function Ee({ scope: e, pspKey: r }) {
829
+ let { text: o } = i(), s = n().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(fe(e))), u = pe(c);
809
830
  return /* @__PURE__ */ k(J, {
810
831
  title: o("Missed rebills"),
811
832
  children: l ? /* @__PURE__ */ k(Y, {}) : u.length === 0 ? /* @__PURE__ */ k(X, { label: o("No missed rebills in this range.") }) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
812
833
  className: "hover:bg-transparent",
813
834
  children: [
814
- /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(e, { id: "Reason" }) }),
835
+ /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(t, { id: "Reason" }) }),
815
836
  /* @__PURE__ */ k(v, { children: "PSP" }),
816
837
  /* @__PURE__ */ k(v, {
817
838
  className: "text-right",
818
- children: /* @__PURE__ */ k(e, { id: "Cycles" })
839
+ children: /* @__PURE__ */ k(t, { id: "Cycles" })
819
840
  })
820
841
  ]
821
- }) }), /* @__PURE__ */ k(y, { children: u.map((e) => /* @__PURE__ */ A(S, { children: [
822
- /* @__PURE__ */ k(x, { children: e.reason }),
842
+ }) }), /* @__PURE__ */ k(y, { children: u.map((t) => /* @__PURE__ */ A(S, { children: [
843
+ /* @__PURE__ */ k(x, { children: t.reason }),
823
844
  /* @__PURE__ */ k(x, {
824
845
  className: "text-xs",
825
- children: a(e.psp)
846
+ children: r(t.psp)
826
847
  }),
827
848
  /* @__PURE__ */ k(x, {
828
849
  className: "text-right tabular-nums",
829
- children: /* @__PURE__ */ k(i, {
850
+ children: /* @__PURE__ */ k(a, {
830
851
  className: "hover:underline",
831
852
  to: U("cycles", {
832
853
  first_outcome: ["missed"],
833
- miss_reason: [e.reason]
834
- }, n, c?.range, e.psp || void 0),
835
- children: e.count
854
+ miss_reason: [t.reason]
855
+ }, e, c?.range, t.psp || void 0),
856
+ children: t.count
836
857
  })
837
858
  })
838
- ] }, `${e.reason}|${e.psp}`)) })] })
859
+ ] }, `${t.reason}|${t.psp}`)) })] })
839
860
  });
840
861
  }
841
- function De({ scope: n, pspKey: a }) {
842
- let { text: o } = t(), s = r().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(me(n))), u = he(c), d = (e, t) => U("attempts", {
862
+ function De({ scope: e, pspKey: r }) {
863
+ let { text: o } = i(), s = n().adminQueries.widgetMetrics, { data: c, isPending: l } = D(s(me(e))), u = he(c), d = (t, n) => U("attempts", {
843
864
  source: ["provider_schedule"],
844
- observed_via: [t]
845
- }, n, c?.range, e || void 0);
865
+ observed_via: [n]
866
+ }, e, c?.range, t || void 0);
846
867
  return /* @__PURE__ */ k(J, {
847
868
  title: o("Provider charges seen by webhook"),
848
869
  children: l ? /* @__PURE__ */ k(Y, {}) : u.length === 0 ? /* @__PURE__ */ k(X, { label: o("No provider-scheduled charges in this range.") }) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
@@ -851,25 +872,25 @@ function De({ scope: n, pspKey: a }) {
851
872
  /* @__PURE__ */ k(v, { children: "PSP" }),
852
873
  /* @__PURE__ */ k(v, {
853
874
  className: "text-right",
854
- children: /* @__PURE__ */ k(e, { id: "Webhook" })
875
+ children: /* @__PURE__ */ k(t, { id: "Webhook" })
855
876
  }),
856
877
  /* @__PURE__ */ k(v, {
857
878
  className: "text-right",
858
- children: /* @__PURE__ */ k(e, { id: "Pull" })
879
+ children: /* @__PURE__ */ k(t, { id: "Pull" })
859
880
  }),
860
881
  /* @__PURE__ */ k(v, {
861
882
  className: "text-right",
862
- children: /* @__PURE__ */ k(e, { id: "Coverage" })
883
+ children: /* @__PURE__ */ k(t, { id: "Coverage" })
863
884
  })
864
885
  ]
865
886
  }) }), /* @__PURE__ */ k(y, { children: u.map((e) => /* @__PURE__ */ A(S, { children: [
866
887
  /* @__PURE__ */ k(x, {
867
888
  className: "text-xs",
868
- children: a(e.psp)
889
+ children: r(e.psp)
869
890
  }),
870
891
  /* @__PURE__ */ k(x, {
871
892
  className: "text-right tabular-nums",
872
- children: /* @__PURE__ */ k(i, {
893
+ children: /* @__PURE__ */ k(a, {
873
894
  className: "hover:underline",
874
895
  to: d(e.psp, "webhook"),
875
896
  children: e.webhook
@@ -877,7 +898,7 @@ function De({ scope: n, pspKey: a }) {
877
898
  }),
878
899
  /* @__PURE__ */ k(x, {
879
900
  className: "text-right tabular-nums",
880
- children: /* @__PURE__ */ k(i, {
901
+ children: /* @__PURE__ */ k(a, {
881
902
  className: "hover:underline",
882
903
  to: d(e.psp, "pull"),
883
904
  children: e.pull
@@ -890,23 +911,23 @@ function De({ scope: n, pspKey: a }) {
890
911
  ] }, e.psp)) })] })
891
912
  });
892
913
  }
893
- function Oe({ scope: n }) {
894
- let { id: i, text: o } = t(), s = r().adminQueries.widgetMetrics, l = G(n), u = D(s(l.months)), d = D(s(l.reasons)), f = D(s(l.recorded)), p = ge(f.data), m = _e(u.data, p), h = ve(d.data).slice(0, 10);
914
+ function Oe({ scope: e }) {
915
+ let { id: a, text: o } = i(), s = n().adminQueries.widgetMetrics, l = G(e), u = D(s(l.months)), d = D(s(l.reasons)), f = D(s(l.recorded)), p = ge(f.data), m = _e(u.data, p), h = ve(d.data).slice(0, 10);
895
916
  return /* @__PURE__ */ A("section", {
896
917
  className: "flex flex-col gap-3",
897
- "aria-labelledby": i("nmi-history"),
918
+ "aria-labelledby": a("nmi-history"),
898
919
  children: [/* @__PURE__ */ A("div", {
899
920
  className: "flex flex-col gap-1",
900
921
  children: [/* @__PURE__ */ k("h2", {
901
- id: i("nmi-history"),
922
+ id: a("nmi-history"),
902
923
  className: "text-lg font-semibold tracking-tight",
903
- children: /* @__PURE__ */ k(e, { id: "NMI history (before OpenRails recorded attempts)" })
924
+ children: /* @__PURE__ */ k(t, { id: "NMI history (before OpenRails recorded attempts)" })
904
925
  }), /* @__PURE__ */ A("p", {
905
926
  className: "max-w-4xl text-sm text-muted-foreground",
906
927
  children: [
907
- /* @__PURE__ */ k(e, { id: "NMI's own transaction history, read daily and kept 25 months. It counts every sender, OpenRails too once it started. One-off sales mix initial sales, upgrades and retries of declined rebills: the history cannot tell them apart. Scheduled rebills are NMI's own charges, each the first try of its period. Rates count authorizations, not buyers." }),
928
+ /* @__PURE__ */ k(t, { id: "NMI's own transaction history, read daily and kept 25 months. It counts every sender, OpenRails too once it started. One-off sales mix initial sales, upgrades and retries of declined rebills: the history cannot tell them apart. Scheduled rebills are NMI's own charges, each the first try of its period. Rates count authorizations, not buyers." }),
908
929
  " ",
909
- p ? `OpenRails recorded its own attempts from ${E(p, "month")}; from then on the panels above measure them.` : "OpenRails recorded no NMI attempt in this range."
930
+ p ? `OpenRails recorded its own attempts from ${T(p, "month")}; from then on the panels above measure them.` : "OpenRails recorded no NMI attempt in this range."
910
931
  ]
911
932
  })]
912
933
  }), /* @__PURE__ */ A("div", {
@@ -916,42 +937,42 @@ function Oe({ scope: n }) {
916
937
  className: "@min-[56rem]/page:col-span-2",
917
938
  children: u.isPending || f.isPending ? /* @__PURE__ */ k(Y, {}) : m.length === 0 ? /* @__PURE__ */ k(X, { label: o("No NMI history yet: it is read daily.") }) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
918
939
  className: "hover:bg-transparent",
919
- children: [/* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(e, { id: "Month" }) }), W.map((e) => /* @__PURE__ */ k(v, {
940
+ children: [/* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(t, { id: "Month" }) }), W.map((e) => /* @__PURE__ */ k(v, {
920
941
  className: "text-right",
921
942
  children: e.label
922
943
  }, e.value))]
923
- }) }), /* @__PURE__ */ k(y, { children: m.map((t) => /* @__PURE__ */ A(S, {
924
- className: a(t.recorded && "text-muted-foreground"),
944
+ }) }), /* @__PURE__ */ k(y, { children: m.map((e) => /* @__PURE__ */ A(S, {
945
+ className: r(e.recorded && "text-muted-foreground"),
925
946
  children: [/* @__PURE__ */ k(x, { children: /* @__PURE__ */ A("span", {
926
947
  className: "flex items-center gap-2",
927
- children: [E(t.month, "month"), t.month === p && /* @__PURE__ */ k(c, {
948
+ children: [T(e.month, "month"), e.month === p && /* @__PURE__ */ k(c, {
928
949
  variant: "outline",
929
- children: /* @__PURE__ */ k(e, { id: "OpenRails starts" })
950
+ children: /* @__PURE__ */ k(t, { id: "OpenRails starts" })
930
951
  })]
931
952
  }) }), W.map((n) => {
932
- let r = t.kinds[n.value];
953
+ let r = e.kinds[n.value];
933
954
  return /* @__PURE__ */ k(x, {
934
955
  className: "text-right tabular-nums",
935
956
  children: r ? /* @__PURE__ */ A(O, { children: [K(r.refusalRate), /* @__PURE__ */ A("span", {
936
957
  className: "ml-1 text-xs text-muted-foreground",
937
- children: [/* @__PURE__ */ k(e, { id: "of " }), r.authorizations.toLocaleString()]
958
+ children: [/* @__PURE__ */ k(t, { id: "of " }), r.authorizations.toLocaleString()]
938
959
  })] }) : "—"
939
960
  }, n.value);
940
961
  })]
941
- }, t.month)) })] })
962
+ }, e.month)) })] })
942
963
  }), /* @__PURE__ */ k(J, {
943
964
  title: o("Top refusal reasons"),
944
965
  children: d.isPending ? /* @__PURE__ */ k(Y, {}) : h.length === 0 ? /* @__PURE__ */ k(X, { label: o("No refusals in NMI's history.") }) : /* @__PURE__ */ A(C, { children: [/* @__PURE__ */ k(b, { children: /* @__PURE__ */ A(S, {
945
966
  className: "hover:bg-transparent",
946
967
  children: [
947
- /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(e, { id: "Kind / reason" }) }),
968
+ /* @__PURE__ */ k(v, { children: /* @__PURE__ */ k(t, { id: "Kind / reason" }) }),
948
969
  /* @__PURE__ */ k(v, {
949
970
  className: "text-right",
950
- children: /* @__PURE__ */ k(e, { id: "Refused" })
971
+ children: /* @__PURE__ */ k(t, { id: "Refused" })
951
972
  }),
952
973
  /* @__PURE__ */ k(v, {
953
974
  className: "text-right",
954
- children: /* @__PURE__ */ k(e, { id: "Share" })
975
+ children: /* @__PURE__ */ k(t, { id: "Share" })
955
976
  })
956
977
  ]
957
978
  }) }), /* @__PURE__ */ k(y, { children: h.map((e) => /* @__PURE__ */ A(S, { children: [
@@ -961,7 +982,7 @@ function Oe({ scope: n }) {
961
982
  W.find((t) => t.value === e.kind)?.label ?? e.kind,
962
983
  " ",
963
984
  "· ",
964
- e.category
985
+ e.cause
965
986
  ]
966
987
  }), e.reason] }),
967
988
  /* @__PURE__ */ k(x, {
@@ -972,11 +993,11 @@ function Oe({ scope: n }) {
972
993
  className: "text-right tabular-nums",
973
994
  children: K(e.share)
974
995
  })
975
- ] }, `${e.kind}|${e.category}|${e.reason}`)) })] })
996
+ ] }, `${e.kind}|${e.cause}|${e.reason}`)) })] })
976
997
  })]
977
998
  })]
978
999
  });
979
1000
  }
980
1001
  export { be as PaymentHealthPage };
981
1002
 
982
- //# sourceMappingURL=admin-health-CnagC763.js.map
1003
+ //# sourceMappingURL=admin-health-DePsyIlc.js.map