@open-mercato/core 0.6.6-develop.6519.1.bdc91fb755 → 0.6.6-develop.6520.1.55df6df792

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 (70) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/customers/backend/calendar/page.js +9 -1
  3. package/dist/modules/customers/backend/calendar/page.js.map +2 -2
  4. package/dist/modules/customers/components/calendar/AgendaList.js +0 -11
  5. package/dist/modules/customers/components/calendar/AgendaList.js.map +2 -2
  6. package/dist/modules/customers/components/calendar/CalendarEventEditor.js +391 -235
  7. package/dist/modules/customers/components/calendar/CalendarEventEditor.js.map +2 -2
  8. package/dist/modules/customers/components/calendar/CalendarScreen.js +5 -5
  9. package/dist/modules/customers/components/calendar/CalendarScreen.js.map +2 -2
  10. package/dist/modules/customers/components/calendar/CalendarSettingsModal.js +2 -2
  11. package/dist/modules/customers/components/calendar/CalendarSettingsModal.js.map +2 -2
  12. package/dist/modules/customers/components/calendar/MonthGrid.js +1 -11
  13. package/dist/modules/customers/components/calendar/MonthGrid.js.map +2 -2
  14. package/dist/modules/customers/components/calendar/TimeGrid.js +162 -176
  15. package/dist/modules/customers/components/calendar/TimeGrid.js.map +2 -2
  16. package/dist/modules/customers/components/calendar/editor/LocationField.js +61 -14
  17. package/dist/modules/customers/components/calendar/editor/LocationField.js.map +2 -2
  18. package/dist/modules/customers/components/calendar/editor/PeopleField.js +10 -5
  19. package/dist/modules/customers/components/calendar/editor/PeopleField.js.map +2 -2
  20. package/dist/modules/customers/components/calendar/editor/PriorityField.js +85 -0
  21. package/dist/modules/customers/components/calendar/editor/PriorityField.js.map +7 -0
  22. package/dist/modules/customers/components/calendar/editor/RelatedToField.js +8 -3
  23. package/dist/modules/customers/components/calendar/editor/RelatedToField.js.map +2 -2
  24. package/dist/modules/customers/components/calendar/editor/ResourcesField.js +225 -0
  25. package/dist/modules/customers/components/calendar/editor/ResourcesField.js.map +7 -0
  26. package/dist/modules/customers/components/calendar/editor/SegmentGroup.js +12 -7
  27. package/dist/modules/customers/components/calendar/editor/SegmentGroup.js.map +2 -2
  28. package/dist/modules/customers/components/calendar/editor/inputs.js +68 -57
  29. package/dist/modules/customers/components/calendar/editor/inputs.js.map +2 -2
  30. package/dist/modules/customers/components/calendar/editor/lookups.js +82 -2
  31. package/dist/modules/customers/components/calendar/editor/lookups.js.map +2 -2
  32. package/dist/modules/customers/components/calendar/useCalendarItems.js +6 -1
  33. package/dist/modules/customers/components/calendar/useCalendarItems.js.map +2 -2
  34. package/dist/modules/customers/data/validators.js +3 -1
  35. package/dist/modules/customers/data/validators.js.map +2 -2
  36. package/dist/modules/customers/lib/calendar/editorPayload.js +53 -22
  37. package/dist/modules/customers/lib/calendar/editorPayload.js.map +2 -2
  38. package/dist/modules/entities/backend/entities/user/[entityId]/page.js +1 -1
  39. package/dist/modules/entities/backend/entities/user/[entityId]/page.js.map +2 -2
  40. package/package.json +7 -7
  41. package/src/modules/customers/backend/calendar/page.tsx +8 -1
  42. package/src/modules/customers/components/calendar/AgendaList.tsx +0 -10
  43. package/src/modules/customers/components/calendar/CalendarEventEditor.tsx +444 -261
  44. package/src/modules/customers/components/calendar/CalendarScreen.tsx +12 -5
  45. package/src/modules/customers/components/calendar/CalendarSettingsModal.tsx +6 -6
  46. package/src/modules/customers/components/calendar/MonthGrid.tsx +0 -11
  47. package/src/modules/customers/components/calendar/TimeGrid.tsx +1 -24
  48. package/src/modules/customers/components/calendar/editor/LocationField.tsx +64 -2
  49. package/src/modules/customers/components/calendar/editor/PeopleField.tsx +11 -4
  50. package/src/modules/customers/components/calendar/editor/PriorityField.tsx +90 -0
  51. package/src/modules/customers/components/calendar/editor/RelatedToField.tsx +8 -3
  52. package/src/modules/customers/components/calendar/editor/ResourcesField.tsx +264 -0
  53. package/src/modules/customers/components/calendar/editor/SegmentGroup.tsx +14 -6
  54. package/src/modules/customers/components/calendar/editor/inputs.tsx +91 -50
  55. package/src/modules/customers/components/calendar/editor/lookups.ts +115 -2
  56. package/src/modules/customers/components/calendar/useCalendarItems.ts +8 -1
  57. package/src/modules/customers/data/validators.ts +3 -1
  58. package/src/modules/customers/i18n/de.json +12 -2
  59. package/src/modules/customers/i18n/en.json +12 -2
  60. package/src/modules/customers/i18n/es.json +12 -2
  61. package/src/modules/customers/i18n/pl.json +12 -2
  62. package/src/modules/customers/lib/calendar/editorPayload.ts +94 -37
  63. package/src/modules/entities/backend/entities/user/[entityId]/page.tsx +1 -1
  64. package/src/modules/entities/i18n/de.json +120 -0
  65. package/src/modules/entities/i18n/en.json +120 -0
  66. package/src/modules/entities/i18n/es.json +120 -0
  67. package/src/modules/entities/i18n/pl.json +120 -0
  68. package/dist/modules/customers/components/calendar/editor/CategoryField.js +0 -75
  69. package/dist/modules/customers/components/calendar/editor/CategoryField.js.map +0 -7
  70. package/src/modules/customers/components/calendar/editor/CategoryField.tsx +0 -79
@@ -70,7 +70,7 @@ async function fetchDealById(dealId, signal) {
70
70
  }
71
71
  async function searchPeopleOptions(query, options) {
72
72
  const [staff, customers] = await Promise.all([
73
- fetchAssignableStaffMembers(query, { pageSize: 10, signal: options.signal }),
73
+ options.includeStaff === false ? Promise.resolve([]) : fetchAssignableStaffMembers(query, { pageSize: 10, signal: options.signal }).catch(() => []),
74
74
  options.includeCustomers ? searchRelatedEntities("person", query, options.signal) : Promise.resolve([])
75
75
  ]);
76
76
  const staffOptions = staff.map((member) => ({
@@ -87,6 +87,83 @@ async function searchPeopleOptions(query, options) {
87
87
  }));
88
88
  return [...staffOptions, ...customerOptions];
89
89
  }
90
+ const RESOURCE_PAGE_SIZE = 20;
91
+ async function searchResourceOptions(params, signal) {
92
+ const search = new URLSearchParams({
93
+ page: "1",
94
+ pageSize: String(RESOURCE_PAGE_SIZE),
95
+ sortField: "name",
96
+ sortDir: "asc",
97
+ isActive: "true"
98
+ });
99
+ if (params.query.length) search.set("search", params.query);
100
+ if (params.resourceTypeId) search.set("resourceTypeId", params.resourceTypeId);
101
+ const data = await readApiResultOrThrow(
102
+ `/api/resources/resources?${search.toString()}`,
103
+ { signal }
104
+ );
105
+ const rows = Array.isArray(data?.items) ? data.items : [];
106
+ const items = rows.map((item) => {
107
+ if (!item || typeof item !== "object") return null;
108
+ const id = typeof item.id === "string" ? item.id : null;
109
+ if (!id) return null;
110
+ const label = readNonEmptyString(item.name) ?? id;
111
+ return { id, label };
112
+ }).filter((option) => option !== null);
113
+ const total = typeof data?.total === "number" && Number.isFinite(data.total) ? data.total : items.length;
114
+ return { items, total };
115
+ }
116
+ async function fetchResourceTypes(signal) {
117
+ const params = new URLSearchParams({
118
+ page: "1",
119
+ pageSize: "100",
120
+ sortField: "name",
121
+ sortDir: "asc",
122
+ withResourceCounts: "true"
123
+ });
124
+ try {
125
+ const data = await readApiResultOrThrow(
126
+ `/api/resources/resource-types?${params.toString()}`,
127
+ { signal }
128
+ );
129
+ const rows = Array.isArray(data?.items) ? data.items : [];
130
+ return rows.map((item) => {
131
+ if (!item || typeof item !== "object") return null;
132
+ const id = typeof item.id === "string" ? item.id : null;
133
+ if (!id) return null;
134
+ const name = readNonEmptyString(item.name) ?? id;
135
+ const rawCount = item.resourceCount;
136
+ const count = typeof rawCount === "number" && Number.isFinite(rawCount) ? rawCount : 0;
137
+ return { id, name, count };
138
+ }).filter((type) => type !== null);
139
+ } catch {
140
+ return [];
141
+ }
142
+ }
143
+ async function fetchPeoplePhones(ids, signal) {
144
+ const unique = Array.from(new Set(ids.filter((id) => typeof id === "string" && id.length > 0)));
145
+ if (unique.length === 0) return [];
146
+ const params = new URLSearchParams({ page: "1", pageSize: "100", ids: unique.join(",") });
147
+ try {
148
+ const data = await readApiResultOrThrow(
149
+ `/api/customers/people?${params.toString()}`,
150
+ { signal }
151
+ );
152
+ const items = Array.isArray(data?.items) ? data.items : [];
153
+ const result = [];
154
+ for (const item of items) {
155
+ if (!item || typeof item !== "object") continue;
156
+ const id = typeof item.id === "string" ? item.id : null;
157
+ const phone = readNonEmptyString(item.primaryPhone) ?? readNonEmptyString(item.primary_phone);
158
+ if (!id || !phone) continue;
159
+ const name = readNonEmptyString(item.displayName) ?? readNonEmptyString(item.display_name) ?? id;
160
+ result.push({ id, name, phone });
161
+ }
162
+ return result;
163
+ } catch {
164
+ return [];
165
+ }
166
+ }
90
167
  async function findStaffMemberName(userId, signal) {
91
168
  try {
92
169
  const members = await fetchAssignableStaffMembers("", { pageSize: 100, signal });
@@ -99,9 +176,12 @@ async function findStaffMemberName(userId, signal) {
99
176
  export {
100
177
  fetchDealById,
101
178
  fetchDealsForEntity,
179
+ fetchPeoplePhones,
102
180
  fetchRelatedEntityById,
181
+ fetchResourceTypes,
103
182
  findStaffMemberName,
104
183
  searchPeopleOptions,
105
- searchRelatedEntities
184
+ searchRelatedEntities,
185
+ searchResourceOptions
106
186
  };
107
187
  //# sourceMappingURL=lookups.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/modules/customers/components/calendar/editor/lookups.ts"],
4
- "sourcesContent": ["import { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { fetchAssignableStaffMembers } from '../../detail/assignableStaff'\n\nexport type RelatedEntityKind = 'person' | 'company'\n\nexport type RelatedEntityOption = {\n id: string\n kind: RelatedEntityKind\n label: string\n subtitle: string | null\n}\n\nexport type DealOption = {\n id: string\n label: string\n}\n\nexport type PersonOption = {\n userId: string\n name: string\n email: string | null\n isCustomer: boolean\n}\n\nfunction readNonEmptyString(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed.length > 0 ? trimmed : null\n}\n\nfunction extractRelatedEntityOption(item: Record<string, unknown>, kind: RelatedEntityKind): RelatedEntityOption | null {\n const id = typeof item.id === 'string' ? item.id : null\n if (!id) return null\n const displayName = readNonEmptyString(item.displayName) ?? readNonEmptyString(item.display_name)\n const detail = kind === 'person'\n ? readNonEmptyString(item.primaryEmail) ?? readNonEmptyString(item.primary_email)\n : readNonEmptyString(item.domain)\n ?? readNonEmptyString(item.websiteUrl)\n ?? readNonEmptyString(item.website_url)\n const label = displayName ?? detail ?? id\n return { id, kind, label, subtitle: detail && detail !== label ? detail : null }\n}\n\n// Same lookup source as the deal-association pattern in DealForm\n// (useDealAssociationLookups): the people/companies CRUD list APIs with\n// `search` + name sorting, merged into a single related-to picker.\nexport async function searchRelatedEntities(\n kind: RelatedEntityKind,\n query: string,\n signal: AbortSignal,\n): Promise<RelatedEntityOption[]> {\n const params = new URLSearchParams({ page: '1', pageSize: '20', sortField: 'name', sortDir: 'asc' })\n if (query.length) params.set('search', query)\n const endpoint = kind === 'person'\n ? `/api/customers/people?${params.toString()}`\n : `/api/customers/companies?${params.toString()}`\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(endpoint, { signal })\n const items = Array.isArray(data?.items) ? data.items : []\n return items\n .map((item) => (item && typeof item === 'object' ? extractRelatedEntityOption(item, kind) : null))\n .filter((option): option is RelatedEntityOption => option !== null)\n}\n\nasync function fetchRelatedEntityOfKind(\n kind: RelatedEntityKind,\n entityId: string,\n signal: AbortSignal,\n): Promise<RelatedEntityOption | null> {\n const params = new URLSearchParams({ page: '1', pageSize: '1', ids: entityId })\n const endpoint = kind === 'person'\n ? `/api/customers/people?${params.toString()}`\n : `/api/customers/companies?${params.toString()}`\n try {\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(endpoint, { signal })\n const item = Array.isArray(data?.items) ? data.items[0] : null\n return item && typeof item === 'object' ? extractRelatedEntityOption(item, kind) : null\n } catch {\n return null\n }\n}\n\nexport async function fetchRelatedEntityById(entityId: string, signal: AbortSignal): Promise<RelatedEntityOption | null> {\n const [person, company] = await Promise.all([\n fetchRelatedEntityOfKind('person', entityId, signal),\n fetchRelatedEntityOfKind('company', entityId, signal),\n ])\n return person ?? company\n}\n\nfunction extractDealOption(item: Record<string, unknown>): DealOption | null {\n const id = typeof item.id === 'string' ? item.id : null\n if (!id) return null\n const label = readNonEmptyString(item.title) ?? id\n return { id, label }\n}\n\nexport async function fetchDealsForEntity(\n entity: { id: string; kind: RelatedEntityKind },\n signal: AbortSignal,\n): Promise<DealOption[]> {\n const params = new URLSearchParams({ page: '1', pageSize: '20' })\n params.set(entity.kind === 'person' ? 'personId' : 'companyId', entity.id)\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(\n `/api/customers/deals?${params.toString()}`,\n { signal },\n )\n const items = Array.isArray(data?.items) ? data.items : []\n return items\n .map((item) => (item && typeof item === 'object' ? extractDealOption(item) : null))\n .filter((option): option is DealOption => option !== null)\n}\n\nexport async function fetchDealById(dealId: string, signal: AbortSignal): Promise<DealOption | null> {\n try {\n const params = new URLSearchParams({ page: '1', pageSize: '1', ids: dealId })\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(\n `/api/customers/deals?${params.toString()}`,\n { signal },\n )\n const item = Array.isArray(data?.items) ? data.items[0] : null\n return item && typeof item === 'object' ? extractDealOption(item) : null\n } catch {\n return null\n }\n}\n\nexport async function searchPeopleOptions(\n query: string,\n options: { includeCustomers: boolean; signal: AbortSignal },\n): Promise<PersonOption[]> {\n const [staff, customers] = await Promise.all([\n fetchAssignableStaffMembers(query, { pageSize: 10, signal: options.signal }),\n options.includeCustomers\n ? searchRelatedEntities('person', query, options.signal)\n : Promise.resolve<RelatedEntityOption[]>([]),\n ])\n const staffOptions: PersonOption[] = staff.map((member) => ({\n userId: member.userId,\n name: member.displayName,\n email: member.email,\n isCustomer: false,\n }))\n const customerOptions: PersonOption[] = customers.map((person) => ({\n userId: person.id,\n name: person.label,\n email: person.subtitle,\n isCustomer: true,\n }))\n return [...staffOptions, ...customerOptions]\n}\n\nexport async function findStaffMemberName(userId: string, signal: AbortSignal): Promise<string | null> {\n try {\n const members = await fetchAssignableStaffMembers('', { pageSize: 100, signal })\n const match = members.find((member) => member.userId === userId)\n return match ? match.displayName : null\n } catch {\n return null\n }\n}\n"],
5
- "mappings": "AAAA,SAA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Q,MAAM,cAAc;AAAA,EACrC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { fetchAssignableStaffMembers } from '../../detail/assignableStaff'\n\nexport type RelatedEntityKind = 'person' | 'company'\n\nexport type RelatedEntityOption = {\n id: string\n kind: RelatedEntityKind\n label: string\n subtitle: string | null\n}\n\nexport type DealOption = {\n id: string\n label: string\n}\n\nexport type PersonOption = {\n userId: string\n name: string\n email: string | null\n isCustomer: boolean\n}\n\nfunction readNonEmptyString(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed.length > 0 ? trimmed : null\n}\n\nfunction extractRelatedEntityOption(item: Record<string, unknown>, kind: RelatedEntityKind): RelatedEntityOption | null {\n const id = typeof item.id === 'string' ? item.id : null\n if (!id) return null\n const displayName = readNonEmptyString(item.displayName) ?? readNonEmptyString(item.display_name)\n const detail = kind === 'person'\n ? readNonEmptyString(item.primaryEmail) ?? readNonEmptyString(item.primary_email)\n : readNonEmptyString(item.domain)\n ?? readNonEmptyString(item.websiteUrl)\n ?? readNonEmptyString(item.website_url)\n const label = displayName ?? detail ?? id\n return { id, kind, label, subtitle: detail && detail !== label ? detail : null }\n}\n\n// Same lookup source as the deal-association pattern in DealForm\n// (useDealAssociationLookups): the people/companies CRUD list APIs with\n// `search` + name sorting, merged into a single related-to picker.\nexport async function searchRelatedEntities(\n kind: RelatedEntityKind,\n query: string,\n signal: AbortSignal,\n): Promise<RelatedEntityOption[]> {\n const params = new URLSearchParams({ page: '1', pageSize: '20', sortField: 'name', sortDir: 'asc' })\n if (query.length) params.set('search', query)\n const endpoint = kind === 'person'\n ? `/api/customers/people?${params.toString()}`\n : `/api/customers/companies?${params.toString()}`\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(endpoint, { signal })\n const items = Array.isArray(data?.items) ? data.items : []\n return items\n .map((item) => (item && typeof item === 'object' ? extractRelatedEntityOption(item, kind) : null))\n .filter((option): option is RelatedEntityOption => option !== null)\n}\n\nasync function fetchRelatedEntityOfKind(\n kind: RelatedEntityKind,\n entityId: string,\n signal: AbortSignal,\n): Promise<RelatedEntityOption | null> {\n const params = new URLSearchParams({ page: '1', pageSize: '1', ids: entityId })\n const endpoint = kind === 'person'\n ? `/api/customers/people?${params.toString()}`\n : `/api/customers/companies?${params.toString()}`\n try {\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(endpoint, { signal })\n const item = Array.isArray(data?.items) ? data.items[0] : null\n return item && typeof item === 'object' ? extractRelatedEntityOption(item, kind) : null\n } catch {\n return null\n }\n}\n\nexport async function fetchRelatedEntityById(entityId: string, signal: AbortSignal): Promise<RelatedEntityOption | null> {\n const [person, company] = await Promise.all([\n fetchRelatedEntityOfKind('person', entityId, signal),\n fetchRelatedEntityOfKind('company', entityId, signal),\n ])\n return person ?? company\n}\n\nfunction extractDealOption(item: Record<string, unknown>): DealOption | null {\n const id = typeof item.id === 'string' ? item.id : null\n if (!id) return null\n const label = readNonEmptyString(item.title) ?? id\n return { id, label }\n}\n\nexport async function fetchDealsForEntity(\n entity: { id: string; kind: RelatedEntityKind },\n signal: AbortSignal,\n): Promise<DealOption[]> {\n const params = new URLSearchParams({ page: '1', pageSize: '20' })\n params.set(entity.kind === 'person' ? 'personId' : 'companyId', entity.id)\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(\n `/api/customers/deals?${params.toString()}`,\n { signal },\n )\n const items = Array.isArray(data?.items) ? data.items : []\n return items\n .map((item) => (item && typeof item === 'object' ? extractDealOption(item) : null))\n .filter((option): option is DealOption => option !== null)\n}\n\nexport async function fetchDealById(dealId: string, signal: AbortSignal): Promise<DealOption | null> {\n try {\n const params = new URLSearchParams({ page: '1', pageSize: '1', ids: dealId })\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(\n `/api/customers/deals?${params.toString()}`,\n { signal },\n )\n const item = Array.isArray(data?.items) ? data.items[0] : null\n return item && typeof item === 'object' ? extractDealOption(item) : null\n } catch {\n return null\n }\n}\n\nexport async function searchPeopleOptions(\n query: string,\n options: { includeCustomers: boolean; includeStaff?: boolean; signal: AbortSignal },\n): Promise<PersonOption[]> {\n // Staff lookup is optional twice over: skipped when the staff module is not\n // loaded (includeStaff === false) and non-fatal when the endpoint errors, so\n // the people picker always degrades to customer-only options (#3552).\n const [staff, customers] = await Promise.all([\n options.includeStaff === false\n ? Promise.resolve<Awaited<ReturnType<typeof fetchAssignableStaffMembers>>>([])\n : fetchAssignableStaffMembers(query, { pageSize: 10, signal: options.signal }).catch(() => []),\n options.includeCustomers\n ? searchRelatedEntities('person', query, options.signal)\n : Promise.resolve<RelatedEntityOption[]>([]),\n ])\n const staffOptions: PersonOption[] = staff.map((member) => ({\n userId: member.userId,\n name: member.displayName,\n email: member.email,\n isCustomer: false,\n }))\n const customerOptions: PersonOption[] = customers.map((person) => ({\n userId: person.id,\n name: person.label,\n email: person.subtitle,\n isCustomer: true,\n }))\n return [...staffOptions, ...customerOptions]\n}\n\nexport type ResourceOption = {\n id: string\n label: string\n}\n\n// Consumed only when the resources module is loaded (server flag from the\n// calendar page); reads the resources CRUD list API \u2014 never resource entities.\nexport type ResourceType = { id: string; name: string; count: number }\n\nexport type ResourceSearchResult = { items: ResourceOption[]; total: number }\n\nconst RESOURCE_PAGE_SIZE = 20\n\n// Server-side resource search, optionally scoped to one resource type. Returns\n// the (page-limited) options plus the full match count so the UI can show a\n// \"showing N of M\" hint and nudge the user to narrow a large catalog (#3552).\nexport async function searchResourceOptions(\n params: { query: string; resourceTypeId?: string | null },\n signal: AbortSignal,\n): Promise<ResourceSearchResult> {\n const search = new URLSearchParams({\n page: '1',\n pageSize: String(RESOURCE_PAGE_SIZE),\n sortField: 'name',\n sortDir: 'asc',\n isActive: 'true',\n })\n if (params.query.length) search.set('search', params.query)\n if (params.resourceTypeId) search.set('resourceTypeId', params.resourceTypeId)\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>>; total?: number }>(\n `/api/resources/resources?${search.toString()}`,\n { signal },\n )\n const rows = Array.isArray(data?.items) ? data.items : []\n const items = rows\n .map((item): ResourceOption | null => {\n if (!item || typeof item !== 'object') return null\n const id = typeof item.id === 'string' ? item.id : null\n if (!id) return null\n const label = readNonEmptyString(item.name) ?? id\n return { id, label }\n })\n .filter((option): option is ResourceOption => option !== null)\n const total = typeof data?.total === 'number' && Number.isFinite(data.total) ? data.total : items.length\n return { items, total }\n}\n\n// Resource types with their resource counts, for the dropdown's type filter.\nexport async function fetchResourceTypes(signal: AbortSignal): Promise<ResourceType[]> {\n const params = new URLSearchParams({\n page: '1',\n pageSize: '100',\n sortField: 'name',\n sortDir: 'asc',\n withResourceCounts: 'true',\n })\n try {\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(\n `/api/resources/resource-types?${params.toString()}`,\n { signal },\n )\n const rows = Array.isArray(data?.items) ? data.items : []\n return rows\n .map((item): ResourceType | null => {\n if (!item || typeof item !== 'object') return null\n const id = typeof item.id === 'string' ? item.id : null\n if (!id) return null\n const name = readNonEmptyString(item.name) ?? id\n const rawCount = (item as Record<string, unknown>).resourceCount\n const count = typeof rawCount === 'number' && Number.isFinite(rawCount) ? rawCount : 0\n return { id, name, count }\n })\n .filter((type): type is ResourceType => type !== null)\n } catch {\n return []\n }\n}\n\nexport type ContactPhone = { id: string; name: string; phone: string }\n\n// Resolves primary phone numbers for the given person ids (companies/staff have\n// none and simply drop out \u2014 the people query only matches people). Used by the\n// Call editor's \"insert phone from contact\" button (#3552).\nexport async function fetchPeoplePhones(ids: string[], signal: AbortSignal): Promise<ContactPhone[]> {\n const unique = Array.from(new Set(ids.filter((id) => typeof id === 'string' && id.length > 0)))\n if (unique.length === 0) return []\n const params = new URLSearchParams({ page: '1', pageSize: '100', ids: unique.join(',') })\n try {\n const data = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(\n `/api/customers/people?${params.toString()}`,\n { signal },\n )\n const items = Array.isArray(data?.items) ? data.items : []\n const result: ContactPhone[] = []\n for (const item of items) {\n if (!item || typeof item !== 'object') continue\n const id = typeof item.id === 'string' ? item.id : null\n const phone = readNonEmptyString(item.primaryPhone) ?? readNonEmptyString(item.primary_phone)\n if (!id || !phone) continue\n const name = readNonEmptyString(item.displayName) ?? readNonEmptyString(item.display_name) ?? id\n result.push({ id, name, phone })\n }\n return result\n } catch {\n return []\n }\n}\n\nexport async function findStaffMemberName(userId: string, signal: AbortSignal): Promise<string | null> {\n try {\n const members = await fetchAssignableStaffMembers('', { pageSize: 100, signal })\n const match = members.find((member) => member.userId === userId)\n return match ? match.displayName : null\n } catch {\n return null\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,4BAA4B;AACrC,SAAS,mCAAmC;AAuB5C,SAAS,mBAAmB,OAA+B;AACzD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,SAAO,QAAQ,SAAS,IAAI,UAAU;AACxC;AAEA,SAAS,2BAA2B,MAA+B,MAAqD;AACtH,QAAM,KAAK,OAAO,KAAK,OAAO,WAAW,KAAK,KAAK;AACnD,MAAI,CAAC,GAAI,QAAO;AAChB,QAAM,cAAc,mBAAmB,KAAK,WAAW,KAAK,mBAAmB,KAAK,YAAY;AAChG,QAAM,SAAS,SAAS,WACpB,mBAAmB,KAAK,YAAY,KAAK,mBAAmB,KAAK,aAAa,IAC9E,mBAAmB,KAAK,MAAM,KAC3B,mBAAmB,KAAK,UAAU,KAClC,mBAAmB,KAAK,WAAW;AAC1C,QAAM,QAAQ,eAAe,UAAU;AACvC,SAAO,EAAE,IAAI,MAAM,OAAO,UAAU,UAAU,WAAW,QAAQ,SAAS,KAAK;AACjF;AAKA,eAAsB,sBACpB,MACA,OACA,QACgC;AAChC,QAAM,SAAS,IAAI,gBAAgB,EAAE,MAAM,KAAK,UAAU,MAAM,WAAW,QAAQ,SAAS,MAAM,CAAC;AACnG,MA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EAAE,OAAO;AAAA,IACX;AACA,UAAM,QAAQ,MAAM,QAAQ,MAAM,KAAK,IAAI,KAAK,QAAQ,CAAC;AACzD,UAAM,SAAyB,CAAC;AAChC,eAAW,QAAQ,OAAO;AACxB,UAAI,CAAC,QAAQ,OAAO,SAAS,SAAU;AACvC,YAAM,KAAK,OAAO,KAAK,OAAO,WAAW,KAAK,KAAK;AACnD,YAAM,QAAQ,mBAAmB,KAAK,YAAY,KAAK,mBAAmB,KAAK,aAAa;AAC5F,UAAI,CAAC,MAAM,CAAC,MAAO;AACnB,YAAM,OAAO,mBAAmB,KAAK,WAAW,KAAK,mBAAmB,KAAK,YAAY,KAAK;AAC9F,aAAO,KAAK,EAAE,IAAI,MAAM,MAAM,CAAC;AAAA,IACjC;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAEA,eAAsB,oBAAoB,QAAgB,QAA6C;AACrG,MAAI;AACF,UAAM,UAAU,MAAM,4BAA4B,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;AAC/E,UAAM,QAAQ,QAAQ,KAAK,CAAC,WAAW,OAAO,WAAW,MAAM;AAC/D,WAAO,QAAQ,MAAM,cAAc;AAAA,EACrC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -45,6 +45,7 @@ function useCalendarItems(range) {
45
45
  const [truncated, setTruncated] = React.useState(false);
46
46
  const [typeLabels, setTypeLabels] = React.useState({});
47
47
  const [typeColors, setTypeColors] = React.useState({});
48
+ const [typeIcons, setTypeIcons] = React.useState({});
48
49
  const [reloadToken, setReloadToken] = React.useState(0);
49
50
  const fromTime = range.from.getTime();
50
51
  const toTime = range.to.getTime();
@@ -60,18 +61,22 @@ function useCalendarItems(range) {
60
61
  const entries = Array.isArray(call.result?.items) ? call.result.items : [];
61
62
  const labels = {};
62
63
  const colors = {};
64
+ const icons = {};
63
65
  for (const entry of entries) {
64
66
  if (typeof entry?.value !== "string" || entry.value.length === 0) continue;
65
67
  labels[entry.value] = typeof entry.label === "string" && entry.label.length > 0 ? entry.label : entry.value;
66
68
  colors[entry.value] = typeof entry.color === "string" && entry.color.length > 0 ? entry.color : null;
69
+ icons[entry.value] = typeof entry.icon === "string" && entry.icon.length > 0 ? entry.icon : null;
67
70
  }
68
71
  setTypeLabels(labels);
69
72
  setTypeColors(colors);
73
+ setTypeIcons(icons);
70
74
  }
71
75
  loadActivityTypes().catch(() => {
72
76
  if (cancelled || controller.signal.aborted) return;
73
77
  setTypeLabels({});
74
78
  setTypeColors({});
79
+ setTypeIcons({});
75
80
  });
76
81
  return () => {
77
82
  cancelled = true;
@@ -121,7 +126,7 @@ function useCalendarItems(range) {
121
126
  const refetch = React.useCallback(() => {
122
127
  setReloadToken((token) => token + 1);
123
128
  }, []);
124
- return { items, isLoading, error, truncated, typeLabels, typeColors, refetch };
129
+ return { items, isLoading, error, truncated, typeLabels, typeColors, typeIcons, refetch };
125
130
  }
126
131
  export {
127
132
  MAX_WINDOW_ITEMS,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/customers/components/calendar/useCalendarItems.ts"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { expandOccurrences } from '../../lib/calendar/recurrence'\nimport { getFetchWindow } from '../../lib/calendar/range'\nimport { mapInteractionToCalendarItem } from '../../lib/calendar/mapItem'\nimport {\n calendarInteractionPayloadSchema,\n type CalendarInteractionPayload,\n type CalendarItem,\n type CalendarRange,\n} from './types'\n\nconst PAGE_LIMIT = 100\nexport const MAX_WINDOW_ITEMS = 500\n\n/**\n * Cursor-follows `/api/customers/interactions` across the given window (already\n * padded by the caller) up to `MAX_WINDOW_ITEMS`. Shared by the grid data hook\n * and the editor's conflict probe so both see the exact same candidate set.\n */\nexport async function fetchInteractionWindow(\n window: CalendarRange,\n signal?: AbortSignal,\n): Promise<{ payloads: CalendarInteractionPayload[]; truncated: boolean }> {\n const collected: CalendarInteractionPayload[] = []\n let cursor: string | undefined\n let truncated = false\n do {\n const params = new URLSearchParams({\n from: window.from.toISOString(),\n to: window.to.toISOString(),\n limit: String(PAGE_LIMIT),\n })\n if (cursor) params.set('cursor', cursor)\n const call = await apiCall<{ items?: unknown[]; nextCursor?: string }>(\n `/api/customers/interactions?${params.toString()}`,\n { signal },\n )\n if (!call.ok) throw new Error(`[internal] calendar interactions fetch failed (${call.status})`)\n const pageItems = Array.isArray(call.result?.items) ? call.result.items : []\n for (const rawItem of pageItems) {\n const parsed = calendarInteractionPayloadSchema.safeParse(rawItem)\n if (parsed.success) collected.push(parsed.data)\n }\n cursor = typeof call.result?.nextCursor === 'string' ? call.result.nextCursor : undefined\n if (cursor && collected.length >= MAX_WINDOW_ITEMS) {\n truncated = true\n cursor = undefined\n }\n } while (cursor)\n return { payloads: collected.slice(0, MAX_WINDOW_ITEMS), truncated }\n}\n\ntype ActivityTypeDictionaryEntry = {\n value?: unknown\n label?: unknown\n color?: unknown\n}\n\nexport type UseCalendarItemsResult = {\n items: CalendarItem[]\n isLoading: boolean\n error: string | null\n truncated: boolean\n typeLabels: Record<string, string>\n typeColors: Record<string, string | null>\n refetch: () => void\n}\n\nexport function useCalendarItems(range: CalendarRange): UseCalendarItemsResult {\n const [payloads, setPayloads] = React.useState<CalendarInteractionPayload[]>([])\n const [isLoading, setIsLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [truncated, setTruncated] = React.useState(false)\n const [typeLabels, setTypeLabels] = React.useState<Record<string, string>>({})\n const [typeColors, setTypeColors] = React.useState<Record<string, string | null>>({})\n const [reloadToken, setReloadToken] = React.useState(0)\n\n const fromTime = range.from.getTime()\n const toTime = range.to.getTime()\n\n React.useEffect(() => {\n const controller = new AbortController()\n let cancelled = false\n async function loadActivityTypes() {\n const call = await apiCall<{ items?: ActivityTypeDictionaryEntry[] }>(\n '/api/customers/dictionaries/activity-types',\n { signal: controller.signal },\n )\n if (cancelled || !call.ok) return\n const entries = Array.isArray(call.result?.items) ? call.result.items : []\n const labels: Record<string, string> = {}\n const colors: Record<string, string | null> = {}\n for (const entry of entries) {\n if (typeof entry?.value !== 'string' || entry.value.length === 0) continue\n labels[entry.value] = typeof entry.label === 'string' && entry.label.length > 0 ? entry.label : entry.value\n colors[entry.value] = typeof entry.color === 'string' && entry.color.length > 0 ? entry.color : null\n }\n setTypeLabels(labels)\n setTypeColors(colors)\n }\n loadActivityTypes().catch(() => {\n if (cancelled || controller.signal.aborted) return\n setTypeLabels({})\n setTypeColors({})\n })\n return () => {\n cancelled = true\n controller.abort()\n }\n }, [])\n\n React.useEffect(() => {\n const controller = new AbortController()\n let cancelled = false\n async function loadInteractions() {\n setIsLoading(true)\n setError(null)\n try {\n const fetchWindow = getFetchWindow({ from: new Date(fromTime), to: new Date(toTime) })\n const { payloads: collected, truncated: windowTruncated } = await fetchInteractionWindow(\n fetchWindow,\n controller.signal,\n )\n if (cancelled) return\n setPayloads(collected)\n setTruncated(windowTruncated)\n } catch (err) {\n if (cancelled || controller.signal.aborted) return\n setPayloads([])\n setTruncated(false)\n setError(err instanceof Error ? err.message : '[internal] calendar interactions fetch failed')\n } finally {\n if (!cancelled) setIsLoading(false)\n }\n }\n void loadInteractions()\n return () => {\n cancelled = true\n controller.abort()\n }\n }, [fromTime, toTime, reloadToken])\n\n const items = React.useMemo(() => {\n const expansionWindow = getFetchWindow({ from: new Date(fromTime), to: new Date(toTime) })\n const mapped: CalendarItem[] = []\n for (const payload of payloads) {\n const item = mapInteractionToCalendarItem(payload, typeColors)\n if (!item) continue\n mapped.push(...expandOccurrences(item, expansionWindow))\n }\n return mapped\n }, [payloads, typeColors, fromTime, toTime])\n\n const refetch = React.useCallback(() => {\n setReloadToken((token) => token + 1)\n }, [])\n\n return { items, isLoading, error, truncated, typeLabels, typeColors, refetch }\n}\n"],
5
- "mappings": ";AAEA,YAAY,WAAW;AACvB,SAAS,eAAe;AACxB,SA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E,OAAO,WAAW,OAAO,WAAW,YAAY,YAAY,QAAQ;AAC/E;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { expandOccurrences } from '../../lib/calendar/recurrence'\nimport { getFetchWindow } from '../../lib/calendar/range'\nimport { mapInteractionToCalendarItem } from '../../lib/calendar/mapItem'\nimport {\n calendarInteractionPayloadSchema,\n type CalendarInteractionPayload,\n type CalendarItem,\n type CalendarRange,\n} from './types'\n\nconst PAGE_LIMIT = 100\nexport const MAX_WINDOW_ITEMS = 500\n\n/**\n * Cursor-follows `/api/customers/interactions` across the given window (already\n * padded by the caller) up to `MAX_WINDOW_ITEMS`. Shared by the grid data hook\n * and the editor's conflict probe so both see the exact same candidate set.\n */\nexport async function fetchInteractionWindow(\n window: CalendarRange,\n signal?: AbortSignal,\n): Promise<{ payloads: CalendarInteractionPayload[]; truncated: boolean }> {\n const collected: CalendarInteractionPayload[] = []\n let cursor: string | undefined\n let truncated = false\n do {\n const params = new URLSearchParams({\n from: window.from.toISOString(),\n to: window.to.toISOString(),\n limit: String(PAGE_LIMIT),\n })\n if (cursor) params.set('cursor', cursor)\n const call = await apiCall<{ items?: unknown[]; nextCursor?: string }>(\n `/api/customers/interactions?${params.toString()}`,\n { signal },\n )\n if (!call.ok) throw new Error(`[internal] calendar interactions fetch failed (${call.status})`)\n const pageItems = Array.isArray(call.result?.items) ? call.result.items : []\n for (const rawItem of pageItems) {\n const parsed = calendarInteractionPayloadSchema.safeParse(rawItem)\n if (parsed.success) collected.push(parsed.data)\n }\n cursor = typeof call.result?.nextCursor === 'string' ? call.result.nextCursor : undefined\n if (cursor && collected.length >= MAX_WINDOW_ITEMS) {\n truncated = true\n cursor = undefined\n }\n } while (cursor)\n return { payloads: collected.slice(0, MAX_WINDOW_ITEMS), truncated }\n}\n\ntype ActivityTypeDictionaryEntry = {\n value?: unknown\n label?: unknown\n color?: unknown\n icon?: unknown\n}\n\nexport type UseCalendarItemsResult = {\n items: CalendarItem[]\n isLoading: boolean\n error: string | null\n truncated: boolean\n typeLabels: Record<string, string>\n typeColors: Record<string, string | null>\n typeIcons: Record<string, string | null>\n refetch: () => void\n}\n\nexport function useCalendarItems(range: CalendarRange): UseCalendarItemsResult {\n const [payloads, setPayloads] = React.useState<CalendarInteractionPayload[]>([])\n const [isLoading, setIsLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [truncated, setTruncated] = React.useState(false)\n const [typeLabels, setTypeLabels] = React.useState<Record<string, string>>({})\n const [typeColors, setTypeColors] = React.useState<Record<string, string | null>>({})\n const [typeIcons, setTypeIcons] = React.useState<Record<string, string | null>>({})\n const [reloadToken, setReloadToken] = React.useState(0)\n\n const fromTime = range.from.getTime()\n const toTime = range.to.getTime()\n\n React.useEffect(() => {\n const controller = new AbortController()\n let cancelled = false\n async function loadActivityTypes() {\n const call = await apiCall<{ items?: ActivityTypeDictionaryEntry[] }>(\n '/api/customers/dictionaries/activity-types',\n { signal: controller.signal },\n )\n if (cancelled || !call.ok) return\n const entries = Array.isArray(call.result?.items) ? call.result.items : []\n const labels: Record<string, string> = {}\n const colors: Record<string, string | null> = {}\n const icons: Record<string, string | null> = {}\n for (const entry of entries) {\n if (typeof entry?.value !== 'string' || entry.value.length === 0) continue\n labels[entry.value] = typeof entry.label === 'string' && entry.label.length > 0 ? entry.label : entry.value\n colors[entry.value] = typeof entry.color === 'string' && entry.color.length > 0 ? entry.color : null\n icons[entry.value] = typeof entry.icon === 'string' && entry.icon.length > 0 ? entry.icon : null\n }\n setTypeLabels(labels)\n setTypeColors(colors)\n setTypeIcons(icons)\n }\n loadActivityTypes().catch(() => {\n if (cancelled || controller.signal.aborted) return\n setTypeLabels({})\n setTypeColors({})\n setTypeIcons({})\n })\n return () => {\n cancelled = true\n controller.abort()\n }\n }, [])\n\n React.useEffect(() => {\n const controller = new AbortController()\n let cancelled = false\n async function loadInteractions() {\n setIsLoading(true)\n setError(null)\n try {\n const fetchWindow = getFetchWindow({ from: new Date(fromTime), to: new Date(toTime) })\n const { payloads: collected, truncated: windowTruncated } = await fetchInteractionWindow(\n fetchWindow,\n controller.signal,\n )\n if (cancelled) return\n setPayloads(collected)\n setTruncated(windowTruncated)\n } catch (err) {\n if (cancelled || controller.signal.aborted) return\n setPayloads([])\n setTruncated(false)\n setError(err instanceof Error ? err.message : '[internal] calendar interactions fetch failed')\n } finally {\n if (!cancelled) setIsLoading(false)\n }\n }\n void loadInteractions()\n return () => {\n cancelled = true\n controller.abort()\n }\n }, [fromTime, toTime, reloadToken])\n\n const items = React.useMemo(() => {\n const expansionWindow = getFetchWindow({ from: new Date(fromTime), to: new Date(toTime) })\n const mapped: CalendarItem[] = []\n for (const payload of payloads) {\n const item = mapInteractionToCalendarItem(payload, typeColors)\n if (!item) continue\n mapped.push(...expandOccurrences(item, expansionWindow))\n }\n return mapped\n }, [payloads, typeColors, fromTime, toTime])\n\n const refetch = React.useCallback(() => {\n setReloadToken((token) => token + 1)\n }, [])\n\n return { items, isLoading, error, truncated, typeLabels, typeColors, typeIcons, refetch }\n}\n"],
5
+ "mappings": ";AAEA,YAAY,WAAW;AACvB,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,oCAAoC;AAC7C;AAAA,EACE;AAAA,OAIK;AAEP,MAAM,aAAa;AACZ,MAAM,mBAAmB;AAOhC,eAAsB,uBACpB,QACA,QACyE;AACzE,QAAM,YAA0C,CAAC;AACjD,MAAI;AACJ,MAAI,YAAY;AAChB,KAAG;AACD,UAAM,SAAS,IAAI,gBAAgB;AAAA,MACjC,MAAM,OAAO,KAAK,YAAY;AAAA,MAC9B,IAAI,OAAO,GAAG,YAAY;AAAA,MAC1B,OAAO,OAAO,UAAU;AAAA,IAC1B,CAAC;AACD,QAAI,OAAQ,QAAO,IAAI,UAAU,MAAM;AACvC,UAAM,OAAO,MAAM;AAAA,MACjB,+BAA+B,OAAO,SAAS,CAAC;AAA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AAgB,IAAI,MAAM;AAAA,UAChE;AAAA,UACA,WAAW;AAAA,QACb;AACA,YAAI,UAAW;AACf,oBAAY,SAAS;AACrB,qBAAa,eAAe;AAAA,MAC9B,SAAS,KAAK;AACZ,YAAI,aAAa,WAAW,OAAO,QAAS;AAC5C,oBAAY,CAAC,CAAC;AACd,qBAAa,KAAK;AAClB,iBAAS,eAAe,QAAQ,IAAI,UAAU,+CAA+C;AAAA,MAC/F,UAAE;AACA,YAAI,CAAC,UAAW,cAAa,KAAK;AAAA,MACpC;AAAA,IACF;AACA,SAAK,iBAAiB;AACtB,WAAO,MAAM;AACX,kBAAY;AACZ,iBAAW,MAAM;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,WAAW,CAAC;AAElC,QAAM,QAAQ,MAAM,QAAQ,MAAM;AAChC,UAAM,kBAAkB,eAAe,EAAE,MAAM,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;AACzF,UAAM,SAAyB,CAAC;AAChC,eAAW,WAAW,UAAU;AAC9B,YAAM,OAAO,6BAA6B,SAAS,UAAU;AAC7D,UAAI,CAAC,KAAM;AACX,aAAO,KAAK,GAAG,kBAAkB,MAAM,eAAe,CAAC;AAAA,IACzD;AACA,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,YAAY,UAAU,MAAM,CAAC;AAE3C,QAAM,UAAU,MAAM,YAAY,MAAM;AACtC,mBAAe,CAAC,UAAU,QAAQ,CAAC;AAAA,EACrC,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,OAAO,WAAW,OAAO,WAAW,YAAY,YAAY,WAAW,QAAQ;AAC1F;",
6
6
  "names": []
7
7
  }
@@ -289,7 +289,9 @@ const interactionParticipantSchema = z.object({
289
289
  });
290
290
  const interactionLinkedEntitySchema = z.object({
291
291
  id: z.string().uuid(),
292
- type: z.enum(["company", "deal", "offer"]),
292
+ // 'resource' links calendar events to bookable resources (rooms, cars,
293
+ // equipment) from the optional resources module (#3552).
294
+ type: z.enum(["company", "deal", "offer", "resource"]),
293
295
  label: z.string().trim().max(500)
294
296
  });
295
297
  const interactionGuestPermissionsSchema = z.object({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/customers/data/validators.ts"],
4
- "sourcesContent": ["import { z } from 'zod'\nimport { isValidPhoneNumber } from '@open-mercato/shared/lib/phone'\nimport { COORDINATE_RANGES } from '@open-mercato/shared/lib/location/coordinates'\nimport { dictionaryEntrySortModeSchema } from '@open-mercato/core/modules/dictionaries/lib/entrySort'\n\nconst uuid = () => z.string().uuid()\n\nexport const CUSTOMER_PHONE_INVALID_MESSAGE_KEY = 'customers.people.form.primaryPhone.invalid'\nexport const ACTIVITY_DATE_REQUIRED_MESSAGE_KEY = 'customers.activities.errors.dateRequired'\nexport const ACTIVITY_TIME_REQUIRED_MESSAGE_KEY = 'customers.activities.errors.timeRequired'\nexport const ACTIVITY_PHONE_REQUIRED_MESSAGE_KEY = 'customers.activities.errors.phoneRequired'\nexport const ACTIVITY_PHONE_INVALID_MESSAGE_KEY = 'customers.activities.errors.phoneInvalid'\n\nconst emptyStringToNull = (value: unknown): unknown => {\n if (typeof value !== 'string') return value\n const trimmed = value.trim()\n return trimmed.length ? trimmed : null\n}\n\nconst phoneSchema = z.preprocess(\n emptyStringToNull,\n z\n .string()\n .trim()\n .max(50)\n .refine((val) => isValidPhoneNumber(val), { message: CUSTOMER_PHONE_INVALID_MESSAGE_KEY })\n .nullable()\n .optional(),\n)\n\nconst clearableEmailSchema = z.preprocess(\n emptyStringToNull,\n z.string().email().max(320).nullable().optional(),\n)\n\nconst clearableUrlSchema = z.preprocess(\n emptyStringToNull,\n z.string().url().max(300).nullable().optional(),\n)\n\n// Domain is a plain (non-URL) string that maps to a nullable column, so blanking\n// a previously-set value on edit must transmit null to clear it. See #2529.\nconst clearableDomainSchema = z.preprocess(\n emptyStringToNull,\n z.string().trim().max(200).nullable().optional(),\n)\n\n// Plain optional string fields that map to nullable columns: blanking a previously-set\n// value on edit must transmit null to clear it, not be silently dropped. See #3050.\nconst clearableStringSchema = (max: number) =>\n z.preprocess(emptyStringToNull, z.string().trim().max(max).nullable().optional())\n\n// Annual revenue maps to a nullable numeric column. `''`/whitespace/null all clear it;\n// `.nullable()` short-circuits before coercion so null does not coerce to 0. See #3050.\nconst clearableRevenueSchema = z.preprocess(\n (value) => {\n if (typeof value === 'string' && value.trim().length === 0) return null\n return value\n },\n z.coerce.number().min(0).nullable().optional(),\n)\n\nconst interactionPhoneNumberSchema = z.string().trim().max(50).optional().nullable()\n\nconst scopedSchema = z.object({\n organizationId: uuid(),\n tenantId: uuid(),\n})\n\nconst nextInteractionSchema = z\n .object({\n at: z.coerce.date(),\n name: z.string().trim().min(1).max(200),\n refId: z.string().trim().max(191).optional().nullable(),\n icon: z.string().trim().max(100).optional().nullable(),\n color: z\n .string()\n .trim()\n .regex(/^#([0-9a-fA-F]{6})$/)\n .optional()\n .nullable(),\n })\n .strict()\n\nconst displayNameSchema = z.string().trim().min(1).max(200)\n\nconst baseEntitySchema = {\n displayName: displayNameSchema,\n // Nullable so a blanked description on edit clears the column instead of being dropped. See #3050.\n description: clearableStringSchema(4000),\n ownerUserId: uuid().optional(),\n primaryEmail: clearableEmailSchema,\n primaryPhone: phoneSchema,\n status: z.string().trim().max(100).optional(),\n lifecycleStage: z.string().trim().max(100).optional(),\n source: z.string().trim().max(150).optional(),\n temperature: z.string().trim().max(100).optional(),\n renewalQuarter: z.string().trim().max(100).optional(),\n isActive: z.boolean().optional(),\n nextInteraction: nextInteractionSchema.nullable().optional(),\n tags: z.array(uuid()).optional(),\n}\n\nconst personDetailsSchema = {\n preferredName: z.string().trim().max(120).optional(),\n jobTitle: z.string().trim().max(150).optional(),\n department: z.string().trim().max(150).optional(),\n seniority: z.string().trim().max(100).optional(),\n timezone: z.string().trim().max(120).optional(),\n linkedInUrl: clearableUrlSchema,\n twitterUrl: clearableUrlSchema,\n companyEntityId: uuid().nullable().optional(),\n}\n\nconst personFirstNameSchema = z.string().trim().min(1).max(120)\nconst personLastNameSchema = z.string().trim().min(1).max(120)\n\nconst companyDetailsSchema = {\n // Nullable so blanked values on edit clear the columns instead of being dropped. See #3050.\n legalName: clearableStringSchema(200),\n brandName: clearableStringSchema(200),\n domain: clearableDomainSchema,\n websiteUrl: clearableUrlSchema,\n industry: z.string().trim().max(150).optional(),\n sizeBucket: clearableStringSchema(100),\n annualRevenue: clearableRevenueSchema,\n}\n\nexport const personCreateSchema = scopedSchema.extend({\n ...baseEntitySchema,\n displayName: displayNameSchema.optional(),\n firstName: personFirstNameSchema,\n lastName: personLastNameSchema,\n ...personDetailsSchema,\n})\n\nexport const personUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(\n scopedSchema.extend({\n ...baseEntitySchema,\n ...personDetailsSchema,\n firstName: personFirstNameSchema.optional(),\n lastName: personLastNameSchema.optional(),\n }).partial()\n )\n\nexport const companyCreateSchema = scopedSchema.extend({\n ...baseEntitySchema,\n displayName: displayNameSchema,\n ...companyDetailsSchema,\n})\n\nexport const companyUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(companyCreateSchema.partial())\n\nexport const dealCreateSchema = scopedSchema.extend({\n title: z.string().min(1).max(200),\n description: z.string().max(4000).optional(),\n status: z.string().max(50).optional(),\n pipelineStage: z.string().max(100).optional(),\n pipelineId: uuid().optional(),\n pipelineStageId: uuid().optional(),\n valueAmount: z.coerce.number().min(0).optional(),\n valueCurrency: z.string().min(3).max(3).optional(),\n probability: z.number().min(0).max(100).optional(),\n expectedCloseAt: z.coerce.date().optional(),\n // Nullable: the bulk owner-update worker passes `null` to clear ownership.\n // Without `.nullable()`, dealUpdateSchema.parse({ ownerUserId: null }) throws\n // ZodError \"expected string, received null\" inside the queue worker (TC-CRM-069).\n ownerUserId: uuid().optional().nullable(),\n source: z.string().max(150).optional(),\n closureOutcome: z.enum(['won', 'lost']).optional(),\n lossReasonId: uuid().optional(),\n lossNotes: z.string().max(4000).optional(),\n companyIds: z.array(uuid()).optional(),\n personIds: z.array(uuid()).optional(),\n})\n\nexport const dealUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(dealCreateSchema.partial())\n\n// Bulk update schemas \u2014 used by `api/deals/bulk-update-{owner,stage}/route.ts`. Kept here\n// so all deal-write contracts live next to `dealCreateSchema` / `dealUpdateSchema`.\nexport const dealsBulkUpdateOwnerSchema = z.object({\n ids: z.array(uuid()).min(1).max(10000),\n ownerUserId: uuid().nullable(),\n})\n\nexport const dealsBulkUpdateStageSchema = z.object({\n ids: z.array(uuid()).min(1).max(10000),\n pipelineStageId: uuid(),\n})\n\nexport const dealsBulkUpdateResponseSchema = z.object({\n ok: z.boolean(),\n progressJobId: uuid().nullable(),\n message: z.string(),\n})\n\nexport const activityCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n activityType: z.string().min(1).max(100),\n subject: z.string().max(200).optional(),\n body: z.string().max(8000).optional(),\n date: z.string().trim().min(1, ACTIVITY_DATE_REQUIRED_MESSAGE_KEY).optional(),\n time: z.string().trim().min(1, ACTIVITY_TIME_REQUIRED_MESSAGE_KEY).optional(),\n phoneNumber: interactionPhoneNumberSchema,\n occurredAt: z.coerce.date().optional(),\n dealId: uuid().optional(),\n authorUserId: uuid().optional(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z\n .string()\n .trim()\n .regex(/^#([0-9a-fA-F]{6})$/)\n .optional()\n .nullable(),\n})\n\nexport const activityUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(activityCreateSchema.partial())\n\nexport const commentCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n dealId: uuid().optional(),\n body: z.string().min(1).max(8000),\n authorUserId: uuid().optional(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z\n .string()\n .trim()\n .regex(/^#([0-9a-fA-F]{6})$/)\n .optional()\n .nullable(),\n})\n\nexport const commentUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(commentCreateSchema.partial())\n\nexport const addressCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n name: z.string().max(150).optional(),\n purpose: z.string().max(150).optional(),\n companyName: z.string().max(200).optional(),\n addressLine1: z.string().min(1).max(300),\n addressLine2: z.string().max(300).optional(),\n buildingNumber: z.string().max(50).optional(),\n flatNumber: z.string().max(50).optional(),\n city: z.string().max(150).optional(),\n region: z.string().max(150).optional(),\n postalCode: z.string().max(30).optional(),\n country: z.string().max(150).optional(),\n latitude: z.coerce\n .number()\n .min(COORDINATE_RANGES.latitude.min)\n .max(COORDINATE_RANGES.latitude.max)\n .nullable()\n .optional(),\n longitude: z.coerce\n .number()\n .min(COORDINATE_RANGES.longitude.min)\n .max(COORDINATE_RANGES.longitude.max)\n .nullable()\n .optional(),\n isPrimary: z.boolean().optional(),\n})\n\nexport const addressUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(addressCreateSchema.partial())\n\nexport const tagCreateSchema = scopedSchema.extend({\n slug: z\n .string()\n .min(1)\n .max(80)\n .regex(/^[a-z0-9_-]+$/, 'Slug must be lowercase and may contain dashes or underscores'),\n label: z.string().min(1).max(120),\n color: z.string().max(30).optional(),\n description: z.string().max(400).optional(),\n})\n\nexport const tagUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(tagCreateSchema.partial())\n\nconst KNOWN_DICTIONARY_KINDS = [\n 'status',\n 'source',\n 'lifecycle_stage',\n 'address_type',\n 'activity_type',\n 'deal_status',\n 'pipeline_stage',\n 'job_title',\n 'industry',\n 'temperature',\n 'renewal_quarter',\n 'person_company_role',\n] as const\nconst CUSTOM_DICTIONARY_KIND_PATTERN = /^[a-z0-9]+(?:[-_][a-z0-9]+)*$/\nconst dictionaryKindEnum = z.string().trim().refine(\n (value) =>\n (KNOWN_DICTIONARY_KINDS as readonly string[]).includes(value) ||\n CUSTOM_DICTIONARY_KIND_PATTERN.test(value),\n { message: 'Unsupported dictionary kind' },\n)\n\nconst dictionaryValueSchema = z.string().trim().min(1).max(150)\nconst dictionaryLabelSchema = z.string().trim().max(150)\n// Pipeline-stage rows migrated to semantic tone identifiers in\n// Migration20260519120000_pipeline_stage_color_tones; AddStageDialog now writes those\n// directly. Other dictionary kinds still store hex. Accept either format so round-tripping\n// a migrated pipeline-stage entry through the dictionary edit UI doesn't fail validation.\nconst DICTIONARY_COLOR_TONES = ['success', 'warning', 'info', 'error', 'neutral', 'brand', 'pink'] as const\nconst dictionaryColorSchema = z\n .string()\n .trim()\n .regex(\n new RegExp(`^(#[0-9a-fA-F]{6}|${DICTIONARY_COLOR_TONES.join('|')})$`),\n 'Color must be a six-digit hex code (e.g. #3366ff) or a semantic tone identifier',\n )\nconst dictionaryIconSchema = z.string().trim().max(48)\n\nexport const customerDictionaryEntryCreateSchema = scopedSchema.extend({\n kind: dictionaryKindEnum,\n value: dictionaryValueSchema,\n label: dictionaryLabelSchema.optional(),\n color: dictionaryColorSchema.nullable().optional(),\n icon: dictionaryIconSchema.nullable().optional(),\n})\n\nexport type CustomerDictionaryEntryCreateInput = z.infer<typeof customerDictionaryEntryCreateSchema>\n\nexport const customerDictionaryEntryUpdateSchema = scopedSchema\n .extend({\n id: uuid(),\n kind: dictionaryKindEnum,\n value: dictionaryValueSchema.optional(),\n label: dictionaryLabelSchema.optional(),\n color: dictionaryColorSchema.nullable().optional(),\n icon: dictionaryIconSchema.nullable().optional(),\n })\n .refine(\n (payload) =>\n payload.value !== undefined ||\n payload.label !== undefined ||\n payload.color !== undefined ||\n payload.icon !== undefined,\n {\n message: 'Provide at least one field to update.',\n path: ['value'],\n }\n )\n\nexport type CustomerDictionaryEntryUpdateInput = z.infer<typeof customerDictionaryEntryUpdateSchema>\n\nexport const customerDictionaryEntryDeleteSchema = scopedSchema.extend({\n id: uuid(),\n kind: dictionaryKindEnum,\n})\n\nexport type CustomerDictionaryEntryDeleteInput = z.infer<typeof customerDictionaryEntryDeleteSchema>\n\nexport const tagAssignmentSchema = scopedSchema.extend({\n tagId: uuid(),\n entityId: uuid(),\n})\n\nexport const todoLinkCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n todoId: uuid(),\n todoSource: z.string().min(1).max(120).default('customers:interaction'),\n createdByUserId: uuid().optional(),\n})\n\nexport const todoLinkWithTodoCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n title: z.string().min(1).max(200),\n isDone: z.boolean().optional(),\n is_done: z.boolean().optional(),\n todoSource: z.string().min(1).max(120).default('customers:interaction'),\n createdByUserId: uuid().optional(),\n todoCustom: z.record(z.string(), z.any()).optional(),\n custom: z.record(z.string(), z.any()).optional(),\n})\n\n// --- Interaction schemas ---\n\n/**\n * @deprecated Interaction statuses are now dictionary-backed and tenant-configurable\n * (the `interaction-statuses` dictionary). This frozen 3-value list is kept only for\n * backward compatibility; it is no longer the validation source (the API accepts any\n * `z.string().max(50)`). For open/terminal semantics use `lib/interactionStatus.ts`\n * (`isOpenInteractionStatus` / `isTerminalInteractionStatus` / `INTERACTION_STATUS_*`);\n * for the seeded default set use `INTERACTION_STATUS_DEFAULTS` in `cli.ts`. Do not expand\n * this list \u2014 adding members would break exhaustive consumers.\n */\nexport const interactionStatusValues = ['planned', 'done', 'canceled'] as const\n/** @deprecated See {@link interactionStatusValues}. */\nexport type InteractionStatus = typeof interactionStatusValues[number]\n\nconst interactionParticipantSchema = z.object({\n userId: z.string().uuid(),\n name: z.string().trim().max(200).optional(),\n email: z.string().trim().max(320).optional(),\n status: z.string().trim().max(50).optional(),\n})\n\nconst interactionLinkedEntitySchema = z.object({\n id: z.string().uuid(),\n type: z.enum(['company', 'deal', 'offer']),\n label: z.string().trim().max(500),\n})\n\nconst interactionGuestPermissionsSchema = z\n .object({\n canInviteOthers: z.boolean().optional(),\n canModify: z.boolean().optional(),\n canSeeList: z.boolean().optional(),\n })\n .strict()\n\nconst interactionExtendedFields = {\n durationMinutes: z.number().int().min(0).optional().nullable(),\n location: z.string().trim().max(500).optional().nullable(),\n allDay: z.boolean().optional().nullable(),\n recurrenceRule: z.string().trim().max(500).optional().nullable(),\n recurrenceEnd: z.coerce.date().optional().nullable(),\n participants: z.array(interactionParticipantSchema).optional().nullable(),\n reminderMinutes: z.number().int().min(0).optional().nullable(),\n visibility: z.string().trim().max(50).optional().nullable(),\n linkedEntities: z.array(interactionLinkedEntitySchema).optional().nullable(),\n guestPermissions: interactionGuestPermissionsSchema.optional().nullable(),\n} as const\n\nconst interactionCreateBaseSchema = scopedSchema.extend({\n id: z.string().uuid().optional(),\n entityId: z.string().uuid(),\n interactionType: z.string().trim().min(1).max(100),\n title: z.string().trim().max(500).optional().nullable(),\n body: z.string().trim().max(10000).optional().nullable(),\n // Lenient like `deal_status` (status: z.string().max(50)). The `interaction-statuses`\n // dictionary drives the UI dropdown; the API accepts any string <=50 chars so existing\n // rows, external writers, and the dispatch-crm MCP keep working. Open/terminal semantics\n // live in lib/interactionStatus.ts, not in this validator.\n status: z.string().max(50).optional().default('planned'),\n date: z.string().trim().min(1, ACTIVITY_DATE_REQUIRED_MESSAGE_KEY).optional(),\n time: z.string().trim().min(1, ACTIVITY_TIME_REQUIRED_MESSAGE_KEY).optional(),\n phoneNumber: interactionPhoneNumberSchema,\n scheduledAt: z.coerce.date().optional().nullable(),\n occurredAt: z.coerce.date().optional().nullable(),\n priority: z.number().int().min(0).max(100).optional().nullable(),\n authorUserId: z.string().uuid().optional().nullable(),\n ownerUserId: z.string().uuid().optional().nullable(),\n dealId: z.string().uuid().optional().nullable(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z.string().trim().regex(/^#([0-9a-fA-F]{6})$/).optional().nullable(),\n source: z.string().trim().max(100).optional().nullable(),\n ...interactionExtendedFields,\n})\n\nfunction deriveScheduledAtFromDateTime(date?: string, time?: string): Date | null {\n if (!date || typeof date !== 'string') return null\n const trimmedDate = date.trim()\n if (!trimmedDate) return null\n const trimmedTime = typeof time === 'string' ? time.trim() : ''\n const iso = trimmedTime ? `${trimmedDate}T${trimmedTime}:00` : `${trimmedDate}T00:00:00`\n const parsed = new Date(iso)\n return Number.isNaN(parsed.getTime()) ? null : parsed\n}\n\nexport const interactionCreateSchema = interactionCreateBaseSchema\n .superRefine((value, ctx) => {\n if (value.interactionType === 'call' && value.phoneNumber !== undefined && value.phoneNumber !== null) {\n const phone = typeof value.phoneNumber === 'string' ? value.phoneNumber.trim() : ''\n if (!phone) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_REQUIRED_MESSAGE_KEY,\n })\n } else if (!isValidPhoneNumber(phone)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_INVALID_MESSAGE_KEY,\n })\n }\n }\n })\n // Derive `scheduledAt` from `date+time` when only the latter are sent so\n // external API consumers don't silently persist `scheduled_at: null` after\n // the validator already enforced non-empty date/time. The form already\n // computes `scheduledAt` itself, so this branch is a no-op for the form path.\n .transform((value) => {\n if (value.scheduledAt) return value\n const derived = deriveScheduledAtFromDateTime(value.date, value.time)\n return derived ? { ...value, scheduledAt: derived } : value\n })\n\nexport type InteractionCreateInput = z.infer<typeof interactionCreateSchema>\n\nconst interactionUpdateBaseSchema = z\n .object({\n id: z.string().uuid(),\n })\n .merge(\n scopedSchema\n .extend({\n interactionType: z.string().trim().min(1).max(100).optional(),\n title: z.string().trim().max(500).optional().nullable(),\n body: z.string().trim().max(10000).optional().nullable(),\n status: z.string().max(50).optional(),\n date: z.string().trim().min(1, ACTIVITY_DATE_REQUIRED_MESSAGE_KEY).optional(),\n time: z.string().trim().min(1, ACTIVITY_TIME_REQUIRED_MESSAGE_KEY).optional(),\n phoneNumber: interactionPhoneNumberSchema,\n scheduledAt: z.coerce.date().optional().nullable(),\n occurredAt: z.coerce.date().optional().nullable(),\n priority: z.number().int().min(0).max(100).optional().nullable(),\n authorUserId: z.string().uuid().optional().nullable(),\n ownerUserId: z.string().uuid().optional().nullable(),\n dealId: z.string().uuid().optional().nullable(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z.string().trim().regex(/^#([0-9a-fA-F]{6})$/).optional().nullable(),\n pinned: z.boolean().optional(),\n ...interactionExtendedFields,\n })\n .partial(),\n )\n\nexport const interactionUpdateSchema = interactionUpdateBaseSchema\n .superRefine((value, ctx) => {\n if (value.interactionType === 'call' && value.phoneNumber !== undefined) {\n const phone = typeof value.phoneNumber === 'string' ? value.phoneNumber.trim() : ''\n if (!phone) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_REQUIRED_MESSAGE_KEY,\n })\n } else if (!isValidPhoneNumber(phone)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_INVALID_MESSAGE_KEY,\n })\n }\n }\n })\n // Mirror the create-schema derivation for partial updates: when an external\n // caller supplies `date+time` without `scheduledAt`, derive the timestamp so\n // the update doesn't silently leave `scheduled_at` stale.\n .transform((value) => {\n if (value.scheduledAt !== undefined) return value\n if (!value.date && !value.time) return value\n const derived = deriveScheduledAtFromDateTime(value.date, value.time)\n return derived ? { ...value, scheduledAt: derived } : value\n })\n\nexport type InteractionUpdateInput = z.infer<typeof interactionUpdateSchema>\n\nexport const interactionCompleteSchema = z.object({\n id: z.string().uuid(),\n occurredAt: z.coerce.date().optional(),\n})\n\nexport const interactionCancelSchema = z.object({\n id: z.string().uuid(),\n})\n\nexport const customerAddressFormatSchema = z.enum(['line_first', 'street_first'])\n\nexport const customerSettingsUpsertSchema = scopedSchema.extend({\n addressFormat: customerAddressFormatSchema,\n})\n\nexport const customerStuckThresholdUpsertSchema = scopedSchema.extend({\n stuckThresholdDays: z.number().int().min(1).max(365),\n})\n\nexport const customerDictionarySortModesSchema = z.record(z.string(), dictionaryEntrySortModeSchema)\n\nexport const customerDictionarySortModesUpsertSchema = scopedSchema.extend({\n dictionarySortModes: customerDictionarySortModesSchema,\n})\n\nexport type PersonCreateInput = z.infer<typeof personCreateSchema>\nexport type PersonUpdateInput = z.infer<typeof personUpdateSchema>\nexport type CompanyCreateInput = z.infer<typeof companyCreateSchema>\nexport type CompanyUpdateInput = z.infer<typeof companyUpdateSchema>\nexport type DealCreateInput = z.infer<typeof dealCreateSchema>\nexport type DealUpdateInput = z.infer<typeof dealUpdateSchema>\nexport type ActivityCreateInput = z.infer<typeof activityCreateSchema>\nexport type ActivityUpdateInput = z.infer<typeof activityUpdateSchema>\nexport type CommentCreateInput = z.infer<typeof commentCreateSchema>\nexport type CommentUpdateInput = z.infer<typeof commentUpdateSchema>\nexport type AddressCreateInput = z.infer<typeof addressCreateSchema>\nexport type AddressUpdateInput = z.infer<typeof addressUpdateSchema>\nexport type TagCreateInput = z.infer<typeof tagCreateSchema>\nexport type TagUpdateInput = z.infer<typeof tagUpdateSchema>\nexport type TagAssignmentInput = z.infer<typeof tagAssignmentSchema>\nexport type TodoLinkCreateInput = z.infer<typeof todoLinkCreateSchema>\nexport type TodoLinkWithTodoCreateInput = z.infer<typeof todoLinkWithTodoCreateSchema>\nexport type CustomerSettingsUpsertInput = z.infer<typeof customerSettingsUpsertSchema>\nexport type CustomerStuckThresholdUpsertInput = z.infer<typeof customerStuckThresholdUpsertSchema>\nexport type CustomerDictionarySortModesUpsertInput = z.infer<typeof customerDictionarySortModesUpsertSchema>\nexport type CustomerAddressFormatInput = z.infer<typeof customerAddressFormatSchema>\nexport type InteractionCompleteInput = z.infer<typeof interactionCompleteSchema>\nexport type InteractionCancelInput = z.infer<typeof interactionCancelSchema>\n\n// --- Pipeline schemas ---\n\nexport const pipelineCreateSchema = scopedSchema.extend({\n name: z.string().trim().min(1).max(200),\n isDefault: z.boolean().optional(),\n})\n\nexport const pipelineUpdateSchema = z.object({\n id: uuid(),\n name: z.string().trim().min(1).max(200).optional(),\n isDefault: z.boolean().optional(),\n})\n\nexport const pipelineDeleteSchema = z.object({\n id: uuid(),\n})\n\nexport type PipelineCreateInput = z.infer<typeof pipelineCreateSchema>\nexport type PipelineUpdateInput = z.infer<typeof pipelineUpdateSchema>\nexport type PipelineDeleteInput = z.infer<typeof pipelineDeleteSchema>\n\n// --- Pipeline Stage schemas ---\n\nexport const pipelineStageCreateSchema = scopedSchema.extend({\n pipelineId: uuid(),\n label: z.string().trim().min(1).max(200),\n order: z.number().int().min(0).optional(),\n color: z.string().trim().max(20).nullish(),\n icon: z.string().trim().max(100).nullish(),\n})\n\nexport const pipelineStageUpdateSchema = z.object({\n id: uuid(),\n label: z.string().trim().min(1).max(200).optional(),\n order: z.number().int().min(0).optional(),\n color: z.string().trim().max(20).nullish(),\n icon: z.string().trim().max(100).nullish(),\n})\n\nexport const pipelineStageDeleteSchema = z.object({\n id: uuid(),\n})\n\nexport const pipelineStageReorderSchema = scopedSchema.extend({\n stages: z.array(z.object({\n id: uuid(),\n order: z.number().int().min(0),\n })).min(1),\n})\n\nexport type PipelineStageCreateInput = z.infer<typeof pipelineStageCreateSchema>\nexport type PipelineStageUpdateInput = z.infer<typeof pipelineStageUpdateSchema>\nexport type PipelineStageDeleteInput = z.infer<typeof pipelineStageDeleteSchema>\nexport type PipelineStageReorderInput = z.infer<typeof pipelineStageReorderSchema>\n\nexport const entityRoleCreateSchema = scopedSchema.extend({\n entityType: z.enum(['company', 'person']),\n entityId: uuid(),\n roleType: z.string().trim().min(1).max(100),\n userId: uuid(),\n})\n\nexport const entityRoleUpdateSchema = scopedSchema.extend({\n id: uuid(),\n userId: uuid(),\n})\n\nexport const entityRoleDeleteSchema = scopedSchema.extend({\n id: uuid(),\n})\n\nexport type EntityRoleCreateInput = z.infer<typeof entityRoleCreateSchema>\nexport type EntityRoleUpdateInput = z.infer<typeof entityRoleUpdateSchema>\nexport type EntityRoleDeleteInput = z.infer<typeof entityRoleDeleteSchema>\n\nexport const updateKindSettingSchema = z.object({\n kind: z.string().trim().min(1).max(100),\n selectionMode: z.enum(['single', 'multi']).optional(),\n visibleInTags: z.boolean().optional(),\n sortOrder: z.number().int().min(0).optional(),\n})\n\nexport type UpdateKindSettingInput = z.infer<typeof updateKindSettingSchema>\n\nexport const customerKindSettingsUpsertSchema = scopedSchema.extend({\n kind: z.string().trim().min(1).max(100),\n selectionMode: z.enum(['single', 'multi']).optional(),\n visibleInTags: z.boolean().optional(),\n sortOrder: z.number().int().min(0).optional(),\n})\n\nexport type CustomerKindSettingsUpsertInput = z.infer<typeof customerKindSettingsUpsertSchema>\n\nexport const labelCreateSchema = z.object({\n label: z.string().trim().min(1).max(120),\n slug: z.string().trim().min(1).max(80).regex(/^[a-z0-9_-]+$/).optional(),\n})\n\nexport type LabelCreateInput = z.infer<typeof labelCreateSchema>\n\nexport const labelCreateCommandSchema = scopedSchema.extend({\n label: z.string().trim().min(1).max(120),\n slug: z.string().trim().min(1).max(80).regex(/^[a-z0-9_-]+$/),\n userId: uuid(),\n})\n\nexport type LabelCreateCommandInput = z.infer<typeof labelCreateCommandSchema>\n\nexport const labelAssignmentSchema = z.object({\n labelId: z.string().uuid(),\n entityId: z.string().uuid(),\n})\n\nexport type LabelAssignmentInput = z.infer<typeof labelAssignmentSchema>\n\nexport const labelAssignCommandSchema = scopedSchema.extend({\n labelId: uuid(),\n entityId: uuid(),\n})\n\nexport const labelUnassignCommandSchema = scopedSchema.extend({\n labelId: uuid(),\n entityId: uuid(),\n})\n\nexport type LabelAssignCommandInput = z.infer<typeof labelAssignCommandSchema>\nexport type LabelUnassignCommandInput = z.infer<typeof labelUnassignCommandSchema>\n\nexport const personCompanyLinkCreateSchema = scopedSchema.extend({\n personEntityId: uuid(),\n companyEntityId: uuid(),\n isPrimary: z.boolean().optional(),\n})\n\nexport const personCompanyLinkUpdateSchema = scopedSchema.extend({\n linkId: uuid(),\n isPrimary: z.boolean(),\n})\n\nexport const personCompanyLinkDeleteSchema = scopedSchema.extend({\n linkId: uuid(),\n})\n\nexport type PersonCompanyLinkCreateInput = z.infer<typeof personCompanyLinkCreateSchema>\nexport type PersonCompanyLinkUpdateInput = z.infer<typeof personCompanyLinkUpdateSchema>\nexport type PersonCompany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AE,QAAQ;AACvB,CAAC;AAEM,MAAM,gCAAgC,aAAa,OAAO;AAAA,EAC/D,QAAQ,KAAK;AACf,CAAC;",
4
+ "sourcesContent": ["import { z } from 'zod'\nimport { isValidPhoneNumber } from '@open-mercato/shared/lib/phone'\nimport { COORDINATE_RANGES } from '@open-mercato/shared/lib/location/coordinates'\nimport { dictionaryEntrySortModeSchema } from '@open-mercato/core/modules/dictionaries/lib/entrySort'\n\nconst uuid = () => z.string().uuid()\n\nexport const CUSTOMER_PHONE_INVALID_MESSAGE_KEY = 'customers.people.form.primaryPhone.invalid'\nexport const ACTIVITY_DATE_REQUIRED_MESSAGE_KEY = 'customers.activities.errors.dateRequired'\nexport const ACTIVITY_TIME_REQUIRED_MESSAGE_KEY = 'customers.activities.errors.timeRequired'\nexport const ACTIVITY_PHONE_REQUIRED_MESSAGE_KEY = 'customers.activities.errors.phoneRequired'\nexport const ACTIVITY_PHONE_INVALID_MESSAGE_KEY = 'customers.activities.errors.phoneInvalid'\n\nconst emptyStringToNull = (value: unknown): unknown => {\n if (typeof value !== 'string') return value\n const trimmed = value.trim()\n return trimmed.length ? trimmed : null\n}\n\nconst phoneSchema = z.preprocess(\n emptyStringToNull,\n z\n .string()\n .trim()\n .max(50)\n .refine((val) => isValidPhoneNumber(val), { message: CUSTOMER_PHONE_INVALID_MESSAGE_KEY })\n .nullable()\n .optional(),\n)\n\nconst clearableEmailSchema = z.preprocess(\n emptyStringToNull,\n z.string().email().max(320).nullable().optional(),\n)\n\nconst clearableUrlSchema = z.preprocess(\n emptyStringToNull,\n z.string().url().max(300).nullable().optional(),\n)\n\n// Domain is a plain (non-URL) string that maps to a nullable column, so blanking\n// a previously-set value on edit must transmit null to clear it. See #2529.\nconst clearableDomainSchema = z.preprocess(\n emptyStringToNull,\n z.string().trim().max(200).nullable().optional(),\n)\n\n// Plain optional string fields that map to nullable columns: blanking a previously-set\n// value on edit must transmit null to clear it, not be silently dropped. See #3050.\nconst clearableStringSchema = (max: number) =>\n z.preprocess(emptyStringToNull, z.string().trim().max(max).nullable().optional())\n\n// Annual revenue maps to a nullable numeric column. `''`/whitespace/null all clear it;\n// `.nullable()` short-circuits before coercion so null does not coerce to 0. See #3050.\nconst clearableRevenueSchema = z.preprocess(\n (value) => {\n if (typeof value === 'string' && value.trim().length === 0) return null\n return value\n },\n z.coerce.number().min(0).nullable().optional(),\n)\n\nconst interactionPhoneNumberSchema = z.string().trim().max(50).optional().nullable()\n\nconst scopedSchema = z.object({\n organizationId: uuid(),\n tenantId: uuid(),\n})\n\nconst nextInteractionSchema = z\n .object({\n at: z.coerce.date(),\n name: z.string().trim().min(1).max(200),\n refId: z.string().trim().max(191).optional().nullable(),\n icon: z.string().trim().max(100).optional().nullable(),\n color: z\n .string()\n .trim()\n .regex(/^#([0-9a-fA-F]{6})$/)\n .optional()\n .nullable(),\n })\n .strict()\n\nconst displayNameSchema = z.string().trim().min(1).max(200)\n\nconst baseEntitySchema = {\n displayName: displayNameSchema,\n // Nullable so a blanked description on edit clears the column instead of being dropped. See #3050.\n description: clearableStringSchema(4000),\n ownerUserId: uuid().optional(),\n primaryEmail: clearableEmailSchema,\n primaryPhone: phoneSchema,\n status: z.string().trim().max(100).optional(),\n lifecycleStage: z.string().trim().max(100).optional(),\n source: z.string().trim().max(150).optional(),\n temperature: z.string().trim().max(100).optional(),\n renewalQuarter: z.string().trim().max(100).optional(),\n isActive: z.boolean().optional(),\n nextInteraction: nextInteractionSchema.nullable().optional(),\n tags: z.array(uuid()).optional(),\n}\n\nconst personDetailsSchema = {\n preferredName: z.string().trim().max(120).optional(),\n jobTitle: z.string().trim().max(150).optional(),\n department: z.string().trim().max(150).optional(),\n seniority: z.string().trim().max(100).optional(),\n timezone: z.string().trim().max(120).optional(),\n linkedInUrl: clearableUrlSchema,\n twitterUrl: clearableUrlSchema,\n companyEntityId: uuid().nullable().optional(),\n}\n\nconst personFirstNameSchema = z.string().trim().min(1).max(120)\nconst personLastNameSchema = z.string().trim().min(1).max(120)\n\nconst companyDetailsSchema = {\n // Nullable so blanked values on edit clear the columns instead of being dropped. See #3050.\n legalName: clearableStringSchema(200),\n brandName: clearableStringSchema(200),\n domain: clearableDomainSchema,\n websiteUrl: clearableUrlSchema,\n industry: z.string().trim().max(150).optional(),\n sizeBucket: clearableStringSchema(100),\n annualRevenue: clearableRevenueSchema,\n}\n\nexport const personCreateSchema = scopedSchema.extend({\n ...baseEntitySchema,\n displayName: displayNameSchema.optional(),\n firstName: personFirstNameSchema,\n lastName: personLastNameSchema,\n ...personDetailsSchema,\n})\n\nexport const personUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(\n scopedSchema.extend({\n ...baseEntitySchema,\n ...personDetailsSchema,\n firstName: personFirstNameSchema.optional(),\n lastName: personLastNameSchema.optional(),\n }).partial()\n )\n\nexport const companyCreateSchema = scopedSchema.extend({\n ...baseEntitySchema,\n displayName: displayNameSchema,\n ...companyDetailsSchema,\n})\n\nexport const companyUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(companyCreateSchema.partial())\n\nexport const dealCreateSchema = scopedSchema.extend({\n title: z.string().min(1).max(200),\n description: z.string().max(4000).optional(),\n status: z.string().max(50).optional(),\n pipelineStage: z.string().max(100).optional(),\n pipelineId: uuid().optional(),\n pipelineStageId: uuid().optional(),\n valueAmount: z.coerce.number().min(0).optional(),\n valueCurrency: z.string().min(3).max(3).optional(),\n probability: z.number().min(0).max(100).optional(),\n expectedCloseAt: z.coerce.date().optional(),\n // Nullable: the bulk owner-update worker passes `null` to clear ownership.\n // Without `.nullable()`, dealUpdateSchema.parse({ ownerUserId: null }) throws\n // ZodError \"expected string, received null\" inside the queue worker (TC-CRM-069).\n ownerUserId: uuid().optional().nullable(),\n source: z.string().max(150).optional(),\n closureOutcome: z.enum(['won', 'lost']).optional(),\n lossReasonId: uuid().optional(),\n lossNotes: z.string().max(4000).optional(),\n companyIds: z.array(uuid()).optional(),\n personIds: z.array(uuid()).optional(),\n})\n\nexport const dealUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(dealCreateSchema.partial())\n\n// Bulk update schemas \u2014 used by `api/deals/bulk-update-{owner,stage}/route.ts`. Kept here\n// so all deal-write contracts live next to `dealCreateSchema` / `dealUpdateSchema`.\nexport const dealsBulkUpdateOwnerSchema = z.object({\n ids: z.array(uuid()).min(1).max(10000),\n ownerUserId: uuid().nullable(),\n})\n\nexport const dealsBulkUpdateStageSchema = z.object({\n ids: z.array(uuid()).min(1).max(10000),\n pipelineStageId: uuid(),\n})\n\nexport const dealsBulkUpdateResponseSchema = z.object({\n ok: z.boolean(),\n progressJobId: uuid().nullable(),\n message: z.string(),\n})\n\nexport const activityCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n activityType: z.string().min(1).max(100),\n subject: z.string().max(200).optional(),\n body: z.string().max(8000).optional(),\n date: z.string().trim().min(1, ACTIVITY_DATE_REQUIRED_MESSAGE_KEY).optional(),\n time: z.string().trim().min(1, ACTIVITY_TIME_REQUIRED_MESSAGE_KEY).optional(),\n phoneNumber: interactionPhoneNumberSchema,\n occurredAt: z.coerce.date().optional(),\n dealId: uuid().optional(),\n authorUserId: uuid().optional(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z\n .string()\n .trim()\n .regex(/^#([0-9a-fA-F]{6})$/)\n .optional()\n .nullable(),\n})\n\nexport const activityUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(activityCreateSchema.partial())\n\nexport const commentCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n dealId: uuid().optional(),\n body: z.string().min(1).max(8000),\n authorUserId: uuid().optional(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z\n .string()\n .trim()\n .regex(/^#([0-9a-fA-F]{6})$/)\n .optional()\n .nullable(),\n})\n\nexport const commentUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(commentCreateSchema.partial())\n\nexport const addressCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n name: z.string().max(150).optional(),\n purpose: z.string().max(150).optional(),\n companyName: z.string().max(200).optional(),\n addressLine1: z.string().min(1).max(300),\n addressLine2: z.string().max(300).optional(),\n buildingNumber: z.string().max(50).optional(),\n flatNumber: z.string().max(50).optional(),\n city: z.string().max(150).optional(),\n region: z.string().max(150).optional(),\n postalCode: z.string().max(30).optional(),\n country: z.string().max(150).optional(),\n latitude: z.coerce\n .number()\n .min(COORDINATE_RANGES.latitude.min)\n .max(COORDINATE_RANGES.latitude.max)\n .nullable()\n .optional(),\n longitude: z.coerce\n .number()\n .min(COORDINATE_RANGES.longitude.min)\n .max(COORDINATE_RANGES.longitude.max)\n .nullable()\n .optional(),\n isPrimary: z.boolean().optional(),\n})\n\nexport const addressUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(addressCreateSchema.partial())\n\nexport const tagCreateSchema = scopedSchema.extend({\n slug: z\n .string()\n .min(1)\n .max(80)\n .regex(/^[a-z0-9_-]+$/, 'Slug must be lowercase and may contain dashes or underscores'),\n label: z.string().min(1).max(120),\n color: z.string().max(30).optional(),\n description: z.string().max(400).optional(),\n})\n\nexport const tagUpdateSchema = z\n .object({\n id: uuid(),\n })\n .merge(tagCreateSchema.partial())\n\nconst KNOWN_DICTIONARY_KINDS = [\n 'status',\n 'source',\n 'lifecycle_stage',\n 'address_type',\n 'activity_type',\n 'deal_status',\n 'pipeline_stage',\n 'job_title',\n 'industry',\n 'temperature',\n 'renewal_quarter',\n 'person_company_role',\n] as const\nconst CUSTOM_DICTIONARY_KIND_PATTERN = /^[a-z0-9]+(?:[-_][a-z0-9]+)*$/\nconst dictionaryKindEnum = z.string().trim().refine(\n (value) =>\n (KNOWN_DICTIONARY_KINDS as readonly string[]).includes(value) ||\n CUSTOM_DICTIONARY_KIND_PATTERN.test(value),\n { message: 'Unsupported dictionary kind' },\n)\n\nconst dictionaryValueSchema = z.string().trim().min(1).max(150)\nconst dictionaryLabelSchema = z.string().trim().max(150)\n// Pipeline-stage rows migrated to semantic tone identifiers in\n// Migration20260519120000_pipeline_stage_color_tones; AddStageDialog now writes those\n// directly. Other dictionary kinds still store hex. Accept either format so round-tripping\n// a migrated pipeline-stage entry through the dictionary edit UI doesn't fail validation.\nconst DICTIONARY_COLOR_TONES = ['success', 'warning', 'info', 'error', 'neutral', 'brand', 'pink'] as const\nconst dictionaryColorSchema = z\n .string()\n .trim()\n .regex(\n new RegExp(`^(#[0-9a-fA-F]{6}|${DICTIONARY_COLOR_TONES.join('|')})$`),\n 'Color must be a six-digit hex code (e.g. #3366ff) or a semantic tone identifier',\n )\nconst dictionaryIconSchema = z.string().trim().max(48)\n\nexport const customerDictionaryEntryCreateSchema = scopedSchema.extend({\n kind: dictionaryKindEnum,\n value: dictionaryValueSchema,\n label: dictionaryLabelSchema.optional(),\n color: dictionaryColorSchema.nullable().optional(),\n icon: dictionaryIconSchema.nullable().optional(),\n})\n\nexport type CustomerDictionaryEntryCreateInput = z.infer<typeof customerDictionaryEntryCreateSchema>\n\nexport const customerDictionaryEntryUpdateSchema = scopedSchema\n .extend({\n id: uuid(),\n kind: dictionaryKindEnum,\n value: dictionaryValueSchema.optional(),\n label: dictionaryLabelSchema.optional(),\n color: dictionaryColorSchema.nullable().optional(),\n icon: dictionaryIconSchema.nullable().optional(),\n })\n .refine(\n (payload) =>\n payload.value !== undefined ||\n payload.label !== undefined ||\n payload.color !== undefined ||\n payload.icon !== undefined,\n {\n message: 'Provide at least one field to update.',\n path: ['value'],\n }\n )\n\nexport type CustomerDictionaryEntryUpdateInput = z.infer<typeof customerDictionaryEntryUpdateSchema>\n\nexport const customerDictionaryEntryDeleteSchema = scopedSchema.extend({\n id: uuid(),\n kind: dictionaryKindEnum,\n})\n\nexport type CustomerDictionaryEntryDeleteInput = z.infer<typeof customerDictionaryEntryDeleteSchema>\n\nexport const tagAssignmentSchema = scopedSchema.extend({\n tagId: uuid(),\n entityId: uuid(),\n})\n\nexport const todoLinkCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n todoId: uuid(),\n todoSource: z.string().min(1).max(120).default('customers:interaction'),\n createdByUserId: uuid().optional(),\n})\n\nexport const todoLinkWithTodoCreateSchema = scopedSchema.extend({\n entityId: uuid(),\n title: z.string().min(1).max(200),\n isDone: z.boolean().optional(),\n is_done: z.boolean().optional(),\n todoSource: z.string().min(1).max(120).default('customers:interaction'),\n createdByUserId: uuid().optional(),\n todoCustom: z.record(z.string(), z.any()).optional(),\n custom: z.record(z.string(), z.any()).optional(),\n})\n\n// --- Interaction schemas ---\n\n/**\n * @deprecated Interaction statuses are now dictionary-backed and tenant-configurable\n * (the `interaction-statuses` dictionary). This frozen 3-value list is kept only for\n * backward compatibility; it is no longer the validation source (the API accepts any\n * `z.string().max(50)`). For open/terminal semantics use `lib/interactionStatus.ts`\n * (`isOpenInteractionStatus` / `isTerminalInteractionStatus` / `INTERACTION_STATUS_*`);\n * for the seeded default set use `INTERACTION_STATUS_DEFAULTS` in `cli.ts`. Do not expand\n * this list \u2014 adding members would break exhaustive consumers.\n */\nexport const interactionStatusValues = ['planned', 'done', 'canceled'] as const\n/** @deprecated See {@link interactionStatusValues}. */\nexport type InteractionStatus = typeof interactionStatusValues[number]\n\nconst interactionParticipantSchema = z.object({\n userId: z.string().uuid(),\n name: z.string().trim().max(200).optional(),\n email: z.string().trim().max(320).optional(),\n status: z.string().trim().max(50).optional(),\n})\n\nconst interactionLinkedEntitySchema = z.object({\n id: z.string().uuid(),\n // 'resource' links calendar events to bookable resources (rooms, cars,\n // equipment) from the optional resources module (#3552).\n type: z.enum(['company', 'deal', 'offer', 'resource']),\n label: z.string().trim().max(500),\n})\n\nconst interactionGuestPermissionsSchema = z\n .object({\n canInviteOthers: z.boolean().optional(),\n canModify: z.boolean().optional(),\n canSeeList: z.boolean().optional(),\n })\n .strict()\n\nconst interactionExtendedFields = {\n durationMinutes: z.number().int().min(0).optional().nullable(),\n location: z.string().trim().max(500).optional().nullable(),\n allDay: z.boolean().optional().nullable(),\n recurrenceRule: z.string().trim().max(500).optional().nullable(),\n recurrenceEnd: z.coerce.date().optional().nullable(),\n participants: z.array(interactionParticipantSchema).optional().nullable(),\n reminderMinutes: z.number().int().min(0).optional().nullable(),\n visibility: z.string().trim().max(50).optional().nullable(),\n linkedEntities: z.array(interactionLinkedEntitySchema).optional().nullable(),\n guestPermissions: interactionGuestPermissionsSchema.optional().nullable(),\n} as const\n\nconst interactionCreateBaseSchema = scopedSchema.extend({\n id: z.string().uuid().optional(),\n entityId: z.string().uuid(),\n interactionType: z.string().trim().min(1).max(100),\n title: z.string().trim().max(500).optional().nullable(),\n body: z.string().trim().max(10000).optional().nullable(),\n // Lenient like `deal_status` (status: z.string().max(50)). The `interaction-statuses`\n // dictionary drives the UI dropdown; the API accepts any string <=50 chars so existing\n // rows, external writers, and the dispatch-crm MCP keep working. Open/terminal semantics\n // live in lib/interactionStatus.ts, not in this validator.\n status: z.string().max(50).optional().default('planned'),\n date: z.string().trim().min(1, ACTIVITY_DATE_REQUIRED_MESSAGE_KEY).optional(),\n time: z.string().trim().min(1, ACTIVITY_TIME_REQUIRED_MESSAGE_KEY).optional(),\n phoneNumber: interactionPhoneNumberSchema,\n scheduledAt: z.coerce.date().optional().nullable(),\n occurredAt: z.coerce.date().optional().nullable(),\n priority: z.number().int().min(0).max(100).optional().nullable(),\n authorUserId: z.string().uuid().optional().nullable(),\n ownerUserId: z.string().uuid().optional().nullable(),\n dealId: z.string().uuid().optional().nullable(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z.string().trim().regex(/^#([0-9a-fA-F]{6})$/).optional().nullable(),\n source: z.string().trim().max(100).optional().nullable(),\n ...interactionExtendedFields,\n})\n\nfunction deriveScheduledAtFromDateTime(date?: string, time?: string): Date | null {\n if (!date || typeof date !== 'string') return null\n const trimmedDate = date.trim()\n if (!trimmedDate) return null\n const trimmedTime = typeof time === 'string' ? time.trim() : ''\n const iso = trimmedTime ? `${trimmedDate}T${trimmedTime}:00` : `${trimmedDate}T00:00:00`\n const parsed = new Date(iso)\n return Number.isNaN(parsed.getTime()) ? null : parsed\n}\n\nexport const interactionCreateSchema = interactionCreateBaseSchema\n .superRefine((value, ctx) => {\n if (value.interactionType === 'call' && value.phoneNumber !== undefined && value.phoneNumber !== null) {\n const phone = typeof value.phoneNumber === 'string' ? value.phoneNumber.trim() : ''\n if (!phone) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_REQUIRED_MESSAGE_KEY,\n })\n } else if (!isValidPhoneNumber(phone)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_INVALID_MESSAGE_KEY,\n })\n }\n }\n })\n // Derive `scheduledAt` from `date+time` when only the latter are sent so\n // external API consumers don't silently persist `scheduled_at: null` after\n // the validator already enforced non-empty date/time. The form already\n // computes `scheduledAt` itself, so this branch is a no-op for the form path.\n .transform((value) => {\n if (value.scheduledAt) return value\n const derived = deriveScheduledAtFromDateTime(value.date, value.time)\n return derived ? { ...value, scheduledAt: derived } : value\n })\n\nexport type InteractionCreateInput = z.infer<typeof interactionCreateSchema>\n\nconst interactionUpdateBaseSchema = z\n .object({\n id: z.string().uuid(),\n })\n .merge(\n scopedSchema\n .extend({\n interactionType: z.string().trim().min(1).max(100).optional(),\n title: z.string().trim().max(500).optional().nullable(),\n body: z.string().trim().max(10000).optional().nullable(),\n status: z.string().max(50).optional(),\n date: z.string().trim().min(1, ACTIVITY_DATE_REQUIRED_MESSAGE_KEY).optional(),\n time: z.string().trim().min(1, ACTIVITY_TIME_REQUIRED_MESSAGE_KEY).optional(),\n phoneNumber: interactionPhoneNumberSchema,\n scheduledAt: z.coerce.date().optional().nullable(),\n occurredAt: z.coerce.date().optional().nullable(),\n priority: z.number().int().min(0).max(100).optional().nullable(),\n authorUserId: z.string().uuid().optional().nullable(),\n ownerUserId: z.string().uuid().optional().nullable(),\n dealId: z.string().uuid().optional().nullable(),\n appearanceIcon: z.string().trim().max(100).optional().nullable(),\n appearanceColor: z.string().trim().regex(/^#([0-9a-fA-F]{6})$/).optional().nullable(),\n pinned: z.boolean().optional(),\n ...interactionExtendedFields,\n })\n .partial(),\n )\n\nexport const interactionUpdateSchema = interactionUpdateBaseSchema\n .superRefine((value, ctx) => {\n if (value.interactionType === 'call' && value.phoneNumber !== undefined) {\n const phone = typeof value.phoneNumber === 'string' ? value.phoneNumber.trim() : ''\n if (!phone) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_REQUIRED_MESSAGE_KEY,\n })\n } else if (!isValidPhoneNumber(phone)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['phoneNumber'],\n message: ACTIVITY_PHONE_INVALID_MESSAGE_KEY,\n })\n }\n }\n })\n // Mirror the create-schema derivation for partial updates: when an external\n // caller supplies `date+time` without `scheduledAt`, derive the timestamp so\n // the update doesn't silently leave `scheduled_at` stale.\n .transform((value) => {\n if (value.scheduledAt !== undefined) return value\n if (!value.date && !value.time) return value\n const derived = deriveScheduledAtFromDateTime(value.date, value.time)\n return derived ? { ...value, scheduledAt: derived } : value\n })\n\nexport type InteractionUpdateInput = z.infer<typeof interactionUpdateSchema>\n\nexport const interactionCompleteSchema = z.object({\n id: z.string().uuid(),\n occurredAt: z.coerce.date().optional(),\n})\n\nexport const interactionCancelSchema = z.object({\n id: z.string().uuid(),\n})\n\nexport const customerAddressFormatSchema = z.enum(['line_first', 'street_first'])\n\nexport const customerSettingsUpsertSchema = scopedSchema.extend({\n addressFormat: customerAddressFormatSchema,\n})\n\nexport const customerStuckThresholdUpsertSchema = scopedSchema.extend({\n stuckThresholdDays: z.number().int().min(1).max(365),\n})\n\nexport const customerDictionarySortModesSchema = z.record(z.string(), dictionaryEntrySortModeSchema)\n\nexport const customerDictionarySortModesUpsertSchema = scopedSchema.extend({\n dictionarySortModes: customerDictionarySortModesSchema,\n})\n\nexport type PersonCreateInput = z.infer<typeof personCreateSchema>\nexport type PersonUpdateInput = z.infer<typeof personUpdateSchema>\nexport type CompanyCreateInput = z.infer<typeof companyCreateSchema>\nexport type CompanyUpdateInput = z.infer<typeof companyUpdateSchema>\nexport type DealCreateInput = z.infer<typeof dealCreateSchema>\nexport type DealUpdateInput = z.infer<typeof dealUpdateSchema>\nexport type ActivityCreateInput = z.infer<typeof activityCreateSchema>\nexport type ActivityUpdateInput = z.infer<typeof activityUpdateSchema>\nexport type CommentCreateInput = z.infer<typeof commentCreateSchema>\nexport type CommentUpdateInput = z.infer<typeof commentUpdateSchema>\nexport type AddressCreateInput = z.infer<typeof addressCreateSchema>\nexport type AddressUpdateInput = z.infer<typeof addressUpdateSchema>\nexport type TagCreateInput = z.infer<typeof tagCreateSchema>\nexport type TagUpdateInput = z.infer<typeof tagUpdateSchema>\nexport type TagAssignmentInput = z.infer<typeof tagAssignmentSchema>\nexport type TodoLinkCreateInput = z.infer<typeof todoLinkCreateSchema>\nexport type TodoLinkWithTodoCreateInput = z.infer<typeof todoLinkWithTodoCreateSchema>\nexport type CustomerSettingsUpsertInput = z.infer<typeof customerSettingsUpsertSchema>\nexport type CustomerStuckThresholdUpsertInput = z.infer<typeof customerStuckThresholdUpsertSchema>\nexport type CustomerDictionarySortModesUpsertInput = z.infer<typeof customerDictionarySortModesUpsertSchema>\nexport type CustomerAddressFormatInput = z.infer<typeof customerAddressFormatSchema>\nexport type InteractionCompleteInput = z.infer<typeof interactionCompleteSchema>\nexport type InteractionCancelInput = z.infer<typeof interactionCancelSchema>\n\n// --- Pipeline schemas ---\n\nexport const pipelineCreateSchema = scopedSchema.extend({\n name: z.string().trim().min(1).max(200),\n isDefault: z.boolean().optional(),\n})\n\nexport const pipelineUpdateSchema = z.object({\n id: uuid(),\n name: z.string().trim().min(1).max(200).optional(),\n isDefault: z.boolean().optional(),\n})\n\nexport const pipelineDeleteSchema = z.object({\n id: uuid(),\n})\n\nexport type PipelineCreateInput = z.infer<typeof pipelineCreateSchema>\nexport type PipelineUpdateInput = z.infer<typeof pipelineUpdateSchema>\nexport type PipelineDeleteInput = z.infer<typeof pipelineDeleteSchema>\n\n// --- Pipeline Stage schemas ---\n\nexport const pipelineStageCreateSchema = scopedSchema.extend({\n pipelineId: uuid(),\n label: z.string().trim().min(1).max(200),\n order: z.number().int().min(0).optional(),\n color: z.string().trim().max(20).nullish(),\n icon: z.string().trim().max(100).nullish(),\n})\n\nexport const pipelineStageUpdateSchema = z.object({\n id: uuid(),\n label: z.string().trim().min(1).max(200).optional(),\n order: z.number().int().min(0).optional(),\n color: z.string().trim().max(20).nullish(),\n icon: z.string().trim().max(100).nullish(),\n})\n\nexport const pipelineStageDeleteSchema = z.object({\n id: uuid(),\n})\n\nexport const pipelineStageReorderSchema = scopedSchema.extend({\n stages: z.array(z.object({\n id: uuid(),\n order: z.number().int().min(0),\n })).min(1),\n})\n\nexport type PipelineStageCreateInput = z.infer<typeof pipelineStageCreateSchema>\nexport type PipelineStageUpdateInput = z.infer<typeof pipelineStageUpdateSchema>\nexport type PipelineStageDeleteInput = z.infer<typeof pipelineStageDeleteSchema>\nexport type PipelineStageReorderInput = z.infer<typeof pipelineStageReorderSchema>\n\nexport const entityRoleCreateSchema = scopedSchema.extend({\n entityType: z.enum(['company', 'person']),\n entityId: uuid(),\n roleType: z.string().trim().min(1).max(100),\n userId: uuid(),\n})\n\nexport const entityRoleUpdateSchema = scopedSchema.extend({\n id: uuid(),\n userId: uuid(),\n})\n\nexport const entityRoleDeleteSchema = scopedSchema.extend({\n id: uuid(),\n})\n\nexport type EntityRoleCreateInput = z.infer<typeof entityRoleCreateSchema>\nexport type EntityRoleUpdateInput = z.infer<typeof entityRoleUpdateSchema>\nexport type EntityRoleDeleteInput = z.infer<typeof entityRoleDeleteSchema>\n\nexport const updateKindSettingSchema = z.object({\n kind: z.string().trim().min(1).max(100),\n selectionMode: z.enum(['single', 'multi']).optional(),\n visibleInTags: z.boolean().optional(),\n sortOrder: z.number().int().min(0).optional(),\n})\n\nexport type UpdateKindSettingInput = z.infer<typeof updateKindSettingSchema>\n\nexport const customerKindSettingsUpsertSchema = scopedSchema.extend({\n kind: z.string().trim().min(1).max(100),\n selectionMode: z.enum(['single', 'multi']).optional(),\n visibleInTags: z.boolean().optional(),\n sortOrder: z.number().int().min(0).optional(),\n})\n\nexport type CustomerKindSettingsUpsertInput = z.infer<typeof customerKindSettingsUpsertSchema>\n\nexport const labelCreateSchema = z.object({\n label: z.string().trim().min(1).max(120),\n slug: z.string().trim().min(1).max(80).regex(/^[a-z0-9_-]+$/).optional(),\n})\n\nexport type LabelCreateInput = z.infer<typeof labelCreateSchema>\n\nexport const labelCreateCommandSchema = scopedSchema.extend({\n label: z.string().trim().min(1).max(120),\n slug: z.string().trim().min(1).max(80).regex(/^[a-z0-9_-]+$/),\n userId: uuid(),\n})\n\nexport type LabelCreateCommandInput = z.infer<typeof labelCreateCommandSchema>\n\nexport const labelAssignmentSchema = z.object({\n labelId: z.string().uuid(),\n entityId: z.string().uuid(),\n})\n\nexport type LabelAssignmentInput = z.infer<typeof labelAssignmentSchema>\n\nexport const labelAssignCommandSchema = scopedSchema.extend({\n labelId: uuid(),\n entityId: uuid(),\n})\n\nexport const labelUnassignCommandSchema = scopedSchema.extend({\n labelId: uuid(),\n entityId: uuid(),\n})\n\nexport type LabelAssignCommandInput = z.infer<typeof labelAssignCommandSchema>\nexport type LabelUnassignCommandInput = z.infer<typeof labelUnassignCommandSchema>\n\nexport const personCompanyLinkCreateSchema = scopedSchema.extend({\n personEntityId: uuid(),\n companyEntityId: uuid(),\n isPrimary: z.boolean().optional(),\n})\n\nexport const personCompanyLinkUpdateSchema = scopedSchema.extend({\n linkId: uuid(),\n isPrimary: z.boolean(),\n})\n\nexport const personCompanyLinkDeleteSchema = scopedSchema.extend({\n linkId: uuid(),\n})\n\nexport type PersonCompanyLinkCreateInput = z.infer<typeof personCompanyLinkCreateSchema>\nexport type PersonCompanyLinkUpdateInput = z.infer<typeof personCompanyLinkUpdateSchema>\nexport type PersonCompanyLinkDeleteInput = z.infer<typeof personCompanyLink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