@open-mercato/core 0.10.1-develop.7668.1.3aa8463bd8 → 0.10.1-develop.7670.1.7b5ad74924

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.
@@ -24,6 +24,7 @@ import {
24
24
  isDateRequired,
25
25
  isTimeRequired,
26
26
  getFieldLabel,
27
+ resolveScheduleActivityType,
27
28
  DateTimeFields,
28
29
  ParticipantsField,
29
30
  LocationField,
@@ -124,10 +125,11 @@ function ScheduleActivityDialog({
124
125
  }) {
125
126
  const t = useT();
126
127
  const state = useScheduleFormState({ open, editData: editData ?? null });
127
- const visibleFields = FIELD_VISIBILITY[state.activityType];
128
+ const presentationType = resolveScheduleActivityType(state.activityType);
129
+ const visibleFields = FIELD_VISIBILITY[presentationType];
128
130
  const { confirm, ConfirmDialogElement } = useConfirmDialog();
129
131
  const isEditing = Boolean(editData?.id);
130
- const chrome = TYPE_CHROME[state.activityType];
132
+ const chrome = TYPE_CHROME[presentationType];
131
133
  const SaveIcon = chrome.saveIcon;
132
134
  const [callDirection, setCallDirection] = React.useState("outbound");
133
135
  const [callOutcome, setCallOutcome] = React.useState(null);
@@ -326,8 +328,8 @@ function ScheduleActivityDialog({
326
328
  const trimmedDate = state.date.trim();
327
329
  const trimmedStartTime = state.startTime.trim();
328
330
  const trimmedCallPhone = callPhoneNumber.trim();
329
- const isDateMissing = isDateRequired(state.activityType) && !trimmedDate;
330
- const isTimeMissing = isTimeRequired(state.activityType) && !state.allDay && !trimmedStartTime;
331
+ const isDateMissing = isDateRequired(presentationType) && !trimmedDate;
332
+ const isTimeMissing = isTimeRequired(presentationType) && !state.allDay && !trimmedStartTime;
331
333
  const isSubmitDisabled = state.saving || !state.title.trim() || isDateMissing || isTimeMissing;
332
334
  const handleSave = React.useCallback(async () => {
333
335
  if (!state.title.trim()) return;
@@ -340,7 +342,7 @@ function ScheduleActivityDialog({
340
342
  return;
341
343
  }
342
344
  let phoneNumberForPayload;
343
- if (state.activityType === "call" && trimmedCallPhone) {
345
+ if (presentationType === "call" && trimmedCallPhone) {
344
346
  const phoneValidation = validatePhoneNumber(trimmedCallPhone);
345
347
  if (!phoneValidation.valid) {
346
348
  setCallPhoneError(callPhoneInvalidMessage);
@@ -360,7 +362,7 @@ function ScheduleActivityDialog({
360
362
  const recurrenceRule = state.recurrenceEnabled ? buildRecurrenceRule(state.recurrenceDays, state.recurrenceEndType, state.recurrenceCount, state.recurrenceEndDate) : null;
361
363
  const isSaveEdit = Boolean(editData?.id);
362
364
  const customValues = {};
363
- if (state.activityType === "call") {
365
+ if (presentationType === "call") {
364
366
  customValues.callDirection = callDirection;
365
367
  if (callOutcome) customValues.callOutcome = callOutcome;
366
368
  if (phoneNumberForPayload) customValues.callPhoneNumber = phoneNumberForPayload;
@@ -378,10 +380,10 @@ function ScheduleActivityDialog({
378
380
  ...isSaveEdit ? {} : { status: "planned" },
379
381
  date: trimmedDate || null,
380
382
  time: trimmedDate ? timeForPayload || null : null,
381
- phoneNumber: state.activityType === "call" ? phoneNumberForPayload : void 0,
383
+ phoneNumber: presentationType === "call" ? phoneNumberForPayload : void 0,
382
384
  // Only tasks expose the priority control, so other types leave the column
383
385
  // untouched rather than clearing it on a type switch (#5943).
384
- priority: state.activityType === "task" ? buildTaskPriorityPayload(taskPriority, seededTaskPriority) : void 0,
386
+ priority: presentationType === "task" ? buildTaskPriorityPayload(taskPriority, seededTaskPriority) : void 0,
385
387
  scheduledAt,
386
388
  durationMinutes: visibleFields.has("duration") && !state.allDay ? state.duration : null,
387
389
  location: visibleFields.has("location") ? state.location.trim() || null : null,
@@ -422,7 +424,7 @@ function ScheduleActivityDialog({
422
424
  }
423
425
  const { message, fieldErrors } = mapCrudServerErrorToFormErrors(err);
424
426
  const phoneFieldError = fieldErrors?.phoneNumber;
425
- if (state.activityType === "call" && phoneFieldError) {
427
+ if (presentationType === "call" && phoneFieldError) {
426
428
  const translatedPhoneError = translateErrorMessage(phoneFieldError, callPhoneInvalidMessage);
427
429
  setCallPhoneError(translatedPhoneError);
428
430
  flash(translatedPhoneError, "error");
@@ -435,7 +437,7 @@ function ScheduleActivityDialog({
435
437
  } finally {
436
438
  state.setSaving(false);
437
439
  }
438
- }, [callDirection, callOutcome, callPhoneInvalidMessage, callPhoneNumber, isDateMissing, isTimeMissing, state.activityType, state.allDay, state.date, state.description, dealId, state.duration, editData, entityId, state.guestPermissions, state.linkedEntities, state.location, onActivityCreated, onClose, state.participants, state.recurrenceCount, state.recurrenceDays, state.recurrenceEnabled, state.recurrenceEndDate, state.recurrenceEndType, state.reminderMinutes, runGuardedMutation, seededTaskPriority, state.startTime, t, taskPriority, state.title, translateErrorMessage, trimmedCallPhone, trimmedDate, trimmedStartTime, state.visibility, visibleFields]);
440
+ }, [callDirection, callOutcome, callPhoneInvalidMessage, callPhoneNumber, isDateMissing, isTimeMissing, presentationType, state.activityType, state.allDay, state.date, state.description, dealId, state.duration, editData, entityId, state.guestPermissions, state.linkedEntities, state.location, onActivityCreated, onClose, state.participants, state.recurrenceCount, state.recurrenceDays, state.recurrenceEnabled, state.recurrenceEndDate, state.recurrenceEndType, state.reminderMinutes, runGuardedMutation, seededTaskPriority, state.startTime, t, taskPriority, state.title, translateErrorMessage, trimmedCallPhone, trimmedDate, trimmedStartTime, state.visibility, visibleFields]);
439
441
  const handleKeyDown = useDialogKeyHandler({ onConfirm: handleSave });
440
442
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (o) => {
441
443
  if (!o) void guardedClose();
@@ -487,14 +489,14 @@ function ScheduleActivityDialog({
487
489
  );
488
490
  }) }),
489
491
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
490
- /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold text-muted-foreground tracking-wider", children: getFieldLabel(state.activityType, "title", t, "customers.schedule.titleLabel", "Title") }),
492
+ /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold text-muted-foreground tracking-wider", children: getFieldLabel(presentationType, "title", t, "customers.schedule.titleLabel", "Title") }),
491
493
  /* @__PURE__ */ jsx(
492
494
  "input",
493
495
  {
494
496
  type: "text",
495
497
  value: state.title,
496
498
  onChange: (e) => state.setTitle(e.target.value),
497
- placeholder: state.activityType === "email" ? t("customers.schedule.subjectPlaceholder", "Subject...") : t("customers.schedule.titlePlaceholder", "Activity title..."),
499
+ placeholder: presentationType === "email" ? t("customers.schedule.subjectPlaceholder", "Subject...") : t("customers.schedule.titlePlaceholder", "Activity title..."),
498
500
  className: "w-full rounded-md border border-border bg-background px-3 py-2.5 text-sm text-foreground outline-none focus:border-foreground",
499
501
  autoFocus: true
500
502
  }
@@ -504,7 +506,7 @@ function ScheduleActivityDialog({
504
506
  DateTimeFields,
505
507
  {
506
508
  visible: visibleFields,
507
- activityType: state.activityType,
509
+ activityType: presentationType,
508
510
  date: state.date,
509
511
  setDate: state.setDate,
510
512
  startTime: state.startTime,
@@ -525,7 +527,7 @@ function ScheduleActivityDialog({
525
527
  setRecurrenceEndDate: state.setRecurrenceEndDate
526
528
  }
527
529
  ),
528
- state.activityType === "call" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
530
+ presentationType === "call" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
529
531
  /* @__PURE__ */ jsxs("div", { children: [
530
532
  /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.call.directionLabel", "Direction") }),
531
533
  /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: CALL_DIRECTIONS.map((opt) => {
@@ -573,7 +575,7 @@ function ScheduleActivityDialog({
573
575
  }) })
574
576
  ] })
575
577
  ] }),
576
- state.activityType === "task" && /* @__PURE__ */ jsxs("div", { children: [
578
+ presentationType === "task" && /* @__PURE__ */ jsxs("div", { children: [
577
579
  /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.task.priorityLabel", "Priority") }),
578
580
  /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: TASK_PRIORITIES.map((opt) => {
579
581
  const isActive = taskPriority === opt.key;
@@ -600,7 +602,7 @@ function ScheduleActivityDialog({
600
602
  ParticipantsField,
601
603
  {
602
604
  visible: visibleFields,
603
- activityType: state.activityType,
605
+ activityType: presentationType,
604
606
  participants: state.participants,
605
607
  setParticipants: state.setParticipants,
606
608
  removeParticipant: state.removeParticipant,
@@ -608,7 +610,7 @@ function ScheduleActivityDialog({
608
610
  setGuestPermissions: state.setGuestPermissions
609
611
  }
610
612
  ),
611
- state.activityType === "call" ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
613
+ presentationType === "call" ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
612
614
  /* @__PURE__ */ jsx("label", { htmlFor: "schedule-call-phone", className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.call.phoneLabel", "Phone number") }),
613
615
  /* @__PURE__ */ jsx(
614
616
  PhoneNumberField,
@@ -627,7 +629,7 @@ function ScheduleActivityDialog({
627
629
  LocationField,
628
630
  {
629
631
  visible: visibleFields,
630
- activityType: state.activityType,
632
+ activityType: presentationType,
631
633
  location: state.location,
632
634
  setLocation: state.setLocation
633
635
  }
@@ -636,22 +638,22 @@ function ScheduleActivityDialog({
636
638
  LinkedEntitiesField,
637
639
  {
638
640
  visible: visibleFields,
639
- activityType: state.activityType,
641
+ activityType: presentationType,
640
642
  linkedEntities: state.linkedEntities,
641
643
  setLinkedEntities: state.setLinkedEntities
642
644
  }
643
645
  ),
644
646
  /* @__PURE__ */ jsxs("div", { children: [
645
- /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: getFieldLabel(state.activityType, "description", t, "customers.schedule.description", "Description") }),
647
+ /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: getFieldLabel(presentationType, "description", t, "customers.schedule.description", "Description") }),
646
648
  /* @__PURE__ */ jsx("div", { className: "mt-[8px]", children: /* @__PURE__ */ jsx(
647
649
  SwitchableMarkdownInput,
648
650
  {
649
651
  value: state.description,
650
652
  onChange: state.setDescription,
651
653
  isMarkdownEnabled: state.markdownEnabled,
652
- disableMarkdown: state.activityType === "email",
653
- rows: state.activityType === "email" ? 8 : void 0,
654
- textareaClassName: state.activityType === "email" ? "w-full resize-y overflow-y-auto rounded-lg border border-muted-foreground/20 bg-background px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" : void 0,
654
+ disableMarkdown: presentationType === "email",
655
+ rows: presentationType === "email" ? 8 : void 0,
656
+ textareaClassName: presentationType === "email" ? "w-full resize-y overflow-y-auto rounded-lg border border-muted-foreground/20 bg-background px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" : void 0,
655
657
  height: 120,
656
658
  placeholder: t("customers.schedule.descriptionPlaceholder", "Add details...")
657
659
  }
@@ -661,7 +663,7 @@ function ScheduleActivityDialog({
661
663
  FooterFields,
662
664
  {
663
665
  visible: visibleFields,
664
- activityType: state.activityType,
666
+ activityType: presentationType,
665
667
  reminderMinutes: state.reminderMinutes,
666
668
  setReminderMinutes: state.setReminderMinutes,
667
669
  visibility: state.visibility,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/customers/components/detail/ScheduleActivityDialog.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Users, Phone, Check, Mail, Calendar, X, StickyNote } from 'lucide-react'\nimport { cn } from '@open-mercato/shared/lib/utils'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { validatePhoneNumber } from '@open-mercato/shared/lib/phone'\nimport { apiCallOrThrow, readApiResultOrThrow, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader, extractOptimisticLockConflict } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { mapCrudServerErrorToFormErrors } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { Alert, AlertDescription, AlertTitle } from '@open-mercato/ui/primitives/alert'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Dialog, DialogContent, DialogTitle } from '@open-mercato/ui/primitives/dialog'\nimport { useDialogKeyHandler } from '@open-mercato/ui/hooks/useDialogKeyHandler'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { PhoneNumberField, SwitchableMarkdownInput } from '@open-mercato/ui/backend/inputs'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport {\n useScheduleFormState,\n FIELD_VISIBILITY,\n isDateRequired,\n isTimeRequired,\n getFieldLabel,\n DateTimeFields,\n ParticipantsField,\n LocationField,\n FooterFields,\n LinkedEntitiesField,\n} from './schedule'\nimport type { ActivityType, ScheduleActivityEditData } from './schedule'\nimport { PRIORITY_NUMBER, priorityFromNumber, type EditorPriority } from '../../lib/calendar/editorPayload'\n\nconst TYPE_TABS: Array<{ type: ActivityType; icon: React.ComponentType<{ className?: string }>; labelKey: string; fallback: string }> = [\n { type: 'meeting', icon: Users, labelKey: 'customers.schedule.types.meeting', fallback: 'Meeting' },\n { type: 'call', icon: Phone, labelKey: 'customers.schedule.types.call', fallback: 'Call' },\n { type: 'task', icon: Check, labelKey: 'customers.schedule.types.task', fallback: 'Task' },\n { type: 'email', icon: Mail, labelKey: 'customers.schedule.types.email', fallback: 'Email' },\n { type: 'note', icon: StickyNote, labelKey: 'customers.schedule.types.note', fallback: 'Note' },\n]\n\ntype DialogChrome = { titleKey: string; titleFallback: string; subtitleKey: string; subtitleFallback: string; saveKey: string; saveFallback: string; saveIcon: React.ComponentType<{ className?: string }> }\n\nconst TYPE_CHROME: Record<ActivityType, DialogChrome> = {\n meeting: {\n titleKey: 'customers.schedule.meeting.title', titleFallback: 'New meeting',\n subtitleKey: 'customers.schedule.meeting.subtitle', subtitleFallback: 'Block time on the calendar with attendees',\n saveKey: 'customers.schedule.meeting.save', saveFallback: 'Save activity', saveIcon: Calendar,\n },\n call: {\n titleKey: 'customers.schedule.call.title', titleFallback: 'Log call',\n subtitleKey: 'customers.schedule.call.subtitle', subtitleFallback: 'Log a call you just had or schedule one',\n saveKey: 'customers.schedule.call.save', saveFallback: 'Log call', saveIcon: Phone,\n },\n task: {\n titleKey: 'customers.schedule.task.title', titleFallback: 'New task',\n subtitleKey: 'customers.schedule.task.subtitle', subtitleFallback: 'Capture something to follow up on',\n saveKey: 'customers.schedule.task.save', saveFallback: 'Save task', saveIcon: Check,\n },\n email: {\n titleKey: 'customers.schedule.email.title', titleFallback: 'Compose email',\n subtitleKey: 'customers.schedule.email.subtitle', subtitleFallback: 'Compose and send a tracked email',\n saveKey: 'customers.schedule.email.save', saveFallback: 'Send email', saveIcon: Mail,\n },\n note: {\n titleKey: 'customers.schedule.note.title', titleFallback: 'Add note',\n subtitleKey: 'customers.schedule.note.subtitle', subtitleFallback: 'Write down a note about this interaction',\n saveKey: 'customers.schedule.note.save', saveFallback: 'Save note', saveIcon: StickyNote,\n },\n}\n\nconst CALL_DIRECTIONS: Array<{ key: 'outbound' | 'inbound'; labelKey: string; labelFallback: string; dot: string }> = [\n { key: 'outbound', labelKey: 'customers.schedule.call.direction.outbound', labelFallback: 'Outbound', dot: 'bg-status-info-icon' },\n { key: 'inbound', labelKey: 'customers.schedule.call.direction.inbound', labelFallback: 'Inbound', dot: 'bg-status-success-icon' },\n]\n\nconst CALL_OUTCOMES: Array<{ key: string; labelKey: string; labelFallback: string; dot: string }> = [\n { key: 'connected', labelKey: 'customers.schedule.call.outcome.connected', labelFallback: 'Connected', dot: 'bg-status-success-icon' },\n { key: 'voicemail', labelKey: 'customers.schedule.call.outcome.voicemail', labelFallback: 'Voicemail', dot: 'bg-status-warning-icon' },\n { key: 'noanswer', labelKey: 'customers.schedule.call.outcome.noAnswer', labelFallback: 'No answer', dot: 'bg-muted-foreground' },\n { key: 'busy', labelKey: 'customers.schedule.call.outcome.busy', labelFallback: 'Busy', dot: 'bg-status-warning-icon' },\n { key: 'badnumber', labelKey: 'customers.schedule.call.outcome.badNumber', labelFallback: 'Bad number', dot: 'bg-status-error-icon' },\n]\n\n// Task priority is the interaction's own nullable `priority` column (0-100), not a\n// custom field \u2014 the same scale `CalendarEventEditor` writes through\n// `PRIORITY_NUMBER` / `priorityFromNumber`. `null` means \"no priority set\", which the\n// column allows (#5943). Dot colours mirror the calendar editor's `PRIORITY_META` so\n// both controls render the same value identically.\ntype TaskPriorityValue = EditorPriority | null\n\nconst TASK_PRIORITIES: Array<{ key: TaskPriorityValue; labelKey: string; labelFallback: string; dot: string }> = [\n { key: null, labelKey: 'customers.schedule.task.priority.none', labelFallback: 'None', dot: 'bg-muted' },\n { key: 'low', labelKey: 'customers.schedule.task.priority.low', labelFallback: 'Low', dot: 'bg-status-info-icon' },\n { key: 'medium', labelKey: 'customers.schedule.task.priority.medium', labelFallback: 'Medium', dot: 'bg-muted-foreground' },\n { key: 'high', labelKey: 'customers.schedule.task.priority.high', labelFallback: 'High', dot: 'bg-status-error-icon' },\n]\n\nfunction readTaskPriorityNumber(raw: { priority?: unknown } | null | undefined): number | null {\n return typeof raw?.priority === 'number' && !Number.isNaN(raw.priority) ? raw.priority : null\n}\n\n// `TaskForm` writes any 0-100 value while these chips only offer three buckets, so a\n// save that did not touch the control must keep the stored number rather than snap it\n// to the bucket midpoint \u2014 `priority` is a sortable column, so rewriting 100 as 90\n// would silently reorder tasks the user never edited.\nfunction buildTaskPriorityPayload(level: TaskPriorityValue, seeded: number | null): number | null {\n if (!level) return null\n if (seeded !== null && priorityFromNumber(seeded) === level) return seeded\n return PRIORITY_NUMBER[level]\n}\n\ninterface ScheduleActivityDialogProps {\n open: boolean\n onClose: () => void\n entityId: string\n dealId?: string | null\n entityName?: string\n companyName?: string | null\n entityType: 'company' | 'person' | 'deal'\n onActivityCreated?: () => void\n /** When provided, dialog opens in edit mode with pre-filled data */\n editData?: ScheduleActivityEditData | null\n /** Default country ISO2 code for phone number input when value is empty/unparsed */\n defaultCountryIso2?: string\n}\n\nexport function ScheduleActivityDialog({\n open,\n onClose,\n entityId,\n dealId = null,\n entityName,\n companyName,\n entityType,\n onActivityCreated,\n editData,\n defaultCountryIso2,\n}: ScheduleActivityDialogProps) {\n const t = useT()\n const state = useScheduleFormState({ open, editData: editData ?? null })\n const visibleFields = FIELD_VISIBILITY[state.activityType]\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const isEditing = Boolean(editData?.id)\n const chrome = TYPE_CHROME[state.activityType]\n const SaveIcon = chrome.saveIcon\n const [callDirection, setCallDirection] = React.useState<'outbound' | 'inbound'>('outbound')\n const [callOutcome, setCallOutcome] = React.useState<string | null>(null)\n const [callPhoneNumber, setCallPhoneNumber] = React.useState('')\n const [callPhoneError, setCallPhoneError] = React.useState<string | null>(null)\n const [taskPriority, setTaskPriority] = React.useState<TaskPriorityValue>(null)\n const [seededTaskPriority, setSeededTaskPriority] = React.useState<number | null>(null)\n const callPhoneInvalidMessage = React.useMemo(\n () =>\n t(\n 'customers.activities.errors.phoneInvalid',\n 'Enter a valid phone number with country code (e.g. +1 212 555 1234)',\n ),\n [t],\n )\n const translateErrorMessage = React.useCallback(\n (message: string | undefined, fallback: string) => {\n const key = typeof message === 'string' ? message.trim() : ''\n return key ? t(key, key) : fallback\n },\n [t],\n )\n\n React.useEffect(() => {\n if (!open) return\n const raw = editData as (Record<string, unknown> & { customValues?: unknown; phoneNumber?: unknown; priority?: unknown }) | null | undefined\n const cv = (raw?.customValues && typeof raw.customValues === 'object' ? raw.customValues : null) as Record<string, unknown> | null\n setCallDirection(typeof cv?.callDirection === 'string' && cv.callDirection === 'inbound' ? 'inbound' : 'outbound')\n setCallOutcome(typeof cv?.callOutcome === 'string' ? cv.callOutcome : null)\n // Seed phone number from either top-level `phoneNumber` (newer write path)\n // or legacy `customValues.callPhoneNumber` so previously-saved calls still\n // round-trip on edit (#1808).\n const seededPhone =\n typeof raw?.phoneNumber === 'string' && raw.phoneNumber.trim().length > 0\n ? raw.phoneNumber\n : typeof cv?.callPhoneNumber === 'string'\n ? cv.callPhoneNumber\n : ''\n setCallPhoneNumber(seededPhone)\n setCallPhoneError(null)\n const seededPriority = readTaskPriorityNumber(raw)\n setSeededTaskPriority(seededPriority)\n setTaskPriority(seededPriority === null ? null : priorityFromNumber(seededPriority))\n }, [open, editData])\n\n // Reset per-type chip state when the user switches activity type in create mode.\n // In edit mode, the persisted customValues should win, so we skip the reset.\n React.useEffect(() => {\n if (!open || isEditing) return\n setCallDirection('outbound')\n setCallOutcome(null)\n setCallPhoneNumber('')\n setCallPhoneError(null)\n setTaskPriority(null)\n setSeededTaskPriority(null)\n }, [state.activityType, open, isEditing])\n\n const handleCallPhoneChange = React.useCallback((next: string | undefined) => {\n setCallPhoneNumber(next ?? '')\n setCallPhoneError(null)\n }, [])\n\n const formSnapshot = React.useMemo(() => JSON.stringify({\n activityType: state.activityType,\n title: state.title,\n date: state.date,\n startTime: state.startTime,\n duration: state.duration,\n allDay: state.allDay,\n description: state.description,\n location: state.location,\n reminderMinutes: state.reminderMinutes,\n visibility: state.visibility,\n participants: state.participants,\n linkedEntities: state.linkedEntities,\n recurrenceEnabled: state.recurrenceEnabled,\n recurrenceDays: state.recurrenceDays,\n recurrenceEndType: state.recurrenceEndType,\n recurrenceCount: state.recurrenceCount,\n recurrenceEndDate: state.recurrenceEndDate,\n guestPermissions: state.guestPermissions,\n }), [\n state.activityType, state.title, state.date, state.startTime, state.duration, state.allDay,\n state.description, state.location, state.reminderMinutes, state.visibility, state.participants,\n state.linkedEntities, state.recurrenceEnabled, state.recurrenceDays, state.recurrenceEndType,\n state.recurrenceCount, state.recurrenceEndDate, state.guestPermissions,\n ])\n const initialSnapshotRef = React.useRef<string | null>(null)\n const snapshotOpenKeyRef = React.useRef<string | null>(null)\n const snapshotSettleCountRef = React.useRef(0)\n const closeConfirmPendingRef = React.useRef(false)\n const openKey = open ? `${editData?.id ?? 'new'}` : null\n React.useEffect(() => {\n if (!open) {\n initialSnapshotRef.current = null\n snapshotOpenKeyRef.current = null\n snapshotSettleCountRef.current = 0\n return\n }\n if (snapshotOpenKeyRef.current !== openKey) {\n snapshotOpenKeyRef.current = openKey\n snapshotSettleCountRef.current = 0\n initialSnapshotRef.current = null\n }\n if (snapshotSettleCountRef.current < 2) {\n initialSnapshotRef.current = formSnapshot\n snapshotSettleCountRef.current += 1\n }\n }, [open, openKey, formSnapshot])\n\n const isDirty = React.useCallback(() => {\n if (initialSnapshotRef.current == null) return false\n return initialSnapshotRef.current !== formSnapshot\n }, [formSnapshot])\n\n const guardedClose = React.useCallback(async () => {\n if (closeConfirmPendingRef.current) return\n if (!isDirty()) {\n onClose()\n return\n }\n closeConfirmPendingRef.current = true\n try {\n const ok = await confirm({\n title: t('customers.schedule.discardConfirm.title', 'Discard unsaved changes?'),\n description: t(\n 'customers.schedule.discardConfirm.description',\n 'You have unsaved edits in this activity. Save them first or continue to discard them.',\n ),\n confirmText: t('customers.schedule.discardConfirm.confirm', 'Discard'),\n cancelText: t('customers.schedule.discardConfirm.cancel', 'Keep editing'),\n variant: 'destructive',\n })\n if (ok) onClose()\n } finally {\n closeConfirmPendingRef.current = false\n }\n }, [confirm, isDirty, onClose, t])\n\n const mutationContextId = React.useMemo(\n () => `customer-activity:${entityType}:${entityId}`,\n [entityId, entityType],\n )\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n resourceId: string\n entityType: 'company' | 'person' | 'deal'\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: mutationContextId,\n blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),\n })\n const mutationContext = React.useMemo(\n () => ({\n formId: mutationContextId,\n resourceKind:\n entityType === 'company'\n ? 'customers.company'\n : entityType === 'person'\n ? 'customers.person'\n : 'customers.deal',\n resourceId: entityId,\n entityType,\n retryLastMutation,\n }),\n [entityId, entityType, mutationContextId, retryLastMutation],\n )\n const runGuardedMutation = React.useCallback(\n async <T,>(operation: () => Promise<T>, mutationPayload: Record<string, unknown>) =>\n runMutation({\n operation,\n mutationPayload,\n context: mutationContext,\n }),\n [mutationContext, runMutation],\n )\n\n // Conflict detection -- debounced check when date/time/duration changes\n React.useEffect(() => {\n if (!open || state.allDay || !state.date || !state.startTime) {\n state.setConflict(null)\n return\n }\n const timer = setTimeout(async () => {\n try {\n const localStart = new Date(`${state.date}T${state.startTime}:00`)\n const params = new URLSearchParams({\n date: state.date,\n startTime: state.startTime,\n duration: String(state.duration),\n })\n if (editData?.id) {\n params.set('excludeId', editData.id)\n }\n if (!Number.isNaN(localStart.getTime())) {\n params.set('timezoneOffsetMinutes', String(-localStart.getTimezoneOffset()))\n }\n const data = await readApiResultOrThrow<{\n hasConflicts: boolean\n conflicts: Array<{ id: string; title: string | null; startTime: string; endTime: string; type: string }>\n }>(`/api/customers/interactions/conflicts?${params.toString()}`)\n if (data?.hasConflicts && Array.isArray(data.conflicts) && data.conflicts.length > 0) {\n const descriptions = data.conflicts\n .map((c) => `${c.startTime}\u2013${c.endTime}: ${c.title ?? c.type}`)\n .join(', ')\n state.setConflict(\n t('customers.schedule.conflict.description', 'Overlaps with: {{items}}', { items: descriptions }),\n )\n } else {\n state.setConflict(null)\n }\n } catch {\n state.setConflict(null)\n }\n }, 500)\n return () => clearTimeout(timer)\n }, [editData?.id, open, state.date, state.startTime, state.duration, state.allDay, t]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const trimmedDate = state.date.trim()\n const trimmedStartTime = state.startTime.trim()\n const trimmedCallPhone = callPhoneNumber.trim()\n // Only calendar-bound types must be scheduled; a task may stay an undated\n // backlog item, so blocking its save on an empty date was wrong (#5941).\n const isDateMissing = isDateRequired(state.activityType) && !trimmedDate\n const isTimeMissing = isTimeRequired(state.activityType) && !state.allDay && !trimmedStartTime\n const isSubmitDisabled =\n state.saving ||\n !state.title.trim() ||\n isDateMissing ||\n isTimeMissing\n\n const handleSave = React.useCallback(async () => {\n if (!state.title.trim()) return\n if (isDateMissing) {\n flash(t('customers.activities.errors.dateRequired', 'Date is required'), 'error')\n return\n }\n if (isTimeMissing) {\n flash(t('customers.activities.errors.timeRequired', 'Time is required'), 'error')\n return\n }\n let phoneNumberForPayload: string | undefined\n if (state.activityType === 'call' && trimmedCallPhone) {\n const phoneValidation = validatePhoneNumber(trimmedCallPhone)\n if (!phoneValidation.valid) {\n setCallPhoneError(callPhoneInvalidMessage)\n flash(callPhoneInvalidMessage, 'error')\n return\n }\n phoneNumberForPayload = phoneValidation.normalized ?? trimmedCallPhone\n setCallPhoneError(null)\n if (phoneNumberForPayload !== callPhoneNumber) {\n setCallPhoneNumber(phoneNumberForPayload)\n }\n }\n state.setSaving(true)\n try {\n // An undated activity (a backlog task) has no moment to compute \u2014 sending\n // an explicit null clears `scheduled_at` instead of posting an\n // `Invalid Date` built from an empty date string (#5941).\n const timeForPayload = state.allDay ? '00:00' : trimmedStartTime\n const scheduledAt = trimmedDate\n ? new Date(`${trimmedDate}T${timeForPayload || '00:00'}:00`).toISOString()\n : null\n\n const recurrenceRule = state.recurrenceEnabled\n ? buildRecurrenceRule(state.recurrenceDays, state.recurrenceEndType, state.recurrenceCount, state.recurrenceEndDate)\n : null\n\n const isSaveEdit = Boolean(editData?.id)\n const customValues: Record<string, unknown> = {}\n if (state.activityType === 'call') {\n customValues.callDirection = callDirection\n if (callOutcome) customValues.callOutcome = callOutcome\n if (phoneNumberForPayload) customValues.callPhoneNumber = phoneNumberForPayload\n }\n // On edit, pin the payload to the activity's own linked entity when the\n // caller provided one (`editData.entityId`) rather than the `entityId` prop,\n // which tracks the host page's currently-selected entity and can differ from\n // the activity's record on multi-entity pages like the deal detail view. This\n // dialog has no entity picker, so an edit must never silently re-link (#6050).\n const payloadEntityId = isSaveEdit && editData?.entityId ? editData.entityId : entityId\n const payload = {\n ...(isSaveEdit ? { id: editData!.id } : {}),\n entityId: payloadEntityId,\n dealId,\n interactionType: state.activityType,\n title: state.title.trim(),\n body: state.description.trim() || null,\n // The dialog has no status control, so an edit must leave the stored status\n // (and its `occurredAt`) alone instead of re-opening a completed activity (#6481).\n ...(isSaveEdit ? {} : { status: 'planned' }),\n date: trimmedDate || null,\n time: trimmedDate ? timeForPayload || null : null,\n phoneNumber: state.activityType === 'call' ? phoneNumberForPayload : undefined,\n // Only tasks expose the priority control, so other types leave the column\n // untouched rather than clearing it on a type switch (#5943).\n priority: state.activityType === 'task' ? buildTaskPriorityPayload(taskPriority, seededTaskPriority) : undefined,\n scheduledAt,\n durationMinutes: visibleFields.has('duration') && !state.allDay ? state.duration : null,\n location: visibleFields.has('location') ? (state.location.trim() || null) : null,\n allDay: visibleFields.has('allDay') ? state.allDay : null,\n recurrenceRule: visibleFields.has('recurrence') ? recurrenceRule : null,\n recurrenceEnd: visibleFields.has('recurrence') && state.recurrenceEndType === 'date' && state.recurrenceEndDate\n ? new Date(state.recurrenceEndDate).toISOString()\n : null,\n participants: visibleFields.has('participants') && state.participants.length > 0\n ? state.participants.map((p) => ({ userId: p.userId, name: p.name, email: p.email, status: p.status ?? 'pending' }))\n : null,\n guestPermissions: visibleFields.has('participants') && state.participants.length > 0 ? state.guestPermissions : null,\n linkedEntities: state.linkedEntities.length > 0\n ? state.linkedEntities.map((e) => ({ id: e.id, type: e.type, label: e.label }))\n : null,\n reminderMinutes: visibleFields.has('reminder') ? state.reminderMinutes : null,\n visibility: visibleFields.has('visibility') ? state.visibility : null,\n ...(Object.keys(customValues).length > 0 ? { customValues } : {}),\n }\n await runGuardedMutation(\n () => {\n const call = () =>\n apiCallOrThrow('/api/customers/interactions', {\n method: isSaveEdit ? 'PUT' : 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n })\n // Optimistic lock only applies to edits \u2014 a stale modal save against a\n // concurrently changed/deleted activity surfaces the conflict bar (#2055).\n return isSaveEdit\n ? withScopedApiRequestHeaders(buildOptimisticLockHeader(editData?.updatedAt), call)\n : call()\n },\n {\n operation: isSaveEdit ? 'updateActivity' : 'createActivity',\n interactionId: editData?.id ?? null,\n interactionType: state.activityType,\n },\n )\n flash(t('customers.schedule.saved', 'Activity scheduled'), 'success')\n onClose()\n // Delay data reload so the dialog can unmount cleanly and Radix restores body scroll\n requestAnimationFrame(() => { onActivityCreated?.() })\n } catch (err) {\n // An optimistic-lock 409 was already surfaced as the persistent conflict\n // bar by `runGuardedMutation` (useGuardedMutation \u2192 surfaceRecordConflict).\n // Do NOT additionally flash the raw `record_modified` code here \u2014 that\n // showed an untranslated toast on top of the localized bar (#2055 QA).\n if (extractOptimisticLockConflict(err)) {\n onClose()\n return\n }\n const { message, fieldErrors } = mapCrudServerErrorToFormErrors(err)\n const phoneFieldError = fieldErrors?.phoneNumber\n if (state.activityType === 'call' && phoneFieldError) {\n const translatedPhoneError = translateErrorMessage(phoneFieldError, callPhoneInvalidMessage)\n setCallPhoneError(translatedPhoneError)\n flash(translatedPhoneError, 'error')\n return\n }\n flash(\n translateErrorMessage(message, t('customers.schedule.error', 'Failed to schedule activity')),\n 'error',\n )\n } finally {\n state.setSaving(false)\n }\n }, [callDirection, callOutcome, callPhoneInvalidMessage, callPhoneNumber, isDateMissing, isTimeMissing, state.activityType, state.allDay, state.date, state.description, dealId, state.duration, editData, entityId, state.guestPermissions, state.linkedEntities, state.location, onActivityCreated, onClose, state.participants, state.recurrenceCount, state.recurrenceDays, state.recurrenceEnabled, state.recurrenceEndDate, state.recurrenceEndType, state.reminderMinutes, runGuardedMutation, seededTaskPriority, state.startTime, t, taskPriority, state.title, translateErrorMessage, trimmedCallPhone, trimmedDate, trimmedStartTime, state.visibility, visibleFields]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleKeyDown = useDialogKeyHandler({ onConfirm: handleSave })\n\n return (\n <Dialog open={open} onOpenChange={(o) => { if (!o) void guardedClose() }}>\n <DialogContent\n className=\"flex max-h-[90vh] flex-col overflow-hidden border-border p-0 shadow-xl sm:max-w-[760px] sm:rounded-xl [&>[data-dialog-close]]:hidden\"\n onKeyDown={handleKeyDown}\n aria-describedby={undefined}\n >\n {ConfirmDialogElement}\n <VisuallyHidden>\n <DialogTitle>{isEditing ? t('customers.schedule.editTitle', 'Edit activity') : t(chrome.titleKey, chrome.titleFallback)}</DialogTitle>\n </VisuallyHidden>\n\n {/* Header */}\n <div className=\"flex shrink-0 items-start justify-between gap-3 border-b border-border bg-background px-6 py-5\">\n <div className=\"flex flex-col gap-1\">\n <h2 className=\"text-lg font-semibold leading-tight tracking-tight text-foreground\">\n {isEditing ? t('customers.schedule.editTitle', 'Edit activity') : t(chrome.titleKey, chrome.titleFallback)}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t(chrome.subtitleKey, chrome.subtitleFallback)}\n </p>\n {entityName ? (\n <p className=\"mt-0.5 text-xs text-muted-foreground/80\">\n {t('customers.schedule.context', 'On timeline: {{name}}', { name: entityName })}\n {companyName ? ` \u00B7 ${companyName}` : ''}\n </p>\n ) : null}\n </div>\n <IconButton type=\"button\" variant=\"ghost\" size=\"sm\" onClick={() => { void guardedClose() }} className=\"flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-background\" aria-label={t('customers.schedule.cancel', 'Cancel')}>\n <X className=\"size-4 text-muted-foreground\" />\n </IconButton>\n </div>\n\n <div className=\"flex-1 overflow-y-auto\">\n <div className=\"flex flex-col gap-4 bg-background p-6\">\n\n {/* Conflict warning */}\n {state.conflict && (\n <Alert status=\"warning\" className=\"rounded-lg\">\n <AlertTitle>\n {t('customers.schedule.conflict.title', 'Calendar conflict')}\n </AlertTitle>\n <AlertDescription>{state.conflict}</AlertDescription>\n </Alert>\n )}\n\n {/* Type tabs \u2014 large rectangular tiles per Figma */}\n <div className=\"grid grid-cols-4 gap-2\">\n {TYPE_TABS.map(({ type, icon: Icon, labelKey, fallback }) => {\n const isActive = state.activityType === type\n return (\n <button\n key={type}\n type=\"button\"\n onClick={() => state.setActivityType(type)}\n aria-pressed={isActive}\n className={cn(\n 'flex h-[80px] flex-col items-center justify-center gap-2 rounded-md border text-[14px] font-semibold transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40 hover:text-foreground',\n )}\n >\n <Icon className=\"size-[18px]\" />\n {t(labelKey, fallback)}\n </button>\n )\n })}\n </div>\n\n {/* Title */}\n <div className=\"flex flex-col gap-1.5\">\n <label className=\"text-overline font-semibold text-muted-foreground tracking-wider\">\n {getFieldLabel(state.activityType, 'title', t, 'customers.schedule.titleLabel', 'Title')}\n </label>\n <input\n type=\"text\"\n value={state.title}\n onChange={(e) => state.setTitle(e.target.value)}\n placeholder={\n state.activityType === 'email'\n ? t('customers.schedule.subjectPlaceholder', 'Subject...')\n : t('customers.schedule.titlePlaceholder', 'Activity title...')\n }\n className=\"w-full rounded-md border border-border bg-background px-3 py-2.5 text-sm text-foreground outline-none focus:border-foreground\"\n autoFocus\n />\n </div>\n\n {/* Date/Time/Duration \u2014 placed before per-type chip rows so the call/task\n workflows match Figma 829:50 / 790:280 (date row first, then status chips). */}\n <DateTimeFields\n visible={visibleFields}\n activityType={state.activityType}\n date={state.date}\n setDate={state.setDate}\n startTime={state.startTime}\n setStartTime={state.setStartTime}\n duration={state.duration}\n setDuration={state.setDuration}\n allDay={state.allDay}\n setAllDay={state.setAllDay}\n recurrenceEnabled={state.recurrenceEnabled}\n setRecurrenceEnabled={state.setRecurrenceEnabled}\n recurrenceDays={state.recurrenceDays}\n toggleRecurrenceDay={state.toggleRecurrenceDay}\n recurrenceEndType={state.recurrenceEndType}\n setRecurrenceEndType={state.setRecurrenceEndType}\n recurrenceCount={state.recurrenceCount}\n setRecurrenceCount={state.setRecurrenceCount}\n recurrenceEndDate={state.recurrenceEndDate}\n setRecurrenceEndDate={state.setRecurrenceEndDate}\n />\n\n {/* Call: Direction + Outcome chips */}\n {state.activityType === 'call' && (\n <div className=\"flex flex-col gap-3\">\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.call.directionLabel', 'Direction')}\n </label>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {CALL_DIRECTIONS.map((opt) => {\n const isActive = callDirection === opt.key\n return (\n <button\n key={opt.key}\n type=\"button\"\n aria-pressed={isActive}\n onClick={() => setCallDirection(opt.key)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40',\n )}\n >\n <span className={cn('inline-block size-1.5 rounded-full', opt.dot)} aria-hidden />\n {t(opt.labelKey, opt.labelFallback)}\n </button>\n )\n })}\n </div>\n </div>\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.call.outcomeLabel', 'Outcome')}\n </label>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {CALL_OUTCOMES.map((opt) => {\n const isActive = callOutcome === opt.key\n return (\n <button\n key={opt.key}\n type=\"button\"\n aria-pressed={isActive}\n onClick={() => setCallOutcome(isActive ? null : opt.key)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40',\n )}\n >\n <span className={cn('inline-block size-1.5 rounded-full', opt.dot)} aria-hidden />\n {t(opt.labelKey, opt.labelFallback)}\n </button>\n )\n })}\n </div>\n </div>\n </div>\n )}\n\n {/* Task: Priority chips */}\n {state.activityType === 'task' && (\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.task.priorityLabel', 'Priority')}\n </label>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {TASK_PRIORITIES.map((opt) => {\n const isActive = taskPriority === opt.key\n return (\n <button\n key={opt.key ?? 'none'}\n type=\"button\"\n aria-pressed={isActive}\n onClick={() => setTaskPriority(opt.key)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40',\n )}\n >\n <span className={cn('inline-block size-1.5 rounded-full', opt.dot)} aria-hidden />\n {t(opt.labelKey, opt.labelFallback)}\n </button>\n )\n })}\n </div>\n </div>\n )}\n\n {/* Participants */}\n <ParticipantsField\n visible={visibleFields}\n activityType={state.activityType}\n participants={state.participants}\n setParticipants={state.setParticipants}\n removeParticipant={state.removeParticipant}\n guestPermissions={state.guestPermissions}\n setGuestPermissions={state.setGuestPermissions}\n />\n\n {/* Location (or phone number for calls) */}\n {state.activityType === 'call' ? (\n <div className=\"flex flex-col gap-1.5\">\n <label htmlFor=\"schedule-call-phone\" className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.call.phoneLabel', 'Phone number')}\n </label>\n <PhoneNumberField\n id=\"schedule-call-phone\"\n value={callPhoneNumber}\n onValueChange={handleCallPhoneChange}\n placeholder={t('customers.schedule.call.phonePlaceholder', '+1 555 000 0000')}\n externalError={callPhoneError}\n invalidLabel={callPhoneInvalidMessage}\n minDigits={7}\n defaultCountryIso2={defaultCountryIso2}\n />\n </div>\n ) : (\n <LocationField\n visible={visibleFields}\n activityType={state.activityType}\n location={state.location}\n setLocation={state.setLocation}\n />\n )}\n\n {/* Linked Entities */}\n <LinkedEntitiesField\n visible={visibleFields}\n activityType={state.activityType}\n linkedEntities={state.linkedEntities}\n setLinkedEntities={state.setLinkedEntities}\n />\n\n {/* Description */}\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {getFieldLabel(state.activityType, 'description', t, 'customers.schedule.description', 'Description')}\n </label>\n <div className=\"mt-[8px]\">\n <SwitchableMarkdownInput\n value={state.description}\n onChange={state.setDescription}\n isMarkdownEnabled={state.markdownEnabled}\n // Email bodies are plain text from other mail clients, not Markdown; `<address>`\n // or `<url>` tokens in them break the MDX editor (#5903).\n disableMarkdown={state.activityType === 'email'}\n // The plain textarea defaults to 3 hidden-overflow rows, which\n // would cut off quoted replies; give email bodies room and a scrollbar.\n rows={state.activityType === 'email' ? 8 : undefined}\n textareaClassName={\n state.activityType === 'email'\n ? 'w-full resize-y overflow-y-auto rounded-lg border border-muted-foreground/20 bg-background px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n : undefined\n }\n height={120}\n placeholder={t('customers.schedule.descriptionPlaceholder', 'Add details...')}\n />\n </div>\n </div>\n\n {/* Reminder + Visibility */}\n <FooterFields\n visible={visibleFields}\n activityType={state.activityType}\n reminderMinutes={state.reminderMinutes}\n setReminderMinutes={state.setReminderMinutes}\n visibility={state.visibility}\n setVisibility={state.setVisibility}\n />\n\n </div>\n </div>\n\n {/* Footer */}\n <div className=\"flex shrink-0 items-center justify-end gap-2.5 border-t border-border bg-muted/50 px-6 py-4\">\n <Button type=\"button\" variant=\"outline\" onClick={() => { void guardedClose() }} className=\"rounded-md border border-input bg-background px-5 py-3 text-sm font-semibold text-foreground\">\n {t('customers.schedule.cancel', 'Cancel')}\n </Button>\n <Button type=\"button\" onClick={handleSave} disabled={isSubmitDisabled} className=\"flex items-center gap-2 rounded-md bg-foreground px-5 py-3 text-sm font-semibold text-background hover:bg-foreground/90 disabled:opacity-50\">\n <SaveIcon className=\"size-3.5\" />\n {state.saving\n ? t('customers.schedule.saving', 'Saving...')\n : isEditing\n ? t('customers.schedule.update', 'Update activity')\n : t(chrome.saveKey, chrome.saveFallback)}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport type { ScheduleActivityEditData }\n\nfunction buildRecurrenceRule(\n days: boolean[],\n endType: 'never' | 'count' | 'date',\n count: number,\n endDate: string,\n): string {\n const dayNames = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']\n const selectedDays = days.map((active, i) => (active ? dayNames[i] : null)).filter(Boolean)\n let rule = `FREQ=WEEKLY;BYDAY=${selectedDays.join(',')}`\n if (endType === 'count') rule += `;COUNT=${count}`\n if (endType === 'date' && endDate) rule += `;UNTIL=${endDate.replace(/-/g, '')}T235959Z`\n return rule\n}\n"],
5
- "mappings": ";AA8gBU,cAaI,YAbJ;AA5gBV,YAAY,WAAW;AACvB,SAAS,OAAO,OAAO,OAAO,MAAM,UAAU,GAAG,kBAAkB;AACnE,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,2BAA2B;AACpC,SAAS,gBAAgB,sBAAsB,mCAAmC;AAClF,SAAS,2BAA2B,qCAAqC;AACzE,SAAS,sCAAsC;AAC/C,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAS,OAAO,kBAAkB,kBAAkB;AACpD,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,0BAA+C;AAEzE,MAAM,YAAkI;AAAA,EACtI,EAAE,MAAM,WAAW,MAAM,OAAO,UAAU,oCAAoC,UAAU,UAAU;AAAA,EAClG,EAAE,MAAM,QAAQ,MAAM,OAAO,UAAU,iCAAiC,UAAU,OAAO;AAAA,EACzF,EAAE,MAAM,QAAQ,MAAM,OAAO,UAAU,iCAAiC,UAAU,OAAO;AAAA,EACzF,EAAE,MAAM,SAAS,MAAM,MAAM,UAAU,kCAAkC,UAAU,QAAQ;AAAA,EAC3F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AU,+IAC/E;AAAA,gCAAC,YAAS,WAAU,YAAW;AAAA,YAC9B,MAAM,SACH,EAAE,6BAA6B,WAAW,IAC1C,YACE,EAAE,6BAA6B,iBAAiB,IAChD,EAAE,OAAO,SAAS,OAAO,YAAY;AAAA,aAC7C;AAAA,WACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;AAIA,SAAS,oBACP,MACA,SACA,OACA,SACQ;AACR,QAAM,WAAW,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI;AAC1D,QAAM,eAAe,KAAK,IAAI,CAAC,QAAQ,MAAO,SAAS,SAAS,CAAC,IAAI,IAAK,EAAE,OAAO,OAAO;AAC1F,MAAI,OAAO,qBAAqB,aAAa,KAAK,GAAG,CAAC;AACtD,MAAI,YAAY,QAAS,SAAQ,UAAU,KAAK;AAChD,MAAI,YAAY,UAAU,QAAS,SAAQ,UAAU,QAAQ,QAAQ,MAAM,EAAE,CAAC;AAC9E,SAAO;AACT;",
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Users, Phone, Check, Mail, Calendar, X, StickyNote } from 'lucide-react'\nimport { cn } from '@open-mercato/shared/lib/utils'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { validatePhoneNumber } from '@open-mercato/shared/lib/phone'\nimport { apiCallOrThrow, readApiResultOrThrow, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader, extractOptimisticLockConflict } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { mapCrudServerErrorToFormErrors } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { Alert, AlertDescription, AlertTitle } from '@open-mercato/ui/primitives/alert'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Dialog, DialogContent, DialogTitle } from '@open-mercato/ui/primitives/dialog'\nimport { useDialogKeyHandler } from '@open-mercato/ui/hooks/useDialogKeyHandler'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { PhoneNumberField, SwitchableMarkdownInput } from '@open-mercato/ui/backend/inputs'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport {\n useScheduleFormState,\n FIELD_VISIBILITY,\n isDateRequired,\n isTimeRequired,\n getFieldLabel,\n resolveScheduleActivityType,\n DateTimeFields,\n ParticipantsField,\n LocationField,\n FooterFields,\n LinkedEntitiesField,\n} from './schedule'\nimport type { ActivityType, ScheduleActivityEditData } from './schedule'\nimport { PRIORITY_NUMBER, priorityFromNumber, type EditorPriority } from '../../lib/calendar/editorPayload'\n\nconst TYPE_TABS: Array<{ type: ActivityType; icon: React.ComponentType<{ className?: string }>; labelKey: string; fallback: string }> = [\n { type: 'meeting', icon: Users, labelKey: 'customers.schedule.types.meeting', fallback: 'Meeting' },\n { type: 'call', icon: Phone, labelKey: 'customers.schedule.types.call', fallback: 'Call' },\n { type: 'task', icon: Check, labelKey: 'customers.schedule.types.task', fallback: 'Task' },\n { type: 'email', icon: Mail, labelKey: 'customers.schedule.types.email', fallback: 'Email' },\n { type: 'note', icon: StickyNote, labelKey: 'customers.schedule.types.note', fallback: 'Note' },\n]\n\ntype DialogChrome = { titleKey: string; titleFallback: string; subtitleKey: string; subtitleFallback: string; saveKey: string; saveFallback: string; saveIcon: React.ComponentType<{ className?: string }> }\n\nconst TYPE_CHROME: Record<ActivityType, DialogChrome> = {\n meeting: {\n titleKey: 'customers.schedule.meeting.title', titleFallback: 'New meeting',\n subtitleKey: 'customers.schedule.meeting.subtitle', subtitleFallback: 'Block time on the calendar with attendees',\n saveKey: 'customers.schedule.meeting.save', saveFallback: 'Save activity', saveIcon: Calendar,\n },\n call: {\n titleKey: 'customers.schedule.call.title', titleFallback: 'Log call',\n subtitleKey: 'customers.schedule.call.subtitle', subtitleFallback: 'Log a call you just had or schedule one',\n saveKey: 'customers.schedule.call.save', saveFallback: 'Log call', saveIcon: Phone,\n },\n task: {\n titleKey: 'customers.schedule.task.title', titleFallback: 'New task',\n subtitleKey: 'customers.schedule.task.subtitle', subtitleFallback: 'Capture something to follow up on',\n saveKey: 'customers.schedule.task.save', saveFallback: 'Save task', saveIcon: Check,\n },\n email: {\n titleKey: 'customers.schedule.email.title', titleFallback: 'Compose email',\n subtitleKey: 'customers.schedule.email.subtitle', subtitleFallback: 'Compose and send a tracked email',\n saveKey: 'customers.schedule.email.save', saveFallback: 'Send email', saveIcon: Mail,\n },\n note: {\n titleKey: 'customers.schedule.note.title', titleFallback: 'Add note',\n subtitleKey: 'customers.schedule.note.subtitle', subtitleFallback: 'Write down a note about this interaction',\n saveKey: 'customers.schedule.note.save', saveFallback: 'Save note', saveIcon: StickyNote,\n },\n}\n\nconst CALL_DIRECTIONS: Array<{ key: 'outbound' | 'inbound'; labelKey: string; labelFallback: string; dot: string }> = [\n { key: 'outbound', labelKey: 'customers.schedule.call.direction.outbound', labelFallback: 'Outbound', dot: 'bg-status-info-icon' },\n { key: 'inbound', labelKey: 'customers.schedule.call.direction.inbound', labelFallback: 'Inbound', dot: 'bg-status-success-icon' },\n]\n\nconst CALL_OUTCOMES: Array<{ key: string; labelKey: string; labelFallback: string; dot: string }> = [\n { key: 'connected', labelKey: 'customers.schedule.call.outcome.connected', labelFallback: 'Connected', dot: 'bg-status-success-icon' },\n { key: 'voicemail', labelKey: 'customers.schedule.call.outcome.voicemail', labelFallback: 'Voicemail', dot: 'bg-status-warning-icon' },\n { key: 'noanswer', labelKey: 'customers.schedule.call.outcome.noAnswer', labelFallback: 'No answer', dot: 'bg-muted-foreground' },\n { key: 'busy', labelKey: 'customers.schedule.call.outcome.busy', labelFallback: 'Busy', dot: 'bg-status-warning-icon' },\n { key: 'badnumber', labelKey: 'customers.schedule.call.outcome.badNumber', labelFallback: 'Bad number', dot: 'bg-status-error-icon' },\n]\n\n// Task priority is the interaction's own nullable `priority` column (0-100), not a\n// custom field \u2014 the same scale `CalendarEventEditor` writes through\n// `PRIORITY_NUMBER` / `priorityFromNumber`. `null` means \"no priority set\", which the\n// column allows (#5943). Dot colours mirror the calendar editor's `PRIORITY_META` so\n// both controls render the same value identically.\ntype TaskPriorityValue = EditorPriority | null\n\nconst TASK_PRIORITIES: Array<{ key: TaskPriorityValue; labelKey: string; labelFallback: string; dot: string }> = [\n { key: null, labelKey: 'customers.schedule.task.priority.none', labelFallback: 'None', dot: 'bg-muted' },\n { key: 'low', labelKey: 'customers.schedule.task.priority.low', labelFallback: 'Low', dot: 'bg-status-info-icon' },\n { key: 'medium', labelKey: 'customers.schedule.task.priority.medium', labelFallback: 'Medium', dot: 'bg-muted-foreground' },\n { key: 'high', labelKey: 'customers.schedule.task.priority.high', labelFallback: 'High', dot: 'bg-status-error-icon' },\n]\n\nfunction readTaskPriorityNumber(raw: { priority?: unknown } | null | undefined): number | null {\n return typeof raw?.priority === 'number' && !Number.isNaN(raw.priority) ? raw.priority : null\n}\n\n// `TaskForm` writes any 0-100 value while these chips only offer three buckets, so a\n// save that did not touch the control must keep the stored number rather than snap it\n// to the bucket midpoint \u2014 `priority` is a sortable column, so rewriting 100 as 90\n// would silently reorder tasks the user never edited.\nfunction buildTaskPriorityPayload(level: TaskPriorityValue, seeded: number | null): number | null {\n if (!level) return null\n if (seeded !== null && priorityFromNumber(seeded) === level) return seeded\n return PRIORITY_NUMBER[level]\n}\n\ninterface ScheduleActivityDialogProps {\n open: boolean\n onClose: () => void\n entityId: string\n dealId?: string | null\n entityName?: string\n companyName?: string | null\n entityType: 'company' | 'person' | 'deal'\n onActivityCreated?: () => void\n /** When provided, dialog opens in edit mode with pre-filled data */\n editData?: ScheduleActivityEditData | null\n /** Default country ISO2 code for phone number input when value is empty/unparsed */\n defaultCountryIso2?: string\n}\n\nexport function ScheduleActivityDialog({\n open,\n onClose,\n entityId,\n dealId = null,\n entityName,\n companyName,\n entityType,\n onActivityCreated,\n editData,\n defaultCountryIso2,\n}: ScheduleActivityDialogProps) {\n const t = useT()\n const state = useScheduleFormState({ open, editData: editData ?? null })\n // `state.activityType` is the raw persisted/selected key \u2014 may be a built-in\n // Event, a custom dictionary key, or a historical key outside this dialog's\n // five legacy kinds (#7486). `presentationType` resolves it to a safe key for\n // every lookup into the five-kind maps below; the save payload keeps the raw\n // value so an unsupported type is never silently rewritten.\n const presentationType = resolveScheduleActivityType(state.activityType)\n const visibleFields = FIELD_VISIBILITY[presentationType]\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const isEditing = Boolean(editData?.id)\n const chrome = TYPE_CHROME[presentationType]\n const SaveIcon = chrome.saveIcon\n const [callDirection, setCallDirection] = React.useState<'outbound' | 'inbound'>('outbound')\n const [callOutcome, setCallOutcome] = React.useState<string | null>(null)\n const [callPhoneNumber, setCallPhoneNumber] = React.useState('')\n const [callPhoneError, setCallPhoneError] = React.useState<string | null>(null)\n const [taskPriority, setTaskPriority] = React.useState<TaskPriorityValue>(null)\n const [seededTaskPriority, setSeededTaskPriority] = React.useState<number | null>(null)\n const callPhoneInvalidMessage = React.useMemo(\n () =>\n t(\n 'customers.activities.errors.phoneInvalid',\n 'Enter a valid phone number with country code (e.g. +1 212 555 1234)',\n ),\n [t],\n )\n const translateErrorMessage = React.useCallback(\n (message: string | undefined, fallback: string) => {\n const key = typeof message === 'string' ? message.trim() : ''\n return key ? t(key, key) : fallback\n },\n [t],\n )\n\n React.useEffect(() => {\n if (!open) return\n const raw = editData as (Record<string, unknown> & { customValues?: unknown; phoneNumber?: unknown; priority?: unknown }) | null | undefined\n const cv = (raw?.customValues && typeof raw.customValues === 'object' ? raw.customValues : null) as Record<string, unknown> | null\n setCallDirection(typeof cv?.callDirection === 'string' && cv.callDirection === 'inbound' ? 'inbound' : 'outbound')\n setCallOutcome(typeof cv?.callOutcome === 'string' ? cv.callOutcome : null)\n // Seed phone number from either top-level `phoneNumber` (newer write path)\n // or legacy `customValues.callPhoneNumber` so previously-saved calls still\n // round-trip on edit (#1808).\n const seededPhone =\n typeof raw?.phoneNumber === 'string' && raw.phoneNumber.trim().length > 0\n ? raw.phoneNumber\n : typeof cv?.callPhoneNumber === 'string'\n ? cv.callPhoneNumber\n : ''\n setCallPhoneNumber(seededPhone)\n setCallPhoneError(null)\n const seededPriority = readTaskPriorityNumber(raw)\n setSeededTaskPriority(seededPriority)\n setTaskPriority(seededPriority === null ? null : priorityFromNumber(seededPriority))\n }, [open, editData])\n\n // Reset per-type chip state when the user switches activity type in create mode.\n // In edit mode, the persisted customValues should win, so we skip the reset.\n React.useEffect(() => {\n if (!open || isEditing) return\n setCallDirection('outbound')\n setCallOutcome(null)\n setCallPhoneNumber('')\n setCallPhoneError(null)\n setTaskPriority(null)\n setSeededTaskPriority(null)\n }, [state.activityType, open, isEditing])\n\n const handleCallPhoneChange = React.useCallback((next: string | undefined) => {\n setCallPhoneNumber(next ?? '')\n setCallPhoneError(null)\n }, [])\n\n const formSnapshot = React.useMemo(() => JSON.stringify({\n activityType: state.activityType,\n title: state.title,\n date: state.date,\n startTime: state.startTime,\n duration: state.duration,\n allDay: state.allDay,\n description: state.description,\n location: state.location,\n reminderMinutes: state.reminderMinutes,\n visibility: state.visibility,\n participants: state.participants,\n linkedEntities: state.linkedEntities,\n recurrenceEnabled: state.recurrenceEnabled,\n recurrenceDays: state.recurrenceDays,\n recurrenceEndType: state.recurrenceEndType,\n recurrenceCount: state.recurrenceCount,\n recurrenceEndDate: state.recurrenceEndDate,\n guestPermissions: state.guestPermissions,\n }), [\n state.activityType, state.title, state.date, state.startTime, state.duration, state.allDay,\n state.description, state.location, state.reminderMinutes, state.visibility, state.participants,\n state.linkedEntities, state.recurrenceEnabled, state.recurrenceDays, state.recurrenceEndType,\n state.recurrenceCount, state.recurrenceEndDate, state.guestPermissions,\n ])\n const initialSnapshotRef = React.useRef<string | null>(null)\n const snapshotOpenKeyRef = React.useRef<string | null>(null)\n const snapshotSettleCountRef = React.useRef(0)\n const closeConfirmPendingRef = React.useRef(false)\n const openKey = open ? `${editData?.id ?? 'new'}` : null\n React.useEffect(() => {\n if (!open) {\n initialSnapshotRef.current = null\n snapshotOpenKeyRef.current = null\n snapshotSettleCountRef.current = 0\n return\n }\n if (snapshotOpenKeyRef.current !== openKey) {\n snapshotOpenKeyRef.current = openKey\n snapshotSettleCountRef.current = 0\n initialSnapshotRef.current = null\n }\n if (snapshotSettleCountRef.current < 2) {\n initialSnapshotRef.current = formSnapshot\n snapshotSettleCountRef.current += 1\n }\n }, [open, openKey, formSnapshot])\n\n const isDirty = React.useCallback(() => {\n if (initialSnapshotRef.current == null) return false\n return initialSnapshotRef.current !== formSnapshot\n }, [formSnapshot])\n\n const guardedClose = React.useCallback(async () => {\n if (closeConfirmPendingRef.current) return\n if (!isDirty()) {\n onClose()\n return\n }\n closeConfirmPendingRef.current = true\n try {\n const ok = await confirm({\n title: t('customers.schedule.discardConfirm.title', 'Discard unsaved changes?'),\n description: t(\n 'customers.schedule.discardConfirm.description',\n 'You have unsaved edits in this activity. Save them first or continue to discard them.',\n ),\n confirmText: t('customers.schedule.discardConfirm.confirm', 'Discard'),\n cancelText: t('customers.schedule.discardConfirm.cancel', 'Keep editing'),\n variant: 'destructive',\n })\n if (ok) onClose()\n } finally {\n closeConfirmPendingRef.current = false\n }\n }, [confirm, isDirty, onClose, t])\n\n const mutationContextId = React.useMemo(\n () => `customer-activity:${entityType}:${entityId}`,\n [entityId, entityType],\n )\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n resourceId: string\n entityType: 'company' | 'person' | 'deal'\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: mutationContextId,\n blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),\n })\n const mutationContext = React.useMemo(\n () => ({\n formId: mutationContextId,\n resourceKind:\n entityType === 'company'\n ? 'customers.company'\n : entityType === 'person'\n ? 'customers.person'\n : 'customers.deal',\n resourceId: entityId,\n entityType,\n retryLastMutation,\n }),\n [entityId, entityType, mutationContextId, retryLastMutation],\n )\n const runGuardedMutation = React.useCallback(\n async <T,>(operation: () => Promise<T>, mutationPayload: Record<string, unknown>) =>\n runMutation({\n operation,\n mutationPayload,\n context: mutationContext,\n }),\n [mutationContext, runMutation],\n )\n\n // Conflict detection -- debounced check when date/time/duration changes\n React.useEffect(() => {\n if (!open || state.allDay || !state.date || !state.startTime) {\n state.setConflict(null)\n return\n }\n const timer = setTimeout(async () => {\n try {\n const localStart = new Date(`${state.date}T${state.startTime}:00`)\n const params = new URLSearchParams({\n date: state.date,\n startTime: state.startTime,\n duration: String(state.duration),\n })\n if (editData?.id) {\n params.set('excludeId', editData.id)\n }\n if (!Number.isNaN(localStart.getTime())) {\n params.set('timezoneOffsetMinutes', String(-localStart.getTimezoneOffset()))\n }\n const data = await readApiResultOrThrow<{\n hasConflicts: boolean\n conflicts: Array<{ id: string; title: string | null; startTime: string; endTime: string; type: string }>\n }>(`/api/customers/interactions/conflicts?${params.toString()}`)\n if (data?.hasConflicts && Array.isArray(data.conflicts) && data.conflicts.length > 0) {\n const descriptions = data.conflicts\n .map((c) => `${c.startTime}\u2013${c.endTime}: ${c.title ?? c.type}`)\n .join(', ')\n state.setConflict(\n t('customers.schedule.conflict.description', 'Overlaps with: {{items}}', { items: descriptions }),\n )\n } else {\n state.setConflict(null)\n }\n } catch {\n state.setConflict(null)\n }\n }, 500)\n return () => clearTimeout(timer)\n }, [editData?.id, open, state.date, state.startTime, state.duration, state.allDay, t]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const trimmedDate = state.date.trim()\n const trimmedStartTime = state.startTime.trim()\n const trimmedCallPhone = callPhoneNumber.trim()\n // Only calendar-bound types must be scheduled; a task may stay an undated\n // backlog item, so blocking its save on an empty date was wrong (#5941).\n const isDateMissing = isDateRequired(presentationType) && !trimmedDate\n const isTimeMissing = isTimeRequired(presentationType) && !state.allDay && !trimmedStartTime\n const isSubmitDisabled =\n state.saving ||\n !state.title.trim() ||\n isDateMissing ||\n isTimeMissing\n\n const handleSave = React.useCallback(async () => {\n if (!state.title.trim()) return\n if (isDateMissing) {\n flash(t('customers.activities.errors.dateRequired', 'Date is required'), 'error')\n return\n }\n if (isTimeMissing) {\n flash(t('customers.activities.errors.timeRequired', 'Time is required'), 'error')\n return\n }\n let phoneNumberForPayload: string | undefined\n if (presentationType === 'call' && trimmedCallPhone) {\n const phoneValidation = validatePhoneNumber(trimmedCallPhone)\n if (!phoneValidation.valid) {\n setCallPhoneError(callPhoneInvalidMessage)\n flash(callPhoneInvalidMessage, 'error')\n return\n }\n phoneNumberForPayload = phoneValidation.normalized ?? trimmedCallPhone\n setCallPhoneError(null)\n if (phoneNumberForPayload !== callPhoneNumber) {\n setCallPhoneNumber(phoneNumberForPayload)\n }\n }\n state.setSaving(true)\n try {\n // An undated activity (a backlog task) has no moment to compute \u2014 sending\n // an explicit null clears `scheduled_at` instead of posting an\n // `Invalid Date` built from an empty date string (#5941).\n const timeForPayload = state.allDay ? '00:00' : trimmedStartTime\n const scheduledAt = trimmedDate\n ? new Date(`${trimmedDate}T${timeForPayload || '00:00'}:00`).toISOString()\n : null\n\n const recurrenceRule = state.recurrenceEnabled\n ? buildRecurrenceRule(state.recurrenceDays, state.recurrenceEndType, state.recurrenceCount, state.recurrenceEndDate)\n : null\n\n const isSaveEdit = Boolean(editData?.id)\n const customValues: Record<string, unknown> = {}\n if (presentationType === 'call') {\n customValues.callDirection = callDirection\n if (callOutcome) customValues.callOutcome = callOutcome\n if (phoneNumberForPayload) customValues.callPhoneNumber = phoneNumberForPayload\n }\n // On edit, pin the payload to the activity's own linked entity when the\n // caller provided one (`editData.entityId`) rather than the `entityId` prop,\n // which tracks the host page's currently-selected entity and can differ from\n // the activity's record on multi-entity pages like the deal detail view. This\n // dialog has no entity picker, so an edit must never silently re-link (#6050).\n const payloadEntityId = isSaveEdit && editData?.entityId ? editData.entityId : entityId\n const payload = {\n ...(isSaveEdit ? { id: editData!.id } : {}),\n entityId: payloadEntityId,\n dealId,\n interactionType: state.activityType,\n title: state.title.trim(),\n body: state.description.trim() || null,\n // The dialog has no status control, so an edit must leave the stored status\n // (and its `occurredAt`) alone instead of re-opening a completed activity (#6481).\n ...(isSaveEdit ? {} : { status: 'planned' }),\n date: trimmedDate || null,\n time: trimmedDate ? timeForPayload || null : null,\n phoneNumber: presentationType === 'call' ? phoneNumberForPayload : undefined,\n // Only tasks expose the priority control, so other types leave the column\n // untouched rather than clearing it on a type switch (#5943).\n priority: presentationType === 'task' ? buildTaskPriorityPayload(taskPriority, seededTaskPriority) : undefined,\n scheduledAt,\n durationMinutes: visibleFields.has('duration') && !state.allDay ? state.duration : null,\n location: visibleFields.has('location') ? (state.location.trim() || null) : null,\n allDay: visibleFields.has('allDay') ? state.allDay : null,\n recurrenceRule: visibleFields.has('recurrence') ? recurrenceRule : null,\n recurrenceEnd: visibleFields.has('recurrence') && state.recurrenceEndType === 'date' && state.recurrenceEndDate\n ? new Date(state.recurrenceEndDate).toISOString()\n : null,\n participants: visibleFields.has('participants') && state.participants.length > 0\n ? state.participants.map((p) => ({ userId: p.userId, name: p.name, email: p.email, status: p.status ?? 'pending' }))\n : null,\n guestPermissions: visibleFields.has('participants') && state.participants.length > 0 ? state.guestPermissions : null,\n linkedEntities: state.linkedEntities.length > 0\n ? state.linkedEntities.map((e) => ({ id: e.id, type: e.type, label: e.label }))\n : null,\n reminderMinutes: visibleFields.has('reminder') ? state.reminderMinutes : null,\n visibility: visibleFields.has('visibility') ? state.visibility : null,\n ...(Object.keys(customValues).length > 0 ? { customValues } : {}),\n }\n await runGuardedMutation(\n () => {\n const call = () =>\n apiCallOrThrow('/api/customers/interactions', {\n method: isSaveEdit ? 'PUT' : 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n })\n // Optimistic lock only applies to edits \u2014 a stale modal save against a\n // concurrently changed/deleted activity surfaces the conflict bar (#2055).\n return isSaveEdit\n ? withScopedApiRequestHeaders(buildOptimisticLockHeader(editData?.updatedAt), call)\n : call()\n },\n {\n operation: isSaveEdit ? 'updateActivity' : 'createActivity',\n interactionId: editData?.id ?? null,\n interactionType: state.activityType,\n },\n )\n flash(t('customers.schedule.saved', 'Activity scheduled'), 'success')\n onClose()\n // Delay data reload so the dialog can unmount cleanly and Radix restores body scroll\n requestAnimationFrame(() => { onActivityCreated?.() })\n } catch (err) {\n // An optimistic-lock 409 was already surfaced as the persistent conflict\n // bar by `runGuardedMutation` (useGuardedMutation \u2192 surfaceRecordConflict).\n // Do NOT additionally flash the raw `record_modified` code here \u2014 that\n // showed an untranslated toast on top of the localized bar (#2055 QA).\n if (extractOptimisticLockConflict(err)) {\n onClose()\n return\n }\n const { message, fieldErrors } = mapCrudServerErrorToFormErrors(err)\n const phoneFieldError = fieldErrors?.phoneNumber\n if (presentationType === 'call' && phoneFieldError) {\n const translatedPhoneError = translateErrorMessage(phoneFieldError, callPhoneInvalidMessage)\n setCallPhoneError(translatedPhoneError)\n flash(translatedPhoneError, 'error')\n return\n }\n flash(\n translateErrorMessage(message, t('customers.schedule.error', 'Failed to schedule activity')),\n 'error',\n )\n } finally {\n state.setSaving(false)\n }\n }, [callDirection, callOutcome, callPhoneInvalidMessage, callPhoneNumber, isDateMissing, isTimeMissing, presentationType, state.activityType, state.allDay, state.date, state.description, dealId, state.duration, editData, entityId, state.guestPermissions, state.linkedEntities, state.location, onActivityCreated, onClose, state.participants, state.recurrenceCount, state.recurrenceDays, state.recurrenceEnabled, state.recurrenceEndDate, state.recurrenceEndType, state.reminderMinutes, runGuardedMutation, seededTaskPriority, state.startTime, t, taskPriority, state.title, translateErrorMessage, trimmedCallPhone, trimmedDate, trimmedStartTime, state.visibility, visibleFields]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleKeyDown = useDialogKeyHandler({ onConfirm: handleSave })\n\n return (\n <Dialog open={open} onOpenChange={(o) => { if (!o) void guardedClose() }}>\n <DialogContent\n className=\"flex max-h-[90vh] flex-col overflow-hidden border-border p-0 shadow-xl sm:max-w-[760px] sm:rounded-xl [&>[data-dialog-close]]:hidden\"\n onKeyDown={handleKeyDown}\n aria-describedby={undefined}\n >\n {ConfirmDialogElement}\n <VisuallyHidden>\n <DialogTitle>{isEditing ? t('customers.schedule.editTitle', 'Edit activity') : t(chrome.titleKey, chrome.titleFallback)}</DialogTitle>\n </VisuallyHidden>\n\n {/* Header */}\n <div className=\"flex shrink-0 items-start justify-between gap-3 border-b border-border bg-background px-6 py-5\">\n <div className=\"flex flex-col gap-1\">\n <h2 className=\"text-lg font-semibold leading-tight tracking-tight text-foreground\">\n {isEditing ? t('customers.schedule.editTitle', 'Edit activity') : t(chrome.titleKey, chrome.titleFallback)}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t(chrome.subtitleKey, chrome.subtitleFallback)}\n </p>\n {entityName ? (\n <p className=\"mt-0.5 text-xs text-muted-foreground/80\">\n {t('customers.schedule.context', 'On timeline: {{name}}', { name: entityName })}\n {companyName ? ` \u00B7 ${companyName}` : ''}\n </p>\n ) : null}\n </div>\n <IconButton type=\"button\" variant=\"ghost\" size=\"sm\" onClick={() => { void guardedClose() }} className=\"flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-background\" aria-label={t('customers.schedule.cancel', 'Cancel')}>\n <X className=\"size-4 text-muted-foreground\" />\n </IconButton>\n </div>\n\n <div className=\"flex-1 overflow-y-auto\">\n <div className=\"flex flex-col gap-4 bg-background p-6\">\n\n {/* Conflict warning */}\n {state.conflict && (\n <Alert status=\"warning\" className=\"rounded-lg\">\n <AlertTitle>\n {t('customers.schedule.conflict.title', 'Calendar conflict')}\n </AlertTitle>\n <AlertDescription>{state.conflict}</AlertDescription>\n </Alert>\n )}\n\n {/* Type tabs \u2014 large rectangular tiles per Figma */}\n <div className=\"grid grid-cols-4 gap-2\">\n {TYPE_TABS.map(({ type, icon: Icon, labelKey, fallback }) => {\n const isActive = state.activityType === type\n return (\n <button\n key={type}\n type=\"button\"\n onClick={() => state.setActivityType(type)}\n aria-pressed={isActive}\n className={cn(\n 'flex h-[80px] flex-col items-center justify-center gap-2 rounded-md border text-[14px] font-semibold transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40 hover:text-foreground',\n )}\n >\n <Icon className=\"size-[18px]\" />\n {t(labelKey, fallback)}\n </button>\n )\n })}\n </div>\n\n {/* Title */}\n <div className=\"flex flex-col gap-1.5\">\n <label className=\"text-overline font-semibold text-muted-foreground tracking-wider\">\n {getFieldLabel(presentationType, 'title', t, 'customers.schedule.titleLabel', 'Title')}\n </label>\n <input\n type=\"text\"\n value={state.title}\n onChange={(e) => state.setTitle(e.target.value)}\n placeholder={\n presentationType === 'email'\n ? t('customers.schedule.subjectPlaceholder', 'Subject...')\n : t('customers.schedule.titlePlaceholder', 'Activity title...')\n }\n className=\"w-full rounded-md border border-border bg-background px-3 py-2.5 text-sm text-foreground outline-none focus:border-foreground\"\n autoFocus\n />\n </div>\n\n {/* Date/Time/Duration \u2014 placed before per-type chip rows so the call/task\n workflows match Figma 829:50 / 790:280 (date row first, then status chips). */}\n <DateTimeFields\n visible={visibleFields}\n activityType={presentationType}\n date={state.date}\n setDate={state.setDate}\n startTime={state.startTime}\n setStartTime={state.setStartTime}\n duration={state.duration}\n setDuration={state.setDuration}\n allDay={state.allDay}\n setAllDay={state.setAllDay}\n recurrenceEnabled={state.recurrenceEnabled}\n setRecurrenceEnabled={state.setRecurrenceEnabled}\n recurrenceDays={state.recurrenceDays}\n toggleRecurrenceDay={state.toggleRecurrenceDay}\n recurrenceEndType={state.recurrenceEndType}\n setRecurrenceEndType={state.setRecurrenceEndType}\n recurrenceCount={state.recurrenceCount}\n setRecurrenceCount={state.setRecurrenceCount}\n recurrenceEndDate={state.recurrenceEndDate}\n setRecurrenceEndDate={state.setRecurrenceEndDate}\n />\n\n {/* Call: Direction + Outcome chips */}\n {presentationType === 'call' && (\n <div className=\"flex flex-col gap-3\">\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.call.directionLabel', 'Direction')}\n </label>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {CALL_DIRECTIONS.map((opt) => {\n const isActive = callDirection === opt.key\n return (\n <button\n key={opt.key}\n type=\"button\"\n aria-pressed={isActive}\n onClick={() => setCallDirection(opt.key)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40',\n )}\n >\n <span className={cn('inline-block size-1.5 rounded-full', opt.dot)} aria-hidden />\n {t(opt.labelKey, opt.labelFallback)}\n </button>\n )\n })}\n </div>\n </div>\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.call.outcomeLabel', 'Outcome')}\n </label>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {CALL_OUTCOMES.map((opt) => {\n const isActive = callOutcome === opt.key\n return (\n <button\n key={opt.key}\n type=\"button\"\n aria-pressed={isActive}\n onClick={() => setCallOutcome(isActive ? null : opt.key)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40',\n )}\n >\n <span className={cn('inline-block size-1.5 rounded-full', opt.dot)} aria-hidden />\n {t(opt.labelKey, opt.labelFallback)}\n </button>\n )\n })}\n </div>\n </div>\n </div>\n )}\n\n {/* Task: Priority chips */}\n {presentationType === 'task' && (\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.task.priorityLabel', 'Priority')}\n </label>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {TASK_PRIORITIES.map((opt) => {\n const isActive = taskPriority === opt.key\n return (\n <button\n key={opt.key ?? 'none'}\n type=\"button\"\n aria-pressed={isActive}\n onClick={() => setTaskPriority(opt.key)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'border-transparent bg-foreground text-background'\n : 'border-border bg-card text-muted-foreground hover:border-foreground/40',\n )}\n >\n <span className={cn('inline-block size-1.5 rounded-full', opt.dot)} aria-hidden />\n {t(opt.labelKey, opt.labelFallback)}\n </button>\n )\n })}\n </div>\n </div>\n )}\n\n {/* Participants */}\n <ParticipantsField\n visible={visibleFields}\n activityType={presentationType}\n participants={state.participants}\n setParticipants={state.setParticipants}\n removeParticipant={state.removeParticipant}\n guestPermissions={state.guestPermissions}\n setGuestPermissions={state.setGuestPermissions}\n />\n\n {/* Location (or phone number for calls) */}\n {presentationType === 'call' ? (\n <div className=\"flex flex-col gap-1.5\">\n <label htmlFor=\"schedule-call-phone\" className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {t('customers.schedule.call.phoneLabel', 'Phone number')}\n </label>\n <PhoneNumberField\n id=\"schedule-call-phone\"\n value={callPhoneNumber}\n onValueChange={handleCallPhoneChange}\n placeholder={t('customers.schedule.call.phonePlaceholder', '+1 555 000 0000')}\n externalError={callPhoneError}\n invalidLabel={callPhoneInvalidMessage}\n minDigits={7}\n defaultCountryIso2={defaultCountryIso2}\n />\n </div>\n ) : (\n <LocationField\n visible={visibleFields}\n activityType={presentationType}\n location={state.location}\n setLocation={state.setLocation}\n />\n )}\n\n {/* Linked Entities */}\n <LinkedEntitiesField\n visible={visibleFields}\n activityType={presentationType}\n linkedEntities={state.linkedEntities}\n setLinkedEntities={state.setLinkedEntities}\n />\n\n {/* Description */}\n <div>\n <label className=\"text-overline font-semibold uppercase text-muted-foreground tracking-wider\">\n {getFieldLabel(presentationType, 'description', t, 'customers.schedule.description', 'Description')}\n </label>\n <div className=\"mt-[8px]\">\n <SwitchableMarkdownInput\n value={state.description}\n onChange={state.setDescription}\n isMarkdownEnabled={state.markdownEnabled}\n // Email bodies are plain text from other mail clients, not Markdown; `<address>`\n // or `<url>` tokens in them break the MDX editor (#5903).\n disableMarkdown={presentationType === 'email'}\n // The plain textarea defaults to 3 hidden-overflow rows, which\n // would cut off quoted replies; give email bodies room and a scrollbar.\n rows={presentationType === 'email' ? 8 : undefined}\n textareaClassName={\n presentationType === 'email'\n ? 'w-full resize-y overflow-y-auto rounded-lg border border-muted-foreground/20 bg-background px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n : undefined\n }\n height={120}\n placeholder={t('customers.schedule.descriptionPlaceholder', 'Add details...')}\n />\n </div>\n </div>\n\n {/* Reminder + Visibility */}\n <FooterFields\n visible={visibleFields}\n activityType={presentationType}\n reminderMinutes={state.reminderMinutes}\n setReminderMinutes={state.setReminderMinutes}\n visibility={state.visibility}\n setVisibility={state.setVisibility}\n />\n\n </div>\n </div>\n\n {/* Footer */}\n <div className=\"flex shrink-0 items-center justify-end gap-2.5 border-t border-border bg-muted/50 px-6 py-4\">\n <Button type=\"button\" variant=\"outline\" onClick={() => { void guardedClose() }} className=\"rounded-md border border-input bg-background px-5 py-3 text-sm font-semibold text-foreground\">\n {t('customers.schedule.cancel', 'Cancel')}\n </Button>\n <Button type=\"button\" onClick={handleSave} disabled={isSubmitDisabled} className=\"flex items-center gap-2 rounded-md bg-foreground px-5 py-3 text-sm font-semibold text-background hover:bg-foreground/90 disabled:opacity-50\">\n <SaveIcon className=\"size-3.5\" />\n {state.saving\n ? t('customers.schedule.saving', 'Saving...')\n : isEditing\n ? t('customers.schedule.update', 'Update activity')\n : t(chrome.saveKey, chrome.saveFallback)}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport type { ScheduleActivityEditData }\n\nfunction buildRecurrenceRule(\n days: boolean[],\n endType: 'never' | 'count' | 'date',\n count: number,\n endDate: string,\n): string {\n const dayNames = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']\n const selectedDays = days.map((active, i) => (active ? dayNames[i] : null)).filter(Boolean)\n let rule = `FREQ=WEEKLY;BYDAY=${selectedDays.join(',')}`\n if (endType === 'count') rule += `;COUNT=${count}`\n if (endType === 'date' && endDate) rule += `;UNTIL=${endDate.replace(/-/g, '')}T235959Z`\n return rule\n}\n"],
5
+ "mappings": ";AAqhBU,cAaI,YAbJ;AAnhBV,YAAY,WAAW;AACvB,SAAS,OAAO,OAAO,OAAO,MAAM,UAAU,GAAG,kBAAkB;AACnE,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,2BAA2B;AACpC,SAAS,gBAAgB,sBAAsB,mCAAmC;AAClF,SAAS,2BAA2B,qCAAqC;AACzE,SAAS,sCAAsC;AAC/C,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAS,OAAO,kBAAkB,kBAAkB;AACpD,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,0BAA+C;AAEzE,MAAM,YAAkI;AAAA,EACtI,EAAE,MAAM,WAAW,MAAM,OAAO,UAAU,oCAAoC,UAAU,UAAU;AAAA,EAClG,EAAE,MAAM,QAAQ,MAAM,OAAO,UAAU,iCAAiC,UAAU,OAAO;AAAA,EACzF,EAAE,MAAM,QAAQ,MAAM,OAAO,UAAU,iCAAiC,UAAU,OAAO;AAAA,EACzF,EAAE,MAAM,SAAS,MAAM,MAAM,UAAU,kCAAkC,UAAU,QAAQ;AAAA,EAC3F,EAAE,MAAM,QAAQ,MAAM,YAAY,UAAU,iCAAiC,UAAU,OAAO;AAChG;AAIA,MAAM,cAAkD;AAAA,EACtD,SAAS;AAAA,IACP,UAA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AAA,EACF,GACF;AAEJ;AAIA,SAAS,oBACP,MACA,SACA,OACA,SACQ;AACR,QAAM,WAAW,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI;AAC1D,QAAM,eAAe,KAAK,IAAI,CAAC,QAAQ,MAAO,SAAS,SAAS,CAAC,IAAI,IAAK,EAAE,OAAO,OAAO;AAC1F,MAAI,OAAO,qBAAqB,aAAa,KAAK,GAAG,CAAC;AACtD,MAAI,YAAY,QAAS,SAAQ,UAAU,KAAK;AAChD,MAAI,YAAY,UAAU,QAAS,SAAQ,UAAU,QAAQ,QAAQ,MAAM,EAAE,CAAC;AAC9E,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,10 @@
1
+ const KNOWN_ACTIVITY_TYPES = /* @__PURE__ */ new Set(["meeting", "call", "task", "email", "note"]);
2
+ function isKnownActivityType(type) {
3
+ return KNOWN_ACTIVITY_TYPES.has(type);
4
+ }
5
+ function resolveScheduleActivityType(type) {
6
+ return isKnownActivityType(type) ? type : "meeting";
7
+ }
1
8
  const FIELD_VISIBILITY = {
2
9
  meeting: /* @__PURE__ */ new Set([
3
10
  "title",
@@ -103,7 +110,9 @@ export {
103
110
  FIELD_VISIBILITY,
104
111
  getFieldLabel,
105
112
  isDateRequired,
113
+ isKnownActivityType,
106
114
  isTimeRequired,
107
- isVisible
115
+ isVisible,
116
+ resolveScheduleActivityType
108
117
  };
109
118
  //# sourceMappingURL=fieldConfig.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/modules/customers/components/detail/schedule/fieldConfig.ts"],
4
- "sourcesContent": ["export type ActivityType = 'meeting' | 'call' | 'task' | 'email' | 'note'\n\nexport type ScheduleFieldId =\n | 'title'\n | 'date'\n | 'startTime'\n | 'duration'\n | 'allDay'\n | 'timezone'\n | 'recurrence'\n | 'participants'\n | 'guestPermissions'\n | 'location'\n | 'linkedEntities'\n | 'description'\n | 'reminder'\n | 'visibility'\n\nexport const FIELD_VISIBILITY: Record<ActivityType, Set<ScheduleFieldId>> = {\n meeting: new Set([\n 'title', 'date', 'startTime', 'duration', 'allDay', 'timezone', 'recurrence',\n 'participants', 'guestPermissions', 'location', 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n call: new Set([\n 'title', 'date', 'startTime', 'duration',\n 'participants', 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n // Task: now also surfaces Due time (startTime) + Estimate (duration) per Figma 790:280.\n task: new Set([\n 'title', 'date', 'startTime', 'duration',\n 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n // Email: surface participants as TO recipients per Figma 790:510.\n email: new Set([\n 'title', 'date', 'startTime',\n 'participants', 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n note: new Set([\n 'title', 'linkedEntities', 'description', 'visibility',\n ]),\n}\n\ntype LabelOverride = { key: string; fallback: string }\n\n// Per-type section labels (Figma 784:1255 / 829:50 / 790:280 / 790:510).\n// `participants` / `linkedEntities` / `description` resolve via these overrides\n// when present; otherwise the field components fall back to their generic key.\nexport const FIELD_LABEL_OVERRIDES: Partial<\n Record<ActivityType, Partial<Record<ScheduleFieldId, LabelOverride>>>\n> = {\n meeting: {\n participants: { key: 'customers.schedule.attendees', fallback: 'Attendees' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n },\n call: {\n participants: { key: 'customers.schedule.contact', fallback: 'Contact' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.callNotes', fallback: 'Call notes' },\n },\n task: {\n date: { key: 'customers.schedule.dueDate', fallback: 'Due date' },\n startTime: { key: 'customers.schedule.dueTime', fallback: 'Due time' },\n duration: { key: 'customers.schedule.estimate', fallback: 'Estimate' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.details', fallback: 'Details' },\n },\n email: {\n title: { key: 'customers.schedule.subject', fallback: 'Subject' },\n participants: { key: 'customers.schedule.to', fallback: 'To' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.message', fallback: 'Message' },\n },\n note: {\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.note.content', fallback: 'Note' },\n },\n}\n\nexport function isVisible(type: ActivityType, fieldId: ScheduleFieldId): boolean {\n return FIELD_VISIBILITY[type].has(fieldId)\n}\n\n// Calendar-bound types must land on a concrete moment, but a task is a backlog\n// item whose due date is optional by design (`interactions.scheduled_at` is\n// nullable and the task lists already render an undated row) \u2014 #5941.\nconst OPTIONAL_DATE_TYPES: Set<ActivityType> = new Set(['task'])\n\nexport function isDateRequired(type: ActivityType): boolean {\n return isVisible(type, 'date') && !OPTIONAL_DATE_TYPES.has(type)\n}\n\n// A time without a date is meaningless, so the time follows the date: it is\n// only demanded for the types that must be scheduled in the first place.\nexport function isTimeRequired(type: ActivityType): boolean {\n return isVisible(type, 'startTime') && isDateRequired(type)\n}\n\nexport function getFieldLabel(\n type: ActivityType,\n fieldId: ScheduleFieldId,\n t: (key: string, fallback: string) => string,\n defaultKey: string,\n defaultFallback: string,\n): string {\n const override = FIELD_LABEL_OVERRIDES[type]?.[fieldId]\n if (override) return t(override.key, override.fallback)\n return t(defaultKey, defaultFallback)\n}\n"],
5
- "mappings": "AAkBO,MAAM,mBAA+D;AAAA,EAC1E,SAAS,oBAAI,IAAI;AAAA,IACf;AAAA,IAAS;AAAA,IAAQ;AAAA,IAAa;AAAA,IAAY;AAAA,IAAU;AAAA,IAAY;AAAA,IAChE;AAAA,IAAgB;AAAA,IAAoB;AAAA,IAAY;AAAA,IAAkB;AAAA,IAClE;AAAA,IAAY;AAAA,EACd,CAAC;AAAA,EACD,MAAM,oBAAI,IAAI;AAAA,IACZ;AAAA,IAAS;AAAA,IAAQ;AAAA,IAAa;AAAA,IAC9B;AAAA,IAAgB;AAAA,IAAkB;AAAA,IAClC;AAAA,IAAY;AAAA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,KAAK,8BAA8B,UAAU,UAAU;AAAA,EACxE;AAAA,EACA,MAAM;AAAA,IACJ,gBAAgB,EAAE,KAAK,kCAAkC,UAAU,cAAc;AAAA,IACjF,aAAa,EAAE,KAAK,mCAAmC,UAAU,OAAO;AAAA,EAC1E;AACF;AAEO,SAAS,UAAU,MAAoB,SAAmC;AAC/E,SAAO,iBAAiB,IAAI,EAAE,IAAI,OAAO;AAC3C;AAKA,MAAM,sBAAyC,oBAAI,IAAI,CAAC,MAAM,CAAC;AAExD,SAAS,eAAe,MAA6B;AAC1D,SAAO,UAAU,MAAM,MAAM,KAAK,CAAC,oBAAoB,IAAI,IAAI;AACjE;AAIO,SAAS,eAAe,MAA6B;AAC1D,SAAO,UAAU,MAAM,WAAW,KAAK,eAAe,IAAI;AAC5D;AAEO,SAAS,cACd,MACA,SACA,GACA,YACA,iBACQ;AACR,QAAM,WAAW,sBAAsB,IAAI,IAAI,OAAO;AACtD,MAAI,SAAU,QAAO,EAAE,SAAS,KAAK,SAAS,QAAQ;AACtD,SAAO,EAAE,YAAY,eAAe;AACtC;",
4
+ "sourcesContent": ["export type ActivityType = 'meeting' | 'call' | 'task' | 'email' | 'note'\n\nexport type ScheduleFieldId =\n | 'title'\n | 'date'\n | 'startTime'\n | 'duration'\n | 'allDay'\n | 'timezone'\n | 'recurrence'\n | 'participants'\n | 'guestPermissions'\n | 'location'\n | 'linkedEntities'\n | 'description'\n | 'reminder'\n | 'visibility'\n\nconst KNOWN_ACTIVITY_TYPES: ReadonlySet<string> = new Set(['meeting', 'call', 'task', 'email', 'note'])\n\nexport function isKnownActivityType(type: string): type is ActivityType {\n return KNOWN_ACTIVITY_TYPES.has(type)\n}\n\n// The built-in Event type and any custom or historical dictionary key the backend\n// accepts fall outside this dialog's five legacy presentation kinds (#7486) \u2014 this\n// dialog predates the configurable calendar event type catalog. Resolve those to\n// Meeting's chrome/field set, the closest and broadest safe default, while callers\n// keep the exact persisted key (`editData.interactionType` / the save payload)\n// untouched so the stored type is never silently rewritten.\nexport function resolveScheduleActivityType(type: string): ActivityType {\n return isKnownActivityType(type) ? type : 'meeting'\n}\n\nexport const FIELD_VISIBILITY: Record<ActivityType, Set<ScheduleFieldId>> = {\n meeting: new Set([\n 'title', 'date', 'startTime', 'duration', 'allDay', 'timezone', 'recurrence',\n 'participants', 'guestPermissions', 'location', 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n call: new Set([\n 'title', 'date', 'startTime', 'duration',\n 'participants', 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n // Task: now also surfaces Due time (startTime) + Estimate (duration) per Figma 790:280.\n task: new Set([\n 'title', 'date', 'startTime', 'duration',\n 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n // Email: surface participants as TO recipients per Figma 790:510.\n email: new Set([\n 'title', 'date', 'startTime',\n 'participants', 'linkedEntities', 'description',\n 'reminder', 'visibility',\n ]),\n note: new Set([\n 'title', 'linkedEntities', 'description', 'visibility',\n ]),\n}\n\ntype LabelOverride = { key: string; fallback: string }\n\n// Per-type section labels (Figma 784:1255 / 829:50 / 790:280 / 790:510).\n// `participants` / `linkedEntities` / `description` resolve via these overrides\n// when present; otherwise the field components fall back to their generic key.\nexport const FIELD_LABEL_OVERRIDES: Partial<\n Record<ActivityType, Partial<Record<ScheduleFieldId, LabelOverride>>>\n> = {\n meeting: {\n participants: { key: 'customers.schedule.attendees', fallback: 'Attendees' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n },\n call: {\n participants: { key: 'customers.schedule.contact', fallback: 'Contact' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.callNotes', fallback: 'Call notes' },\n },\n task: {\n date: { key: 'customers.schedule.dueDate', fallback: 'Due date' },\n startTime: { key: 'customers.schedule.dueTime', fallback: 'Due time' },\n duration: { key: 'customers.schedule.estimate', fallback: 'Estimate' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.details', fallback: 'Details' },\n },\n email: {\n title: { key: 'customers.schedule.subject', fallback: 'Subject' },\n participants: { key: 'customers.schedule.to', fallback: 'To' },\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.message', fallback: 'Message' },\n },\n note: {\n linkedEntities: { key: 'customers.schedule.connections', fallback: 'Connections' },\n description: { key: 'customers.schedule.note.content', fallback: 'Note' },\n },\n}\n\nexport function isVisible(type: ActivityType, fieldId: ScheduleFieldId): boolean {\n return FIELD_VISIBILITY[type].has(fieldId)\n}\n\n// Calendar-bound types must land on a concrete moment, but a task is a backlog\n// item whose due date is optional by design (`interactions.scheduled_at` is\n// nullable and the task lists already render an undated row) \u2014 #5941.\nconst OPTIONAL_DATE_TYPES: Set<ActivityType> = new Set(['task'])\n\nexport function isDateRequired(type: ActivityType): boolean {\n return isVisible(type, 'date') && !OPTIONAL_DATE_TYPES.has(type)\n}\n\n// A time without a date is meaningless, so the time follows the date: it is\n// only demanded for the types that must be scheduled in the first place.\nexport function isTimeRequired(type: ActivityType): boolean {\n return isVisible(type, 'startTime') && isDateRequired(type)\n}\n\nexport function getFieldLabel(\n type: ActivityType,\n fieldId: ScheduleFieldId,\n t: (key: string, fallback: string) => string,\n defaultKey: string,\n defaultFallback: string,\n): string {\n const override = FIELD_LABEL_OVERRIDES[type]?.[fieldId]\n if (override) return t(override.key, override.fallback)\n return t(defaultKey, defaultFallback)\n}\n"],
5
+ "mappings": "AAkBA,MAAM,uBAA4C,oBAAI,IAAI,CAAC,WAAW,QAAQ,QAAQ,SAAS,MAAM,CAAC;AAE/F,SAAS,oBAAoB,MAAoC;AACtE,SAAO,qBAAqB,IAAI,IAAI;AACtC;AAQO,SAAS,4BAA4B,MAA4B;AACtE,SAAO,oBAAoB,IAAI,IAAI,OAAO;AAC5C;AAEO,MAAM,mBAA+D;AAAA,EAC1E,SAAS,oBAAI,IAAI;AAAA,IACf;AAAA,IAAS;AAAA,IAAQ;AAAA,IA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gB,EAAE,KAAK,kCAAkC,UAAU,cAAc;AAAA,IACjF,aAAa,EAAE,KAAK,8BAA8B,UAAU,UAAU;AAAA,EACxE;AAAA,EACA,OAAO;AAAA,IACL,OAAO,EAAE,KAAK,8BAA8B,UAAU,UAAU;AAAA,IAChE,cAAc,EAAE,KAAK,yBAAyB,UAAU,KAAK;AAAA,IAC7D,gBAAgB,EAAE,KAAK,kCAAkC,UAAU,cAAc;AAAA,IACjF,aAAa,EAAE,KAAK,8BAA8B,UAAU,UAAU;AAAA,EACxE;AAAA,EACA,MAAM;AAAA,IACJ,gBAAgB,EAAE,KAAK,kCAAkC,UAAU,cAAc;AAAA,IACjF,aAAa,EAAE,KAAK,mCAAmC,UAAU,OAAO;AAAA,EAC1E;AACF;AAEO,SAAS,UAAU,MAAoB,SAAmC;AAC/E,SAAO,iBAAiB,IAAI,EAAE,IAAI,OAAO;AAC3C;AAKA,MAAM,sBAAyC,oBAAI,IAAI,CAAC,MAAM,CAAC;AAExD,SAAS,eAAe,MAA6B;AAC1D,SAAO,UAAU,MAAM,MAAM,KAAK,CAAC,oBAAoB,IAAI,IAAI;AACjE;AAIO,SAAS,eAAe,MAA6B;AAC1D,SAAO,UAAU,MAAM,WAAW,KAAK,eAAe,IAAI;AAC5D;AAEO,SAAS,cACd,MACA,SACA,GACA,YACA,iBACQ;AACR,QAAM,WAAW,sBAAsB,IAAI,IAAI,OAAO;AACtD,MAAI,SAAU,QAAO,EAAE,SAAS,KAAK,SAAS,QAAQ;AACtD,SAAO,EAAE,YAAY,eAAe;AACtC;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,7 @@ import { ParticipantsField } from "./ParticipantsField.js";
3
3
  import { LocationField } from "./LocationField.js";
4
4
  import { FooterFields } from "./FooterFields.js";
5
5
  import { LinkedEntitiesField } from "./LinkedEntitiesField.js";
6
- import { isVisible, isDateRequired, isTimeRequired, getFieldLabel, FIELD_VISIBILITY, FIELD_LABEL_OVERRIDES } from "./fieldConfig.js";
6
+ import { isVisible, isDateRequired, isTimeRequired, getFieldLabel, resolveScheduleActivityType, FIELD_VISIBILITY, FIELD_LABEL_OVERRIDES } from "./fieldConfig.js";
7
7
  import { useScheduleFormState, PARTICIPANT_COLORS } from "./useScheduleFormState.js";
8
8
  export {
9
9
  DateTimeFields,
@@ -18,6 +18,7 @@ export {
18
18
  isDateRequired,
19
19
  isTimeRequired,
20
20
  isVisible,
21
+ resolveScheduleActivityType,
21
22
  useScheduleFormState
22
23
  };
23
24
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/modules/customers/components/detail/schedule/index.ts"],
4
- "sourcesContent": ["export { DateTimeFields } from './DateTimeFields'\nexport { ParticipantsField } from './ParticipantsField'\nexport { LocationField } from './LocationField'\nexport { FooterFields } from './FooterFields'\nexport { LinkedEntitiesField } from './LinkedEntitiesField'\nexport { isVisible, isDateRequired, isTimeRequired, getFieldLabel, FIELD_VISIBILITY, FIELD_LABEL_OVERRIDES } from './fieldConfig'\nexport type { ActivityType, ScheduleFieldId } from './fieldConfig'\nexport { useScheduleFormState, PARTICIPANT_COLORS } from './useScheduleFormState'\nexport type { Participant, LinkedEntity, RsvpStatus, ScheduleActivityEditData } from './useScheduleFormState'\n"],
5
- "mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,SAAS,WAAW,gBAAgB,gBAAgB,eAAe,kBAAkB,6BAA6B;AAElH,SAAS,sBAAsB,0BAA0B;",
4
+ "sourcesContent": ["export { DateTimeFields } from './DateTimeFields'\nexport { ParticipantsField } from './ParticipantsField'\nexport { LocationField } from './LocationField'\nexport { FooterFields } from './FooterFields'\nexport { LinkedEntitiesField } from './LinkedEntitiesField'\nexport { isVisible, isDateRequired, isTimeRequired, getFieldLabel, resolveScheduleActivityType, FIELD_VISIBILITY, FIELD_LABEL_OVERRIDES } from './fieldConfig'\nexport type { ActivityType, ScheduleFieldId } from './fieldConfig'\nexport { useScheduleFormState, PARTICIPANT_COLORS } from './useScheduleFormState'\nexport type { Participant, LinkedEntity, RsvpStatus, ScheduleActivityEditData } from './useScheduleFormState'\n"],
5
+ "mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,SAAS,WAAW,gBAAgB,gBAAgB,eAAe,6BAA6B,kBAAkB,6BAA6B;AAE/I,SAAS,sBAAsB,0BAA0B;",
6
6
  "names": []
7
7
  }