@burdenoff/microfe-subscriberbot 2026.1023.1 → 2026.1029.1

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 (46) hide show
  1. package/dist/subscriberbot/admin/AdminDashboardPage.js +5 -5
  2. package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
  3. package/dist/subscriberbot/components/PostureOptions.d.ts +10 -0
  4. package/dist/subscriberbot/components/PostureOptions.d.ts.map +1 -0
  5. package/dist/subscriberbot/components/PostureOptions.js +20 -0
  6. package/dist/subscriberbot/components/PostureOptions.js.map +1 -0
  7. package/dist/subscriberbot/components/index.d.ts +2 -0
  8. package/dist/subscriberbot/components/index.d.ts.map +1 -1
  9. package/dist/subscriberbot/components/index.js +1 -0
  10. package/dist/subscriberbot/hooks/index.d.ts +1 -0
  11. package/dist/subscriberbot/hooks/index.d.ts.map +1 -1
  12. package/dist/subscriberbot/hooks/index.js +2 -1
  13. package/dist/subscriberbot/hooks/useAutonomousAgentMode.d.ts +15 -0
  14. package/dist/subscriberbot/hooks/useAutonomousAgentMode.d.ts.map +1 -0
  15. package/dist/subscriberbot/hooks/useAutonomousAgentMode.js +13 -0
  16. package/dist/subscriberbot/hooks/useAutonomousAgentMode.js.map +1 -0
  17. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
  18. package/dist/subscriberbot/hooks/useSubscriberBotApi.js +9 -0
  19. package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
  20. package/dist/subscriberbot/pages/AssetVaultPage.js +16 -16
  21. package/dist/subscriberbot/pages/DashboardPage.js +23 -23
  22. package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
  23. package/dist/subscriberbot/pages/InboxPage.js +62 -62
  24. package/dist/subscriberbot/pages/InsightsPage.js +14 -14
  25. package/dist/subscriberbot/pages/InvoicesPage.js +66 -66
  26. package/dist/subscriberbot/pages/WorkflowsPage.js +20 -20
  27. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +1 -1
  28. package/dist/subscriberbot/pages/agents/AgentDetailPage.js +184 -182
  29. package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
  30. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +1 -1
  31. package/dist/subscriberbot/pages/agents/AgentNewPage.js +77 -79
  32. package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
  33. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +1 -1
  34. package/dist/subscriberbot/pages/agents/AgentsListPage.js +134 -133
  35. package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
  36. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +64 -64
  37. package/dist/subscriberbot/pages/providers/ProviderNewPage.js +3 -3
  38. package/dist/subscriberbot/pages/providers/ProvidersListPage.js +18 -18
  39. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
  40. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +122 -89
  41. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
  42. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +6 -6
  43. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +7 -7
  44. package/dist/subscriberbot/types/index.d.ts +1 -0
  45. package/dist/subscriberbot/types/index.d.ts.map +1 -1
  46. package/package.json +1 -1
@@ -4,11 +4,11 @@ import { formatCurrency as n, formatDate as r, formatEnumLabel as i, formatInter
4
4
  import { StatusBadge as o } from "../../components/StatusBadge.js";
5
5
  import { EmptyState as s } from "../../components/EmptyState.js";
6
6
  import { Modal as c } from "../../components/Modal.js";
7
- import { ErrorView as l, LoadingView as u, Section as d } from "../../components/StateViews.js";
8
- import { Gauge as f, MiniProgress as p, Timeline as m } from "../../components/viz.js";
7
+ import { useTr as l } from "../../hooks/useTr.js";
8
+ import { ErrorView as u, LoadingView as d, Section as f } from "../../components/StateViews.js";
9
+ import { Gauge as p, MiniProgress as m, Timeline as h } from "../../components/viz.js";
9
10
  import "../../components/index.js";
10
- import { useCancelRelationship as h, useCreateAsset as g, useCreateEntitlement as _, useFileDownloadUrl as v, usePlans as y, useProviders as b, useRelationship as x, useTransitionRelationship as S, useUpdateRelationship as C, useUploadFile as w } from "../../hooks/useSubscriberBotApi.js";
11
- import { useTr as T } from "../../hooks/useTr.js";
11
+ import { useCancelRelationship as g, useCreateAsset as _, useCreateEntitlement as v, useFileDownloadUrl as y, usePlans as b, useProviders as x, useRelationship as S, useTransitionRelationship as C, useUpdateRelationship as w, useUploadFile as T } from "../../hooks/useSubscriberBotApi.js";
12
12
  import { useState as E } from "react";
13
13
  import { Activity as D, ArrowLeft as O, Ban as k, CalendarClock as A, CreditCard as j, Download as M, Paperclip as N, Pause as P, Pencil as F, Play as I, Plus as L, ShieldCheck as R, Tag as ee, Wallet as te } from "lucide-react";
14
14
  import { useParams as ne } from "react-router";
@@ -90,10 +90,10 @@ function Y(e) {
90
90
  return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
91
91
  }
92
92
  function oe({ relationship: e, onClose: t }) {
93
- let n = T(), r = C(), i = b({ pagination: {
93
+ let n = l(), r = w(), i = x({ pagination: {
94
94
  limit: 100,
95
95
  offset: 0
96
- } }), [a, o] = E(e.label), [s, l] = E(e.providerId ?? ""), [u, d] = E(e.planId ?? ""), [f, p] = E(String(e.amount ?? "")), [m, h] = E(e.currency), [g, _] = E(e.interval), [v, x] = E(Y(e.renewsAt)), [S, w] = E(e.autoRenew), [D, O] = E(e.healthScore == null ? "" : String(e.healthScore)), [k, A] = E(e.notes ?? ""), [j, M] = E(null), N = y(s || void 0), P = (() => {
96
+ } }), [a, o] = E(e.label), [s, u] = E(e.providerId ?? ""), [d, f] = E(e.planId ?? ""), [p, m] = E(String(e.amount ?? "")), [h, g] = E(e.currency), [_, v] = E(e.interval), [y, S] = E(Y(e.renewsAt)), [C, T] = E(e.autoRenew), [D, O] = E(e.healthScore == null ? "" : String(e.healthScore)), [k, A] = E(e.notes ?? ""), [j, M] = E(null), N = b(s || void 0), P = (() => {
97
97
  let t = i.data?.items ?? [];
98
98
  return e.provider && !t.some((t) => t.id === e.provider?.id) ? [e.provider, ...t] : t;
99
99
  })(), F = N.data ?? [];
@@ -109,15 +109,15 @@ function oe({ relationship: e, onClose: t }) {
109
109
  }
110
110
  let o = {
111
111
  label: a.trim(),
112
- interval: g,
113
- autoRenew: S,
114
- currency: m.trim() || "USD",
112
+ interval: _,
113
+ autoRenew: C,
114
+ currency: h.trim() || "USD",
115
115
  notes: k.trim(),
116
116
  ...s ? { providerId: s } : {},
117
- ...u ? { planId: u } : {},
118
- ...f.trim() ? { amount: Number(f) } : {},
117
+ ...d ? { planId: d } : {},
118
+ ...p.trim() ? { amount: Number(p) } : {},
119
119
  ...D.trim() ? { healthScore: Number(D) } : {},
120
- ...v ? { renewsAt: new Date(v).toISOString() } : {}
120
+ ...y ? { renewsAt: new Date(y).toISOString() } : {}
121
121
  };
122
122
  r.mutate({
123
123
  id: e.id,
@@ -162,7 +162,7 @@ function oe({ relationship: e, onClose: t }) {
162
162
  id: "edit-provider",
163
163
  value: s,
164
164
  onChange: (e) => {
165
- l(e.target.value), d("");
165
+ u(e.target.value), f("");
166
166
  },
167
167
  className: H,
168
168
  children: [/* @__PURE__ */ z("option", {
@@ -178,8 +178,8 @@ function oe({ relationship: e, onClose: t }) {
178
178
  children: n("relationships.detail.editModal.planLabel", "Plan")
179
179
  }), /* @__PURE__ */ B("select", {
180
180
  id: "edit-plan",
181
- value: u,
182
- onChange: (e) => d(e.target.value),
181
+ value: d,
182
+ onChange: (e) => f(e.target.value),
183
183
  className: H,
184
184
  disabled: !s || F.length === 0,
185
185
  children: [/* @__PURE__ */ z("option", {
@@ -203,8 +203,8 @@ function oe({ relationship: e, onClose: t }) {
203
203
  type: "number",
204
204
  min: "0",
205
205
  step: "0.01",
206
- value: f,
207
- onChange: (e) => p(e.target.value),
206
+ value: p,
207
+ onChange: (e) => m(e.target.value),
208
208
  className: H
209
209
  })] }),
210
210
  /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
@@ -214,8 +214,8 @@ function oe({ relationship: e, onClose: t }) {
214
214
  }), /* @__PURE__ */ z("input", {
215
215
  id: "edit-currency",
216
216
  type: "text",
217
- value: m,
218
- onChange: (e) => h(e.target.value.toUpperCase()),
217
+ value: h,
218
+ onChange: (e) => g(e.target.value.toUpperCase()),
219
219
  maxLength: 3,
220
220
  className: H
221
221
  })] }),
@@ -225,8 +225,8 @@ function oe({ relationship: e, onClose: t }) {
225
225
  children: n("relationships.detail.editModal.intervalLabel", "Billing interval")
226
226
  }), /* @__PURE__ */ z("select", {
227
227
  id: "edit-interval",
228
- value: g,
229
- onChange: (e) => _(e.target.value),
228
+ value: _,
229
+ onChange: (e) => v(e.target.value),
230
230
  className: H,
231
231
  children: W.map((e) => /* @__PURE__ */ z("option", {
232
232
  value: e,
@@ -245,8 +245,8 @@ function oe({ relationship: e, onClose: t }) {
245
245
  }), /* @__PURE__ */ z("input", {
246
246
  id: "edit-renews",
247
247
  type: "date",
248
- value: v,
249
- onChange: (e) => x(e.target.value),
248
+ value: y,
249
+ onChange: (e) => S(e.target.value),
250
250
  className: H
251
251
  })] }),
252
252
  /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
@@ -268,8 +268,8 @@ function oe({ relationship: e, onClose: t }) {
268
268
  className: "flex items-center gap-2 text-sm text-text-primary",
269
269
  children: [/* @__PURE__ */ z("input", {
270
270
  type: "checkbox",
271
- checked: S,
272
- onChange: (e) => w(e.target.checked),
271
+ checked: C,
272
+ onChange: (e) => T(e.target.checked),
273
273
  className: "size-4 rounded border-border-subtle"
274
274
  }), n("relationships.detail.editModal.autoRenews", "Auto-renews")]
275
275
  })
@@ -306,33 +306,33 @@ function oe({ relationship: e, onClose: t }) {
306
306
  });
307
307
  }
308
308
  function se({ relationshipId: e, onClose: t }) {
309
- let n = T(), r = _(), [i, a] = E(""), [o, s] = E("FEATURE_ACCESS"), [l, u] = E(""), [d, f] = E(""), [p, m] = E(""), [h, g] = E(null);
309
+ let n = l(), r = v(), [i, a] = E(""), [o, s] = E("FEATURE_ACCESS"), [u, d] = E(""), [f, p] = E(""), [m, h] = E(""), [g, _] = E(null);
310
310
  return /* @__PURE__ */ z(c, {
311
311
  title: n("relationships.detail.addEntitlementModal.title", "Add entitlement"),
312
312
  onClose: t,
313
313
  children: /* @__PURE__ */ B("form", {
314
314
  onSubmit: (a) => {
315
- if (a.preventDefault(), g(null), !i.trim()) {
316
- g(n("relationships.detail.addEntitlementModal.nameRequired", "An entitlement name is required."));
315
+ if (a.preventDefault(), _(null), !i.trim()) {
316
+ _(n("relationships.detail.addEntitlementModal.nameRequired", "An entitlement name is required."));
317
317
  return;
318
318
  }
319
319
  r.mutate({
320
320
  relationshipId: e,
321
321
  name: i.trim(),
322
322
  type: o,
323
- ...l.trim() ? { quota: Number(l) } : {},
324
- ...d.trim() ? { unit: d.trim() } : {},
325
- ...p.trim() ? { description: p.trim() } : {}
323
+ ...u.trim() ? { quota: Number(u) } : {},
324
+ ...f.trim() ? { unit: f.trim() } : {},
325
+ ...m.trim() ? { description: m.trim() } : {}
326
326
  }, {
327
327
  onSuccess: () => t(),
328
- onError: (e) => g(e instanceof Error ? e.message : n("relationships.detail.addEntitlementModal.error", "Could not add entitlement."))
328
+ onError: (e) => _(e instanceof Error ? e.message : n("relationships.detail.addEntitlementModal.error", "Could not add entitlement."))
329
329
  });
330
330
  },
331
331
  className: "space-y-4",
332
332
  children: [
333
- h && /* @__PURE__ */ z("div", {
333
+ g && /* @__PURE__ */ z("div", {
334
334
  className: "rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
335
- children: h
335
+ children: g
336
336
  }),
337
337
  /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ B("label", {
338
338
  htmlFor: "ent-name",
@@ -379,8 +379,8 @@ function se({ relationshipId: e, onClose: t }) {
379
379
  id: "ent-quota",
380
380
  type: "number",
381
381
  min: "0",
382
- value: l,
383
- onChange: (e) => u(e.target.value),
382
+ value: u,
383
+ onChange: (e) => d(e.target.value),
384
384
  placeholder: n("relationships.detail.addEntitlementModal.quotaPlaceholder", "e.g. 5"),
385
385
  className: H
386
386
  })] }),
@@ -391,8 +391,8 @@ function se({ relationshipId: e, onClose: t }) {
391
391
  }), /* @__PURE__ */ z("input", {
392
392
  id: "ent-unit",
393
393
  type: "text",
394
- value: d,
395
- onChange: (e) => f(e.target.value),
394
+ value: f,
395
+ onChange: (e) => p(e.target.value),
396
396
  placeholder: n("relationships.detail.addEntitlementModal.unitPlaceholder", "e.g. seats, GB"),
397
397
  className: H
398
398
  })] })
@@ -404,8 +404,8 @@ function se({ relationshipId: e, onClose: t }) {
404
404
  children: n("relationships.detail.addEntitlementModal.descriptionLabel", "Description")
405
405
  }), /* @__PURE__ */ z("textarea", {
406
406
  id: "ent-desc",
407
- value: p,
408
- onChange: (e) => m(e.target.value),
407
+ value: m,
408
+ onChange: (e) => h(e.target.value),
409
409
  rows: 2,
410
410
  className: H
411
411
  })] }),
@@ -428,34 +428,34 @@ function se({ relationshipId: e, onClose: t }) {
428
428
  });
429
429
  }
430
430
  function ce({ relationshipId: e, onClose: t }) {
431
- let n = T(), r = g(), { uploadFile: i, progress: a, isUploading: o } = w(), [s, l] = E(""), [u, d] = E("RECEIPT"), [f, p] = E(null), [m, h] = E(""), [_, v] = E(null), y = o || r.isPending;
431
+ let n = l(), r = _(), { uploadFile: i, progress: a, isUploading: o } = T(), [s, u] = E(""), [d, f] = E("RECEIPT"), [p, m] = E(null), [h, g] = E(""), [v, y] = E(null), b = o || r.isPending;
432
432
  return /* @__PURE__ */ z(c, {
433
433
  title: n("relationships.detail.attachAssetModal.title", "Attach asset"),
434
434
  onClose: t,
435
435
  children: /* @__PURE__ */ B("form", {
436
436
  onSubmit: async (a) => {
437
- if (a.preventDefault(), v(null), !f) {
438
- v(n("relationships.detail.attachAssetModal.chooseFile", "Choose a file to attach."));
437
+ if (a.preventDefault(), y(null), !p) {
438
+ y(n("relationships.detail.attachAssetModal.chooseFile", "Choose a file to attach."));
439
439
  return;
440
440
  }
441
441
  try {
442
- let { fileId: n, fileName: a } = await i(f);
442
+ let { fileId: n, fileName: a } = await i(p);
443
443
  await r.mutateAsync({
444
444
  relationshipId: e,
445
445
  name: s.trim() || a,
446
- type: u,
446
+ type: d,
447
447
  fileId: n,
448
- ...m ? { expiresAt: new Date(m).toISOString() } : {}
448
+ ...h ? { expiresAt: new Date(h).toISOString() } : {}
449
449
  }), t();
450
450
  } catch (e) {
451
- v(e instanceof Error ? e.message : n("relationships.detail.attachAssetModal.error", "Could not attach the asset."));
451
+ y(e instanceof Error ? e.message : n("relationships.detail.attachAssetModal.error", "Could not attach the asset."));
452
452
  }
453
453
  },
454
454
  className: "space-y-4",
455
455
  children: [
456
- _ && /* @__PURE__ */ z("div", {
456
+ v && /* @__PURE__ */ z("div", {
457
457
  className: "rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
458
- children: _
458
+ children: v
459
459
  }),
460
460
  /* @__PURE__ */ B("div", { children: [
461
461
  /* @__PURE__ */ B("label", {
@@ -475,7 +475,7 @@ function ce({ relationshipId: e, onClose: t }) {
475
475
  type: "file",
476
476
  onChange: (e) => {
477
477
  let t = e.target.files?.[0] ?? null;
478
- p(t), t && !s.trim() && l(t.name);
478
+ m(t), t && !s.trim() && u(t.name);
479
479
  },
480
480
  className: "w-full text-sm text-text-secondary file:mr-3 file:rounded-lg file:border file:border-border-subtle file:bg-bg-surface file:px-3 file:py-1.5 file:text-sm file:font-medium file:text-text-primary hover:file:bg-bg-sunken"
481
481
  }),
@@ -494,7 +494,7 @@ function ce({ relationshipId: e, onClose: t }) {
494
494
  id: "asset-name",
495
495
  type: "text",
496
496
  value: s,
497
- onChange: (e) => l(e.target.value),
497
+ onChange: (e) => u(e.target.value),
498
498
  placeholder: n("relationships.detail.attachAssetModal.namePlaceholder", "Defaults to the file name"),
499
499
  className: H
500
500
  })] }), /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
@@ -503,8 +503,8 @@ function ce({ relationshipId: e, onClose: t }) {
503
503
  children: n("relationships.detail.attachAssetModal.typeLabel", "Type")
504
504
  }), /* @__PURE__ */ z("select", {
505
505
  id: "asset-type",
506
- value: u,
507
- onChange: (e) => d(e.target.value),
506
+ value: d,
507
+ onChange: (e) => f(e.target.value),
508
508
  className: H,
509
509
  children: K.map((e) => /* @__PURE__ */ z("option", {
510
510
  value: e,
@@ -519,8 +519,8 @@ function ce({ relationshipId: e, onClose: t }) {
519
519
  }), /* @__PURE__ */ z("input", {
520
520
  id: "asset-expires",
521
521
  type: "date",
522
- value: m,
523
- onChange: (e) => h(e.target.value),
522
+ value: h,
523
+ onChange: (e) => g(e.target.value),
524
524
  className: H
525
525
  })] }),
526
526
  o && /* @__PURE__ */ z("p", {
@@ -536,9 +536,9 @@ function ce({ relationshipId: e, onClose: t }) {
536
536
  children: n("relationships.detail.attachAssetModal.cancel", "Cancel")
537
537
  }), /* @__PURE__ */ z("button", {
538
538
  type: "submit",
539
- disabled: y,
539
+ disabled: b,
540
540
  className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50",
541
- children: y ? n("relationships.detail.attachAssetModal.attaching", "Attaching…") : n("relationships.detail.attachAssetModal.submit", "Attach asset")
541
+ children: b ? n("relationships.detail.attachAssetModal.attaching", "Attaching…") : n("relationships.detail.attachAssetModal.submit", "Attach asset")
542
542
  })]
543
543
  })
544
544
  ]
@@ -546,7 +546,7 @@ function ce({ relationshipId: e, onClose: t }) {
546
546
  });
547
547
  }
548
548
  function le({ asset: e }) {
549
- let t = T(), n = v(), [a, o] = E(!1);
549
+ let t = l(), n = y(), [a, o] = E(!1);
550
550
  return /* @__PURE__ */ B("div", {
551
551
  className: "flex items-center justify-between gap-3 p-3",
552
552
  children: [/* @__PURE__ */ B("div", {
@@ -590,20 +590,42 @@ function le({ asset: e }) {
590
590
  })]
591
591
  });
592
592
  }
593
+ function ue({ invoice: e }) {
594
+ let t = l(), a = e.number ?? t("relationships.detail.invoiceRow.unnumbered", "Unnumbered invoice");
595
+ return /* @__PURE__ */ B("div", {
596
+ className: "flex items-center justify-between gap-3 p-3",
597
+ children: [/* @__PURE__ */ B("div", {
598
+ className: "flex min-w-0 items-center gap-2",
599
+ children: [/* @__PURE__ */ z(j, { className: "h-4 w-4 shrink-0 text-text-secondary" }), /* @__PURE__ */ B("div", {
600
+ className: "min-w-0",
601
+ children: [/* @__PURE__ */ z("p", {
602
+ className: "truncate text-sm font-medium text-text-primary",
603
+ children: a
604
+ }), /* @__PURE__ */ B("p", {
605
+ className: "text-xs text-text-secondary",
606
+ children: [i(e.status), e.dueDate ? ` · ${t("relationships.detail.invoiceRow.due", "due {{date}}", { date: r(e.dueDate) })}` : e.issueDate ? ` · ${r(e.issueDate)}` : ""]
607
+ })]
608
+ })]
609
+ }), /* @__PURE__ */ z("span", {
610
+ className: "shrink-0 text-sm font-medium tabular-nums text-text-primary",
611
+ children: n(e.total, e.currency)
612
+ })]
613
+ });
614
+ }
593
615
  function X() {
594
- let c = T(), { id: g } = ne(), { navigateTo: _ } = e(), { data: v, isLoading: y, isError: b, refetch: C } = x(g), w = S(), M = h(), [N, P] = E(null), [I, H] = E(!1), [U, W] = E(!1), [G, K] = E(!1);
595
- if (y) return /* @__PURE__ */ z(t, {
616
+ let c = l(), { id: _ } = ne(), { navigateTo: v } = e(), { data: y, isLoading: b, isError: x, refetch: w } = S(_), T = C(), M = g(), [N, P] = E(null), [I, H] = E(!1), [U, W] = E(!1), [G, K] = E(!1);
617
+ if (b) return /* @__PURE__ */ z(t, {
596
618
  title: c("relationships.title", "Relationship"),
597
- children: /* @__PURE__ */ z(u, { label: c("relationships.detail.loading", "Loading relationship…") })
619
+ children: /* @__PURE__ */ z(d, { label: c("relationships.detail.loading", "Loading relationship…") })
598
620
  });
599
- if (b) return /* @__PURE__ */ z(t, {
621
+ if (x) return /* @__PURE__ */ z(t, {
600
622
  title: c("relationships.title", "Relationship"),
601
- children: /* @__PURE__ */ z(l, {
623
+ children: /* @__PURE__ */ z(u, {
602
624
  message: c("relationships.detail.error", "Could not load this relationship."),
603
- onRetry: () => void C()
625
+ onRetry: () => void w()
604
626
  })
605
627
  });
606
- if (!v) return /* @__PURE__ */ z(t, {
628
+ if (!y) return /* @__PURE__ */ z(t, {
607
629
  title: c("relationships.title", "Relationship"),
608
630
  children: /* @__PURE__ */ z(s, {
609
631
  illustration: "empty-data",
@@ -611,18 +633,18 @@ function X() {
611
633
  description: c("relationships.detail.notFoundDescription", "It may have been removed, or you may not have access to it."),
612
634
  action: /* @__PURE__ */ z("button", {
613
635
  type: "button",
614
- onClick: () => _("/relationships"),
636
+ onClick: () => v("/relationships"),
615
637
  className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
616
638
  children: c("relationships.detail.backToRelationships", "Back to relationships")
617
639
  })
618
640
  })
619
641
  });
620
- let Y = v, X = w.isPending || M.isPending, ue = (e) => {
621
- P(null), w.mutate({
642
+ let Y = y, X = T.isPending || M.isPending, de = (e) => {
643
+ P(null), T.mutate({
622
644
  id: Y.id,
623
645
  status: e
624
646
  }, { onError: (e) => P(e instanceof Error ? e.message : c("relationships.detail.transitionError", "Transition failed")) });
625
- }, de = () => {
647
+ }, fe = () => {
626
648
  P(null), M.mutate(Y.id, { onError: (e) => P(e instanceof Error ? e.message : c("relationships.detail.cancelError", "Cancel failed")) });
627
649
  }, Z = [...Y.renewalEvents ?? []].sort((e, t) => new Date(e.occursAt).getTime() - new Date(t.occursAt).getTime()).map((e) => {
628
650
  let t = new Date(e.occursAt).getTime(), a = !Number.isNaN(t) && t > Date.now();
@@ -638,7 +660,7 @@ function X() {
638
660
  }) : /* @__PURE__ */ z("span", {
639
661
  className: "inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary",
640
662
  children: c("relationships.detail.autoRenewOff", "Off")
641
- }), fe = ie.filter((e) => e.status !== Y.status), $ = Y.plan?.features ?? [];
663
+ }), pe = ie.filter((e) => e.status !== Y.status), $ = Y.plan?.features ?? [];
642
664
  return /* @__PURE__ */ B(t, {
643
665
  title: Y.label,
644
666
  description: Y.provider?.name ?? c(q[Y.kind], i(Y.kind)),
@@ -655,7 +677,7 @@ function X() {
655
677
  ]
656
678
  }), /* @__PURE__ */ B("button", {
657
679
  type: "button",
658
- onClick: () => _("/relationships"),
680
+ onClick: () => v("/relationships"),
659
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",
660
682
  children: [
661
683
  /* @__PURE__ */ z(O, { className: "h-4 w-4" }),
@@ -719,12 +741,12 @@ function X() {
719
741
  ]
720
742
  }), /* @__PURE__ */ B("div", {
721
743
  className: "flex shrink-0 flex-wrap gap-2 lg:flex-col lg:items-stretch",
722
- children: [fe.map((e) => {
744
+ children: [pe.map((e) => {
723
745
  let t = e.icon;
724
746
  return /* @__PURE__ */ B("button", {
725
747
  type: "button",
726
748
  disabled: X,
727
- onClick: () => ue(e.status),
749
+ onClick: () => de(e.status),
728
750
  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",
729
751
  children: [
730
752
  /* @__PURE__ */ z(t, { className: "h-3.5 w-3.5" }),
@@ -735,7 +757,7 @@ function X() {
735
757
  }), Y.status !== "CANCELLED" && /* @__PURE__ */ B("button", {
736
758
  type: "button",
737
759
  disabled: X,
738
- onClick: de,
760
+ onClick: fe,
739
761
  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",
740
762
  children: [
741
763
  /* @__PURE__ */ z(k, { className: "h-3.5 w-3.5" }),
@@ -838,7 +860,7 @@ function X() {
838
860
  })]
839
861
  })]
840
862
  }),
841
- /* @__PURE__ */ z(d, {
863
+ /* @__PURE__ */ z(f, {
842
864
  className: "mt-0",
843
865
  title: c("relationships.detail.sections.entitlements", "Entitlements"),
844
866
  description: c("relationships.detail.sections.entitlementsDescription", "What this relationship grants you"),
@@ -888,7 +910,7 @@ function X() {
888
910
  className: "tabular-nums",
889
911
  children: [Math.round(e.used / e.quota * 100), "%"]
890
912
  })]
891
- }), /* @__PURE__ */ z(p, {
913
+ }), /* @__PURE__ */ z(m, {
892
914
  value: e.used,
893
915
  max: e.quota,
894
916
  tone: e.used / e.quota >= .9 ? "negative" : e.used / e.quota >= .7 ? "warning" : "accent",
@@ -900,7 +922,7 @@ function X() {
900
922
  })
901
923
  })
902
924
  }),
903
- /* @__PURE__ */ z(d, {
925
+ /* @__PURE__ */ z(f, {
904
926
  className: "mt-0",
905
927
  title: c("relationships.detail.sections.assets", "Assets"),
906
928
  description: c("relationships.detail.sections.assetsDescription", "Invoices, contracts, licenses and credentials"),
@@ -914,15 +936,26 @@ function X() {
914
936
  c("relationships.detail.sections.attachAsset", "Attach asset")
915
937
  ]
916
938
  }),
917
- children: !Y.assets || Y.assets.length === 0 ? /* @__PURE__ */ z(s, {
918
- illustration: "empty-data",
919
- title: c("relationships.detail.empty.noAssetsTitle", "No assets attached"),
920
- description: c("relationships.detail.empty.noAssetsDescription", "Attach invoices, contracts, licenses or receipts to this relationship.")
921
- }) : /* @__PURE__ */ z(V, {
922
- treatment: "plain",
923
- className: "divide-y divide-border-subtle p-0",
924
- children: Y.assets.map((e) => /* @__PURE__ */ z(le, { asset: e }, e.id))
925
- })
939
+ children: (() => {
940
+ let e = Y.assets ?? [], t = Y.invoices ?? [];
941
+ return e.length > 0 || t.length > 0 ? /* @__PURE__ */ z(V, {
942
+ treatment: "plain",
943
+ className: "divide-y divide-border-subtle p-0",
944
+ children: [...e.map((e) => ({
945
+ kind: "asset",
946
+ sort: new Date(e.createdAt).getTime() || 0,
947
+ asset: e
948
+ })), ...t.map((e) => ({
949
+ kind: "invoice",
950
+ sort: new Date(e.createdAt).getTime() || 0,
951
+ invoice: e
952
+ }))].sort((e, t) => t.sort - e.sort).map((e) => e.kind === "asset" ? /* @__PURE__ */ z(le, { asset: e.asset }, `a-${e.asset.id}`) : /* @__PURE__ */ z(ue, { invoice: e.invoice }, `i-${e.invoice.id}`))
953
+ }) : /* @__PURE__ */ z(s, {
954
+ illustration: "empty-data",
955
+ title: c("relationships.detail.empty.noAssetsTitle", "No assets attached"),
956
+ description: c("relationships.detail.empty.noAssetsDescription", "Attach invoices, contracts, licenses or receipts to this relationship.")
957
+ });
958
+ })()
926
959
  }),
927
960
  Y.notes && /* @__PURE__ */ B(V, {
928
961
  treatment: "plain",
@@ -953,14 +986,14 @@ function X() {
953
986
  children: c("relationships.detail.empty.noHealthScore", "Not scored yet. A health score appears once Subscriber Bot has enough signal.")
954
987
  }) : /* @__PURE__ */ B("div", {
955
988
  className: "mt-4 flex flex-col items-center",
956
- children: [/* @__PURE__ */ z(f, {
989
+ children: [/* @__PURE__ */ z(p, {
957
990
  value: Y.healthScore,
958
991
  max: 100,
959
992
  size: 160,
960
993
  label: c("relationships.detail.outOf100", "of 100")
961
994
  }), /* @__PURE__ */ z("div", {
962
995
  className: "mt-2 w-full",
963
- children: /* @__PURE__ */ z(p, {
996
+ children: /* @__PURE__ */ z(m, {
964
997
  value: Y.healthScore,
965
998
  max: 100,
966
999
  tone: ae(Y.healthScore)
@@ -990,7 +1023,7 @@ function X() {
990
1023
  title: c("relationships.detail.empty.noRenewalEventsTitle", "No renewal events"),
991
1024
  description: c("relationships.detail.empty.noRenewalEventsDescription", "Renewals and price changes will appear here as they're detected.")
992
1025
  })
993
- }) : /* @__PURE__ */ z(m, {
1026
+ }) : /* @__PURE__ */ z(h, {
994
1027
  items: Z,
995
1028
  className: "mt-4"
996
1029
  })