@burdenoff/microfe-calendar 2026.1124.3 → 2026.1124.4

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 (88) hide show
  1. package/dist/generated/wspace-operations.d.ts +342 -69
  2. package/dist/generated/wspace-operations.js +73 -31
  3. package/dist/generated/wspace-operations.js.map +1 -1
  4. package/dist/generated/wspace-types.d.ts +405 -6
  5. package/dist/translations/en.d.ts +22 -4
  6. package/dist/v2/CalendarPageV2.js +45 -41
  7. package/dist/v2/CalendarPageV2.js.map +1 -1
  8. package/dist/v2/CalendarRoutesV2.js +64 -64
  9. package/dist/v2/CalendarRoutesV2.js.map +1 -1
  10. package/dist/v2/data/errors.d.ts +5 -0
  11. package/dist/v2/data/errors.js +6 -2
  12. package/dist/v2/data/errors.js.map +1 -1
  13. package/dist/v2/data/normalize.d.ts +31 -3
  14. package/dist/v2/data/normalize.js +57 -13
  15. package/dist/v2/data/normalize.js.map +1 -1
  16. package/dist/v2/data/seriesDateLookup.d.ts +9 -0
  17. package/dist/v2/data/seriesDateLookup.js +12 -0
  18. package/dist/v2/data/seriesDateLookup.js.map +1 -0
  19. package/dist/v2/data/useEventActions.d.ts +9 -3
  20. package/dist/v2/data/useEventActions.js +239 -186
  21. package/dist/v2/data/useEventActions.js.map +1 -1
  22. package/dist/v2/data/useEventForPeek.js +63 -21
  23. package/dist/v2/data/useEventForPeek.js.map +1 -1
  24. package/dist/v2/data/useEventsInRangeV2.d.ts +40 -2
  25. package/dist/v2/data/useEventsInRangeV2.js +76 -47
  26. package/dist/v2/data/useEventsInRangeV2.js.map +1 -1
  27. package/dist/v2/day/DayPanel.js +1 -1
  28. package/dist/v2/day/DayPanel.js.map +1 -1
  29. package/dist/v2/event/EventDialog.d.ts +13 -3
  30. package/dist/v2/event/EventDialog.js +189 -166
  31. package/dist/v2/event/EventDialog.js.map +1 -1
  32. package/dist/v2/event/EventDialogs.js +57 -50
  33. package/dist/v2/event/EventDialogs.js.map +1 -1
  34. package/dist/v2/event/EventMoreTab.js +8 -7
  35. package/dist/v2/event/EventMoreTab.js.map +1 -1
  36. package/dist/v2/event/EventPlaceTab.js +2 -2
  37. package/dist/v2/event/EventPlaceTab.js.map +1 -1
  38. package/dist/v2/event/FindTimeDialog.js +1 -1
  39. package/dist/v2/event/FindTimeDialog.js.map +1 -1
  40. package/dist/v2/event/RepeatField.js +10 -7
  41. package/dist/v2/event/RepeatField.js.map +1 -1
  42. package/dist/v2/event/dialogLogic.d.ts +10 -0
  43. package/dist/v2/event/dialogLogic.js +25 -22
  44. package/dist/v2/event/dialogLogic.js.map +1 -1
  45. package/dist/v2/event/dialogModel.d.ts +3 -0
  46. package/dist/v2/event/dialogModel.js.map +1 -1
  47. package/dist/v2/event/eventForm.d.ts +26 -0
  48. package/dist/v2/event/eventForm.js +145 -92
  49. package/dist/v2/event/eventForm.js.map +1 -1
  50. package/dist/v2/event/findTimeSource.js +44 -44
  51. package/dist/v2/event/findTimeSource.js.map +1 -1
  52. package/dist/v2/event/rrule.js.map +1 -1
  53. package/dist/v2/event/savePlan.d.ts +125 -15
  54. package/dist/v2/event/savePlan.js +162 -68
  55. package/dist/v2/event/savePlan.js.map +1 -1
  56. package/dist/v2/event/useEventData.d.ts +7 -2
  57. package/dist/v2/event/useEventData.js +107 -80
  58. package/dist/v2/event/useEventData.js.map +1 -1
  59. package/dist/v2/event/useEventDialogModel.d.ts +16 -3
  60. package/dist/v2/event/useEventDialogModel.js +82 -67
  61. package/dist/v2/event/useEventDialogModel.js.map +1 -1
  62. package/dist/v2/event/useEventSave.d.ts +20 -4
  63. package/dist/v2/event/useEventSave.js +181 -90
  64. package/dist/v2/event/useEventSave.js.map +1 -1
  65. package/dist/v2/events/eventLook.js +16 -16
  66. package/dist/v2/events/eventLook.js.map +1 -1
  67. package/dist/v2/events/eventModel.d.ts +17 -4
  68. package/dist/v2/events/eventModel.js +46 -34
  69. package/dist/v2/events/eventModel.js.map +1 -1
  70. package/dist/v2/events/localChanges.d.ts +4 -1
  71. package/dist/v2/events/localChanges.js +4 -2
  72. package/dist/v2/events/localChanges.js.map +1 -1
  73. package/dist/v2/page/CalendarPageContext.d.ts +2 -2
  74. package/dist/v2/page/CalendarPageContext.js.map +1 -1
  75. package/dist/v2/page/useCalendarPageModel.js +141 -139
  76. package/dist/v2/page/useCalendarPageModel.js.map +1 -1
  77. package/dist/v2/page/viewState.d.ts +9 -1
  78. package/dist/v2/page/viewState.js +5 -3
  79. package/dist/v2/page/viewState.js.map +1 -1
  80. package/dist/v2/peek/PeekEvent.js +210 -204
  81. package/dist/v2/peek/PeekEvent.js.map +1 -1
  82. package/dist/v2/rail/useMonthEventDates.js +1 -1
  83. package/dist/v2/rail/useMonthEventDates.js.map +1 -1
  84. package/dist/v2/states/CalendarStates.d.ts +15 -0
  85. package/dist/v2/states/CalendarStates.js +42 -11
  86. package/dist/v2/states/CalendarStates.js.map +1 -1
  87. package/dist/v2/types.d.ts +30 -2
  88. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
1
  import { useFreeBusy as e } from "../data/useFreeBusy.js";
2
- import { canEditEvent as t } from "../events/eventModel.js";
3
- import { useCalendarPage as n } from "../page/CalendarPageContext.js";
4
- import { dialogHeading as r, footerNote as i, headerDescription as a, lockReason as o, readBackOf as s, reloadNote as c, statusFrom as l } from "./dialogLogic.js";
5
- import { availabilitySpan as u, endInstant as d, formFromEvent as f, formIssues as p, hasIssues as m, sameForm as h, startInstant as g } from "./eventForm.js";
6
- import { freeBusyRangeFor as _ } from "./findTime.js";
7
- import { roomStateAt as v } from "./place.js";
8
- import { isEmptyPlan as y, planEdit as b } from "./savePlan.js";
9
- import { useIdentities as x, useRoomsForEvent as S } from "./useEventData.js";
10
- import { useMemo as C } from "react";
2
+ import { canEditEvent as t, isSeriesDate as n } from "../events/eventModel.js";
3
+ import { useCalendarPage as r } from "../page/CalendarPageContext.js";
4
+ import { baselineOf as i, dialogHeading as a, footerNote as o, headerDescription as s, lockReason as c, readBackOf as l, reloadNote as u, statusFrom as d } from "./dialogLogic.js";
5
+ import { availabilitySpan as f, endInstant as p, formFromEvent as m, formIssues as h, hasIssues as g, sameForm as _, startInstant as v } from "./eventForm.js";
6
+ import { freeBusyRangeFor as y } from "./findTime.js";
7
+ import { roomStateAt as b } from "./place.js";
8
+ import { carriesWork as x, isEmptyPlan as S, planEdit as C } from "./savePlan.js";
9
+ import { useIdentities as w, useRoomsForEvent as T } from "./useEventData.js";
10
+ import { useMemo as E } from "react";
11
11
  // src/v2/event/useEventDialogModel.ts
12
- var w = {
12
+ var D = {
13
13
  kind: "noFreeBusy",
14
14
  span: null,
15
15
  truncated: !1
16
16
  };
17
- function T(e, t, n) {
17
+ function O(e, t, n) {
18
18
  let r = n.flatMap((e) => e.userId ? [e.userId] : []).join("\n");
19
- return C(() => [.../* @__PURE__ */ new Set([
19
+ return E(() => [.../* @__PURE__ */ new Set([
20
20
  ...e ? [e] : [],
21
21
  ...t ? [t] : [],
22
22
  ...r ? r.split("\n") : []
@@ -26,21 +26,21 @@ function T(e, t, n) {
26
26
  t
27
27
  ]);
28
28
  }
29
- function E(e, t) {
29
+ function k(e, t) {
30
30
  return e.status === "error" ? { kind: "error" } : e.status === "ready" ? {
31
31
  kind: "ready",
32
32
  person: e.byUserId.get(t)
33
33
  } : { kind: "loading" };
34
34
  }
35
- function D(t, r) {
36
- let { tr: i, timeZone: a, me: o } = n(), s = T(o, r?.organizerId ?? null, t.guests), c = x(s), d = u(t, a), f = _(d.start, d.end, a), p = e(s, f.from, f.to), m = r && !r.allDay ? {
37
- start: r.start,
38
- end: r.end
35
+ function A(t, n) {
36
+ let { tr: i, timeZone: a, me: o } = r(), s = O(o, n?.organizerId ?? null, t.guests), c = w(s), l = f(t, a), u = y(l.start, l.end, a), p = e(s, u.from, u.to), m = n && !n.allDay ? {
37
+ start: n.start,
38
+ end: n.end
39
39
  } : null;
40
40
  return {
41
- me: o ? l(E(p, o), d, a, m) : w,
41
+ me: o ? d(k(p, o), l, a, m) : D,
42
42
  guestStatus: (e) => {
43
- if (!e.userId) return w;
43
+ if (!e.userId) return D;
44
44
  if (c.status === "error") return {
45
45
  kind: "error",
46
46
  span: null,
@@ -51,9 +51,9 @@ function D(t, r) {
51
51
  span: null,
52
52
  truncated: !1
53
53
  };
54
- if (!c.byUserId.has(e.userId)) return w;
54
+ if (!c.byUserId.has(e.userId)) return D;
55
55
  let t = e.attendeeId !== null && e.response !== "DECLINED";
56
- return l(E(p, e.userId), d, a, t ? m : null);
56
+ return d(k(p, e.userId), l, a, t ? m : null);
57
57
  },
58
58
  guestName: (e) => (e.userId ? c.byUserId.get(e.userId)?.name : void 0) ?? e.name ?? e.email ?? i("calendar.v2.guest", "Guest"),
59
59
  identities: c,
@@ -62,68 +62,83 @@ function D(t, r) {
62
62
  }
63
63
  };
64
64
  }
65
- function O(e, t, n) {
66
- return !h(e.form, t ? f(t, n) : e.initial);
65
+ function j(e, t, n) {
66
+ return x(e.carry) || !_(e.form, t ? m(t, n) : e.initial);
67
67
  }
68
- function k(e, t) {
69
- let { form: n, room: r } = e, a = r && !n.allDay ? {
68
+ function M(e, t) {
69
+ let { form: n, room: r } = e, i = r && !n.allDay ? {
70
70
  name: r.name,
71
- state: v(r, g(n), d(n), e.event?.id ?? null),
71
+ state: b(r, v(n), p(n), e.event?.eventId ?? null),
72
72
  needsApproval: r.needsApproval
73
- } : null, o = m(e.issues) || !e.event && !e.calendarId;
74
- return i({
75
- blocked: e.showIssues && o,
73
+ } : null, a = g(e.issues) || !e.event && !e.calendarId;
74
+ return o({
75
+ blocked: e.showIssues && a,
76
76
  noCalendar: !e.calendarId,
77
77
  title: n.title.trim(),
78
- room: a,
78
+ room: i,
79
79
  busy: !n.allDay && (e.me.kind === "busy" || e.me.kind === "away"),
80
80
  guestCount: n.guests.length
81
81
  }, t);
82
82
  }
83
- function A({ session: e, edited: i, onChange: l, onFindTime: u, onGuestsPending: f, showIssues: m }) {
84
- let h = n(), { tr: _, format: v, timeZone: x, me: C } = h, { form: w } = e, T = e.eventId && i.status === "ready" ? i.event : null, E = T ? h.calendarsById.get(T.calendarId) : void 0, A = T !== null && !t(T, E, C), j = e.eventId ? s(i) : null, M = D(w, T), N = S(d(w)), P = w.calendarId ?? h.defaultCalendarId, F = p(w), I = N.rooms.find((e) => e.id === w.roomId), L = j ? c(j, _) : k({
85
- form: w,
86
- event: T,
87
- issues: F,
83
+ function N(e, t) {
84
+ return !e.eventId || t.status !== "ready" ? {
85
+ event: null,
86
+ row: null,
87
+ seriesDate: !1
88
+ } : {
89
+ event: t.event,
90
+ row: t.row,
91
+ seriesDate: n(t.event)
92
+ };
93
+ }
94
+ function P({ session: e, edited: n, onChange: o, onFindTime: d, onGuestsPending: f, showIssues: m }) {
95
+ let g = r(), { tr: _, format: y, timeZone: b, me: w } = g, { form: E } = e, { event: D, row: O, seriesDate: k } = N(e, n), P = D ? g.calendarsById.get(D.calendarId) : void 0, F = D !== null && !t(D, P, w), I = e.eventId ? l(n) : null, L = A(E, D), R = T(p(E)), z = E.calendarId ?? g.defaultCalendarId, B = h(E), V = R.rooms.find((e) => e.id === E.roomId), H = I ? u(I, _) : M({
96
+ form: E,
97
+ event: D,
98
+ issues: B,
88
99
  showIssues: m,
89
- calendarId: P,
90
- room: I,
91
- me: M.me
92
- }, _), R = {
93
- form: w,
94
- update: (e) => l((t) => ({
100
+ calendarId: z,
101
+ room: V,
102
+ me: L.me
103
+ }, _), U = {
104
+ form: E,
105
+ update: (e) => o((t) => ({
95
106
  ...t,
96
107
  form: e(t.form)
97
108
  })),
98
- readOnly: A,
99
- event: T,
100
- issues: F,
109
+ readOnly: F,
110
+ event: D,
111
+ issues: B,
101
112
  showIssues: m,
102
- start: g(w),
103
- end: d(w),
104
- me: M.me,
105
- guestStatus: M.guestStatus,
106
- retryFreeBusy: M.retry,
107
- identities: M.identities,
108
- guestName: M.guestName,
109
- rooms: N,
110
- openFindTime: () => u(e),
111
- guestsPending: f
112
- }, z = T ? M.identities.byUserId.get(T.organizerId)?.name : null;
113
+ start: v(E),
114
+ end: p(E),
115
+ me: L.me,
116
+ guestStatus: L.guestStatus,
117
+ retryFreeBusy: L.retry,
118
+ identities: L.identities,
119
+ guestName: L.guestName,
120
+ rooms: R,
121
+ openFindTime: () => d(e),
122
+ guestsPending: f,
123
+ scope: k ? e.scope : null
124
+ }, W = D ? L.identities.byUserId.get(D.organizerId)?.name : null;
113
125
  return {
114
- model: R,
115
- event: T,
116
- readOnly: A,
117
- readBack: j,
118
- dirty: O(e, T, x),
119
- toSave: !T || !y(b(w, T, x, e.scope)),
120
- calendarId: P,
121
- lock: A && T ? o(T, E, z ?? null, _) : null,
122
- note: A ? null : L,
123
- heading: r(e.eventId, A, _),
124
- description: a(w, _, v)
126
+ model: U,
127
+ event: D,
128
+ row: O,
129
+ seriesDate: k,
130
+ readOnly: F,
131
+ readBack: I,
132
+ dirty: j(e, D, b),
133
+ toSave: !D || x(e.carry) || !S(C(E, D, b)),
134
+ baseline: i(e, n, b),
135
+ calendarId: z,
136
+ lock: F && D ? c(D, P, W ?? null, _) : null,
137
+ note: F ? null : H,
138
+ heading: a(e.eventId, F, _),
139
+ description: s(E, _, y)
125
140
  };
126
141
  }
127
- export { A as useEventDialogModel };
142
+ export { P as useEventDialogModel };
128
143
 
129
144
  //# sourceMappingURL=useEventDialogModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEventDialogModel.js","names":["NO_FREE_BUSY","useAskIds","guestKey","guests","guest","useMemo","me","organizerId","answerFrom","freeBusy","userId","usePeopleTime","useCalendarPage","askIds","event","form","identities","useIdentities","span","availabilitySpan","timeZone","range","freeBusyRangeFor","useFreeBusy","ownTime","statusFrom","invited","tr","isDirty","sameForm","session","formFromEvent","noteFor","input","roomThen","room","roomStateAt","startInstant","endInstant","blocked","hasIssues","footerNote","useEventDialogModel","page","edited","calendar","readOnly","canEditEvent","readBack","readBackOf","people","rooms","useRoomsForEvent","calendarId","issues","formIssues","item","note","reloadNote","model","onChange","current","change","onFindTime","onGuestsPending","organizerName","isEmptyPlan","planEdit","lockReason","dialogHeading","headerDescription","format"],"sources":["../../../src/v2/event/useEventDialogModel.ts"],"sourcesContent":["/**\n * Everything the event dialog's tabs and footer read (BOFF-15698 A2), built from the session the\n * host keeps and the event as the service last returned it: who may change it, what each person's\n * time is then (free/busy), the rooms, what stops a save, and the header and footer words.\n */\nimport { useMemo } from 'react';\nimport type { Tr } from '../data/useEventActions';\nimport { useFreeBusy, type FreeBusyV2 } from '../data/useFreeBusy';\nimport { canEditEvent } from '../events/eventModel';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport type { CalendarEventV2 } from '../types';\nimport type { EventSession } from './EventDialog';\nimport type { EventDialogModel, PersonStatus } from './dialogModel';\nimport {\n dialogHeading,\n footerNote,\n headerDescription,\n lockReason,\n readBackOf,\n reloadNote,\n statusFrom,\n type FooterNote,\n type FreeBusyAnswer,\n type ReadBack,\n} from './dialogLogic';\nimport {\n availabilitySpan,\n endInstant,\n formFromEvent,\n formIssues,\n hasIssues,\n sameForm,\n startInstant,\n type EventForm,\n type FormIssues,\n type GuestDraft,\n} from './eventForm';\nimport { freeBusyRangeFor } from './findTime';\nimport { roomStateAt, type RoomForEvent } from './place';\nimport { isEmptyPlan, planEdit } from './savePlan';\nimport { useIdentities, useRoomsForEvent, type EditedEvent, type Identities } from './useEventData';\n\nexport interface EventDialogState {\n model: EventDialogModel;\n /** The event being edited; null for a new one. */\n event: CalendarEventV2 | null;\n readOnly: boolean;\n /**\n * Where reading the edited event back stands (`readBackOf`): null when the dialog holds it as\n * the service has it now, or for a new event. Nothing saves until then: after a partial save a\n * plan made on the older copy would send again what saved (or create a new event twice).\n */\n readBack: ReadBack | null;\n /** Something would be lost by closing: the form isn't the event's (or as it opened). */\n dirty: boolean;\n /** Save has something to send (an edit's plan isn't empty; a new event always). */\n toSave: boolean;\n /** The calendar a new event goes on (the person's default until they pick). */\n calendarId: string | null;\n /** Why the person can't change it; null when they can. */\n lock: string | null;\n /** The footer's note; null while read-only. */\n note: FooterNote | null;\n heading: string;\n description: string;\n}\n\nconst NO_FREE_BUSY: PersonStatus = { kind: 'noFreeBusy', span: null, truncated: false };\n\n/** The ids to ask free/busy and names about: the person, the organiser, the guests. */\nfunction useAskIds(me: string | null, organizerId: string | null, guests: readonly GuestDraft[]) {\n const guestKey = guests.flatMap((guest) => (guest.userId ? [guest.userId] : [])).join('\\n');\n return useMemo(\n () => [\n ...new Set([\n ...(me ? [me] : []),\n ...(organizerId ? [organizerId] : []),\n ...(guestKey ? guestKey.split('\\n') : []),\n ]),\n ],\n [guestKey, me, organizerId]\n );\n}\n\n/** What free/busy has said about one person so far. */\nfunction answerFrom(freeBusy: FreeBusyV2, userId: string): FreeBusyAnswer {\n if (freeBusy.status === 'error') return { kind: 'error' };\n if (freeBusy.status !== 'ready') return { kind: 'loading' };\n return { kind: 'ready', person: freeBusy.byUserId.get(userId) };\n}\n\ninterface PeopleTime {\n me: PersonStatus;\n guestStatus: (guest: GuestDraft) => PersonStatus;\n guestName: (guest: GuestDraft) => string;\n identities: Identities;\n retry: () => void;\n}\n\n/** Each person's time while the event happens (free/busy), and the guests' names. */\nfunction usePeopleTime(form: EventForm, event: CalendarEventV2 | null): PeopleTime {\n const { tr, timeZone, me } = useCalendarPage();\n const askIds = useAskIds(me, event?.organizerId ?? null, form.guests);\n const identities = useIdentities(askIds);\n const span = availabilitySpan(form, timeZone);\n // Whole days, so moving the time within them asks nothing again (the hook keys on instants).\n const range = freeBusyRangeFor(span.start, span.end, timeZone);\n const freeBusy = useFreeBusy(askIds, range.from, range.to);\n // The event's own time doesn't make its organiser or its guests busy.\n const ownTime = event && !event.allDay ? { start: event.start, end: event.end } : null;\n const guestStatus = (guest: GuestDraft): PersonStatus => {\n if (!guest.userId) return NO_FREE_BUSY;\n // Only a member has free/busy: until that is known, nothing is said (never \"free\").\n if (identities.status === 'error') return { kind: 'error', span: null, truncated: false };\n if (identities.status !== 'ready') return { kind: 'loading', span: null, truncated: false };\n if (!identities.byUserId.has(guest.userId)) return NO_FREE_BUSY;\n const invited = guest.attendeeId !== null && guest.response !== 'DECLINED';\n return statusFrom(answerFrom(freeBusy, guest.userId), span, timeZone, invited ? ownTime : null);\n };\n const guestName = (guest: GuestDraft) => {\n const known = guest.userId ? identities.byUserId.get(guest.userId)?.name : undefined;\n return known ?? guest.name ?? guest.email ?? tr('calendar.v2.guest', 'Guest');\n };\n return {\n me: me ? statusFrom(answerFrom(freeBusy, me), span, timeZone, ownTime) : NO_FREE_BUSY,\n guestStatus,\n guestName,\n identities,\n retry: () => {\n freeBusy.refetch();\n identities.retry();\n },\n };\n}\n\n/**\n * Whether closing would lose something: the form differs from the event as the service has it\n * (a change, a time from Find a time, what a partial save left), or a new event's from how it\n * opened. A booking the save would only put right (`planEdit`) isn't the person's change.\n */\nfunction isDirty(session: EventSession, event: CalendarEventV2 | null, timeZone: string) {\n return !sameForm(session.form, event ? formFromEvent(event, timeZone) : session.initial);\n}\n\n/** The footer's facts: what stops a save, the room then, the person's own time, the guests. */\nfunction noteFor(\n input: {\n form: EventForm;\n event: CalendarEventV2 | null;\n issues: FormIssues;\n showIssues: boolean;\n calendarId: string | null;\n room: RoomForEvent | undefined;\n me: PersonStatus;\n },\n tr: Tr\n): FooterNote {\n const { form, room } = input;\n const roomThen =\n room && !form.allDay\n ? {\n name: room.name,\n state: roomStateAt(room, startInstant(form), endInstant(form), input.event?.id ?? null),\n needsApproval: room.needsApproval,\n }\n : null;\n const blocked = hasIssues(input.issues) || (!input.event && !input.calendarId);\n return footerNote(\n {\n blocked: input.showIssues && blocked,\n noCalendar: !input.calendarId,\n title: form.title.trim(),\n room: roomThen,\n busy: !form.allDay && (input.me.kind === 'busy' || input.me.kind === 'away'),\n guestCount: form.guests.length,\n },\n tr\n );\n}\n\nexport function useEventDialogModel({\n session,\n edited,\n onChange,\n onFindTime,\n onGuestsPending,\n showIssues,\n}: {\n session: EventSession;\n edited: EditedEvent;\n onChange: (change: (session: EventSession) => EventSession) => void;\n onFindTime: (session: EventSession) => void;\n onGuestsPending: (pending: boolean) => void;\n showIssues: boolean;\n}): EventDialogState {\n const page = useCalendarPage();\n const { tr, format, timeZone, me } = page;\n const { form } = session;\n const event = session.eventId && edited.status === 'ready' ? edited.event : null;\n const calendar = event ? page.calendarsById.get(event.calendarId) : undefined;\n const readOnly = event !== null && !canEditEvent(event, calendar, me);\n const readBack = session.eventId ? readBackOf(edited) : null;\n const people = usePeopleTime(form, event);\n const rooms = useRoomsForEvent(endInstant(form));\n const calendarId = form.calendarId ?? page.defaultCalendarId;\n const issues = formIssues(form);\n const room = rooms.rooms.find((item) => item.id === form.roomId);\n const note = readBack\n ? reloadNote(readBack, tr)\n : noteFor({ form, event, issues, showIssues, calendarId, room, me: people.me }, tr);\n\n const model: EventDialogModel = {\n form,\n update: (change: (form: EventForm) => EventForm) =>\n onChange((current) => ({ ...current, form: change(current.form) })),\n readOnly,\n event,\n issues,\n showIssues,\n start: startInstant(form),\n end: endInstant(form),\n me: people.me,\n guestStatus: people.guestStatus,\n retryFreeBusy: people.retry,\n identities: people.identities,\n guestName: people.guestName,\n rooms,\n openFindTime: () => onFindTime(session),\n guestsPending: onGuestsPending,\n };\n const organizerName = event ? people.identities.byUserId.get(event.organizerId)?.name : null;\n return {\n model,\n event,\n readOnly,\n readBack,\n dirty: isDirty(session, event, timeZone),\n toSave: !event || !isEmptyPlan(planEdit(form, event, timeZone, session.scope)),\n calendarId,\n lock: readOnly && event ? lockReason(event, calendar, organizerName ?? null, tr) : null,\n note: readOnly ? null : note,\n heading: dialogHeading(session.eventId, readOnly, tr),\n description: headerDescription(form, tr, format),\n };\n}\n"],"mappings":";;;;;;;;;;;AAmEA,IAAMA,IAA6B;CAAE,MAAM;CAAc,MAAM;CAAM,WAAW;AAAM;AAGtF,SAASC,EAAU,GAAmB,GAA4B,GAA+B;CAC/F,IAAMC,IAAWC,EAAO,SAAS,MAAWC,EAAM,SAAS,CAACA,EAAM,MAAM,IAAI,CAAC,CAAE,CAAC,CA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oB,KAAiB,MAAMtC,CAAE,IAAI;EACnF,MAAMmB,IAAW,OAAOW;EACxB,SAASY,EAAcvC,EAAQ,SAASgB,GAAUnB,CAAE;EACpD,aAAa2C,EAAkBvD,GAAMY,GAAI4C,CAAM;CACjD;AACF"}
1
+ {"version":3,"file":"useEventDialogModel.js","names":["NO_FREE_BUSY","useAskIds","guestKey","guests","guest","useMemo","me","organizerId","answerFrom","freeBusy","userId","usePeopleTime","useCalendarPage","askIds","event","form","identities","useIdentities","span","availabilitySpan","timeZone","range","freeBusyRangeFor","useFreeBusy","ownTime","statusFrom","invited","tr","isDirty","carriesWork","session","sameForm","formFromEvent","noteFor","input","roomThen","room","roomStateAt","startInstant","endInstant","blocked","hasIssues","footerNote","editedPair","edited","isSeriesDate","useEventDialogModel","page","calendar","readOnly","canEditEvent","readBack","readBackOf","people","rooms","useRoomsForEvent","calendarId","issues","formIssues","item","note","reloadNote","model","onChange","current","change","onFindTime","onGuestsPending","seriesDate","organizerName","isEmptyPlan","planEdit","baselineOf","lockReason","dialogHeading","headerDescription","format"],"sources":["../../../src/v2/event/useEventDialogModel.ts"],"sourcesContent":["/**\n * Everything the event dialog's tabs and footer read (BOFF-15698 A2), built from the session the\n * host keeps and the event as the service last returned it: who may change it, what each person's\n * time is then (free/busy), the rooms, what stops a save, and the header and footer words.\n */\nimport { useMemo } from 'react';\nimport type { Tr } from '../data/useEventActions';\nimport { useFreeBusy, type FreeBusyV2 } from '../data/useFreeBusy';\nimport { canEditEvent, isSeriesDate } from '../events/eventModel';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport type { CalendarEventV2 } from '../types';\nimport type { EventSession } from './EventDialog';\nimport type { EventDialogModel, PersonStatus } from './dialogModel';\nimport {\n baselineOf,\n dialogHeading,\n footerNote,\n headerDescription,\n lockReason,\n readBackOf,\n reloadNote,\n statusFrom,\n type FooterNote,\n type FreeBusyAnswer,\n type ReadBack,\n} from './dialogLogic';\nimport {\n availabilitySpan,\n endInstant,\n formFromEvent,\n formIssues,\n hasIssues,\n sameForm,\n startInstant,\n type EventForm,\n type FormIssues,\n type GuestDraft,\n} from './eventForm';\nimport { freeBusyRangeFor } from './findTime';\nimport { roomStateAt, type RoomForEvent } from './place';\nimport { carriesWork, isEmptyPlan, planEdit } from './savePlan';\nimport { useIdentities, useRoomsForEvent, type EditedEvent, type Identities } from './useEventData';\n\nexport interface EventDialogState {\n model: EventDialogModel;\n /** The event being edited (a series' date at that date, A4); null for a new one. */\n event: CalendarEventV2 | null;\n /** The stored event behind it: for a series' date, the series at its first date. */\n row: CalendarEventV2 | null;\n /** A date of a repeating event: the footer asks which events change. */\n seriesDate: boolean;\n readOnly: boolean;\n /**\n * Where reading the edited event back stands (`readBackOf`): null when the dialog holds it as\n * the service has it now, or for a new event. Nothing saves until then: after a partial save a\n * plan made on the older copy would send again what saved (or create a new event twice).\n */\n readBack: ReadBack | null;\n /**\n * Something would be lost by closing: the form isn't the event's (or as it opened), or a save\n * left work for the next one.\n */\n dirty: boolean;\n /**\n * Save has something to send (an edit's plan isn't empty, or a save left work for the next\n * one; a new event always).\n */\n toSave: boolean;\n /** What the person's changes are told from (`baselineOf`). */\n baseline: EventForm;\n /** The calendar a new event goes on (the person's default until they pick). */\n calendarId: string | null;\n /** Why the person can't change it; null when they can. */\n lock: string | null;\n /** The footer's note; null while read-only. */\n note: FooterNote | null;\n heading: string;\n description: string;\n}\n\nconst NO_FREE_BUSY: PersonStatus = { kind: 'noFreeBusy', span: null, truncated: false };\n\n/** The ids to ask free/busy and names about: the person, the organiser, the guests. */\nfunction useAskIds(me: string | null, organizerId: string | null, guests: readonly GuestDraft[]) {\n const guestKey = guests.flatMap((guest) => (guest.userId ? [guest.userId] : [])).join('\\n');\n return useMemo(\n () => [\n ...new Set([\n ...(me ? [me] : []),\n ...(organizerId ? [organizerId] : []),\n ...(guestKey ? guestKey.split('\\n') : []),\n ]),\n ],\n [guestKey, me, organizerId]\n );\n}\n\n/** What free/busy has said about one person so far. */\nfunction answerFrom(freeBusy: FreeBusyV2, userId: string): FreeBusyAnswer {\n if (freeBusy.status === 'error') return { kind: 'error' };\n if (freeBusy.status !== 'ready') return { kind: 'loading' };\n return { kind: 'ready', person: freeBusy.byUserId.get(userId) };\n}\n\ninterface PeopleTime {\n me: PersonStatus;\n guestStatus: (guest: GuestDraft) => PersonStatus;\n guestName: (guest: GuestDraft) => string;\n identities: Identities;\n retry: () => void;\n}\n\n/** Each person's time while the event happens (free/busy), and the guests' names. */\nfunction usePeopleTime(form: EventForm, event: CalendarEventV2 | null): PeopleTime {\n const { tr, timeZone, me } = useCalendarPage();\n const askIds = useAskIds(me, event?.organizerId ?? null, form.guests);\n const identities = useIdentities(askIds);\n const span = availabilitySpan(form, timeZone);\n // Whole days, so moving the time within them asks nothing again (the hook keys on instants).\n const range = freeBusyRangeFor(span.start, span.end, timeZone);\n const freeBusy = useFreeBusy(askIds, range.from, range.to);\n // The event's own time doesn't make its organiser or its guests busy.\n const ownTime = event && !event.allDay ? { start: event.start, end: event.end } : null;\n const guestStatus = (guest: GuestDraft): PersonStatus => {\n if (!guest.userId) return NO_FREE_BUSY;\n // Only a member has free/busy: until that is known, nothing is said (never \"free\").\n if (identities.status === 'error') return { kind: 'error', span: null, truncated: false };\n if (identities.status !== 'ready') return { kind: 'loading', span: null, truncated: false };\n if (!identities.byUserId.has(guest.userId)) return NO_FREE_BUSY;\n const invited = guest.attendeeId !== null && guest.response !== 'DECLINED';\n return statusFrom(answerFrom(freeBusy, guest.userId), span, timeZone, invited ? ownTime : null);\n };\n const guestName = (guest: GuestDraft) => {\n const known = guest.userId ? identities.byUserId.get(guest.userId)?.name : undefined;\n return known ?? guest.name ?? guest.email ?? tr('calendar.v2.guest', 'Guest');\n };\n return {\n me: me ? statusFrom(answerFrom(freeBusy, me), span, timeZone, ownTime) : NO_FREE_BUSY,\n guestStatus,\n guestName,\n identities,\n retry: () => {\n freeBusy.refetch();\n identities.retry();\n },\n };\n}\n\n/**\n * Whether closing would lose something: the form differs from the event as the service has it\n * (a change, a time from Find a time, what a partial save left), or a new event's from how it\n * opened. A booking the save would only put right (`planEdit`) isn't the person's change.\n */\nfunction isDirty(session: EventSession, event: CalendarEventV2 | null, timeZone: string) {\n return (\n carriesWork(session.carry) ||\n !sameForm(session.form, event ? formFromEvent(event, timeZone) : session.initial)\n );\n}\n\n/** The footer's facts: what stops a save, the room then, the person's own time, the guests. */\nfunction noteFor(\n input: {\n form: EventForm;\n event: CalendarEventV2 | null;\n issues: FormIssues;\n showIssues: boolean;\n calendarId: string | null;\n room: RoomForEvent | undefined;\n me: PersonStatus;\n },\n tr: Tr\n): FooterNote {\n const { form, room } = input;\n const roomThen =\n room && !form.allDay\n ? {\n name: room.name,\n state: roomStateAt(\n room,\n startInstant(form),\n endInstant(form),\n input.event?.eventId ?? null\n ),\n needsApproval: room.needsApproval,\n }\n : null;\n const blocked = hasIssues(input.issues) || (!input.event && !input.calendarId);\n return footerNote(\n {\n blocked: input.showIssues && blocked,\n noCalendar: !input.calendarId,\n title: form.title.trim(),\n room: roomThen,\n busy: !form.allDay && (input.me.kind === 'busy' || input.me.kind === 'away'),\n guestCount: form.guests.length,\n },\n tr\n );\n}\n\n/** The event the dialog edits and the stored event behind it, once read; none for a new one. */\nfunction editedPair(\n session: EventSession,\n edited: EditedEvent\n): { event: CalendarEventV2 | null; row: CalendarEventV2 | null; seriesDate: boolean } {\n if (!session.eventId || edited.status !== 'ready') {\n return { event: null, row: null, seriesDate: false };\n }\n return { event: edited.event, row: edited.row, seriesDate: isSeriesDate(edited.event) };\n}\n\nexport function useEventDialogModel({\n session,\n edited,\n onChange,\n onFindTime,\n onGuestsPending,\n showIssues,\n}: {\n session: EventSession;\n edited: EditedEvent;\n onChange: (change: (session: EventSession) => EventSession) => void;\n onFindTime: (session: EventSession) => void;\n onGuestsPending: (pending: boolean) => void;\n showIssues: boolean;\n}): EventDialogState {\n const page = useCalendarPage();\n const { tr, format, timeZone, me } = page;\n const { form } = session;\n const { event, row, seriesDate } = editedPair(session, edited);\n const calendar = event ? page.calendarsById.get(event.calendarId) : undefined;\n const readOnly = event !== null && !canEditEvent(event, calendar, me);\n const readBack = session.eventId ? readBackOf(edited) : null;\n const people = usePeopleTime(form, event);\n const rooms = useRoomsForEvent(endInstant(form));\n const calendarId = form.calendarId ?? page.defaultCalendarId;\n const issues = formIssues(form);\n const room = rooms.rooms.find((item) => item.id === form.roomId);\n const note = readBack\n ? reloadNote(readBack, tr)\n : noteFor({ form, event, issues, showIssues, calendarId, room, me: people.me }, tr);\n\n const model: EventDialogModel = {\n form,\n update: (change: (form: EventForm) => EventForm) =>\n onChange((current) => ({ ...current, form: change(current.form) })),\n readOnly,\n event,\n issues,\n showIssues,\n start: startInstant(form),\n end: endInstant(form),\n me: people.me,\n guestStatus: people.guestStatus,\n retryFreeBusy: people.retry,\n identities: people.identities,\n guestName: people.guestName,\n rooms,\n openFindTime: () => onFindTime(session),\n guestsPending: onGuestsPending,\n scope: seriesDate ? session.scope : null,\n };\n const organizerName = event ? people.identities.byUserId.get(event.organizerId)?.name : null;\n return {\n model,\n event,\n row,\n seriesDate,\n readOnly,\n readBack,\n dirty: isDirty(session, event, timeZone),\n toSave: !event || carriesWork(session.carry) || !isEmptyPlan(planEdit(form, event, timeZone)),\n baseline: baselineOf(session, edited, timeZone),\n calendarId,\n lock: readOnly && event ? lockReason(event, calendar, organizerName ?? null, tr) : null,\n note: readOnly ? null : note,\n heading: dialogHeading(session.eventId, readOnly, tr),\n description: headerDescription(form, tr, format),\n };\n}\n"],"mappings":";;;;;;;;;;;AAgFA,IAAMA,IAA6B;CAAE,MAAM;CAAc,MAAM;CAAM,WAAW;AAAM;AAGtF,SAASC,EAAU,GAAmB,GAA4B,GAA+B;CAC/F,IAAMC,IAAWC,EAAO,SAAS,MAAWC,EAAM,SAAS,CAACA,EAAM,MAAM,IAAI,CAAC,CAAE,CAAC,CAAC,KAAK,IAAI;CAC1F,OAAOC,QACC,CACJ,mBAAG,IAAI,IAAI;EACT,GAAIC,I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A;EACA;EACA;EACA,OAAOc,EAAQE,GAAShB,GAAOM,CAAQ;EACvC,QAAQ,CAACN,KAASe,EAAYC,EAAQ,KAAK,KAAK,CAACwC,EAAYC,EAASxD,GAAMD,GAAOM,CAAQ,CAAC;EAC5F,UAAUoD,EAAW1C,GAASc,GAAQxB,CAAQ;EAC9C;EACA,MAAM6B,KAAYnC,IAAQ2D,EAAW3D,GAAOkC,GAAUqB,KAAiB,MAAM1C,CAAE,IAAI;EACnF,MAAMsB,IAAW,OAAOW;EACxB,SAASc,EAAc5C,EAAQ,SAASmB,GAAUtB,CAAE;EACpD,aAAagD,EAAkB5D,GAAMY,GAAIiD,CAAM;CACjD;AACF"}
@@ -2,7 +2,7 @@ import { Tr } from '../data/useEventActions';
2
2
  import { CalendarFormat, DurationWords } from '../format';
3
3
  import { CalendarEventV2 } from '../types';
4
4
  import { EventForm, GuestDraft } from './eventForm';
5
- import { ScopeChoice } from './savePlan';
5
+ import { SaveCarry, ScopeChoice } from './savePlan';
6
6
  export interface EventSaveContext {
7
7
  tr: Tr;
8
8
  format: CalendarFormat;
@@ -15,22 +15,38 @@ export interface EventSaveContext {
15
15
  roomName: (roomId: string) => string | null;
16
16
  /** A guest's name, for "Couldn't add Priya Raman". */
17
17
  guestName: (guest: GuestDraft) => string;
18
+ /** The signed-in person: whose answer an event read back carries. */
19
+ me: string | null;
18
20
  }
19
21
  export interface SaveRequest {
20
22
  form: EventForm;
21
- /** The event as the service last returned it; null for a new event. */
23
+ /** The form as the dialog opened (for a series' date, at that date). */
24
+ initial: EventForm;
25
+ /** The event as the service last returned it (a series' date at that date); null when new. */
22
26
  event: CalendarEventV2 | null;
23
- /** A repeating event's answer to "Change …". */
27
+ /** The stored event behind it: for a series' date, the series at its first date. */
28
+ row: CalendarEventV2 | null;
29
+ /** A series' date: the answer to "Change …". */
24
30
  scope: ScopeChoice;
31
+ /** What a save before left undone and the event read back can't show; null when nothing. */
32
+ carry: SaveCarry | null;
25
33
  }
26
34
  export type SaveOutcome = {
27
35
  kind: 'saved';
28
36
  eventId: string;
29
37
  }
30
- /** The event saved but some of its guests, reminders or room didn't. */
38
+ /**
39
+ * The event saved but not all of it did. The dialog goes on with `eventId` (at
40
+ * `instanceDate`, a series' date); `madeNew`: the service made that event from a series (a
41
+ * date on its own, or the later part of a split), so the guests and reminders the form holds
42
+ * are new to it. `carry`: what failed that the event read back won't show, for the next save.
43
+ */
31
44
  | {
32
45
  kind: 'partial';
33
46
  eventId: string;
47
+ instanceDate: Date | null;
48
+ madeNew: boolean;
49
+ carry: SaveCarry | null;
34
50
  }
35
51
  /** Nothing changed on the service. */
36
52
  | {