@burdenoff/microfe-calendar 2026.626.1 → 2026.704.1
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.
- package/dist/components/EventBlock.js +6 -5
- package/dist/components/EventBlock.js.map +1 -1
- package/dist/graphql/calendarDocuments.js +52 -26
- package/dist/graphql/calendarDocuments.js.map +1 -1
- package/dist/hooks/useEvents.js +149 -46
- package/dist/hooks/useEvents.js.map +1 -1
- package/dist/hooks/useOpenEvent.js +1 -1
- package/dist/hooks/useOpenEvent.js.map +1 -1
- package/dist/pages/CalendarPage.js +91 -42
- package/dist/pages/CalendarPage.js.map +1 -1
- package/dist/pages/ResourcesPage.js.map +1 -1
- package/dist/providers/CalendarProvider.js +12 -10
- package/dist/providers/CalendarProvider.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,13 +3,14 @@ import { useOpenEvent as t } from "../hooks/useOpenEvent.js";
|
|
|
3
3
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/EventBlock.tsx
|
|
5
5
|
function i({ event: i }) {
|
|
6
|
-
let a = t()
|
|
6
|
+
let a = t(), o = (e) => {
|
|
7
|
+
e.stopPropagation(), a(i);
|
|
8
|
+
}, s = i.sourceKind === "task" || i.sourceKind === "milestone", c = s ? "bg-bg-canvas text-text-primary border-l-2 border-border-default hover:bg-bg-elevated" : i.sourceKind === "scheduler" ? "bg-bg-canvas text-text-primary border-border-strong hover:bg-bg-elevated" : "bg-bg-elevated text-text-primary border-border-default hover:bg-bg-canvas";
|
|
7
9
|
return /* @__PURE__ */ r("button", {
|
|
8
10
|
type: "button",
|
|
9
|
-
onClick:
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
className: `w-full text-left px-1.5 py-0.5 rounded text-xs border transition-colors cursor-pointer truncate ${i.sourceKind === "scheduler" ? "bg-bg-canvas text-text-primary border-border-strong hover:bg-bg-elevated" : "bg-bg-elevated text-text-primary border-border-default hover:bg-bg-canvas"}`,
|
|
11
|
+
onClick: o,
|
|
12
|
+
style: s ? { borderLeftColor: i.calendarColor ?? "var(--color-action-primary-bg)" } : void 0,
|
|
13
|
+
className: `w-full text-left px-1.5 py-0.5 rounded text-xs border transition-colors cursor-pointer truncate ${c}`,
|
|
13
14
|
title: `${i.title} (${e(i.startTime)} - ${e(i.endTime)})`,
|
|
14
15
|
children: [/* @__PURE__ */ n("span", {
|
|
15
16
|
className: "font-medium",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBlock.js","names":[],"sources":["../../src/components/EventBlock.tsx"],"sourcesContent":["/**\n * EventBlock — Renders a single event inside a time grid cell\n *\n * Displays the event title and time range. Clicking selects the event\n * in the calendar store for detail view.\n */\n\nimport { useOpenEvent } from '../hooks/useOpenEvent';\nimport { formatTime } from '../utils/dateHelpers';\nimport type { CalendarEvent } from '../types';\n\ninterface EventBlockProps {\n event: CalendarEvent;\n}\n\nexport function EventBlock({ event }: EventBlockProps) {\n const openEvent = useOpenEvent();\n\n const handleClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n openEvent(event);\n };\n\n const
|
|
1
|
+
{"version":3,"file":"EventBlock.js","names":[],"sources":["../../src/components/EventBlock.tsx"],"sourcesContent":["/**\n * EventBlock — Renders a single event inside a time grid cell\n *\n * Displays the event title and time range. Clicking selects the event\n * in the calendar store for detail view.\n */\n\nimport { useOpenEvent } from '../hooks/useOpenEvent';\nimport { formatTime } from '../utils/dateHelpers';\nimport type { CalendarEvent } from '../types';\n\ninterface EventBlockProps {\n event: CalendarEvent;\n}\n\nexport function EventBlock({ event }: EventBlockProps) {\n const openEvent = useOpenEvent();\n\n const handleClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n openEvent(event);\n };\n\n // Task / milestone overlay events read as a distinct layer: canvas background\n // + a colored left accent (the synthetic event's calendarColor), so they're\n // visually separable from real calendar events without inventing new tokens.\n const isOverlayEvent = event.sourceKind === 'task' || event.sourceKind === 'milestone';\n const baseClasses = isOverlayEvent\n ? 'bg-bg-canvas text-text-primary border-l-2 border-border-default hover:bg-bg-elevated'\n : event.sourceKind === 'scheduler'\n ? 'bg-bg-canvas text-text-primary border-border-strong hover:bg-bg-elevated'\n : 'bg-bg-elevated text-text-primary border-border-default hover:bg-bg-canvas';\n const overlayStyle = isOverlayEvent\n ? { borderLeftColor: event.calendarColor ?? 'var(--color-action-primary-bg)' }\n : undefined;\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n style={overlayStyle}\n className={`w-full text-left px-1.5 py-0.5 rounded text-xs border transition-colors cursor-pointer truncate ${baseClasses}`}\n title={`${event.title} (${formatTime(event.startTime)} - ${formatTime(event.endTime)})`}\n >\n <span className=\"font-medium\">{event.title}</span>\n {!event.isAllDay && <span className=\"ml-1 opacity-70\">{formatTime(event.startTime)}</span>}\n </button>\n );\n}\n"],"mappings":";;;;AAeA,SAAgB,EAAW,EAAE,YAA0B;CACrD,IAAM,IAAY,GAAc,EAE1B,KAAe,MAAwB;AAE3C,EADA,EAAE,iBAAiB,EACnB,EAAU,EAAM;IAMZ,IAAiB,EAAM,eAAe,UAAU,EAAM,eAAe,aACrE,IAAc,IAChB,yFACA,EAAM,eAAe,cACnB,6EACA;AAKN,QACE,kBAAC,UAAD;EACE,MAAK;EACL,SAAS;EACT,OARiB,IACjB,EAAE,iBAAiB,EAAM,iBAAiB,kCAAkC,GAC5E,KAAA;EAOA,WAAW,mGAAmG;EAC9G,OAAO,GAAG,EAAM,MAAM,IAAI,EAAW,EAAM,UAAU,CAAC,KAAK,EAAW,EAAM,QAAQ,CAAC;YALvF,CAOE,kBAAC,QAAD;GAAM,WAAU;aAAe,EAAM;GAAa,CAAA,EACjD,CAAC,EAAM,YAAY,kBAAC,QAAD;GAAM,WAAU;aAAmB,EAAW,EAAM,UAAU;GAAQ,CAAA,CACnF"}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { gql as e } from "@apollo/client";
|
|
2
2
|
//#region src/graphql/calendarDocuments.ts
|
|
3
3
|
var t = e`
|
|
4
|
+
query CalendarPlanmagnetWorkItems($workspaceId: ID!, $pagination: PlanmagnetPaginationInput) {
|
|
5
|
+
planmagnetWorkItems(workspaceId: $workspaceId, pagination: $pagination) {
|
|
6
|
+
items {
|
|
7
|
+
id
|
|
8
|
+
key
|
|
9
|
+
title
|
|
10
|
+
type
|
|
11
|
+
status
|
|
12
|
+
priority
|
|
13
|
+
assigneeId
|
|
14
|
+
dueDate
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`, n = e`
|
|
19
|
+
query CalendarPlanmagnetMilestones($workspaceId: ID!, $pagination: PlanmagnetPaginationInput) {
|
|
20
|
+
planmagnetMilestones(workspaceId: $workspaceId, pagination: $pagination) {
|
|
21
|
+
items {
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
status
|
|
25
|
+
dueDate
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`, r = e`
|
|
4
30
|
query CalendarEventsInRange($calendarId: ID!, $startDate: DateTime!, $endDate: DateTime!) {
|
|
5
31
|
eventsInRange(calendarId: $calendarId, startDate: $startDate, endDate: $endDate) {
|
|
6
32
|
id
|
|
@@ -67,7 +93,7 @@ var t = e`
|
|
|
67
93
|
attachments
|
|
68
94
|
}
|
|
69
95
|
}
|
|
70
|
-
`,
|
|
96
|
+
`, i = e`
|
|
71
97
|
query CalendarScheduledJobs(
|
|
72
98
|
$workspaceId: ID!
|
|
73
99
|
$nextExecutionAfter: DateTime
|
|
@@ -76,9 +102,9 @@ var t = e`
|
|
|
76
102
|
scheduledJobs(
|
|
77
103
|
workspaceId: $workspaceId
|
|
78
104
|
filter: { nextExecutionAfter: $nextExecutionAfter, nextExecutionBefore: $nextExecutionBefore }
|
|
79
|
-
pagination: {
|
|
105
|
+
pagination: { first: 100 }
|
|
80
106
|
) {
|
|
81
|
-
|
|
107
|
+
jobs {
|
|
82
108
|
id
|
|
83
109
|
name
|
|
84
110
|
description
|
|
@@ -97,7 +123,7 @@ var t = e`
|
|
|
97
123
|
}
|
|
98
124
|
}
|
|
99
125
|
}
|
|
100
|
-
`,
|
|
126
|
+
`, a = e`
|
|
101
127
|
query CalendarDetails($id: ID!) {
|
|
102
128
|
calendar(id: $id) {
|
|
103
129
|
id
|
|
@@ -130,7 +156,7 @@ var t = e`
|
|
|
130
156
|
}
|
|
131
157
|
}
|
|
132
158
|
}
|
|
133
|
-
`,
|
|
159
|
+
`, o = e`
|
|
134
160
|
query CalendarAvailabilityRules($calendarId: ID!) {
|
|
135
161
|
getAvailabilityRules(calendarId: $calendarId) {
|
|
136
162
|
id
|
|
@@ -148,7 +174,7 @@ var t = e`
|
|
|
148
174
|
priority
|
|
149
175
|
}
|
|
150
176
|
}
|
|
151
|
-
`,
|
|
177
|
+
`, s = e`
|
|
152
178
|
query CalendarBlackoutDates($calendarId: ID!, $startDate: DateTime!, $endDate: DateTime!) {
|
|
153
179
|
getBlackoutDates(calendarId: $calendarId, startDate: $startDate, endDate: $endDate) {
|
|
154
180
|
id
|
|
@@ -160,7 +186,7 @@ var t = e`
|
|
|
160
186
|
createdAt
|
|
161
187
|
}
|
|
162
188
|
}
|
|
163
|
-
`,
|
|
189
|
+
`, c = e`
|
|
164
190
|
query CalendarExternalSyncs($calendarId: ID!) {
|
|
165
191
|
getExternalCalendarSyncs(calendarId: $calendarId) {
|
|
166
192
|
id
|
|
@@ -181,7 +207,7 @@ var t = e`
|
|
|
181
207
|
updatedAt
|
|
182
208
|
}
|
|
183
209
|
}
|
|
184
|
-
`,
|
|
210
|
+
`, l = e`
|
|
185
211
|
mutation ShareCalendar(
|
|
186
212
|
$calendarId: ID!
|
|
187
213
|
$userId: String
|
|
@@ -207,11 +233,11 @@ var t = e`
|
|
|
207
233
|
createdAt
|
|
208
234
|
}
|
|
209
235
|
}
|
|
210
|
-
`,
|
|
236
|
+
`, u = e`
|
|
211
237
|
mutation RevokeCalendarShare($shareId: ID!) {
|
|
212
238
|
revokeCalendarShare(shareId: $shareId)
|
|
213
239
|
}
|
|
214
|
-
`,
|
|
240
|
+
`, d = e`
|
|
215
241
|
mutation CreateAvailabilityRule($input: CreateAvailabilityRuleInput!) {
|
|
216
242
|
createAvailabilityRule(input: $input) {
|
|
217
243
|
id
|
|
@@ -228,11 +254,11 @@ var t = e`
|
|
|
228
254
|
priority
|
|
229
255
|
}
|
|
230
256
|
}
|
|
231
|
-
`,
|
|
257
|
+
`, f = e`
|
|
232
258
|
mutation DeleteAvailabilityRule($id: ID!) {
|
|
233
259
|
deleteAvailabilityRule(id: $id)
|
|
234
260
|
}
|
|
235
|
-
`,
|
|
261
|
+
`, p = e`
|
|
236
262
|
mutation CreateBlackoutDate($input: CreateBlackoutDateInput!) {
|
|
237
263
|
createBlackoutDate(input: $input) {
|
|
238
264
|
id
|
|
@@ -244,11 +270,11 @@ var t = e`
|
|
|
244
270
|
createdAt
|
|
245
271
|
}
|
|
246
272
|
}
|
|
247
|
-
`,
|
|
273
|
+
`, m = e`
|
|
248
274
|
mutation DeleteBlackoutDate($id: ID!) {
|
|
249
275
|
deleteBlackoutDate(id: $id)
|
|
250
276
|
}
|
|
251
|
-
`,
|
|
277
|
+
`, h = e`
|
|
252
278
|
mutation CreateBookingPage($input: CreateBookingPageInput!) {
|
|
253
279
|
createBookingPage(input: $input) {
|
|
254
280
|
id
|
|
@@ -263,11 +289,11 @@ var t = e`
|
|
|
263
289
|
maxAttendees
|
|
264
290
|
}
|
|
265
291
|
}
|
|
266
|
-
`,
|
|
292
|
+
`, g = e`
|
|
267
293
|
mutation DeleteBookingPage($id: ID!) {
|
|
268
294
|
deleteBookingPage(id: $id)
|
|
269
295
|
}
|
|
270
|
-
`,
|
|
296
|
+
`, _ = e`
|
|
271
297
|
mutation ConnectExternalCalendar($input: ConnectExternalCalendarInput!) {
|
|
272
298
|
connectExternalCalendar(input: $input) {
|
|
273
299
|
id
|
|
@@ -284,7 +310,7 @@ var t = e`
|
|
|
284
310
|
nextSyncAt
|
|
285
311
|
}
|
|
286
312
|
}
|
|
287
|
-
`,
|
|
313
|
+
`, v = e`
|
|
288
314
|
mutation TriggerExternalCalendarSync($syncId: ID!) {
|
|
289
315
|
triggerSync(syncId: $syncId) {
|
|
290
316
|
id
|
|
@@ -295,7 +321,7 @@ var t = e`
|
|
|
295
321
|
nextSyncAt
|
|
296
322
|
}
|
|
297
323
|
}
|
|
298
|
-
`,
|
|
324
|
+
`, y = e`
|
|
299
325
|
mutation PauseExternalCalendarSync($syncId: ID!) {
|
|
300
326
|
pauseSync(syncId: $syncId) {
|
|
301
327
|
id
|
|
@@ -303,7 +329,7 @@ var t = e`
|
|
|
303
329
|
syncEnabled
|
|
304
330
|
}
|
|
305
331
|
}
|
|
306
|
-
`,
|
|
332
|
+
`, b = e`
|
|
307
333
|
mutation ResumeExternalCalendarSync($syncId: ID!) {
|
|
308
334
|
resumeSync(syncId: $syncId) {
|
|
309
335
|
id
|
|
@@ -311,11 +337,11 @@ var t = e`
|
|
|
311
337
|
syncEnabled
|
|
312
338
|
}
|
|
313
339
|
}
|
|
314
|
-
`,
|
|
340
|
+
`, x = e`
|
|
315
341
|
mutation DisconnectExternalCalendar($syncId: ID!) {
|
|
316
342
|
disconnectExternalCalendar(syncId: $syncId)
|
|
317
343
|
}
|
|
318
|
-
`,
|
|
344
|
+
`, S = e`
|
|
319
345
|
mutation AddCalendarAttendee($eventId: ID!, $userId: String, $email: String, $name: String) {
|
|
320
346
|
addAttendee(eventId: $eventId, userId: $userId, email: $email, name: $name) {
|
|
321
347
|
id
|
|
@@ -326,11 +352,11 @@ var t = e`
|
|
|
326
352
|
isOptional
|
|
327
353
|
}
|
|
328
354
|
}
|
|
329
|
-
`,
|
|
355
|
+
`, C = e`
|
|
330
356
|
mutation RemoveCalendarAttendee($attendeeId: ID!) {
|
|
331
357
|
removeAttendee(attendeeId: $attendeeId)
|
|
332
358
|
}
|
|
333
|
-
`,
|
|
359
|
+
`, w = e`
|
|
334
360
|
mutation RespondToCalendarEvent($eventId: ID!, $status: RSVPStatus!) {
|
|
335
361
|
respondToEvent(eventId: $eventId, status: $status) {
|
|
336
362
|
id
|
|
@@ -341,7 +367,7 @@ var t = e`
|
|
|
341
367
|
isOptional
|
|
342
368
|
}
|
|
343
369
|
}
|
|
344
|
-
`,
|
|
370
|
+
`, T = e`
|
|
345
371
|
mutation CreateCalendarReminder($input: CreateReminderInput!) {
|
|
346
372
|
createReminder(input: $input) {
|
|
347
373
|
id
|
|
@@ -349,12 +375,12 @@ var t = e`
|
|
|
349
375
|
channel
|
|
350
376
|
}
|
|
351
377
|
}
|
|
352
|
-
`,
|
|
378
|
+
`, E = e`
|
|
353
379
|
mutation DeleteCalendarReminder($id: ID!) {
|
|
354
380
|
deleteReminder(id: $id)
|
|
355
381
|
}
|
|
356
382
|
`;
|
|
357
383
|
//#endregion
|
|
358
|
-
export {
|
|
384
|
+
export { S as ADD_ATTENDEE_MUTATION, o as AVAILABILITY_RULES_QUERY, s as BLACKOUT_DATES_QUERY, a as CALENDAR_DETAILS_QUERY, _ as CONNECT_EXTERNAL_CALENDAR_MUTATION, d as CREATE_AVAILABILITY_RULE_MUTATION, p as CREATE_BLACKOUT_DATE_MUTATION, h as CREATE_BOOKING_PAGE_MUTATION, T as CREATE_REMINDER_MUTATION, f as DELETE_AVAILABILITY_RULE_MUTATION, m as DELETE_BLACKOUT_DATE_MUTATION, g as DELETE_BOOKING_PAGE_MUTATION, E as DELETE_REMINDER_MUTATION, x as DISCONNECT_EXTERNAL_CALENDAR_MUTATION, r as EVENTS_IN_RANGE_QUERY, c as EXTERNAL_SYNCS_QUERY, y as PAUSE_SYNC_MUTATION, n as PLANMAGNET_MILESTONES_QUERY, t as PLANMAGNET_WORK_ITEMS_QUERY, C as REMOVE_ATTENDEE_MUTATION, w as RESPOND_TO_EVENT_MUTATION, b as RESUME_SYNC_MUTATION, u as REVOKE_CALENDAR_SHARE_MUTATION, i as SCHEDULED_JOBS_QUERY, l as SHARE_CALENDAR_MUTATION, v as TRIGGER_SYNC_MUTATION };
|
|
359
385
|
|
|
360
386
|
//# sourceMappingURL=calendarDocuments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendarDocuments.js","names":[],"sources":["../../src/graphql/calendarDocuments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const EVENTS_IN_RANGE_QUERY = gql`\n query CalendarEventsInRange($calendarId: ID!, $startDate: DateTime!, $endDate: DateTime!) {\n eventsInRange(calendarId: $calendarId, startDate: $startDate, endDate: $endDate) {\n id\n calendarId\n workspaceId\n title\n description\n location\n locationAddress\n locationType\n locationUrl\n startTime\n endTime\n allDay\n timezone\n status\n visibility\n eventType\n isRecurring\n rrule\n tags\n maxAttendees\n currentAttendeeCount\n checkInEnabled\n onlineMeetingUrl\n onlineMeetingProvider\n metadata\n createdBy\n createdAt\n updatedAt\n calendar {\n id\n name\n color\n }\n attendees {\n id\n userId\n email\n name\n rsvpStatus\n isOptional\n }\n reminders {\n id\n minutesBefore\n channel\n }\n resourceBookings {\n id\n resourceId\n startTime\n endTime\n status\n notes\n resource {\n id\n name\n resourceType\n location\n capacity\n }\n }\n attachments\n }\n }\n`;\n\nexport const SCHEDULED_JOBS_QUERY = gql`\n query CalendarScheduledJobs(\n $workspaceId: ID!\n $nextExecutionAfter: DateTime\n $nextExecutionBefore: DateTime\n ) {\n scheduledJobs(\n workspaceId: $workspaceId\n filter: { nextExecutionAfter: $nextExecutionAfter, nextExecutionBefore: $nextExecutionBefore }\n pagination: { limit: 100, offset: 0 }\n ) {\n scheduledJobs {\n id\n name\n description\n scheduleType\n status\n priority\n scheduledAt\n nextExecutionAt\n lastExecutionAt\n timezone\n tags\n actionId\n metadata\n createdAt\n updatedAt\n }\n }\n }\n`;\n\nexport const CALENDAR_DETAILS_QUERY = gql`\n query CalendarDetails($id: ID!) {\n calendar(id: $id) {\n id\n name\n description\n color\n timezone\n calendarType\n isPublic\n isDefault\n shares {\n id\n userId\n teamId\n canView\n canEdit\n canManage\n createdAt\n }\n bookingPages {\n id\n name\n slug\n pageType\n eventDuration\n isActive\n isPublic\n requireApproval\n maxAttendees\n }\n }\n }\n`;\n\nexport const AVAILABILITY_RULES_QUERY = gql`\n query CalendarAvailabilityRules($calendarId: ID!) {\n getAvailabilityRules(calendarId: $calendarId) {\n id\n dayOfWeek\n isAvailable\n startTime\n endTime\n timezone\n bufferBefore\n bufferAfter\n minGapBetweenEvents\n slotIncrement\n minNotice\n maxNotice\n priority\n }\n }\n`;\n\nexport const BLACKOUT_DATES_QUERY = gql`\n query CalendarBlackoutDates($calendarId: ID!, $startDate: DateTime!, $endDate: DateTime!) {\n getBlackoutDates(calendarId: $calendarId, startDate: $startDate, endDate: $endDate) {\n id\n startDate\n endDate\n reason\n isRecurring\n recurrencePattern\n createdAt\n }\n }\n`;\n\nexport const EXTERNAL_SYNCS_QUERY = gql`\n query CalendarExternalSyncs($calendarId: ID!) {\n getExternalCalendarSyncs(calendarId: $calendarId) {\n id\n calendarId\n provider\n externalCalendarId\n externalCalendarName\n direction\n syncEnabled\n syncFrequency\n conflictResolution\n status\n lastSyncAt\n lastSyncStatus\n lastSyncError\n nextSyncAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const SHARE_CALENDAR_MUTATION = gql`\n mutation ShareCalendar(\n $calendarId: ID!\n $userId: String\n $teamId: String\n $canView: Boolean!\n $canEdit: Boolean!\n $canManage: Boolean!\n ) {\n shareCalendar(\n calendarId: $calendarId\n userId: $userId\n teamId: $teamId\n canView: $canView\n canEdit: $canEdit\n canManage: $canManage\n ) {\n id\n userId\n teamId\n canView\n canEdit\n canManage\n createdAt\n }\n }\n`;\n\nexport const REVOKE_CALENDAR_SHARE_MUTATION = gql`\n mutation RevokeCalendarShare($shareId: ID!) {\n revokeCalendarShare(shareId: $shareId)\n }\n`;\n\nexport const CREATE_AVAILABILITY_RULE_MUTATION = gql`\n mutation CreateAvailabilityRule($input: CreateAvailabilityRuleInput!) {\n createAvailabilityRule(input: $input) {\n id\n dayOfWeek\n isAvailable\n startTime\n endTime\n timezone\n bufferBefore\n bufferAfter\n slotIncrement\n minNotice\n maxNotice\n priority\n }\n }\n`;\n\nexport const DELETE_AVAILABILITY_RULE_MUTATION = gql`\n mutation DeleteAvailabilityRule($id: ID!) {\n deleteAvailabilityRule(id: $id)\n }\n`;\n\nexport const CREATE_BLACKOUT_DATE_MUTATION = gql`\n mutation CreateBlackoutDate($input: CreateBlackoutDateInput!) {\n createBlackoutDate(input: $input) {\n id\n startDate\n endDate\n reason\n isRecurring\n recurrencePattern\n createdAt\n }\n }\n`;\n\nexport const DELETE_BLACKOUT_DATE_MUTATION = gql`\n mutation DeleteBlackoutDate($id: ID!) {\n deleteBlackoutDate(id: $id)\n }\n`;\n\nexport const CREATE_BOOKING_PAGE_MUTATION = gql`\n mutation CreateBookingPage($input: CreateBookingPageInput!) {\n createBookingPage(input: $input) {\n id\n calendarId\n name\n slug\n pageType\n eventDuration\n isActive\n isPublic\n requireApproval\n maxAttendees\n }\n }\n`;\n\nexport const DELETE_BOOKING_PAGE_MUTATION = gql`\n mutation DeleteBookingPage($id: ID!) {\n deleteBookingPage(id: $id)\n }\n`;\n\nexport const CONNECT_EXTERNAL_CALENDAR_MUTATION = gql`\n mutation ConnectExternalCalendar($input: ConnectExternalCalendarInput!) {\n connectExternalCalendar(input: $input) {\n id\n provider\n externalCalendarId\n externalCalendarName\n direction\n syncEnabled\n syncFrequency\n conflictResolution\n status\n lastSyncStatus\n lastSyncError\n nextSyncAt\n }\n }\n`;\n\nexport const TRIGGER_SYNC_MUTATION = gql`\n mutation TriggerExternalCalendarSync($syncId: ID!) {\n triggerSync(syncId: $syncId) {\n id\n status\n lastSyncAt\n lastSyncStatus\n lastSyncError\n nextSyncAt\n }\n }\n`;\n\nexport const PAUSE_SYNC_MUTATION = gql`\n mutation PauseExternalCalendarSync($syncId: ID!) {\n pauseSync(syncId: $syncId) {\n id\n status\n syncEnabled\n }\n }\n`;\n\nexport const RESUME_SYNC_MUTATION = gql`\n mutation ResumeExternalCalendarSync($syncId: ID!) {\n resumeSync(syncId: $syncId) {\n id\n status\n syncEnabled\n }\n }\n`;\n\nexport const DISCONNECT_EXTERNAL_CALENDAR_MUTATION = gql`\n mutation DisconnectExternalCalendar($syncId: ID!) {\n disconnectExternalCalendar(syncId: $syncId)\n }\n`;\n\nexport const ADD_ATTENDEE_MUTATION = gql`\n mutation AddCalendarAttendee($eventId: ID!, $userId: String, $email: String, $name: String) {\n addAttendee(eventId: $eventId, userId: $userId, email: $email, name: $name) {\n id\n userId\n email\n name\n rsvpStatus\n isOptional\n }\n }\n`;\n\nexport const REMOVE_ATTENDEE_MUTATION = gql`\n mutation RemoveCalendarAttendee($attendeeId: ID!) {\n removeAttendee(attendeeId: $attendeeId)\n }\n`;\n\nexport const RESPOND_TO_EVENT_MUTATION = gql`\n mutation RespondToCalendarEvent($eventId: ID!, $status: RSVPStatus!) {\n respondToEvent(eventId: $eventId, status: $status) {\n id\n userId\n email\n name\n rsvpStatus\n isOptional\n }\n }\n`;\n\nexport const CREATE_REMINDER_MUTATION = gql`\n mutation CreateCalendarReminder($input: CreateReminderInput!) {\n createReminder(input: $input) {\n id\n minutesBefore\n channel\n }\n }\n`;\n\nexport const DELETE_REMINDER_MUTATION = gql`\n mutation DeleteCalendarReminder($id: ID!) {\n deleteReminder(id: $id)\n }\n`;\n"],"mappings":";;AAEA,IAAa,IAAwB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqE3B,IAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgC1B,IAAyB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmC5B,IAA2B,CAAG;;;;;;;;;;;;;;;;;;GAoB9B,IAAuB,CAAG;;;;;;;;;;;;GAc1B,IAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;GAuB1B,IAA0B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GA4B7B,IAAiC,CAAG;;;;GAMpC,IAAoC,CAAG;;;;;;;;;;;;;;;;;GAmBvC,IAAoC,CAAG;;;;GAMvC,IAAgC,CAAG;;;;;;;;;;;;GAcnC,IAAgC,CAAG;;;;GAMnC,IAA+B,CAAG;;;;;;;;;;;;;;;GAiBlC,IAA+B,CAAG;;;;GAMlC,IAAqC,CAAG;;;;;;;;;;;;;;;;;GAmBxC,IAAwB,CAAG;;;;;;;;;;;GAa3B,IAAsB,CAAG;;;;;;;;GAUzB,IAAuB,CAAG;;;;;;;;GAU1B,IAAwC,CAAG;;;;GAM3C,IAAwB,CAAG;;;;;;;;;;;GAa3B,IAA2B,CAAG;;;;GAM9B,IAA4B,CAAG;;;;;;;;;;;GAa/B,IAA2B,CAAG;;;;;;;;GAU9B,IAA2B,CAAG"}
|
|
1
|
+
{"version":3,"file":"calendarDocuments.js","names":[],"sources":["../../src/graphql/calendarDocuments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\n/**\n * PlanMagnet work items for the task overlay. Deliberately selects a MINIMAL\n * field set and does NOT select `sortOrder` — that field is `Int!` in the SDL\n * but backed by the Prisma `position` column, and selecting it triggers a\n * gateway serialization crash on some paths (the same class of bug the svc\n * field-resolver fix addresses). We only need enough to place + label + link a\n * task on the calendar. Workspace-scoped, no date filter exists on the list\n * query, so we page a generous window and filter by dueDate client-side.\n */\nexport const PLANMAGNET_WORK_ITEMS_QUERY = gql`\n query CalendarPlanmagnetWorkItems($workspaceId: ID!, $pagination: PlanmagnetPaginationInput) {\n planmagnetWorkItems(workspaceId: $workspaceId, pagination: $pagination) {\n items {\n id\n key\n title\n type\n status\n priority\n assigneeId\n dueDate\n }\n }\n }\n`;\n\nexport const PLANMAGNET_MILESTONES_QUERY = gql`\n query CalendarPlanmagnetMilestones($workspaceId: ID!, $pagination: PlanmagnetPaginationInput) {\n planmagnetMilestones(workspaceId: $workspaceId, pagination: $pagination) {\n items {\n id\n name\n status\n dueDate\n }\n }\n }\n`;\n\nexport const EVENTS_IN_RANGE_QUERY = gql`\n query CalendarEventsInRange($calendarId: ID!, $startDate: DateTime!, $endDate: DateTime!) {\n eventsInRange(calendarId: $calendarId, startDate: $startDate, endDate: $endDate) {\n id\n calendarId\n workspaceId\n title\n description\n location\n locationAddress\n locationType\n locationUrl\n startTime\n endTime\n allDay\n timezone\n status\n visibility\n eventType\n isRecurring\n rrule\n tags\n maxAttendees\n currentAttendeeCount\n checkInEnabled\n onlineMeetingUrl\n onlineMeetingProvider\n metadata\n createdBy\n createdAt\n updatedAt\n calendar {\n id\n name\n color\n }\n attendees {\n id\n userId\n email\n name\n rsvpStatus\n isOptional\n }\n reminders {\n id\n minutesBefore\n channel\n }\n resourceBookings {\n id\n resourceId\n startTime\n endTime\n status\n notes\n resource {\n id\n name\n resourceType\n location\n capacity\n }\n }\n attachments\n }\n }\n`;\n\nexport const SCHEDULED_JOBS_QUERY = gql`\n query CalendarScheduledJobs(\n $workspaceId: ID!\n $nextExecutionAfter: DateTime\n $nextExecutionBefore: DateTime\n ) {\n scheduledJobs(\n workspaceId: $workspaceId\n filter: { nextExecutionAfter: $nextExecutionAfter, nextExecutionBefore: $nextExecutionBefore }\n pagination: { first: 100 }\n ) {\n jobs {\n id\n name\n description\n scheduleType\n status\n priority\n scheduledAt\n nextExecutionAt\n lastExecutionAt\n timezone\n tags\n actionId\n metadata\n createdAt\n updatedAt\n }\n }\n }\n`;\n\nexport const CALENDAR_DETAILS_QUERY = gql`\n query CalendarDetails($id: ID!) {\n calendar(id: $id) {\n id\n name\n description\n color\n timezone\n calendarType\n isPublic\n isDefault\n shares {\n id\n userId\n teamId\n canView\n canEdit\n canManage\n createdAt\n }\n bookingPages {\n id\n name\n slug\n pageType\n eventDuration\n isActive\n isPublic\n requireApproval\n maxAttendees\n }\n }\n }\n`;\n\nexport const AVAILABILITY_RULES_QUERY = gql`\n query CalendarAvailabilityRules($calendarId: ID!) {\n getAvailabilityRules(calendarId: $calendarId) {\n id\n dayOfWeek\n isAvailable\n startTime\n endTime\n timezone\n bufferBefore\n bufferAfter\n minGapBetweenEvents\n slotIncrement\n minNotice\n maxNotice\n priority\n }\n }\n`;\n\nexport const BLACKOUT_DATES_QUERY = gql`\n query CalendarBlackoutDates($calendarId: ID!, $startDate: DateTime!, $endDate: DateTime!) {\n getBlackoutDates(calendarId: $calendarId, startDate: $startDate, endDate: $endDate) {\n id\n startDate\n endDate\n reason\n isRecurring\n recurrencePattern\n createdAt\n }\n }\n`;\n\nexport const EXTERNAL_SYNCS_QUERY = gql`\n query CalendarExternalSyncs($calendarId: ID!) {\n getExternalCalendarSyncs(calendarId: $calendarId) {\n id\n calendarId\n provider\n externalCalendarId\n externalCalendarName\n direction\n syncEnabled\n syncFrequency\n conflictResolution\n status\n lastSyncAt\n lastSyncStatus\n lastSyncError\n nextSyncAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const SHARE_CALENDAR_MUTATION = gql`\n mutation ShareCalendar(\n $calendarId: ID!\n $userId: String\n $teamId: String\n $canView: Boolean!\n $canEdit: Boolean!\n $canManage: Boolean!\n ) {\n shareCalendar(\n calendarId: $calendarId\n userId: $userId\n teamId: $teamId\n canView: $canView\n canEdit: $canEdit\n canManage: $canManage\n ) {\n id\n userId\n teamId\n canView\n canEdit\n canManage\n createdAt\n }\n }\n`;\n\nexport const REVOKE_CALENDAR_SHARE_MUTATION = gql`\n mutation RevokeCalendarShare($shareId: ID!) {\n revokeCalendarShare(shareId: $shareId)\n }\n`;\n\nexport const CREATE_AVAILABILITY_RULE_MUTATION = gql`\n mutation CreateAvailabilityRule($input: CreateAvailabilityRuleInput!) {\n createAvailabilityRule(input: $input) {\n id\n dayOfWeek\n isAvailable\n startTime\n endTime\n timezone\n bufferBefore\n bufferAfter\n slotIncrement\n minNotice\n maxNotice\n priority\n }\n }\n`;\n\nexport const DELETE_AVAILABILITY_RULE_MUTATION = gql`\n mutation DeleteAvailabilityRule($id: ID!) {\n deleteAvailabilityRule(id: $id)\n }\n`;\n\nexport const CREATE_BLACKOUT_DATE_MUTATION = gql`\n mutation CreateBlackoutDate($input: CreateBlackoutDateInput!) {\n createBlackoutDate(input: $input) {\n id\n startDate\n endDate\n reason\n isRecurring\n recurrencePattern\n createdAt\n }\n }\n`;\n\nexport const DELETE_BLACKOUT_DATE_MUTATION = gql`\n mutation DeleteBlackoutDate($id: ID!) {\n deleteBlackoutDate(id: $id)\n }\n`;\n\nexport const CREATE_BOOKING_PAGE_MUTATION = gql`\n mutation CreateBookingPage($input: CreateBookingPageInput!) {\n createBookingPage(input: $input) {\n id\n calendarId\n name\n slug\n pageType\n eventDuration\n isActive\n isPublic\n requireApproval\n maxAttendees\n }\n }\n`;\n\nexport const DELETE_BOOKING_PAGE_MUTATION = gql`\n mutation DeleteBookingPage($id: ID!) {\n deleteBookingPage(id: $id)\n }\n`;\n\nexport const CONNECT_EXTERNAL_CALENDAR_MUTATION = gql`\n mutation ConnectExternalCalendar($input: ConnectExternalCalendarInput!) {\n connectExternalCalendar(input: $input) {\n id\n provider\n externalCalendarId\n externalCalendarName\n direction\n syncEnabled\n syncFrequency\n conflictResolution\n status\n lastSyncStatus\n lastSyncError\n nextSyncAt\n }\n }\n`;\n\nexport const TRIGGER_SYNC_MUTATION = gql`\n mutation TriggerExternalCalendarSync($syncId: ID!) {\n triggerSync(syncId: $syncId) {\n id\n status\n lastSyncAt\n lastSyncStatus\n lastSyncError\n nextSyncAt\n }\n }\n`;\n\nexport const PAUSE_SYNC_MUTATION = gql`\n mutation PauseExternalCalendarSync($syncId: ID!) {\n pauseSync(syncId: $syncId) {\n id\n status\n syncEnabled\n }\n }\n`;\n\nexport const RESUME_SYNC_MUTATION = gql`\n mutation ResumeExternalCalendarSync($syncId: ID!) {\n resumeSync(syncId: $syncId) {\n id\n status\n syncEnabled\n }\n }\n`;\n\nexport const DISCONNECT_EXTERNAL_CALENDAR_MUTATION = gql`\n mutation DisconnectExternalCalendar($syncId: ID!) {\n disconnectExternalCalendar(syncId: $syncId)\n }\n`;\n\nexport const ADD_ATTENDEE_MUTATION = gql`\n mutation AddCalendarAttendee($eventId: ID!, $userId: String, $email: String, $name: String) {\n addAttendee(eventId: $eventId, userId: $userId, email: $email, name: $name) {\n id\n userId\n email\n name\n rsvpStatus\n isOptional\n }\n }\n`;\n\nexport const REMOVE_ATTENDEE_MUTATION = gql`\n mutation RemoveCalendarAttendee($attendeeId: ID!) {\n removeAttendee(attendeeId: $attendeeId)\n }\n`;\n\nexport const RESPOND_TO_EVENT_MUTATION = gql`\n mutation RespondToCalendarEvent($eventId: ID!, $status: RSVPStatus!) {\n respondToEvent(eventId: $eventId, status: $status) {\n id\n userId\n email\n name\n rsvpStatus\n isOptional\n }\n }\n`;\n\nexport const CREATE_REMINDER_MUTATION = gql`\n mutation CreateCalendarReminder($input: CreateReminderInput!) {\n createReminder(input: $input) {\n id\n minutesBefore\n channel\n }\n }\n`;\n\nexport const DELETE_REMINDER_MUTATION = gql`\n mutation DeleteCalendarReminder($id: ID!) {\n deleteReminder(id: $id)\n }\n`;\n"],"mappings":";;AAWA,IAAa,IAA8B,CAAG;;;;;;;;;;;;;;;GAiBjC,IAA8B,CAAG;;;;;;;;;;;GAajC,IAAwB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqE3B,IAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgC1B,IAAyB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmC5B,IAA2B,CAAG;;;;;;;;;;;;;;;;;;GAoB9B,IAAuB,CAAG;;;;;;;;;;;;GAc1B,IAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;GAuB1B,IAA0B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GA4B7B,IAAiC,CAAG;;;;GAMpC,IAAoC,CAAG;;;;;;;;;;;;;;;;;GAmBvC,IAAoC,CAAG;;;;GAMvC,IAAgC,CAAG;;;;;;;;;;;;GAcnC,IAAgC,CAAG;;;;GAMnC,IAA+B,CAAG;;;;;;;;;;;;;;;GAiBlC,IAA+B,CAAG;;;;GAMlC,IAAqC,CAAG;;;;;;;;;;;;;;;;;GAmBxC,IAAwB,CAAG;;;;;;;;;;;GAa3B,IAAsB,CAAG;;;;;;;;GAUzB,IAAuB,CAAG;;;;;;;;GAU1B,IAAwC,CAAG;;;;GAM3C,IAAwB,CAAG;;;;;;;;;;;GAa3B,IAA2B,CAAG;;;;GAM9B,IAA4B,CAAG;;;;;;;;;;;GAa/B,IAA2B,CAAG;;;;;;;;GAU9B,IAA2B,CAAG"}
|
package/dist/hooks/useEvents.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useCalendar as e } from "../providers/CalendarProvider.js";
|
|
2
2
|
import { useGetCalendarsQuery as t } from "../generated/wspace-operations.js";
|
|
3
3
|
import { useCalendarStore as n } from "../store/calendarStore.js";
|
|
4
|
-
import { EVENTS_IN_RANGE_QUERY as r,
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { useApolloClient as
|
|
4
|
+
import { EVENTS_IN_RANGE_QUERY as r, PLANMAGNET_MILESTONES_QUERY as i, PLANMAGNET_WORK_ITEMS_QUERY as a, SCHEDULED_JOBS_QUERY as o } from "../graphql/calendarDocuments.js";
|
|
5
|
+
import { useEffect as s, useMemo as c, useState as l } from "react";
|
|
6
|
+
import { useApolloClient as u } from "@apollo/client/react";
|
|
7
7
|
//#region src/hooks/useEvents.ts
|
|
8
|
-
|
|
8
|
+
var d = 300;
|
|
9
|
+
function f(e) {
|
|
9
10
|
return e ? e.reduce((e, t, n) => {
|
|
10
11
|
let r = t.url ?? t.fileUrl ?? "", i = t.name ?? t.fileName ?? `Attachment ${n + 1}`;
|
|
11
12
|
return !r && !t.fileId || e.push({
|
|
@@ -18,7 +19,7 @@ function l(e) {
|
|
|
18
19
|
}), e;
|
|
19
20
|
}, []) : [];
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function p(e) {
|
|
22
23
|
return {
|
|
23
24
|
id: e.id,
|
|
24
25
|
calendarId: e.calendarId,
|
|
@@ -64,7 +65,7 @@ function u(e) {
|
|
|
64
65
|
status: t.status ?? "PENDING",
|
|
65
66
|
createdAt: new Date(e.createdAt)
|
|
66
67
|
})) ?? [],
|
|
67
|
-
attachments:
|
|
68
|
+
attachments: f(e.attachments),
|
|
68
69
|
videoCallLink: e.onlineMeetingUrl ?? void 0,
|
|
69
70
|
onlineMeetingProvider: e.onlineMeetingProvider ?? void 0,
|
|
70
71
|
maxAttendees: e.maxAttendees ?? void 0,
|
|
@@ -77,7 +78,7 @@ function u(e) {
|
|
|
77
78
|
updatedAt: new Date(e.updatedAt)
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
+
function m(e) {
|
|
81
82
|
let t = e.nextExecutionAt ?? e.scheduledAt ?? e.lastExecutionAt;
|
|
82
83
|
if (!t) return null;
|
|
83
84
|
let n = new Date(t), r = new Date(n.getTime() + 1800 * 1e3), i = e.status === "CANCELLED" || e.status === "FAILED" || e.status === "DISABLED" ? "CANCELLED" : e.status === "PAUSED" ? "TENTATIVE" : "CONFIRMED";
|
|
@@ -108,8 +109,79 @@ function d(e) {
|
|
|
108
109
|
updatedAt: new Date(e.updatedAt)
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
var h = new Set(["DONE", "CANCELLED"]), g = new Set(["COMPLETED", "CANCELLED"]);
|
|
113
|
+
function _(e) {
|
|
114
|
+
if (!e) return null;
|
|
115
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})/.exec(e);
|
|
116
|
+
if (!t) {
|
|
117
|
+
let t = new Date(e);
|
|
118
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
119
|
+
}
|
|
120
|
+
return new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
|
|
121
|
+
}
|
|
122
|
+
function v(e, t) {
|
|
123
|
+
let n = _(e.dueDate);
|
|
124
|
+
return !n || e.status && h.has(e.status) ? null : {
|
|
125
|
+
id: `task-${e.id}`,
|
|
126
|
+
calendarId: "__tasks__",
|
|
127
|
+
calendarName: "Tasks",
|
|
128
|
+
calendarColor: "var(--color-accent-blue)",
|
|
129
|
+
title: e.title,
|
|
130
|
+
startTime: n,
|
|
131
|
+
endTime: new Date(n.getTime()),
|
|
132
|
+
isAllDay: !0,
|
|
133
|
+
privacy: "PRIVATE",
|
|
134
|
+
status: "CONFIRMED",
|
|
135
|
+
eventType: "TASK",
|
|
136
|
+
organizerId: e.assigneeId ?? "planmagnet",
|
|
137
|
+
tags: [],
|
|
138
|
+
metadata: {
|
|
139
|
+
source: "planmagnet",
|
|
140
|
+
entityType: "workItem",
|
|
141
|
+
workItemId: e.id,
|
|
142
|
+
key: e.key ?? void 0,
|
|
143
|
+
status: e.status ?? void 0,
|
|
144
|
+
priority: e.priority ?? void 0,
|
|
145
|
+
assigneeId: e.assigneeId ?? void 0
|
|
146
|
+
},
|
|
147
|
+
sourceKind: "task",
|
|
148
|
+
deepLink: `${t}?item=${encodeURIComponent(e.id)}`,
|
|
149
|
+
createdAt: n,
|
|
150
|
+
updatedAt: n
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function y(e, t) {
|
|
154
|
+
let n = _(e.dueDate);
|
|
155
|
+
return !n || e.status && g.has(e.status) ? null : {
|
|
156
|
+
id: `milestone-${e.id}`,
|
|
157
|
+
calendarId: "__milestones__",
|
|
158
|
+
calendarName: "Milestones",
|
|
159
|
+
calendarColor: "var(--color-accent-purple)",
|
|
160
|
+
title: e.name,
|
|
161
|
+
startTime: n,
|
|
162
|
+
endTime: new Date(n.getTime()),
|
|
163
|
+
isAllDay: !0,
|
|
164
|
+
privacy: "PRIVATE",
|
|
165
|
+
status: "CONFIRMED",
|
|
166
|
+
eventType: "MILESTONE",
|
|
167
|
+
organizerId: "planmagnet",
|
|
168
|
+
tags: [],
|
|
169
|
+
metadata: {
|
|
170
|
+
source: "planmagnet",
|
|
171
|
+
entityType: "milestone",
|
|
172
|
+
milestoneId: e.id,
|
|
173
|
+
status: e.status ?? void 0
|
|
174
|
+
},
|
|
175
|
+
sourceKind: "milestone",
|
|
176
|
+
deepLink: t,
|
|
177
|
+
createdAt: n,
|
|
178
|
+
updatedAt: n
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function b(e, t) {
|
|
112
182
|
return e.filter((e) => {
|
|
183
|
+
if (e.sourceKind === "task") return t.showTasks !== !1;
|
|
184
|
+
if (e.sourceKind === "milestone") return t.showMilestones !== !1;
|
|
113
185
|
if (t.calendarIds?.length && !t.calendarIds.includes(e.calendarId) || t.status?.length && !t.status.includes(e.status) || t.privacy?.length && !t.privacy.includes(e.privacy)) return !1;
|
|
114
186
|
if (t.attendeeIds?.length) {
|
|
115
187
|
let n = e.attendees?.flatMap((e) => e.userId ? [e.userId] : []) ?? [];
|
|
@@ -129,77 +201,108 @@ function f(e, t) {
|
|
|
129
201
|
return !0;
|
|
130
202
|
});
|
|
131
203
|
}
|
|
132
|
-
function
|
|
133
|
-
let
|
|
204
|
+
function x({ startDate: f, endDate: h, skip: g = !1 }) {
|
|
205
|
+
let _ = u(), { workspaceId: x, taskOverlay: S } = e(), C = n((e) => e.visibleCalendars), w = n((e) => e.eventFilter), { data: T, loading: E, refetch: D } = t({
|
|
134
206
|
variables: { pagination: { limit: 50 } },
|
|
135
|
-
skip:
|
|
207
|
+
skip: g,
|
|
136
208
|
fetchPolicy: "cache-and-network"
|
|
137
|
-
}), [
|
|
138
|
-
let e =
|
|
139
|
-
return (
|
|
209
|
+
}), [O, k] = l([]), [A, j] = l(!1), [M, N] = l(null), [P, F] = l(0), I = c(() => T?.calendars?.calendars ?? [], [T?.calendars?.calendars]), L = c(() => {
|
|
210
|
+
let e = I.map((e) => e.id), t = C.size > 0 ? Array.from(C) : e;
|
|
211
|
+
return (w.calendarIds?.length ? w.calendarIds : t).filter((t) => e.includes(t));
|
|
140
212
|
}, [
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
213
|
+
I,
|
|
214
|
+
w.calendarIds,
|
|
215
|
+
C
|
|
144
216
|
]);
|
|
145
|
-
return
|
|
217
|
+
return s(() => {
|
|
146
218
|
let e = !1;
|
|
147
219
|
return (async () => {
|
|
148
|
-
if (!(
|
|
149
|
-
|
|
220
|
+
if (!(g || E)) {
|
|
221
|
+
j(!0), N(null);
|
|
150
222
|
try {
|
|
151
|
-
let t = await Promise.allSettled(
|
|
223
|
+
let t = await Promise.allSettled(L.map((e) => _.query({
|
|
152
224
|
query: r,
|
|
153
225
|
variables: {
|
|
154
226
|
calendarId: e,
|
|
155
|
-
startDate:
|
|
156
|
-
endDate:
|
|
227
|
+
startDate: f.toISOString(),
|
|
228
|
+
endDate: h.toISOString()
|
|
157
229
|
},
|
|
158
230
|
fetchPolicy: "network-only"
|
|
159
231
|
}))), n = t.some((e) => e.status === "fulfilled");
|
|
160
|
-
if (
|
|
232
|
+
if (L.length > 0 && !n) {
|
|
161
233
|
let e = t.find((e) => e.status === "rejected")?.reason;
|
|
162
234
|
throw e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load events");
|
|
163
235
|
}
|
|
164
|
-
let
|
|
165
|
-
query:
|
|
236
|
+
let s = t.flatMap((e) => e.status === "fulfilled" ? e.value.data?.eventsInRange ?? [] : []), c = ((x ? await _.query({
|
|
237
|
+
query: o,
|
|
166
238
|
variables: {
|
|
167
|
-
workspaceId:
|
|
168
|
-
nextExecutionAfter:
|
|
169
|
-
nextExecutionBefore:
|
|
239
|
+
workspaceId: x,
|
|
240
|
+
nextExecutionAfter: f.toISOString(),
|
|
241
|
+
nextExecutionBefore: h.toISOString()
|
|
170
242
|
},
|
|
171
243
|
fetchPolicy: "network-only"
|
|
172
|
-
}).catch(() => null) : null)?.data?.scheduledJobs?.
|
|
173
|
-
|
|
244
|
+
}).catch(() => null) : null)?.data?.scheduledJobs?.jobs ?? []).map(m).filter((e) => !!e), l = S?.tasksPath, u = [];
|
|
245
|
+
if (l && x) {
|
|
246
|
+
let [e, t] = await Promise.all([_.query({
|
|
247
|
+
query: a,
|
|
248
|
+
variables: {
|
|
249
|
+
workspaceId: x,
|
|
250
|
+
pagination: { first: d }
|
|
251
|
+
},
|
|
252
|
+
fetchPolicy: "network-only"
|
|
253
|
+
}).catch(() => null), _.query({
|
|
254
|
+
query: i,
|
|
255
|
+
variables: {
|
|
256
|
+
workspaceId: x,
|
|
257
|
+
pagination: { first: d }
|
|
258
|
+
},
|
|
259
|
+
fetchPolicy: "network-only"
|
|
260
|
+
}).catch(() => null)]), n = (e) => e.startTime.getTime() >= f.getTime() && e.startTime.getTime() <= h.getTime();
|
|
261
|
+
for (let t of e?.data?.planmagnetWorkItems?.items ?? []) {
|
|
262
|
+
let e = v(t, l);
|
|
263
|
+
e && n(e) && u.push(e);
|
|
264
|
+
}
|
|
265
|
+
for (let e of t?.data?.planmagnetMilestones?.items ?? []) {
|
|
266
|
+
let t = y(e, l);
|
|
267
|
+
t && n(t) && u.push(t);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
let g = b([
|
|
271
|
+
...s.map(p),
|
|
272
|
+
...c,
|
|
273
|
+
...u
|
|
274
|
+
].sort((e, t) => e.startTime.getTime() - t.startTime.getTime()), w);
|
|
275
|
+
e || k(g);
|
|
174
276
|
} catch (t) {
|
|
175
|
-
e || (
|
|
277
|
+
e || (N(t instanceof Error ? t.message : "Failed to load events"), k([]));
|
|
176
278
|
} finally {
|
|
177
|
-
e ||
|
|
279
|
+
e || j(!1);
|
|
178
280
|
}
|
|
179
281
|
}
|
|
180
282
|
})(), () => {
|
|
181
283
|
e = !0;
|
|
182
284
|
};
|
|
183
285
|
}, [
|
|
184
|
-
|
|
185
|
-
|
|
286
|
+
L,
|
|
287
|
+
E,
|
|
288
|
+
_,
|
|
186
289
|
h,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
290
|
+
w,
|
|
291
|
+
P,
|
|
292
|
+
g,
|
|
293
|
+
f,
|
|
294
|
+
x,
|
|
295
|
+
S?.tasksPath
|
|
193
296
|
]), {
|
|
194
|
-
events:
|
|
195
|
-
isLoading:
|
|
196
|
-
error:
|
|
297
|
+
events: O,
|
|
298
|
+
isLoading: A || E,
|
|
299
|
+
error: M,
|
|
197
300
|
refetch: async () => {
|
|
198
|
-
await
|
|
301
|
+
await D().catch(() => {}), F((e) => e + 1);
|
|
199
302
|
}
|
|
200
303
|
};
|
|
201
304
|
}
|
|
202
305
|
//#endregion
|
|
203
|
-
export {
|
|
306
|
+
export { x as useEvents };
|
|
204
307
|
|
|
205
308
|
//# sourceMappingURL=useEvents.js.map
|