@rapidmx/web-client 0.4.0 → 0.6.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.
- package/README.md +88 -0
- package/apps/admin/audit-log/index.tsx +35 -8
- package/apps/admin/data-requests/index.tsx +480 -485
- package/apps/admin/distribution-lists/[uid].tsx +19 -1
- package/apps/admin/escrow-scopes/[uid].tsx +348 -237
- package/apps/admin/escrow-scopes/new/index.tsx +8 -2
- package/apps/admin/index.tsx +19 -1
- package/apps/admin/ingest-queue/index.tsx +44 -5
- package/apps/admin/mailboxes/[uid].tsx +211 -184
- package/apps/admin/quarantine/index.tsx +46 -14
- package/apps/admin/transport-rules/[uid].tsx +30 -1
- package/apps/admin/transport-rules/_transportRuleConfig.tsx +38 -2
- package/apps/admin/transport-rules/index.tsx +24 -6
- package/apps/admin/transport-rules/new/index.tsx +30 -1
- package/apps/escrow/_layout.tsx +2 -3
- package/apps/escrow/audit-log/index.tsx +196 -168
- package/apps/escrow/matters/[uid].tsx +621 -521
- package/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.tsx +22 -1
- package/apps/shared/components/admin/layout/AdminShell.tsx +28 -9
- package/apps/shared/components/admin/mailboxes/EscrowScopeCard.tsx +152 -0
- package/apps/shared/components/admin/mailboxes/ResourceSettingsCard.tsx +3 -3
- package/apps/shared/components/admin/mailboxes/ShareAccessCard.tsx +55 -11
- package/apps/shared/components/admin/settings/BrandingForm.tsx +15 -4
- package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +18 -7
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +10 -2
- package/apps/shared/components/admin/settings/MailboxCreateForm.tsx +6 -0
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +45 -12
- package/apps/shared/components/admin/settings/PluginsManager.tsx +1235 -595
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +174 -98
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +49 -13
- package/apps/shared/components/admin/setup/SetupWizard.tsx +150 -34
- package/apps/shared/components/admin/signOut.ts +79 -0
- package/apps/shared/components/admin/usePagedList.tsx +129 -0
- package/apps/shared/components/calendar/EventModal.tsx +717 -549
- package/apps/shared/components/calendar/MonthView.tsx +173 -139
- package/apps/shared/components/calendar/RecurrenceEditor.tsx +222 -180
- package/apps/shared/components/calendar/SplitDayView.tsx +143 -137
- package/apps/shared/components/calendar/TimeGridView.tsx +244 -198
- package/apps/shared/components/calendar/allDay.ts +124 -0
- package/apps/shared/components/calendar/layout/CalendarShell.tsx +194 -192
- package/apps/shared/components/contacts/ContactDetailPane.tsx +100 -21
- package/apps/shared/components/contacts/ContactForm.tsx +377 -348
- package/apps/shared/components/contacts/ContactsSidebar.tsx +6 -2
- package/apps/shared/components/contacts/KeyChangeReview.tsx +192 -0
- package/apps/shared/components/contacts/contactKeys.ts +78 -0
- package/apps/shared/components/contacts/layout/ContactsShell.tsx +199 -197
- package/apps/shared/components/escrow/layout/EscrowShell.tsx +148 -134
- package/apps/shared/components/layout/AppShell.tsx +123 -33
- package/apps/shared/components/layout/BrandingChrome.tsx +48 -10
- package/apps/shared/components/layout/KeyEnrollmentGate.tsx +389 -298
- package/apps/shared/components/layout/MailboxProvisioning.tsx +19 -3
- package/apps/shared/components/layout/RecoveryCodeUnlock.tsx +350 -0
- package/apps/shared/components/layout/UnlockPromptProvider.tsx +257 -128
- package/apps/shared/components/mail/ConversationThreadPane.tsx +216 -181
- package/apps/shared/components/mail/MessageDetailPane.tsx +1318 -630
- package/apps/shared/components/mail/compose/ComposeContext.tsx +20 -15
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +854 -132
- package/apps/shared/components/mail/compose/composeFlushRegistry.ts +60 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +420 -408
- package/apps/shared/components/mail/pinnedSigners.ts +124 -0
- package/apps/shared/components/mail/verificationSeals.ts +125 -0
- package/apps/shared/components/mail/writableMailboxes.ts +101 -0
- package/apps/shared/components/rules/RuleBuilder.tsx +311 -276
- package/apps/shared/components/settings/layout/SettingsShell.tsx +23 -9
- package/apps/shared/components/tasks/layout/TasksShell.tsx +201 -199
- package/apps/shared/mail/listAllPages.ts +39 -0
- package/apps/shared/plugins/pluginNav.ts +73 -0
- package/apps/shared/search/LocalIndexLifecycle.tsx +64 -55
- package/apps/shared/search/localIndexBuilder.ts +481 -179
- package/apps/shared/search/localIndexRpcClient.ts +231 -29
- package/apps/shared/search/localIndexSchema.ts +15 -6
- package/apps/shared/search/localIndexStorage.ts +98 -0
- package/apps/shared/search/localIndexVFS.ts +32 -1
- package/apps/shared/search/localIndexWorker.ts +648 -186
- package/apps/www/calendar/index.tsx +438 -417
- package/apps/www/contacts/[uid].tsx +21 -2
- package/apps/www/contacts/index.tsx +116 -12
- package/apps/www/index.tsx +1314 -1041
- package/apps/www/messages/[uid].tsx +18 -6
- package/apps/www/settings/auto-reply/index.tsx +134 -129
- package/apps/www/settings/encryption/index.tsx +739 -216
- package/apps/www/settings/filters/[uid].tsx +171 -155
- package/apps/www/settings/filters/new/index.tsx +8 -1
- package/apps/www/settings/focused-inbox/index.tsx +150 -148
- package/apps/www/settings/privacy/index.tsx +494 -436
- package/apps/www/settings/read-receipts/index.tsx +148 -125
- package/apps/www/settings/sharing/index.tsx +17 -14
- package/apps/www/tasks/index.tsx +638 -579
- package/dist/apps/admin/_404.d.ts +2 -0
- package/dist/apps/admin/_500.d.ts +2 -0
- package/dist/apps/admin/_layout.d.ts +8 -0
- package/dist/apps/admin/audit-log/index.d.ts +11 -0
- package/dist/apps/admin/audit-log/index.js +38 -8
- package/dist/apps/admin/branding/index.d.ts +3 -0
- package/dist/apps/admin/data-requests/index.d.ts +3 -0
- package/dist/apps/admin/data-requests/index.js +52 -72
- package/dist/apps/admin/distribution-lists/[uid].d.ts +7 -0
- package/dist/apps/admin/distribution-lists/[uid].js +1 -1
- package/dist/apps/admin/distribution-lists/index.d.ts +3 -0
- package/dist/apps/admin/distribution-lists/new/index.d.ts +3 -0
- package/dist/apps/admin/domains/[uid].d.ts +7 -0
- package/dist/apps/admin/domains/index.d.ts +3 -0
- package/dist/apps/admin/domains/new/index.d.ts +3 -0
- package/dist/apps/admin/encryption-policy/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/[uid].d.ts +21 -0
- package/dist/apps/admin/escrow-scopes/[uid].js +91 -12
- package/dist/apps/admin/escrow-scopes/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/new/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/new/index.js +8 -3
- package/dist/apps/admin/index.d.ts +3 -0
- package/dist/apps/admin/index.js +4 -1
- package/dist/apps/admin/ingest-queue/index.d.ts +4 -0
- package/dist/apps/admin/ingest-queue/index.js +24 -6
- package/dist/apps/admin/mailbox-policy/index.d.ts +3 -0
- package/dist/apps/admin/mailboxes/[uid].d.ts +7 -0
- package/dist/apps/admin/mailboxes/[uid].js +20 -4
- package/dist/apps/admin/mailboxes/new/index.d.ts +3 -0
- package/dist/apps/admin/plugins/index.d.ts +3 -0
- package/dist/apps/admin/quarantine/index.d.ts +6 -0
- package/dist/apps/admin/quarantine/index.js +20 -11
- package/dist/apps/admin/retention-policy/index.d.ts +3 -0
- package/dist/apps/admin/setup/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/[uid].d.ts +7 -0
- package/dist/apps/admin/transport-rules/[uid].js +18 -2
- package/dist/apps/admin/transport-rules/_transportRuleConfig.d.ts +21 -0
- package/dist/apps/admin/transport-rules/_transportRuleConfig.js +19 -0
- package/dist/apps/admin/transport-rules/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/index.js +22 -6
- package/dist/apps/admin/transport-rules/new/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/new/index.js +18 -2
- package/dist/apps/escrow/_layout.d.ts +10 -0
- package/dist/apps/escrow/_layout.js +3 -3
- package/dist/apps/escrow/audit-log/index.d.ts +9 -0
- package/dist/apps/escrow/audit-log/index.js +26 -1
- package/dist/apps/escrow/index.d.ts +3 -0
- package/dist/apps/escrow/matters/[uid].d.ts +7 -0
- package/dist/apps/escrow/matters/[uid].js +77 -42
- package/dist/apps/escrow/matters/new/index.d.ts +3 -0
- package/dist/apps/shared/components/admin/distributionLists/MemberListCard.d.ts +17 -0
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.d.ts +32 -0
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.js +11 -2
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +32 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.js +15 -6
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.js +72 -0
- package/dist/apps/shared/components/admin/mailboxes/MailboxTable.d.ts +6 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.d.ts +19 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.js +3 -3
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.js +22 -4
- package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +15 -4
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +13 -7
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.js +7 -2
- package/dist/apps/shared/components/admin/settings/LoadedSettingsForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.d.ts +19 -0
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.js +6 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.d.ts +10 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.js +34 -12
- package/dist/apps/shared/components/admin/settings/PluginsManager.d.ts +4 -0
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +390 -78
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.js +40 -11
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.d.ts +14 -0
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.js +29 -13
- package/dist/apps/shared/components/admin/setup/SetupWizard.d.ts +36 -0
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +87 -21
- package/dist/apps/shared/components/admin/signOut.d.ts +23 -0
- package/dist/apps/shared/components/admin/signOut.js +75 -0
- package/dist/apps/shared/components/admin/usePagedList.d.ts +39 -0
- package/dist/apps/shared/components/admin/usePagedList.js +99 -0
- package/dist/apps/shared/components/calendar/CalendarListSidebar.d.ts +26 -0
- package/dist/apps/shared/components/calendar/EventModal.d.ts +46 -0
- package/dist/apps/shared/components/calendar/EventModal.js +142 -21
- package/dist/apps/shared/components/calendar/MonthView.d.ts +15 -0
- package/dist/apps/shared/components/calendar/MonthView.js +12 -5
- package/dist/apps/shared/components/calendar/RecurrenceEditor.d.ts +20 -0
- package/dist/apps/shared/components/calendar/RecurrenceEditor.js +40 -5
- package/dist/apps/shared/components/calendar/ResourcePicker.d.ts +19 -0
- package/dist/apps/shared/components/calendar/SplitDayView.d.ts +28 -0
- package/dist/apps/shared/components/calendar/SplitDayView.js +10 -4
- package/dist/apps/shared/components/calendar/TimeGridView.d.ts +17 -0
- package/dist/apps/shared/components/calendar/TimeGridView.js +23 -7
- package/dist/apps/shared/components/calendar/allDay.d.ts +51 -0
- package/dist/apps/shared/components/calendar/allDay.js +111 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.d.ts +40 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +3 -3
- package/dist/apps/shared/components/contacts/ContactDetailPane.d.ts +23 -0
- package/dist/apps/shared/components/contacts/ContactDetailPane.js +43 -5
- package/dist/apps/shared/components/contacts/ContactForm.d.ts +20 -0
- package/dist/apps/shared/components/contacts/ContactForm.js +32 -10
- package/dist/apps/shared/components/contacts/ContactsSidebar.d.ts +40 -0
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +2 -2
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +25 -0
- package/dist/apps/shared/components/contacts/KeyChangeReview.d.ts +40 -0
- package/dist/apps/shared/components/contacts/KeyChangeReview.js +63 -0
- package/dist/apps/shared/components/contacts/contactKeys.d.ts +29 -0
- package/dist/apps/shared/components/contacts/contactKeys.js +64 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.d.ts +21 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.js +2 -2
- package/dist/apps/shared/components/escrow/layout/EscrowShell.d.ts +25 -0
- package/dist/apps/shared/components/escrow/layout/EscrowShell.js +24 -5
- package/dist/apps/shared/components/forms/StringListField.d.ts +22 -0
- package/dist/apps/shared/components/layout/AppShell.d.ts +49 -0
- package/dist/apps/shared/components/layout/AppShell.js +97 -26
- package/dist/apps/shared/components/layout/BrandingChrome.d.ts +18 -0
- package/dist/apps/shared/components/layout/BrandingChrome.js +45 -10
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.d.ts +51 -0
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.js +49 -12
- package/dist/apps/shared/components/layout/MailboxProvisioning.d.ts +13 -0
- package/dist/apps/shared/components/layout/MailboxProvisioning.js +10 -2
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.d.ts +66 -0
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.js +174 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.d.ts +45 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.js +73 -14
- package/dist/apps/shared/components/layout/UserMenu.d.ts +23 -0
- package/dist/apps/shared/components/mail/ConversationList.d.ts +11 -0
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +23 -0
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +50 -12
- package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +93 -0
- package/dist/apps/shared/components/mail/MessageDetailPane.js +441 -36
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +58 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +9 -6
- package/dist/apps/shared/components/mail/compose/ComposeToolbar.d.ts +15 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +37 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +699 -128
- package/dist/apps/shared/components/mail/compose/EmojiPicker.d.ts +14 -0
- package/dist/apps/shared/components/mail/compose/GifPicker.d.ts +13 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +34 -0
- package/dist/apps/shared/components/mail/compose/ScheduleSendPicker.d.ts +16 -0
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.d.ts +27 -0
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.js +50 -0
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +57 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +13 -4
- package/dist/apps/shared/components/mail/pinnedSigners.d.ts +33 -0
- package/dist/apps/shared/components/mail/pinnedSigners.js +98 -0
- package/dist/apps/shared/components/mail/verificationSeals.d.ts +22 -0
- package/dist/apps/shared/components/mail/verificationSeals.js +112 -0
- package/dist/apps/shared/components/mail/writableMailboxes.d.ts +15 -0
- package/dist/apps/shared/components/mail/writableMailboxes.js +87 -0
- package/dist/apps/shared/components/rules/RuleBuilder.d.ts +70 -0
- package/dist/apps/shared/components/rules/RuleBuilder.js +34 -6
- package/dist/apps/shared/components/settings/layout/SettingsShell.d.ts +41 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +19 -9
- package/dist/apps/shared/components/tasks/TasksSidebar.d.ts +41 -0
- package/dist/apps/shared/components/tasks/TasksToolbar.d.ts +14 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.d.ts +24 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.js +2 -2
- package/dist/apps/shared/mail/findWellKnownFolderUid.d.ts +5 -0
- package/dist/apps/shared/mail/listAllPages.d.ts +17 -0
- package/dist/apps/shared/mail/listAllPages.js +25 -0
- package/dist/apps/shared/plugins/pluginNav.d.ts +39 -0
- package/dist/apps/shared/plugins/pluginNav.js +33 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.d.ts +13 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.js +58 -54
- package/dist/apps/shared/search/localIndexBlockCipher.d.ts +36 -0
- package/dist/apps/shared/search/localIndexBuilder.d.ts +85 -0
- package/dist/apps/shared/search/localIndexBuilder.js +292 -37
- package/dist/apps/shared/search/localIndexKey.d.ts +4 -0
- package/dist/apps/shared/search/localIndexRpcClient.d.ts +71 -0
- package/dist/apps/shared/search/localIndexRpcClient.js +191 -26
- package/dist/apps/shared/search/localIndexSchema.d.ts +111 -0
- package/dist/apps/shared/search/localIndexSchema.js +12 -6
- package/dist/apps/shared/search/localIndexSizePreference.d.ts +27 -0
- package/dist/apps/shared/search/localIndexStorage.d.ts +28 -0
- package/dist/apps/shared/search/localIndexStorage.js +86 -0
- package/dist/apps/shared/search/localIndexVFS.d.ts +101 -0
- package/dist/apps/shared/search/localIndexVFS.js +68 -40
- package/dist/apps/shared/search/localIndexWorker.d.ts +145 -0
- package/dist/apps/shared/search/localIndexWorker.js +519 -173
- package/dist/apps/shared/search/searchTier2.d.ts +30 -0
- package/dist/apps/www/_404.d.ts +2 -0
- package/dist/apps/www/_500.d.ts +2 -0
- package/dist/apps/www/_layout.d.ts +14 -0
- package/dist/apps/www/calendar/index.d.ts +3 -0
- package/dist/apps/www/calendar/index.js +28 -10
- package/dist/apps/www/contacts/[uid].d.ts +13 -0
- package/dist/apps/www/contacts/[uid].js +13 -2
- package/dist/apps/www/contacts/index.d.ts +3 -0
- package/dist/apps/www/contacts/index.js +80 -10
- package/dist/apps/www/index.d.ts +3 -0
- package/dist/apps/www/index.js +339 -108
- package/dist/apps/www/messages/[uid].d.ts +11 -0
- package/dist/apps/www/messages/[uid].js +18 -6
- package/dist/apps/www/settings/auto-reply/index.d.ts +4 -0
- package/dist/apps/www/settings/auto-reply/index.js +9 -4
- package/dist/apps/www/settings/encryption/index.d.ts +7 -0
- package/dist/apps/www/settings/encryption/index.js +514 -97
- package/dist/apps/www/settings/filters/[uid].d.ts +8 -0
- package/dist/apps/www/settings/filters/[uid].js +22 -7
- package/dist/apps/www/settings/filters/_mailFilterRuleConfig.d.ts +11 -0
- package/dist/apps/www/settings/filters/index.d.ts +4 -0
- package/dist/apps/www/settings/filters/new/index.d.ts +4 -0
- package/dist/apps/www/settings/filters/new/index.js +8 -2
- package/dist/apps/www/settings/focused-inbox/index.d.ts +4 -0
- package/dist/apps/www/settings/focused-inbox/index.js +3 -1
- package/dist/apps/www/settings/labels/index.d.ts +4 -0
- package/dist/apps/www/settings/privacy/index.d.ts +4 -0
- package/dist/apps/www/settings/privacy/index.js +57 -22
- package/dist/apps/www/settings/read-receipts/index.d.ts +4 -0
- package/dist/apps/www/settings/read-receipts/index.js +10 -3
- package/dist/apps/www/settings/sharing/index.d.ts +4 -0
- package/dist/apps/www/settings/sharing/index.js +7 -11
- package/dist/apps/www/settings/signatures/[uid].d.ts +8 -0
- package/dist/apps/www/settings/signatures/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/new/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/signatureDefaults.d.ts +10 -0
- package/dist/apps/www/tasks/index.d.ts +3 -0
- package/dist/apps/www/tasks/index.js +50 -10
- package/package.json +3 -3
- package/apps/shared/components/booking/AvailabilityEditor.tsx +0 -118
- package/apps/www/settings/booking-types/[uid].tsx +0 -300
- package/apps/www/settings/booking-types/index.tsx +0 -98
- package/apps/www/settings/booking-types/new/index.tsx +0 -212
- package/dist/apps/shared/components/booking/AvailabilityEditor.js +0 -45
- package/dist/apps/www/settings/booking-types/[uid].js +0 -129
- package/dist/apps/www/settings/booking-types/index.js +0 -29
- package/dist/apps/www/settings/booking-types/new/index.js +0 -86
|
@@ -1,549 +1,717 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
-
import React, { FormEvent, useRef, useState } from "react";
|
|
6
|
-
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
-
import {
|
|
8
|
-
Attendee,
|
|
9
|
-
AttendeeResponseInput,
|
|
10
|
-
AttendeeResponseStatus,
|
|
11
|
-
AttendeeRole,
|
|
12
|
-
BusyStatus,
|
|
13
|
-
CalendarEventInput,
|
|
14
|
-
RecurrenceRule,
|
|
15
|
-
createCalendarEvent,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
"text-sm py-2 px-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
>
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
<
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
>
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
>
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React, { FormEvent, useRef, useState } from "react";
|
|
6
|
+
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
+
import {
|
|
8
|
+
Attendee,
|
|
9
|
+
AttendeeResponseInput,
|
|
10
|
+
AttendeeResponseStatus,
|
|
11
|
+
AttendeeRole,
|
|
12
|
+
BusyStatus,
|
|
13
|
+
CalendarEventInput,
|
|
14
|
+
RecurrenceRule,
|
|
15
|
+
createCalendarEvent,
|
|
16
|
+
getCalendarEvent,
|
|
17
|
+
respondToEvent,
|
|
18
|
+
updateCalendarEvent,
|
|
19
|
+
} from "@rapidmx/react-shared/calendar/calendarApi.js";
|
|
20
|
+
import { deleteEventOccurrence, deleteEventSeries, detachOccurrence, saveEventSeries } from "@rapidmx/react-shared/calendar/calendarMutations.js";
|
|
21
|
+
import { toDatetimeLocal } from "@rapidmx/react-shared/util/dateInput.js";
|
|
22
|
+
import { Mailbox } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
23
|
+
import { CalendarOccurrence, fromEventWallClock, toEventWallClock } from "@rapidmx/react-shared/calendar/recurrence.js";
|
|
24
|
+
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
25
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
26
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
27
|
+
import FormField from "@rapidmx/react-shared/components/forms/FormField.js";
|
|
28
|
+
import RecurrenceEditor from "./RecurrenceEditor.js";
|
|
29
|
+
import { addDaysToKey, allDayDateKey, allDayInstant, recurrenceUntilDateKey, recurrenceUntilInstant, startWeekdayCode } from "./allDay.js";
|
|
30
|
+
import ResourcePicker from "./ResourcePicker.js";
|
|
31
|
+
|
|
32
|
+
const INPUT_CLASS =
|
|
33
|
+
"w-full text-sm py-2 px-3 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary";
|
|
34
|
+
const SELECT_CLASS =
|
|
35
|
+
"text-sm py-2 px-2 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary";
|
|
36
|
+
|
|
37
|
+
const ATTENDEE_ROLES: AttendeeRole[] = ["required", "optional", "resource"];
|
|
38
|
+
const BUSY_STATUSES: BusyStatus[] = ["busy", "free", "tentative", "oof"];
|
|
39
|
+
const BUSY_STATUS_LABEL: Record<BusyStatus, string> = { busy: "Busy", free: "Free", tentative: "Tentative", oof: "Out of office" };
|
|
40
|
+
const RESPONSE_STATUS_LABEL: Record<AttendeeResponseStatus, string> = {
|
|
41
|
+
needsAction: "Awaiting response",
|
|
42
|
+
accepted: "Accepted",
|
|
43
|
+
declined: "Declined",
|
|
44
|
+
tentative: "Tentative",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export interface EventModalProps {
|
|
48
|
+
open: boolean;
|
|
49
|
+
onClose: () => void;
|
|
50
|
+
mailboxUid: string;
|
|
51
|
+
/** The calendar folder a new event is created into (ignored when editing — an existing event keeps
|
|
52
|
+
* its own `folderUid`). When `calendars` names more than one option, a "Calendar" selector lets the
|
|
53
|
+
* user override this default before saving. */
|
|
54
|
+
folderUid: string;
|
|
55
|
+
/** Every calendar the caller could create this event into. Omitted, or a single entry, means "only
|
|
56
|
+
* one calendar exists" — no selector is shown and `folderUid` is used as-is, matching this
|
|
57
|
+
* component's original single-calendar behavior exactly. */
|
|
58
|
+
calendars?: { uid: string; name: string }[];
|
|
59
|
+
/** Every mailbox a new event could be created in, each with its own calendars. With more than one, a
|
|
60
|
+
* "Mailbox" selector (create mode only) chooses the mailbox, which in turn drives the Calendar selector
|
|
61
|
+
* and the organizer address; `mailboxUid`/`folderUid` are the initial selection. */
|
|
62
|
+
mailboxOptions?: { mailbox: Mailbox; calendars: { uid: string; name: string }[] }[];
|
|
63
|
+
organizerAddress: string;
|
|
64
|
+
/** The viewing mailbox's alias addresses - an event it organizes (or an invitation to it) may name any of
|
|
65
|
+
* them instead of `organizerAddress`. Defaults to that mailbox's `aliasAddresses` from `mailboxOptions`. */
|
|
66
|
+
organizerAliases?: string[];
|
|
67
|
+
/** `null` when creating a new event. */
|
|
68
|
+
occurrence: CalendarOccurrence | null;
|
|
69
|
+
/** Prefilled start/end for create mode (e.g. the day/slot the user clicked). */
|
|
70
|
+
initialStart?: Date;
|
|
71
|
+
initialEnd?: Date;
|
|
72
|
+
onSaved: () => void;
|
|
73
|
+
onDeleted: () => void;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type EditScope = "occurrence" | "series";
|
|
77
|
+
|
|
78
|
+
/** `CalendarEventInput` fields as sent on save. `null` explicitly clears a field on an update - an
|
|
79
|
+
* omitted (`undefined`) field is dropped by `JSON.stringify` and would leave the stored value in place. */
|
|
80
|
+
type EventFields = { [K in keyof CalendarEventInput]?: CalendarEventInput[K] | null };
|
|
81
|
+
|
|
82
|
+
const MS_PER_MINUTE = 60_000;
|
|
83
|
+
const MS_PER_DAY = 86_400_000;
|
|
84
|
+
|
|
85
|
+
/** Whether two ISO instants fall in the same minute - a stored `...T15:00:00Z` and the form's re-serialized
|
|
86
|
+
* `...T15:00:00.000Z` name the same time without being equal strings. */
|
|
87
|
+
function sameMinute(a: string, b: string): boolean {
|
|
88
|
+
return Math.round(new Date(a).getTime() / MS_PER_MINUTE) === Math.round(new Date(b).getTime() / MS_PER_MINUTE);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Milliseconds since midnight of an instant's wall clock in `timezone` (a timed event's own zone). */
|
|
92
|
+
function wallTimeOfDayMs(instantMs: number, timezone: string | undefined): number {
|
|
93
|
+
const wall = toEventWallClock(instantMs, timezone, false);
|
|
94
|
+
return ((wall % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Rewrites an edited occurrence's `startDate`/`endDate` for a save to the entire series. The modal only
|
|
99
|
+
* ever shows (and edits) *this occurrence's* dates, but the series is stored as its master record starting
|
|
100
|
+
* at the first occurrence - sending the occurrence's dates as-is would move the whole series' start to
|
|
101
|
+
* this occurrence. So only the change in time-of-day (and the new duration) is applied to the master's own
|
|
102
|
+
* start; the series keeps its original first date. Unchanged times aren't sent at all.
|
|
103
|
+
*
|
|
104
|
+
* Times of day are read on the event's own timezone wall clock (the series expands there), not the
|
|
105
|
+
* browser's, and the change is the smallest signed difference modulo 24h - moving 23:00 to 01:00 is two
|
|
106
|
+
* hours later (into the next day), never 22 hours earlier. The master's new start is converted back from
|
|
107
|
+
* that wall clock, so a master on the other side of a DST change keeps the chosen local time.
|
|
108
|
+
*/
|
|
109
|
+
async function toSeriesFields(occurrence: CalendarOccurrence, fields: EventFields): Promise<EventFields> {
|
|
110
|
+
const { startDate, endDate, ...rest } = fields;
|
|
111
|
+
if (sameMinute(startDate as string, occurrence.startDate) && sameMinute(endDate as string, occurrence.endDate)) {
|
|
112
|
+
return rest;
|
|
113
|
+
}
|
|
114
|
+
const master = await getCalendarEvent(occurrence.uid);
|
|
115
|
+
const timezone = fields.timezone as string;
|
|
116
|
+
const newStart = new Date(startDate as string).getTime();
|
|
117
|
+
const durationMs = new Date(endDate as string).getTime() - newStart;
|
|
118
|
+
let masterStart: number;
|
|
119
|
+
if (fields.allDay) {
|
|
120
|
+
// Timed -> all-day keeps the master's own date on its wall clock.
|
|
121
|
+
const masterDateKey = master.allDay
|
|
122
|
+
? allDayDateKey(master.startDate)
|
|
123
|
+
: new Date(toEventWallClock(new Date(master.startDate).getTime(), timezone, false)).toISOString().slice(0, 10);
|
|
124
|
+
masterStart = new Date(allDayInstant(masterDateKey)).getTime();
|
|
125
|
+
} else if (master.allDay) {
|
|
126
|
+
// All-day -> timed: the master's own date at the newly chosen wall-clock time.
|
|
127
|
+
const masterDateWall = new Date(allDayInstant(allDayDateKey(master.startDate))).getTime();
|
|
128
|
+
masterStart = fromEventWallClock(masterDateWall + wallTimeOfDayMs(newStart, timezone), timezone, false);
|
|
129
|
+
} else {
|
|
130
|
+
const rawDelta = wallTimeOfDayMs(newStart, timezone) - wallTimeOfDayMs(new Date(occurrence.startDate).getTime(), timezone);
|
|
131
|
+
const delta = ((((rawDelta + MS_PER_DAY / 2) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY) - MS_PER_DAY / 2;
|
|
132
|
+
const masterWall = toEventWallClock(new Date(master.startDate).getTime(), timezone, false);
|
|
133
|
+
masterStart = fromEventWallClock(masterWall + delta, timezone, false);
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
...rest,
|
|
137
|
+
startDate: new Date(masterStart).toISOString(),
|
|
138
|
+
endDate: new Date(masterStart + durationMs).toISOString(),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Create/view/edit/delete for a single calendar event. Editing or deleting a recurring event's
|
|
144
|
+
* occurrence offers a choice between "this event" and "the entire series" (see
|
|
145
|
+
* `calendarMutations.ts`) — Outlook's own convention for the same ambiguity.
|
|
146
|
+
*/
|
|
147
|
+
export default function EventModal({
|
|
148
|
+
open,
|
|
149
|
+
onClose,
|
|
150
|
+
mailboxUid,
|
|
151
|
+
folderUid,
|
|
152
|
+
calendars,
|
|
153
|
+
mailboxOptions,
|
|
154
|
+
organizerAddress,
|
|
155
|
+
organizerAliases,
|
|
156
|
+
occurrence,
|
|
157
|
+
initialStart,
|
|
158
|
+
initialEnd,
|
|
159
|
+
onSaved,
|
|
160
|
+
onDeleted,
|
|
161
|
+
}: EventModalProps) {
|
|
162
|
+
const [targetFolderUid, setTargetFolderUid] = useState(folderUid);
|
|
163
|
+
const [targetMailboxUid, setTargetMailboxUid] = useState(mailboxUid);
|
|
164
|
+
const targetMailboxOption = mailboxOptions?.find((option) => option.mailbox.uid === targetMailboxUid);
|
|
165
|
+
// Create mode follows the chosen mailbox; editing an existing event always keeps the passed-in values.
|
|
166
|
+
const calendarChoices = !occurrence && targetMailboxOption ? targetMailboxOption.calendars : calendars;
|
|
167
|
+
const effectiveOrganizerAddress = !occurrence && targetMailboxOption ? targetMailboxOption.mailbox.primarySmtpAddress : organizerAddress;
|
|
168
|
+
// Every address the viewing mailbox receives at - its primary address and its aliases, case-insensitively.
|
|
169
|
+
const ownAddresses = new Set(
|
|
170
|
+
[organizerAddress, ...(organizerAliases ?? mailboxOptions?.find((option) => option.mailbox.uid === mailboxUid)?.mailbox.aliasAddresses ?? [])].map(
|
|
171
|
+
(address) => address.toLowerCase(),
|
|
172
|
+
),
|
|
173
|
+
);
|
|
174
|
+
const isOwnAddress = (address: string) => ownAddresses.has(address.toLowerCase());
|
|
175
|
+
// An existing event organized by someone else is the viewing mailbox's copy of an invitation: only the
|
|
176
|
+
// organizer can change it (their next update would overwrite local edits anyway), so it's read-only
|
|
177
|
+
// apart from the RSVP controls.
|
|
178
|
+
const isInvited =
|
|
179
|
+
!!occurrence && !isOwnAddress(occurrence.organizer.address) && !occurrence.attendees.some((a) => a.isOrganizer && isOwnAddress(a.address));
|
|
180
|
+
|
|
181
|
+
function handleMailboxChange(nextMailboxUid: string) {
|
|
182
|
+
setTargetMailboxUid(nextMailboxUid);
|
|
183
|
+
const firstCalendar = mailboxOptions?.find((option) => option.mailbox.uid === nextMailboxUid)?.calendars[0];
|
|
184
|
+
if (firstCalendar) {
|
|
185
|
+
setTargetFolderUid(firstCalendar.uid);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const [title, setTitle] = useState(occurrence?.title ?? "");
|
|
189
|
+
const [location, setLocation] = useState(occurrence?.location ?? "");
|
|
190
|
+
// An all-day event is stored date-only with an exclusive end (see `allDay.ts`); the form shows its
|
|
191
|
+
// inclusive last day instead.
|
|
192
|
+
const [start, setStart] = useState(() =>
|
|
193
|
+
occurrence?.allDay
|
|
194
|
+
? `${allDayDateKey(occurrence.startDate)}T00:00`
|
|
195
|
+
: toDatetimeLocal(occurrence?.startDate ?? initialStart?.toISOString() ?? new Date().toISOString()),
|
|
196
|
+
);
|
|
197
|
+
const [end, setEnd] = useState(() => {
|
|
198
|
+
if (occurrence?.allDay) {
|
|
199
|
+
const startKey = allDayDateKey(occurrence.startDate);
|
|
200
|
+
const lastDayKey = addDaysToKey(allDayDateKey(occurrence.endDate), -1);
|
|
201
|
+
return `${lastDayKey < startKey ? startKey : lastDayKey}T00:00`;
|
|
202
|
+
}
|
|
203
|
+
return toDatetimeLocal(occurrence?.endDate ?? initialEnd?.toISOString() ?? new Date(Date.now() + 30 * 60_000).toISOString());
|
|
204
|
+
});
|
|
205
|
+
const [allDay, setAllDay] = useState(occurrence?.allDay ?? false);
|
|
206
|
+
const [timezone] = useState(occurrence?.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
207
|
+
const [attendees, setAttendees] = useState<Attendee[]>(occurrence?.attendees ?? []);
|
|
208
|
+
const [recurrenceRule, setRecurrenceRule] = useState<RecurrenceRule | null>(occurrence?.recurrenceRule ?? null);
|
|
209
|
+
const [reminderMinutes, setReminderMinutes] = useState(occurrence?.reminderMinutesBeforeStart?.toString() ?? "");
|
|
210
|
+
const [busyStatus, setBusyStatus] = useState<BusyStatus>(occurrence?.busyStatus ?? "busy");
|
|
211
|
+
const [autoReplyEnabled, setAutoReplyEnabled] = useState(occurrence?.autoReplyEnabled ?? false);
|
|
212
|
+
const [autoReplyMessage, setAutoReplyMessage] = useState(occurrence?.autoReplyMessage ?? "");
|
|
213
|
+
const [editScope, setEditScope] = useState<EditScope>("occurrence");
|
|
214
|
+
const [confirmingDelete, setConfirmingDelete] = useState(false);
|
|
215
|
+
const [error, setError] = useState<string | null>(null);
|
|
216
|
+
const [saving, setSaving] = useState(false);
|
|
217
|
+
// A series save that moved the series but couldn't move every separately edited occurrence with it.
|
|
218
|
+
const [syncWarning, setSyncWarning] = useState(false);
|
|
219
|
+
const [responding, setResponding] = useState(false);
|
|
220
|
+
const [resourcePickerOpen, setResourcePickerOpen] = useState(false);
|
|
221
|
+
const addResourceButtonRef = useRef<HTMLButtonElement>(null);
|
|
222
|
+
|
|
223
|
+
// The viewing mailbox can respond to an *existing* event it's invited to but doesn't organize —
|
|
224
|
+
// `organizerAddress` (plus the aliases) are this mailbox's own addresses (see `EventModalProps`), so
|
|
225
|
+
// finding one among `attendees` (and not as that attendee's own organizer flag) identifies exactly
|
|
226
|
+
// that case. `@rapidmx/restapi`'s `respond()` route has no occurrence-vs-series scope of its own
|
|
227
|
+
// (see `calendarApi.ts`'s `respondToEvent` doc comment) — it always acts on `occurrence.uid` as a
|
|
228
|
+
// single event document, so this deliberately does not consult `editScope`.
|
|
229
|
+
const myAttendeeIndex = occurrence ? attendees.findIndex((a) => isOwnAddress(a.address)) : -1;
|
|
230
|
+
const canRespond = myAttendeeIndex !== -1 && !attendees[myAttendeeIndex].isOrganizer;
|
|
231
|
+
// "This event only" detaches a standalone, non-repeating copy - the series' rule doesn't apply to it.
|
|
232
|
+
const editingSingleOccurrence = !!occurrence?.isRecurringOccurrence && editScope === "occurrence";
|
|
233
|
+
|
|
234
|
+
function updateAttendee(index: number, patch: Partial<Attendee>) {
|
|
235
|
+
setAttendees((prev) => prev.map((a, i) => (i === index ? { ...a, ...patch } : a)));
|
|
236
|
+
}
|
|
237
|
+
function removeAttendee(index: number) {
|
|
238
|
+
setAttendees((prev) => prev.filter((_, i) => i !== index));
|
|
239
|
+
}
|
|
240
|
+
function addResource(mailbox: Mailbox) {
|
|
241
|
+
setAttendees((prev) => [
|
|
242
|
+
...prev,
|
|
243
|
+
{ address: mailbox.primarySmtpAddress, displayName: mailbox.displayName, role: "resource", responseStatus: "needsAction", isOrganizer: false },
|
|
244
|
+
]);
|
|
245
|
+
setResourcePickerOpen(false);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async function handleSubmit(e: FormEvent) {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
setError(null);
|
|
251
|
+
|
|
252
|
+
if (!title.trim()) {
|
|
253
|
+
setError("A title is required.");
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
let startDate: string;
|
|
257
|
+
let endDate: string;
|
|
258
|
+
if (allDay) {
|
|
259
|
+
const startKey = start.slice(0, 10);
|
|
260
|
+
const lastDayKey = end.slice(0, 10);
|
|
261
|
+
if (lastDayKey < startKey) {
|
|
262
|
+
setError("The end date can't be before the start date.");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
startDate = allDayInstant(startKey);
|
|
266
|
+
endDate = allDayInstant(addDaysToKey(lastDayKey, 1));
|
|
267
|
+
} else {
|
|
268
|
+
if (new Date(end) <= new Date(start)) {
|
|
269
|
+
setError("The end time must be after the start time.");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
startDate = new Date(start).toISOString();
|
|
273
|
+
endDate = new Date(end).toISOString();
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Only a stored event is updated in place, where a cleared field must be sent as `null`; creating
|
|
277
|
+
// (a new event, or the detached copy of one occurrence) just omits it.
|
|
278
|
+
const updatingInPlace = !!occurrence && !editingSingleOccurrence;
|
|
279
|
+
const cleared = updatingInPlace ? null : undefined;
|
|
280
|
+
const fields: EventFields = {
|
|
281
|
+
title: title.trim(),
|
|
282
|
+
location: location.trim() || cleared,
|
|
283
|
+
startDate,
|
|
284
|
+
endDate,
|
|
285
|
+
allDay,
|
|
286
|
+
timezone,
|
|
287
|
+
attendees,
|
|
288
|
+
recurrenceRule: editingSingleOccurrence ? undefined : (recurrenceRule ?? cleared),
|
|
289
|
+
reminderMinutesBeforeStart: reminderMinutes.trim() ? Number(reminderMinutes) : cleared,
|
|
290
|
+
busyStatus,
|
|
291
|
+
autoReplyEnabled,
|
|
292
|
+
autoReplyMessage: autoReplyEnabled ? autoReplyMessage : cleared,
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
setSaving(true);
|
|
296
|
+
try {
|
|
297
|
+
if (!occurrence) {
|
|
298
|
+
// The organizer is only ever set on create - an edit keeps the event's own organizer.
|
|
299
|
+
await createCalendarEvent({
|
|
300
|
+
mailboxUid: targetMailboxUid,
|
|
301
|
+
folderUid: targetFolderUid,
|
|
302
|
+
...fields,
|
|
303
|
+
organizer: { address: effectiveOrganizerAddress, type: "to" },
|
|
304
|
+
} as CalendarEventInput);
|
|
305
|
+
} else if (editingSingleOccurrence) {
|
|
306
|
+
await detachOccurrence(occurrence, fields as Partial<CalendarEventInput>);
|
|
307
|
+
} else if (occurrence.isRecurringOccurrence) {
|
|
308
|
+
const saved = await saveEventSeries(occurrence, (await toSeriesFields(occurrence, fields)) as Partial<CalendarEventInput>);
|
|
309
|
+
if (saved.detachedOccurrenceSyncFailed) {
|
|
310
|
+
// The series itself was saved - say so, and leave closing to the user once they've read it.
|
|
311
|
+
setSyncWarning(true);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
await updateCalendarEvent({ uid: occurrence.uid, version: occurrence.version, ...(fields as Partial<CalendarEventInput>) });
|
|
316
|
+
}
|
|
317
|
+
onSaved();
|
|
318
|
+
} catch (err) {
|
|
319
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not save this event.");
|
|
320
|
+
} finally {
|
|
321
|
+
setSaving(false);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Only ever invoked from the Delete button(s) rendered inside the `{occurrence && (...)}` block
|
|
326
|
+
// below, so `occurrence` is always non-null here — no defensive null check needed.
|
|
327
|
+
async function handleDelete(scope: EditScope) {
|
|
328
|
+
setError(null);
|
|
329
|
+
setSaving(true);
|
|
330
|
+
try {
|
|
331
|
+
if (occurrence!.isRecurringOccurrence && scope === "occurrence") {
|
|
332
|
+
await deleteEventOccurrence(occurrence!);
|
|
333
|
+
} else {
|
|
334
|
+
await deleteEventSeries(occurrence!);
|
|
335
|
+
}
|
|
336
|
+
onDeleted();
|
|
337
|
+
} catch (err) {
|
|
338
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not delete this event.");
|
|
339
|
+
setSaving(false);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Only rendered inside the `{canRespond && (...)}` block below, which already requires `occurrence`
|
|
344
|
+
// to be non-null (see `canRespond`'s own definition above) — same established pattern as
|
|
345
|
+
// `handleDelete`'s non-null assertion.
|
|
346
|
+
async function handleRespond(responseStatus: AttendeeResponseInput) {
|
|
347
|
+
setError(null);
|
|
348
|
+
setResponding(true);
|
|
349
|
+
try {
|
|
350
|
+
await respondToEvent(occurrence!.uid, responseStatus);
|
|
351
|
+
// A decline soft-deletes the mailbox's own copy server-side — treat it the same as a
|
|
352
|
+
// delete rather than a save so the calendar view drops it immediately.
|
|
353
|
+
if (responseStatus === "declined") {
|
|
354
|
+
onDeleted();
|
|
355
|
+
} else {
|
|
356
|
+
onSaved();
|
|
357
|
+
}
|
|
358
|
+
} catch (err) {
|
|
359
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not send your response.");
|
|
360
|
+
setResponding(false);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// The recurrence end date is stored in the frame the series expands in (UTC for all-day, local otherwise),
|
|
365
|
+
// so toggling All day re-stores the same chosen date in the new frame.
|
|
366
|
+
function handleAllDayChange(nextAllDay: boolean) {
|
|
367
|
+
setAllDay(nextAllDay);
|
|
368
|
+
setRecurrenceRule((rule) =>
|
|
369
|
+
rule?.until ? { ...rule, until: recurrenceUntilInstant(recurrenceUntilDateKey(rule.until, allDay), nextAllDay) } : rule,
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (syncWarning) {
|
|
374
|
+
return (
|
|
375
|
+
<Modal open={open} onClose={onSaved} title="Series saved">
|
|
376
|
+
<p role="alert" className="text-sm mb-4">
|
|
377
|
+
The series was saved, but some occurrences you had changed individually couldn’t be moved with it. They
|
|
378
|
+
may now appear twice - check the calendar and delete any duplicate.
|
|
379
|
+
</p>
|
|
380
|
+
<Button type="button" className="!w-auto" onClick={onSaved}>
|
|
381
|
+
OK
|
|
382
|
+
</Button>
|
|
383
|
+
</Modal>
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return (
|
|
388
|
+
<Modal open={open} onClose={onClose} title={occurrence ? "Edit event" : "New event"}>
|
|
389
|
+
<form onSubmit={handleSubmit} className="flex flex-col gap-1">
|
|
390
|
+
{error && <Alert>{error}</Alert>}
|
|
391
|
+
|
|
392
|
+
{canRespond && (
|
|
393
|
+
<div className="flex flex-col gap-2 mb-3 p-3 rounded-sm bg-surface-alt">
|
|
394
|
+
<div className="flex items-center justify-between gap-3 flex-wrap">
|
|
395
|
+
<span className="text-sm font-medium">Your response</span>
|
|
396
|
+
<div className="flex gap-2">
|
|
397
|
+
<Button
|
|
398
|
+
type="button"
|
|
399
|
+
variant="secondary"
|
|
400
|
+
className="!w-auto"
|
|
401
|
+
disabled={responding}
|
|
402
|
+
onClick={() => handleRespond("accepted")}
|
|
403
|
+
>
|
|
404
|
+
Accept
|
|
405
|
+
</Button>
|
|
406
|
+
<Button
|
|
407
|
+
type="button"
|
|
408
|
+
variant="secondary"
|
|
409
|
+
className="!w-auto"
|
|
410
|
+
disabled={responding}
|
|
411
|
+
onClick={() => handleRespond("tentative")}
|
|
412
|
+
>
|
|
413
|
+
Tentative
|
|
414
|
+
</Button>
|
|
415
|
+
<Button
|
|
416
|
+
type="button"
|
|
417
|
+
variant="secondary"
|
|
418
|
+
className="!w-auto text-danger"
|
|
419
|
+
disabled={responding}
|
|
420
|
+
onClick={() => handleRespond("declined")}
|
|
421
|
+
>
|
|
422
|
+
Decline
|
|
423
|
+
</Button>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
<p className="text-xs text-text-muted">Other attendees’ responses may take a few minutes to update.</p>
|
|
427
|
+
</div>
|
|
428
|
+
)}
|
|
429
|
+
|
|
430
|
+
{isInvited && (
|
|
431
|
+
<p className="text-xs text-text-muted mb-3">
|
|
432
|
+
You were invited to this event. Only the organizer can change its details.
|
|
433
|
+
</p>
|
|
434
|
+
)}
|
|
435
|
+
|
|
436
|
+
<fieldset disabled={isInvited} className="flex flex-col gap-1 min-w-0">
|
|
437
|
+
|
|
438
|
+
{!occurrence && mailboxOptions && mailboxOptions.length > 1 && (
|
|
439
|
+
<FormField label="Mailbox" htmlFor="event-mailbox">
|
|
440
|
+
<select
|
|
441
|
+
id="event-mailbox"
|
|
442
|
+
className={INPUT_CLASS}
|
|
443
|
+
value={targetMailboxUid}
|
|
444
|
+
onChange={(e) => handleMailboxChange(e.target.value)}
|
|
445
|
+
>
|
|
446
|
+
{mailboxOptions.map(({ mailbox }) => (
|
|
447
|
+
<option key={mailbox.uid} value={mailbox.uid}>
|
|
448
|
+
{mailbox.displayName}
|
|
449
|
+
{mailbox.ownerUserUid ? "" : " (shared)"}
|
|
450
|
+
</option>
|
|
451
|
+
))}
|
|
452
|
+
</select>
|
|
453
|
+
</FormField>
|
|
454
|
+
)}
|
|
455
|
+
|
|
456
|
+
{!occurrence && calendarChoices && calendarChoices.length > 1 && (
|
|
457
|
+
<FormField label="Calendar" htmlFor="event-calendar">
|
|
458
|
+
<select
|
|
459
|
+
id="event-calendar"
|
|
460
|
+
className={INPUT_CLASS}
|
|
461
|
+
value={targetFolderUid}
|
|
462
|
+
onChange={(e) => setTargetFolderUid(e.target.value)}
|
|
463
|
+
>
|
|
464
|
+
{calendarChoices.map((cal) => (
|
|
465
|
+
<option key={cal.uid} value={cal.uid}>
|
|
466
|
+
{cal.name}
|
|
467
|
+
</option>
|
|
468
|
+
))}
|
|
469
|
+
</select>
|
|
470
|
+
</FormField>
|
|
471
|
+
)}
|
|
472
|
+
|
|
473
|
+
<FormField label="Title" htmlFor="event-title">
|
|
474
|
+
<input id="event-title" type="text" className={INPUT_CLASS} value={title} onChange={(e) => setTitle(e.target.value)} />
|
|
475
|
+
</FormField>
|
|
476
|
+
|
|
477
|
+
<FormField label="Location" htmlFor="event-location">
|
|
478
|
+
<input id="event-location" type="text" className={INPUT_CLASS} value={location} onChange={(e) => setLocation(e.target.value)} />
|
|
479
|
+
</FormField>
|
|
480
|
+
|
|
481
|
+
<label className="flex items-center gap-2 text-sm font-medium mb-3">
|
|
482
|
+
<input type="checkbox" checked={allDay} onChange={(e) => handleAllDayChange(e.target.checked)} />
|
|
483
|
+
All day
|
|
484
|
+
</label>
|
|
485
|
+
|
|
486
|
+
<div className="grid grid-cols-2 gap-3">
|
|
487
|
+
<FormField label="Start" htmlFor="event-start">
|
|
488
|
+
<input
|
|
489
|
+
id="event-start"
|
|
490
|
+
type={allDay ? "date" : "datetime-local"}
|
|
491
|
+
className={INPUT_CLASS}
|
|
492
|
+
value={allDay ? start.slice(0, 10) : start}
|
|
493
|
+
onChange={(e) => setStart(allDay ? `${e.target.value}T00:00` : e.target.value)}
|
|
494
|
+
/>
|
|
495
|
+
</FormField>
|
|
496
|
+
<FormField label="End" htmlFor="event-end">
|
|
497
|
+
<input
|
|
498
|
+
id="event-end"
|
|
499
|
+
type={allDay ? "date" : "datetime-local"}
|
|
500
|
+
className={INPUT_CLASS}
|
|
501
|
+
value={allDay ? end.slice(0, 10) : end}
|
|
502
|
+
onChange={(e) => setEnd(allDay ? `${e.target.value}T00:00` : e.target.value)}
|
|
503
|
+
/>
|
|
504
|
+
</FormField>
|
|
505
|
+
</div>
|
|
506
|
+
|
|
507
|
+
<FormField label="Attendees" htmlFor="event-attendees">
|
|
508
|
+
<div id="event-attendees" className="flex flex-col gap-2">
|
|
509
|
+
{attendees.map((attendee, i) => (
|
|
510
|
+
<div key={i} className="flex gap-2">
|
|
511
|
+
<input
|
|
512
|
+
type="email"
|
|
513
|
+
className={`${INPUT_CLASS} flex-1`}
|
|
514
|
+
value={attendee.address}
|
|
515
|
+
onChange={(e) => updateAttendee(i, { address: e.target.value })}
|
|
516
|
+
aria-label={`Attendee email ${i + 1}`}
|
|
517
|
+
/>
|
|
518
|
+
<select
|
|
519
|
+
className={SELECT_CLASS}
|
|
520
|
+
value={attendee.role}
|
|
521
|
+
onChange={(e) => updateAttendee(i, { role: e.target.value as AttendeeRole })}
|
|
522
|
+
aria-label={`Attendee role ${i + 1}`}
|
|
523
|
+
>
|
|
524
|
+
{ATTENDEE_ROLES.map((role) => (
|
|
525
|
+
<option key={role} value={role}>
|
|
526
|
+
{role}
|
|
527
|
+
</option>
|
|
528
|
+
))}
|
|
529
|
+
</select>
|
|
530
|
+
<span className="text-xs font-medium text-text-muted shrink-0 py-1 px-2.5 rounded-pill bg-surface-alt self-center">
|
|
531
|
+
{RESPONSE_STATUS_LABEL[attendee.responseStatus]}
|
|
532
|
+
</span>
|
|
533
|
+
<button
|
|
534
|
+
type="button"
|
|
535
|
+
onClick={() => removeAttendee(i)}
|
|
536
|
+
className="text-sm text-danger px-2"
|
|
537
|
+
aria-label={`Remove attendee ${i + 1}`}
|
|
538
|
+
>
|
|
539
|
+
×
|
|
540
|
+
</button>
|
|
541
|
+
</div>
|
|
542
|
+
))}
|
|
543
|
+
<div className="flex gap-3 items-center">
|
|
544
|
+
<button
|
|
545
|
+
type="button"
|
|
546
|
+
onClick={() => setAttendees((prev) => [...prev, { address: "", role: "required", responseStatus: "needsAction", isOrganizer: false }])}
|
|
547
|
+
className="self-start text-xs font-medium text-primary-dark hover:underline"
|
|
548
|
+
>
|
|
549
|
+
+ Add attendee
|
|
550
|
+
</button>
|
|
551
|
+
<button
|
|
552
|
+
ref={addResourceButtonRef}
|
|
553
|
+
type="button"
|
|
554
|
+
onClick={() => setResourcePickerOpen(true)}
|
|
555
|
+
className="self-start text-xs font-medium text-primary-dark hover:underline"
|
|
556
|
+
>
|
|
557
|
+
+ Add room/equipment
|
|
558
|
+
</button>
|
|
559
|
+
</div>
|
|
560
|
+
{resourcePickerOpen && (
|
|
561
|
+
<ResourcePicker
|
|
562
|
+
anchorRef={addResourceButtonRef}
|
|
563
|
+
onClose={() => setResourcePickerOpen(false)}
|
|
564
|
+
onSelect={addResource}
|
|
565
|
+
excludeAddresses={attendees.map((a) => a.address.toLowerCase())}
|
|
566
|
+
/>
|
|
567
|
+
)}
|
|
568
|
+
</div>
|
|
569
|
+
</FormField>
|
|
570
|
+
|
|
571
|
+
<div className="grid grid-cols-2 gap-3">
|
|
572
|
+
<FormField label="Busy status" htmlFor="event-busyStatus">
|
|
573
|
+
<select
|
|
574
|
+
id="event-busyStatus"
|
|
575
|
+
className={INPUT_CLASS}
|
|
576
|
+
value={busyStatus}
|
|
577
|
+
onChange={(e) => setBusyStatus(e.target.value as BusyStatus)}
|
|
578
|
+
>
|
|
579
|
+
{BUSY_STATUSES.map((status) => (
|
|
580
|
+
<option key={status} value={status}>
|
|
581
|
+
{BUSY_STATUS_LABEL[status]}
|
|
582
|
+
</option>
|
|
583
|
+
))}
|
|
584
|
+
</select>
|
|
585
|
+
</FormField>
|
|
586
|
+
<FormField label="Reminder (minutes before)" htmlFor="event-reminder">
|
|
587
|
+
<input
|
|
588
|
+
id="event-reminder"
|
|
589
|
+
type="number"
|
|
590
|
+
min={0}
|
|
591
|
+
className={INPUT_CLASS}
|
|
592
|
+
value={reminderMinutes}
|
|
593
|
+
onChange={(e) => setReminderMinutes(e.target.value)}
|
|
594
|
+
placeholder="None"
|
|
595
|
+
/>
|
|
596
|
+
</FormField>
|
|
597
|
+
</div>
|
|
598
|
+
|
|
599
|
+
<div className="mb-3">
|
|
600
|
+
<label className="flex items-center gap-2 text-sm font-medium">
|
|
601
|
+
<input
|
|
602
|
+
type="checkbox"
|
|
603
|
+
checked={autoReplyEnabled}
|
|
604
|
+
onChange={(e) => setAutoReplyEnabled(e.target.checked)}
|
|
605
|
+
/>
|
|
606
|
+
Send an automatic reply while this event is happening
|
|
607
|
+
</label>
|
|
608
|
+
<p className="text-xs text-text-muted mt-1">
|
|
609
|
+
Applies in addition to your mailbox’s own Automatic Replies setting (see Settings) —
|
|
610
|
+
this event’s message takes over for its own start/end window.
|
|
611
|
+
</p>
|
|
612
|
+
{autoReplyEnabled && (
|
|
613
|
+
<textarea
|
|
614
|
+
aria-label="Automatic reply message"
|
|
615
|
+
className={`${INPUT_CLASS} mt-2`}
|
|
616
|
+
rows={3}
|
|
617
|
+
value={autoReplyMessage}
|
|
618
|
+
onChange={(e) => setAutoReplyMessage(e.target.value)}
|
|
619
|
+
placeholder="I'm out of office and back on..."
|
|
620
|
+
/>
|
|
621
|
+
)}
|
|
622
|
+
</div>
|
|
623
|
+
|
|
624
|
+
{!editingSingleOccurrence && (
|
|
625
|
+
<FormField label="Recurrence" htmlFor="event-recurrence">
|
|
626
|
+
<RecurrenceEditor
|
|
627
|
+
value={recurrenceRule}
|
|
628
|
+
onChange={setRecurrenceRule}
|
|
629
|
+
allDay={allDay}
|
|
630
|
+
startWeekday={startWeekdayCode(start, allDay, timezone)}
|
|
631
|
+
/>
|
|
632
|
+
</FormField>
|
|
633
|
+
)}
|
|
634
|
+
|
|
635
|
+
{occurrence?.isRecurringOccurrence && !isInvited && (
|
|
636
|
+
<fieldset className="flex flex-col gap-1.5 text-sm mb-3">
|
|
637
|
+
<legend className="text-xs font-bold uppercase tracking-wide text-text-muted mb-1">Apply changes to</legend>
|
|
638
|
+
<label className="flex items-center gap-2">
|
|
639
|
+
<input
|
|
640
|
+
type="radio"
|
|
641
|
+
name="event-edit-scope"
|
|
642
|
+
checked={editScope === "occurrence"}
|
|
643
|
+
onChange={() => setEditScope("occurrence")}
|
|
644
|
+
/>
|
|
645
|
+
This event only
|
|
646
|
+
</label>
|
|
647
|
+
<label className="flex items-center gap-2">
|
|
648
|
+
<input
|
|
649
|
+
type="radio"
|
|
650
|
+
name="event-edit-scope"
|
|
651
|
+
checked={editScope === "series"}
|
|
652
|
+
onChange={() => setEditScope("series")}
|
|
653
|
+
/>
|
|
654
|
+
The entire series
|
|
655
|
+
</label>
|
|
656
|
+
</fieldset>
|
|
657
|
+
)}
|
|
658
|
+
|
|
659
|
+
</fieldset>
|
|
660
|
+
|
|
661
|
+
<div className="flex gap-3 mt-2">
|
|
662
|
+
{!isInvited && (
|
|
663
|
+
<Button type="submit" loading={saving} disabled={saving} className="!w-auto">
|
|
664
|
+
Save
|
|
665
|
+
</Button>
|
|
666
|
+
)}
|
|
667
|
+
<Button type="button" variant="secondary" className="!w-auto" onClick={onClose}>
|
|
668
|
+
Cancel
|
|
669
|
+
</Button>
|
|
670
|
+
{occurrence &&
|
|
671
|
+
(!occurrence.isRecurringOccurrence ? (
|
|
672
|
+
<Button
|
|
673
|
+
type="button"
|
|
674
|
+
variant="secondary"
|
|
675
|
+
className="!w-auto ml-auto text-danger"
|
|
676
|
+
disabled={saving}
|
|
677
|
+
onClick={() => handleDelete("series")}
|
|
678
|
+
>
|
|
679
|
+
Delete
|
|
680
|
+
</Button>
|
|
681
|
+
) : !confirmingDelete ? (
|
|
682
|
+
<Button
|
|
683
|
+
type="button"
|
|
684
|
+
variant="secondary"
|
|
685
|
+
className="!w-auto ml-auto text-danger"
|
|
686
|
+
disabled={saving}
|
|
687
|
+
onClick={() => setConfirmingDelete(true)}
|
|
688
|
+
>
|
|
689
|
+
Delete
|
|
690
|
+
</Button>
|
|
691
|
+
) : (
|
|
692
|
+
<div className="flex gap-2 ml-auto">
|
|
693
|
+
<Button
|
|
694
|
+
type="button"
|
|
695
|
+
variant="secondary"
|
|
696
|
+
className="!w-auto text-danger"
|
|
697
|
+
disabled={saving}
|
|
698
|
+
onClick={() => handleDelete("occurrence")}
|
|
699
|
+
>
|
|
700
|
+
Delete this event
|
|
701
|
+
</Button>
|
|
702
|
+
<Button
|
|
703
|
+
type="button"
|
|
704
|
+
variant="secondary"
|
|
705
|
+
className="!w-auto text-danger"
|
|
706
|
+
disabled={saving}
|
|
707
|
+
onClick={() => handleDelete("series")}
|
|
708
|
+
>
|
|
709
|
+
Delete series
|
|
710
|
+
</Button>
|
|
711
|
+
</div>
|
|
712
|
+
))}
|
|
713
|
+
</div>
|
|
714
|
+
</form>
|
|
715
|
+
</Modal>
|
|
716
|
+
);
|
|
717
|
+
}
|