@burdenoff/microfe-subscriberbot 2026.1031.1 → 2026.1102.2

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 (112) hide show
  1. package/dist/stories/pages/NegotiationDetailPage.stories.d.ts +11 -0
  2. package/dist/stories/pages/NegotiationDetailPage.stories.d.ts.map +1 -0
  3. package/dist/stories/pages/NegotiationNewPage.stories.d.ts +9 -0
  4. package/dist/stories/pages/NegotiationNewPage.stories.d.ts.map +1 -0
  5. package/dist/stories/pages/NegotiationsPage.stories.d.ts +11 -0
  6. package/dist/stories/pages/NegotiationsPage.stories.d.ts.map +1 -0
  7. package/dist/stories/pages/ProcurementDetailPage.stories.d.ts +10 -0
  8. package/dist/stories/pages/ProcurementDetailPage.stories.d.ts.map +1 -0
  9. package/dist/stories/pages/ProcurementNewPage.stories.d.ts +9 -0
  10. package/dist/stories/pages/ProcurementNewPage.stories.d.ts.map +1 -0
  11. package/dist/stories/pages/ProcurementPage.stories.d.ts +11 -0
  12. package/dist/stories/pages/ProcurementPage.stories.d.ts.map +1 -0
  13. package/dist/stories/support/negotiationFixtures.d.ts +14 -0
  14. package/dist/stories/support/negotiationFixtures.d.ts.map +1 -0
  15. package/dist/stories/support/procurementFixtures.d.ts +14 -0
  16. package/dist/stories/support/procurementFixtures.d.ts.map +1 -0
  17. package/dist/subscriberbot/SubscriberBotRoutes.d.ts.map +1 -1
  18. package/dist/subscriberbot/SubscriberBotRoutes.js +30 -6
  19. package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
  20. package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +1 -1
  21. package/dist/subscriberbot/admin/AdminDashboardPage.js +166 -146
  22. package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
  23. package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts +4 -0
  24. package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts.map +1 -0
  25. package/dist/subscriberbot/admin/NegotiationDeskPanel.js +210 -0
  26. package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -0
  27. package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts +4 -0
  28. package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +1 -0
  29. package/dist/subscriberbot/admin/ProcurementDeskPanel.js +450 -0
  30. package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -0
  31. package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.d.ts +8 -0
  32. package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.d.ts.map +1 -0
  33. package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +18 -0
  34. package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js.map +1 -0
  35. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts +8 -0
  36. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts.map +1 -0
  37. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +49 -0
  38. package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -0
  39. package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts +13 -0
  40. package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts.map +1 -0
  41. package/dist/subscriberbot/components/negotiations/OutcomeForm.js +112 -0
  42. package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -0
  43. package/dist/subscriberbot/components/negotiations/index.d.ts +5 -0
  44. package/dist/subscriberbot/components/negotiations/index.d.ts.map +1 -0
  45. package/dist/subscriberbot/components/negotiations/index.js +4 -0
  46. package/dist/subscriberbot/components/negotiations/labels.d.ts +16 -0
  47. package/dist/subscriberbot/components/negotiations/labels.d.ts.map +1 -0
  48. package/dist/subscriberbot/components/negotiations/labels.js +179 -0
  49. package/dist/subscriberbot/components/negotiations/labels.js.map +1 -0
  50. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts +12 -0
  51. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +1 -0
  52. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +155 -0
  53. package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -0
  54. package/dist/subscriberbot/components/procurement/ProcurementStatusPill.d.ts +8 -0
  55. package/dist/subscriberbot/components/procurement/ProcurementStatusPill.d.ts.map +1 -0
  56. package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +18 -0
  57. package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js.map +1 -0
  58. package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts +13 -0
  59. package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +1 -0
  60. package/dist/subscriberbot/components/procurement/ProcurementThread.js +51 -0
  61. package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -0
  62. package/dist/subscriberbot/components/procurement/index.d.ts +5 -0
  63. package/dist/subscriberbot/components/procurement/index.d.ts.map +1 -0
  64. package/dist/subscriberbot/components/procurement/index.js +4 -0
  65. package/dist/subscriberbot/components/procurement/labels.d.ts +16 -0
  66. package/dist/subscriberbot/components/procurement/labels.d.ts.map +1 -0
  67. package/dist/subscriberbot/components/procurement/labels.js +154 -0
  68. package/dist/subscriberbot/components/procurement/labels.js.map +1 -0
  69. package/dist/subscriberbot/hooks/useNegotiationApi.d.ts +51 -0
  70. package/dist/subscriberbot/hooks/useNegotiationApi.d.ts.map +1 -0
  71. package/dist/subscriberbot/hooks/useNegotiationApi.js +106 -0
  72. package/dist/subscriberbot/hooks/useNegotiationApi.js.map +1 -0
  73. package/dist/subscriberbot/hooks/useProcurementApi.d.ts +58 -0
  74. package/dist/subscriberbot/hooks/useProcurementApi.d.ts.map +1 -0
  75. package/dist/subscriberbot/hooks/useProcurementApi.js +128 -0
  76. package/dist/subscriberbot/hooks/useProcurementApi.js.map +1 -0
  77. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts +1 -0
  78. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
  79. package/dist/subscriberbot/hooks/useSubscriberBotApi.js +1 -1
  80. package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
  81. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts +11 -0
  82. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts.map +1 -0
  83. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +312 -0
  84. package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -0
  85. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts +11 -0
  86. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts.map +1 -0
  87. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +375 -0
  88. package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -0
  89. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts +10 -0
  90. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts.map +1 -0
  91. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +155 -0
  92. package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -0
  93. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +11 -0
  94. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +1 -0
  95. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +276 -0
  96. package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -0
  97. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +12 -0
  98. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +1 -0
  99. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +362 -0
  100. package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -0
  101. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +11 -0
  102. package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +1 -0
  103. package/dist/subscriberbot/pages/procurement/ProcurementPage.js +156 -0
  104. package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -0
  105. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
  106. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +149 -124
  107. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
  108. package/dist/subscriberbot/types/negotiation.d.ts +101 -0
  109. package/dist/subscriberbot/types/negotiation.d.ts.map +1 -0
  110. package/dist/subscriberbot/types/procurement.d.ts +127 -0
  111. package/dist/subscriberbot/types/procurement.d.ts.map +1 -0
  112. package/package.json +1 -1
@@ -8,14 +8,14 @@ import { useTr as l } from "../../hooks/useTr.js";
8
8
  import { ErrorView as u, LoadingView as d, Section as f } from "../../components/StateViews.js";
9
9
  import { Gauge as p, MiniProgress as m, Timeline as h } from "../../components/viz.js";
10
10
  import "../../components/index.js";
11
- import { useCancelRelationship as g, useCreateAsset as _, useCreateEntitlement as v, useDecisions as y, useFileDownloadUrl as b, useInvoices as x, usePlans as S, useProviders as C, useRelationship as w, useTransitionRelationship as T, useUpdateRelationship as E, useUploadFile as D } from "../../hooks/useSubscriberBotApi.js";
12
- import { DecisionCard as O } from "../../components/decisions/DecisionCard.js";
13
- import { AiDisclaimer as k } from "../../components/decisions/DecisionBanners.js";
11
+ import { useCancelRelationship as g, useCreateAsset as _, useCreateEntitlement as v, useDecisions as y, useFileDownloadUrl as b, useInvoices as x, usePlans as S, useProviders as C, useRelationship as ee, useTransitionRelationship as w, useUpdateRelationship as T, useUploadFile as E } from "../../hooks/useSubscriberBotApi.js";
12
+ import { DecisionCard as D } from "../../components/decisions/DecisionCard.js";
13
+ import { AiDisclaimer as O } from "../../components/decisions/DecisionBanners.js";
14
14
  import "../../components/decisions/index.js";
15
- import { useState as A } from "react";
16
- import { Activity as j, ArrowLeft as M, Ban as N, CalendarClock as P, CreditCard as F, Download as I, Paperclip as L, Pause as R, Pencil as ee, Play as z, Plus as B, ShieldCheck as te, Tag as ne, Wallet as re } from "lucide-react";
17
- import { useParams as ie } from "react-router";
18
- import { Fragment as ae, jsx as V, jsxs as H } from "react/jsx-runtime";
15
+ import { useState as k } from "react";
16
+ import { Activity as A, ArrowLeft as j, Ban as M, Briefcase as N, CalendarClock as P, CreditCard as F, Download as I, Handshake as te, Paperclip as L, Pause as R, Pencil as ne, Play as z, Plus as B, ShieldCheck as re, Tag as ie, Wallet as ae } from "lucide-react";
17
+ import { useParams as oe } from "react-router";
18
+ import { Fragment as se, jsx as V, jsxs as H } from "react/jsx-runtime";
19
19
  import { GlassCard as U } from "@burdenoff/fe-libs/ui";
20
20
  //#region src/subscriberbot/pages/relationships/RelationshipDetailPage.tsx
21
21
  var W = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", G = "mb-1 block text-xs font-medium text-text-secondary", K = [
@@ -52,7 +52,7 @@ var W = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 t
52
52
  RECURRING_PAYMENT: "relationships.kinds.recurringPayment",
53
53
  ENROLLMENT: "relationships.kinds.enrollment",
54
54
  TRIAL: "relationships.kinds.trial"
55
- }, oe = [
55
+ }, ce = [
56
56
  {
57
57
  status: "ACTIVE",
58
58
  labelKey: "relationships.detail.actions.activate",
@@ -69,7 +69,7 @@ var W = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 t
69
69
  status: "EXPIRED",
70
70
  labelKey: "relationships.detail.actions.markExpired",
71
71
  defaultLabel: "Mark expired",
72
- icon: N
72
+ icon: M
73
73
  }
74
74
  ];
75
75
  function X({ label: e, value: t }) {
@@ -84,30 +84,30 @@ function X({ label: e, value: t }) {
84
84
  })]
85
85
  });
86
86
  }
87
- function se(e) {
87
+ function le(e) {
88
88
  return e == null ? "accent" : e >= 66 ? "positive" : e >= 33 ? "warning" : "negative";
89
89
  }
90
- function ce(e) {
90
+ function Z(e) {
91
91
  if (!e) return "";
92
92
  let t = new Date(e);
93
93
  return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
94
94
  }
95
- function le({ relationship: e, onClose: t }) {
96
- let n = l(), r = E(), i = C({ pagination: {
95
+ function ue({ relationship: e, onClose: t }) {
96
+ let n = l(), r = T(), i = C({ pagination: {
97
97
  limit: 100,
98
98
  offset: 0
99
- } }), [a, o] = A(e.label), [s, u] = A(e.providerId ?? ""), [d, f] = A(e.planId ?? ""), [p, m] = A(String(e.amount ?? "")), [h, g] = A(e.currency), [_, v] = A(e.interval), [y, b] = A(ce(e.renewsAt)), [x, w] = A(e.autoRenew), [T, D] = A(e.notes ?? ""), [O, k] = A(e.department ?? ""), [j, M] = A(null), N = S(s || void 0), P = (() => {
99
+ } }), [a, o] = k(e.label), [s, u] = k(e.providerId ?? ""), [d, f] = k(e.planId ?? ""), [p, m] = k(String(e.amount ?? "")), [h, g] = k(e.currency), [_, v] = k(e.interval), [y, b] = k(Z(e.renewsAt)), [x, ee] = k(e.autoRenew), [w, E] = k(e.notes ?? ""), [D, O] = k(e.department ?? ""), [A, j] = k(null), M = S(s || void 0), N = (() => {
100
100
  let t = i.data?.items ?? [];
101
101
  return e.provider && !t.some((t) => t.id === e.provider?.id) ? [e.provider, ...t] : t;
102
- })(), F = N.data ?? [];
102
+ })(), P = M.data ?? [];
103
103
  return /* @__PURE__ */ V(c, {
104
104
  title: n("relationships.detail.editModal.title", "Edit relationship"),
105
105
  onClose: t,
106
106
  maxWidthClassName: "max-w-2xl",
107
107
  children: /* @__PURE__ */ H("form", {
108
108
  onSubmit: (i) => {
109
- if (i.preventDefault(), M(null), !a.trim()) {
110
- M(n("relationships.detail.editModal.labelRequired", "A label is required."));
109
+ if (i.preventDefault(), j(null), !a.trim()) {
110
+ j(n("relationships.detail.editModal.labelRequired", "A label is required."));
111
111
  return;
112
112
  }
113
113
  let o = {
@@ -115,8 +115,8 @@ function le({ relationship: e, onClose: t }) {
115
115
  interval: _,
116
116
  autoRenew: x,
117
117
  currency: h.trim() || "USD",
118
- notes: T.trim(),
119
- department: O.trim(),
118
+ notes: w.trim(),
119
+ department: D.trim(),
120
120
  ...s ? { providerId: s } : {},
121
121
  ...d ? { planId: d } : {},
122
122
  ...p.trim() ? { amount: Number(p) } : {},
@@ -127,14 +127,14 @@ function le({ relationship: e, onClose: t }) {
127
127
  input: o
128
128
  }, {
129
129
  onSuccess: () => t(),
130
- onError: (e) => M(e instanceof Error ? e.message : n("relationships.detail.editModal.error", "Could not update relationship."))
130
+ onError: (e) => j(e instanceof Error ? e.message : n("relationships.detail.editModal.error", "Could not update relationship."))
131
131
  });
132
132
  },
133
133
  className: "space-y-4",
134
134
  children: [
135
- j && /* @__PURE__ */ V("div", {
135
+ A && /* @__PURE__ */ V("div", {
136
136
  className: "rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
137
- children: j
137
+ children: A
138
138
  }),
139
139
  /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("label", {
140
140
  htmlFor: "edit-label",
@@ -163,8 +163,8 @@ function le({ relationship: e, onClose: t }) {
163
163
  id: "edit-department",
164
164
  type: "text",
165
165
  maxLength: 120,
166
- value: O,
167
- onChange: (e) => k(e.target.value),
166
+ value: D,
167
+ onChange: (e) => O(e.target.value),
168
168
  placeholder: n("relationships.detail.editModal.departmentPlaceholder", "e.g. Engineering, Marketing"),
169
169
  className: W
170
170
  })] }),
@@ -184,7 +184,7 @@ function le({ relationship: e, onClose: t }) {
184
184
  children: [/* @__PURE__ */ V("option", {
185
185
  value: "",
186
186
  children: n("relationships.detail.editModal.providerNone", "— None —")
187
- }), P.map((e) => /* @__PURE__ */ V("option", {
187
+ }), N.map((e) => /* @__PURE__ */ V("option", {
188
188
  value: e.id,
189
189
  children: e.name
190
190
  }, e.id))]
@@ -197,11 +197,11 @@ function le({ relationship: e, onClose: t }) {
197
197
  value: d,
198
198
  onChange: (e) => f(e.target.value),
199
199
  className: W,
200
- disabled: !s || F.length === 0,
200
+ disabled: !s || P.length === 0,
201
201
  children: [/* @__PURE__ */ V("option", {
202
202
  value: "",
203
203
  children: n("relationships.detail.editModal.planNone", "— None —")
204
- }), F.map((e) => /* @__PURE__ */ V("option", {
204
+ }), P.map((e) => /* @__PURE__ */ V("option", {
205
205
  value: e.id,
206
206
  children: e.name
207
207
  }, e.id))]
@@ -270,7 +270,7 @@ function le({ relationship: e, onClose: t }) {
270
270
  children: [/* @__PURE__ */ V("input", {
271
271
  type: "checkbox",
272
272
  checked: x,
273
- onChange: (e) => w(e.target.checked),
273
+ onChange: (e) => ee(e.target.checked),
274
274
  className: "size-4 rounded border-border-subtle"
275
275
  }), n("relationships.detail.editModal.autoRenews", "Auto-renews")]
276
276
  })
@@ -282,8 +282,8 @@ function le({ relationship: e, onClose: t }) {
282
282
  children: n("relationships.detail.editModal.notesLabel", "Notes")
283
283
  }), /* @__PURE__ */ V("textarea", {
284
284
  id: "edit-notes",
285
- value: T,
286
- onChange: (e) => D(e.target.value),
285
+ value: w,
286
+ onChange: (e) => E(e.target.value),
287
287
  rows: 3,
288
288
  className: W
289
289
  })] }),
@@ -305,8 +305,8 @@ function le({ relationship: e, onClose: t }) {
305
305
  })
306
306
  });
307
307
  }
308
- function ue({ relationshipId: e, onClose: t }) {
309
- let n = l(), r = v(), [i, a] = A(""), [o, s] = A("FEATURE_ACCESS"), [u, d] = A(""), [f, p] = A(""), [m, h] = A(""), [g, _] = A(null);
308
+ function de({ relationshipId: e, onClose: t }) {
309
+ let n = l(), r = v(), [i, a] = k(""), [o, s] = k("FEATURE_ACCESS"), [u, d] = k(""), [f, p] = k(""), [m, h] = k(""), [g, _] = k(null);
310
310
  return /* @__PURE__ */ V(c, {
311
311
  title: n("relationships.detail.addEntitlementModal.title", "Add entitlement"),
312
312
  onClose: t,
@@ -427,8 +427,8 @@ function ue({ relationshipId: e, onClose: t }) {
427
427
  })
428
428
  });
429
429
  }
430
- function de({ relationshipId: e, onClose: t }) {
431
- let n = l(), r = _(), { uploadFile: i, progress: a, isUploading: o } = D(), [s, u] = A(""), [d, f] = A("RECEIPT"), [p, m] = A(null), [h, g] = A(""), [v, y] = A(null), b = o || r.isPending;
430
+ function fe({ relationshipId: e, onClose: t }) {
431
+ let n = l(), r = _(), { uploadFile: i, progress: a, isUploading: o } = E(), [s, u] = k(""), [d, f] = k("RECEIPT"), [p, m] = k(null), [h, g] = k(""), [v, y] = k(null), b = o || r.isPending;
432
432
  return /* @__PURE__ */ V(c, {
433
433
  title: n("relationships.detail.attachAssetModal.title", "Attach asset"),
434
434
  onClose: t,
@@ -545,8 +545,8 @@ function de({ relationshipId: e, onClose: t }) {
545
545
  })
546
546
  });
547
547
  }
548
- function fe({ asset: e }) {
549
- let t = l(), n = b(), [a, o] = A(!1);
548
+ function pe({ asset: e }) {
549
+ let t = l(), n = b(), [a, o] = k(!1);
550
550
  return /* @__PURE__ */ H("div", {
551
551
  className: "flex items-center justify-between gap-3 p-3",
552
552
  children: [/* @__PURE__ */ H("div", {
@@ -590,7 +590,7 @@ function fe({ asset: e }) {
590
590
  })]
591
591
  });
592
592
  }
593
- function pe({ invoice: e }) {
593
+ function me({ invoice: e }) {
594
594
  let t = l(), a = e.number ?? t("relationships.detail.invoiceRow.unnumbered", "Unnumbered invoice");
595
595
  return /* @__PURE__ */ H("div", {
596
596
  className: "flex items-center justify-between gap-3 p-3",
@@ -612,14 +612,14 @@ function pe({ invoice: e }) {
612
612
  })]
613
613
  });
614
614
  }
615
- function Z() {
616
- let c = l(), { id: _ } = ie(), { navigateTo: v } = e(), { data: b, isLoading: S, isError: C, refetch: E } = w(_), D = T(), I = g(), [L, R] = A(null), [z, W] = A(!1), [G, K] = A(!1), [q, J] = A(!1), ce = x({
615
+ function Q() {
616
+ let c = l(), { id: _ } = oe(), { navigateTo: v } = e(), { data: b, isLoading: S, isError: C, refetch: T } = ee(_), E = w(), I = g(), [L, R] = k(null), [z, W] = k(!1), [G, K] = k(!1), [q, J] = k(!1), Z = x({
617
617
  relationshipId: _,
618
618
  pagination: {
619
619
  limit: 50,
620
620
  offset: 0
621
621
  }
622
- }, { enabled: !!_ }), Z = y({
622
+ }, { enabled: !!_ }), Q = y({
623
623
  relationshipId: _,
624
624
  status: "PROPOSED"
625
625
  }, { enabled: !!_ });
@@ -631,7 +631,7 @@ function Z() {
631
631
  title: c("relationships.title", "Relationship"),
632
632
  children: /* @__PURE__ */ V(u, {
633
633
  message: c("relationships.detail.error", "Could not load this relationship."),
634
- onRetry: () => void E()
634
+ onRetry: () => void T()
635
635
  })
636
636
  });
637
637
  if (!b) return /* @__PURE__ */ V(t, {
@@ -648,52 +648,77 @@ function Z() {
648
648
  })
649
649
  })
650
650
  });
651
- let Q = b, $ = D.isPending || I.isPending, me = (e) => {
652
- R(null), D.mutate({
653
- id: Q.id,
651
+ let $ = b, he = E.isPending || I.isPending, ge = (e) => {
652
+ R(null), E.mutate({
653
+ id: $.id,
654
654
  status: e
655
655
  }, { onError: (e) => R(e instanceof Error ? e.message : c("relationships.detail.transitionError", "Transition failed")) });
656
- }, he = () => {
657
- R(null), I.mutate(Q.id, { onError: (e) => R(e instanceof Error ? e.message : c("relationships.detail.cancelError", "Cancel failed")) });
658
- }, ge = [...Q.renewalEvents ?? []].sort((e, t) => new Date(e.occursAt).getTime() - new Date(t.occursAt).getTime()).map((e) => {
656
+ }, _e = () => {
657
+ R(null), I.mutate($.id, { onError: (e) => R(e instanceof Error ? e.message : c("relationships.detail.cancelError", "Cancel failed")) });
658
+ }, ve = [...$.renewalEvents ?? []].sort((e, t) => new Date(e.occursAt).getTime() - new Date(t.occursAt).getTime()).map((e) => {
659
659
  let t = new Date(e.occursAt).getTime(), a = !Number.isNaN(t) && t > Date.now();
660
660
  return {
661
661
  title: i(e.eventType),
662
662
  sub: `${r(e.occursAt)}${e.detail ? ` · ${e.detail}` : ""}`,
663
- meta: e.amount == null ? void 0 : n(e.amount, e.currency ?? Q.currency),
663
+ meta: e.amount == null ? void 0 : n(e.amount, e.currency ?? $.currency),
664
664
  tone: a ? "warning" : "muted"
665
665
  };
666
- }), _e = Q.autoRenew ? /* @__PURE__ */ V("span", {
666
+ }), ye = $.autoRenew ? /* @__PURE__ */ V("span", {
667
667
  className: "inline-flex items-center rounded-full bg-status-success-bg-subtle px-2 py-0.5 text-xs font-medium text-status-success-text",
668
668
  children: c("relationships.detail.autoRenewOn", "On")
669
669
  }) : /* @__PURE__ */ V("span", {
670
670
  className: "inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary",
671
671
  children: c("relationships.detail.autoRenewOff", "Off")
672
- }), ve = oe.filter((e) => e.status !== Q.status), ye = Q.plan?.features ?? [];
672
+ }), be = ce.filter((e) => e.status !== $.status), xe = $.plan?.features ?? [];
673
673
  return /* @__PURE__ */ H(t, {
674
- title: Q.label,
675
- description: Q.provider?.name ?? c(Y[Q.kind], i(Q.kind)),
674
+ title: $.label,
675
+ description: $.provider?.name ?? c(Y[$.kind], i($.kind)),
676
676
  actions: /* @__PURE__ */ H("div", {
677
677
  className: "flex items-center gap-2",
678
- children: [/* @__PURE__ */ H("button", {
679
- type: "button",
680
- onClick: () => W(!0),
681
- className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
682
- children: [
683
- /* @__PURE__ */ V(ee, { className: "h-4 w-4" }),
684
- " ",
685
- c("relationships.detail.edit", "Edit")
686
- ]
687
- }), /* @__PURE__ */ H("button", {
688
- type: "button",
689
- onClick: () => v("/relationships"),
690
- className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
691
- children: [
692
- /* @__PURE__ */ V(M, { className: "h-4 w-4" }),
693
- " ",
694
- c("relationships.detail.back", "Back")
695
- ]
696
- })]
678
+ children: [
679
+ /* @__PURE__ */ H("button", {
680
+ type: "button",
681
+ onClick: () => W(!0),
682
+ className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
683
+ children: [
684
+ /* @__PURE__ */ V(ne, { className: "h-4 w-4" }),
685
+ " ",
686
+ c("relationships.detail.edit", "Edit")
687
+ ]
688
+ }),
689
+ /* @__PURE__ */ H("button", {
690
+ type: "button",
691
+ "data-testid": "negotiate-bill",
692
+ onClick: () => v(`/negotiations/new?relationshipId=${encodeURIComponent($.id)}`),
693
+ className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
694
+ children: [
695
+ /* @__PURE__ */ V(te, { className: "h-4 w-4" }),
696
+ " ",
697
+ c("relationships.detail.negotiate", "Negotiate this bill")
698
+ ]
699
+ }),
700
+ /* @__PURE__ */ H("button", {
701
+ type: "button",
702
+ "data-testid": "request-procurement",
703
+ onClick: () => v(`/procurement/new?relationshipId=${encodeURIComponent($.id)}`),
704
+ className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
705
+ children: [
706
+ /* @__PURE__ */ V(N, { className: "h-4 w-4" }),
707
+ " ",
708
+ c("relationships.detail.procurement", "Ask an expert to negotiate")
709
+ ]
710
+ }),
711
+ /* @__PURE__ */ H("button", {
712
+ type: "button",
713
+ onClick: () => v("/relationships"),
714
+ className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
715
+ children: [
716
+ /* @__PURE__ */ V(j, { className: "h-4 w-4" }),
717
+ " ",
718
+ c("relationships.detail.back", "Back")
719
+ ]
720
+ })
721
+ ]
697
722
  }),
698
723
  children: [
699
724
  /* @__PURE__ */ V(U, {
@@ -707,42 +732,42 @@ function Z() {
707
732
  children: [
708
733
  /* @__PURE__ */ V("p", {
709
734
  className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
710
- children: c(Y[Q.kind], i(Q.kind))
735
+ children: c(Y[$.kind], i($.kind))
711
736
  }),
712
737
  /* @__PURE__ */ H("div", {
713
738
  className: "mt-2 flex flex-wrap items-center gap-3",
714
739
  children: [/* @__PURE__ */ H("span", {
715
740
  className: "text-3xl font-bold tabular-nums text-text-primary",
716
- children: [n(Q.amount, Q.currency), /* @__PURE__ */ V("span", {
741
+ children: [n($.amount, $.currency), /* @__PURE__ */ V("span", {
717
742
  className: "text-base font-normal text-text-secondary",
718
- children: a(Q.interval)
743
+ children: a($.interval)
719
744
  })]
720
- }), /* @__PURE__ */ V(o, { status: Q.status })]
745
+ }), /* @__PURE__ */ V(o, { status: $.status })]
721
746
  }),
722
747
  /* @__PURE__ */ H("div", {
723
748
  className: "mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-text-secondary",
724
749
  children: [
725
750
  /* @__PURE__ */ H("span", {
726
751
  className: "inline-flex items-center gap-1.5",
727
- children: [/* @__PURE__ */ V(P, { className: "h-3.5 w-3.5" }), Q.renewsAt ? c("relationships.detail.renews", "Renews {{date}}", { date: r(Q.renewsAt) }) : c("relationships.detail.noRenewalScheduled", "No renewal scheduled")]
752
+ children: [/* @__PURE__ */ V(P, { className: "h-3.5 w-3.5" }), $.renewsAt ? c("relationships.detail.renews", "Renews {{date}}", { date: r($.renewsAt) }) : c("relationships.detail.noRenewalScheduled", "No renewal scheduled")]
728
753
  }),
729
754
  /* @__PURE__ */ H("span", {
730
755
  className: "inline-flex items-center gap-1.5",
731
- children: [/* @__PURE__ */ V(te, { className: "h-3.5 w-3.5" }), i(Q.discoverySource)]
756
+ children: [/* @__PURE__ */ V(re, { className: "h-3.5 w-3.5" }), i($.discoverySource)]
732
757
  }),
733
758
  /* @__PURE__ */ H("span", {
734
759
  className: "inline-flex items-center gap-1.5",
735
760
  children: [
736
761
  c("relationships.detail.autoRenew", "Auto-renew"),
737
762
  " ",
738
- _e
763
+ ye
739
764
  ]
740
765
  })
741
766
  ]
742
767
  }),
743
- Q.tags.length > 0 && /* @__PURE__ */ H("div", {
768
+ $.tags.length > 0 && /* @__PURE__ */ H("div", {
744
769
  className: "mt-3 flex flex-wrap items-center gap-2",
745
- children: [/* @__PURE__ */ V(ne, { className: "h-3.5 w-3.5 text-text-secondary" }), Q.tags.map((e) => /* @__PURE__ */ V("span", {
770
+ children: [/* @__PURE__ */ V(ie, { className: "h-3.5 w-3.5 text-text-secondary" }), $.tags.map((e) => /* @__PURE__ */ V("span", {
746
771
  className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
747
772
  children: e
748
773
  }, e))]
@@ -750,12 +775,12 @@ function Z() {
750
775
  ]
751
776
  }), /* @__PURE__ */ H("div", {
752
777
  className: "flex shrink-0 flex-wrap gap-2 lg:flex-col lg:items-stretch",
753
- children: [ve.map((e) => {
778
+ children: [be.map((e) => {
754
779
  let t = e.icon;
755
780
  return /* @__PURE__ */ H("button", {
756
781
  type: "button",
757
- disabled: $,
758
- onClick: () => me(e.status),
782
+ disabled: he,
783
+ onClick: () => ge(e.status),
759
784
  className: "inline-flex items-center justify-center gap-1.5 rounded-lg border border-border-subtle bg-bg-surface px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50",
760
785
  children: [
761
786
  /* @__PURE__ */ V(t, { className: "h-3.5 w-3.5" }),
@@ -763,13 +788,13 @@ function Z() {
763
788
  c(e.labelKey, e.defaultLabel)
764
789
  ]
765
790
  }, e.status);
766
- }), Q.status !== "CANCELLED" && /* @__PURE__ */ H("button", {
791
+ }), $.status !== "CANCELLED" && /* @__PURE__ */ H("button", {
767
792
  type: "button",
768
- disabled: $,
769
- onClick: he,
793
+ disabled: he,
794
+ onClick: _e,
770
795
  className: "inline-flex items-center justify-center gap-1.5 rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-3 py-1.5 text-xs font-medium text-status-error-text hover:opacity-90 disabled:opacity-50",
771
796
  children: [
772
- /* @__PURE__ */ V(N, { className: "h-3.5 w-3.5" }),
797
+ /* @__PURE__ */ V(M, { className: "h-3.5 w-3.5" }),
773
798
  " ",
774
799
  c("relationships.detail.actions.cancel", "Cancel")
775
800
  ]
@@ -805,28 +830,28 @@ function Z() {
805
830
  children: [
806
831
  /* @__PURE__ */ V(X, {
807
832
  label: c("relationships.detail.info.plan", "Plan"),
808
- value: Q.plan?.name ?? "—"
833
+ value: $.plan?.name ?? "—"
809
834
  }),
810
835
  /* @__PURE__ */ V(X, {
811
836
  label: c("relationships.detail.info.price", "Price"),
812
- value: /* @__PURE__ */ H(ae, { children: [n(Q.amount, Q.currency), /* @__PURE__ */ V("span", {
837
+ value: /* @__PURE__ */ H(se, { children: [n($.amount, $.currency), /* @__PURE__ */ V("span", {
813
838
  className: "font-normal text-text-secondary",
814
- children: a(Q.interval)
839
+ children: a($.interval)
815
840
  })] })
816
841
  }),
817
842
  /* @__PURE__ */ V(X, {
818
843
  label: c("relationships.detail.info.billingInterval", "Billing interval"),
819
- value: i(Q.interval)
844
+ value: i($.interval)
820
845
  }),
821
846
  /* @__PURE__ */ V(X, {
822
847
  label: c("relationships.detail.info.provider", "Provider"),
823
- value: Q.provider?.name ?? "—"
848
+ value: $.provider?.name ?? "—"
824
849
  })
825
850
  ]
826
851
  }),
827
- ye.length > 0 && /* @__PURE__ */ V("div", {
852
+ xe.length > 0 && /* @__PURE__ */ V("div", {
828
853
  className: "mt-3 flex flex-wrap gap-1.5",
829
- children: ye.map((e) => /* @__PURE__ */ V("span", {
854
+ children: xe.map((e) => /* @__PURE__ */ V("span", {
830
855
  className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
831
856
  children: e
832
857
  }, e))
@@ -838,7 +863,7 @@ function Z() {
838
863
  children: [/* @__PURE__ */ H("div", {
839
864
  className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
840
865
  children: [
841
- /* @__PURE__ */ V(re, { className: "h-4 w-4 text-text-secondary" }),
866
+ /* @__PURE__ */ V(ae, { className: "h-4 w-4 text-text-secondary" }),
842
867
  " ",
843
868
  c("relationships.detail.sections.paymentBilling", "Payment & billing")
844
869
  ]
@@ -847,36 +872,36 @@ function Z() {
847
872
  children: [
848
873
  /* @__PURE__ */ V(X, {
849
874
  label: c("relationships.detail.info.currency", "Currency"),
850
- value: Q.currency
875
+ value: $.currency
851
876
  }),
852
877
  /* @__PURE__ */ V(X, {
853
878
  label: c("relationships.detail.info.autoRenew", "Auto-renew"),
854
- value: _e
879
+ value: ye
855
880
  }),
856
881
  /* @__PURE__ */ V(X, {
857
882
  label: c("relationships.detail.info.nextRenewal", "Next renewal"),
858
- value: Q.renewsAt ? r(Q.renewsAt) : "—"
883
+ value: $.renewsAt ? r($.renewsAt) : "—"
859
884
  }),
860
885
  /* @__PURE__ */ V(X, {
861
886
  label: c("relationships.detail.info.started", "Started"),
862
- value: Q.startedAt ? r(Q.startedAt) : "—"
887
+ value: $.startedAt ? r($.startedAt) : "—"
863
888
  }),
864
- Q.trialEndsAt && /* @__PURE__ */ V(X, {
889
+ $.trialEndsAt && /* @__PURE__ */ V(X, {
865
890
  label: c("relationships.detail.info.trialEnds", "Trial ends"),
866
- value: r(Q.trialEndsAt)
891
+ value: r($.trialEndsAt)
867
892
  })
868
893
  ]
869
894
  })]
870
895
  })]
871
896
  }),
872
- (Z.data?.items.length ?? 0) > 0 && /* @__PURE__ */ H(f, {
897
+ (Q.data?.items.length ?? 0) > 0 && /* @__PURE__ */ H(f, {
873
898
  className: "mt-0",
874
899
  title: c("relationships.detail.sections.aiRecommendations", "AI recommendations"),
875
900
  description: c("relationships.detail.sections.aiRecommendationsDescription", "Open recommendations about this subscription. You can also make any of these changes by hand above."),
876
- children: [/* @__PURE__ */ V(k, { className: "mb-3" }), /* @__PURE__ */ V("div", {
901
+ children: [/* @__PURE__ */ V(O, { className: "mb-3" }), /* @__PURE__ */ V("div", {
877
902
  className: "grid grid-cols-1 gap-3",
878
903
  "data-testid": "relationship-decisions",
879
- children: Z.data?.items.map((e) => /* @__PURE__ */ V(O, { decision: e }, e.id))
904
+ children: Q.data?.items.map((e) => /* @__PURE__ */ V(D, { decision: e }, e.id))
880
905
  })]
881
906
  }),
882
907
  /* @__PURE__ */ V(f, {
@@ -893,13 +918,13 @@ function Z() {
893
918
  c("relationships.detail.sections.addEntitlement", "Add entitlement")
894
919
  ]
895
920
  }),
896
- children: !Q.entitlements || Q.entitlements.length === 0 ? /* @__PURE__ */ V(s, {
921
+ children: !$.entitlements || $.entitlements.length === 0 ? /* @__PURE__ */ V(s, {
897
922
  illustration: "empty-data",
898
923
  title: c("relationships.detail.empty.noEntitlementsTitle", "No entitlements"),
899
924
  description: c("relationships.detail.empty.noEntitlementsDescription", "Entitlements (seats, quotas, feature access) will appear here.")
900
925
  }) : /* @__PURE__ */ V("div", {
901
926
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
902
- children: Q.entitlements.map((e) => {
927
+ children: $.entitlements.map((e) => {
903
928
  let t = e.quota != null && e.quota > 0;
904
929
  return /* @__PURE__ */ H(U, {
905
930
  treatment: "plain",
@@ -956,7 +981,7 @@ function Z() {
956
981
  ]
957
982
  }),
958
983
  children: (() => {
959
- let e = Q.assets ?? [], t = ce.data?.items ?? [];
984
+ let e = $.assets ?? [], t = Z.data?.items ?? [];
960
985
  return e.length > 0 || t.length > 0 ? /* @__PURE__ */ V(U, {
961
986
  treatment: "plain",
962
987
  className: "divide-y divide-border-subtle p-0",
@@ -968,7 +993,7 @@ function Z() {
968
993
  kind: "invoice",
969
994
  sort: new Date(e.createdAt).getTime() || 0,
970
995
  invoice: e
971
- }))].sort((e, t) => t.sort - e.sort).map((e) => e.kind === "asset" ? /* @__PURE__ */ V(fe, { asset: e.asset }, `a-${e.asset.id}`) : /* @__PURE__ */ V(pe, { invoice: e.invoice }, `i-${e.invoice.id}`))
996
+ }))].sort((e, t) => t.sort - e.sort).map((e) => e.kind === "asset" ? /* @__PURE__ */ V(pe, { asset: e.asset }, `a-${e.asset.id}`) : /* @__PURE__ */ V(me, { invoice: e.invoice }, `i-${e.invoice.id}`))
972
997
  }) : /* @__PURE__ */ V(s, {
973
998
  illustration: "empty-data",
974
999
  title: c("relationships.detail.empty.noAssetsTitle", "No assets attached"),
@@ -976,7 +1001,7 @@ function Z() {
976
1001
  });
977
1002
  })()
978
1003
  }),
979
- Q.notes && /* @__PURE__ */ H(U, {
1004
+ $.notes && /* @__PURE__ */ H(U, {
980
1005
  treatment: "plain",
981
1006
  className: "p-4",
982
1007
  children: [/* @__PURE__ */ V("p", {
@@ -984,7 +1009,7 @@ function Z() {
984
1009
  children: c("relationships.detail.sections.notes", "Notes")
985
1010
  }), /* @__PURE__ */ V("p", {
986
1011
  className: "mt-1 whitespace-pre-wrap text-sm text-text-primary",
987
- children: Q.notes
1012
+ children: $.notes
988
1013
  })]
989
1014
  })
990
1015
  ]
@@ -996,18 +1021,18 @@ function Z() {
996
1021
  children: [/* @__PURE__ */ H("div", {
997
1022
  className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
998
1023
  children: [
999
- /* @__PURE__ */ V(j, { className: "h-4 w-4 text-text-secondary" }),
1024
+ /* @__PURE__ */ V(A, { className: "h-4 w-4 text-text-secondary" }),
1000
1025
  " ",
1001
1026
  c("relationships.detail.sections.healthScore", "Health score")
1002
1027
  ]
1003
- }), Q.healthScore == null ? /* @__PURE__ */ V("p", {
1028
+ }), $.healthScore == null ? /* @__PURE__ */ V("p", {
1004
1029
  className: "mt-4 text-sm text-text-secondary",
1005
1030
  children: c("relationships.detail.empty.noHealthScore", "Not scored yet. A health score appears once Subscriber Bot has enough signal.")
1006
1031
  }) : /* @__PURE__ */ H("div", {
1007
1032
  className: "mt-4 flex flex-col items-center",
1008
1033
  children: [
1009
1034
  /* @__PURE__ */ V(p, {
1010
- value: Q.healthScore,
1035
+ value: $.healthScore,
1011
1036
  max: 100,
1012
1037
  size: 160,
1013
1038
  label: c("relationships.detail.outOf100", "of 100")
@@ -1015,9 +1040,9 @@ function Z() {
1015
1040
  /* @__PURE__ */ V("div", {
1016
1041
  className: "mt-2 w-full",
1017
1042
  children: /* @__PURE__ */ V(m, {
1018
- value: Q.healthScore,
1043
+ value: $.healthScore,
1019
1044
  max: 100,
1020
- tone: se(Q.healthScore)
1045
+ tone: le($.healthScore)
1021
1046
  })
1022
1047
  }),
1023
1048
  /* @__PURE__ */ V("p", {
@@ -1043,7 +1068,7 @@ function Z() {
1043
1068
  className: "mt-0.5 text-xs text-text-secondary",
1044
1069
  children: c("relationships.detail.sections.renewalTimelineDescription", "Detected renewals and price changes")
1045
1070
  }),
1046
- ge.length === 0 ? /* @__PURE__ */ V("div", {
1071
+ ve.length === 0 ? /* @__PURE__ */ V("div", {
1047
1072
  className: "mt-4",
1048
1073
  children: /* @__PURE__ */ V(s, {
1049
1074
  illustration: "empty-calendar",
@@ -1051,29 +1076,29 @@ function Z() {
1051
1076
  description: c("relationships.detail.empty.noRenewalEventsDescription", "Renewals and price changes will appear here as they're detected.")
1052
1077
  })
1053
1078
  }) : /* @__PURE__ */ V(h, {
1054
- items: ge,
1079
+ items: ve,
1055
1080
  className: "mt-4"
1056
1081
  })
1057
1082
  ]
1058
1083
  })]
1059
1084
  })]
1060
1085
  }),
1061
- z && /* @__PURE__ */ V(le, {
1062
- relationship: Q,
1086
+ z && /* @__PURE__ */ V(ue, {
1087
+ relationship: $,
1063
1088
  onClose: () => W(!1)
1064
1089
  }),
1065
- G && /* @__PURE__ */ V(ue, {
1066
- relationshipId: Q.id,
1090
+ G && /* @__PURE__ */ V(de, {
1091
+ relationshipId: $.id,
1067
1092
  onClose: () => K(!1)
1068
1093
  }),
1069
- q && /* @__PURE__ */ V(de, {
1070
- relationshipId: Q.id,
1094
+ q && /* @__PURE__ */ V(fe, {
1095
+ relationshipId: $.id,
1071
1096
  onClose: () => J(!1)
1072
1097
  })
1073
1098
  ]
1074
1099
  });
1075
1100
  }
1076
1101
  //#endregion
1077
- export { Z as RelationshipDetailPage };
1102
+ export { Q as RelationshipDetailPage };
1078
1103
 
1079
1104
  //# sourceMappingURL=RelationshipDetailPage.js.map