@alfadocs/ui-kit 1.43.0 → 1.44.0

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 (105) hide show
  1. package/dist/_chunks/{calendar-ChJQzRw-.js → calendar-U6N0F99w.js} +383 -359
  2. package/dist/_chunks/calendar-workspace-DBYAtdyd.js +12161 -0
  3. package/dist/_chunks/{face-scheme-Dg6ZyLKb.js → face-scheme-Bm6pe7R8.js} +265 -275
  4. package/dist/_chunks/help-me-write-templates-GUeEn3Ff.js +741 -0
  5. package/dist/_chunks/{notes-panel-CRAovkjx.js → notes-panel-CY4KmDo-.js} +159 -152
  6. package/dist/_chunks/{panel-subview-PMBRPFOa.js → panel-subview-CYnuX-KR.js} +61 -40
  7. package/dist/_chunks/rich-text-editor-BYE6kK4u.js +3839 -0
  8. package/dist/_chunks/undo-2-CYNAzclj.js +26 -0
  9. package/dist/_chunks/variables-menu-vXUaSBj4.js +401 -0
  10. package/dist/agent-catalog.json +84 -3
  11. package/dist/agent-i18n/en.json +14 -3
  12. package/dist/components/calendar/calendar.d.ts +6 -0
  13. package/dist/components/calendar/index.js +1 -1
  14. package/dist/components/face-scheme/index.js +1 -1
  15. package/dist/components/index.d.ts +1 -0
  16. package/dist/components/notes-panel/index.js +1 -1
  17. package/dist/components/notes-panel/notes-panel.d.ts +4 -0
  18. package/dist/components/panel-subview/index.js +1 -1
  19. package/dist/components/panel-subview/panel-subview.d.ts +6 -0
  20. package/dist/components/rich-text-editor/editor-toolbar.d.ts +35 -3
  21. package/dist/components/rich-text-editor/index.d.ts +1 -1
  22. package/dist/components/rich-text-editor/index.js +1 -1
  23. package/dist/components/rich-text-editor/rich-text-editor.d.ts +98 -15
  24. package/dist/components/variables-menu/index.d.ts +4 -0
  25. package/dist/components/variables-menu/index.js +6 -0
  26. package/dist/components/variables-menu/variables-menu.agent.d.ts +10 -0
  27. package/dist/components/variables-menu/variables-menu.d.ts +53 -0
  28. package/dist/host-compat.css +5 -5
  29. package/dist/i18n/locales/ar.d.ts +77 -6
  30. package/dist/i18n/locales/ar.js +78 -7
  31. package/dist/i18n/locales/de.d.ts +77 -6
  32. package/dist/i18n/locales/de.js +78 -7
  33. package/dist/i18n/locales/el.d.ts +77 -6
  34. package/dist/i18n/locales/el.js +78 -7
  35. package/dist/i18n/locales/en.d.ts +77 -6
  36. package/dist/i18n/locales/en.js +85 -7
  37. package/dist/i18n/locales/es.d.ts +77 -6
  38. package/dist/i18n/locales/es.js +78 -7
  39. package/dist/i18n/locales/fr.d.ts +77 -6
  40. package/dist/i18n/locales/fr.js +78 -7
  41. package/dist/i18n/locales/hi.d.ts +77 -6
  42. package/dist/i18n/locales/hi.js +78 -7
  43. package/dist/i18n/locales/it.d.ts +77 -6
  44. package/dist/i18n/locales/it.js +78 -7
  45. package/dist/i18n/locales/ja.d.ts +77 -6
  46. package/dist/i18n/locales/ja.js +78 -7
  47. package/dist/i18n/locales/nl.d.ts +77 -6
  48. package/dist/i18n/locales/nl.js +78 -7
  49. package/dist/i18n/locales/pl.d.ts +77 -6
  50. package/dist/i18n/locales/pl.js +78 -7
  51. package/dist/i18n/locales/pt.d.ts +77 -6
  52. package/dist/i18n/locales/pt.js +78 -7
  53. package/dist/i18n/locales/ro.d.ts +77 -6
  54. package/dist/i18n/locales/ro.js +78 -7
  55. package/dist/i18n/locales/ru.d.ts +77 -6
  56. package/dist/i18n/locales/ru.js +78 -7
  57. package/dist/i18n/locales/sq.d.ts +77 -6
  58. package/dist/i18n/locales/sq.js +78 -7
  59. package/dist/i18n/locales/sv.d.ts +77 -6
  60. package/dist/i18n/locales/sv.js +78 -7
  61. package/dist/i18n/locales/tr.d.ts +77 -6
  62. package/dist/i18n/locales/tr.js +78 -7
  63. package/dist/i18n/locales/zh.d.ts +77 -6
  64. package/dist/i18n/locales/zh.js +78 -7
  65. package/dist/index.js +916 -913
  66. package/dist/locales/ar.json +78 -7
  67. package/dist/locales/de.json +78 -7
  68. package/dist/locales/el.json +78 -7
  69. package/dist/locales/en.json +78 -7
  70. package/dist/locales/es.json +78 -7
  71. package/dist/locales/fr.json +78 -7
  72. package/dist/locales/hi.json +78 -7
  73. package/dist/locales/it.json +78 -7
  74. package/dist/locales/ja.json +78 -7
  75. package/dist/locales/nl.json +78 -7
  76. package/dist/locales/pl.json +78 -7
  77. package/dist/locales/pt.json +78 -7
  78. package/dist/locales/ro.json +78 -7
  79. package/dist/locales/ru.json +78 -7
  80. package/dist/locales/sq.json +78 -7
  81. package/dist/locales/sv.json +78 -7
  82. package/dist/locales/tr.json +78 -7
  83. package/dist/locales/zh.json +78 -7
  84. package/dist/patterns/calendar/calendar-bookings-panel.d.ts +8 -3
  85. package/dist/patterns/calendar/calendar-care-rules.d.ts +49 -0
  86. package/dist/patterns/calendar/calendar-task-editor.d.ts +31 -0
  87. package/dist/patterns/calendar/calendar-workspace.d.ts +8 -1
  88. package/dist/patterns/calendar/calendar-workspace.model.d.ts +39 -12
  89. package/dist/patterns/calendar/calendar.data.d.ts +9 -0
  90. package/dist/patterns/calendar/calendar.journey.d.ts +35 -3
  91. package/dist/patterns/calendar/calendar.model.d.ts +23 -1
  92. package/dist/patterns/calendar/calendar.sheets.d.ts +21 -3
  93. package/dist/patterns/calendar/calendar.surface.d.ts +6 -1
  94. package/dist/patterns/calendar/calendar.types.d.ts +32 -1
  95. package/dist/patterns/calendar/index.js +1 -1
  96. package/dist/patterns/help-me-write-templates/help-me-write-templates.d.ts +58 -26
  97. package/dist/patterns/help-me-write-templates/index.d.ts +1 -1
  98. package/dist/patterns/help-me-write-templates/index.js +1 -1
  99. package/dist/tokens.css +6 -6
  100. package/package.json +5 -1
  101. package/dist/_chunks/calendar-workspace-DhXqqu-D.js +0 -11392
  102. package/dist/_chunks/help-me-write-templates-B-m7zgJa.js +0 -775
  103. package/dist/_chunks/highlighter-DSkckT2Q.js +0 -15
  104. package/dist/_chunks/rich-text-editor-DUMeifwc.js +0 -3176
  105. package/dist/_chunks/wand-sparkles-DAjKyhz7.js +0 -27
@@ -344,28 +344,38 @@ unresolvedPatientLabel: string,
344
344
  * fetching (`detailsPending`). Such a row carries no patient id and
345
345
  * no title, so without it the feed would print a nameless line. */
346
346
  pendingDetailsLabel?: string): AppointmentItem;
347
- /** How far back the platform's booking query looks, on `createdAt`. */
348
- export declare const ONLINE_BOOKINGS_WINDOW_DAYS = 30;
349
347
  /**
350
- * Bookings still to check: created online (or through the API) within
351
- * the last 30 days, not cancelled, and still missing a patient OR an
352
- * operator. Mirrors the repository query behind the platform's alert
353
- * strip; Increment 1 renders the same count on a toolbar button.
348
+ * True when a row still needs completing before it is a real, workable
349
+ * appointment: no patient record, no operator, or — only where the
350
+ * practice actually has chairs — no chair. Tasks never qualify (the
351
+ * caller already drops them from `rows`, but a defensive check costs
352
+ * nothing). Origin (online vs. desk-created) is irrelevant: a gap is a
353
+ * gap regardless of how the appointment was created.
354
+ */
355
+ export declare function appointmentNeedsCompletion(row: CalendarRow, data: CalendarData): boolean;
356
+ /**
357
+ * The backlog queue: every row in `rows` that still needs a patient, an
358
+ * operator or a chair. Mirrors the platform's alert-strip query in
359
+ * spirit, but is no longer scoped to online bookings or to a 30-day
360
+ * window — the caller already hands in only the rows in the loaded
361
+ * range, and a desk-created gap is exactly as real as an online one.
354
362
  */
355
363
  export declare function onlineBookingsToCheck(rows: readonly CalendarRow[], data: CalendarData): CalendarRow[];
356
364
  /**
357
- * One row of the platform's "Prenotazioni online" page, which Increment 1
358
- * hosts in the rail instead of sending the user to a separate page.
359
- * Columns mirror it: when it was booked, what was asked for, whether it
360
- * was paid online, and what is still missing before it is a real
361
- * appointment.
365
+ * One row of the backlog queue (formerly the platform's "Prenotazioni
366
+ * online" page, which Increment 1 hosts in the rail instead of sending
367
+ * the user to a separate page). Columns mirror it: when it was booked
368
+ * (a desk-created slot carries no `bookedAt` and groups under its own
369
+ * appointment date instead), what was asked for, whether it was paid
370
+ * online, and what is still missing before it is a real appointment.
362
371
  */
363
372
  export interface BookingRowView {
364
373
  row: CalendarRow;
365
374
  eventId: string;
366
375
  /** The appointment's own start. */
367
376
  start: Date;
368
- /** Platform `createdAt` — "del <date>" under the appointment date. */
377
+ /** Platform `createdAt` — "del <date>" under the appointment date.
378
+ * Null for a desk-created slot, which has no booking record. */
369
379
  bookedAt: Date | null;
370
380
  /** The booking reason, or the platform's "Non specificato". */
371
381
  reason: string | null;
@@ -374,10 +384,27 @@ export interface BookingRowView {
374
384
  paidOnline: number | null;
375
385
  needsPatient: boolean;
376
386
  needsOperator: boolean;
387
+ /** True only where the practice has chairs at all — see
388
+ * `appointmentNeedsCompletion`. */
389
+ needsChair: boolean;
390
+ /** Badge fact, not a filter: origin no longer decides membership, but
391
+ * the card still says where the appointment came from. */
392
+ bookedOnline: boolean;
377
393
  /** Booked after the user last opened the page — the "(Nuovo)" marker. */
378
394
  isNew: boolean;
379
395
  }
380
396
  export declare function bookingRowView(row: CalendarRow, data: CalendarData, lastSeenMs?: number | null, createdAtIso?: string): BookingRowView;
397
+ /** The three completion gaps a backlog card can show, in filter order.
398
+ * Chair is only ever offered when the practice has chair resources. */
399
+ export type BacklogGap = 'patient' | 'operator' | 'chair';
400
+ /** All three switches on by default — the uncontrolled starting point
401
+ * for a host that does not persist the filter state itself. */
402
+ export declare const DEFAULT_BACKLOG_FILTERS: Readonly<Record<BacklogGap, boolean>>;
403
+ /** Applies the header's three switches to an already-built view list. A
404
+ * view is kept when it carries at least one gap left switched on — an
405
+ * appointment missing only a patient still shows with "Senza operatore"
406
+ * and "Senza poltrona" off, since it still needs a patient. */
407
+ export declare function filterBacklogViews(views: readonly BookingRowView[], filters: Readonly<Record<BacklogGap, boolean>>): BookingRowView[];
381
408
  /** The nine advanced inputs, all optional. Empty = the input is unset;
382
409
  * `operatorId` also accepts `NONE`, the platform's "no operator". */
383
410
  export interface WaitingListFilters {
@@ -95,6 +95,15 @@ export interface CalendarData {
95
95
  * through `carePlanById` / `openCarePlansForPatient`. */
96
96
  carePlans?: readonly CalendarCarePlan[];
97
97
  patients: readonly CalendarPatient[];
98
+ /** Companies a task may be "about" (platform `doctorCompany`). Omit it
99
+ * and the task editor's "Riguarda" choice offers only Nobody / Patient
100
+ * — a free-text company name is not an id and the platform would
101
+ * reject or mis-link it, so the Company segment is withheld rather
102
+ * than rendered over nothing to type an id into. */
103
+ companies?: ReadonlyArray<{
104
+ id: string;
105
+ name: string;
106
+ }>;
98
107
  /** Optional host typeahead. Omit for client filtering of `patients`.
99
108
  * The picker debounces nonblank queries, aborts superseded requests and
100
109
  * keeps the host's result order, including matches by phone or number.
@@ -16,7 +16,7 @@ import type { NotesPanelNote, NotesPanelProps, NotesPanelSubmission, AiConsentGa
16
16
  import type { PatientNotesSeam } from './calendar.sheets';
17
17
  import type { AvailabilityContext, BacklogFilter, BacklogItem, CalendarFreeSlot, CalendarRow, DisplaySettings, DraftSlot, EditorDraft, EditorPrefill, FindSlotsSeed, HistoryInput, RailFocus, SlotPatch, WaitingEntryDraft } from './calendar.model';
18
18
  import type { DeleteOptions, EditorDraftExtras, RecurringScope } from './calendar-workspace.model';
19
- import type { CalendarHistoryEntry, CalendarSignChannel, CalendarWaitingEntry } from './calendar.types';
19
+ import type { CalendarHistoryEntry, CalendarSignChannel, CalendarTask, CalendarWaitingEntry, TaskDraft } from './calendar.types';
20
20
  /** The host's notes read for one patient (N-C3); `writable` follows the
21
21
  * notes, not the appointment-edit right. */
22
22
  export type PatientNotesLoad = {
@@ -134,6 +134,38 @@ export interface CalendarJourney {
134
134
  * user-facing Error message to keep the editor open with its draft.
135
135
  * `extras` arrive untouched unless the kit expands a demo series row. */
136
136
  handleCreateAppointment: (draft: EditorDraft, extras?: EditorDraftExtras) => void | Promise<void>;
137
+ /**
138
+ * Task seams — mirroring the platform's DoctorReminder routes
139
+ * (`ic_dcp_task_create` / `ic_dcp_task_edit` / a `done` toggle / delete).
140
+ * Every seam here is OPTIONAL and each is independent: absent, the
141
+ * corresponding action is withheld from the task editor (kit convention
142
+ * — withheld, not disabled). A host with no task backend at all simply
143
+ * omits every one of them and the "New task" toolbar member opens a
144
+ * form nothing can save.
145
+ */
146
+ /**
147
+ * ONE promise contract across every task seam: reject with a
148
+ * user-facing Error to keep the editor open with its draft (and, for
149
+ * delete/done, to roll the confirm dialog / the Switch back rather than
150
+ * leave the form locked on a write that never landed); resolve and the
151
+ * editor treats the write as accepted. `handleCreateTask` alone must
152
+ * resolve WITH the saved record — the host assigns the new id, and
153
+ * nothing else can tell the editor what it is. The others resolve with
154
+ * nothing: an update or a delete names its subject by the id already in
155
+ * hand, so there is nothing new to report back.
156
+ */
157
+ handleCreateTask?: (draft: TaskDraft) => Promise<CalendarTask>;
158
+ /** Full re-send, not a patch — mirrors `handleCreateAppointment`. */
159
+ handleUpdateTask?: (id: string, draft: TaskDraft) => Promise<void>;
160
+ handleDeleteTask?: (id: string) => Promise<void>;
161
+ /** The task editor's Done switch — a dedicated seam rather than routing
162
+ * through `handleUpdateTask` so a host whose `done` toggle is a
163
+ * separate lightweight endpoint (the platform's is) can wire it
164
+ * directly instead of resending the whole record. */
165
+ handleSetTaskDone?: (id: string, done: boolean) => Promise<void>;
166
+ /** Loads one task for the editor's edit mode — the same hydration
167
+ * seam shape as `loadAppointmentEditor` (`CalendarEditorHydration`). */
168
+ loadTask?: (id: string) => Promise<CalendarTask>;
137
169
  /**
138
170
  * Commit a new note on the patient's record. The HOST builds the
139
171
  * stored note — its id, its timestamp and its AUTHOR, who is the
@@ -172,12 +204,12 @@ export interface CalendarJourney {
172
204
  /**
173
205
  * The notes composer's template-variable, Help-me-write and image-upload
174
206
  * seams for one patient, read as the details panel opens them — one hook
175
- * instead of six props, mirroring `noteAiConsentFor`. Omit any key (or the
207
+ * instead of a prop each, mirroring `noteAiConsentFor`. Omit any key (or the
176
208
  * whole hook) and that affordance is not offered: the kit ships no
177
209
  * variables, no bring-your-own Help-me-write surface and no image upload
178
210
  * of its own. Typically backed by the host's own `useHelpMeWriteTemplates`
179
211
  * call, built once per patient and passed straight through.
180
212
  */
181
- noteComposerExtrasFor?: (patientId: string) => Partial<Pick<PatientNotesSeam, 'variables' | 'validateVariable' | 'onVariableValidityChange' | 'renderHelpMeWrite' | 'onUploadImage' | 'onAiCreditsExhausted' | 'composerBefore' | 'composerAfter'>> | undefined;
213
+ noteComposerExtrasFor?: (patientId: string) => Partial<Pick<PatientNotesSeam, 'variables' | 'validateVariable' | 'onVariableValidityChange' | 'renderHelpMeWrite' | 'aiTemplates' | 'onAiApplied' | 'onUploadImage' | 'onAiCreditsExhausted' | 'composerBefore' | 'composerAfter'>> | undefined;
182
214
  }
183
215
  //# sourceMappingURL=calendar.journey.d.ts.map
@@ -149,7 +149,7 @@ export interface CalendarEditorCapabilities {
149
149
  editStatus?: boolean;
150
150
  }
151
151
  /** The editor field an arrival lands focus on. */
152
- export type EditorInitialFocus = 'patient' | 'operator';
152
+ export type EditorInitialFocus = 'patient' | 'operator' | 'chair';
153
153
  export interface EditorPrefill {
154
154
  /** Set = the editor EDITS this existing event; unset = create. */
155
155
  editEventId?: string;
@@ -189,6 +189,12 @@ export interface EditorPrefill {
189
189
  * assign intent). A hint, never saved: an absent or disabled field, or
190
190
  * no value, moves no focus. */
191
191
  initialFocus?: EditorInitialFocus;
192
+ /** A pure ROUTING flag, not a presentational one: this kit has no
193
+ * task-editor panel of its own, so nothing currently sets it and the
194
+ * appointment editor does not read it. Reserved for the task-editor
195
+ * PR (stacked on the calendar toolbar work) to route a future
196
+ * "Nuova attività" hand-off to its own panel instead of this one. */
197
+ isTask?: boolean;
192
198
  }
193
199
  /** Platform's six `recurrence_frequency` values, in its dropdown order. */
194
200
  export type RecurrenceFrequency = 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'semiannual' | 'yearly';
@@ -745,6 +751,22 @@ export interface CalendarFreeBand extends AvailabilityRange {
745
751
  }
746
752
  /** Union free time per local day while retaining the original booking choices. */
747
753
  export declare function buildFreeBands(slots: readonly CalendarFreeSlot[]): CalendarFreeBand[];
754
+ export interface AvailabilitySlotCell extends AvailabilityRange {
755
+ /** Distinct chair x operator combinations sharing this exact
756
+ * start + duration (+ resource column, on a resource axis). */
757
+ optionCount: number;
758
+ }
759
+ /**
760
+ * One cell per DISTINCT start + duration, not a merged band: the grid
761
+ * projection ("Show in calendar") highlights individual bookable slots
762
+ * rather than one filled range spanning everything free. On `'none'` the
763
+ * key is the slot's own start + duration, deduped across every chair x
764
+ * operator pair; on a resource axis the key also carries the resource, so
765
+ * two touching slots in the same column stay two cells, never merged into
766
+ * one (unlike `mergeAvailabilityRanges`). `buildFreeBands` is untouched —
767
+ * the finder's own list still unions by day, this is grid painting only.
768
+ */
769
+ export declare function buildFreeSlotCells(slots: readonly CalendarFreeSlot[], axisKind: 'none' | 'chair' | 'operator'): AvailabilitySlotCell[];
748
770
  /**
749
771
  * The in-memory free-slot search over the loaded rows: closed dates and
750
772
  * holidays yield nothing, an operator away that day drops out of it, an
@@ -29,7 +29,7 @@ import { type NotesPanelNote, type NotesPanelProps, type NotesPanelSubmission, t
29
29
  import { type ColorAssociation, type CalendarCarePlan, type CalendarAnamnesisAnswer, type CalendarOperatorGroup, type CalendarPatient, type CalendarWaitingEntry, type CalendarHistoryEntry, type CalendarSignChannel, type PatientRef } from './calendar.types';
30
30
  import { type CalendarData } from './calendar.data';
31
31
  import { type CalendarRow, type DisplaySettings, type EditorPrefill, type EditorDraft, type DraftSlot, type SlotPatch, type BacklogFilter, type BacklogItem, type WaitingEntryDraft, type CalendarFreeSlot, type PrintDaySection, type FindSlotsSeed, type AvailabilityContext } from './calendar.model';
32
- import { type EditorDraftExtras, type DeleteOptions } from './calendar-workspace.model';
32
+ import { type BacklogGap, type EditorDraftExtras, type DeleteOptions, type WorkspaceDisplaySettings } from './calendar-workspace.model';
33
33
  import { type BookingCompleteIntent } from './calendar-bookings-panel';
34
34
  /** The operators a NEW booking may take — the practice's ACTIVE cast, as
35
35
  * on the platform. A disabled operator reaches a list only through
@@ -92,6 +92,10 @@ export interface PatientNotesSeam {
92
92
  /** Bring your own Help-me-write surface (e.g. practice templates). See
93
93
  * `RichTextEditor`. */
94
94
  renderHelpMeWrite?: NotesPanelProps['renderHelpMeWrite'];
95
+ /** Practice templates in the composer's AI pill. See `RichTextEditor`. */
96
+ aiTemplates?: NotesPanelProps['aiTemplates'];
97
+ /** After a pill action rewrote the draft. See `RichTextEditor`. */
98
+ onAiApplied?: NotesPanelProps['onAiApplied'];
95
99
  /** Upload an image yourself and resolve its URL. See `RichTextEditor`. */
96
100
  onUploadImage?: NotesPanelProps['onUploadImage'];
97
101
  /** An AI call ran out of credits. See `RichTextEditor`. */
@@ -385,7 +389,7 @@ export declare function BacklogPanel({ items, locale, seed, signRequests, onProc
385
389
  * mode (create / move banner) instead of opening the editor at once. */
386
390
  onPlaceWaiting?: (entry: CalendarWaitingEntry) => void;
387
391
  }): import("react/jsx-runtime").JSX.Element;
388
- export declare function BookingsPanel({ bookings, locale, privacy, status, lastSeenIso, createdAtById, currentBookingId, currentBookingKey, onRetry, onShowInCalendar, onComplete, }: {
392
+ export declare function BookingsPanel({ bookings, locale, privacy, status, lastSeenIso, createdAtById, currentBookingId, currentBookingKey, onRetry, onShowInCalendar, onComplete, resourceKind, filters, onFiltersChange, }: {
389
393
  bookings: readonly CalendarRow[];
390
394
  locale?: string;
391
395
  /** Masks the patient names, in step with the grid. */
@@ -405,6 +409,16 @@ export declare function BookingsPanel({ bookings, locale, privacy, status, lastS
405
409
  /** Opens the editor to complete it (platform "Completa appuntamento").
406
410
  * `intent` says which assign segment was pressed; the pencil sends none. */
407
411
  onComplete?: (row: CalendarRow, intent?: BookingCompleteIntent) => void;
412
+ /** The grid's column axis — chair-columns hide a chairless row, so the
413
+ * panel says so once when that is the current view. */
414
+ resourceKind?: WorkspaceDisplaySettings['resourceKind'];
415
+ /** The header's three switches. `bookings` already arrives filtered by
416
+ * the host (`CalendarWorkspace` applies `filterBacklogViews` before
417
+ * this panel ever sees the rows); these two only drive the controls
418
+ * themselves and are optional so a host bypassing the workspace still
419
+ * gets an unfiltered list rather than a crash. */
420
+ filters?: Readonly<Record<BacklogGap, boolean>>;
421
+ onFiltersChange?: (filters: Readonly<Record<BacklogGap, boolean>>) => void;
408
422
  }): import("react/jsx-runtime").JSX.Element;
409
423
  /**
410
424
  * The platform's waiting-list AddModal as a rail sub-view — same field
@@ -428,12 +442,16 @@ export declare function WaitingListEntryForm({ entry, onSave, onCancel, chrome,
428
442
  * The same entry form as a `PanelSubview`: it slides over the queue it was
429
443
  * opened from, pins Cancel and Save, and hands focus back to the opener.
430
444
  */
431
- export declare function WaitingListEntrySubview({ open, entry, onSave, onCancel, readOnly, }: {
445
+ export declare function WaitingListEntrySubview({ open, entry, onSave, onCancel, onRemove, readOnly, }: {
432
446
  open: boolean;
433
447
  /** Set = edit this entry; unset = add a new one. */
434
448
  entry?: CalendarWaitingEntry;
435
449
  onSave: (draft: WaitingEntryDraft) => void;
436
450
  onCancel: () => void;
451
+ /** Edit mode only: the panel's EXISTING remove seam (the card's ⋮ menu
452
+ * `onRemove`) — reused here rather than a second one. Unset or no
453
+ * `entry` (add mode) and the footer's leading slot is not rendered. */
454
+ onRemove?: (entry: CalendarWaitingEntry) => void;
437
455
  readOnly?: boolean;
438
456
  }): import("react/jsx-runtime").JSX.Element;
439
457
  /**
@@ -2,7 +2,7 @@ import { type CalendarPreferenceAdapter } from './calendar.preferences';
2
2
  import { type CalendarRow, type RailFocus, type EditorPrefill, type HistoryInput, type AvailabilityContext, type CalendarFreeSlot } from './calendar.model';
3
3
  import { type WorkspaceDisplaySettings, type CreateModeRequest, type PlacementRequest, type SaveNotice, type CalendarWorkspaceToolId } from './calendar-workspace.model';
4
4
  import type { CalendarOccurrenceMove } from './calendar.journey';
5
- export declare function CalendarSurface({ rows, setRows, onFocus, locale, onComposeNew, onOpenWaitingList, onAddWaitingEntry, onOpenOnlineBookings, onlineBookingsCount, waitingBadgeCount, onVisibleRangeChange, selectedEventId, gotoRequest, onBookSlot, onBookSlotFromFinder, display, setDisplay, onHistory, readOnly, reviewOnlyEventIds, detailsOnEveryClick, placement, onPlacementEnd, createMode, onCreateModeEnd, focusScroll, saveNotice, privacy, onPrivacyChange, availability, availabilityContext, availableTools, schedulerLicenseKey, id, preferences, onMoveOccurrence, }: {
5
+ export declare function CalendarSurface({ rows, setRows, onFocus, locale, onComposeNew, onComposeTask, onOpenWaitingList, onAddWaitingEntry, onOpenOnlineBookings, onlineBookingsCount, waitingBadgeCount, onVisibleRangeChange, selectedEventId, gotoRequest, onBookSlot, onBookSlotFromFinder, display, setDisplay, onHistory, readOnly, reviewOnlyEventIds, detailsOnEveryClick, placement, onPlacementEnd, createMode, onCreateModeEnd, focusScroll, saveNotice, privacy, onPrivacyChange, availability, availabilityContext, availableTools, schedulerLicenseKey, id, preferences, onMoveOccurrence, }: {
6
6
  rows: CalendarRow[];
7
7
  setRows: React.Dispatch<React.SetStateAction<CalendarRow[]>>;
8
8
  onFocus: (focus: RailFocus) => void;
@@ -43,6 +43,11 @@ export declare function CalendarSurface({ rows, setRows, onFocus, locale, onComp
43
43
  saveNotice?: SaveNotice | null;
44
44
  /** New appointment — seeds a clean editor (the host docks the panel). */
45
45
  onComposeNew: () => void;
46
+ /** New task — the create group's second member. Omit it (the host has
47
+ * no `handleCreateTask`) and the button is withheld entirely, leaving
48
+ * a single "New appointment" button; this surface does not decide
49
+ * what the click opens, only whether to offer it. */
50
+ onComposeTask?: () => void;
46
51
  /** The split button's main segment — the waiting-list panel. */
47
52
  onOpenWaitingList: () => void;
48
53
  /** The split button's plus segment — the waiting-list entry form. */
@@ -253,7 +253,9 @@ export interface CalendarAppointmentMeta {
253
253
  patientId: string;
254
254
  /** Absent = nobody assigned yet — a Backlog "No operator" item. */
255
255
  operatorId?: string;
256
- chairId: string;
256
+ /** Absent = a desk-created slot with no chair yet (chairs are optional
257
+ * on the platform) — the calendar backlog's "Senza poltrona" gap. */
258
+ chairId?: string;
257
259
  /** Derived care label — `careLabel(cares)`, tasks keep the task title.
258
260
  * Also the event's always-on `suffix`. */
259
261
  care: string;
@@ -320,6 +322,35 @@ export interface CalendarBookingContact {
320
322
  /** When the booking was made (platform `createdAt`). */
321
323
  bookedAtIso: string;
322
324
  }
325
+ /**
326
+ * A calendar task (platform `DoctorReminder`) — the model the task editor
327
+ * saves. `note` is the only required field; a task may be about a patient,
328
+ * about a company, or neither, but never both (mutually exclusive, like
329
+ * `CalendarWaitingEntry`'s three connections). No title separate from the
330
+ * note, no priority, no duration — the platform model has none.
331
+ */
332
+ export interface CalendarTask {
333
+ id: string;
334
+ /** Local wall-clock instant (date + time), as an ISO string. */
335
+ dateIso: string;
336
+ /** The task text — the only required field. */
337
+ note: string;
338
+ /** Absent = nobody assigned (platform `practiceUser` optional target). */
339
+ operatorId?: string;
340
+ /** Mutually exclusive with `companyId`. */
341
+ patientId?: string;
342
+ /** Mutually exclusive with `patientId` (platform `doctorCompany`). */
343
+ companyId?: string;
344
+ done: boolean;
345
+ }
346
+ /** The same shape without an identity — what the editor hands the create
347
+ * seam, and what an edit save re-sends in full (no partial patch).
348
+ * `done` is optional here (defaults to `false`) so a caller building a
349
+ * brand-new task never has to state the obvious; `CalendarTask.done` on
350
+ * a saved record stays required — a saved task always has a value. */
351
+ export type TaskDraft = Omit<CalendarTask, 'id' | 'done'> & {
352
+ done?: boolean;
353
+ };
323
354
  /** One contiguous working range, minutes from local midnight. */
324
355
  export interface CalendarDayHours {
325
356
  startMin: number;
@@ -1,4 +1,4 @@
1
- import { C as s, a as r, b as E, c as P, D as S, d as o, S as C, V as t, W as d, e as A, i, m as n, r as D, u as W, f as _, g as c } from "../../_chunks/calendar-workspace-DhXqqu-D.js";
1
+ import { C as s, a as r, b as E, c as P, D as S, d as o, S as C, V as t, W as d, e as A, i, m as n, r as D, u as W, f as _, g as c } from "../../_chunks/calendar-workspace-DBYAtdyd.js";
2
2
  export {
3
3
  s as CALENDAR_PREFERENCE_KEYS,
4
4
  r as CalendarDataProvider,
@@ -1,20 +1,22 @@
1
1
  /**
2
- * Help me write templates (HTP-6383) — practice-shared AI templates inside the
3
- * RichTextEditor's "Help me write".
2
+ * Help me write templates (HTP-6383) — practice-shared AI templates in the
3
+ * RichTextEditor.
4
4
  *
5
5
  * Runtime pattern: real consuming apps mount this in production (surfaced via
6
6
  * `src/patterns/index.ts` and the `./patterns/help-me-write-templates`
7
- * subpath). It plugs into the editor through `renderHelpMeWrite`, so the kit
8
- * editor keeps its own AI pill, the patient AI-consent gate and the
9
- * resume-after-grant; this pattern supplies the bar that opens from it.
7
+ * subpath). Templates are an AI action of the editor itself, next to
8
+ * spelling and auto-format: a Templates segment in the AI pill and in the
9
+ * selection bubble (`aiTemplates`). Picking one rewrites the selection, else
10
+ * the whole note, then this pattern offers Undo. The editor keeps the
11
+ * patient AI-consent gate and resume-after-grant for all of it.
10
12
  *
11
13
  * Parts, usable on their own or wired together by `useHelpMeWriteTemplates`:
12
- * - `HelpMeWriteTemplatesBar` — the docked bar: free prompt with an optional
13
- * mic, a Templates menu, a side-by-side compare, Replace / Insert below.
14
+ * - `HelpMeWriteTemplatesBar` — the Help-me-write bar (`renderHelpMeWrite`):
15
+ * a free prompt with an optional mic, the draft and Insert.
14
16
  * - `AiTemplateManager` — the dialog to list, create, edit and delete
15
17
  * templates and pick the default.
16
18
  * - `AiCreditsExhaustedNotice` — the out-of-credits state the bar shows when
17
- * `onGenerate` rejects with `AiCreditsExhaustedError`.
19
+ * an AI call rejects with `AiCreditsExhaustedError`, from the bar or the pill.
18
20
  * - `HelpMeWriteUndoNotice` — the success notice with Undo after a template
19
21
  * rewrote the note.
20
22
  *
@@ -22,7 +24,7 @@
22
24
  * never talks to a backend.
23
25
  */
24
26
  import { type ReactNode } from 'react';
25
- import type { HelpMeWriteRenderContext } from '../../components/rich-text-editor';
27
+ import type { HelpMeWriteRenderContext, RichTextEditorAiApplied, RichTextEditorAiTemplates } from '../../components/rich-text-editor';
26
28
  /** A practice-shared AI template. */
27
29
  export interface AiTemplate {
28
30
  id: string;
@@ -32,8 +34,11 @@ export interface AiTemplate {
32
34
  description?: string;
33
35
  /** The instructions sent to the AI, up to 4000 characters. */
34
36
  prompt: string;
35
- /** At most one per practice; listed first with a Default badge. */
36
- isDefault: boolean;
37
+ /**
38
+ * @deprecated The list order is the menu order: the first template is the
39
+ * one most people use. Ignored; reorder with `onReorderTemplates`.
40
+ */
41
+ isDefault?: boolean;
37
42
  }
38
43
  /** What the manager hands `onSaveTemplate`: `id` is absent for a new one. */
39
44
  export type AiTemplateDraft = Omit<AiTemplate, 'id'> & {
@@ -44,8 +49,14 @@ export interface HelpMeWriteRequest {
44
49
  template?: AiTemplate;
45
50
  /** The free prompt, or extra instructions for a template. May be ''. */
46
51
  prompt: string;
47
- /** Plain text the template rewrites: the selection, else the whole note. */
52
+ /**
53
+ * The context, as plain text. For a template, the text it rewrites. For
54
+ * the free prompt, what the draft is about. From the AI pill it is the
55
+ * whole note; from the selection bubble, the selected text.
56
+ */
48
57
  sourceText: string;
58
+ /** Where `sourceText` came from. */
59
+ scope?: 'document' | 'selection';
49
60
  signal: AbortSignal;
50
61
  }
51
62
  /**
@@ -90,15 +101,16 @@ export declare function AiCreditsExhaustedNotice({ credits, onBack, }: AiCredits
90
101
  export interface HelpMeWriteTemplatesBarProps {
91
102
  /** What `RichTextEditor`'s `renderHelpMeWrite` hands its host. */
92
103
  context: HelpMeWriteRenderContext;
93
- templates: AiTemplate[];
94
- /** The AI call. Reject with `AiCreditsExhaustedError` when out of credits. */
95
- onGenerate: (request: HelpMeWriteRequest) => Promise<string>;
96
104
  /**
97
- * Opens the template manager. Omit to hide "Manage templates" and
98
- * "Create your first template" (e.g. for readers who may not manage).
105
+ * @deprecated Templates run from the editor's AI pill (`aiTemplates`),
106
+ * not from this bar. Ignored.
99
107
  */
108
+ templates?: AiTemplate[];
109
+ /** The AI call. Reject with `AiCreditsExhaustedError` when out of credits. */
110
+ onGenerate: (request: HelpMeWriteRequest) => Promise<string>;
111
+ /** @deprecated The manager opens from the pill's Templates menu. Ignored. */
100
112
  onManageTemplates?: (mode: 'list' | 'create') => void;
101
- /** After a draft lands; the hook uses it for Undo. */
113
+ /** After a draft lands. */
102
114
  onApplied?: (applied: HelpMeWriteApplied) => void;
103
115
  /** Shown in the out-of-credits notice. */
104
116
  credits?: AiCreditsInfo;
@@ -107,8 +119,12 @@ export interface HelpMeWriteTemplatesBarProps {
107
119
  /** Ignore Escape (e.g. while the manager dialog above it is open). */
108
120
  suspendClose?: boolean;
109
121
  }
110
- /** The Help-me-write bar with templates, docked in the editor's AI slot. */
111
- export declare function HelpMeWriteTemplatesBar({ context, templates, onGenerate, onManageTemplates, onApplied, credits, enableDictation, suspendClose, }: HelpMeWriteTemplatesBarProps): React.JSX.Element;
122
+ /**
123
+ * The Help-me-write bar, docked in the editor's AI slot: a free prompt with
124
+ * an optional mic, then the draft and Insert. It also shows the
125
+ * out-of-credits notice, including when a pill action ran out.
126
+ */
127
+ export declare function HelpMeWriteTemplatesBar({ context, onGenerate, onApplied, credits, enableDictation, suspendClose, }: HelpMeWriteTemplatesBarProps): React.JSX.Element;
112
128
  export interface AiTemplateManagerProps {
113
129
  open: boolean;
114
130
  onOpenChange: (open: boolean) => void;
@@ -119,9 +135,14 @@ export interface AiTemplateManagerProps {
119
135
  onSaveTemplate: (draft: AiTemplateDraft) => void | Promise<void>;
120
136
  /** Omit to hide Delete. */
121
137
  onDeleteTemplate?: (id: string) => void | Promise<void>;
138
+ /**
139
+ * Persist a new order (every template id, first to last): the order of
140
+ * the Templates menu. Omit to hide the drag handles.
141
+ */
142
+ onReorderTemplates?: (orderedIds: string[]) => void | Promise<void>;
122
143
  }
123
144
  /** List, create, edit and delete the practice's templates. */
124
- export declare function AiTemplateManager({ open, onOpenChange, initialMode, templates, onSaveTemplate, onDeleteTemplate, }: AiTemplateManagerProps): React.JSX.Element;
145
+ export declare function AiTemplateManager({ open, onOpenChange, initialMode, templates, onSaveTemplate, onDeleteTemplate, onReorderTemplates, }: AiTemplateManagerProps): React.JSX.Element;
125
146
  export interface HelpMeWriteUndoNoticeProps {
126
147
  /** The change to offer Undo for; `null` hides the notice. */
127
148
  applied: HelpMeWriteApplied | null;
@@ -132,20 +153,29 @@ export interface HelpMeWriteUndoNoticeProps {
132
153
  export declare function HelpMeWriteUndoNotice({ applied, onUndo, onDismiss, }: HelpMeWriteUndoNoticeProps): React.JSX.Element | null;
133
154
  export interface UseHelpMeWriteTemplatesOptions {
134
155
  templates: AiTemplate[];
156
+ /** The AI call, for both templates (from the pill) and the free prompt. */
135
157
  onGenerate: HelpMeWriteTemplatesBarProps['onGenerate'];
136
158
  /** Enables the manager (create / edit). Omit for read-only template users. */
137
159
  onSaveTemplate?: AiTemplateManagerProps['onSaveTemplate'];
138
160
  /** Enables Delete in the manager. */
139
161
  onDeleteTemplate?: AiTemplateManagerProps['onDeleteTemplate'];
162
+ /** Enables drag-and-drop reordering in the manager (the menu order). */
163
+ onReorderTemplates?: AiTemplateManagerProps['onReorderTemplates'];
140
164
  credits?: AiCreditsInfo;
141
165
  /** Mic in the bar's prompt when the editor has `onDictate`. Default true. */
142
166
  enableDictation?: boolean;
143
167
  /** Also told about every applied draft (e.g. for analytics). */
144
168
  onApplied?: (applied: HelpMeWriteApplied) => void;
145
169
  }
146
- export interface UseHelpMeWriteTemplatesResult {
147
- /** Pass to `RichTextEditor`'s `renderHelpMeWrite`. */
170
+ /** The `RichTextEditor` props the hook drives; spread them on the editor. */
171
+ export interface HelpMeWriteTemplatesEditorProps {
148
172
  renderHelpMeWrite: (context: HelpMeWriteRenderContext) => ReactNode;
173
+ aiTemplates: RichTextEditorAiTemplates;
174
+ onAiApplied: (applied: RichTextEditorAiApplied) => void;
175
+ }
176
+ export interface UseHelpMeWriteTemplatesResult extends HelpMeWriteTemplatesEditorProps {
177
+ /** All three editor props at once: `<RichTextEditor {...hmw.editorProps} />`. */
178
+ editorProps: HelpMeWriteTemplatesEditorProps;
149
179
  /** Mount once, anywhere (a portalled dialog); `null` without `onSaveTemplate`. */
150
180
  manager: ReactNode;
151
181
  /** Place where the Undo notice should show, e.g. above the editor. */
@@ -153,12 +183,14 @@ export interface UseHelpMeWriteTemplatesResult {
153
183
  openManager: (mode?: 'list' | 'create') => void;
154
184
  }
155
185
  /**
156
- * Wires the bar, the manager and Undo together. Usage:
186
+ * Wires templates, the Help-me-write bar, the manager and Undo into the
187
+ * editor. Templates run from the editor's AI pill and selection bubble;
188
+ * the bar is the free prompt. Usage:
157
189
  *
158
190
  * const hmw = useHelpMeWriteTemplates({ templates, onGenerate, onSaveTemplate });
159
191
  * {hmw.undoNotice}
160
- * <RichTextEditor renderHelpMeWrite={hmw.renderHelpMeWrite} … />
192
+ * <RichTextEditor {...hmw.editorProps} … />
161
193
  * {hmw.manager}
162
194
  */
163
- export declare function useHelpMeWriteTemplates({ templates, onGenerate, onSaveTemplate, onDeleteTemplate, credits, enableDictation, onApplied, }: UseHelpMeWriteTemplatesOptions): UseHelpMeWriteTemplatesResult;
195
+ export declare function useHelpMeWriteTemplates({ templates, onGenerate, onSaveTemplate, onDeleteTemplate, onReorderTemplates, credits, enableDictation, onApplied, }: UseHelpMeWriteTemplatesOptions): UseHelpMeWriteTemplatesResult;
164
196
  //# sourceMappingURL=help-me-write-templates.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export { AiCreditsExhaustedError, AiCreditsExhaustedNotice, AiTemplateManager, HelpMeWriteTemplatesBar, HelpMeWriteUndoNotice, useHelpMeWriteTemplates, } from './help-me-write-templates';
2
- export type { AiCreditsExhaustedNoticeProps, AiCreditsInfo, AiTemplate, AiTemplateDraft, AiTemplateManagerProps, HelpMeWriteApplied, HelpMeWriteApplyMode, HelpMeWriteRequest, HelpMeWriteTemplatesBarProps, HelpMeWriteUndoNoticeProps, UseHelpMeWriteTemplatesOptions, UseHelpMeWriteTemplatesResult, } from './help-me-write-templates';
2
+ export type { AiCreditsExhaustedNoticeProps, AiCreditsInfo, AiTemplate, AiTemplateDraft, AiTemplateManagerProps, HelpMeWriteApplied, HelpMeWriteApplyMode, HelpMeWriteRequest, HelpMeWriteTemplatesBarProps, HelpMeWriteUndoNoticeProps, UseHelpMeWriteTemplatesOptions, UseHelpMeWriteTemplatesResult, HelpMeWriteTemplatesEditorProps, } from './help-me-write-templates';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { A as s, a as t, b as r, H as i, c as p, u as l } from "../../_chunks/help-me-write-templates-B-m7zgJa.js";
1
+ import { A as s, a as t, b as r, H as i, c as p, u as l } from "../../_chunks/help-me-write-templates-GUeEn3Ff.js";
2
2
  export {
3
3
  s as AiCreditsExhaustedError,
4
4
  t as AiCreditsExhaustedNotice,