@open-mercato/core 0.6.7-develop.6785.1.1dd7cfac55 → 0.6.7-develop.6795.1.8a3f27921c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/generated/entities.ids.generated.js +1 -0
  3. package/dist/generated/entities.ids.generated.js.map +2 -2
  4. package/dist/modules/auth/backend/settings/page.js +14 -9
  5. package/dist/modules/auth/backend/settings/page.js.map +2 -2
  6. package/dist/modules/customers/cli.js +17 -7
  7. package/dist/modules/customers/cli.js.map +2 -2
  8. package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +229 -216
  9. package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
  10. package/dist/modules/customers/search.js +50 -29
  11. package/dist/modules/customers/search.js.map +2 -2
  12. package/dist/modules/data_sync/api/mappings/[id]/route.js +22 -9
  13. package/dist/modules/data_sync/api/mappings/[id]/route.js.map +2 -2
  14. package/dist/modules/data_sync/api/mappings/route.js +13 -4
  15. package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
  16. package/dist/modules/data_sync/api/options.js +7 -2
  17. package/dist/modules/data_sync/api/options.js.map +2 -2
  18. package/dist/modules/data_sync/api/run.js +7 -2
  19. package/dist/modules/data_sync/api/run.js.map +2 -2
  20. package/dist/modules/data_sync/api/runs/[id]/cancel.js +8 -3
  21. package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
  22. package/dist/modules/data_sync/api/runs/[id]/retry.js +7 -2
  23. package/dist/modules/data_sync/api/runs/[id]/retry.js.map +2 -2
  24. package/dist/modules/data_sync/api/runs/[id]/route.js +8 -3
  25. package/dist/modules/data_sync/api/runs/[id]/route.js.map +2 -2
  26. package/dist/modules/data_sync/api/runs.js +7 -2
  27. package/dist/modules/data_sync/api/runs.js.map +2 -2
  28. package/dist/modules/data_sync/api/schedules/[id]/route.js +19 -6
  29. package/dist/modules/data_sync/api/schedules/[id]/route.js.map +2 -2
  30. package/dist/modules/data_sync/api/schedules/route.js +13 -4
  31. package/dist/modules/data_sync/api/schedules/route.js.map +2 -2
  32. package/dist/modules/data_sync/api/validate.js +9 -4
  33. package/dist/modules/data_sync/api/validate.js.map +2 -2
  34. package/dist/modules/design_system/acl.js +9 -0
  35. package/dist/modules/design_system/acl.js.map +7 -0
  36. package/dist/modules/design_system/backend/design-system/page.js +11 -0
  37. package/dist/modules/design_system/backend/design-system/page.js.map +7 -0
  38. package/dist/modules/design_system/backend/design-system/page.meta.js +15 -0
  39. package/dist/modules/design_system/backend/design-system/page.meta.js.map +7 -0
  40. package/dist/modules/design_system/gallery/components/CodeSnippet.js +52 -0
  41. package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +7 -0
  42. package/dist/modules/design_system/gallery/components/EntryCard.js +63 -0
  43. package/dist/modules/design_system/gallery/components/EntryCard.js.map +7 -0
  44. package/dist/modules/design_system/gallery/components/GalleryShell.js +163 -0
  45. package/dist/modules/design_system/gallery/components/GalleryShell.js.map +7 -0
  46. package/dist/modules/design_system/gallery/components/VariantPreview.js +9 -0
  47. package/dist/modules/design_system/gallery/components/VariantPreview.js.map +7 -0
  48. package/dist/modules/design_system/gallery/entries/banners.js +186 -0
  49. package/dist/modules/design_system/gallery/entries/banners.js.map +7 -0
  50. package/dist/modules/design_system/gallery/entries/buttons.js +361 -0
  51. package/dist/modules/design_system/gallery/entries/buttons.js.map +7 -0
  52. package/dist/modules/design_system/gallery/entries/charts.js +457 -0
  53. package/dist/modules/design_system/gallery/entries/charts.js.map +7 -0
  54. package/dist/modules/design_system/gallery/entries/dates.js +306 -0
  55. package/dist/modules/design_system/gallery/entries/dates.js.map +7 -0
  56. package/dist/modules/design_system/gallery/entries/detail.js +358 -0
  57. package/dist/modules/design_system/gallery/entries/detail.js.map +7 -0
  58. package/dist/modules/design_system/gallery/entries/display.js +785 -0
  59. package/dist/modules/design_system/gallery/entries/display.js.map +7 -0
  60. package/dist/modules/design_system/gallery/entries/feedback.js +658 -0
  61. package/dist/modules/design_system/gallery/entries/feedback.js.map +7 -0
  62. package/dist/modules/design_system/gallery/entries/filters.js +505 -0
  63. package/dist/modules/design_system/gallery/entries/filters.js.map +7 -0
  64. package/dist/modules/design_system/gallery/entries/foundations.js +453 -0
  65. package/dist/modules/design_system/gallery/entries/foundations.js.map +7 -0
  66. package/dist/modules/design_system/gallery/entries/icons.js +140 -0
  67. package/dist/modules/design_system/gallery/entries/icons.js.map +7 -0
  68. package/dist/modules/design_system/gallery/entries/inputs.js +1217 -0
  69. package/dist/modules/design_system/gallery/entries/inputs.js.map +7 -0
  70. package/dist/modules/design_system/gallery/entries/messages.js +334 -0
  71. package/dist/modules/design_system/gallery/entries/messages.js.map +7 -0
  72. package/dist/modules/design_system/gallery/entries/navigation.js +475 -0
  73. package/dist/modules/design_system/gallery/entries/navigation.js.map +7 -0
  74. package/dist/modules/design_system/gallery/entries/notifications.js +257 -0
  75. package/dist/modules/design_system/gallery/entries/notifications.js.map +7 -0
  76. package/dist/modules/design_system/gallery/entries/overlays.js +576 -0
  77. package/dist/modules/design_system/gallery/entries/overlays.js.map +7 -0
  78. package/dist/modules/design_system/gallery/entries/scaffolding.js +378 -0
  79. package/dist/modules/design_system/gallery/entries/scaffolding.js.map +7 -0
  80. package/dist/modules/design_system/gallery/entries/schedule.js +297 -0
  81. package/dist/modules/design_system/gallery/entries/schedule.js.map +7 -0
  82. package/dist/modules/design_system/gallery/registry.js +139 -0
  83. package/dist/modules/design_system/gallery/registry.js.map +7 -0
  84. package/dist/modules/design_system/gallery/types.js +1 -0
  85. package/dist/modules/design_system/gallery/types.js.map +7 -0
  86. package/dist/modules/design_system/index.js +9 -0
  87. package/dist/modules/design_system/index.js.map +7 -0
  88. package/dist/modules/design_system/setup.js +14 -0
  89. package/dist/modules/design_system/setup.js.map +7 -0
  90. package/dist/modules/inbox_ops/search.js +15 -4
  91. package/dist/modules/inbox_ops/search.js.map +2 -2
  92. package/dist/modules/integrations/api/[id]/credentials/route.js +11 -5
  93. package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
  94. package/dist/modules/integrations/api/[id]/health/route.js +6 -3
  95. package/dist/modules/integrations/api/[id]/health/route.js.map +2 -2
  96. package/dist/modules/integrations/api/[id]/route.js +6 -3
  97. package/dist/modules/integrations/api/[id]/route.js.map +2 -2
  98. package/dist/modules/integrations/api/[id]/state/route.js +6 -3
  99. package/dist/modules/integrations/api/[id]/state/route.js.map +2 -2
  100. package/dist/modules/integrations/api/[id]/version/route.js +6 -3
  101. package/dist/modules/integrations/api/[id]/version/route.js.map +2 -2
  102. package/dist/modules/integrations/api/logs/route.js +6 -3
  103. package/dist/modules/integrations/api/logs/route.js.map +2 -2
  104. package/dist/modules/integrations/api/route.js +6 -3
  105. package/dist/modules/integrations/api/route.js.map +2 -2
  106. package/dist/modules/integrations/api/umes-read.js +2 -2
  107. package/dist/modules/integrations/api/umes-read.js.map +2 -2
  108. package/dist/modules/integrations/lib/organization-scope.js +2 -9
  109. package/dist/modules/integrations/lib/organization-scope.js.map +2 -2
  110. package/dist/modules/messages/search.js +10 -5
  111. package/dist/modules/messages/search.js.map +2 -2
  112. package/dist/modules/query_index/data/entities.js +2 -1
  113. package/dist/modules/query_index/data/entities.js.map +2 -2
  114. package/dist/modules/query_index/lib/engine.js +32 -50
  115. package/dist/modules/query_index/lib/engine.js.map +2 -2
  116. package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js +17 -0
  117. package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js.map +7 -0
  118. package/generated/entities.ids.generated.ts +1 -0
  119. package/package.json +16 -16
  120. package/src/modules/auth/backend/settings/page.tsx +17 -8
  121. package/src/modules/customers/cli.ts +17 -7
  122. package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +24 -13
  123. package/src/modules/customers/i18n/de.json +17 -0
  124. package/src/modules/customers/i18n/en.json +17 -0
  125. package/src/modules/customers/i18n/es.json +17 -0
  126. package/src/modules/customers/i18n/pl.json +17 -0
  127. package/src/modules/customers/search.ts +59 -27
  128. package/src/modules/data_sync/AGENTS.md +1 -0
  129. package/src/modules/data_sync/api/mappings/[id]/route.ts +22 -9
  130. package/src/modules/data_sync/api/mappings/route.ts +13 -4
  131. package/src/modules/data_sync/api/options.ts +7 -2
  132. package/src/modules/data_sync/api/run.ts +7 -2
  133. package/src/modules/data_sync/api/runs/[id]/cancel.ts +8 -3
  134. package/src/modules/data_sync/api/runs/[id]/retry.ts +7 -2
  135. package/src/modules/data_sync/api/runs/[id]/route.ts +8 -3
  136. package/src/modules/data_sync/api/runs.ts +7 -2
  137. package/src/modules/data_sync/api/schedules/[id]/route.ts +19 -6
  138. package/src/modules/data_sync/api/schedules/route.ts +13 -4
  139. package/src/modules/data_sync/api/validate.ts +9 -4
  140. package/src/modules/design_system/AGENTS.md +34 -0
  141. package/src/modules/design_system/acl.ts +5 -0
  142. package/src/modules/design_system/backend/design-system/page.meta.ts +11 -0
  143. package/src/modules/design_system/backend/design-system/page.tsx +14 -0
  144. package/src/modules/design_system/gallery/components/CodeSnippet.tsx +55 -0
  145. package/src/modules/design_system/gallery/components/EntryCard.tsx +95 -0
  146. package/src/modules/design_system/gallery/components/GalleryShell.tsx +206 -0
  147. package/src/modules/design_system/gallery/components/VariantPreview.tsx +15 -0
  148. package/src/modules/design_system/gallery/entries/banners.tsx +226 -0
  149. package/src/modules/design_system/gallery/entries/buttons.tsx +422 -0
  150. package/src/modules/design_system/gallery/entries/charts.tsx +518 -0
  151. package/src/modules/design_system/gallery/entries/dates.tsx +325 -0
  152. package/src/modules/design_system/gallery/entries/detail.tsx +403 -0
  153. package/src/modules/design_system/gallery/entries/display.tsx +893 -0
  154. package/src/modules/design_system/gallery/entries/feedback.tsx +746 -0
  155. package/src/modules/design_system/gallery/entries/filters.tsx +570 -0
  156. package/src/modules/design_system/gallery/entries/foundations.tsx +529 -0
  157. package/src/modules/design_system/gallery/entries/icons.tsx +168 -0
  158. package/src/modules/design_system/gallery/entries/inputs.tsx +1516 -0
  159. package/src/modules/design_system/gallery/entries/messages.tsx +339 -0
  160. package/src/modules/design_system/gallery/entries/navigation.tsx +573 -0
  161. package/src/modules/design_system/gallery/entries/notifications.tsx +285 -0
  162. package/src/modules/design_system/gallery/entries/overlays.tsx +677 -0
  163. package/src/modules/design_system/gallery/entries/scaffolding.tsx +430 -0
  164. package/src/modules/design_system/gallery/entries/schedule.tsx +307 -0
  165. package/src/modules/design_system/gallery/registry.ts +152 -0
  166. package/src/modules/design_system/gallery/types.ts +32 -0
  167. package/src/modules/design_system/i18n/.hardcoded-allowlist.json +71 -0
  168. package/src/modules/design_system/i18n/de.json +46 -0
  169. package/src/modules/design_system/i18n/en.json +46 -0
  170. package/src/modules/design_system/i18n/es.json +46 -0
  171. package/src/modules/design_system/i18n/pl.json +46 -0
  172. package/src/modules/design_system/index.ts +7 -0
  173. package/src/modules/design_system/setup.ts +12 -0
  174. package/src/modules/inbox_ops/i18n/de.json +3 -0
  175. package/src/modules/inbox_ops/i18n/en.json +3 -0
  176. package/src/modules/inbox_ops/i18n/es.json +3 -0
  177. package/src/modules/inbox_ops/i18n/pl.json +3 -0
  178. package/src/modules/inbox_ops/search.ts +20 -4
  179. package/src/modules/integrations/api/[id]/credentials/route.ts +11 -5
  180. package/src/modules/integrations/api/[id]/health/route.ts +6 -3
  181. package/src/modules/integrations/api/[id]/route.ts +6 -3
  182. package/src/modules/integrations/api/[id]/state/route.ts +6 -3
  183. package/src/modules/integrations/api/[id]/version/route.ts +6 -3
  184. package/src/modules/integrations/api/logs/route.ts +6 -3
  185. package/src/modules/integrations/api/route.ts +6 -3
  186. package/src/modules/integrations/api/umes-read.ts +2 -2
  187. package/src/modules/integrations/lib/organization-scope.ts +5 -25
  188. package/src/modules/messages/i18n/de.json +2 -0
  189. package/src/modules/messages/i18n/en.json +2 -0
  190. package/src/modules/messages/i18n/es.json +2 -0
  191. package/src/modules/messages/i18n/pl.json +2 -0
  192. package/src/modules/messages/search.ts +11 -5
  193. package/src/modules/query_index/data/entities.ts +7 -0
  194. package/src/modules/query_index/lib/engine.ts +40 -63
  195. package/src/modules/query_index/migrations/.snapshot-open-mercato.json +12 -0
  196. package/src/modules/query_index/migrations/Migration20260731105052_query_index.ts +35 -0
@@ -202,6 +202,7 @@ function ScheduleActivityDialog({
202
202
  const initialSnapshotRef = React.useRef(null);
203
203
  const snapshotOpenKeyRef = React.useRef(null);
204
204
  const snapshotSettleCountRef = React.useRef(0);
205
+ const closeConfirmPendingRef = React.useRef(false);
205
206
  const openKey = open ? `${editData?.id ?? "new"}` : null;
206
207
  React.useEffect(() => {
207
208
  if (!open) {
@@ -225,21 +226,27 @@ function ScheduleActivityDialog({
225
226
  return initialSnapshotRef.current !== formSnapshot;
226
227
  }, [formSnapshot]);
227
228
  const guardedClose = React.useCallback(async () => {
229
+ if (closeConfirmPendingRef.current) return;
228
230
  if (!isDirty()) {
229
231
  onClose();
230
232
  return;
231
233
  }
232
- const ok = await confirm({
233
- title: t("customers.schedule.discardConfirm.title", "Discard unsaved changes?"),
234
- description: t(
235
- "customers.schedule.discardConfirm.description",
236
- "You have unsaved edits in this activity. Save them first or continue to discard them."
237
- ),
238
- confirmText: t("customers.schedule.discardConfirm.confirm", "Discard"),
239
- cancelText: t("customers.schedule.discardConfirm.cancel", "Keep editing"),
240
- variant: "destructive"
241
- });
242
- if (ok) onClose();
234
+ closeConfirmPendingRef.current = true;
235
+ try {
236
+ const ok = await confirm({
237
+ title: t("customers.schedule.discardConfirm.title", "Discard unsaved changes?"),
238
+ description: t(
239
+ "customers.schedule.discardConfirm.description",
240
+ "You have unsaved edits in this activity. Save them first or continue to discard them."
241
+ ),
242
+ confirmText: t("customers.schedule.discardConfirm.confirm", "Discard"),
243
+ cancelText: t("customers.schedule.discardConfirm.cancel", "Keep editing"),
244
+ variant: "destructive"
245
+ });
246
+ if (ok) onClose();
247
+ } finally {
248
+ closeConfirmPendingRef.current = false;
249
+ }
243
250
  }, [confirm, isDirty, onClose, t]);
244
251
  const mutationContextId = React.useMemo(
245
252
  () => `customer-activity:${entityType}:${entityId}`,
@@ -411,123 +418,152 @@ function ScheduleActivityDialog({
411
418
  }
412
419
  }, [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, state.startTime, t, taskPriority, state.title, translateErrorMessage, trimmedCallPhone, trimmedDate, trimmedStartTime, state.visibility, visibleFields]);
413
420
  const handleKeyDown = useDialogKeyHandler({ onConfirm: handleSave });
414
- return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: (o) => {
421
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (o) => {
415
422
  if (!o) void guardedClose();
416
- }, children: [
417
- ConfirmDialogElement,
418
- /* @__PURE__ */ jsxs(DialogContent, { 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", onKeyDown: handleKeyDown, "aria-describedby": void 0, children: [
419
- /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(DialogTitle, { children: isEditing ? t("customers.schedule.editTitle", "Edit activity") : t(chrome.titleKey, chrome.titleFallback) }) }),
420
- /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border bg-background px-6 py-5", children: [
421
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
422
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold leading-tight tracking-tight text-foreground", children: isEditing ? t("customers.schedule.editTitle", "Edit activity") : t(chrome.titleKey, chrome.titleFallback) }),
423
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t(chrome.subtitleKey, chrome.subtitleFallback) }),
424
- entityName ? /* @__PURE__ */ jsxs("p", { className: "mt-0.5 text-xs text-muted-foreground/80", children: [
425
- t("customers.schedule.context", "On timeline: {{name}}", { name: entityName }),
426
- companyName ? ` \xB7 ${companyName}` : ""
427
- ] }) : null
428
- ] }),
429
- /* @__PURE__ */ jsx(IconButton, { type: "button", variant: "ghost", size: "sm", onClick: () => {
430
- void guardedClose();
431
- }, className: "flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-background", "aria-label": t("customers.schedule.cancel", "Cancel"), children: /* @__PURE__ */ jsx(X, { className: "size-4 text-muted-foreground" }) })
432
- ] }),
433
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 bg-background p-6", children: [
434
- state.conflict && /* @__PURE__ */ jsxs(Alert, { variant: "warning", className: "rounded-lg", children: [
435
- /* @__PURE__ */ jsx(AlertTitle, { children: t("customers.schedule.conflict.title", "Calendar conflict") }),
436
- /* @__PURE__ */ jsx(AlertDescription, { children: state.conflict })
423
+ }, children: /* @__PURE__ */ jsxs(
424
+ DialogContent,
425
+ {
426
+ 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",
427
+ onKeyDown: handleKeyDown,
428
+ "aria-describedby": void 0,
429
+ children: [
430
+ ConfirmDialogElement,
431
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(DialogTitle, { children: isEditing ? t("customers.schedule.editTitle", "Edit activity") : t(chrome.titleKey, chrome.titleFallback) }) }),
432
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border bg-background px-6 py-5", children: [
433
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
434
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold leading-tight tracking-tight text-foreground", children: isEditing ? t("customers.schedule.editTitle", "Edit activity") : t(chrome.titleKey, chrome.titleFallback) }),
435
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t(chrome.subtitleKey, chrome.subtitleFallback) }),
436
+ entityName ? /* @__PURE__ */ jsxs("p", { className: "mt-0.5 text-xs text-muted-foreground/80", children: [
437
+ t("customers.schedule.context", "On timeline: {{name}}", { name: entityName }),
438
+ companyName ? ` \xB7 ${companyName}` : ""
439
+ ] }) : null
440
+ ] }),
441
+ /* @__PURE__ */ jsx(IconButton, { type: "button", variant: "ghost", size: "sm", onClick: () => {
442
+ void guardedClose();
443
+ }, className: "flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-background", "aria-label": t("customers.schedule.cancel", "Cancel"), children: /* @__PURE__ */ jsx(X, { className: "size-4 text-muted-foreground" }) })
437
444
  ] }),
438
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-2", children: TYPE_TABS.map(({ type, icon: Icon, labelKey, fallback }) => {
439
- const isActive = state.activityType === type;
440
- return /* @__PURE__ */ jsxs(
441
- "button",
442
- {
443
- type: "button",
444
- onClick: () => state.setActivityType(type),
445
- "aria-pressed": isActive,
446
- className: cn(
447
- "flex h-[80px] flex-col items-center justify-center gap-2 rounded-md border text-[14px] font-semibold transition-colors",
448
- isActive ? "border-transparent bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-foreground/40 hover:text-foreground"
449
- ),
450
- children: [
451
- /* @__PURE__ */ jsx(Icon, { className: "size-[18px]" }),
452
- t(labelKey, fallback)
453
- ]
454
- },
455
- type
456
- );
457
- }) }),
458
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
459
- /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold text-muted-foreground tracking-wider", children: getFieldLabel(state.activityType, "title", t, "customers.schedule.titleLabel", "Title") }),
445
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 bg-background p-6", children: [
446
+ state.conflict && /* @__PURE__ */ jsxs(Alert, { variant: "warning", className: "rounded-lg", children: [
447
+ /* @__PURE__ */ jsx(AlertTitle, { children: t("customers.schedule.conflict.title", "Calendar conflict") }),
448
+ /* @__PURE__ */ jsx(AlertDescription, { children: state.conflict })
449
+ ] }),
450
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-2", children: TYPE_TABS.map(({ type, icon: Icon, labelKey, fallback }) => {
451
+ const isActive = state.activityType === type;
452
+ return /* @__PURE__ */ jsxs(
453
+ "button",
454
+ {
455
+ type: "button",
456
+ onClick: () => state.setActivityType(type),
457
+ "aria-pressed": isActive,
458
+ className: cn(
459
+ "flex h-[80px] flex-col items-center justify-center gap-2 rounded-md border text-[14px] font-semibold transition-colors",
460
+ isActive ? "border-transparent bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-foreground/40 hover:text-foreground"
461
+ ),
462
+ children: [
463
+ /* @__PURE__ */ jsx(Icon, { className: "size-[18px]" }),
464
+ t(labelKey, fallback)
465
+ ]
466
+ },
467
+ type
468
+ );
469
+ }) }),
470
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
471
+ /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold text-muted-foreground tracking-wider", children: getFieldLabel(state.activityType, "title", t, "customers.schedule.titleLabel", "Title") }),
472
+ /* @__PURE__ */ jsx(
473
+ "input",
474
+ {
475
+ type: "text",
476
+ value: state.title,
477
+ onChange: (e) => state.setTitle(e.target.value),
478
+ placeholder: state.activityType === "email" ? t("customers.schedule.subjectPlaceholder", "Subject...") : t("customers.schedule.titlePlaceholder", "Activity title..."),
479
+ className: "w-full rounded-md border border-border bg-background px-3 py-2.5 text-sm text-foreground outline-none focus:border-foreground",
480
+ autoFocus: true
481
+ }
482
+ )
483
+ ] }),
460
484
  /* @__PURE__ */ jsx(
461
- "input",
485
+ DateTimeFields,
462
486
  {
463
- type: "text",
464
- value: state.title,
465
- onChange: (e) => state.setTitle(e.target.value),
466
- placeholder: state.activityType === "email" ? t("customers.schedule.subjectPlaceholder", "Subject...") : t("customers.schedule.titlePlaceholder", "Activity title..."),
467
- className: "w-full rounded-md border border-border bg-background px-3 py-2.5 text-sm text-foreground outline-none focus:border-foreground",
468
- autoFocus: true
487
+ visible: visibleFields,
488
+ activityType: state.activityType,
489
+ date: state.date,
490
+ setDate: state.setDate,
491
+ startTime: state.startTime,
492
+ setStartTime: state.setStartTime,
493
+ duration: state.duration,
494
+ setDuration: state.setDuration,
495
+ allDay: state.allDay,
496
+ setAllDay: state.setAllDay,
497
+ recurrenceEnabled: state.recurrenceEnabled,
498
+ setRecurrenceEnabled: state.setRecurrenceEnabled,
499
+ recurrenceDays: state.recurrenceDays,
500
+ toggleRecurrenceDay: state.toggleRecurrenceDay,
501
+ recurrenceEndType: state.recurrenceEndType,
502
+ setRecurrenceEndType: state.setRecurrenceEndType,
503
+ recurrenceCount: state.recurrenceCount,
504
+ setRecurrenceCount: state.setRecurrenceCount,
505
+ recurrenceEndDate: state.recurrenceEndDate,
506
+ setRecurrenceEndDate: state.setRecurrenceEndDate
469
507
  }
470
- )
471
- ] }),
472
- /* @__PURE__ */ jsx(
473
- DateTimeFields,
474
- {
475
- visible: visibleFields,
476
- activityType: state.activityType,
477
- date: state.date,
478
- setDate: state.setDate,
479
- startTime: state.startTime,
480
- setStartTime: state.setStartTime,
481
- duration: state.duration,
482
- setDuration: state.setDuration,
483
- allDay: state.allDay,
484
- setAllDay: state.setAllDay,
485
- recurrenceEnabled: state.recurrenceEnabled,
486
- setRecurrenceEnabled: state.setRecurrenceEnabled,
487
- recurrenceDays: state.recurrenceDays,
488
- toggleRecurrenceDay: state.toggleRecurrenceDay,
489
- recurrenceEndType: state.recurrenceEndType,
490
- setRecurrenceEndType: state.setRecurrenceEndType,
491
- recurrenceCount: state.recurrenceCount,
492
- setRecurrenceCount: state.setRecurrenceCount,
493
- recurrenceEndDate: state.recurrenceEndDate,
494
- setRecurrenceEndDate: state.setRecurrenceEndDate
495
- }
496
- ),
497
- state.activityType === "call" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
498
- /* @__PURE__ */ jsxs("div", { children: [
499
- /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.call.directionLabel", "Direction") }),
500
- /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: CALL_DIRECTIONS.map((opt) => {
501
- const isActive = callDirection === opt.key;
502
- return /* @__PURE__ */ jsxs(
503
- "button",
504
- {
505
- type: "button",
506
- "aria-pressed": isActive,
507
- onClick: () => setCallDirection(opt.key),
508
- className: cn(
509
- "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors",
510
- isActive ? "border-transparent bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-foreground/40"
511
- ),
512
- children: [
513
- /* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", opt.dot), "aria-hidden": true }),
514
- t(opt.labelKey, opt.labelFallback)
515
- ]
516
- },
517
- opt.key
518
- );
519
- }) })
508
+ ),
509
+ state.activityType === "call" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
510
+ /* @__PURE__ */ jsxs("div", { children: [
511
+ /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.call.directionLabel", "Direction") }),
512
+ /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: CALL_DIRECTIONS.map((opt) => {
513
+ const isActive = callDirection === opt.key;
514
+ return /* @__PURE__ */ jsxs(
515
+ "button",
516
+ {
517
+ type: "button",
518
+ "aria-pressed": isActive,
519
+ onClick: () => setCallDirection(opt.key),
520
+ className: cn(
521
+ "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors",
522
+ isActive ? "border-transparent bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-foreground/40"
523
+ ),
524
+ children: [
525
+ /* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", opt.dot), "aria-hidden": true }),
526
+ t(opt.labelKey, opt.labelFallback)
527
+ ]
528
+ },
529
+ opt.key
530
+ );
531
+ }) })
532
+ ] }),
533
+ /* @__PURE__ */ jsxs("div", { children: [
534
+ /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.call.outcomeLabel", "Outcome") }),
535
+ /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: CALL_OUTCOMES.map((opt) => {
536
+ const isActive = callOutcome === opt.key;
537
+ return /* @__PURE__ */ jsxs(
538
+ "button",
539
+ {
540
+ type: "button",
541
+ "aria-pressed": isActive,
542
+ onClick: () => setCallOutcome(isActive ? null : opt.key),
543
+ className: cn(
544
+ "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors",
545
+ isActive ? "border-transparent bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-foreground/40"
546
+ ),
547
+ children: [
548
+ /* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", opt.dot), "aria-hidden": true }),
549
+ t(opt.labelKey, opt.labelFallback)
550
+ ]
551
+ },
552
+ opt.key
553
+ );
554
+ }) })
555
+ ] })
520
556
  ] }),
521
- /* @__PURE__ */ jsxs("div", { children: [
522
- /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.call.outcomeLabel", "Outcome") }),
523
- /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: CALL_OUTCOMES.map((opt) => {
524
- const isActive = callOutcome === opt.key;
557
+ state.activityType === "task" && /* @__PURE__ */ jsxs("div", { children: [
558
+ /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.task.priorityLabel", "Priority") }),
559
+ /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: TASK_PRIORITIES.map((opt) => {
560
+ const isActive = taskPriority === opt.key;
525
561
  return /* @__PURE__ */ jsxs(
526
562
  "button",
527
563
  {
528
564
  type: "button",
529
565
  "aria-pressed": isActive,
530
- onClick: () => setCallOutcome(isActive ? null : opt.key),
566
+ onClick: () => setTaskPriority(opt.key),
531
567
  className: cn(
532
568
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors",
533
569
  isActive ? "border-transparent bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-foreground/40"
@@ -540,112 +576,89 @@ function ScheduleActivityDialog({
540
576
  opt.key
541
577
  );
542
578
  }) })
543
- ] })
544
- ] }),
545
- state.activityType === "task" && /* @__PURE__ */ jsxs("div", { children: [
546
- /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: t("customers.schedule.task.priorityLabel", "Priority") }),
547
- /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: TASK_PRIORITIES.map((opt) => {
548
- const isActive = taskPriority === opt.key;
549
- return /* @__PURE__ */ jsxs(
550
- "button",
579
+ ] }),
580
+ /* @__PURE__ */ jsx(
581
+ ParticipantsField,
582
+ {
583
+ visible: visibleFields,
584
+ activityType: state.activityType,
585
+ participants: state.participants,
586
+ setParticipants: state.setParticipants,
587
+ removeParticipant: state.removeParticipant,
588
+ guestPermissions: state.guestPermissions,
589
+ setGuestPermissions: state.setGuestPermissions
590
+ }
591
+ ),
592
+ state.activityType === "call" ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
593
+ /* @__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") }),
594
+ /* @__PURE__ */ jsx(
595
+ PhoneNumberField,
551
596
  {
552
- type: "button",
553
- "aria-pressed": isActive,
554
- onClick: () => setTaskPriority(opt.key),
555
- className: cn(
556
- "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm font-medium transition-colors",
557
- isActive ? "border-transparent bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-foreground/40"
558
- ),
559
- children: [
560
- /* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", opt.dot), "aria-hidden": true }),
561
- t(opt.labelKey, opt.labelFallback)
562
- ]
563
- },
564
- opt.key
565
- );
566
- }) })
567
- ] }),
568
- /* @__PURE__ */ jsx(
569
- ParticipantsField,
570
- {
571
- visible: visibleFields,
572
- activityType: state.activityType,
573
- participants: state.participants,
574
- setParticipants: state.setParticipants,
575
- removeParticipant: state.removeParticipant,
576
- guestPermissions: state.guestPermissions,
577
- setGuestPermissions: state.setGuestPermissions
578
- }
579
- ),
580
- state.activityType === "call" ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
581
- /* @__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") }),
597
+ id: "schedule-call-phone",
598
+ value: callPhoneNumber,
599
+ onValueChange: handleCallPhoneChange,
600
+ placeholder: t("customers.schedule.call.phonePlaceholder", "+1 555 000 0000"),
601
+ externalError: callPhoneError,
602
+ invalidLabel: callPhoneInvalidMessage,
603
+ minDigits: 7,
604
+ defaultCountryIso2
605
+ }
606
+ )
607
+ ] }) : /* @__PURE__ */ jsx(
608
+ LocationField,
609
+ {
610
+ visible: visibleFields,
611
+ activityType: state.activityType,
612
+ location: state.location,
613
+ setLocation: state.setLocation
614
+ }
615
+ ),
582
616
  /* @__PURE__ */ jsx(
583
- PhoneNumberField,
617
+ LinkedEntitiesField,
584
618
  {
585
- id: "schedule-call-phone",
586
- value: callPhoneNumber,
587
- onValueChange: handleCallPhoneChange,
588
- placeholder: t("customers.schedule.call.phonePlaceholder", "+1 555 000 0000"),
589
- externalError: callPhoneError,
590
- invalidLabel: callPhoneInvalidMessage,
591
- minDigits: 7,
592
- defaultCountryIso2
619
+ visible: visibleFields,
620
+ activityType: state.activityType,
621
+ linkedEntities: state.linkedEntities,
622
+ setLinkedEntities: state.setLinkedEntities
593
623
  }
594
- )
595
- ] }) : /* @__PURE__ */ jsx(
596
- LocationField,
597
- {
598
- visible: visibleFields,
599
- activityType: state.activityType,
600
- location: state.location,
601
- setLocation: state.setLocation
602
- }
603
- ),
604
- /* @__PURE__ */ jsx(
605
- LinkedEntitiesField,
606
- {
607
- visible: visibleFields,
608
- activityType: state.activityType,
609
- linkedEntities: state.linkedEntities,
610
- setLinkedEntities: state.setLinkedEntities
611
- }
612
- ),
613
- /* @__PURE__ */ jsxs("div", { children: [
614
- /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: getFieldLabel(state.activityType, "description", t, "customers.schedule.description", "Description") }),
615
- /* @__PURE__ */ jsx("div", { className: "mt-[8px]", children: /* @__PURE__ */ jsx(
616
- SwitchableMarkdownInput,
624
+ ),
625
+ /* @__PURE__ */ jsxs("div", { children: [
626
+ /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold uppercase text-muted-foreground tracking-wider", children: getFieldLabel(state.activityType, "description", t, "customers.schedule.description", "Description") }),
627
+ /* @__PURE__ */ jsx("div", { className: "mt-[8px]", children: /* @__PURE__ */ jsx(
628
+ SwitchableMarkdownInput,
629
+ {
630
+ value: state.description,
631
+ onChange: state.setDescription,
632
+ isMarkdownEnabled: state.markdownEnabled,
633
+ height: 120,
634
+ placeholder: t("customers.schedule.descriptionPlaceholder", "Add details...")
635
+ }
636
+ ) })
637
+ ] }),
638
+ /* @__PURE__ */ jsx(
639
+ FooterFields,
617
640
  {
618
- value: state.description,
619
- onChange: state.setDescription,
620
- isMarkdownEnabled: state.markdownEnabled,
621
- height: 120,
622
- placeholder: t("customers.schedule.descriptionPlaceholder", "Add details...")
641
+ visible: visibleFields,
642
+ activityType: state.activityType,
643
+ reminderMinutes: state.reminderMinutes,
644
+ setReminderMinutes: state.setReminderMinutes,
645
+ visibility: state.visibility,
646
+ setVisibility: state.setVisibility
623
647
  }
624
- ) })
625
- ] }),
626
- /* @__PURE__ */ jsx(
627
- FooterFields,
628
- {
629
- visible: visibleFields,
630
- activityType: state.activityType,
631
- reminderMinutes: state.reminderMinutes,
632
- setReminderMinutes: state.setReminderMinutes,
633
- visibility: state.visibility,
634
- setVisibility: state.setVisibility
635
- }
636
- )
637
- ] }) }),
638
- /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center justify-end gap-2.5 border-t border-border bg-muted/50 px-6 py-4", children: [
639
- /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => {
640
- void guardedClose();
641
- }, className: "rounded-md border border-input bg-background px-5 py-3 text-sm font-semibold text-foreground", children: t("customers.schedule.cancel", "Cancel") }),
642
- /* @__PURE__ */ jsxs(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", children: [
643
- /* @__PURE__ */ jsx(SaveIcon, { className: "size-3.5" }),
644
- state.saving ? t("customers.schedule.saving", "Saving...") : isEditing ? t("customers.schedule.update", "Update activity") : t(chrome.saveKey, chrome.saveFallback)
648
+ )
649
+ ] }) }),
650
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center justify-end gap-2.5 border-t border-border bg-muted/50 px-6 py-4", children: [
651
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => {
652
+ void guardedClose();
653
+ }, className: "rounded-md border border-input bg-background px-5 py-3 text-sm font-semibold text-foreground", children: t("customers.schedule.cancel", "Cancel") }),
654
+ /* @__PURE__ */ jsxs(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", children: [
655
+ /* @__PURE__ */ jsx(SaveIcon, { className: "size-3.5" }),
656
+ state.saving ? t("customers.schedule.saving", "Saving...") : isEditing ? t("customers.schedule.update", "Update activity") : t(chrome.saveKey, chrome.saveFallback)
657
+ ] })
645
658
  ] })
646
- ] })
647
- ] })
648
- ] });
659
+ ]
660
+ }
661
+ ) });
649
662
  }
650
663
  function buildRecurrenceRule(days, endType, count, endDate) {
651
664
  const dayNames = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];