@fluid-app/portal-sdk 0.1.172 → 0.1.173

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.
@@ -2,7 +2,7 @@ import { r as __exportAll } from "./es-CtZEZp97.mjs";
2
2
  import { n as useCountriesApi } from "./countries-api-context-DScC_39w.mjs";
3
3
  import { t as parseApiErrors } from "./parse-api-errors-XxGAprV3.mjs";
4
4
  import { n as usePortalTenantClient } from "./PortalTenantClientProvider-BF-1Fy27.mjs";
5
- import { $t as Avatar, A as SelectTrigger, B as FormItem, C as SheetFooter, Ct as CardContent, D as Select, G as DropdownMenuContent, H as FormMessage, Jt as BreadcrumbLink, K as DropdownMenuItem, Kt as Breadcrumb, O as SelectContent, P as Input, Qt as Badge, R as FormControl, S as SheetContent, T as SheetTitle, V as FormLabel, W as DropdownMenu, X as DropdownMenuSeparator, Xt as BreadcrumbPage, Yt as BreadcrumbList, Zt as BreadcrumbSeparator, _ as fluidToast, _n as useZodForm, a as ToggleGroup, an as AlertDialogContent, at as DialogFooter, b as Skeleton, c as Table$1, cn as AlertDialogHeader, d as TableHead, en as AvatarFallback, et as DropdownMenuTrigger, f as TableHeader, i as TooltipTrigger, in as AlertDialogCancel, j as SelectValue, k as SelectItem, l as TableBody, ln as AlertDialogTitle, lt as DialogTitle, n as TooltipContent, nn as AlertDialog, o as ToggleGroupItem, on as AlertDialogDescription, ot as DialogHeader, p as TableRow, qt as BreadcrumbItem, r as TooltipProvider, rn as AlertDialogAction, rt as DialogContent, sn as AlertDialogFooter, t as Tooltip, tn as AvatarImage, tt as Dialog, u as TableCell, un as Button, vn as cn, w as SheetHeader, x as Sheet, xt as Card, z as FormField } from "./src-BYkS71q3.mjs";
5
+ import { $t as Avatar, A as SelectTrigger, B as FormItem, C as SheetFooter, Ct as CardContent, D as Select, G as DropdownMenuContent, H as FormMessage, Jt as BreadcrumbLink, K as DropdownMenuItem, Kt as Breadcrumb, O as SelectContent, P as Input, R as FormControl, S as SheetContent, T as SheetTitle, V as FormLabel, W as DropdownMenu, X as DropdownMenuSeparator, Xt as BreadcrumbPage, Yt as BreadcrumbList, Zt as BreadcrumbSeparator, _ as fluidToast, _n as useZodForm, an as AlertDialogContent, at as DialogFooter, b as Skeleton, c as Table$1, cn as AlertDialogHeader, d as TableHead, en as AvatarFallback, et as DropdownMenuTrigger, f as TableHeader, g as Spinner, i as TooltipTrigger, in as AlertDialogCancel, j as SelectValue, k as SelectItem, l as TableBody, ln as AlertDialogTitle, lt as DialogTitle, n as TooltipContent, nn as AlertDialog, on as AlertDialogDescription, ot as DialogHeader, p as TableRow, qt as BreadcrumbItem, r as TooltipProvider, rn as AlertDialogAction, rt as DialogContent, sn as AlertDialogFooter, t as Tooltip, tn as AvatarImage, tt as Dialog, u as TableCell, un as Button, vn as cn, w as SheetHeader, x as Sheet, xt as Card, z as FormField } from "./src-BYkS71q3.mjs";
6
6
  import { n as useScreenHeaderActions, r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-DhC-5Y4x.mjs";
7
7
  import { a as useEditor, n as Heading, o as Placeholder, r as EditorContent, t as StarterKit } from "./dist-BJl_h8oY.mjs";
8
8
  import { t as SearchSort } from "./SearchSort-C2bgQmpq.mjs";
@@ -40,6 +40,67 @@ function StatusBadge({ status, label, className }) {
40
40
  });
41
41
  }
42
42
  //#endregion
43
+ //#region ../../contacts/core/src/contacts-api-context.ts
44
+ const ContactsApiContext = createContext(null);
45
+ const ContactsApiProvider = ContactsApiContext.Provider;
46
+ function useContactsDomainApi() {
47
+ const api = useContext(ContactsApiContext);
48
+ if (!api) throw new Error("useContactsDomainApi must be used within a ContactsApiProvider");
49
+ return api;
50
+ }
51
+ function useContactsCrud() {
52
+ return useContactsDomainApi().contacts;
53
+ }
54
+ function useNotesApi() {
55
+ return useContactsDomainApi().notes;
56
+ }
57
+ function useTasksApi() {
58
+ return useContactsDomainApi().tasks;
59
+ }
60
+ /** Returns GroupsApi if the provider supplies one, otherwise null. */
61
+ function useGroupsApi() {
62
+ return useContactsDomainApi().groups ?? null;
63
+ }
64
+ //#endregion
65
+ //#region ../../contacts/core/src/query-keys.ts
66
+ const CONTACTS_QUERY_KEYS = {
67
+ all: (prefix) => [prefix],
68
+ list: (prefix) => [...CONTACTS_QUERY_KEYS.all(prefix), "list"],
69
+ detail: (prefix, id) => [
70
+ ...CONTACTS_QUERY_KEYS.all(prefix),
71
+ "detail",
72
+ id
73
+ ]
74
+ };
75
+ const contactsKeys = {
76
+ activities: (contactId) => [
77
+ "portal-contacts",
78
+ "activities",
79
+ contactId
80
+ ],
81
+ tasks: (contactId) => [
82
+ "portal-contacts",
83
+ "tasks",
84
+ contactId
85
+ ],
86
+ notes: (contactId) => [
87
+ "portal-contacts",
88
+ "notes",
89
+ contactId
90
+ ],
91
+ orders: (contactId) => [
92
+ "rep-contacts",
93
+ "orders",
94
+ contactId
95
+ ],
96
+ subscriptionOrders: (contactId) => [
97
+ "rep-contacts",
98
+ "subscription-orders",
99
+ contactId
100
+ ],
101
+ groups: () => ["portal-contacts", "groups"]
102
+ };
103
+ //#endregion
43
104
  //#region ../../contacts/ui/src/shared/components/contacts/allContacts/contactsTable.tsx
44
105
  function getInitials(fullName) {
45
106
  const trimmed = fullName?.trim();
@@ -136,11 +197,11 @@ function resolveContactGroupLabels(contact) {
136
197
  if (lead && String(lead).trim()) return [String(lead).replaceAll("_", " ")];
137
198
  return [];
138
199
  }
139
- function RepContactCard({ contact, selected, onToggleSelect, onRowClick, onEditContact, setSelectedContacts, setOpenDeleteModal }) {
200
+ function RepContactCard({ contact, selected, onToggleSelect, onRowClick, onEditContact, setSelectedContacts, setOpenDeleteModal, groupsByName }) {
140
201
  const groupLabels = resolveContactGroupLabels(contact);
141
202
  const groupTitle = groupLabels.length > 0 ? groupLabels.join(", ") : void 0;
142
203
  return /* @__PURE__ */ jsx(Card, {
143
- className: cn("border-border hover:bg-accent/30 h-[100px] w-full flex-col items-start justify-center gap-0 py-0 shadow-sm transition-colors", selected && "bg-accent/40 border-primary/25 ring-primary/20 ring-1"),
204
+ className: cn("border-border hover:bg-accent/30 min-h-[100px] w-full flex-col items-start justify-center gap-0 py-3 shadow-sm transition-colors sm:py-0", selected && "bg-accent/40 border-primary/25 ring-primary/20 ring-1"),
144
205
  children: /* @__PURE__ */ jsx(CardContent, {
145
206
  className: "w-full px-3 py-0",
146
207
  children: /* @__PURE__ */ jsxs("div", {
@@ -161,46 +222,54 @@ function RepContactCard({ contact, selected, onToggleSelect, onRowClick, onEditC
161
222
  type: "button",
162
223
  className: "text-foreground focus-visible:ring-ring flex min-w-0 flex-1 items-center gap-2 rounded-md text-left outline-none focus-visible:ring-2 sm:gap-3",
163
224
  onClick: () => onRowClick?.(contact),
164
- children: [
165
- /* @__PURE__ */ jsxs(Avatar, {
166
- className: "size-12 shrink-0",
167
- children: [contact.avatar_url ? /* @__PURE__ */ jsx(AvatarImage, {
168
- src: contact.avatar_url,
169
- alt: contact.full_name || "Contact"
170
- }) : null, /* @__PURE__ */ jsx(AvatarFallback, {
171
- className: "border-border text-foreground bg-accent ring-border/80 text-xs font-semibold ring-1",
172
- children: getInitials(contact.full_name)
173
- })]
174
- }),
175
- /* @__PURE__ */ jsx("span", {
176
- className: "max-w-[32%] min-w-0 shrink truncate text-sm leading-tight font-semibold sm:max-w-none sm:flex-[1.15]",
177
- title: contact.full_name,
178
- children: contact.full_name || "—"
179
- }),
180
- /* @__PURE__ */ jsx("span", {
181
- className: "text-muted-foreground min-w-0 flex-[1.35] truncate text-xs leading-tight",
182
- title: contact.email ?? void 0,
183
- children: contact.email || "—"
184
- }),
185
- /* @__PURE__ */ jsx("span", {
186
- className: "text-muted-foreground min-w-0 flex-[0.95] truncate text-xs leading-tight",
187
- title: contact.phone ?? void 0,
188
- children: contact.phone || "—"
189
- }),
190
- /* @__PURE__ */ jsxs("span", {
191
- className: "text-muted-foreground flex min-w-0 flex-[0.95] items-center gap-1 text-xs leading-tight",
192
- title: groupTitle,
193
- children: [groupLabels.length > 0 ? groupLabels.slice(0, 2).map((label, index) => /* @__PURE__ */ jsx(Badge, {
194
- variant: "secondary",
195
- className: "max-w-[min(100%,10rem)] shrink truncate font-normal capitalize",
196
- title: label,
197
- children: label
198
- }, `${contact.id}-group-${index}-${label}`)) : "—", groupLabels.length > 2 && /* @__PURE__ */ jsxs("span", {
199
- className: "text-muted-foreground shrink-0 text-[10px]",
200
- children: ["+", groupLabels.length - 2]
201
- })]
202
- })
203
- ]
225
+ children: [/* @__PURE__ */ jsxs(Avatar, {
226
+ className: "size-12 shrink-0",
227
+ children: [contact.avatar_url ? /* @__PURE__ */ jsx(AvatarImage, {
228
+ src: contact.avatar_url,
229
+ alt: contact.full_name || "Contact"
230
+ }) : null, /* @__PURE__ */ jsx(AvatarFallback, {
231
+ className: "border-border text-foreground bg-accent ring-border/80 text-xs font-semibold ring-1",
232
+ children: getInitials(contact.full_name)
233
+ })]
234
+ }), /* @__PURE__ */ jsxs("div", {
235
+ className: "flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-center sm:gap-3",
236
+ children: [
237
+ /* @__PURE__ */ jsx("span", {
238
+ className: "min-w-0 truncate text-sm leading-tight font-semibold sm:flex-[1.15]",
239
+ title: contact.full_name,
240
+ children: contact.full_name || "—"
241
+ }),
242
+ /* @__PURE__ */ jsx("span", {
243
+ className: "text-muted-foreground min-w-0 truncate text-xs leading-tight sm:flex-[1.35]",
244
+ title: contact.email ?? void 0,
245
+ children: contact.email || "—"
246
+ }),
247
+ /* @__PURE__ */ jsx("span", {
248
+ className: "text-muted-foreground min-w-0 truncate text-xs leading-tight sm:flex-[0.95]",
249
+ title: contact.phone ?? void 0,
250
+ children: contact.phone || "—"
251
+ }),
252
+ /* @__PURE__ */ jsxs("span", {
253
+ className: "text-muted-foreground flex min-w-0 flex-wrap items-center gap-1 text-xs leading-tight sm:flex-[0.95] sm:flex-nowrap",
254
+ title: groupTitle,
255
+ children: [groupLabels.length > 0 ? groupLabels.slice(0, 2).map((label, index) => {
256
+ const group = groupsByName.get(label);
257
+ return /* @__PURE__ */ jsxs("span", {
258
+ className: "text-foreground border-border inline-flex max-w-[min(100%,10rem)] shrink items-center gap-1 truncate rounded-full border px-2 py-0.5 font-normal capitalize",
259
+ style: { backgroundColor: group?.avatar_background ?? "var(--color-muted)" },
260
+ title: label,
261
+ children: [group?.avatar && /* @__PURE__ */ jsx("span", { children: group.avatar }), /* @__PURE__ */ jsx("span", {
262
+ className: "truncate",
263
+ children: label
264
+ })]
265
+ }, `${contact.id}-group-${index}-${label}`);
266
+ }) : "—", groupLabels.length > 2 && /* @__PURE__ */ jsxs("span", {
267
+ className: "text-muted-foreground shrink-0 text-[10px]",
268
+ children: ["+", groupLabels.length - 2]
269
+ })]
270
+ })
271
+ ]
272
+ })]
204
273
  }),
205
274
  /* @__PURE__ */ jsx("div", {
206
275
  className: "flex shrink-0 items-center",
@@ -233,11 +302,6 @@ function RepContactCard({ contact, selected, onToggleSelect, onRowClick, onEditC
233
302
  })
234
303
  });
235
304
  }
236
- const TABS = [
237
- "All",
238
- "Leads",
239
- "Customers"
240
- ];
241
305
  function getSortComparable(contact, field) {
242
306
  if (field === "name") return contact.full_name ?? "";
243
307
  return contact.email ?? "";
@@ -252,9 +316,20 @@ const CONTACT_SORT_COLUMNS = [{
252
316
  }];
253
317
  function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setOpenDeleteModal, onEditContact, onRowClick, resetKey, tableLayout }) {
254
318
  const isMemberLayout = tableLayout === "members";
319
+ const groupsApi = useGroupsApi();
320
+ const { data: availableGroups = [] } = useQuery({
321
+ queryKey: contactsKeys.groups(),
322
+ queryFn: () => groupsApi.listGroups(),
323
+ enabled: !!groupsApi && isMemberLayout,
324
+ select: (data) => data.groups
325
+ });
326
+ const groupsByName = useMemo(() => {
327
+ const map = /* @__PURE__ */ new Map();
328
+ for (const group of availableGroups) map.set(group.name, group);
329
+ return map;
330
+ }, [availableGroups]);
255
331
  const [currentPage, setCurrentPage] = useState(1);
256
332
  const [searchTerm, setSearchTerm] = useState("");
257
- const [activeTab, setActiveTab] = useState("All");
258
333
  const [sortValue, setSortValue] = useState("name_asc");
259
334
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
260
335
  const parsedSort = useMemo(() => {
@@ -267,23 +342,17 @@ function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setO
267
342
  useEffect(() => {
268
343
  setCurrentPage(1);
269
344
  setSelectedIds(/* @__PURE__ */ new Set());
270
- }, [
271
- searchTerm,
272
- activeTab,
273
- sortValue
274
- ]);
345
+ }, [searchTerm, sortValue]);
275
346
  useEffect(() => {
276
347
  setSelectedIds(/* @__PURE__ */ new Set());
277
348
  }, [currentPage]);
278
349
  useEffect(() => {
279
350
  setSelectedIds(/* @__PURE__ */ new Set());
280
351
  }, [resetKey]);
281
- const resolvedStatus = activeTab === "Leads" ? "lead" : activeTab === "Customers" ? "customer" : null;
282
352
  const { data, isLoading } = useQuery({
283
353
  queryKey: [queryKeyPrefix, {
284
354
  searchTerm,
285
355
  currentPage,
286
- activeTab,
287
356
  sortField: parsedSort.id,
288
357
  sortDesc: parsedSort.desc
289
358
  }],
@@ -291,7 +360,6 @@ function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setO
291
360
  search_query: searchTerm || void 0,
292
361
  page: currentPage,
293
362
  per_page: PAGE_SIZE,
294
- ...resolvedStatus ? { status: resolvedStatus } : {},
295
363
  sort_by: parsedSort.id,
296
364
  sort_direction: parsedSort.desc ? "desc" : "asc"
297
365
  }),
@@ -347,20 +415,9 @@ function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setO
347
415
  return /* @__PURE__ */ jsxs("div", {
348
416
  className: "border-border overflow-hidden rounded-lg border shadow-sm",
349
417
  children: [
350
- /* @__PURE__ */ jsxs("div", {
351
- className: "flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between",
352
- children: [/* @__PURE__ */ jsx(ToggleGroup, {
353
- type: "single",
354
- value: activeTab,
355
- onValueChange: (v) => {
356
- if (v) setActiveTab(v);
357
- },
358
- variant: "ghost",
359
- children: TABS.map((tab) => /* @__PURE__ */ jsx(ToggleGroupItem, {
360
- value: tab,
361
- children: tab
362
- }, tab))
363
- }), /* @__PURE__ */ jsx("div", {
418
+ /* @__PURE__ */ jsx("div", {
419
+ className: "flex justify-end p-3",
420
+ children: /* @__PURE__ */ jsx("div", {
364
421
  className: "w-full max-w-sm",
365
422
  children: /* @__PURE__ */ jsx(SearchSort, {
366
423
  searchValue: searchTerm,
@@ -376,7 +433,7 @@ function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setO
376
433
  sortValue,
377
434
  onSortChange: setSortValue
378
435
  })
379
- })]
436
+ })
380
437
  }),
381
438
  isMemberLayout ? /* @__PURE__ */ jsxs("div", {
382
439
  className: "space-y-3 p-3",
@@ -447,7 +504,8 @@ function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setO
447
504
  onRowClick,
448
505
  onEditContact,
449
506
  setSelectedContacts,
450
- setOpenDeleteModal
507
+ setOpenDeleteModal,
508
+ groupsByName
451
509
  }, contact.id))]
452
510
  }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
453
511
  className: "block md:hidden",
@@ -689,45 +747,6 @@ function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setO
689
747
  });
690
748
  }
691
749
  //#endregion
692
- //#region ../../contacts/core/src/query-keys.ts
693
- const CONTACTS_QUERY_KEYS = {
694
- all: (prefix) => [prefix],
695
- list: (prefix) => [...CONTACTS_QUERY_KEYS.all(prefix), "list"],
696
- detail: (prefix, id) => [
697
- ...CONTACTS_QUERY_KEYS.all(prefix),
698
- "detail",
699
- id
700
- ]
701
- };
702
- const contactsKeys = {
703
- activities: (contactId) => [
704
- "portal-contacts",
705
- "activities",
706
- contactId
707
- ],
708
- tasks: (contactId) => [
709
- "portal-contacts",
710
- "tasks",
711
- contactId
712
- ],
713
- notes: (contactId) => [
714
- "portal-contacts",
715
- "notes",
716
- contactId
717
- ],
718
- orders: (contactId) => [
719
- "rep-contacts",
720
- "orders",
721
- contactId
722
- ],
723
- subscriptionOrders: (contactId) => [
724
- "rep-contacts",
725
- "subscription-orders",
726
- contactId
727
- ],
728
- groups: () => ["portal-contacts", "groups"]
729
- };
730
- //#endregion
731
750
  //#region ../../contacts/ui/src/shared/components/contacts/allContacts/contactsPage.tsx
732
751
  function ContactsPage({ listContacts, deleteContacts, queryKeyPrefix, header, onEditContact, onRowClick, tableLayout }) {
733
752
  const [openDeleteModal, setOpenDeleteModal] = useState(false);
@@ -1086,7 +1105,7 @@ const ContactInfoCard = ({ contact, className, onEdit, showActions = false, onCr
1086
1105
  renderer: renderBackground
1087
1106
  })
1088
1107
  }), /* @__PURE__ */ jsxs("div", {
1089
- className: "relative z-10 p-6",
1108
+ className: "relative p-6",
1090
1109
  children: [
1091
1110
  /* @__PURE__ */ jsxs("div", {
1092
1111
  className: "mb-5 flex items-center justify-between",
@@ -1098,7 +1117,7 @@ const ContactInfoCard = ({ contact, className, onEdit, showActions = false, onCr
1098
1117
  onClick: onEdit,
1099
1118
  disabled: isDimmed,
1100
1119
  className: "bg-card/90 text-card-foreground hover:bg-card rounded-lg px-4 py-1.5 text-sm font-medium shadow-sm backdrop-blur-sm transition-colors disabled:opacity-60",
1101
- children: isDimmed ? "Editing…" : "Edit"
1120
+ children: "Edit"
1102
1121
  })]
1103
1122
  }),
1104
1123
  /* @__PURE__ */ jsxs("div", {
@@ -1276,7 +1295,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1276
1295
  onChange: (url) => setValue("avatar_url", url ?? "", { shouldDirty: true })
1277
1296
  })]
1278
1297
  }), /* @__PURE__ */ jsxs("div", {
1279
- className: "grid grid-cols-1 gap-6 md:grid-cols-2",
1298
+ className: "grid grid-cols-1 gap-6 lg:grid-cols-2",
1280
1299
  children: [
1281
1300
  /* @__PURE__ */ jsx(FormField, {
1282
1301
  control,
@@ -1290,7 +1309,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1290
1309
  placeholder: "Enter first name",
1291
1310
  ...field,
1292
1311
  value: field.value ?? "",
1293
- className: "ring-input bg-white shadow-sm"
1312
+ className: "ring-input"
1294
1313
  }) }),
1295
1314
  /* @__PURE__ */ jsx(FormMessage, {})
1296
1315
  ] })
@@ -1307,7 +1326,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1307
1326
  placeholder: "Enter last name",
1308
1327
  ...field,
1309
1328
  value: field.value ?? "",
1310
- className: "ring-input bg-white shadow-sm"
1329
+ className: "ring-input"
1311
1330
  }) }),
1312
1331
  /* @__PURE__ */ jsx(FormMessage, {})
1313
1332
  ] })
@@ -1325,7 +1344,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1325
1344
  type: "email",
1326
1345
  ...field,
1327
1346
  value: field.value ?? "",
1328
- className: "ring-input bg-white shadow-sm"
1347
+ className: "ring-input"
1329
1348
  }) }),
1330
1349
  /* @__PURE__ */ jsx(FormMessage, {})
1331
1350
  ] })
@@ -1342,7 +1361,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1342
1361
  placeholder: "Enter phone number",
1343
1362
  ...field,
1344
1363
  value: field.value ?? "",
1345
- className: "ring-input bg-white shadow-sm"
1364
+ className: "ring-input"
1346
1365
  }) }),
1347
1366
  /* @__PURE__ */ jsx(FormMessage, {})
1348
1367
  ] })
@@ -1359,7 +1378,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1359
1378
  value: field.value ?? "",
1360
1379
  onValueChange: field.onChange,
1361
1380
  children: [/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, {
1362
- className: "w-full bg-white shadow-sm",
1381
+ className: "w-full",
1363
1382
  children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select status" })
1364
1383
  }) }), /* @__PURE__ */ jsx(SelectContent, {
1365
1384
  position: "popper",
@@ -1377,7 +1396,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1377
1396
  control,
1378
1397
  name: "address",
1379
1398
  render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, {
1380
- className: "col-span-2",
1399
+ className: "lg:col-span-2",
1381
1400
  children: [
1382
1401
  /* @__PURE__ */ jsx(FormLabel, {
1383
1402
  className: "font-inter text-foreground font-medium",
@@ -1387,7 +1406,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1387
1406
  placeholder: "Enter street address",
1388
1407
  ...field,
1389
1408
  value: field.value ?? "",
1390
- className: "ring-input bg-white shadow-sm"
1409
+ className: "ring-input"
1391
1410
  }) }),
1392
1411
  /* @__PURE__ */ jsx(FormMessage, {})
1393
1412
  ]
@@ -1405,7 +1424,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1405
1424
  placeholder: "Enter city",
1406
1425
  ...field,
1407
1426
  value: field.value ?? "",
1408
- className: "ring-input bg-white shadow-sm"
1427
+ className: "ring-input"
1409
1428
  }) }),
1410
1429
  /* @__PURE__ */ jsx(FormMessage, {})
1411
1430
  ] })
@@ -1422,7 +1441,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1422
1441
  placeholder: "Enter state or province",
1423
1442
  ...field,
1424
1443
  value: field.value ?? "",
1425
- className: "ring-input bg-white shadow-sm"
1444
+ className: "ring-input"
1426
1445
  }) }),
1427
1446
  /* @__PURE__ */ jsx(FormMessage, {})
1428
1447
  ] })
@@ -1439,7 +1458,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1439
1458
  placeholder: "Enter postal code",
1440
1459
  ...field,
1441
1460
  value: field.value ?? "",
1442
- className: "ring-input bg-white shadow-sm"
1461
+ className: "ring-input"
1443
1462
  }) }),
1444
1463
  /* @__PURE__ */ jsx(FormMessage, {})
1445
1464
  ] })
@@ -1456,7 +1475,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1456
1475
  value: field.value ?? "",
1457
1476
  onValueChange: field.onChange,
1458
1477
  children: [/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, {
1459
- className: "w-full bg-white shadow-sm",
1478
+ className: "w-full",
1460
1479
  children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select country" })
1461
1480
  }) }), /* @__PURE__ */ jsx(SelectContent, {
1462
1481
  position: "popper",
@@ -1475,28 +1494,6 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1475
1494
  });
1476
1495
  };
1477
1496
  //#endregion
1478
- //#region ../../contacts/core/src/contacts-api-context.ts
1479
- const ContactsApiContext = createContext(null);
1480
- const ContactsApiProvider = ContactsApiContext.Provider;
1481
- function useContactsDomainApi() {
1482
- const api = useContext(ContactsApiContext);
1483
- if (!api) throw new Error("useContactsDomainApi must be used within a ContactsApiProvider");
1484
- return api;
1485
- }
1486
- function useContactsCrud() {
1487
- return useContactsDomainApi().contacts;
1488
- }
1489
- function useNotesApi() {
1490
- return useContactsDomainApi().notes;
1491
- }
1492
- function useTasksApi() {
1493
- return useContactsDomainApi().tasks;
1494
- }
1495
- /** Returns GroupsApi if the provider supplies one, otherwise null. */
1496
- function useGroupsApi() {
1497
- return useContactsDomainApi().groups ?? null;
1498
- }
1499
- //#endregion
1500
1497
  //#region ../../contacts/ui/src/portal/hooks/notes/use-delete-contact-note.ts
1501
1498
  function useDeleteContactNote(contactId, options) {
1502
1499
  const queryClient = useQueryClient();
@@ -1692,14 +1689,14 @@ function NoteTaskEditor({ titlePlaceholder = "New Note", bodyPlaceholder = "Star
1692
1689
  fireOnChange();
1693
1690
  }, [dueDate]);
1694
1691
  const buttonBase = "flex h-7 w-7 items-center justify-center rounded text-xs transition-colors";
1695
- const buttonActive = "bg-gray-100 text-primary";
1696
- const buttonInactive = "text-gray-400 hover:bg-gray-50";
1697
- const toolbarSeparator = /* @__PURE__ */ jsx("div", { className: "mx-1 h-5 w-px bg-gray-200" });
1692
+ const buttonActive = "bg-muted text-primary";
1693
+ const buttonInactive = "text-muted-foreground hover:bg-muted/50";
1694
+ const toolbarSeparator = /* @__PURE__ */ jsx("div", { className: "bg-border mx-1 h-5 w-px" });
1698
1695
  return /* @__PURE__ */ jsxs("div", {
1699
1696
  className: cn("border-border flex flex-col overflow-hidden rounded-lg border", className),
1700
1697
  children: [
1701
1698
  /* @__PURE__ */ jsxs("div", {
1702
- className: "border-border flex items-center gap-0.5 border-b bg-gray-50 px-2 py-1.5",
1699
+ className: "border-border bg-muted/50 flex items-center gap-0.5 border-b px-2 py-1.5",
1703
1700
  children: [
1704
1701
  /* @__PURE__ */ jsx("button", {
1705
1702
  type: "button",
@@ -1788,7 +1785,7 @@ function NoteTaskEditor({ titlePlaceholder = "New Note", bodyPlaceholder = "Star
1788
1785
  }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
1789
1786
  type: "button",
1790
1787
  onClick: () => dateInputRef.current?.showPicker(),
1791
- className: "flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-xs font-medium text-gray-400 transition-colors hover:bg-gray-50 hover:text-gray-600",
1788
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-xs font-medium transition-colors",
1792
1789
  children: [/* @__PURE__ */ jsx(Calendar, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsx("span", { children: "Due date" })]
1793
1790
  }), /* @__PURE__ */ jsx("input", {
1794
1791
  ref: dateInputRef,
@@ -1818,7 +1815,7 @@ function NoteTaskEditor({ titlePlaceholder = "New Note", bodyPlaceholder = "Star
1818
1815
 
1819
1816
  .ProseMirror h1.is-empty::before,
1820
1817
  .ProseMirror p.is-empty::before {
1821
- color: #9ca3af;
1818
+ color: var(--color-muted-foreground);
1822
1819
  content: attr(data-placeholder);
1823
1820
  float: left;
1824
1821
  height: 0;
@@ -1916,7 +1913,7 @@ function NoteTaskModal({ open, onOpenChange, mode, type, initialTitle = "", init
1916
1913
  children: [/* @__PURE__ */ jsxs("button", {
1917
1914
  type: "button",
1918
1915
  onClick: () => dateInputRef.current?.showPicker(),
1919
- className: "text-muted-foreground hover:text-foreground inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors hover:bg-gray-50",
1916
+ className: "text-muted-foreground hover:text-foreground hover:bg-muted inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors",
1920
1917
  children: [/* @__PURE__ */ jsx(Calendar, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsx("span", { children: "Add due date" })]
1921
1918
  }), /* @__PURE__ */ jsx("input", {
1922
1919
  ref: dateInputRef,
@@ -1975,7 +1972,7 @@ function EmptyState$3({ onCreateNote }) {
1975
1972
  className: "flex h-20 w-20 items-center justify-center rounded-full bg-gradient-to-br from-amber-100 to-yellow-100",
1976
1973
  children: /* @__PURE__ */ jsx(StickyNote, { className: "h-9 w-9 text-amber-500" })
1977
1974
  }), /* @__PURE__ */ jsx("div", {
1978
- className: "absolute -right-2 -bottom-1 flex h-9 w-9 items-center justify-center rounded-full border-2 border-white bg-gradient-to-br from-orange-100 to-red-100 shadow-sm",
1975
+ className: "border-background absolute -right-2 -bottom-1 flex h-9 w-9 items-center justify-center rounded-full border-2 bg-gradient-to-br from-orange-100 to-red-100 shadow-sm",
1979
1976
  children: /* @__PURE__ */ jsx(Pen, { className: "h-4 w-4 text-orange-500" })
1980
1977
  })]
1981
1978
  }),
@@ -2311,7 +2308,7 @@ function EmptyState$2({ onCreateTask }) {
2311
2308
  className: "flex h-20 w-20 items-center justify-center rounded-full bg-gradient-to-br from-teal-100 to-emerald-100",
2312
2309
  children: /* @__PURE__ */ jsx(ClipboardList, { className: "h-9 w-9 text-teal-500" })
2313
2310
  }), /* @__PURE__ */ jsx("div", {
2314
- className: "absolute -right-2 -bottom-1 flex h-9 w-9 items-center justify-center rounded-full border-2 border-white bg-gradient-to-br from-blue-100 to-indigo-100 shadow-sm",
2311
+ className: "border-background absolute -right-2 -bottom-1 flex h-9 w-9 items-center justify-center rounded-full border-2 bg-gradient-to-br from-blue-100 to-indigo-100 shadow-sm",
2315
2312
  children: /* @__PURE__ */ jsx(SquareCheckBig, { className: "h-4 w-4 text-blue-500" })
2316
2313
  })]
2317
2314
  }),
@@ -2644,7 +2641,7 @@ function GroupsSection({ contactTags, availableGroups = [], onManageGroups, onAd
2644
2641
  return availableGroups.find((g) => g.name === tagName);
2645
2642
  };
2646
2643
  return /* @__PURE__ */ jsxs("div", {
2647
- className: cn("rounded-lg border bg-white p-4 shadow-xs transition-all hover:shadow-md", disabled && "pointer-events-none opacity-45 select-none"),
2644
+ className: cn("bg-card rounded-lg border p-4 shadow-xs transition-all hover:shadow-md", disabled && "pointer-events-none opacity-45 select-none"),
2648
2645
  "aria-disabled": disabled || void 0,
2649
2646
  children: [
2650
2647
  /* @__PURE__ */ jsxs("div", {
@@ -2663,10 +2660,10 @@ function GroupsSection({ contactTags, availableGroups = [], onManageGroups, onAd
2663
2660
  className: "flex flex-wrap gap-2",
2664
2661
  children: contactTags.map((tag) => {
2665
2662
  const group = getGroupDetails(tag);
2666
- const backgroundColor = group?.avatar_background ?? "#F3F4F6";
2663
+ const backgroundColor = group?.avatar_background ?? "var(--color-muted)";
2667
2664
  const emoji = group?.avatar;
2668
2665
  return /* @__PURE__ */ jsxs("span", {
2669
- className: "text-foreground inline-flex items-center gap-2 rounded-full border border-gray-100 px-3 py-1.5 text-xs",
2666
+ className: "text-foreground border-border inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs",
2670
2667
  style: { backgroundColor },
2671
2668
  children: [
2672
2669
  emoji && /* @__PURE__ */ jsx("span", { children: emoji }),
@@ -2698,7 +2695,7 @@ function GroupsSection({ contactTags, availableGroups = [], onManageGroups, onAd
2698
2695
  className: "flex cursor-pointer items-center gap-3",
2699
2696
  children: [/* @__PURE__ */ jsx("div", {
2700
2697
  className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm",
2701
- style: { backgroundColor: group.avatar_background ?? "#F3F4F6" },
2698
+ style: { backgroundColor: group.avatar_background ?? "var(--color-muted)" },
2702
2699
  children: group.avatar
2703
2700
  }), /* @__PURE__ */ jsx("span", {
2704
2701
  className: "flex-1 truncate text-sm",
@@ -2761,14 +2758,14 @@ function ManageGroupsModal({ open, onOpenChange, contactName, currentTags, avail
2761
2758
  }),
2762
2759
  /* @__PURE__ */ jsx("div", {
2763
2760
  className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg",
2764
- style: { backgroundColor: group.avatar_background ?? "#F3F4F6" },
2761
+ style: { backgroundColor: group.avatar_background ?? "var(--color-muted)" },
2765
2762
  children: group.avatar
2766
2763
  }),
2767
2764
  /* @__PURE__ */ jsx("span", {
2768
2765
  className: "text-foreground min-w-0 flex-1 truncate text-sm font-medium",
2769
2766
  children: group.name
2770
2767
  }),
2771
- isSelected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 shrink-0 text-green-600" })
2768
+ isSelected && /* @__PURE__ */ jsx(Check, { className: "text-primary h-4 w-4 shrink-0" })
2772
2769
  ]
2773
2770
  }, group.id);
2774
2771
  })
@@ -3128,11 +3125,11 @@ function RepContactDetailView({ contact, contactId, countryOptions = DEFAULT_COU
3128
3125
  return /* @__PURE__ */ jsxs("div", {
3129
3126
  className: "flex h-full flex-col",
3130
3127
  children: [/* @__PURE__ */ jsx("div", {
3131
- className: "mx-auto w-full flex-1 overflow-hidden",
3128
+ className: "mx-auto w-full flex-1 lg:overflow-hidden",
3132
3129
  children: /* @__PURE__ */ jsxs("div", {
3133
- className: "flex h-full gap-6 px-6 py-8",
3130
+ className: "flex flex-col gap-6 px-4 py-4 lg:h-full lg:flex-row lg:px-6 lg:py-8",
3134
3131
  children: [/* @__PURE__ */ jsxs("div", {
3135
- className: "w-80 space-y-6 overflow-y-auto",
3132
+ className: cn("w-full space-y-6 lg:w-80 lg:overflow-y-auto", isEditingProfile && "hidden lg:block"),
3136
3133
  children: [/* @__PURE__ */ jsx(ContactInfoCard, {
3137
3134
  contact: contactInfo,
3138
3135
  isDimmed: isEditingProfile,
@@ -3156,15 +3153,15 @@ function RepContactDetailView({ contact, contactId, countryOptions = DEFAULT_COU
3156
3153
  disabled: isEditingProfile
3157
3154
  })]
3158
3155
  }), /* @__PURE__ */ jsxs("div", {
3159
- className: "flex flex-1 flex-col overflow-hidden",
3156
+ className: "flex flex-1 flex-col lg:overflow-hidden",
3160
3157
  children: [isEditingProfile ? /* @__PURE__ */ jsxs("div", {
3161
- className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2",
3158
+ className: "flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:gap-x-4 sm:gap-y-2",
3162
3159
  children: [/* @__PURE__ */ jsxs("div", {
3163
3160
  className: "flex min-w-0 items-center gap-1",
3164
3161
  children: [/* @__PURE__ */ jsx("button", {
3165
3162
  type: "button",
3166
3163
  onClick: () => setActiveTab("Tasks"),
3167
- className: "text-muted-foreground hover:bg-muted hover:text-foreground flex h-9 w-9 shrink-0 items-center justify-center rounded-md transition-colors",
3164
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground hidden h-9 w-9 shrink-0 items-center justify-center rounded-md transition-colors sm:flex",
3168
3165
  "aria-label": "Back to Tasks",
3169
3166
  children: /* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4" })
3170
3167
  }), /* @__PURE__ */ jsxs("span", {
@@ -3172,17 +3169,21 @@ function RepContactDetailView({ contact, contactId, countryOptions = DEFAULT_COU
3172
3169
  children: ["Editing ", fullName]
3173
3170
  })]
3174
3171
  }), /* @__PURE__ */ jsxs("div", {
3175
- className: "flex shrink-0 items-center gap-3",
3172
+ className: "flex w-full flex-col gap-2 sm:w-auto sm:shrink-0 sm:flex-row sm:items-center sm:gap-3",
3176
3173
  children: [/* @__PURE__ */ jsx(Button, {
3177
3174
  type: "button",
3178
3175
  variant: "secondary",
3179
3176
  onClick: () => setActiveTab("Tasks"),
3177
+ disabled: isSubmitting,
3178
+ className: "w-full sm:w-auto",
3180
3179
  children: "Cancel"
3181
- }), /* @__PURE__ */ jsx(Button, {
3180
+ }), /* @__PURE__ */ jsxs(Button, {
3182
3181
  type: "button",
3183
3182
  onClick: onSave,
3184
3183
  disabled: !isDirty || isSubmitting,
3185
- children: isSubmitting ? "Updating…" : "Update Contact"
3184
+ "aria-busy": isSubmitting,
3185
+ className: "w-full sm:w-auto",
3186
+ children: [isSubmitting && /* @__PURE__ */ jsx(Spinner, { className: "size-4" }), isSubmitting ? "Saving" : "Update Contact"]
3186
3187
  })]
3187
3188
  })]
3188
3189
  }) : /* @__PURE__ */ jsx("div", {
@@ -3194,7 +3195,7 @@ function RepContactDetailView({ contact, contactId, countryOptions = DEFAULT_COU
3194
3195
  children: tab
3195
3196
  }, tab))
3196
3197
  }), /* @__PURE__ */ jsxs("div", {
3197
- className: "flex-1 overflow-y-auto pt-6",
3198
+ className: "flex-1 pt-6 lg:overflow-y-auto",
3198
3199
  children: [
3199
3200
  activeTab === "Tasks" && /* @__PURE__ */ jsx(TaskList, {
3200
3201
  tasks,
@@ -4594,4 +4595,4 @@ const contactsScreenPropertySchema = {
4594
4595
  //#endregion
4595
4596
  export { ContactsScreen_exports as n, contactsScreenPropertySchema as r, ContactsScreen as t };
4596
4597
 
4597
- //# sourceMappingURL=ContactsScreen-Cx_EJtrO.mjs.map
4598
+ //# sourceMappingURL=ContactsScreen-C1TCBi7p.mjs.map