@agent-native/scheduling 0.1.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/README.md +58 -0
- package/dist/actions/_helpers.d.ts +12 -0
- package/dist/actions/_helpers.d.ts.map +1 -0
- package/dist/actions/_helpers.js +49 -0
- package/dist/actions/_helpers.js.map +1 -0
- package/dist/actions/accept-team-invite.d.ts +3 -0
- package/dist/actions/accept-team-invite.d.ts.map +1 -0
- package/dist/actions/accept-team-invite.js +27 -0
- package/dist/actions/accept-team-invite.js.map +1 -0
- package/dist/actions/add-booking-attendee.d.ts +3 -0
- package/dist/actions/add-booking-attendee.d.ts.map +1 -0
- package/dist/actions/add-booking-attendee.js +33 -0
- package/dist/actions/add-booking-attendee.js.map +1 -0
- package/dist/actions/add-booking-note.d.ts +3 -0
- package/dist/actions/add-booking-note.d.ts.map +1 -0
- package/dist/actions/add-booking-note.js +26 -0
- package/dist/actions/add-booking-note.js.map +1 -0
- package/dist/actions/add-date-override.d.ts +3 -0
- package/dist/actions/add-date-override.d.ts.map +1 -0
- package/dist/actions/add-date-override.js +16 -0
- package/dist/actions/add-date-override.js.map +1 -0
- package/dist/actions/add-private-link.d.ts +3 -0
- package/dist/actions/add-private-link.d.ts.map +1 -0
- package/dist/actions/add-private-link.js +31 -0
- package/dist/actions/add-private-link.js.map +1 -0
- package/dist/actions/assign-round-robin-host.d.ts +3 -0
- package/dist/actions/assign-round-robin-host.d.ts.map +1 -0
- package/dist/actions/assign-round-robin-host.js +48 -0
- package/dist/actions/assign-round-robin-host.js.map +1 -0
- package/dist/actions/cancel-booking.d.ts +3 -0
- package/dist/actions/cancel-booking.d.ts.map +1 -0
- package/dist/actions/cancel-booking.js +34 -0
- package/dist/actions/cancel-booking.js.map +1 -0
- package/dist/actions/check-availability.d.ts +3 -0
- package/dist/actions/check-availability.d.ts.map +1 -0
- package/dist/actions/check-availability.js +43 -0
- package/dist/actions/check-availability.js.map +1 -0
- package/dist/actions/confirm-booking.d.ts +3 -0
- package/dist/actions/confirm-booking.d.ts.map +1 -0
- package/dist/actions/confirm-booking.js +12 -0
- package/dist/actions/confirm-booking.js.map +1 -0
- package/dist/actions/connect-calendar.d.ts +3 -0
- package/dist/actions/connect-calendar.d.ts.map +1 -0
- package/dist/actions/connect-calendar.js +26 -0
- package/dist/actions/connect-calendar.js.map +1 -0
- package/dist/actions/connect-video.d.ts +3 -0
- package/dist/actions/connect-video.d.ts.map +1 -0
- package/dist/actions/connect-video.js +54 -0
- package/dist/actions/connect-video.js.map +1 -0
- package/dist/actions/create-booking.d.ts +3 -0
- package/dist/actions/create-booking.d.ts.map +1 -0
- package/dist/actions/create-booking.js +60 -0
- package/dist/actions/create-booking.js.map +1 -0
- package/dist/actions/create-event-type.d.ts +3 -0
- package/dist/actions/create-event-type.d.ts.map +1 -0
- package/dist/actions/create-event-type.js +45 -0
- package/dist/actions/create-event-type.js.map +1 -0
- package/dist/actions/create-host-group.d.ts +3 -0
- package/dist/actions/create-host-group.d.ts.map +1 -0
- package/dist/actions/create-host-group.js +25 -0
- package/dist/actions/create-host-group.js.map +1 -0
- package/dist/actions/create-routing-form.d.ts +3 -0
- package/dist/actions/create-routing-form.d.ts.map +1 -0
- package/dist/actions/create-routing-form.js +39 -0
- package/dist/actions/create-routing-form.js.map +1 -0
- package/dist/actions/create-schedule.d.ts +3 -0
- package/dist/actions/create-schedule.d.ts.map +1 -0
- package/dist/actions/create-schedule.js +32 -0
- package/dist/actions/create-schedule.js.map +1 -0
- package/dist/actions/create-team.d.ts +3 -0
- package/dist/actions/create-team.d.ts.map +1 -0
- package/dist/actions/create-team.js +44 -0
- package/dist/actions/create-team.js.map +1 -0
- package/dist/actions/create-workflow.d.ts +3 -0
- package/dist/actions/create-workflow.d.ts.map +1 -0
- package/dist/actions/create-workflow.js +81 -0
- package/dist/actions/create-workflow.js.map +1 -0
- package/dist/actions/delete-event-type.d.ts +3 -0
- package/dist/actions/delete-event-type.d.ts.map +1 -0
- package/dist/actions/delete-event-type.js +14 -0
- package/dist/actions/delete-event-type.js.map +1 -0
- package/dist/actions/delete-routing-form.d.ts +3 -0
- package/dist/actions/delete-routing-form.d.ts.map +1 -0
- package/dist/actions/delete-routing-form.js +21 -0
- package/dist/actions/delete-routing-form.js.map +1 -0
- package/dist/actions/delete-schedule.d.ts +3 -0
- package/dist/actions/delete-schedule.d.ts.map +1 -0
- package/dist/actions/delete-schedule.js +14 -0
- package/dist/actions/delete-schedule.js.map +1 -0
- package/dist/actions/delete-workflow.d.ts +3 -0
- package/dist/actions/delete-workflow.d.ts.map +1 -0
- package/dist/actions/delete-workflow.js +21 -0
- package/dist/actions/delete-workflow.js.map +1 -0
- package/dist/actions/disconnect-calendar.d.ts +3 -0
- package/dist/actions/disconnect-calendar.d.ts.map +1 -0
- package/dist/actions/disconnect-calendar.js +22 -0
- package/dist/actions/disconnect-calendar.js.map +1 -0
- package/dist/actions/duplicate-event-type.d.ts +3 -0
- package/dist/actions/duplicate-event-type.d.ts.map +1 -0
- package/dist/actions/duplicate-event-type.js +34 -0
- package/dist/actions/duplicate-event-type.js.map +1 -0
- package/dist/actions/export-bookings-csv.d.ts +3 -0
- package/dist/actions/export-bookings-csv.d.ts.map +1 -0
- package/dist/actions/export-bookings-csv.js +53 -0
- package/dist/actions/export-bookings-csv.js.map +1 -0
- package/dist/actions/find-available-slot.d.ts +3 -0
- package/dist/actions/find-available-slot.d.ts.map +1 -0
- package/dist/actions/find-available-slot.js +39 -0
- package/dist/actions/find-available-slot.js.map +1 -0
- package/dist/actions/get-availability.d.ts +3 -0
- package/dist/actions/get-availability.d.ts.map +1 -0
- package/dist/actions/get-availability.js +20 -0
- package/dist/actions/get-availability.js.map +1 -0
- package/dist/actions/get-booking.d.ts +3 -0
- package/dist/actions/get-booking.d.ts.map +1 -0
- package/dist/actions/get-booking.js +9 -0
- package/dist/actions/get-booking.js.map +1 -0
- package/dist/actions/get-event-type.d.ts +3 -0
- package/dist/actions/get-event-type.d.ts.map +1 -0
- package/dist/actions/get-event-type.js +27 -0
- package/dist/actions/get-event-type.js.map +1 -0
- package/dist/actions/install-conferencing-app.d.ts +3 -0
- package/dist/actions/install-conferencing-app.d.ts.map +1 -0
- package/dist/actions/install-conferencing-app.js +28 -0
- package/dist/actions/install-conferencing-app.js.map +1 -0
- package/dist/actions/invite-team-member.d.ts +3 -0
- package/dist/actions/invite-team-member.d.ts.map +1 -0
- package/dist/actions/invite-team-member.js +30 -0
- package/dist/actions/invite-team-member.js.map +1 -0
- package/dist/actions/list-bookings.d.ts +3 -0
- package/dist/actions/list-bookings.d.ts.map +1 -0
- package/dist/actions/list-bookings.js +35 -0
- package/dist/actions/list-bookings.js.map +1 -0
- package/dist/actions/list-calendar-integrations.d.ts +3 -0
- package/dist/actions/list-calendar-integrations.d.ts.map +1 -0
- package/dist/actions/list-calendar-integrations.js +26 -0
- package/dist/actions/list-calendar-integrations.js.map +1 -0
- package/dist/actions/list-event-types.d.ts +3 -0
- package/dist/actions/list-event-types.d.ts.map +1 -0
- package/dist/actions/list-event-types.js +31 -0
- package/dist/actions/list-event-types.js.map +1 -0
- package/dist/actions/list-routing-form-responses.d.ts +3 -0
- package/dist/actions/list-routing-form-responses.d.ts.map +1 -0
- package/dist/actions/list-routing-form-responses.js +24 -0
- package/dist/actions/list-routing-form-responses.js.map +1 -0
- package/dist/actions/list-routing-forms.d.ts +3 -0
- package/dist/actions/list-routing-forms.d.ts.map +1 -0
- package/dist/actions/list-routing-forms.js +29 -0
- package/dist/actions/list-routing-forms.js.map +1 -0
- package/dist/actions/list-schedules.d.ts +3 -0
- package/dist/actions/list-schedules.d.ts.map +1 -0
- package/dist/actions/list-schedules.js +16 -0
- package/dist/actions/list-schedules.js.map +1 -0
- package/dist/actions/list-selected-calendars.d.ts +3 -0
- package/dist/actions/list-selected-calendars.d.ts.map +1 -0
- package/dist/actions/list-selected-calendars.js +42 -0
- package/dist/actions/list-selected-calendars.js.map +1 -0
- package/dist/actions/list-workflows.d.ts +3 -0
- package/dist/actions/list-workflows.d.ts.map +1 -0
- package/dist/actions/list-workflows.js +29 -0
- package/dist/actions/list-workflows.js.map +1 -0
- package/dist/actions/mark-no-show.d.ts +3 -0
- package/dist/actions/mark-no-show.d.ts.map +1 -0
- package/dist/actions/mark-no-show.js +15 -0
- package/dist/actions/mark-no-show.js.map +1 -0
- package/dist/actions/refresh-busy-times.d.ts +3 -0
- package/dist/actions/refresh-busy-times.d.ts.map +1 -0
- package/dist/actions/refresh-busy-times.js +25 -0
- package/dist/actions/refresh-busy-times.js.map +1 -0
- package/dist/actions/remove-booking-attendee.d.ts +3 -0
- package/dist/actions/remove-booking-attendee.d.ts.map +1 -0
- package/dist/actions/remove-booking-attendee.js +20 -0
- package/dist/actions/remove-booking-attendee.js.map +1 -0
- package/dist/actions/remove-date-override.d.ts +3 -0
- package/dist/actions/remove-date-override.d.ts.map +1 -0
- package/dist/actions/remove-date-override.js +15 -0
- package/dist/actions/remove-date-override.js.map +1 -0
- package/dist/actions/remove-team-member.d.ts +3 -0
- package/dist/actions/remove-team-member.d.ts.map +1 -0
- package/dist/actions/remove-team-member.js +18 -0
- package/dist/actions/remove-team-member.js.map +1 -0
- package/dist/actions/reorder-event-types.d.ts +3 -0
- package/dist/actions/reorder-event-types.d.ts.map +1 -0
- package/dist/actions/reorder-event-types.js +18 -0
- package/dist/actions/reorder-event-types.js.map +1 -0
- package/dist/actions/reschedule-booking.d.ts +3 -0
- package/dist/actions/reschedule-booking.d.ts.map +1 -0
- package/dist/actions/reschedule-booking.js +38 -0
- package/dist/actions/reschedule-booking.js.map +1 -0
- package/dist/actions/revoke-private-link.d.ts +3 -0
- package/dist/actions/revoke-private-link.d.ts.map +1 -0
- package/dist/actions/revoke-private-link.js +16 -0
- package/dist/actions/revoke-private-link.js.map +1 -0
- package/dist/actions/send-reschedule-link.d.ts +3 -0
- package/dist/actions/send-reschedule-link.d.ts.map +1 -0
- package/dist/actions/send-reschedule-link.js +18 -0
- package/dist/actions/send-reschedule-link.js.map +1 -0
- package/dist/actions/set-appearance.d.ts +3 -0
- package/dist/actions/set-appearance.d.ts.map +1 -0
- package/dist/actions/set-appearance.js +23 -0
- package/dist/actions/set-appearance.js.map +1 -0
- package/dist/actions/set-default-conferencing-app.d.ts +3 -0
- package/dist/actions/set-default-conferencing-app.d.ts.map +1 -0
- package/dist/actions/set-default-conferencing-app.js +25 -0
- package/dist/actions/set-default-conferencing-app.js.map +1 -0
- package/dist/actions/set-default-schedule.d.ts +3 -0
- package/dist/actions/set-default-schedule.d.ts.map +1 -0
- package/dist/actions/set-default-schedule.js +15 -0
- package/dist/actions/set-default-schedule.js.map +1 -0
- package/dist/actions/set-destination-calendar.d.ts +3 -0
- package/dist/actions/set-destination-calendar.d.ts.map +1 -0
- package/dist/actions/set-destination-calendar.js +39 -0
- package/dist/actions/set-destination-calendar.js.map +1 -0
- package/dist/actions/set-event-type-hosts.d.ts +3 -0
- package/dist/actions/set-event-type-hosts.d.ts.map +1 -0
- package/dist/actions/set-event-type-hosts.js +41 -0
- package/dist/actions/set-event-type-hosts.js.map +1 -0
- package/dist/actions/set-event-type-location.d.ts +3 -0
- package/dist/actions/set-event-type-location.d.ts.map +1 -0
- package/dist/actions/set-event-type-location.js +18 -0
- package/dist/actions/set-event-type-location.js.map +1 -0
- package/dist/actions/set-host-availability-override.d.ts +3 -0
- package/dist/actions/set-host-availability-override.d.ts.map +1 -0
- package/dist/actions/set-host-availability-override.js +21 -0
- package/dist/actions/set-host-availability-override.js.map +1 -0
- package/dist/actions/set-team-branding.d.ts +3 -0
- package/dist/actions/set-team-branding.d.ts.map +1 -0
- package/dist/actions/set-team-branding.js +28 -0
- package/dist/actions/set-team-branding.js.map +1 -0
- package/dist/actions/submit-routing-form-response.d.ts +3 -0
- package/dist/actions/submit-routing-form-response.d.ts.map +1 -0
- package/dist/actions/submit-routing-form-response.js +46 -0
- package/dist/actions/submit-routing-form-response.js.map +1 -0
- package/dist/actions/toggle-event-type-hidden.d.ts +3 -0
- package/dist/actions/toggle-event-type-hidden.d.ts.map +1 -0
- package/dist/actions/toggle-event-type-hidden.js +19 -0
- package/dist/actions/toggle-event-type-hidden.js.map +1 -0
- package/dist/actions/toggle-selected-calendar.d.ts +3 -0
- package/dist/actions/toggle-selected-calendar.d.ts.map +1 -0
- package/dist/actions/toggle-selected-calendar.js +40 -0
- package/dist/actions/toggle-selected-calendar.js.map +1 -0
- package/dist/actions/toggle-workflow.d.ts +3 -0
- package/dist/actions/toggle-workflow.d.ts.map +1 -0
- package/dist/actions/toggle-workflow.js +26 -0
- package/dist/actions/toggle-workflow.js.map +1 -0
- package/dist/actions/update-event-type.d.ts +3 -0
- package/dist/actions/update-event-type.d.ts.map +1 -0
- package/dist/actions/update-event-type.js +54 -0
- package/dist/actions/update-event-type.js.map +1 -0
- package/dist/actions/update-member-role.d.ts +3 -0
- package/dist/actions/update-member-role.d.ts.map +1 -0
- package/dist/actions/update-member-role.js +23 -0
- package/dist/actions/update-member-role.js.map +1 -0
- package/dist/actions/update-profile.d.ts +3 -0
- package/dist/actions/update-profile.d.ts.map +1 -0
- package/dist/actions/update-profile.js +34 -0
- package/dist/actions/update-profile.js.map +1 -0
- package/dist/actions/update-routing-form.d.ts +3 -0
- package/dist/actions/update-routing-form.d.ts.map +1 -0
- package/dist/actions/update-routing-form.js +40 -0
- package/dist/actions/update-routing-form.js.map +1 -0
- package/dist/actions/update-schedule.d.ts +3 -0
- package/dist/actions/update-schedule.d.ts.map +1 -0
- package/dist/actions/update-schedule.js +44 -0
- package/dist/actions/update-schedule.js.map +1 -0
- package/dist/actions/update-workflow.d.ts +3 -0
- package/dist/actions/update-workflow.d.ts.map +1 -0
- package/dist/actions/update-workflow.js +89 -0
- package/dist/actions/update-workflow.js.map +1 -0
- package/dist/core/buffers.d.ts +25 -0
- package/dist/core/buffers.d.ts.map +1 -0
- package/dist/core/buffers.js +21 -0
- package/dist/core/buffers.js.map +1 -0
- package/dist/core/conflicts.d.ts +11 -0
- package/dist/core/conflicts.d.ts.map +1 -0
- package/dist/core/conflicts.js +42 -0
- package/dist/core/conflicts.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/limits.d.ts +23 -0
- package/dist/core/limits.d.ts.map +1 -0
- package/dist/core/limits.js +28 -0
- package/dist/core/limits.js.map +1 -0
- package/dist/core/round-robin.d.ts +31 -0
- package/dist/core/round-robin.d.ts.map +1 -0
- package/dist/core/round-robin.js +57 -0
- package/dist/core/round-robin.js.map +1 -0
- package/dist/core/rrule.d.ts +2 -0
- package/dist/core/rrule.d.ts.map +1 -0
- package/dist/core/rrule.js +14 -0
- package/dist/core/rrule.js.map +1 -0
- package/dist/core/rules.d.ts +26 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +40 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/slots.d.ts +58 -0
- package/dist/core/slots.d.ts.map +1 -0
- package/dist/core/slots.js +98 -0
- package/dist/core/slots.js.map +1 -0
- package/dist/core/time.d.ts +52 -0
- package/dist/core/time.d.ts.map +1 -0
- package/dist/core/time.js +109 -0
- package/dist/core/time.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +28 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +160 -0
- package/dist/manifest.js.map +1 -0
- package/dist/react/components/SlotPicker.d.ts +21 -0
- package/dist/react/components/SlotPicker.d.ts.map +1 -0
- package/dist/react/components/SlotPicker.js +15 -0
- package/dist/react/components/SlotPicker.js.map +1 -0
- package/dist/react/components/TimezoneSelect.d.ts +7 -0
- package/dist/react/components/TimezoneSelect.d.ts.map +1 -0
- package/dist/react/components/TimezoneSelect.js +31 -0
- package/dist/react/components/TimezoneSelect.js.map +1 -0
- package/dist/react/components/booking-links/AvailabilityEditor.d.ts +21 -0
- package/dist/react/components/booking-links/AvailabilityEditor.d.ts.map +1 -0
- package/dist/react/components/booking-links/AvailabilityEditor.js +102 -0
- package/dist/react/components/booking-links/AvailabilityEditor.js.map +1 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.d.ts +22 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.d.ts.map +1 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.js +75 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.js.map +1 -0
- package/dist/react/components/booking-links/ConferencingSelector.d.ts +19 -0
- package/dist/react/components/booking-links/ConferencingSelector.d.ts.map +1 -0
- package/dist/react/components/booking-links/ConferencingSelector.js +87 -0
- package/dist/react/components/booking-links/ConferencingSelector.js.map +1 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.d.ts +19 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.d.ts.map +1 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.js +117 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.js.map +1 -0
- package/dist/react/components/booking-links/DurationPicker.d.ts +9 -0
- package/dist/react/components/booking-links/DurationPicker.d.ts.map +1 -0
- package/dist/react/components/booking-links/DurationPicker.js +56 -0
- package/dist/react/components/booking-links/DurationPicker.js.map +1 -0
- package/dist/react/components/booking-links/SlugEditor.d.ts +15 -0
- package/dist/react/components/booking-links/SlugEditor.d.ts.map +1 -0
- package/dist/react/components/booking-links/SlugEditor.js +64 -0
- package/dist/react/components/booking-links/SlugEditor.js.map +1 -0
- package/dist/react/components/booking-links/index.d.ts +16 -0
- package/dist/react/components/booking-links/index.d.ts.map +1 -0
- package/dist/react/components/booking-links/index.js +16 -0
- package/dist/react/components/booking-links/index.js.map +1 -0
- package/dist/react/components/index.d.ts +14 -0
- package/dist/react/components/index.d.ts.map +1 -0
- package/dist/react/components/index.js +14 -0
- package/dist/react/components/index.js.map +1 -0
- package/dist/react/hooks/useBookingFlow.d.ts +33 -0
- package/dist/react/hooks/useBookingFlow.d.ts.map +1 -0
- package/dist/react/hooks/useBookingFlow.js +51 -0
- package/dist/react/hooks/useBookingFlow.js.map +1 -0
- package/dist/react/hooks/useEventType.d.ts +21 -0
- package/dist/react/hooks/useEventType.d.ts.map +1 -0
- package/dist/react/hooks/useEventType.js +38 -0
- package/dist/react/hooks/useEventType.js.map +1 -0
- package/dist/react/hooks/useReschedule.d.ts +13 -0
- package/dist/react/hooks/useReschedule.d.ts.map +1 -0
- package/dist/react/hooks/useReschedule.js +33 -0
- package/dist/react/hooks/useReschedule.js.map +1 -0
- package/dist/react/hooks/useSlots.d.ts +32 -0
- package/dist/react/hooks/useSlots.d.ts.map +1 -0
- package/dist/react/hooks/useSlots.js +59 -0
- package/dist/react/hooks/useSlots.js.map +1 -0
- package/dist/react/hooks/useTimezone.d.ts +3 -0
- package/dist/react/hooks/useTimezone.d.ts.map +1 -0
- package/dist/react/hooks/useTimezone.js +30 -0
- package/dist/react/hooks/useTimezone.js.map +1 -0
- package/dist/react/index.d.ts +11 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +11 -0
- package/dist/react/index.js.map +1 -0
- package/dist/schema/bookings.d.ts +1201 -0
- package/dist/schema/bookings.d.ts.map +1 -0
- package/dist/schema/bookings.js +100 -0
- package/dist/schema/bookings.js.map +1 -0
- package/dist/schema/calendar-cache.d.ts +160 -0
- package/dist/schema/calendar-cache.d.ts.map +1 -0
- package/dist/schema/calendar-cache.js +23 -0
- package/dist/schema/calendar-cache.js.map +1 -0
- package/dist/schema/credentials.d.ts +743 -0
- package/dist/schema/credentials.d.ts.map +1 -0
- package/dist/schema/credentials.js +79 -0
- package/dist/schema/credentials.js.map +1 -0
- package/dist/schema/event-types.d.ts +1292 -0
- package/dist/schema/event-types.d.ts.map +1 -0
- package/dist/schema/event-types.js +131 -0
- package/dist/schema/event-types.js.map +1 -0
- package/dist/schema/index.d.ts +20 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +20 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/routing-forms.d.ts +571 -0
- package/dist/schema/routing-forms.d.ts.map +1 -0
- package/dist/schema/routing-forms.js +44 -0
- package/dist/schema/routing-forms.js.map +1 -0
- package/dist/schema/schedules.d.ts +830 -0
- package/dist/schema/schedules.d.ts.map +1 -0
- package/dist/schema/schedules.js +72 -0
- package/dist/schema/schedules.js.map +1 -0
- package/dist/schema/teams.d.ts +569 -0
- package/dist/schema/teams.d.ts.map +1 -0
- package/dist/schema/teams.js +38 -0
- package/dist/schema/teams.js.map +1 -0
- package/dist/schema/workflows.d.ts +1367 -0
- package/dist/schema/workflows.d.ts.map +1 -0
- package/dist/schema/workflows.js +116 -0
- package/dist/schema/workflows.js.map +1 -0
- package/dist/server/availability-engine.d.ts +21 -0
- package/dist/server/availability-engine.d.ts.map +1 -0
- package/dist/server/availability-engine.js +135 -0
- package/dist/server/availability-engine.js.map +1 -0
- package/dist/server/booking-service.d.ts +46 -0
- package/dist/server/booking-service.d.ts.map +1 -0
- package/dist/server/booking-service.js +198 -0
- package/dist/server/booking-service.js.map +1 -0
- package/dist/server/bookings-repo.d.ts +48 -0
- package/dist/server/bookings-repo.d.ts.map +1 -0
- package/dist/server/bookings-repo.js +244 -0
- package/dist/server/bookings-repo.js.map +1 -0
- package/dist/server/context.d.ts +33 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +11 -0
- package/dist/server/context.js.map +1 -0
- package/dist/server/db-types.d.ts +15 -0
- package/dist/server/db-types.d.ts.map +1 -0
- package/dist/server/db-types.js +2 -0
- package/dist/server/db-types.js.map +1 -0
- package/dist/server/event-types-repo.d.ts +46 -0
- package/dist/server/event-types-repo.d.ts.map +1 -0
- package/dist/server/event-types-repo.js +320 -0
- package/dist/server/event-types-repo.js.map +1 -0
- package/dist/server/hooks.d.ts +6 -0
- package/dist/server/hooks.d.ts.map +1 -0
- package/dist/server/hooks.js +173 -0
- package/dist/server/hooks.js.map +1 -0
- package/dist/server/ics.d.ts +12 -0
- package/dist/server/ics.d.ts.map +1 -0
- package/dist/server/ics.js +81 -0
- package/dist/server/ics.js.map +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +12 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/providers/builtin-video.d.ts +12 -0
- package/dist/server/providers/builtin-video.d.ts.map +1 -0
- package/dist/server/providers/builtin-video.js +50 -0
- package/dist/server/providers/builtin-video.js.map +1 -0
- package/dist/server/providers/cal-video.d.ts +12 -0
- package/dist/server/providers/cal-video.d.ts.map +1 -0
- package/dist/server/providers/cal-video.js +50 -0
- package/dist/server/providers/cal-video.js.map +1 -0
- package/dist/server/providers/google-calendar.d.ts +28 -0
- package/dist/server/providers/google-calendar.d.ts.map +1 -0
- package/dist/server/providers/google-calendar.js +163 -0
- package/dist/server/providers/google-calendar.js.map +1 -0
- package/dist/server/providers/google-meet.d.ts +10 -0
- package/dist/server/providers/google-meet.d.ts.map +1 -0
- package/dist/server/providers/google-meet.js +14 -0
- package/dist/server/providers/google-meet.js.map +1 -0
- package/dist/server/providers/index.d.ts +8 -0
- package/dist/server/providers/index.d.ts.map +1 -0
- package/dist/server/providers/index.js +8 -0
- package/dist/server/providers/index.js.map +1 -0
- package/dist/server/providers/office365.d.ts +21 -0
- package/dist/server/providers/office365.d.ts.map +1 -0
- package/dist/server/providers/office365.js +146 -0
- package/dist/server/providers/office365.js.map +1 -0
- package/dist/server/providers/registry.d.ts +14 -0
- package/dist/server/providers/registry.d.ts.map +1 -0
- package/dist/server/providers/registry.js +28 -0
- package/dist/server/providers/registry.js.map +1 -0
- package/dist/server/providers/types.d.ts +133 -0
- package/dist/server/providers/types.d.ts.map +1 -0
- package/dist/server/providers/types.js +2 -0
- package/dist/server/providers/types.js.map +1 -0
- package/dist/server/providers/zoom.d.ts +34 -0
- package/dist/server/providers/zoom.d.ts.map +1 -0
- package/dist/server/providers/zoom.js +111 -0
- package/dist/server/providers/zoom.js.map +1 -0
- package/dist/server/schedules-repo.d.ts +26 -0
- package/dist/server/schedules-repo.d.ts.map +1 -0
- package/dist/server/schedules-repo.js +223 -0
- package/dist/server/schedules-repo.js.map +1 -0
- package/dist/server/video-oauth-state.d.ts +28 -0
- package/dist/server/video-oauth-state.d.ts.map +1 -0
- package/dist/server/video-oauth-state.js +101 -0
- package/dist/server/video-oauth-state.js.map +1 -0
- package/dist/server/video-oauth.d.ts +18 -0
- package/dist/server/video-oauth.d.ts.map +1 -0
- package/dist/server/video-oauth.js +82 -0
- package/dist/server/video-oauth.js.map +1 -0
- package/dist/shared/index.d.ts +298 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +6 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/docs/UI_UNIFICATION.md +78 -0
- package/docs/actions.md +64 -0
- package/docs/eject.md +18 -0
- package/docs/llms-full.txt +1022 -0
- package/docs/llms.txt +89 -0
- package/docs/providers.md +68 -0
- package/docs/schema.md +86 -0
- package/docs/skills/availability/SKILL.md +44 -0
- package/docs/skills/booker/SKILL.md +51 -0
- package/docs/skills/bookings/SKILL.md +43 -0
- package/docs/skills/embeds/SKILL.md +49 -0
- package/docs/skills/event-types/SKILL.md +40 -0
- package/docs/skills/integrations/SKILL.md +52 -0
- package/docs/skills/routing-forms/SKILL.md +39 -0
- package/docs/skills/scheduling-basics/SKILL.md +51 -0
- package/docs/skills/slot-engine/SKILL.md +52 -0
- package/docs/skills/team-scheduling/SKILL.md +54 -0
- package/docs/skills/workflows/SKILL.md +55 -0
- package/package.json +87 -0
- package/src/actions/_helpers.ts +62 -0
- package/src/actions/accept-team-invite.ts +26 -0
- package/src/actions/add-booking-attendee.ts +32 -0
- package/src/actions/add-booking-note.ts +25 -0
- package/src/actions/add-date-override.ts +23 -0
- package/src/actions/add-private-link.ts +31 -0
- package/src/actions/assign-round-robin-host.ts +54 -0
- package/src/actions/cancel-booking.ts +39 -0
- package/src/actions/check-availability.ts +46 -0
- package/src/actions/confirm-booking.ts +15 -0
- package/src/actions/connect-calendar.ts +27 -0
- package/src/actions/connect-video.ts +57 -0
- package/src/actions/create-booking.ts +62 -0
- package/src/actions/create-event-type.ts +45 -0
- package/src/actions/create-host-group.ts +25 -0
- package/src/actions/create-routing-form.ts +39 -0
- package/src/actions/create-schedule.ts +36 -0
- package/src/actions/create-team.ts +44 -0
- package/src/actions/create-workflow.ts +83 -0
- package/src/actions/delete-event-type.ts +14 -0
- package/src/actions/delete-routing-form.ts +21 -0
- package/src/actions/delete-schedule.ts +14 -0
- package/src/actions/delete-workflow.ts +21 -0
- package/src/actions/disconnect-calendar.ts +22 -0
- package/src/actions/duplicate-event-type.ts +36 -0
- package/src/actions/export-bookings-csv.ts +54 -0
- package/src/actions/find-available-slot.ts +40 -0
- package/src/actions/get-availability.ts +20 -0
- package/src/actions/get-booking.ts +9 -0
- package/src/actions/get-event-type.ts +29 -0
- package/src/actions/install-conferencing-app.ts +29 -0
- package/src/actions/invite-team-member.ts +30 -0
- package/src/actions/list-bookings.ts +36 -0
- package/src/actions/list-calendar-integrations.ts +26 -0
- package/src/actions/list-event-types.ts +31 -0
- package/src/actions/list-routing-form-responses.ts +24 -0
- package/src/actions/list-routing-forms.ts +34 -0
- package/src/actions/list-schedules.ts +16 -0
- package/src/actions/list-selected-calendars.ts +41 -0
- package/src/actions/list-workflows.ts +34 -0
- package/src/actions/mark-no-show.ts +15 -0
- package/src/actions/refresh-busy-times.ts +26 -0
- package/src/actions/remove-booking-attendee.ts +24 -0
- package/src/actions/remove-date-override.ts +15 -0
- package/src/actions/remove-team-member.ts +23 -0
- package/src/actions/reorder-event-types.ts +18 -0
- package/src/actions/reschedule-booking.ts +45 -0
- package/src/actions/revoke-private-link.ts +16 -0
- package/src/actions/send-reschedule-link.ts +18 -0
- package/src/actions/set-appearance.ts +24 -0
- package/src/actions/set-default-conferencing-app.ts +25 -0
- package/src/actions/set-default-schedule.ts +15 -0
- package/src/actions/set-destination-calendar.ts +39 -0
- package/src/actions/set-event-type-hosts.ts +43 -0
- package/src/actions/set-event-type-location.ts +18 -0
- package/src/actions/set-host-availability-override.ts +27 -0
- package/src/actions/set-team-branding.ts +28 -0
- package/src/actions/submit-routing-form-response.ts +47 -0
- package/src/actions/toggle-event-type-hidden.ts +21 -0
- package/src/actions/toggle-selected-calendar.ts +43 -0
- package/src/actions/toggle-workflow.ts +25 -0
- package/src/actions/update-event-type.ts +54 -0
- package/src/actions/update-member-role.ts +28 -0
- package/src/actions/update-profile.ts +36 -0
- package/src/actions/update-routing-form.ts +36 -0
- package/src/actions/update-schedule.ts +53 -0
- package/src/actions/update-workflow.ts +89 -0
- package/src/core/buffers.ts +46 -0
- package/src/core/conflicts.ts +49 -0
- package/src/core/index.ts +8 -0
- package/src/core/limits.ts +60 -0
- package/src/core/round-robin.test.ts +95 -0
- package/src/core/round-robin.ts +103 -0
- package/src/core/rrule.ts +20 -0
- package/src/core/rules.ts +66 -0
- package/src/core/slots.test.ts +246 -0
- package/src/core/slots.ts +223 -0
- package/src/core/time.ts +136 -0
- package/src/index.ts +14 -0
- package/src/manifest.ts +174 -0
- package/src/react/components/SlotPicker.tsx +72 -0
- package/src/react/components/TimezoneSelect.tsx +55 -0
- package/src/react/components/_shadcn-shims.d.ts +251 -0
- package/src/react/components/booking-links/AvailabilityEditor.tsx +177 -0
- package/src/react/components/booking-links/BookingLinkCreateDialog.tsx +189 -0
- package/src/react/components/booking-links/ConferencingSelector.tsx +255 -0
- package/src/react/components/booking-links/CustomFieldsEditor.tsx +420 -0
- package/src/react/components/booking-links/DurationPicker.tsx +115 -0
- package/src/react/components/booking-links/SlugEditor.tsx +149 -0
- package/src/react/components/booking-links/index.ts +15 -0
- package/src/react/components/index.ts +13 -0
- package/src/react/hooks/useBookingFlow.ts +113 -0
- package/src/react/hooks/useEventType.ts +52 -0
- package/src/react/hooks/useReschedule.ts +39 -0
- package/src/react/hooks/useSlots.ts +88 -0
- package/src/react/hooks/useTimezone.ts +29 -0
- package/src/react/index.ts +10 -0
- package/src/schema/bookings.ts +124 -0
- package/src/schema/calendar-cache.ts +23 -0
- package/src/schema/credentials.ts +83 -0
- package/src/schema/event-types.ts +154 -0
- package/src/schema/index.ts +19 -0
- package/src/schema/routing-forms.ts +52 -0
- package/src/schema/schedules.ts +83 -0
- package/src/schema/teams.ts +46 -0
- package/src/schema/workflows.ts +128 -0
- package/src/server/availability-engine.ts +193 -0
- package/src/server/booking-service.ts +264 -0
- package/src/server/bookings-repo.ts +330 -0
- package/src/server/context.ts +49 -0
- package/src/server/db-types.ts +16 -0
- package/src/server/event-types-repo.ts +385 -0
- package/src/server/hooks.ts +213 -0
- package/src/server/ics.ts +99 -0
- package/src/server/index.ts +11 -0
- package/src/server/providers/builtin-video.ts +62 -0
- package/src/server/providers/google-calendar.ts +237 -0
- package/src/server/providers/google-meet.ts +22 -0
- package/src/server/providers/index.ts +7 -0
- package/src/server/providers/office365.ts +208 -0
- package/src/server/providers/registry.ts +43 -0
- package/src/server/providers/types.ts +126 -0
- package/src/server/providers/zoom.ts +173 -0
- package/src/server/schedules-repo.ts +279 -0
- package/src/server/video-oauth-state.test.ts +120 -0
- package/src/server/video-oauth-state.ts +116 -0
- package/src/server/video-oauth.ts +99 -0
- package/src/shared/index.ts +366 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data access for event types.
|
|
3
|
+
*
|
|
4
|
+
* All write paths funnel through here so ownership, slug uniqueness, and
|
|
5
|
+
* redirect history are handled consistently.
|
|
6
|
+
*/
|
|
7
|
+
import { eq, and, or, type SQL } from "drizzle-orm";
|
|
8
|
+
import { nanoid } from "nanoid";
|
|
9
|
+
import { accessFilter } from "@agent-native/core/sharing";
|
|
10
|
+
import type {
|
|
11
|
+
EventType,
|
|
12
|
+
Location,
|
|
13
|
+
CustomField,
|
|
14
|
+
RecurringEventRule,
|
|
15
|
+
} from "../shared/index.js";
|
|
16
|
+
import { getSchedulingContext } from "./context.js";
|
|
17
|
+
|
|
18
|
+
function keyFor(
|
|
19
|
+
ownerEmail: string | null,
|
|
20
|
+
teamId: string | null,
|
|
21
|
+
slug: string,
|
|
22
|
+
): string {
|
|
23
|
+
if (teamId) return `team:${teamId}:${slug}`;
|
|
24
|
+
return `user:${ownerEmail ?? ""}:${slug}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function rowToEventType(row: any): EventType {
|
|
28
|
+
return {
|
|
29
|
+
id: row.id,
|
|
30
|
+
title: row.title,
|
|
31
|
+
slug: row.slug,
|
|
32
|
+
description: row.description ?? undefined,
|
|
33
|
+
length: row.length,
|
|
34
|
+
durations: parseJson<number[]>(row.durations),
|
|
35
|
+
hidden: Boolean(row.hidden),
|
|
36
|
+
position: row.position,
|
|
37
|
+
schedulingType: row.schedulingType,
|
|
38
|
+
ownerEmail: row.ownerEmail ?? undefined,
|
|
39
|
+
teamId: row.teamId ?? undefined,
|
|
40
|
+
scheduleId: row.scheduleId ?? undefined,
|
|
41
|
+
locations: parseJson<Location[]>(row.locations) ?? [],
|
|
42
|
+
customFields: parseJson<CustomField[]>(row.customFields) ?? [],
|
|
43
|
+
minimumBookingNotice: row.minimumBookingNotice,
|
|
44
|
+
beforeEventBuffer: row.beforeEventBuffer,
|
|
45
|
+
afterEventBuffer: row.afterEventBuffer,
|
|
46
|
+
slotInterval: row.slotInterval ?? null,
|
|
47
|
+
periodType: row.periodType,
|
|
48
|
+
periodDays: row.periodDays ?? undefined,
|
|
49
|
+
periodStartDate: row.periodStartDate ?? undefined,
|
|
50
|
+
periodEndDate: row.periodEndDate ?? undefined,
|
|
51
|
+
seatsPerTimeSlot: row.seatsPerTimeSlot ?? undefined,
|
|
52
|
+
requiresConfirmation: Boolean(row.requiresConfirmation),
|
|
53
|
+
disableGuests: Boolean(row.disableGuests),
|
|
54
|
+
hideCalendarNotes: Boolean(row.hideCalendarNotes),
|
|
55
|
+
successRedirectUrl: row.successRedirectUrl ?? undefined,
|
|
56
|
+
bookingLimits: parseJson(row.bookingLimits),
|
|
57
|
+
lockTimeZoneToggle: Boolean(row.lockTimeZoneToggle),
|
|
58
|
+
color: row.color ?? undefined,
|
|
59
|
+
eventName: row.eventName ?? undefined,
|
|
60
|
+
recurringEvent: parseJson(row.recurringEvent),
|
|
61
|
+
metadata: parseJson(row.metadata),
|
|
62
|
+
createdAt: row.createdAt,
|
|
63
|
+
updatedAt: row.updatedAt,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function parseJson<T = any>(str: string | null | undefined): T | undefined {
|
|
68
|
+
if (!str) return undefined;
|
|
69
|
+
try {
|
|
70
|
+
return JSON.parse(str);
|
|
71
|
+
} catch {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function listEventTypes(params: {
|
|
77
|
+
/**
|
|
78
|
+
* If provided and `useAccessFilter` is not true, narrow rows to this owner.
|
|
79
|
+
* For org-aware list calls, prefer `useAccessFilter: true` instead.
|
|
80
|
+
*/
|
|
81
|
+
ownerEmail?: string;
|
|
82
|
+
teamId?: string;
|
|
83
|
+
includeHidden?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* When true, apply the framework `accessFilter` (owner OR shared OR
|
|
86
|
+
* org-visibility OR public) instead of plain ownerEmail equality. This is
|
|
87
|
+
* the right mode for any UI/agent listing, since it admits org-shared and
|
|
88
|
+
* explicitly-shared event types in addition to the user's own.
|
|
89
|
+
*/
|
|
90
|
+
useAccessFilter?: boolean;
|
|
91
|
+
}): Promise<EventType[]> {
|
|
92
|
+
const { getDb, schema } = getSchedulingContext();
|
|
93
|
+
const db = getDb();
|
|
94
|
+
let rows: any[];
|
|
95
|
+
if (params.teamId) {
|
|
96
|
+
// Team-scoped listings. Callers are responsible for asserting team
|
|
97
|
+
// membership before invoking — the repo does not (it runs without a
|
|
98
|
+
// request context in some paths, e.g. public booking pages that
|
|
99
|
+
// explicitly pass a teamId).
|
|
100
|
+
rows = await db
|
|
101
|
+
.select()
|
|
102
|
+
.from(schema.eventTypes)
|
|
103
|
+
.where(eq(schema.eventTypes.teamId, params.teamId));
|
|
104
|
+
} else if (params.useAccessFilter) {
|
|
105
|
+
rows = await db
|
|
106
|
+
.select()
|
|
107
|
+
.from(schema.eventTypes)
|
|
108
|
+
.where(accessFilter(schema.eventTypes, schema.eventTypeShares));
|
|
109
|
+
} else if (params.ownerEmail) {
|
|
110
|
+
rows = await db
|
|
111
|
+
.select()
|
|
112
|
+
.from(schema.eventTypes)
|
|
113
|
+
.where(eq(schema.eventTypes.ownerEmail, params.ownerEmail));
|
|
114
|
+
} else {
|
|
115
|
+
// Refuse to return unscoped results. Callers must supply at least
|
|
116
|
+
// one of: teamId, useAccessFilter, or ownerEmail.
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
return rows
|
|
120
|
+
.filter((r: any) => (params.includeHidden ? true : !r.hidden))
|
|
121
|
+
.sort((a: any, b: any) => a.position - b.position)
|
|
122
|
+
.map(rowToEventType);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export async function getEventTypeById(id: string): Promise<EventType | null> {
|
|
126
|
+
const { getDb, schema } = getSchedulingContext();
|
|
127
|
+
const rows = await getDb()
|
|
128
|
+
.select()
|
|
129
|
+
.from(schema.eventTypes)
|
|
130
|
+
.where(eq(schema.eventTypes.id, id));
|
|
131
|
+
return rows[0] ? rowToEventType(rows[0]) : null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export async function getEventTypeBySlug(params: {
|
|
135
|
+
ownerEmail?: string;
|
|
136
|
+
teamId?: string;
|
|
137
|
+
slug: string;
|
|
138
|
+
}): Promise<EventType | null> {
|
|
139
|
+
const { getDb, schema } = getSchedulingContext();
|
|
140
|
+
const db = getDb();
|
|
141
|
+
let rows: any[];
|
|
142
|
+
if (params.teamId) {
|
|
143
|
+
rows = await db
|
|
144
|
+
.select()
|
|
145
|
+
.from(schema.eventTypes)
|
|
146
|
+
.where(
|
|
147
|
+
and(
|
|
148
|
+
eq(schema.eventTypes.teamId, params.teamId),
|
|
149
|
+
eq(schema.eventTypes.slug, params.slug),
|
|
150
|
+
),
|
|
151
|
+
);
|
|
152
|
+
} else if (params.ownerEmail) {
|
|
153
|
+
rows = await db
|
|
154
|
+
.select()
|
|
155
|
+
.from(schema.eventTypes)
|
|
156
|
+
.where(
|
|
157
|
+
and(
|
|
158
|
+
eq(schema.eventTypes.ownerEmail, params.ownerEmail),
|
|
159
|
+
eq(schema.eventTypes.slug, params.slug),
|
|
160
|
+
),
|
|
161
|
+
);
|
|
162
|
+
} else {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return rows[0] ? rowToEventType(rows[0]) : null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export async function createEventType(input: {
|
|
169
|
+
ownerEmail?: string;
|
|
170
|
+
teamId?: string;
|
|
171
|
+
orgId?: string;
|
|
172
|
+
title: string;
|
|
173
|
+
slug: string;
|
|
174
|
+
length: number;
|
|
175
|
+
description?: string;
|
|
176
|
+
schedulingType?: EventType["schedulingType"];
|
|
177
|
+
locations?: Location[];
|
|
178
|
+
customFields?: CustomField[];
|
|
179
|
+
scheduleId?: string;
|
|
180
|
+
color?: string;
|
|
181
|
+
recurringEvent?: RecurringEventRule;
|
|
182
|
+
}): Promise<EventType> {
|
|
183
|
+
const { getDb, schema } = getSchedulingContext();
|
|
184
|
+
const db = getDb();
|
|
185
|
+
const now = new Date().toISOString();
|
|
186
|
+
const id = nanoid();
|
|
187
|
+
// Default location: the user's `isDefault` conferencing credential if they
|
|
188
|
+
// have one installed (Zoom, Meet, Teams), otherwise no location — the
|
|
189
|
+
// editor will prompt them to pick.
|
|
190
|
+
const defaultLocations: Location[] =
|
|
191
|
+
input.locations ??
|
|
192
|
+
(input.ownerEmail ? await resolveDefaultLocation(input.ownerEmail) : []);
|
|
193
|
+
await db.insert(schema.eventTypes).values({
|
|
194
|
+
id,
|
|
195
|
+
title: input.title,
|
|
196
|
+
slug: input.slug,
|
|
197
|
+
description: input.description ?? null,
|
|
198
|
+
length: input.length,
|
|
199
|
+
position: 0,
|
|
200
|
+
hidden: false,
|
|
201
|
+
schedulingType: input.schedulingType ?? "personal",
|
|
202
|
+
ownerEmail: input.ownerEmail ?? null,
|
|
203
|
+
teamId: input.teamId ?? null,
|
|
204
|
+
scheduleId: input.scheduleId ?? null,
|
|
205
|
+
locations: JSON.stringify(defaultLocations),
|
|
206
|
+
customFields: input.customFields
|
|
207
|
+
? JSON.stringify(input.customFields)
|
|
208
|
+
: JSON.stringify([]),
|
|
209
|
+
minimumBookingNotice: 0,
|
|
210
|
+
beforeEventBuffer: 0,
|
|
211
|
+
afterEventBuffer: 0,
|
|
212
|
+
slotInterval: null,
|
|
213
|
+
periodType: "rolling",
|
|
214
|
+
periodDays: 60,
|
|
215
|
+
requiresConfirmation: false,
|
|
216
|
+
disableGuests: false,
|
|
217
|
+
hideCalendarNotes: false,
|
|
218
|
+
lockTimeZoneToggle: false,
|
|
219
|
+
color: input.color ?? null,
|
|
220
|
+
recurringEvent: input.recurringEvent
|
|
221
|
+
? JSON.stringify(input.recurringEvent)
|
|
222
|
+
: null,
|
|
223
|
+
createdAt: now,
|
|
224
|
+
updatedAt: now,
|
|
225
|
+
orgId: input.orgId ?? null,
|
|
226
|
+
});
|
|
227
|
+
const created = await getEventTypeById(id);
|
|
228
|
+
if (!created) throw new Error("Failed to create event type");
|
|
229
|
+
return created;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export async function updateEventType(
|
|
233
|
+
id: string,
|
|
234
|
+
patch: Partial<EventType>,
|
|
235
|
+
): Promise<EventType> {
|
|
236
|
+
const { getDb, schema } = getSchedulingContext();
|
|
237
|
+
const db = getDb();
|
|
238
|
+
const current = await getEventTypeById(id);
|
|
239
|
+
if (!current) throw new Error(`Event type ${id} not found`);
|
|
240
|
+
|
|
241
|
+
const dbPatch: Record<string, any> = {};
|
|
242
|
+
if (patch.title != null) dbPatch.title = patch.title;
|
|
243
|
+
if (patch.slug != null && patch.slug !== current.slug) {
|
|
244
|
+
// Record slug redirect
|
|
245
|
+
const oldKey = keyFor(
|
|
246
|
+
current.ownerEmail ?? null,
|
|
247
|
+
current.teamId ?? null,
|
|
248
|
+
current.slug,
|
|
249
|
+
);
|
|
250
|
+
const newKey = keyFor(
|
|
251
|
+
current.ownerEmail ?? null,
|
|
252
|
+
current.teamId ?? null,
|
|
253
|
+
patch.slug,
|
|
254
|
+
);
|
|
255
|
+
await db
|
|
256
|
+
.insert(schema.eventTypeSlugRedirects)
|
|
257
|
+
.values({
|
|
258
|
+
oldKey,
|
|
259
|
+
newKey,
|
|
260
|
+
eventTypeId: id,
|
|
261
|
+
createdAt: new Date().toISOString(),
|
|
262
|
+
})
|
|
263
|
+
.onConflictDoNothing?.();
|
|
264
|
+
dbPatch.slug = patch.slug;
|
|
265
|
+
}
|
|
266
|
+
if (patch.description !== undefined)
|
|
267
|
+
dbPatch.description = patch.description ?? null;
|
|
268
|
+
if (patch.length != null) dbPatch.length = patch.length;
|
|
269
|
+
if (patch.durations !== undefined)
|
|
270
|
+
dbPatch.durations = patch.durations
|
|
271
|
+
? JSON.stringify(patch.durations)
|
|
272
|
+
: null;
|
|
273
|
+
if (patch.hidden != null) dbPatch.hidden = patch.hidden;
|
|
274
|
+
if (patch.position != null) dbPatch.position = patch.position;
|
|
275
|
+
if (patch.schedulingType != null)
|
|
276
|
+
dbPatch.schedulingType = patch.schedulingType;
|
|
277
|
+
if (patch.scheduleId !== undefined)
|
|
278
|
+
dbPatch.scheduleId = patch.scheduleId ?? null;
|
|
279
|
+
if (patch.locations !== undefined)
|
|
280
|
+
dbPatch.locations = JSON.stringify(patch.locations ?? []);
|
|
281
|
+
if (patch.customFields !== undefined)
|
|
282
|
+
dbPatch.customFields = JSON.stringify(patch.customFields ?? []);
|
|
283
|
+
if (patch.minimumBookingNotice != null)
|
|
284
|
+
dbPatch.minimumBookingNotice = patch.minimumBookingNotice;
|
|
285
|
+
if (patch.beforeEventBuffer != null)
|
|
286
|
+
dbPatch.beforeEventBuffer = patch.beforeEventBuffer;
|
|
287
|
+
if (patch.afterEventBuffer != null)
|
|
288
|
+
dbPatch.afterEventBuffer = patch.afterEventBuffer;
|
|
289
|
+
if (patch.slotInterval !== undefined)
|
|
290
|
+
dbPatch.slotInterval = patch.slotInterval;
|
|
291
|
+
if (patch.periodType != null) dbPatch.periodType = patch.periodType;
|
|
292
|
+
if (patch.periodDays !== undefined)
|
|
293
|
+
dbPatch.periodDays = patch.periodDays ?? null;
|
|
294
|
+
if (patch.periodStartDate !== undefined)
|
|
295
|
+
dbPatch.periodStartDate = patch.periodStartDate ?? null;
|
|
296
|
+
if (patch.periodEndDate !== undefined)
|
|
297
|
+
dbPatch.periodEndDate = patch.periodEndDate ?? null;
|
|
298
|
+
if (patch.seatsPerTimeSlot !== undefined)
|
|
299
|
+
dbPatch.seatsPerTimeSlot = patch.seatsPerTimeSlot ?? null;
|
|
300
|
+
if (patch.requiresConfirmation != null)
|
|
301
|
+
dbPatch.requiresConfirmation = patch.requiresConfirmation;
|
|
302
|
+
if (patch.disableGuests != null) dbPatch.disableGuests = patch.disableGuests;
|
|
303
|
+
if (patch.hideCalendarNotes != null)
|
|
304
|
+
dbPatch.hideCalendarNotes = patch.hideCalendarNotes;
|
|
305
|
+
if (patch.successRedirectUrl !== undefined)
|
|
306
|
+
dbPatch.successRedirectUrl = patch.successRedirectUrl ?? null;
|
|
307
|
+
if (patch.bookingLimits !== undefined)
|
|
308
|
+
dbPatch.bookingLimits = patch.bookingLimits
|
|
309
|
+
? JSON.stringify(patch.bookingLimits)
|
|
310
|
+
: null;
|
|
311
|
+
if (patch.lockTimeZoneToggle != null)
|
|
312
|
+
dbPatch.lockTimeZoneToggle = patch.lockTimeZoneToggle;
|
|
313
|
+
if (patch.color !== undefined) dbPatch.color = patch.color ?? null;
|
|
314
|
+
if (patch.eventName !== undefined)
|
|
315
|
+
dbPatch.eventName = patch.eventName ?? null;
|
|
316
|
+
if (patch.recurringEvent !== undefined)
|
|
317
|
+
dbPatch.recurringEvent = patch.recurringEvent
|
|
318
|
+
? JSON.stringify(patch.recurringEvent)
|
|
319
|
+
: null;
|
|
320
|
+
if (patch.metadata !== undefined)
|
|
321
|
+
dbPatch.metadata = patch.metadata ? JSON.stringify(patch.metadata) : null;
|
|
322
|
+
|
|
323
|
+
dbPatch.updatedAt = new Date().toISOString();
|
|
324
|
+
|
|
325
|
+
await db
|
|
326
|
+
.update(schema.eventTypes)
|
|
327
|
+
.set(dbPatch)
|
|
328
|
+
.where(eq(schema.eventTypes.id, id));
|
|
329
|
+
const updated = await getEventTypeById(id);
|
|
330
|
+
if (!updated) throw new Error("Failed to update event type");
|
|
331
|
+
return updated;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export async function deleteEventType(id: string): Promise<void> {
|
|
335
|
+
const { getDb, schema } = getSchedulingContext();
|
|
336
|
+
await getDb().delete(schema.eventTypes).where(eq(schema.eventTypes.id, id));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Return a sensible default location for a freshly-created event type.
|
|
341
|
+
* Priority: the user's `isDefault` video conferencing credential → the
|
|
342
|
+
* first installed video credential → an empty list (editor prompts user).
|
|
343
|
+
*/
|
|
344
|
+
async function resolveDefaultLocation(ownerEmail: string): Promise<Location[]> {
|
|
345
|
+
const { getDb, schema } = getSchedulingContext();
|
|
346
|
+
const rows = await getDb()
|
|
347
|
+
.select()
|
|
348
|
+
.from(schema.schedulingCredentials)
|
|
349
|
+
.where(eq(schema.schedulingCredentials.userEmail, ownerEmail));
|
|
350
|
+
const videoKinds = new Set(["zoom_video", "google_meet", "teams_video"]);
|
|
351
|
+
const video = rows.filter((r: any) => videoKinds.has(r.type) && !r.invalid);
|
|
352
|
+
const preferred = video.find((r: any) => r.isDefault) ?? video[0];
|
|
353
|
+
if (!preferred) return [];
|
|
354
|
+
const kindMap: Record<string, Location["kind"]> = {
|
|
355
|
+
zoom_video: "zoom",
|
|
356
|
+
google_meet: "google-meet",
|
|
357
|
+
teams_video: "teams",
|
|
358
|
+
};
|
|
359
|
+
const kind = kindMap[preferred.type];
|
|
360
|
+
if (!kind) return [];
|
|
361
|
+
return [{ kind, credentialId: preferred.id }];
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export async function resolveEventTypeSlug(params: {
|
|
365
|
+
ownerEmail?: string;
|
|
366
|
+
teamId?: string;
|
|
367
|
+
slug: string;
|
|
368
|
+
}): Promise<EventType | null> {
|
|
369
|
+
const direct = await getEventTypeBySlug(params);
|
|
370
|
+
if (direct) return direct;
|
|
371
|
+
const { getDb, schema } = getSchedulingContext();
|
|
372
|
+
const oldKey = keyFor(
|
|
373
|
+
params.ownerEmail ?? null,
|
|
374
|
+
params.teamId ?? null,
|
|
375
|
+
params.slug,
|
|
376
|
+
);
|
|
377
|
+
const redirects = await getDb()
|
|
378
|
+
.select()
|
|
379
|
+
.from(schema.eventTypeSlugRedirects)
|
|
380
|
+
.where(eq(schema.eventTypeSlugRedirects.oldKey, oldKey));
|
|
381
|
+
if (redirects[0]?.eventTypeId) {
|
|
382
|
+
return getEventTypeById(redirects[0].eventTypeId);
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Booking lifecycle hooks → workflow / webhook dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* When a booking is created / rescheduled / cancelled / no-shown, we:
|
|
5
|
+
* - Materialize scheduled reminders for each active workflow step
|
|
6
|
+
* - Enqueue outgoing webhook deliveries
|
|
7
|
+
*
|
|
8
|
+
* The actual reminder + webhook firing happens on a recurring job (not here).
|
|
9
|
+
*/
|
|
10
|
+
import { eq, and, inArray } from "drizzle-orm";
|
|
11
|
+
import { nanoid } from "nanoid";
|
|
12
|
+
import type { Booking, Workflow, WorkflowStep } from "../shared/index.js";
|
|
13
|
+
import { getSchedulingContext } from "./context.js";
|
|
14
|
+
import { addMinutes } from "../core/time.js";
|
|
15
|
+
|
|
16
|
+
export async function onBookingCreated(booking: Booking): Promise<void> {
|
|
17
|
+
await materializeReminders(booking, "new-booking");
|
|
18
|
+
await materializeRemindersBefore(booking);
|
|
19
|
+
await enqueueWebhooks(booking, "BOOKING_CREATED");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function onBookingRescheduled(
|
|
23
|
+
original: Booking,
|
|
24
|
+
next: Booking,
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
await materializeReminders(next, "reschedule");
|
|
27
|
+
await enqueueWebhooks(next, "BOOKING_RESCHEDULED");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function onBookingCancelled(booking: Booking): Promise<void> {
|
|
31
|
+
await materializeReminders(booking, "cancellation");
|
|
32
|
+
await enqueueWebhooks(booking, "BOOKING_CANCELLED");
|
|
33
|
+
// Cancel any pending before-event reminders
|
|
34
|
+
const { getDb, schema } = getSchedulingContext();
|
|
35
|
+
await getDb()
|
|
36
|
+
.update(schema.scheduledReminders)
|
|
37
|
+
.set({ sent: true, sentAt: new Date().toISOString() })
|
|
38
|
+
.where(
|
|
39
|
+
and(
|
|
40
|
+
eq(schema.scheduledReminders.bookingId, booking.id),
|
|
41
|
+
eq(schema.scheduledReminders.sent, false),
|
|
42
|
+
),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function onBookingNoShow(booking: Booking): Promise<void> {
|
|
47
|
+
await materializeReminders(booking, "no-show");
|
|
48
|
+
await enqueueWebhooks(booking, "BOOKING_NO_SHOW");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function materializeReminders(
|
|
52
|
+
booking: Booking,
|
|
53
|
+
trigger: "new-booking" | "reschedule" | "cancellation" | "no-show",
|
|
54
|
+
): Promise<void> {
|
|
55
|
+
const workflows = await activeWorkflowsForEvent(booking.eventTypeId, trigger);
|
|
56
|
+
const now = new Date();
|
|
57
|
+
for (const wf of workflows) {
|
|
58
|
+
for (const step of wf.steps) {
|
|
59
|
+
const scheduledFor =
|
|
60
|
+
trigger === "new-booking" && step.offsetMinutes > 0
|
|
61
|
+
? addMinutes(now, step.offsetMinutes)
|
|
62
|
+
: now;
|
|
63
|
+
await writeReminder(booking, step, scheduledFor);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function materializeRemindersBefore(booking: Booking): Promise<void> {
|
|
69
|
+
const workflows = await activeWorkflowsForEvent(
|
|
70
|
+
booking.eventTypeId,
|
|
71
|
+
"before-event",
|
|
72
|
+
);
|
|
73
|
+
const start = new Date(booking.startTime);
|
|
74
|
+
for (const wf of workflows) {
|
|
75
|
+
for (const step of wf.steps) {
|
|
76
|
+
// offsetMinutes is how many minutes BEFORE the event
|
|
77
|
+
const scheduledFor = addMinutes(start, -Math.abs(step.offsetMinutes));
|
|
78
|
+
if (scheduledFor <= new Date()) continue;
|
|
79
|
+
await writeReminder(booking, step, scheduledFor);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const afterWorkflows = await activeWorkflowsForEvent(
|
|
83
|
+
booking.eventTypeId,
|
|
84
|
+
"after-event",
|
|
85
|
+
);
|
|
86
|
+
const end = new Date(booking.endTime);
|
|
87
|
+
for (const wf of afterWorkflows) {
|
|
88
|
+
for (const step of wf.steps) {
|
|
89
|
+
const scheduledFor = addMinutes(end, Math.abs(step.offsetMinutes));
|
|
90
|
+
await writeReminder(booking, step, scheduledFor);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function writeReminder(
|
|
96
|
+
booking: Booking,
|
|
97
|
+
step: WorkflowStep,
|
|
98
|
+
scheduledFor: Date,
|
|
99
|
+
): Promise<void> {
|
|
100
|
+
const { getDb, schema } = getSchedulingContext();
|
|
101
|
+
await getDb()
|
|
102
|
+
.insert(schema.scheduledReminders)
|
|
103
|
+
.values({
|
|
104
|
+
id: nanoid(),
|
|
105
|
+
bookingId: booking.id,
|
|
106
|
+
workflowStepId: step.id,
|
|
107
|
+
method: methodForAction(step.action),
|
|
108
|
+
scheduledFor: scheduledFor.toISOString(),
|
|
109
|
+
sent: false,
|
|
110
|
+
failed: false,
|
|
111
|
+
attempts: 0,
|
|
112
|
+
createdAt: new Date().toISOString(),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function methodForAction(
|
|
117
|
+
action: WorkflowStep["action"],
|
|
118
|
+
): "email" | "sms" | "webhook" {
|
|
119
|
+
if (action.startsWith("sms-")) return "sms";
|
|
120
|
+
if (action === "webhook") return "webhook";
|
|
121
|
+
return "email";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function activeWorkflowsForEvent(
|
|
125
|
+
eventTypeId: string,
|
|
126
|
+
trigger: string,
|
|
127
|
+
): Promise<Workflow[]> {
|
|
128
|
+
const { getDb, schema } = getSchedulingContext();
|
|
129
|
+
const db = getDb();
|
|
130
|
+
const wfRows = await db
|
|
131
|
+
.select()
|
|
132
|
+
.from(schema.workflows)
|
|
133
|
+
.where(
|
|
134
|
+
and(
|
|
135
|
+
eq(schema.workflows.trigger, trigger as any),
|
|
136
|
+
eq(schema.workflows.disabled, false),
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
const active = wfRows.filter((w: any) => {
|
|
140
|
+
const ids = safeJson<string[]>(w.activeOnEventTypeIds) ?? [];
|
|
141
|
+
return ids.includes(eventTypeId);
|
|
142
|
+
});
|
|
143
|
+
if (active.length === 0) return [];
|
|
144
|
+
const stepRows = await db
|
|
145
|
+
.select()
|
|
146
|
+
.from(schema.workflowSteps)
|
|
147
|
+
.where(
|
|
148
|
+
inArray(
|
|
149
|
+
schema.workflowSteps.workflowId,
|
|
150
|
+
active.map((w: any) => w.id),
|
|
151
|
+
),
|
|
152
|
+
);
|
|
153
|
+
return active.map((w: any) => hydrateWorkflow(w, stepRows));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async function enqueueWebhooks(booking: Booking, event: string): Promise<void> {
|
|
157
|
+
const { getDb, schema } = getSchedulingContext();
|
|
158
|
+
const db = getDb();
|
|
159
|
+
const webhooks = await db.select().from(schema.webhooks);
|
|
160
|
+
const now = new Date().toISOString();
|
|
161
|
+
for (const wh of webhooks) {
|
|
162
|
+
if (!wh.active) continue;
|
|
163
|
+
const triggers = safeJson<string[]>(wh.eventTriggers) ?? [];
|
|
164
|
+
if (!triggers.includes(event)) continue;
|
|
165
|
+
if (wh.eventTypeId && wh.eventTypeId !== booking.eventTypeId) continue;
|
|
166
|
+
await db.insert(schema.webhookDeliveries).values({
|
|
167
|
+
id: nanoid(),
|
|
168
|
+
webhookId: wh.id,
|
|
169
|
+
triggeredAt: now,
|
|
170
|
+
payload: JSON.stringify({ event, booking }),
|
|
171
|
+
success: false,
|
|
172
|
+
attempts: 0,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function hydrateWorkflow(row: any, steps: any[]): Workflow {
|
|
178
|
+
return {
|
|
179
|
+
id: row.id,
|
|
180
|
+
name: row.name,
|
|
181
|
+
trigger: row.trigger,
|
|
182
|
+
ownerEmail: row.ownerEmail ?? undefined,
|
|
183
|
+
teamId: row.teamId ?? undefined,
|
|
184
|
+
activeOnEventTypeIds: safeJson<string[]>(row.activeOnEventTypeIds) ?? [],
|
|
185
|
+
disabled: Boolean(row.disabled),
|
|
186
|
+
createdAt: row.createdAt,
|
|
187
|
+
updatedAt: row.updatedAt,
|
|
188
|
+
steps: steps
|
|
189
|
+
.filter((s) => s.workflowId === row.id)
|
|
190
|
+
.sort((a, b) => a.order - b.order)
|
|
191
|
+
.map((s) => ({
|
|
192
|
+
id: s.id,
|
|
193
|
+
order: s.order,
|
|
194
|
+
action: s.action,
|
|
195
|
+
offsetMinutes: s.offsetMinutes,
|
|
196
|
+
sendTo: s.sendTo ?? undefined,
|
|
197
|
+
emailSubject: s.emailSubject ?? undefined,
|
|
198
|
+
emailBody: s.emailBody ?? undefined,
|
|
199
|
+
smsBody: s.smsBody ?? undefined,
|
|
200
|
+
webhookUrl: s.webhookUrl ?? undefined,
|
|
201
|
+
template: s.template ?? undefined,
|
|
202
|
+
})),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function safeJson<T = any>(s: string | null | undefined): T | undefined {
|
|
207
|
+
if (!s) return undefined;
|
|
208
|
+
try {
|
|
209
|
+
return JSON.parse(s);
|
|
210
|
+
} catch {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal iCalendar (RFC 5545) generator for booking confirmation emails and
|
|
3
|
+
* the `/booking/:uid.ics` download endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Not exhaustive — just enough for Apple Mail / Outlook / Gmail to render
|
|
6
|
+
* the event card correctly and for Add-to-Calendar buttons to work.
|
|
7
|
+
*/
|
|
8
|
+
import type { Booking } from "../shared/index.js";
|
|
9
|
+
|
|
10
|
+
export function buildIcs(booking: Booking, organizerName: string): string {
|
|
11
|
+
const dtStart = toIcsDate(new Date(booking.startTime));
|
|
12
|
+
const dtEnd = toIcsDate(new Date(booking.endTime));
|
|
13
|
+
const dtStamp = toIcsDate(new Date());
|
|
14
|
+
const summary = escapeIcs(booking.title);
|
|
15
|
+
const desc = escapeIcs(
|
|
16
|
+
[
|
|
17
|
+
booking.description,
|
|
18
|
+
booking.location?.link ? `Join: ${booking.location.link}` : "",
|
|
19
|
+
booking.location?.address ? `Where: ${booking.location.address}` : "",
|
|
20
|
+
]
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join("\\n"),
|
|
23
|
+
);
|
|
24
|
+
const attendees = booking.attendees
|
|
25
|
+
.map(
|
|
26
|
+
(a) =>
|
|
27
|
+
`ATTENDEE;CN=${escapeIcs(a.name)};ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE:mailto:${a.email}`,
|
|
28
|
+
)
|
|
29
|
+
.join("\n");
|
|
30
|
+
const location = booking.location?.address
|
|
31
|
+
? `LOCATION:${escapeIcs(booking.location.address)}`
|
|
32
|
+
: booking.location?.link
|
|
33
|
+
? `LOCATION:${escapeIcs(booking.location.link)}`
|
|
34
|
+
: "";
|
|
35
|
+
|
|
36
|
+
const cancelled = booking.status === "cancelled";
|
|
37
|
+
return [
|
|
38
|
+
"BEGIN:VCALENDAR",
|
|
39
|
+
"VERSION:2.0",
|
|
40
|
+
"PRODID:-//agent-native//scheduling//EN",
|
|
41
|
+
"CALSCALE:GREGORIAN",
|
|
42
|
+
"METHOD:" + (cancelled ? "CANCEL" : "REQUEST"),
|
|
43
|
+
"BEGIN:VEVENT",
|
|
44
|
+
`UID:${booking.iCalUid}`,
|
|
45
|
+
`SEQUENCE:${booking.iCalSequence}`,
|
|
46
|
+
`DTSTAMP:${dtStamp}`,
|
|
47
|
+
`DTSTART:${dtStart}`,
|
|
48
|
+
`DTEND:${dtEnd}`,
|
|
49
|
+
`SUMMARY:${summary}`,
|
|
50
|
+
desc && `DESCRIPTION:${desc}`,
|
|
51
|
+
location,
|
|
52
|
+
`ORGANIZER;CN=${escapeIcs(organizerName)}:mailto:${booking.hostEmail}`,
|
|
53
|
+
attendees,
|
|
54
|
+
cancelled ? "STATUS:CANCELLED" : "STATUS:CONFIRMED",
|
|
55
|
+
"END:VEVENT",
|
|
56
|
+
"END:VCALENDAR",
|
|
57
|
+
]
|
|
58
|
+
.filter(Boolean)
|
|
59
|
+
.join("\r\n");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function toIcsDate(d: Date): string {
|
|
63
|
+
return d
|
|
64
|
+
.toISOString()
|
|
65
|
+
.replace(/[-:]/g, "")
|
|
66
|
+
.replace(/\.\d{3}/, "");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function escapeIcs(s: string): string {
|
|
70
|
+
return (s ?? "")
|
|
71
|
+
.replace(/\\/g, "\\\\")
|
|
72
|
+
.replace(/;/g, "\\;")
|
|
73
|
+
.replace(/,/g, "\\,")
|
|
74
|
+
.replace(/\n/g, "\\n");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function addToGoogleCalendarUrl(booking: Booking): string {
|
|
78
|
+
const params = new URLSearchParams({
|
|
79
|
+
action: "TEMPLATE",
|
|
80
|
+
text: booking.title,
|
|
81
|
+
dates: `${toIcsDate(new Date(booking.startTime))}/${toIcsDate(new Date(booking.endTime))}`,
|
|
82
|
+
details: booking.description ?? "",
|
|
83
|
+
location: booking.location?.link ?? booking.location?.address ?? "",
|
|
84
|
+
});
|
|
85
|
+
return `https://www.google.com/calendar/render?${params}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function addToOutlookWebUrl(booking: Booking): string {
|
|
89
|
+
const params = new URLSearchParams({
|
|
90
|
+
path: "/calendar/action/compose",
|
|
91
|
+
rru: "addevent",
|
|
92
|
+
startdt: booking.startTime,
|
|
93
|
+
enddt: booking.endTime,
|
|
94
|
+
subject: booking.title,
|
|
95
|
+
body: booking.description ?? "",
|
|
96
|
+
location: booking.location?.link ?? booking.location?.address ?? "",
|
|
97
|
+
});
|
|
98
|
+
return `https://outlook.live.com/calendar/0/deeplink/compose?${params}`;
|
|
99
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./context.js";
|
|
2
|
+
export * from "./bookings-repo.js";
|
|
3
|
+
export * from "./event-types-repo.js";
|
|
4
|
+
export * from "./schedules-repo.js";
|
|
5
|
+
export * from "./availability-engine.js";
|
|
6
|
+
export * from "./booking-service.js";
|
|
7
|
+
export * from "./hooks.js";
|
|
8
|
+
export * from "./ics.js";
|
|
9
|
+
export * from "./providers/index.js";
|
|
10
|
+
export * from "./video-oauth.js";
|
|
11
|
+
export * from "./video-oauth-state.js";
|