@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.
Files changed (653) hide show
  1. package/README.md +58 -0
  2. package/dist/actions/_helpers.d.ts +12 -0
  3. package/dist/actions/_helpers.d.ts.map +1 -0
  4. package/dist/actions/_helpers.js +49 -0
  5. package/dist/actions/_helpers.js.map +1 -0
  6. package/dist/actions/accept-team-invite.d.ts +3 -0
  7. package/dist/actions/accept-team-invite.d.ts.map +1 -0
  8. package/dist/actions/accept-team-invite.js +27 -0
  9. package/dist/actions/accept-team-invite.js.map +1 -0
  10. package/dist/actions/add-booking-attendee.d.ts +3 -0
  11. package/dist/actions/add-booking-attendee.d.ts.map +1 -0
  12. package/dist/actions/add-booking-attendee.js +33 -0
  13. package/dist/actions/add-booking-attendee.js.map +1 -0
  14. package/dist/actions/add-booking-note.d.ts +3 -0
  15. package/dist/actions/add-booking-note.d.ts.map +1 -0
  16. package/dist/actions/add-booking-note.js +26 -0
  17. package/dist/actions/add-booking-note.js.map +1 -0
  18. package/dist/actions/add-date-override.d.ts +3 -0
  19. package/dist/actions/add-date-override.d.ts.map +1 -0
  20. package/dist/actions/add-date-override.js +16 -0
  21. package/dist/actions/add-date-override.js.map +1 -0
  22. package/dist/actions/add-private-link.d.ts +3 -0
  23. package/dist/actions/add-private-link.d.ts.map +1 -0
  24. package/dist/actions/add-private-link.js +31 -0
  25. package/dist/actions/add-private-link.js.map +1 -0
  26. package/dist/actions/assign-round-robin-host.d.ts +3 -0
  27. package/dist/actions/assign-round-robin-host.d.ts.map +1 -0
  28. package/dist/actions/assign-round-robin-host.js +48 -0
  29. package/dist/actions/assign-round-robin-host.js.map +1 -0
  30. package/dist/actions/cancel-booking.d.ts +3 -0
  31. package/dist/actions/cancel-booking.d.ts.map +1 -0
  32. package/dist/actions/cancel-booking.js +34 -0
  33. package/dist/actions/cancel-booking.js.map +1 -0
  34. package/dist/actions/check-availability.d.ts +3 -0
  35. package/dist/actions/check-availability.d.ts.map +1 -0
  36. package/dist/actions/check-availability.js +43 -0
  37. package/dist/actions/check-availability.js.map +1 -0
  38. package/dist/actions/confirm-booking.d.ts +3 -0
  39. package/dist/actions/confirm-booking.d.ts.map +1 -0
  40. package/dist/actions/confirm-booking.js +12 -0
  41. package/dist/actions/confirm-booking.js.map +1 -0
  42. package/dist/actions/connect-calendar.d.ts +3 -0
  43. package/dist/actions/connect-calendar.d.ts.map +1 -0
  44. package/dist/actions/connect-calendar.js +26 -0
  45. package/dist/actions/connect-calendar.js.map +1 -0
  46. package/dist/actions/connect-video.d.ts +3 -0
  47. package/dist/actions/connect-video.d.ts.map +1 -0
  48. package/dist/actions/connect-video.js +54 -0
  49. package/dist/actions/connect-video.js.map +1 -0
  50. package/dist/actions/create-booking.d.ts +3 -0
  51. package/dist/actions/create-booking.d.ts.map +1 -0
  52. package/dist/actions/create-booking.js +60 -0
  53. package/dist/actions/create-booking.js.map +1 -0
  54. package/dist/actions/create-event-type.d.ts +3 -0
  55. package/dist/actions/create-event-type.d.ts.map +1 -0
  56. package/dist/actions/create-event-type.js +45 -0
  57. package/dist/actions/create-event-type.js.map +1 -0
  58. package/dist/actions/create-host-group.d.ts +3 -0
  59. package/dist/actions/create-host-group.d.ts.map +1 -0
  60. package/dist/actions/create-host-group.js +25 -0
  61. package/dist/actions/create-host-group.js.map +1 -0
  62. package/dist/actions/create-routing-form.d.ts +3 -0
  63. package/dist/actions/create-routing-form.d.ts.map +1 -0
  64. package/dist/actions/create-routing-form.js +39 -0
  65. package/dist/actions/create-routing-form.js.map +1 -0
  66. package/dist/actions/create-schedule.d.ts +3 -0
  67. package/dist/actions/create-schedule.d.ts.map +1 -0
  68. package/dist/actions/create-schedule.js +32 -0
  69. package/dist/actions/create-schedule.js.map +1 -0
  70. package/dist/actions/create-team.d.ts +3 -0
  71. package/dist/actions/create-team.d.ts.map +1 -0
  72. package/dist/actions/create-team.js +44 -0
  73. package/dist/actions/create-team.js.map +1 -0
  74. package/dist/actions/create-workflow.d.ts +3 -0
  75. package/dist/actions/create-workflow.d.ts.map +1 -0
  76. package/dist/actions/create-workflow.js +81 -0
  77. package/dist/actions/create-workflow.js.map +1 -0
  78. package/dist/actions/delete-event-type.d.ts +3 -0
  79. package/dist/actions/delete-event-type.d.ts.map +1 -0
  80. package/dist/actions/delete-event-type.js +14 -0
  81. package/dist/actions/delete-event-type.js.map +1 -0
  82. package/dist/actions/delete-routing-form.d.ts +3 -0
  83. package/dist/actions/delete-routing-form.d.ts.map +1 -0
  84. package/dist/actions/delete-routing-form.js +21 -0
  85. package/dist/actions/delete-routing-form.js.map +1 -0
  86. package/dist/actions/delete-schedule.d.ts +3 -0
  87. package/dist/actions/delete-schedule.d.ts.map +1 -0
  88. package/dist/actions/delete-schedule.js +14 -0
  89. package/dist/actions/delete-schedule.js.map +1 -0
  90. package/dist/actions/delete-workflow.d.ts +3 -0
  91. package/dist/actions/delete-workflow.d.ts.map +1 -0
  92. package/dist/actions/delete-workflow.js +21 -0
  93. package/dist/actions/delete-workflow.js.map +1 -0
  94. package/dist/actions/disconnect-calendar.d.ts +3 -0
  95. package/dist/actions/disconnect-calendar.d.ts.map +1 -0
  96. package/dist/actions/disconnect-calendar.js +22 -0
  97. package/dist/actions/disconnect-calendar.js.map +1 -0
  98. package/dist/actions/duplicate-event-type.d.ts +3 -0
  99. package/dist/actions/duplicate-event-type.d.ts.map +1 -0
  100. package/dist/actions/duplicate-event-type.js +34 -0
  101. package/dist/actions/duplicate-event-type.js.map +1 -0
  102. package/dist/actions/export-bookings-csv.d.ts +3 -0
  103. package/dist/actions/export-bookings-csv.d.ts.map +1 -0
  104. package/dist/actions/export-bookings-csv.js +53 -0
  105. package/dist/actions/export-bookings-csv.js.map +1 -0
  106. package/dist/actions/find-available-slot.d.ts +3 -0
  107. package/dist/actions/find-available-slot.d.ts.map +1 -0
  108. package/dist/actions/find-available-slot.js +39 -0
  109. package/dist/actions/find-available-slot.js.map +1 -0
  110. package/dist/actions/get-availability.d.ts +3 -0
  111. package/dist/actions/get-availability.d.ts.map +1 -0
  112. package/dist/actions/get-availability.js +20 -0
  113. package/dist/actions/get-availability.js.map +1 -0
  114. package/dist/actions/get-booking.d.ts +3 -0
  115. package/dist/actions/get-booking.d.ts.map +1 -0
  116. package/dist/actions/get-booking.js +9 -0
  117. package/dist/actions/get-booking.js.map +1 -0
  118. package/dist/actions/get-event-type.d.ts +3 -0
  119. package/dist/actions/get-event-type.d.ts.map +1 -0
  120. package/dist/actions/get-event-type.js +27 -0
  121. package/dist/actions/get-event-type.js.map +1 -0
  122. package/dist/actions/install-conferencing-app.d.ts +3 -0
  123. package/dist/actions/install-conferencing-app.d.ts.map +1 -0
  124. package/dist/actions/install-conferencing-app.js +28 -0
  125. package/dist/actions/install-conferencing-app.js.map +1 -0
  126. package/dist/actions/invite-team-member.d.ts +3 -0
  127. package/dist/actions/invite-team-member.d.ts.map +1 -0
  128. package/dist/actions/invite-team-member.js +30 -0
  129. package/dist/actions/invite-team-member.js.map +1 -0
  130. package/dist/actions/list-bookings.d.ts +3 -0
  131. package/dist/actions/list-bookings.d.ts.map +1 -0
  132. package/dist/actions/list-bookings.js +35 -0
  133. package/dist/actions/list-bookings.js.map +1 -0
  134. package/dist/actions/list-calendar-integrations.d.ts +3 -0
  135. package/dist/actions/list-calendar-integrations.d.ts.map +1 -0
  136. package/dist/actions/list-calendar-integrations.js +26 -0
  137. package/dist/actions/list-calendar-integrations.js.map +1 -0
  138. package/dist/actions/list-event-types.d.ts +3 -0
  139. package/dist/actions/list-event-types.d.ts.map +1 -0
  140. package/dist/actions/list-event-types.js +31 -0
  141. package/dist/actions/list-event-types.js.map +1 -0
  142. package/dist/actions/list-routing-form-responses.d.ts +3 -0
  143. package/dist/actions/list-routing-form-responses.d.ts.map +1 -0
  144. package/dist/actions/list-routing-form-responses.js +24 -0
  145. package/dist/actions/list-routing-form-responses.js.map +1 -0
  146. package/dist/actions/list-routing-forms.d.ts +3 -0
  147. package/dist/actions/list-routing-forms.d.ts.map +1 -0
  148. package/dist/actions/list-routing-forms.js +29 -0
  149. package/dist/actions/list-routing-forms.js.map +1 -0
  150. package/dist/actions/list-schedules.d.ts +3 -0
  151. package/dist/actions/list-schedules.d.ts.map +1 -0
  152. package/dist/actions/list-schedules.js +16 -0
  153. package/dist/actions/list-schedules.js.map +1 -0
  154. package/dist/actions/list-selected-calendars.d.ts +3 -0
  155. package/dist/actions/list-selected-calendars.d.ts.map +1 -0
  156. package/dist/actions/list-selected-calendars.js +42 -0
  157. package/dist/actions/list-selected-calendars.js.map +1 -0
  158. package/dist/actions/list-workflows.d.ts +3 -0
  159. package/dist/actions/list-workflows.d.ts.map +1 -0
  160. package/dist/actions/list-workflows.js +29 -0
  161. package/dist/actions/list-workflows.js.map +1 -0
  162. package/dist/actions/mark-no-show.d.ts +3 -0
  163. package/dist/actions/mark-no-show.d.ts.map +1 -0
  164. package/dist/actions/mark-no-show.js +15 -0
  165. package/dist/actions/mark-no-show.js.map +1 -0
  166. package/dist/actions/refresh-busy-times.d.ts +3 -0
  167. package/dist/actions/refresh-busy-times.d.ts.map +1 -0
  168. package/dist/actions/refresh-busy-times.js +25 -0
  169. package/dist/actions/refresh-busy-times.js.map +1 -0
  170. package/dist/actions/remove-booking-attendee.d.ts +3 -0
  171. package/dist/actions/remove-booking-attendee.d.ts.map +1 -0
  172. package/dist/actions/remove-booking-attendee.js +20 -0
  173. package/dist/actions/remove-booking-attendee.js.map +1 -0
  174. package/dist/actions/remove-date-override.d.ts +3 -0
  175. package/dist/actions/remove-date-override.d.ts.map +1 -0
  176. package/dist/actions/remove-date-override.js +15 -0
  177. package/dist/actions/remove-date-override.js.map +1 -0
  178. package/dist/actions/remove-team-member.d.ts +3 -0
  179. package/dist/actions/remove-team-member.d.ts.map +1 -0
  180. package/dist/actions/remove-team-member.js +18 -0
  181. package/dist/actions/remove-team-member.js.map +1 -0
  182. package/dist/actions/reorder-event-types.d.ts +3 -0
  183. package/dist/actions/reorder-event-types.d.ts.map +1 -0
  184. package/dist/actions/reorder-event-types.js +18 -0
  185. package/dist/actions/reorder-event-types.js.map +1 -0
  186. package/dist/actions/reschedule-booking.d.ts +3 -0
  187. package/dist/actions/reschedule-booking.d.ts.map +1 -0
  188. package/dist/actions/reschedule-booking.js +38 -0
  189. package/dist/actions/reschedule-booking.js.map +1 -0
  190. package/dist/actions/revoke-private-link.d.ts +3 -0
  191. package/dist/actions/revoke-private-link.d.ts.map +1 -0
  192. package/dist/actions/revoke-private-link.js +16 -0
  193. package/dist/actions/revoke-private-link.js.map +1 -0
  194. package/dist/actions/send-reschedule-link.d.ts +3 -0
  195. package/dist/actions/send-reschedule-link.d.ts.map +1 -0
  196. package/dist/actions/send-reschedule-link.js +18 -0
  197. package/dist/actions/send-reschedule-link.js.map +1 -0
  198. package/dist/actions/set-appearance.d.ts +3 -0
  199. package/dist/actions/set-appearance.d.ts.map +1 -0
  200. package/dist/actions/set-appearance.js +23 -0
  201. package/dist/actions/set-appearance.js.map +1 -0
  202. package/dist/actions/set-default-conferencing-app.d.ts +3 -0
  203. package/dist/actions/set-default-conferencing-app.d.ts.map +1 -0
  204. package/dist/actions/set-default-conferencing-app.js +25 -0
  205. package/dist/actions/set-default-conferencing-app.js.map +1 -0
  206. package/dist/actions/set-default-schedule.d.ts +3 -0
  207. package/dist/actions/set-default-schedule.d.ts.map +1 -0
  208. package/dist/actions/set-default-schedule.js +15 -0
  209. package/dist/actions/set-default-schedule.js.map +1 -0
  210. package/dist/actions/set-destination-calendar.d.ts +3 -0
  211. package/dist/actions/set-destination-calendar.d.ts.map +1 -0
  212. package/dist/actions/set-destination-calendar.js +39 -0
  213. package/dist/actions/set-destination-calendar.js.map +1 -0
  214. package/dist/actions/set-event-type-hosts.d.ts +3 -0
  215. package/dist/actions/set-event-type-hosts.d.ts.map +1 -0
  216. package/dist/actions/set-event-type-hosts.js +41 -0
  217. package/dist/actions/set-event-type-hosts.js.map +1 -0
  218. package/dist/actions/set-event-type-location.d.ts +3 -0
  219. package/dist/actions/set-event-type-location.d.ts.map +1 -0
  220. package/dist/actions/set-event-type-location.js +18 -0
  221. package/dist/actions/set-event-type-location.js.map +1 -0
  222. package/dist/actions/set-host-availability-override.d.ts +3 -0
  223. package/dist/actions/set-host-availability-override.d.ts.map +1 -0
  224. package/dist/actions/set-host-availability-override.js +21 -0
  225. package/dist/actions/set-host-availability-override.js.map +1 -0
  226. package/dist/actions/set-team-branding.d.ts +3 -0
  227. package/dist/actions/set-team-branding.d.ts.map +1 -0
  228. package/dist/actions/set-team-branding.js +28 -0
  229. package/dist/actions/set-team-branding.js.map +1 -0
  230. package/dist/actions/submit-routing-form-response.d.ts +3 -0
  231. package/dist/actions/submit-routing-form-response.d.ts.map +1 -0
  232. package/dist/actions/submit-routing-form-response.js +46 -0
  233. package/dist/actions/submit-routing-form-response.js.map +1 -0
  234. package/dist/actions/toggle-event-type-hidden.d.ts +3 -0
  235. package/dist/actions/toggle-event-type-hidden.d.ts.map +1 -0
  236. package/dist/actions/toggle-event-type-hidden.js +19 -0
  237. package/dist/actions/toggle-event-type-hidden.js.map +1 -0
  238. package/dist/actions/toggle-selected-calendar.d.ts +3 -0
  239. package/dist/actions/toggle-selected-calendar.d.ts.map +1 -0
  240. package/dist/actions/toggle-selected-calendar.js +40 -0
  241. package/dist/actions/toggle-selected-calendar.js.map +1 -0
  242. package/dist/actions/toggle-workflow.d.ts +3 -0
  243. package/dist/actions/toggle-workflow.d.ts.map +1 -0
  244. package/dist/actions/toggle-workflow.js +26 -0
  245. package/dist/actions/toggle-workflow.js.map +1 -0
  246. package/dist/actions/update-event-type.d.ts +3 -0
  247. package/dist/actions/update-event-type.d.ts.map +1 -0
  248. package/dist/actions/update-event-type.js +54 -0
  249. package/dist/actions/update-event-type.js.map +1 -0
  250. package/dist/actions/update-member-role.d.ts +3 -0
  251. package/dist/actions/update-member-role.d.ts.map +1 -0
  252. package/dist/actions/update-member-role.js +23 -0
  253. package/dist/actions/update-member-role.js.map +1 -0
  254. package/dist/actions/update-profile.d.ts +3 -0
  255. package/dist/actions/update-profile.d.ts.map +1 -0
  256. package/dist/actions/update-profile.js +34 -0
  257. package/dist/actions/update-profile.js.map +1 -0
  258. package/dist/actions/update-routing-form.d.ts +3 -0
  259. package/dist/actions/update-routing-form.d.ts.map +1 -0
  260. package/dist/actions/update-routing-form.js +40 -0
  261. package/dist/actions/update-routing-form.js.map +1 -0
  262. package/dist/actions/update-schedule.d.ts +3 -0
  263. package/dist/actions/update-schedule.d.ts.map +1 -0
  264. package/dist/actions/update-schedule.js +44 -0
  265. package/dist/actions/update-schedule.js.map +1 -0
  266. package/dist/actions/update-workflow.d.ts +3 -0
  267. package/dist/actions/update-workflow.d.ts.map +1 -0
  268. package/dist/actions/update-workflow.js +89 -0
  269. package/dist/actions/update-workflow.js.map +1 -0
  270. package/dist/core/buffers.d.ts +25 -0
  271. package/dist/core/buffers.d.ts.map +1 -0
  272. package/dist/core/buffers.js +21 -0
  273. package/dist/core/buffers.js.map +1 -0
  274. package/dist/core/conflicts.d.ts +11 -0
  275. package/dist/core/conflicts.d.ts.map +1 -0
  276. package/dist/core/conflicts.js +42 -0
  277. package/dist/core/conflicts.js.map +1 -0
  278. package/dist/core/index.d.ts +9 -0
  279. package/dist/core/index.d.ts.map +1 -0
  280. package/dist/core/index.js +9 -0
  281. package/dist/core/index.js.map +1 -0
  282. package/dist/core/limits.d.ts +23 -0
  283. package/dist/core/limits.d.ts.map +1 -0
  284. package/dist/core/limits.js +28 -0
  285. package/dist/core/limits.js.map +1 -0
  286. package/dist/core/round-robin.d.ts +31 -0
  287. package/dist/core/round-robin.d.ts.map +1 -0
  288. package/dist/core/round-robin.js +57 -0
  289. package/dist/core/round-robin.js.map +1 -0
  290. package/dist/core/rrule.d.ts +2 -0
  291. package/dist/core/rrule.d.ts.map +1 -0
  292. package/dist/core/rrule.js +14 -0
  293. package/dist/core/rrule.js.map +1 -0
  294. package/dist/core/rules.d.ts +26 -0
  295. package/dist/core/rules.d.ts.map +1 -0
  296. package/dist/core/rules.js +40 -0
  297. package/dist/core/rules.js.map +1 -0
  298. package/dist/core/slots.d.ts +58 -0
  299. package/dist/core/slots.d.ts.map +1 -0
  300. package/dist/core/slots.js +98 -0
  301. package/dist/core/slots.js.map +1 -0
  302. package/dist/core/time.d.ts +52 -0
  303. package/dist/core/time.d.ts.map +1 -0
  304. package/dist/core/time.js +109 -0
  305. package/dist/core/time.js.map +1 -0
  306. package/dist/index.d.ts +14 -0
  307. package/dist/index.d.ts.map +1 -0
  308. package/dist/index.js +14 -0
  309. package/dist/index.js.map +1 -0
  310. package/dist/manifest.d.ts +28 -0
  311. package/dist/manifest.d.ts.map +1 -0
  312. package/dist/manifest.js +160 -0
  313. package/dist/manifest.js.map +1 -0
  314. package/dist/react/components/SlotPicker.d.ts +21 -0
  315. package/dist/react/components/SlotPicker.d.ts.map +1 -0
  316. package/dist/react/components/SlotPicker.js +15 -0
  317. package/dist/react/components/SlotPicker.js.map +1 -0
  318. package/dist/react/components/TimezoneSelect.d.ts +7 -0
  319. package/dist/react/components/TimezoneSelect.d.ts.map +1 -0
  320. package/dist/react/components/TimezoneSelect.js +31 -0
  321. package/dist/react/components/TimezoneSelect.js.map +1 -0
  322. package/dist/react/components/booking-links/AvailabilityEditor.d.ts +21 -0
  323. package/dist/react/components/booking-links/AvailabilityEditor.d.ts.map +1 -0
  324. package/dist/react/components/booking-links/AvailabilityEditor.js +102 -0
  325. package/dist/react/components/booking-links/AvailabilityEditor.js.map +1 -0
  326. package/dist/react/components/booking-links/BookingLinkCreateDialog.d.ts +22 -0
  327. package/dist/react/components/booking-links/BookingLinkCreateDialog.d.ts.map +1 -0
  328. package/dist/react/components/booking-links/BookingLinkCreateDialog.js +75 -0
  329. package/dist/react/components/booking-links/BookingLinkCreateDialog.js.map +1 -0
  330. package/dist/react/components/booking-links/ConferencingSelector.d.ts +19 -0
  331. package/dist/react/components/booking-links/ConferencingSelector.d.ts.map +1 -0
  332. package/dist/react/components/booking-links/ConferencingSelector.js +87 -0
  333. package/dist/react/components/booking-links/ConferencingSelector.js.map +1 -0
  334. package/dist/react/components/booking-links/CustomFieldsEditor.d.ts +19 -0
  335. package/dist/react/components/booking-links/CustomFieldsEditor.d.ts.map +1 -0
  336. package/dist/react/components/booking-links/CustomFieldsEditor.js +117 -0
  337. package/dist/react/components/booking-links/CustomFieldsEditor.js.map +1 -0
  338. package/dist/react/components/booking-links/DurationPicker.d.ts +9 -0
  339. package/dist/react/components/booking-links/DurationPicker.d.ts.map +1 -0
  340. package/dist/react/components/booking-links/DurationPicker.js +56 -0
  341. package/dist/react/components/booking-links/DurationPicker.js.map +1 -0
  342. package/dist/react/components/booking-links/SlugEditor.d.ts +15 -0
  343. package/dist/react/components/booking-links/SlugEditor.d.ts.map +1 -0
  344. package/dist/react/components/booking-links/SlugEditor.js +64 -0
  345. package/dist/react/components/booking-links/SlugEditor.js.map +1 -0
  346. package/dist/react/components/booking-links/index.d.ts +16 -0
  347. package/dist/react/components/booking-links/index.d.ts.map +1 -0
  348. package/dist/react/components/booking-links/index.js +16 -0
  349. package/dist/react/components/booking-links/index.js.map +1 -0
  350. package/dist/react/components/index.d.ts +14 -0
  351. package/dist/react/components/index.d.ts.map +1 -0
  352. package/dist/react/components/index.js +14 -0
  353. package/dist/react/components/index.js.map +1 -0
  354. package/dist/react/hooks/useBookingFlow.d.ts +33 -0
  355. package/dist/react/hooks/useBookingFlow.d.ts.map +1 -0
  356. package/dist/react/hooks/useBookingFlow.js +51 -0
  357. package/dist/react/hooks/useBookingFlow.js.map +1 -0
  358. package/dist/react/hooks/useEventType.d.ts +21 -0
  359. package/dist/react/hooks/useEventType.d.ts.map +1 -0
  360. package/dist/react/hooks/useEventType.js +38 -0
  361. package/dist/react/hooks/useEventType.js.map +1 -0
  362. package/dist/react/hooks/useReschedule.d.ts +13 -0
  363. package/dist/react/hooks/useReschedule.d.ts.map +1 -0
  364. package/dist/react/hooks/useReschedule.js +33 -0
  365. package/dist/react/hooks/useReschedule.js.map +1 -0
  366. package/dist/react/hooks/useSlots.d.ts +32 -0
  367. package/dist/react/hooks/useSlots.d.ts.map +1 -0
  368. package/dist/react/hooks/useSlots.js +59 -0
  369. package/dist/react/hooks/useSlots.js.map +1 -0
  370. package/dist/react/hooks/useTimezone.d.ts +3 -0
  371. package/dist/react/hooks/useTimezone.d.ts.map +1 -0
  372. package/dist/react/hooks/useTimezone.js +30 -0
  373. package/dist/react/hooks/useTimezone.js.map +1 -0
  374. package/dist/react/index.d.ts +11 -0
  375. package/dist/react/index.d.ts.map +1 -0
  376. package/dist/react/index.js +11 -0
  377. package/dist/react/index.js.map +1 -0
  378. package/dist/schema/bookings.d.ts +1201 -0
  379. package/dist/schema/bookings.d.ts.map +1 -0
  380. package/dist/schema/bookings.js +100 -0
  381. package/dist/schema/bookings.js.map +1 -0
  382. package/dist/schema/calendar-cache.d.ts +160 -0
  383. package/dist/schema/calendar-cache.d.ts.map +1 -0
  384. package/dist/schema/calendar-cache.js +23 -0
  385. package/dist/schema/calendar-cache.js.map +1 -0
  386. package/dist/schema/credentials.d.ts +743 -0
  387. package/dist/schema/credentials.d.ts.map +1 -0
  388. package/dist/schema/credentials.js +79 -0
  389. package/dist/schema/credentials.js.map +1 -0
  390. package/dist/schema/event-types.d.ts +1292 -0
  391. package/dist/schema/event-types.d.ts.map +1 -0
  392. package/dist/schema/event-types.js +131 -0
  393. package/dist/schema/event-types.js.map +1 -0
  394. package/dist/schema/index.d.ts +20 -0
  395. package/dist/schema/index.d.ts.map +1 -0
  396. package/dist/schema/index.js +20 -0
  397. package/dist/schema/index.js.map +1 -0
  398. package/dist/schema/routing-forms.d.ts +571 -0
  399. package/dist/schema/routing-forms.d.ts.map +1 -0
  400. package/dist/schema/routing-forms.js +44 -0
  401. package/dist/schema/routing-forms.js.map +1 -0
  402. package/dist/schema/schedules.d.ts +830 -0
  403. package/dist/schema/schedules.d.ts.map +1 -0
  404. package/dist/schema/schedules.js +72 -0
  405. package/dist/schema/schedules.js.map +1 -0
  406. package/dist/schema/teams.d.ts +569 -0
  407. package/dist/schema/teams.d.ts.map +1 -0
  408. package/dist/schema/teams.js +38 -0
  409. package/dist/schema/teams.js.map +1 -0
  410. package/dist/schema/workflows.d.ts +1367 -0
  411. package/dist/schema/workflows.d.ts.map +1 -0
  412. package/dist/schema/workflows.js +116 -0
  413. package/dist/schema/workflows.js.map +1 -0
  414. package/dist/server/availability-engine.d.ts +21 -0
  415. package/dist/server/availability-engine.d.ts.map +1 -0
  416. package/dist/server/availability-engine.js +135 -0
  417. package/dist/server/availability-engine.js.map +1 -0
  418. package/dist/server/booking-service.d.ts +46 -0
  419. package/dist/server/booking-service.d.ts.map +1 -0
  420. package/dist/server/booking-service.js +198 -0
  421. package/dist/server/booking-service.js.map +1 -0
  422. package/dist/server/bookings-repo.d.ts +48 -0
  423. package/dist/server/bookings-repo.d.ts.map +1 -0
  424. package/dist/server/bookings-repo.js +244 -0
  425. package/dist/server/bookings-repo.js.map +1 -0
  426. package/dist/server/context.d.ts +33 -0
  427. package/dist/server/context.d.ts.map +1 -0
  428. package/dist/server/context.js +11 -0
  429. package/dist/server/context.js.map +1 -0
  430. package/dist/server/db-types.d.ts +15 -0
  431. package/dist/server/db-types.d.ts.map +1 -0
  432. package/dist/server/db-types.js +2 -0
  433. package/dist/server/db-types.js.map +1 -0
  434. package/dist/server/event-types-repo.d.ts +46 -0
  435. package/dist/server/event-types-repo.d.ts.map +1 -0
  436. package/dist/server/event-types-repo.js +320 -0
  437. package/dist/server/event-types-repo.js.map +1 -0
  438. package/dist/server/hooks.d.ts +6 -0
  439. package/dist/server/hooks.d.ts.map +1 -0
  440. package/dist/server/hooks.js +173 -0
  441. package/dist/server/hooks.js.map +1 -0
  442. package/dist/server/ics.d.ts +12 -0
  443. package/dist/server/ics.d.ts.map +1 -0
  444. package/dist/server/ics.js +81 -0
  445. package/dist/server/ics.js.map +1 -0
  446. package/dist/server/index.d.ts +12 -0
  447. package/dist/server/index.d.ts.map +1 -0
  448. package/dist/server/index.js +12 -0
  449. package/dist/server/index.js.map +1 -0
  450. package/dist/server/providers/builtin-video.d.ts +12 -0
  451. package/dist/server/providers/builtin-video.d.ts.map +1 -0
  452. package/dist/server/providers/builtin-video.js +50 -0
  453. package/dist/server/providers/builtin-video.js.map +1 -0
  454. package/dist/server/providers/cal-video.d.ts +12 -0
  455. package/dist/server/providers/cal-video.d.ts.map +1 -0
  456. package/dist/server/providers/cal-video.js +50 -0
  457. package/dist/server/providers/cal-video.js.map +1 -0
  458. package/dist/server/providers/google-calendar.d.ts +28 -0
  459. package/dist/server/providers/google-calendar.d.ts.map +1 -0
  460. package/dist/server/providers/google-calendar.js +163 -0
  461. package/dist/server/providers/google-calendar.js.map +1 -0
  462. package/dist/server/providers/google-meet.d.ts +10 -0
  463. package/dist/server/providers/google-meet.d.ts.map +1 -0
  464. package/dist/server/providers/google-meet.js +14 -0
  465. package/dist/server/providers/google-meet.js.map +1 -0
  466. package/dist/server/providers/index.d.ts +8 -0
  467. package/dist/server/providers/index.d.ts.map +1 -0
  468. package/dist/server/providers/index.js +8 -0
  469. package/dist/server/providers/index.js.map +1 -0
  470. package/dist/server/providers/office365.d.ts +21 -0
  471. package/dist/server/providers/office365.d.ts.map +1 -0
  472. package/dist/server/providers/office365.js +146 -0
  473. package/dist/server/providers/office365.js.map +1 -0
  474. package/dist/server/providers/registry.d.ts +14 -0
  475. package/dist/server/providers/registry.d.ts.map +1 -0
  476. package/dist/server/providers/registry.js +28 -0
  477. package/dist/server/providers/registry.js.map +1 -0
  478. package/dist/server/providers/types.d.ts +133 -0
  479. package/dist/server/providers/types.d.ts.map +1 -0
  480. package/dist/server/providers/types.js +2 -0
  481. package/dist/server/providers/types.js.map +1 -0
  482. package/dist/server/providers/zoom.d.ts +34 -0
  483. package/dist/server/providers/zoom.d.ts.map +1 -0
  484. package/dist/server/providers/zoom.js +111 -0
  485. package/dist/server/providers/zoom.js.map +1 -0
  486. package/dist/server/schedules-repo.d.ts +26 -0
  487. package/dist/server/schedules-repo.d.ts.map +1 -0
  488. package/dist/server/schedules-repo.js +223 -0
  489. package/dist/server/schedules-repo.js.map +1 -0
  490. package/dist/server/video-oauth-state.d.ts +28 -0
  491. package/dist/server/video-oauth-state.d.ts.map +1 -0
  492. package/dist/server/video-oauth-state.js +101 -0
  493. package/dist/server/video-oauth-state.js.map +1 -0
  494. package/dist/server/video-oauth.d.ts +18 -0
  495. package/dist/server/video-oauth.d.ts.map +1 -0
  496. package/dist/server/video-oauth.js +82 -0
  497. package/dist/server/video-oauth.js.map +1 -0
  498. package/dist/shared/index.d.ts +298 -0
  499. package/dist/shared/index.d.ts.map +1 -0
  500. package/dist/shared/index.js +6 -0
  501. package/dist/shared/index.js.map +1 -0
  502. package/dist/version.d.ts +2 -0
  503. package/dist/version.d.ts.map +1 -0
  504. package/dist/version.js +2 -0
  505. package/dist/version.js.map +1 -0
  506. package/docs/UI_UNIFICATION.md +78 -0
  507. package/docs/actions.md +64 -0
  508. package/docs/eject.md +18 -0
  509. package/docs/llms-full.txt +1022 -0
  510. package/docs/llms.txt +89 -0
  511. package/docs/providers.md +68 -0
  512. package/docs/schema.md +86 -0
  513. package/docs/skills/availability/SKILL.md +44 -0
  514. package/docs/skills/booker/SKILL.md +51 -0
  515. package/docs/skills/bookings/SKILL.md +43 -0
  516. package/docs/skills/embeds/SKILL.md +49 -0
  517. package/docs/skills/event-types/SKILL.md +40 -0
  518. package/docs/skills/integrations/SKILL.md +52 -0
  519. package/docs/skills/routing-forms/SKILL.md +39 -0
  520. package/docs/skills/scheduling-basics/SKILL.md +51 -0
  521. package/docs/skills/slot-engine/SKILL.md +52 -0
  522. package/docs/skills/team-scheduling/SKILL.md +54 -0
  523. package/docs/skills/workflows/SKILL.md +55 -0
  524. package/package.json +87 -0
  525. package/src/actions/_helpers.ts +62 -0
  526. package/src/actions/accept-team-invite.ts +26 -0
  527. package/src/actions/add-booking-attendee.ts +32 -0
  528. package/src/actions/add-booking-note.ts +25 -0
  529. package/src/actions/add-date-override.ts +23 -0
  530. package/src/actions/add-private-link.ts +31 -0
  531. package/src/actions/assign-round-robin-host.ts +54 -0
  532. package/src/actions/cancel-booking.ts +39 -0
  533. package/src/actions/check-availability.ts +46 -0
  534. package/src/actions/confirm-booking.ts +15 -0
  535. package/src/actions/connect-calendar.ts +27 -0
  536. package/src/actions/connect-video.ts +57 -0
  537. package/src/actions/create-booking.ts +62 -0
  538. package/src/actions/create-event-type.ts +45 -0
  539. package/src/actions/create-host-group.ts +25 -0
  540. package/src/actions/create-routing-form.ts +39 -0
  541. package/src/actions/create-schedule.ts +36 -0
  542. package/src/actions/create-team.ts +44 -0
  543. package/src/actions/create-workflow.ts +83 -0
  544. package/src/actions/delete-event-type.ts +14 -0
  545. package/src/actions/delete-routing-form.ts +21 -0
  546. package/src/actions/delete-schedule.ts +14 -0
  547. package/src/actions/delete-workflow.ts +21 -0
  548. package/src/actions/disconnect-calendar.ts +22 -0
  549. package/src/actions/duplicate-event-type.ts +36 -0
  550. package/src/actions/export-bookings-csv.ts +54 -0
  551. package/src/actions/find-available-slot.ts +40 -0
  552. package/src/actions/get-availability.ts +20 -0
  553. package/src/actions/get-booking.ts +9 -0
  554. package/src/actions/get-event-type.ts +29 -0
  555. package/src/actions/install-conferencing-app.ts +29 -0
  556. package/src/actions/invite-team-member.ts +30 -0
  557. package/src/actions/list-bookings.ts +36 -0
  558. package/src/actions/list-calendar-integrations.ts +26 -0
  559. package/src/actions/list-event-types.ts +31 -0
  560. package/src/actions/list-routing-form-responses.ts +24 -0
  561. package/src/actions/list-routing-forms.ts +34 -0
  562. package/src/actions/list-schedules.ts +16 -0
  563. package/src/actions/list-selected-calendars.ts +41 -0
  564. package/src/actions/list-workflows.ts +34 -0
  565. package/src/actions/mark-no-show.ts +15 -0
  566. package/src/actions/refresh-busy-times.ts +26 -0
  567. package/src/actions/remove-booking-attendee.ts +24 -0
  568. package/src/actions/remove-date-override.ts +15 -0
  569. package/src/actions/remove-team-member.ts +23 -0
  570. package/src/actions/reorder-event-types.ts +18 -0
  571. package/src/actions/reschedule-booking.ts +45 -0
  572. package/src/actions/revoke-private-link.ts +16 -0
  573. package/src/actions/send-reschedule-link.ts +18 -0
  574. package/src/actions/set-appearance.ts +24 -0
  575. package/src/actions/set-default-conferencing-app.ts +25 -0
  576. package/src/actions/set-default-schedule.ts +15 -0
  577. package/src/actions/set-destination-calendar.ts +39 -0
  578. package/src/actions/set-event-type-hosts.ts +43 -0
  579. package/src/actions/set-event-type-location.ts +18 -0
  580. package/src/actions/set-host-availability-override.ts +27 -0
  581. package/src/actions/set-team-branding.ts +28 -0
  582. package/src/actions/submit-routing-form-response.ts +47 -0
  583. package/src/actions/toggle-event-type-hidden.ts +21 -0
  584. package/src/actions/toggle-selected-calendar.ts +43 -0
  585. package/src/actions/toggle-workflow.ts +25 -0
  586. package/src/actions/update-event-type.ts +54 -0
  587. package/src/actions/update-member-role.ts +28 -0
  588. package/src/actions/update-profile.ts +36 -0
  589. package/src/actions/update-routing-form.ts +36 -0
  590. package/src/actions/update-schedule.ts +53 -0
  591. package/src/actions/update-workflow.ts +89 -0
  592. package/src/core/buffers.ts +46 -0
  593. package/src/core/conflicts.ts +49 -0
  594. package/src/core/index.ts +8 -0
  595. package/src/core/limits.ts +60 -0
  596. package/src/core/round-robin.test.ts +95 -0
  597. package/src/core/round-robin.ts +103 -0
  598. package/src/core/rrule.ts +20 -0
  599. package/src/core/rules.ts +66 -0
  600. package/src/core/slots.test.ts +246 -0
  601. package/src/core/slots.ts +223 -0
  602. package/src/core/time.ts +136 -0
  603. package/src/index.ts +14 -0
  604. package/src/manifest.ts +174 -0
  605. package/src/react/components/SlotPicker.tsx +72 -0
  606. package/src/react/components/TimezoneSelect.tsx +55 -0
  607. package/src/react/components/_shadcn-shims.d.ts +251 -0
  608. package/src/react/components/booking-links/AvailabilityEditor.tsx +177 -0
  609. package/src/react/components/booking-links/BookingLinkCreateDialog.tsx +189 -0
  610. package/src/react/components/booking-links/ConferencingSelector.tsx +255 -0
  611. package/src/react/components/booking-links/CustomFieldsEditor.tsx +420 -0
  612. package/src/react/components/booking-links/DurationPicker.tsx +115 -0
  613. package/src/react/components/booking-links/SlugEditor.tsx +149 -0
  614. package/src/react/components/booking-links/index.ts +15 -0
  615. package/src/react/components/index.ts +13 -0
  616. package/src/react/hooks/useBookingFlow.ts +113 -0
  617. package/src/react/hooks/useEventType.ts +52 -0
  618. package/src/react/hooks/useReschedule.ts +39 -0
  619. package/src/react/hooks/useSlots.ts +88 -0
  620. package/src/react/hooks/useTimezone.ts +29 -0
  621. package/src/react/index.ts +10 -0
  622. package/src/schema/bookings.ts +124 -0
  623. package/src/schema/calendar-cache.ts +23 -0
  624. package/src/schema/credentials.ts +83 -0
  625. package/src/schema/event-types.ts +154 -0
  626. package/src/schema/index.ts +19 -0
  627. package/src/schema/routing-forms.ts +52 -0
  628. package/src/schema/schedules.ts +83 -0
  629. package/src/schema/teams.ts +46 -0
  630. package/src/schema/workflows.ts +128 -0
  631. package/src/server/availability-engine.ts +193 -0
  632. package/src/server/booking-service.ts +264 -0
  633. package/src/server/bookings-repo.ts +330 -0
  634. package/src/server/context.ts +49 -0
  635. package/src/server/db-types.ts +16 -0
  636. package/src/server/event-types-repo.ts +385 -0
  637. package/src/server/hooks.ts +213 -0
  638. package/src/server/ics.ts +99 -0
  639. package/src/server/index.ts +11 -0
  640. package/src/server/providers/builtin-video.ts +62 -0
  641. package/src/server/providers/google-calendar.ts +237 -0
  642. package/src/server/providers/google-meet.ts +22 -0
  643. package/src/server/providers/index.ts +7 -0
  644. package/src/server/providers/office365.ts +208 -0
  645. package/src/server/providers/registry.ts +43 -0
  646. package/src/server/providers/types.ts +126 -0
  647. package/src/server/providers/zoom.ts +173 -0
  648. package/src/server/schedules-repo.ts +279 -0
  649. package/src/server/video-oauth-state.test.ts +120 -0
  650. package/src/server/video-oauth-state.ts +116 -0
  651. package/src/server/video-oauth.ts +99 -0
  652. package/src/shared/index.ts +366 -0
  653. package/src/version.ts +1 -0
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Pluggable provider interfaces for calendar reads and video-meeting writes.
3
+ *
4
+ * Consumers register providers via the registry. Each provider owns its own
5
+ * OAuth/credential lifecycle; this package is agnostic to how the tokens
6
+ * are stored (typically in core `oauth_tokens`).
7
+ */
8
+ import type { BusyInterval, Booking } from "../../shared/index.js";
9
+
10
+ export interface CalendarProvider {
11
+ /** Unique provider slug, e.g. "google_calendar" */
12
+ kind: string;
13
+
14
+ /** Human-friendly display name, e.g. "Google Calendar" */
15
+ label: string;
16
+
17
+ /**
18
+ * Start the OAuth flow — return an authorization URL for the user to visit.
19
+ * `redirectUri` is the server's OAuth callback path for this provider.
20
+ */
21
+ startOAuth(opts: {
22
+ redirectUri: string;
23
+ state: string;
24
+ }): Promise<{ authUrl: string }>;
25
+
26
+ /** Complete the OAuth flow with the received code; persist the credential. */
27
+ completeOAuth(opts: {
28
+ credentialId: string;
29
+ userEmail: string;
30
+ code: string;
31
+ redirectUri: string;
32
+ }): Promise<{
33
+ externalEmail: string;
34
+ calendars: { externalId: string; name: string; primary: boolean }[];
35
+ }>;
36
+
37
+ /** List the calendars the user has access to (for Selected Calendars UI). */
38
+ listCalendars(opts: {
39
+ credentialId: string;
40
+ }): Promise<{ externalId: string; name: string; primary: boolean }[]>;
41
+
42
+ /** Read busy intervals across the user's selected calendars. */
43
+ getBusy(opts: {
44
+ credentialId: string;
45
+ calendarExternalIds: string[];
46
+ start: Date;
47
+ end: Date;
48
+ }): Promise<BusyInterval[]>;
49
+
50
+ /** Create a calendar event; return the external id. */
51
+ createEvent(opts: {
52
+ credentialId: string;
53
+ calendarExternalId: string;
54
+ booking: Booking;
55
+ includeConference?: boolean;
56
+ }): Promise<{
57
+ externalId: string;
58
+ meetingUrl?: string;
59
+ icalUid?: string;
60
+ }>;
61
+
62
+ /** Update (e.g. after reschedule). Returns the new iCalSequence. */
63
+ updateEvent(opts: {
64
+ credentialId: string;
65
+ externalId: string;
66
+ booking: Booking;
67
+ }): Promise<{ iCalSequence: number }>;
68
+
69
+ /** Delete/cancel an event. */
70
+ deleteEvent(opts: {
71
+ credentialId: string;
72
+ externalId: string;
73
+ }): Promise<void>;
74
+ }
75
+
76
+ export interface VideoProvider {
77
+ kind: string;
78
+ label: string;
79
+
80
+ /**
81
+ * Start the OAuth flow — optional. Present on providers like Zoom /
82
+ * Microsoft Teams that require a user's OAuth grant to create meetings on
83
+ * their behalf. Zero-OAuth providers (the built-in video provider, or
84
+ * Google Meet which piggy-backs on the Google Calendar scope) omit this.
85
+ */
86
+ startOAuth?(opts: {
87
+ redirectUri: string;
88
+ state: string;
89
+ }): Promise<{ authUrl: string }>;
90
+
91
+ /**
92
+ * Complete the OAuth flow — optional. Paired with `startOAuth`. Consumers
93
+ * call this from their OAuth callback handler to exchange the `code` for
94
+ * tokens and return identifying info so a `scheduling_credentials` row
95
+ * can be written.
96
+ */
97
+ completeOAuth?(opts: {
98
+ credentialId: string;
99
+ userEmail: string;
100
+ code: string;
101
+ redirectUri: string;
102
+ }): Promise<{
103
+ externalEmail?: string;
104
+ externalAccountId: string;
105
+ displayName?: string;
106
+ }>;
107
+
108
+ /** Create a meeting room for a booking. */
109
+ createMeeting(opts: { credentialId?: string; booking: Booking }): Promise<{
110
+ meetingUrl: string;
111
+ meetingId: string;
112
+ meetingPassword?: string;
113
+ }>;
114
+
115
+ /** Delete the meeting when the booking is cancelled. */
116
+ deleteMeeting?(opts: {
117
+ credentialId?: string;
118
+ meetingId: string;
119
+ }): Promise<void>;
120
+ }
121
+
122
+ export interface SmsProvider {
123
+ kind: string;
124
+ label: string;
125
+ sendSms(opts: { to: string; body: string; from?: string }): Promise<void>;
126
+ }
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Zoom provider — OAuth-based; creates a Zoom meeting per booking.
3
+ *
4
+ * Tokens are stored via the consumer's callback (typically core's
5
+ * oauth_tokens), keyed by credentialId. Consumers wire up
6
+ * `getAccessToken` + `updateTokens` against their token store.
7
+ *
8
+ * OAuth:
9
+ * - Auth URL: https://zoom.us/oauth/authorize?response_type=code&...
10
+ * - Token URL: https://zoom.us/oauth/token (basic-auth client_id:secret)
11
+ * - Scopes: meeting:write meeting:read (so we can create + delete)
12
+ * - User info: GET https://api.zoom.us/v2/users/me (returns account_id + email)
13
+ */
14
+ import type { VideoProvider } from "./types.js";
15
+
16
+ export interface ZoomProviderConfig {
17
+ clientId: string;
18
+ clientSecret: string;
19
+ getAccessToken: (credentialId: string) => Promise<string>;
20
+ /**
21
+ * Persist tokens after `completeOAuth` (and any later refresh). Optional —
22
+ * if omitted, the consumer is responsible for doing the write inside their
23
+ * own callback handler.
24
+ */
25
+ updateTokens?: (
26
+ credentialId: string,
27
+ tokens: {
28
+ accessToken: string;
29
+ refreshToken?: string;
30
+ expiresAt?: Date;
31
+ rawResponse?: Record<string, unknown>;
32
+ },
33
+ ) => Promise<void>;
34
+ /** Called when the API returns 401/403; mark credential invalid in UI. */
35
+ markInvalid?: (credentialId: string) => Promise<void>;
36
+ }
37
+
38
+ // Minimum scope needed to create + read meetings on the user's behalf.
39
+ const SCOPES = ["meeting:write", "meeting:read", "user:read"];
40
+
41
+ export function createZoomProvider(config: ZoomProviderConfig): VideoProvider {
42
+ return {
43
+ kind: "zoom_video",
44
+ label: "Zoom",
45
+
46
+ async startOAuth({ redirectUri, state }) {
47
+ const params = new URLSearchParams({
48
+ response_type: "code",
49
+ client_id: config.clientId,
50
+ redirect_uri: redirectUri,
51
+ state,
52
+ scope: SCOPES.join(" "),
53
+ });
54
+ return {
55
+ authUrl: `https://zoom.us/oauth/authorize?${params}`,
56
+ };
57
+ },
58
+
59
+ async completeOAuth({ code, redirectUri, credentialId }) {
60
+ const basic = Buffer.from(
61
+ `${config.clientId}:${config.clientSecret}`,
62
+ ).toString("base64");
63
+ const body = new URLSearchParams({
64
+ grant_type: "authorization_code",
65
+ code,
66
+ redirect_uri: redirectUri,
67
+ });
68
+ const tokenRes = await fetch("https://zoom.us/oauth/token", {
69
+ method: "POST",
70
+ headers: {
71
+ authorization: `Basic ${basic}`,
72
+ "content-type": "application/x-www-form-urlencoded",
73
+ },
74
+ body,
75
+ });
76
+ if (!tokenRes.ok) {
77
+ throw new Error(
78
+ `Zoom token exchange failed: ${tokenRes.status} ${await tokenRes.text()}`,
79
+ );
80
+ }
81
+ const tokens = (await tokenRes.json()) as {
82
+ access_token: string;
83
+ refresh_token?: string;
84
+ expires_in?: number;
85
+ scope?: string;
86
+ token_type?: string;
87
+ };
88
+
89
+ await config.updateTokens?.(credentialId, {
90
+ accessToken: tokens.access_token,
91
+ refreshToken: tokens.refresh_token,
92
+ expiresAt: new Date(Date.now() + (tokens.expires_in ?? 3600) * 1000),
93
+ rawResponse: tokens as unknown as Record<string, unknown>,
94
+ });
95
+
96
+ // Pull user info to label the credential.
97
+ const userRes = await fetch("https://api.zoom.us/v2/users/me", {
98
+ headers: { authorization: `Bearer ${tokens.access_token}` },
99
+ });
100
+ let externalEmail: string | undefined;
101
+ let externalAccountId = credentialId;
102
+ let displayName: string | undefined;
103
+ if (userRes.ok) {
104
+ const user = (await userRes.json()) as {
105
+ id?: string;
106
+ email?: string;
107
+ first_name?: string;
108
+ last_name?: string;
109
+ account_id?: string;
110
+ };
111
+ externalEmail = user.email;
112
+ externalAccountId = user.id ?? user.account_id ?? credentialId;
113
+ if (user.first_name || user.last_name) {
114
+ displayName = [user.first_name, user.last_name]
115
+ .filter(Boolean)
116
+ .join(" ");
117
+ }
118
+ }
119
+
120
+ return { externalAccountId, externalEmail, displayName };
121
+ },
122
+
123
+ async createMeeting({ credentialId, booking }) {
124
+ if (!credentialId) throw new Error("Zoom requires credentialId");
125
+ const token = await config.getAccessToken(credentialId);
126
+ const res = await fetch("https://api.zoom.us/v2/users/me/meetings", {
127
+ method: "POST",
128
+ headers: {
129
+ authorization: `Bearer ${token}`,
130
+ "content-type": "application/json",
131
+ },
132
+ body: JSON.stringify({
133
+ topic: booking.title,
134
+ type: 2,
135
+ start_time: booking.startTime,
136
+ duration: Math.round(
137
+ (new Date(booking.endTime).getTime() -
138
+ new Date(booking.startTime).getTime()) /
139
+ 60000,
140
+ ),
141
+ timezone: booking.timezone,
142
+ settings: {
143
+ join_before_host: true,
144
+ waiting_room: false,
145
+ mute_upon_entry: false,
146
+ },
147
+ }),
148
+ });
149
+ if (res.status === 401 || res.status === 403) {
150
+ await config.markInvalid?.(credentialId);
151
+ }
152
+ if (!res.ok) throw new Error(`Zoom ${res.status}: ${await res.text()}`);
153
+ const body = await res.json();
154
+ return {
155
+ meetingUrl: body.join_url,
156
+ meetingId: String(body.id),
157
+ meetingPassword: body.password,
158
+ };
159
+ },
160
+
161
+ async deleteMeeting({ credentialId, meetingId }) {
162
+ if (!credentialId) return;
163
+ const token = await config.getAccessToken(credentialId);
164
+ await fetch(
165
+ `https://api.zoom.us/v2/meetings/${encodeURIComponent(meetingId)}`,
166
+ {
167
+ method: "DELETE",
168
+ headers: { authorization: `Bearer ${token}` },
169
+ },
170
+ );
171
+ },
172
+ };
173
+ }
@@ -0,0 +1,279 @@
1
+ /**
2
+ * Data access for schedules — the weekly-hours + date-override definitions
3
+ * that event types reference.
4
+ */
5
+ import { eq, and, inArray, type SQL } from "drizzle-orm";
6
+ import { nanoid } from "nanoid";
7
+ import { accessFilter } from "@agent-native/core/sharing";
8
+ import type {
9
+ Schedule,
10
+ WeeklyAvailability,
11
+ DateOverride,
12
+ AvailabilityInterval,
13
+ } from "../shared/index.js";
14
+ import { getSchedulingContext } from "./context.js";
15
+
16
+ export async function listSchedules(
17
+ ownerEmailOrParams:
18
+ | string
19
+ | {
20
+ ownerEmail?: string;
21
+ useAccessFilter?: boolean;
22
+ },
23
+ ): Promise<Schedule[]> {
24
+ const params =
25
+ typeof ownerEmailOrParams === "string"
26
+ ? { ownerEmail: ownerEmailOrParams }
27
+ : ownerEmailOrParams;
28
+ const { getDb, schema } = getSchedulingContext();
29
+ const db = getDb();
30
+ let where: SQL | undefined;
31
+ if (params.useAccessFilter) {
32
+ where = accessFilter(schema.schedules, schema.scheduleShares);
33
+ } else if (params.ownerEmail) {
34
+ where = eq(schema.schedules.ownerEmail, params.ownerEmail);
35
+ }
36
+ const scheduleRows = await db.select().from(schema.schedules).where(where);
37
+ if (scheduleRows.length === 0) return [];
38
+ const ids = scheduleRows.map((r: any) => r.id);
39
+ const availabilityRows = await db
40
+ .select()
41
+ .from(schema.scheduleAvailability)
42
+ .where(inArray(schema.scheduleAvailability.scheduleId, ids));
43
+ const overrideRows = await db
44
+ .select()
45
+ .from(schema.dateOverrides)
46
+ .where(inArray(schema.dateOverrides.scheduleId, ids));
47
+ return scheduleRows.map((s: any) =>
48
+ hydrateSchedule(s, availabilityRows, overrideRows),
49
+ );
50
+ }
51
+
52
+ export async function getScheduleById(id: string): Promise<Schedule | null> {
53
+ const { getDb, schema } = getSchedulingContext();
54
+ const db = getDb();
55
+ const s = await db
56
+ .select()
57
+ .from(schema.schedules)
58
+ .where(eq(schema.schedules.id, id));
59
+ if (!s[0]) return null;
60
+ const avail = await db
61
+ .select()
62
+ .from(schema.scheduleAvailability)
63
+ .where(eq(schema.scheduleAvailability.scheduleId, id));
64
+ const overrides = await db
65
+ .select()
66
+ .from(schema.dateOverrides)
67
+ .where(eq(schema.dateOverrides.scheduleId, id));
68
+ return hydrateSchedule(s[0], avail, overrides);
69
+ }
70
+
71
+ export async function createSchedule(input: {
72
+ ownerEmail: string;
73
+ orgId?: string;
74
+ name: string;
75
+ timezone: string;
76
+ isDefault?: boolean;
77
+ weeklyAvailability?: WeeklyAvailability[];
78
+ }): Promise<Schedule> {
79
+ const { getDb, schema } = getSchedulingContext();
80
+ const db = getDb();
81
+ const id = nanoid();
82
+ const now = new Date().toISOString();
83
+ await db.insert(schema.schedules).values({
84
+ id,
85
+ name: input.name,
86
+ timezone: input.timezone,
87
+ isDefault: Boolean(input.isDefault),
88
+ ownerEmail: input.ownerEmail,
89
+ orgId: input.orgId ?? null,
90
+ createdAt: now,
91
+ updatedAt: now,
92
+ });
93
+ const weekly = input.weeklyAvailability ?? defaultWeeklyAvailability();
94
+ for (const w of weekly) {
95
+ for (const iv of w.intervals) {
96
+ await db.insert(schema.scheduleAvailability).values({
97
+ id: nanoid(),
98
+ scheduleId: id,
99
+ day: w.day,
100
+ startTime: iv.startTime,
101
+ endTime: iv.endTime,
102
+ createdAt: now,
103
+ });
104
+ }
105
+ }
106
+ const out = await getScheduleById(id);
107
+ if (!out) throw new Error("Failed to create schedule");
108
+ return out;
109
+ }
110
+
111
+ export async function updateSchedule(
112
+ id: string,
113
+ patch: {
114
+ name?: string;
115
+ timezone?: string;
116
+ weeklyAvailability?: WeeklyAvailability[];
117
+ dateOverrides?: DateOverride[];
118
+ isDefault?: boolean;
119
+ },
120
+ ): Promise<Schedule> {
121
+ const { getDb, schema } = getSchedulingContext();
122
+ const db = getDb();
123
+ const now = new Date().toISOString();
124
+ const setClause: any = { updatedAt: now };
125
+ if (patch.name != null) setClause.name = patch.name;
126
+ if (patch.timezone != null) setClause.timezone = patch.timezone;
127
+ if (patch.isDefault != null) setClause.isDefault = patch.isDefault;
128
+ await db
129
+ .update(schema.schedules)
130
+ .set(setClause)
131
+ .where(eq(schema.schedules.id, id));
132
+
133
+ if (patch.weeklyAvailability) {
134
+ await db
135
+ .delete(schema.scheduleAvailability)
136
+ .where(eq(schema.scheduleAvailability.scheduleId, id));
137
+ for (const w of patch.weeklyAvailability) {
138
+ for (const iv of w.intervals) {
139
+ await db.insert(schema.scheduleAvailability).values({
140
+ id: nanoid(),
141
+ scheduleId: id,
142
+ day: w.day,
143
+ startTime: iv.startTime,
144
+ endTime: iv.endTime,
145
+ createdAt: now,
146
+ });
147
+ }
148
+ }
149
+ }
150
+ if (patch.dateOverrides) {
151
+ await db
152
+ .delete(schema.dateOverrides)
153
+ .where(eq(schema.dateOverrides.scheduleId, id));
154
+ for (const o of patch.dateOverrides) {
155
+ await db.insert(schema.dateOverrides).values({
156
+ id: nanoid(),
157
+ scheduleId: id,
158
+ date: o.date,
159
+ intervals: JSON.stringify(o.intervals),
160
+ createdAt: now,
161
+ });
162
+ }
163
+ }
164
+ const updated = await getScheduleById(id);
165
+ if (!updated) throw new Error("Failed to update schedule");
166
+ return updated;
167
+ }
168
+
169
+ export async function deleteSchedule(id: string): Promise<void> {
170
+ const { getDb, schema } = getSchedulingContext();
171
+ const db = getDb();
172
+ await db
173
+ .delete(schema.dateOverrides)
174
+ .where(eq(schema.dateOverrides.scheduleId, id));
175
+ await db
176
+ .delete(schema.scheduleAvailability)
177
+ .where(eq(schema.scheduleAvailability.scheduleId, id));
178
+ await db.delete(schema.schedules).where(eq(schema.schedules.id, id));
179
+ }
180
+
181
+ export async function setDefaultSchedule(
182
+ ownerEmail: string,
183
+ scheduleId: string,
184
+ ): Promise<void> {
185
+ const { getDb, schema } = getSchedulingContext();
186
+ const db = getDb();
187
+ const now = new Date().toISOString();
188
+ const all = await db
189
+ .select({ id: schema.schedules.id })
190
+ .from(schema.schedules)
191
+ .where(eq(schema.schedules.ownerEmail, ownerEmail));
192
+ for (const row of all) {
193
+ await db
194
+ .update(schema.schedules)
195
+ .set({ isDefault: row.id === scheduleId, updatedAt: now })
196
+ .where(eq(schema.schedules.id, row.id));
197
+ }
198
+ }
199
+
200
+ export async function upsertDateOverride(
201
+ scheduleId: string,
202
+ date: string,
203
+ intervals: AvailabilityInterval[],
204
+ ): Promise<void> {
205
+ const { getDb, schema } = getSchedulingContext();
206
+ const db = getDb();
207
+ const now = new Date().toISOString();
208
+ await db
209
+ .delete(schema.dateOverrides)
210
+ .where(
211
+ and(
212
+ eq(schema.dateOverrides.scheduleId, scheduleId),
213
+ eq(schema.dateOverrides.date, date),
214
+ ),
215
+ );
216
+ await db.insert(schema.dateOverrides).values({
217
+ id: nanoid(),
218
+ scheduleId,
219
+ date,
220
+ intervals: JSON.stringify(intervals),
221
+ createdAt: now,
222
+ });
223
+ }
224
+
225
+ export async function removeDateOverride(
226
+ scheduleId: string,
227
+ date: string,
228
+ ): Promise<void> {
229
+ const { getDb, schema } = getSchedulingContext();
230
+ await getDb()
231
+ .delete(schema.dateOverrides)
232
+ .where(
233
+ and(
234
+ eq(schema.dateOverrides.scheduleId, scheduleId),
235
+ eq(schema.dateOverrides.date, date),
236
+ ),
237
+ );
238
+ }
239
+
240
+ function hydrateSchedule(
241
+ s: any,
242
+ availabilityRows: any[],
243
+ overrideRows: any[],
244
+ ): Schedule {
245
+ const weekly = new Map<number, AvailabilityInterval[]>();
246
+ for (const row of availabilityRows) {
247
+ if (row.scheduleId !== s.id) continue;
248
+ const day = row.day;
249
+ if (!weekly.has(day)) weekly.set(day, []);
250
+ weekly.get(day)!.push({ startTime: row.startTime, endTime: row.endTime });
251
+ }
252
+ const weeklyAvailability: WeeklyAvailability[] = Array.from(weekly.entries())
253
+ .map(([day, intervals]) => ({ day, intervals }))
254
+ .sort((a, b) => a.day - b.day);
255
+ const dateOverrides: DateOverride[] = overrideRows
256
+ .filter((r) => r.scheduleId === s.id)
257
+ .map((r) => ({
258
+ date: r.date,
259
+ intervals: JSON.parse(r.intervals),
260
+ }));
261
+ return {
262
+ id: s.id,
263
+ name: s.name,
264
+ timezone: s.timezone,
265
+ ownerEmail: s.ownerEmail,
266
+ isDefault: Boolean(s.isDefault),
267
+ weeklyAvailability,
268
+ dateOverrides,
269
+ createdAt: s.createdAt,
270
+ updatedAt: s.updatedAt,
271
+ };
272
+ }
273
+
274
+ function defaultWeeklyAvailability(): WeeklyAvailability[] {
275
+ return [1, 2, 3, 4, 5].map((day) => ({
276
+ day,
277
+ intervals: [{ startTime: "09:00", endTime: "17:00" }],
278
+ }));
279
+ }
@@ -0,0 +1,120 @@
1
+ import { describe, expect, it, beforeEach, afterEach } from "vitest";
2
+ import {
3
+ signVideoOAuthState,
4
+ verifyVideoOAuthState,
5
+ } from "./video-oauth-state.js";
6
+
7
+ const ORIGINAL_SECRET = process.env.BETTER_AUTH_SECRET;
8
+
9
+ describe("video-oauth-state", () => {
10
+ beforeEach(() => {
11
+ process.env.BETTER_AUTH_SECRET = "test-secret-do-not-use-in-prod";
12
+ });
13
+
14
+ afterEach(() => {
15
+ if (ORIGINAL_SECRET === undefined) delete process.env.BETTER_AUTH_SECRET;
16
+ else process.env.BETTER_AUTH_SECRET = ORIGINAL_SECRET;
17
+ });
18
+
19
+ it("signs and verifies a state for the same user + kind", () => {
20
+ const state = signVideoOAuthState({
21
+ kind: "zoom_video",
22
+ userEmail: "alice@example.com",
23
+ });
24
+ expect(
25
+ verifyVideoOAuthState({
26
+ state,
27
+ kind: "zoom_video",
28
+ userEmail: "alice@example.com",
29
+ }),
30
+ ).toBe(true);
31
+ });
32
+
33
+ it("rejects a state forged for a different user", () => {
34
+ const state = signVideoOAuthState({
35
+ kind: "zoom_video",
36
+ userEmail: "alice@example.com",
37
+ });
38
+ expect(
39
+ verifyVideoOAuthState({
40
+ state,
41
+ kind: "zoom_video",
42
+ userEmail: "mallory@example.com",
43
+ }),
44
+ ).toBe(false);
45
+ });
46
+
47
+ it("rejects a state cross-bound to a different kind", () => {
48
+ const state = signVideoOAuthState({
49
+ kind: "zoom_video",
50
+ userEmail: "alice@example.com",
51
+ });
52
+ expect(
53
+ verifyVideoOAuthState({
54
+ state,
55
+ kind: "google_meet",
56
+ userEmail: "alice@example.com",
57
+ }),
58
+ ).toBe(false);
59
+ });
60
+
61
+ it("rejects empty / malformed state", () => {
62
+ expect(
63
+ verifyVideoOAuthState({
64
+ state: undefined,
65
+ kind: "zoom_video",
66
+ userEmail: "alice@example.com",
67
+ }),
68
+ ).toBe(false);
69
+ expect(
70
+ verifyVideoOAuthState({
71
+ state: "",
72
+ kind: "zoom_video",
73
+ userEmail: "alice@example.com",
74
+ }),
75
+ ).toBe(false);
76
+ expect(
77
+ verifyVideoOAuthState({
78
+ state: "garbage",
79
+ kind: "zoom_video",
80
+ userEmail: "alice@example.com",
81
+ }),
82
+ ).toBe(false);
83
+ expect(
84
+ verifyVideoOAuthState({
85
+ state: "a.b.c.d.e",
86
+ kind: "zoom_video",
87
+ userEmail: "alice@example.com",
88
+ }),
89
+ ).toBe(false);
90
+ });
91
+
92
+ it("rejects expired state", () => {
93
+ const state = signVideoOAuthState({
94
+ kind: "zoom_video",
95
+ userEmail: "alice@example.com",
96
+ });
97
+ expect(
98
+ verifyVideoOAuthState({
99
+ state,
100
+ kind: "zoom_video",
101
+ userEmail: "alice@example.com",
102
+ ttlMs: -1, // every state is "older" than -1 ms ago.
103
+ }),
104
+ ).toBe(false);
105
+ });
106
+
107
+ it("is case-insensitive on email but rejects mismatched casing if secret rotates", () => {
108
+ const state = signVideoOAuthState({
109
+ kind: "zoom_video",
110
+ userEmail: "Alice@Example.COM",
111
+ });
112
+ expect(
113
+ verifyVideoOAuthState({
114
+ state,
115
+ kind: "zoom_video",
116
+ userEmail: "alice@example.com",
117
+ }),
118
+ ).toBe(true);
119
+ });
120
+ });