@burdenoff/microfe-proserviceworld 2026.720.1 → 2026.728.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 (37) hide show
  1. package/dist/proserviceworld/ProServiceWorldRoot.d.ts.map +1 -1
  2. package/dist/proserviceworld/ProServiceWorldRoot.js +49 -19
  3. package/dist/proserviceworld/ProServiceWorldRoot.js.map +1 -1
  4. package/dist/proserviceworld/ProServiceWorldRoutes.d.ts.map +1 -1
  5. package/dist/proserviceworld/ProServiceWorldRoutes.js +62 -27
  6. package/dist/proserviceworld/ProServiceWorldRoutes.js.map +1 -1
  7. package/dist/proserviceworld/components/ui.d.ts.map +1 -1
  8. package/dist/proserviceworld/components/ui.js +7 -1
  9. package/dist/proserviceworld/components/ui.js.map +1 -1
  10. package/dist/proserviceworld/hooks/useProServiceWorldApi.d.ts +187 -0
  11. package/dist/proserviceworld/hooks/useProServiceWorldApi.d.ts.map +1 -1
  12. package/dist/proserviceworld/hooks/useProServiceWorldApi.js +416 -140
  13. package/dist/proserviceworld/hooks/useProServiceWorldApi.js.map +1 -1
  14. package/dist/proserviceworld/pages/ClientPortalAccessPage.d.ts +4 -0
  15. package/dist/proserviceworld/pages/ClientPortalAccessPage.d.ts.map +1 -0
  16. package/dist/proserviceworld/pages/ClientPortalAccessPage.js +191 -0
  17. package/dist/proserviceworld/pages/ClientPortalAccessPage.js.map +1 -0
  18. package/dist/proserviceworld/pages/DashboardPage.d.ts.map +1 -1
  19. package/dist/proserviceworld/pages/DashboardPage.js +94 -82
  20. package/dist/proserviceworld/pages/DashboardPage.js.map +1 -1
  21. package/dist/proserviceworld/pages/MyPortalPage.d.ts +4 -0
  22. package/dist/proserviceworld/pages/MyPortalPage.d.ts.map +1 -0
  23. package/dist/proserviceworld/pages/MyPortalPage.js +162 -0
  24. package/dist/proserviceworld/pages/MyPortalPage.js.map +1 -0
  25. package/dist/proserviceworld/pages/MySignaturesPage.d.ts +4 -0
  26. package/dist/proserviceworld/pages/MySignaturesPage.d.ts.map +1 -0
  27. package/dist/proserviceworld/pages/MySignaturesPage.js +240 -0
  28. package/dist/proserviceworld/pages/MySignaturesPage.js.map +1 -0
  29. package/dist/proserviceworld/pages/SignaturesPage.d.ts +4 -0
  30. package/dist/proserviceworld/pages/SignaturesPage.d.ts.map +1 -0
  31. package/dist/proserviceworld/pages/SignaturesPage.js +317 -0
  32. package/dist/proserviceworld/pages/SignaturesPage.js.map +1 -0
  33. package/dist/proserviceworld/pages/TrustPage.d.ts +14 -0
  34. package/dist/proserviceworld/pages/TrustPage.d.ts.map +1 -0
  35. package/dist/proserviceworld/pages/TrustPage.js +603 -0
  36. package/dist/proserviceworld/pages/TrustPage.js.map +1 -0
  37. package/package.json +1 -1
@@ -2,198 +2,210 @@ import { useDashboardStats as e } from "../hooks/useProServiceWorldApi.js";
2
2
  import { useNav as t } from "../utils/nav.js";
3
3
  import { cn as n } from "../utils/cn.js";
4
4
  import { ErrorState as r, LoadingBlock as i, MetricCard as a, PageHeader as o, SectionCard as s, StatusPill as c, fmtHours as l, fmtMoney as u } from "../components/ui.js";
5
- import { ArrowRight as d, BarChart3 as f, Briefcase as p, Clock as m, FileText as h, FolderKanban as g, GitBranch as _, Network as v, Receipt as y, Scale as b, ShieldCheck as x, Users as S } from "lucide-react";
6
- import { jsx as C, jsxs as w } from "react/jsx-runtime";
5
+ import { ArrowRight as d, BarChart3 as f, Briefcase as p, Clock as m, FileText as h, FolderKanban as g, GitBranch as _, Network as v, Receipt as y, Scale as b, ShieldCheck as x, Users as S, Wallet as C } from "lucide-react";
6
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
7
7
  //#region src/proserviceworld/pages/DashboardPage.tsx
8
- var T = [
8
+ var E = [
9
9
  {
10
10
  label: "Clients",
11
11
  to: "clients",
12
- icon: /* @__PURE__ */ C(S, { className: "h-4 w-4" })
12
+ icon: /* @__PURE__ */ w(S, { className: "h-4 w-4" })
13
13
  },
14
14
  {
15
15
  label: "Engagements",
16
16
  to: "engagements",
17
- icon: /* @__PURE__ */ C(p, { className: "h-4 w-4" })
17
+ icon: /* @__PURE__ */ w(p, { className: "h-4 w-4" })
18
18
  },
19
19
  {
20
20
  label: "Matters",
21
21
  to: "matters",
22
- icon: /* @__PURE__ */ C(g, { className: "h-4 w-4" })
22
+ icon: /* @__PURE__ */ w(g, { className: "h-4 w-4" })
23
23
  },
24
24
  {
25
25
  label: "Time",
26
26
  to: "time",
27
- icon: /* @__PURE__ */ C(m, { className: "h-4 w-4" })
27
+ icon: /* @__PURE__ */ w(m, { className: "h-4 w-4" })
28
28
  },
29
29
  {
30
30
  label: "Invoices",
31
31
  to: "invoices",
32
- icon: /* @__PURE__ */ C(y, { className: "h-4 w-4" })
32
+ icon: /* @__PURE__ */ w(y, { className: "h-4 w-4" })
33
+ },
34
+ {
35
+ label: "Trust accounting",
36
+ to: "trust",
37
+ icon: /* @__PURE__ */ w(C, { className: "h-4 w-4" })
33
38
  },
34
39
  {
35
40
  label: "Compliance",
36
41
  to: "compliance",
37
- icon: /* @__PURE__ */ C(x, { className: "h-4 w-4" })
42
+ icon: /* @__PURE__ */ w(x, { className: "h-4 w-4" })
38
43
  },
39
44
  {
40
45
  label: "Conflict checks",
41
46
  to: "conflicts",
42
- icon: /* @__PURE__ */ C(b, { className: "h-4 w-4" })
47
+ icon: /* @__PURE__ */ w(b, { className: "h-4 w-4" })
43
48
  },
44
49
  {
45
50
  label: "Documents",
46
51
  to: "documents",
47
- icon: /* @__PURE__ */ C(h, { className: "h-4 w-4" })
52
+ icon: /* @__PURE__ */ w(h, { className: "h-4 w-4" })
48
53
  },
49
54
  {
50
55
  label: "Practice areas",
51
56
  to: "practice-areas",
52
- icon: /* @__PURE__ */ C(v, { className: "h-4 w-4" })
57
+ icon: /* @__PURE__ */ w(v, { className: "h-4 w-4" })
53
58
  },
54
59
  {
55
60
  label: "Analytics",
56
61
  to: "analytics",
57
- icon: /* @__PURE__ */ C(f, { className: "h-4 w-4" })
62
+ icon: /* @__PURE__ */ w(f, { className: "h-4 w-4" })
58
63
  }
59
- ], E = () => {
64
+ ], D = () => {
60
65
  let c = t(), { data: f, isLoading: h, error: v, refetch: b } = e();
61
- return h ? /* @__PURE__ */ C(i, { label: "Loading practice overview…" }) : v ? /* @__PURE__ */ C(r, {
66
+ return h ? /* @__PURE__ */ w(i, { label: "Loading practice overview…" }) : v ? /* @__PURE__ */ w(r, {
62
67
  error: v,
63
68
  onRetry: () => void b()
64
- }) : f ? /* @__PURE__ */ w("div", {
69
+ }) : f ? /* @__PURE__ */ T("div", {
65
70
  className: "space-y-6",
66
71
  children: [
67
- /* @__PURE__ */ C(o, {
72
+ /* @__PURE__ */ w(o, {
68
73
  title: "Practice overview",
69
74
  subtitle: "One governed view of clients, engagements, matters, time and billing across your firm."
70
75
  }),
71
- /* @__PURE__ */ w("div", {
76
+ /* @__PURE__ */ T("div", {
72
77
  className: "grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-4",
73
78
  children: [
74
- /* @__PURE__ */ C(a, {
79
+ /* @__PURE__ */ w(a, {
75
80
  label: "Active clients",
76
81
  value: f.activeClients,
77
82
  hint: `${f.totalClients} total`,
78
- icon: /* @__PURE__ */ C(S, { className: "h-4 w-4" }),
83
+ icon: /* @__PURE__ */ w(S, { className: "h-4 w-4" }),
79
84
  tone: "success"
80
85
  }),
81
- /* @__PURE__ */ C(a, {
86
+ /* @__PURE__ */ w(a, {
82
87
  label: "Active engagements",
83
88
  value: f.activeEngagements,
84
- icon: /* @__PURE__ */ C(p, { className: "h-4 w-4" }),
89
+ icon: /* @__PURE__ */ w(p, { className: "h-4 w-4" }),
85
90
  tone: "accent"
86
91
  }),
87
- /* @__PURE__ */ C(a, {
92
+ /* @__PURE__ */ w(a, {
88
93
  label: "Open matters",
89
94
  value: f.openMatters,
90
- icon: /* @__PURE__ */ C(g, { className: "h-4 w-4" }),
95
+ icon: /* @__PURE__ */ w(g, { className: "h-4 w-4" }),
91
96
  tone: "info"
92
97
  }),
93
- /* @__PURE__ */ C(a, {
98
+ /* @__PURE__ */ w(a, {
94
99
  label: "Unbilled hours",
95
100
  value: l(f.unbilledHours),
96
101
  hint: `${l(f.billedHours)} billed`,
97
- icon: /* @__PURE__ */ C(m, { className: "h-4 w-4" }),
102
+ icon: /* @__PURE__ */ w(m, { className: "h-4 w-4" }),
98
103
  tone: "warning"
99
104
  }),
100
- /* @__PURE__ */ C(a, {
105
+ /* @__PURE__ */ w(a, {
101
106
  label: "Outstanding",
102
107
  value: u(f.outstandingInvoiceTotal),
103
108
  hint: "Sent + overdue",
104
- icon: /* @__PURE__ */ C(y, { className: "h-4 w-4" }),
109
+ icon: /* @__PURE__ */ w(y, { className: "h-4 w-4" }),
105
110
  tone: "warning"
106
111
  }),
107
- /* @__PURE__ */ C(a, {
112
+ /* @__PURE__ */ w(a, {
108
113
  label: "Collected",
109
114
  value: u(f.paidInvoiceTotal),
110
- icon: /* @__PURE__ */ C(y, { className: "h-4 w-4" }),
115
+ icon: /* @__PURE__ */ w(y, { className: "h-4 w-4" }),
111
116
  tone: "success"
112
117
  }),
113
- /* @__PURE__ */ C(a, {
118
+ /* @__PURE__ */ w(a, {
119
+ label: "Trust held",
120
+ value: u(f.trustHeldTotal),
121
+ hint: `${f.activeTrustAccounts} active account${f.activeTrustAccounts === 1 ? "" : "s"}`,
122
+ icon: /* @__PURE__ */ w(C, { className: "h-4 w-4" }),
123
+ tone: "info"
124
+ }),
125
+ /* @__PURE__ */ w(a, {
114
126
  label: "Compliance due",
115
127
  value: f.pendingComplianceChecks,
116
- icon: /* @__PURE__ */ C(x, { className: "h-4 w-4" }),
128
+ icon: /* @__PURE__ */ w(x, { className: "h-4 w-4" }),
117
129
  tone: f.pendingComplianceChecks ? "warning" : "success"
118
130
  }),
119
- /* @__PURE__ */ C(a, {
131
+ /* @__PURE__ */ w(a, {
120
132
  label: "Open conflicts",
121
133
  value: f.openConflictChecks,
122
- icon: /* @__PURE__ */ C(_, { className: "h-4 w-4" }),
134
+ icon: /* @__PURE__ */ w(_, { className: "h-4 w-4" }),
123
135
  tone: f.openConflictChecks ? "danger" : "success"
124
136
  })
125
137
  ]
126
138
  }),
127
- /* @__PURE__ */ w("div", {
139
+ /* @__PURE__ */ T("div", {
128
140
  className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
129
141
  children: [
130
- /* @__PURE__ */ C(s, {
142
+ /* @__PURE__ */ w(s, {
131
143
  title: "Engagements by status",
132
- children: /* @__PURE__ */ C(D, { items: f.engagementsByStatus })
144
+ children: /* @__PURE__ */ w(O, { items: f.engagementsByStatus })
133
145
  }),
134
- /* @__PURE__ */ C(s, {
146
+ /* @__PURE__ */ w(s, {
135
147
  title: "Matters by status",
136
- children: /* @__PURE__ */ C(D, { items: f.mattersByStatus })
148
+ children: /* @__PURE__ */ w(O, { items: f.mattersByStatus })
137
149
  }),
138
- /* @__PURE__ */ C(s, {
150
+ /* @__PURE__ */ w(s, {
139
151
  title: "Revenue",
140
152
  description: "Invoiced totals, recent months.",
141
- children: /* @__PURE__ */ C(O, { data: f.revenueByMonth })
153
+ children: /* @__PURE__ */ w(k, { data: f.revenueByMonth })
142
154
  })
143
155
  ]
144
156
  }),
145
- /* @__PURE__ */ C(s, {
157
+ /* @__PURE__ */ w(s, {
146
158
  title: "Jump to",
147
- children: /* @__PURE__ */ C("div", {
159
+ children: /* @__PURE__ */ w("div", {
148
160
  className: "grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",
149
- children: T.map((e) => /* @__PURE__ */ w("button", {
161
+ children: E.map((e) => /* @__PURE__ */ T("button", {
150
162
  type: "button",
151
163
  onClick: () => c(e.to),
152
164
  className: n("group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-canvas px-3.5 py-3 text-left", "transition hover:-translate-y-0.5 hover:border-accent hover:bg-bg-surface hover:shadow-sm"),
153
165
  children: [
154
- /* @__PURE__ */ C("span", {
166
+ /* @__PURE__ */ w("span", {
155
167
  className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-accent transition group-hover:bg-accent/15",
156
168
  children: e.icon
157
169
  }),
158
- /* @__PURE__ */ C("span", {
170
+ /* @__PURE__ */ w("span", {
159
171
  className: "flex-1 truncate text-sm font-medium text-text-primary",
160
172
  children: e.label
161
173
  }),
162
- /* @__PURE__ */ C(d, { className: "h-4 w-4 shrink-0 text-text-tertiary transition group-hover:translate-x-0.5 group-hover:text-accent" })
174
+ /* @__PURE__ */ w(d, { className: "h-4 w-4 shrink-0 text-text-tertiary transition group-hover:translate-x-0.5 group-hover:text-accent" })
163
175
  ]
164
176
  }, e.to))
165
177
  })
166
178
  })
167
179
  ]
168
180
  }) : null;
169
- }, D = ({ items: e }) => {
170
- if (!e.length) return /* @__PURE__ */ C("p", {
181
+ }, O = ({ items: e }) => {
182
+ if (!e.length) return /* @__PURE__ */ w("p", {
171
183
  className: "text-sm text-text-tertiary",
172
184
  children: "No records yet."
173
185
  });
174
186
  let t = Math.max(...e.map((e) => e.count), 1), r = e.reduce((e, t) => e + t.count, 0) || 1;
175
- return /* @__PURE__ */ C("ul", {
187
+ return /* @__PURE__ */ w("ul", {
176
188
  className: "space-y-3.5",
177
- children: e.map((e) => /* @__PURE__ */ w("li", {
189
+ children: e.map((e) => /* @__PURE__ */ T("li", {
178
190
  className: "grid grid-cols-[7.5rem_minmax(0,1fr)_auto] items-center gap-3",
179
191
  children: [
180
- /* @__PURE__ */ C(c, {
192
+ /* @__PURE__ */ w(c, {
181
193
  status: e.status,
182
194
  className: "justify-self-start"
183
195
  }),
184
- /* @__PURE__ */ C("div", {
196
+ /* @__PURE__ */ w("div", {
185
197
  className: "h-2.5 overflow-hidden rounded-full bg-bg-sunken",
186
- children: /* @__PURE__ */ C("div", {
187
- className: n("h-full rounded-full bg-gradient-to-r transition-all duration-500", j(e.status)),
198
+ children: /* @__PURE__ */ w("div", {
199
+ className: n("h-full rounded-full bg-gradient-to-r transition-all duration-500", M(e.status)),
188
200
  style: { width: `${Math.max(e.count / t * 100, 4)}%` }
189
201
  })
190
202
  }),
191
- /* @__PURE__ */ w("span", {
203
+ /* @__PURE__ */ T("span", {
192
204
  className: "flex items-baseline justify-end gap-1.5 tabular-nums",
193
- children: [/* @__PURE__ */ C("span", {
205
+ children: [/* @__PURE__ */ w("span", {
194
206
  className: "text-sm font-semibold text-text-primary",
195
207
  children: e.count
196
- }), /* @__PURE__ */ w("span", {
208
+ }), /* @__PURE__ */ T("span", {
197
209
  className: "text-xs text-text-tertiary",
198
210
  children: [Math.round(e.count / r * 100), "%"]
199
211
  })]
@@ -201,59 +213,59 @@ var T = [
201
213
  ]
202
214
  }, e.status))
203
215
  });
204
- }, O = ({ data: e }) => {
205
- if (!e.length) return /* @__PURE__ */ C("p", {
216
+ }, k = ({ data: e }) => {
217
+ if (!e.length) return /* @__PURE__ */ w("p", {
206
218
  className: "text-sm text-text-tertiary",
207
219
  children: "No invoiced revenue yet."
208
220
  });
209
- let t = M(Math.max(...e.map((e) => e.amount), 1)), r = [
221
+ let t = N(Math.max(...e.map((e) => e.amount), 1)), r = [
210
222
  1,
211
223
  .75,
212
224
  .5,
213
225
  .25,
214
226
  0
215
227
  ].map((e) => t * e);
216
- return /* @__PURE__ */ C("div", {
228
+ return /* @__PURE__ */ w("div", {
217
229
  className: "overflow-x-auto",
218
- children: /* @__PURE__ */ w("div", {
230
+ children: /* @__PURE__ */ T("div", {
219
231
  className: "min-w-[260px]",
220
- children: [/* @__PURE__ */ w("div", {
232
+ children: [/* @__PURE__ */ T("div", {
221
233
  className: "relative h-44",
222
- children: [r.map((e, t) => /* @__PURE__ */ w("div", {
234
+ children: [r.map((e, t) => /* @__PURE__ */ T("div", {
223
235
  className: "absolute inset-x-0 flex items-center gap-2",
224
236
  style: { top: `${t / (r.length - 1) * 100}%` },
225
- children: [/* @__PURE__ */ C("span", {
237
+ children: [/* @__PURE__ */ w("span", {
226
238
  className: "w-11 shrink-0 text-right text-[10px] leading-none tabular-nums text-text-tertiary",
227
- children: N(e)
228
- }), /* @__PURE__ */ C("span", { className: n("h-px flex-1", t === r.length - 1 ? "bg-border-seam" : "bg-border-seam/50") })]
229
- }, e)), /* @__PURE__ */ C("div", {
239
+ children: P(e)
240
+ }), /* @__PURE__ */ w("span", { className: n("h-px flex-1", t === r.length - 1 ? "bg-border-seam" : "bg-border-seam/50") })]
241
+ }, e)), /* @__PURE__ */ w("div", {
230
242
  className: "absolute inset-0 flex items-end gap-1.5 pl-[3.25rem]",
231
- children: e.map((e) => /* @__PURE__ */ C("div", {
243
+ children: e.map((e) => /* @__PURE__ */ w("div", {
232
244
  className: "group flex h-full flex-1 flex-col items-center justify-end",
233
- children: /* @__PURE__ */ C("div", {
245
+ children: /* @__PURE__ */ w("div", {
234
246
  className: "w-full max-w-[2rem] rounded-t-md bg-gradient-to-t from-accent/55 to-accent shadow-sm transition-all duration-200 group-hover:-translate-y-0.5 group-hover:shadow",
235
247
  style: { height: `${Math.max(e.amount / t * 100, 1.5)}%` },
236
248
  title: u(e.amount)
237
249
  })
238
250
  }, e.month))
239
251
  })]
240
- }), /* @__PURE__ */ C("div", {
252
+ }), /* @__PURE__ */ w("div", {
241
253
  className: "mt-2 flex gap-1.5 pl-[3.25rem]",
242
- children: e.map((e) => /* @__PURE__ */ C("span", {
254
+ children: e.map((e) => /* @__PURE__ */ w("span", {
243
255
  className: "flex-1 text-center text-[10px] text-text-tertiary",
244
- children: P(e.month)
256
+ children: F(e.month)
245
257
  }, e.month))
246
258
  })]
247
259
  })
248
260
  });
249
- }, k = {
261
+ }, A = {
250
262
  success: "from-status-success-text/55 to-status-success-text",
251
263
  warning: "from-status-warning-text/55 to-status-warning-text",
252
264
  danger: "from-status-error-text/55 to-status-error-text",
253
265
  info: "from-text-link/55 to-text-link",
254
266
  accent: "from-accent/55 to-accent",
255
267
  neutral: "from-text-tertiary/30 to-text-tertiary/70"
256
- }, A = {
268
+ }, j = {
257
269
  ACTIVE: "success",
258
270
  DELIVERED: "success",
259
271
  INVOICED: "success",
@@ -293,24 +305,24 @@ var T = [
293
305
  DRAFT: "neutral",
294
306
  WAIVED: "neutral"
295
307
  };
296
- function j(e) {
297
- return k[A[e] ?? "accent"];
298
- }
299
308
  function M(e) {
309
+ return A[j[e] ?? "accent"];
310
+ }
311
+ function N(e) {
300
312
  if (e <= 0) return 1;
301
313
  let t = 10 ** Math.floor(Math.log10(e)), n = e / t;
302
314
  return (n <= 1 ? 1 : n <= 2 ? 2 : n <= 2.5 ? 2.5 : n <= 5 ? 5 : 10) * t;
303
315
  }
304
- function N(e) {
316
+ function P(e) {
305
317
  return e >= 1e6 ? `$${(e / 1e6).toFixed(e % 1e6 == 0 ? 0 : 1)}M` : e >= 1e3 ? `$${Math.round(e / 1e3)}k` : `$${Math.round(e)}`;
306
318
  }
307
- function P(e) {
319
+ function F(e) {
308
320
  let [t, n] = e.split("-").map(Number);
309
321
  if (!t || !n) return e;
310
322
  let r = new Date(t, n - 1, 1);
311
323
  return Number.isNaN(r.getTime()) ? e : r.toLocaleDateString(void 0, { month: "short" });
312
324
  }
313
325
  //#endregion
314
- export { E as DashboardPage };
326
+ export { D as DashboardPage };
315
327
 
316
328
  //# sourceMappingURL=DashboardPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardPage.js","names":[],"sources":["../../../src/proserviceworld/pages/DashboardPage.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport {\n Users,\n Briefcase,\n FolderKanban,\n Clock,\n Receipt,\n ShieldCheck,\n GitBranch,\n ArrowRight,\n Scale,\n FileText,\n Network,\n BarChart3,\n} from 'lucide-react';\nimport { useDashboardStats } from '../hooks/useProServiceWorldApi';\nimport { useNav } from '../utils/nav';\nimport { cn } from '../utils/cn';\nimport {\n PageHeader,\n MetricCard,\n SectionCard,\n LoadingBlock,\n ErrorState,\n StatusPill,\n fmtMoney,\n fmtHours,\n} from '../components/ui';\n\nconst QUICK: { label: string; to: string; icon: ReactNode }[] = [\n { label: 'Clients', to: 'clients', icon: <Users className=\"h-4 w-4\" /> },\n { label: 'Engagements', to: 'engagements', icon: <Briefcase className=\"h-4 w-4\" /> },\n { label: 'Matters', to: 'matters', icon: <FolderKanban className=\"h-4 w-4\" /> },\n { label: 'Time', to: 'time', icon: <Clock className=\"h-4 w-4\" /> },\n { label: 'Invoices', to: 'invoices', icon: <Receipt className=\"h-4 w-4\" /> },\n { label: 'Compliance', to: 'compliance', icon: <ShieldCheck className=\"h-4 w-4\" /> },\n { label: 'Conflict checks', to: 'conflicts', icon: <Scale className=\"h-4 w-4\" /> },\n { label: 'Documents', to: 'documents', icon: <FileText className=\"h-4 w-4\" /> },\n { label: 'Practice areas', to: 'practice-areas', icon: <Network className=\"h-4 w-4\" /> },\n { label: 'Analytics', to: 'analytics', icon: <BarChart3 className=\"h-4 w-4\" /> },\n];\n\nexport const DashboardPage: FC = () => {\n const nav = useNav();\n const { data, isLoading, error, refetch } = useDashboardStats();\n\n if (isLoading) return <LoadingBlock label=\"Loading practice overview…\" />;\n if (error) return <ErrorState error={error} onRetry={() => void refetch()} />;\n if (!data) return null;\n\n return (\n <div className=\"space-y-6\">\n <PageHeader\n title=\"Practice overview\"\n subtitle=\"One governed view of clients, engagements, matters, time and billing across your firm.\"\n />\n\n <div className=\"grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-4\">\n <MetricCard\n label=\"Active clients\"\n value={data.activeClients}\n hint={`${data.totalClients} total`}\n icon={<Users className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label=\"Active engagements\"\n value={data.activeEngagements}\n icon={<Briefcase className=\"h-4 w-4\" />}\n tone=\"accent\"\n />\n <MetricCard\n label=\"Open matters\"\n value={data.openMatters}\n icon={<FolderKanban className=\"h-4 w-4\" />}\n tone=\"info\"\n />\n <MetricCard\n label=\"Unbilled hours\"\n value={fmtHours(data.unbilledHours)}\n hint={`${fmtHours(data.billedHours)} billed`}\n icon={<Clock className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label=\"Outstanding\"\n value={fmtMoney(data.outstandingInvoiceTotal)}\n hint=\"Sent + overdue\"\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label=\"Collected\"\n value={fmtMoney(data.paidInvoiceTotal)}\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label=\"Compliance due\"\n value={data.pendingComplianceChecks}\n icon={<ShieldCheck className=\"h-4 w-4\" />}\n tone={data.pendingComplianceChecks ? 'warning' : 'success'}\n />\n <MetricCard\n label=\"Open conflicts\"\n value={data.openConflictChecks}\n icon={<GitBranch className=\"h-4 w-4\" />}\n tone={data.openConflictChecks ? 'danger' : 'success'}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <SectionCard title=\"Engagements by status\">\n <StatusBreakdown items={data.engagementsByStatus} />\n </SectionCard>\n <SectionCard title=\"Matters by status\">\n <StatusBreakdown items={data.mattersByStatus} />\n </SectionCard>\n <SectionCard title=\"Revenue\" description=\"Invoiced totals, recent months.\">\n <RevenueBars data={data.revenueByMonth} />\n </SectionCard>\n </div>\n\n <SectionCard title=\"Jump to\">\n <div className=\"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5\">\n {QUICK.map((q) => (\n <button\n key={q.to}\n type=\"button\"\n onClick={() => nav(q.to)}\n className={cn(\n 'group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-canvas px-3.5 py-3 text-left',\n 'transition hover:-translate-y-0.5 hover:border-accent hover:bg-bg-surface hover:shadow-sm'\n )}\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-accent transition group-hover:bg-accent/15\">\n {q.icon}\n </span>\n <span className=\"flex-1 truncate text-sm font-medium text-text-primary\">\n {q.label}\n </span>\n <ArrowRight className=\"h-4 w-4 shrink-0 text-text-tertiary transition group-hover:translate-x-0.5 group-hover:text-accent\" />\n </button>\n ))}\n </div>\n </SectionCard>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Status breakdown — tone-colored, gradient horizontal bars with count + share\n// ---------------------------------------------------------------------------\nconst StatusBreakdown: FC<{ items: { status: string; count: number }[] }> = ({ items }) => {\n if (!items.length) return <p className=\"text-sm text-text-tertiary\">No records yet.</p>;\n const max = Math.max(...items.map((i) => i.count), 1);\n const total = items.reduce((s, i) => s + i.count, 0) || 1;\n return (\n <ul className=\"space-y-3.5\">\n {items.map((i) => (\n <li\n key={i.status}\n className=\"grid grid-cols-[7.5rem_minmax(0,1fr)_auto] items-center gap-3\"\n >\n <StatusPill status={i.status} className=\"justify-self-start\" />\n <div className=\"h-2.5 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n 'h-full rounded-full bg-gradient-to-r transition-all duration-500',\n barGradientFor(i.status)\n )}\n style={{ width: `${Math.max((i.count / max) * 100, 4)}%` }}\n />\n </div>\n <span className=\"flex items-baseline justify-end gap-1.5 tabular-nums\">\n <span className=\"text-sm font-semibold text-text-primary\">{i.count}</span>\n <span className=\"text-xs text-text-tertiary\">\n {Math.round((i.count / total) * 100)}%\n </span>\n </span>\n </li>\n ))}\n </ul>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Revenue column chart — y-axis scale + gridlines, gradient columns, hover\n// ---------------------------------------------------------------------------\nconst RevenueBars: FC<{ data: { month: string; amount: number }[] }> = ({ data }) => {\n if (!data.length) return <p className=\"text-sm text-text-tertiary\">No invoiced revenue yet.</p>;\n const peak = Math.max(...data.map((d) => d.amount), 1);\n const axisMax = niceCeil(peak);\n const ticks = [1, 0.75, 0.5, 0.25, 0].map((f) => axisMax * f);\n return (\n <div className=\"overflow-x-auto\">\n <div className=\"min-w-[260px]\">\n <div className=\"relative h-44\">\n {ticks.map((t, idx) => (\n <div\n key={t}\n className=\"absolute inset-x-0 flex items-center gap-2\"\n style={{ top: `${(idx / (ticks.length - 1)) * 100}%` }}\n >\n <span className=\"w-11 shrink-0 text-right text-[10px] leading-none tabular-nums text-text-tertiary\">\n {fmtCompactMoney(t)}\n </span>\n <span\n className={cn(\n 'h-px flex-1',\n idx === ticks.length - 1 ? 'bg-border-seam' : 'bg-border-seam/50'\n )}\n />\n </div>\n ))}\n <div className=\"absolute inset-0 flex items-end gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <div\n key={d.month}\n className=\"group flex h-full flex-1 flex-col items-center justify-end\"\n >\n <div\n className=\"w-full max-w-[2rem] rounded-t-md bg-gradient-to-t from-accent/55 to-accent shadow-sm transition-all duration-200 group-hover:-translate-y-0.5 group-hover:shadow\"\n style={{ height: `${Math.max((d.amount / axisMax) * 100, 1.5)}%` }}\n title={fmtMoney(d.amount)}\n />\n </div>\n ))}\n </div>\n </div>\n <div className=\"mt-2 flex gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <span key={d.month} className=\"flex-1 text-center text-[10px] text-text-tertiary\">\n {monthShort(d.month)}\n </span>\n ))}\n </div>\n </div>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Chart helpers (token-driven; self-contained to this page)\n// ---------------------------------------------------------------------------\ntype BarTone = 'success' | 'warning' | 'danger' | 'info' | 'accent' | 'neutral';\n\nconst BAR_GRADIENT: Record<BarTone, string> = {\n success: 'from-status-success-text/55 to-status-success-text',\n warning: 'from-status-warning-text/55 to-status-warning-text',\n danger: 'from-status-error-text/55 to-status-error-text',\n info: 'from-text-link/55 to-text-link',\n accent: 'from-accent/55 to-accent',\n neutral: 'from-text-tertiary/30 to-text-tertiary/70',\n};\n\n/** Mirror of the shared StatusPill tone mapping, used to tint chart bars. */\nconst STATUS_BAR_TONE: Record<string, BarTone> = {\n ACTIVE: 'success',\n DELIVERED: 'success',\n INVOICED: 'success',\n PAID: 'success',\n APPROVED: 'success',\n PASSED: 'success',\n CLEAR: 'success',\n COMPLETED: 'success',\n FINAL: 'success',\n PROSPECT: 'info',\n PROPOSAL: 'info',\n MEDIUM: 'info',\n INTERNAL_REVIEW: 'info',\n SUBMITTED: 'info',\n SENT: 'info',\n IN_REVIEW: 'info',\n REVIEW: 'warning',\n ON_HOLD: 'warning',\n HIGH: 'warning',\n CLIENT_REVIEW: 'warning',\n PENDING: 'warning',\n POTENTIAL_CONFLICT: 'warning',\n CANCELLED: 'danger',\n CRITICAL: 'danger',\n REJECTED: 'danger',\n OVERDUE: 'danger',\n FAILED: 'danger',\n CONFLICT: 'danger',\n ACCEPTED: 'accent',\n IN_PROGRESS: 'accent',\n OPEN: 'accent',\n BILLED: 'accent',\n INACTIVE: 'neutral',\n ARCHIVED: 'neutral',\n CLOSED: 'neutral',\n LOW: 'neutral',\n DRAFT: 'neutral',\n WAIVED: 'neutral',\n};\n\nfunction barGradientFor(status: string): string {\n return BAR_GRADIENT[STATUS_BAR_TONE[status] ?? 'accent'];\n}\n\n/** Round a peak value up to a clean axis maximum (1/2/2.5/5/10 × 10ⁿ). */\nfunction niceCeil(v: number): number {\n if (v <= 0) return 1;\n const pow = 10 ** Math.floor(Math.log10(v));\n const n = v / pow;\n const step = n <= 1 ? 1 : n <= 2 ? 2 : n <= 2.5 ? 2.5 : n <= 5 ? 5 : 10;\n return step * pow;\n}\n\nfunction fmtCompactMoney(n: number): string {\n if (n >= 1_000_000) return `$${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`;\n if (n >= 1_000) return `$${Math.round(n / 1_000)}k`;\n return `$${Math.round(n)}`;\n}\n\n/** \"2026-07\" → \"Jul\" (falls back to the raw value if unparseable). */\nfunction monthShort(m: string): string {\n const [y, mo] = m.split('-').map(Number);\n if (!y || !mo) return m;\n const d = new Date(y, mo - 1, 1);\n return Number.isNaN(d.getTime()) ? m : d.toLocaleDateString(undefined, { month: 'short' });\n}\n"],"mappings":";;;;;;;AA6BA,IAAM,IAA0D;CAC9D;EAAE,OAAO;EAAW,IAAI;EAAW,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CAAE;CACvE;EAAE,OAAO;EAAe,IAAI;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AG,IAAK,GAAG,CAAC;CAC/B,OAAO,OAAO,MAAM,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE,mBAAmB,KAAA,GAAW,EAAE,OAAO,QAAQ,CAAC;AAC3F"}
1
+ {"version":3,"file":"DashboardPage.js","names":[],"sources":["../../../src/proserviceworld/pages/DashboardPage.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport {\n Users,\n Briefcase,\n FolderKanban,\n Clock,\n Receipt,\n Wallet,\n ShieldCheck,\n GitBranch,\n ArrowRight,\n Scale,\n FileText,\n Network,\n BarChart3,\n} from 'lucide-react';\nimport { useDashboardStats } from '../hooks/useProServiceWorldApi';\nimport { useNav } from '../utils/nav';\nimport { cn } from '../utils/cn';\nimport {\n PageHeader,\n MetricCard,\n SectionCard,\n LoadingBlock,\n ErrorState,\n StatusPill,\n fmtMoney,\n fmtHours,\n} from '../components/ui';\n\nconst QUICK: { label: string; to: string; icon: ReactNode }[] = [\n { label: 'Clients', to: 'clients', icon: <Users className=\"h-4 w-4\" /> },\n { label: 'Engagements', to: 'engagements', icon: <Briefcase className=\"h-4 w-4\" /> },\n { label: 'Matters', to: 'matters', icon: <FolderKanban className=\"h-4 w-4\" /> },\n { label: 'Time', to: 'time', icon: <Clock className=\"h-4 w-4\" /> },\n { label: 'Invoices', to: 'invoices', icon: <Receipt className=\"h-4 w-4\" /> },\n { label: 'Trust accounting', to: 'trust', icon: <Wallet className=\"h-4 w-4\" /> },\n { label: 'Compliance', to: 'compliance', icon: <ShieldCheck className=\"h-4 w-4\" /> },\n { label: 'Conflict checks', to: 'conflicts', icon: <Scale className=\"h-4 w-4\" /> },\n { label: 'Documents', to: 'documents', icon: <FileText className=\"h-4 w-4\" /> },\n { label: 'Practice areas', to: 'practice-areas', icon: <Network className=\"h-4 w-4\" /> },\n { label: 'Analytics', to: 'analytics', icon: <BarChart3 className=\"h-4 w-4\" /> },\n];\n\nexport const DashboardPage: FC = () => {\n const nav = useNav();\n const { data, isLoading, error, refetch } = useDashboardStats();\n\n if (isLoading) return <LoadingBlock label=\"Loading practice overview…\" />;\n if (error) return <ErrorState error={error} onRetry={() => void refetch()} />;\n if (!data) return null;\n\n return (\n <div className=\"space-y-6\">\n <PageHeader\n title=\"Practice overview\"\n subtitle=\"One governed view of clients, engagements, matters, time and billing across your firm.\"\n />\n\n <div className=\"grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-4\">\n <MetricCard\n label=\"Active clients\"\n value={data.activeClients}\n hint={`${data.totalClients} total`}\n icon={<Users className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label=\"Active engagements\"\n value={data.activeEngagements}\n icon={<Briefcase className=\"h-4 w-4\" />}\n tone=\"accent\"\n />\n <MetricCard\n label=\"Open matters\"\n value={data.openMatters}\n icon={<FolderKanban className=\"h-4 w-4\" />}\n tone=\"info\"\n />\n <MetricCard\n label=\"Unbilled hours\"\n value={fmtHours(data.unbilledHours)}\n hint={`${fmtHours(data.billedHours)} billed`}\n icon={<Clock className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label=\"Outstanding\"\n value={fmtMoney(data.outstandingInvoiceTotal)}\n hint=\"Sent + overdue\"\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label=\"Collected\"\n value={fmtMoney(data.paidInvoiceTotal)}\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label=\"Trust held\"\n value={fmtMoney(data.trustHeldTotal)}\n hint={`${data.activeTrustAccounts} active account${data.activeTrustAccounts === 1 ? '' : 's'}`}\n icon={<Wallet className=\"h-4 w-4\" />}\n tone=\"info\"\n />\n <MetricCard\n label=\"Compliance due\"\n value={data.pendingComplianceChecks}\n icon={<ShieldCheck className=\"h-4 w-4\" />}\n tone={data.pendingComplianceChecks ? 'warning' : 'success'}\n />\n <MetricCard\n label=\"Open conflicts\"\n value={data.openConflictChecks}\n icon={<GitBranch className=\"h-4 w-4\" />}\n tone={data.openConflictChecks ? 'danger' : 'success'}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <SectionCard title=\"Engagements by status\">\n <StatusBreakdown items={data.engagementsByStatus} />\n </SectionCard>\n <SectionCard title=\"Matters by status\">\n <StatusBreakdown items={data.mattersByStatus} />\n </SectionCard>\n <SectionCard title=\"Revenue\" description=\"Invoiced totals, recent months.\">\n <RevenueBars data={data.revenueByMonth} />\n </SectionCard>\n </div>\n\n <SectionCard title=\"Jump to\">\n <div className=\"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5\">\n {QUICK.map((q) => (\n <button\n key={q.to}\n type=\"button\"\n onClick={() => nav(q.to)}\n className={cn(\n 'group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-canvas px-3.5 py-3 text-left',\n 'transition hover:-translate-y-0.5 hover:border-accent hover:bg-bg-surface hover:shadow-sm'\n )}\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-accent transition group-hover:bg-accent/15\">\n {q.icon}\n </span>\n <span className=\"flex-1 truncate text-sm font-medium text-text-primary\">\n {q.label}\n </span>\n <ArrowRight className=\"h-4 w-4 shrink-0 text-text-tertiary transition group-hover:translate-x-0.5 group-hover:text-accent\" />\n </button>\n ))}\n </div>\n </SectionCard>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Status breakdown — tone-colored, gradient horizontal bars with count + share\n// ---------------------------------------------------------------------------\nconst StatusBreakdown: FC<{ items: { status: string; count: number }[] }> = ({ items }) => {\n if (!items.length) return <p className=\"text-sm text-text-tertiary\">No records yet.</p>;\n const max = Math.max(...items.map((i) => i.count), 1);\n const total = items.reduce((s, i) => s + i.count, 0) || 1;\n return (\n <ul className=\"space-y-3.5\">\n {items.map((i) => (\n <li\n key={i.status}\n className=\"grid grid-cols-[7.5rem_minmax(0,1fr)_auto] items-center gap-3\"\n >\n <StatusPill status={i.status} className=\"justify-self-start\" />\n <div className=\"h-2.5 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n 'h-full rounded-full bg-gradient-to-r transition-all duration-500',\n barGradientFor(i.status)\n )}\n style={{ width: `${Math.max((i.count / max) * 100, 4)}%` }}\n />\n </div>\n <span className=\"flex items-baseline justify-end gap-1.5 tabular-nums\">\n <span className=\"text-sm font-semibold text-text-primary\">{i.count}</span>\n <span className=\"text-xs text-text-tertiary\">\n {Math.round((i.count / total) * 100)}%\n </span>\n </span>\n </li>\n ))}\n </ul>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Revenue column chart — y-axis scale + gridlines, gradient columns, hover\n// ---------------------------------------------------------------------------\nconst RevenueBars: FC<{ data: { month: string; amount: number }[] }> = ({ data }) => {\n if (!data.length) return <p className=\"text-sm text-text-tertiary\">No invoiced revenue yet.</p>;\n const peak = Math.max(...data.map((d) => d.amount), 1);\n const axisMax = niceCeil(peak);\n const ticks = [1, 0.75, 0.5, 0.25, 0].map((f) => axisMax * f);\n return (\n <div className=\"overflow-x-auto\">\n <div className=\"min-w-[260px]\">\n <div className=\"relative h-44\">\n {ticks.map((t, idx) => (\n <div\n key={t}\n className=\"absolute inset-x-0 flex items-center gap-2\"\n style={{ top: `${(idx / (ticks.length - 1)) * 100}%` }}\n >\n <span className=\"w-11 shrink-0 text-right text-[10px] leading-none tabular-nums text-text-tertiary\">\n {fmtCompactMoney(t)}\n </span>\n <span\n className={cn(\n 'h-px flex-1',\n idx === ticks.length - 1 ? 'bg-border-seam' : 'bg-border-seam/50'\n )}\n />\n </div>\n ))}\n <div className=\"absolute inset-0 flex items-end gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <div\n key={d.month}\n className=\"group flex h-full flex-1 flex-col items-center justify-end\"\n >\n <div\n className=\"w-full max-w-[2rem] rounded-t-md bg-gradient-to-t from-accent/55 to-accent shadow-sm transition-all duration-200 group-hover:-translate-y-0.5 group-hover:shadow\"\n style={{ height: `${Math.max((d.amount / axisMax) * 100, 1.5)}%` }}\n title={fmtMoney(d.amount)}\n />\n </div>\n ))}\n </div>\n </div>\n <div className=\"mt-2 flex gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <span key={d.month} className=\"flex-1 text-center text-[10px] text-text-tertiary\">\n {monthShort(d.month)}\n </span>\n ))}\n </div>\n </div>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Chart helpers (token-driven; self-contained to this page)\n// ---------------------------------------------------------------------------\ntype BarTone = 'success' | 'warning' | 'danger' | 'info' | 'accent' | 'neutral';\n\nconst BAR_GRADIENT: Record<BarTone, string> = {\n success: 'from-status-success-text/55 to-status-success-text',\n warning: 'from-status-warning-text/55 to-status-warning-text',\n danger: 'from-status-error-text/55 to-status-error-text',\n info: 'from-text-link/55 to-text-link',\n accent: 'from-accent/55 to-accent',\n neutral: 'from-text-tertiary/30 to-text-tertiary/70',\n};\n\n/** Mirror of the shared StatusPill tone mapping, used to tint chart bars. */\nconst STATUS_BAR_TONE: Record<string, BarTone> = {\n ACTIVE: 'success',\n DELIVERED: 'success',\n INVOICED: 'success',\n PAID: 'success',\n APPROVED: 'success',\n PASSED: 'success',\n CLEAR: 'success',\n COMPLETED: 'success',\n FINAL: 'success',\n PROSPECT: 'info',\n PROPOSAL: 'info',\n MEDIUM: 'info',\n INTERNAL_REVIEW: 'info',\n SUBMITTED: 'info',\n SENT: 'info',\n IN_REVIEW: 'info',\n REVIEW: 'warning',\n ON_HOLD: 'warning',\n HIGH: 'warning',\n CLIENT_REVIEW: 'warning',\n PENDING: 'warning',\n POTENTIAL_CONFLICT: 'warning',\n CANCELLED: 'danger',\n CRITICAL: 'danger',\n REJECTED: 'danger',\n OVERDUE: 'danger',\n FAILED: 'danger',\n CONFLICT: 'danger',\n ACCEPTED: 'accent',\n IN_PROGRESS: 'accent',\n OPEN: 'accent',\n BILLED: 'accent',\n INACTIVE: 'neutral',\n ARCHIVED: 'neutral',\n CLOSED: 'neutral',\n LOW: 'neutral',\n DRAFT: 'neutral',\n WAIVED: 'neutral',\n};\n\nfunction barGradientFor(status: string): string {\n return BAR_GRADIENT[STATUS_BAR_TONE[status] ?? 'accent'];\n}\n\n/** Round a peak value up to a clean axis maximum (1/2/2.5/5/10 × 10ⁿ). */\nfunction niceCeil(v: number): number {\n if (v <= 0) return 1;\n const pow = 10 ** Math.floor(Math.log10(v));\n const n = v / pow;\n const step = n <= 1 ? 1 : n <= 2 ? 2 : n <= 2.5 ? 2.5 : n <= 5 ? 5 : 10;\n return step * pow;\n}\n\nfunction fmtCompactMoney(n: number): string {\n if (n >= 1_000_000) return `$${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`;\n if (n >= 1_000) return `$${Math.round(n / 1_000)}k`;\n return `$${Math.round(n)}`;\n}\n\n/** \"2026-07\" → \"Jul\" (falls back to the raw value if unparseable). */\nfunction monthShort(m: string): string {\n const [y, mo] = m.split('-').map(Number);\n if (!y || !mo) return m;\n const d = new Date(y, mo - 1, 1);\n return Number.isNaN(d.getTime()) ? m : d.toLocaleDateString(undefined, { month: 'short' });\n}\n"],"mappings":";;;;;;;AA8BA,IAAM,IAA0D;CAC9D;EAAE,OAAO;EAAW,IAAI;EAAW,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CAAE;CACvE;EAAE,OAAO;EAAe,IAAI;EAAe,MAAM,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;CAAE;CACnF;EAAE,OAAO;EAAW,IAAI;EAAW,MAAM,kBAAC,GAAD,EAAc,WAAU,UAAW,CAAA;CAAE;CAC9E;EAAE,OAAO;EAAQ,IAAI;EAAQ,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CAAE;CACjE;EAAE,OAAO;EAAY,IAAI;EAAY,MAAM,kBAAC,GAAD,EAAS,WAAU,UAAW,CAAA;CAAE;CAC3E;EAAE,OAAO;EAAoB,IAAI;EAAS,MAAM,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA;CAAE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,QAAQ,CAAC;AAC3F"}
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+
3
+ export declare const MyPortalPage: FC;
4
+ //# sourceMappingURL=MyPortalPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MyPortalPage.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/pages/MyPortalPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA4BhC,eAAO,MAAM,YAAY,EAAE,EAiE1B,CAAC"}
@@ -0,0 +1,162 @@
1
+ import { useMyClientPortalClients as e, useMyDocuments as t, useMyInvoices as n, useMyMatters as r } from "../hooks/useProServiceWorldApi.js";
2
+ import { Banner as i, Empty as a, ErrorState as o, LoadingBlock as s, PageHeader as c, SectionCard as l, StatusPill as u, TableWrap as d, Td as f, Th as p, fmtDate as m, fmtMoney as h } from "../components/ui.js";
3
+ import { getDocumentDownloadUrl as g } from "../hooks/useFiles.js";
4
+ import { useState as _ } from "react";
5
+ import { Contact as v, Download as y, FileText as b, FolderKanban as x, Receipt as S } from "lucide-react";
6
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
7
+ import { Button as T } from "@burdenoff/fe-libs/ui";
8
+ //#region src/proserviceworld/pages/MyPortalPage.tsx
9
+ var E = () => {
10
+ let { data: t, isLoading: n, error: r } = e(), [i, l] = _("matters");
11
+ return n ? /* @__PURE__ */ C(s, {}) : r ? /* @__PURE__ */ C(o, { error: r }) : !t || t.length === 0 ? /* @__PURE__ */ w("div", {
12
+ className: "space-y-6",
13
+ children: [/* @__PURE__ */ C(c, {
14
+ title: "My portal",
15
+ subtitle: "View your matters, invoices, and documents.",
16
+ icon: /* @__PURE__ */ C(v, { className: "h-6 w-6" })
17
+ }), /* @__PURE__ */ C(a, {
18
+ title: "No portal access",
19
+ description: "You don't have client-portal access in this workspace yet. Ask your firm to grant it.",
20
+ icon: /* @__PURE__ */ C(v, { className: "h-8 w-8" })
21
+ })]
22
+ }) : /* @__PURE__ */ w("div", {
23
+ className: "space-y-6",
24
+ children: [
25
+ /* @__PURE__ */ C(c, {
26
+ title: "My portal",
27
+ subtitle: `Viewing ${t.map((e) => e.name).join(", ")}`,
28
+ icon: /* @__PURE__ */ C(v, { className: "h-6 w-6" })
29
+ }),
30
+ /* @__PURE__ */ C("div", {
31
+ className: "flex gap-2 border-b border-border-seam",
32
+ children: [
33
+ {
34
+ id: "matters",
35
+ label: "My matters",
36
+ icon: x
37
+ },
38
+ {
39
+ id: "invoices",
40
+ label: "My invoices",
41
+ icon: S
42
+ },
43
+ {
44
+ id: "documents",
45
+ label: "My documents",
46
+ icon: b
47
+ }
48
+ ].map((e) => /* @__PURE__ */ w("button", {
49
+ type: "button",
50
+ onClick: () => l(e.id),
51
+ className: `flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium ${i === e.id ? "border-accent text-accent" : "border-transparent text-text-secondary hover:text-text-primary"}`,
52
+ children: [/* @__PURE__ */ C(e.icon, { className: "h-4 w-4" }), e.label]
53
+ }, e.id))
54
+ }),
55
+ i === "matters" && /* @__PURE__ */ C(D, {}),
56
+ i === "invoices" && /* @__PURE__ */ C(O, {}),
57
+ i === "documents" && /* @__PURE__ */ C(k, {})
58
+ ]
59
+ });
60
+ }, D = () => {
61
+ let { data: e, isLoading: t, error: n, refetch: i } = r(), c = e?.items ?? [];
62
+ return t ? /* @__PURE__ */ C(s, {}) : n ? /* @__PURE__ */ C(o, {
63
+ error: n,
64
+ onRetry: () => void i()
65
+ }) : c.length === 0 ? /* @__PURE__ */ C(a, {
66
+ title: "No matters yet",
67
+ icon: /* @__PURE__ */ C(x, { className: "h-8 w-8" })
68
+ }) : /* @__PURE__ */ C(l, {
69
+ title: `${e?.totalCount ?? c.length} matter${(e?.totalCount ?? c.length) === 1 ? "" : "s"}`,
70
+ children: /* @__PURE__ */ w(d, { children: [/* @__PURE__ */ C("thead", { children: /* @__PURE__ */ w("tr", { children: [
71
+ /* @__PURE__ */ C(p, { children: "Title" }),
72
+ /* @__PURE__ */ C(p, { children: "Status" }),
73
+ /* @__PURE__ */ C(p, { children: "Priority" }),
74
+ /* @__PURE__ */ C(p, { children: "Due" })
75
+ ] }) }), /* @__PURE__ */ C("tbody", { children: c.map((e) => /* @__PURE__ */ w("tr", { children: [
76
+ /* @__PURE__ */ C(f, {
77
+ className: "font-medium text-text-primary",
78
+ children: e.title
79
+ }),
80
+ /* @__PURE__ */ C(f, { children: /* @__PURE__ */ C(u, { status: e.status }) }),
81
+ /* @__PURE__ */ C(f, { children: /* @__PURE__ */ C(u, { status: e.priority }) }),
82
+ /* @__PURE__ */ C(f, { children: m(e.dueDate) })
83
+ ] }, e.id)) })] })
84
+ });
85
+ }, O = () => {
86
+ let { data: e, isLoading: t, error: r, refetch: i } = n(), c = e?.items ?? [];
87
+ return t ? /* @__PURE__ */ C(s, {}) : r ? /* @__PURE__ */ C(o, {
88
+ error: r,
89
+ onRetry: () => void i()
90
+ }) : c.length === 0 ? /* @__PURE__ */ C(a, {
91
+ title: "No invoices yet",
92
+ icon: /* @__PURE__ */ C(S, { className: "h-8 w-8" })
93
+ }) : /* @__PURE__ */ C(l, {
94
+ title: `${e?.totalCount ?? c.length} invoice${(e?.totalCount ?? c.length) === 1 ? "" : "s"}`,
95
+ children: /* @__PURE__ */ w(d, { children: [/* @__PURE__ */ C("thead", { children: /* @__PURE__ */ w("tr", { children: [
96
+ /* @__PURE__ */ C(p, { children: "Number" }),
97
+ /* @__PURE__ */ C(p, { children: "Status" }),
98
+ /* @__PURE__ */ C(p, { children: "Amount" }),
99
+ /* @__PURE__ */ C(p, { children: "Due" })
100
+ ] }) }), /* @__PURE__ */ C("tbody", { children: c.map((e) => /* @__PURE__ */ w("tr", { children: [
101
+ /* @__PURE__ */ C(f, {
102
+ className: "font-medium text-text-primary",
103
+ children: e.number
104
+ }),
105
+ /* @__PURE__ */ C(f, { children: /* @__PURE__ */ C(u, { status: e.status }) }),
106
+ /* @__PURE__ */ C(f, { children: h(e.total, e.currency) }),
107
+ /* @__PURE__ */ C(f, { children: m(e.dueDate) })
108
+ ] }, e.id)) })] })
109
+ });
110
+ }, k = () => {
111
+ let { data: e, isLoading: n, error: r, refetch: c } = t(), u = e?.items ?? [], [h, v] = _(null), x = async (e) => {
112
+ try {
113
+ let t = await g(e);
114
+ window.open(t, "_blank", "noopener");
115
+ } catch (e) {
116
+ v(e instanceof Error ? e.message : "Could not open document.");
117
+ }
118
+ };
119
+ return n ? /* @__PURE__ */ C(s, {}) : r ? /* @__PURE__ */ C(o, {
120
+ error: r,
121
+ onRetry: () => void c()
122
+ }) : u.length === 0 ? /* @__PURE__ */ C(a, {
123
+ title: "No documents yet",
124
+ icon: /* @__PURE__ */ C(b, { className: "h-8 w-8" })
125
+ }) : /* @__PURE__ */ w("div", {
126
+ className: "space-y-3",
127
+ children: [h && /* @__PURE__ */ C(i, {
128
+ tone: "danger",
129
+ onClose: () => v(null),
130
+ children: h
131
+ }), /* @__PURE__ */ C(l, {
132
+ title: `${e?.totalCount ?? u.length} document${(e?.totalCount ?? u.length) === 1 ? "" : "s"}`,
133
+ children: /* @__PURE__ */ w(d, { children: [/* @__PURE__ */ C("thead", { children: /* @__PURE__ */ w("tr", { children: [
134
+ /* @__PURE__ */ C(p, { children: "Name" }),
135
+ /* @__PURE__ */ C(p, { children: "Added" }),
136
+ /* @__PURE__ */ C(p, {
137
+ className: "text-right",
138
+ children: "Actions"
139
+ })
140
+ ] }) }), /* @__PURE__ */ C("tbody", { children: u.map((e) => /* @__PURE__ */ w("tr", { children: [
141
+ /* @__PURE__ */ C(f, {
142
+ className: "font-medium text-text-primary",
143
+ children: e.name
144
+ }),
145
+ /* @__PURE__ */ C(f, { children: m(e.createdAt) }),
146
+ /* @__PURE__ */ C(f, {
147
+ className: "text-right",
148
+ children: e.file?.id && /* @__PURE__ */ w(T, {
149
+ variant: "ghost",
150
+ size: "sm",
151
+ onClick: () => void x(e.file.id),
152
+ children: [/* @__PURE__ */ C(y, { className: "mr-1.5 h-4 w-4" }), "Download"]
153
+ })
154
+ })
155
+ ] }, e.id)) })] })
156
+ })]
157
+ });
158
+ };
159
+ //#endregion
160
+ export { E as MyPortalPage };
161
+
162
+ //# sourceMappingURL=MyPortalPage.js.map