@nylas/web-elements 1.1.0-canary.7 → 1.1.0-canary.9

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 (473) hide show
  1. package/dist/cjs/{add-circle-icon_22.cjs.entry.js → add-circle-icon_21.cjs.entry.js} +55 -165
  2. package/dist/cjs/add-circle-icon_21.cjs.entry.js.map +1 -0
  3. package/dist/cjs/forward-icon_6.cjs.entry.js +2 -2
  4. package/dist/cjs/google-logo-icon_4.cjs.entry.js +24 -16
  5. package/dist/cjs/google-logo-icon_4.cjs.entry.js.map +1 -1
  6. package/dist/cjs/index.cjs.js +2 -2
  7. package/dist/cjs/{index.es-b12b7df1.js → index.es-cc2d145f.js} +3 -3
  8. package/dist/cjs/index.es-cc2d145f.js.map +1 -0
  9. package/dist/cjs/{index.es-0a0f2d87.js → index.es-ec84e726.js} +3 -3
  10. package/dist/cjs/index.es-ec84e726.js.map +1 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{mailbox-store-14531fd4.js → mailbox-store-5ea7604e.js} +3 -3
  13. package/dist/cjs/{mailbox-store-05fa3bec.js.map → mailbox-store-5ea7604e.js.map} +1 -1
  14. package/dist/cjs/{mailbox-store-05fa3bec.js → mailbox-store-a02df2a7.js} +3 -3
  15. package/dist/cjs/{mailbox-store-14531fd4.js.map → mailbox-store-a02df2a7.js.map} +1 -1
  16. package/dist/cjs/multi-select-dropdown.cjs.entry.js +1 -1
  17. package/dist/cjs/nylas-additional-participants.cjs.entry.js +2 -2
  18. package/dist/cjs/{nylas-api-request-abdb8dd8.js → nylas-api-request-05f1e068.js} +2 -2
  19. package/dist/cjs/{nylas-api-request-abdb8dd8.js.map → nylas-api-request-05f1e068.js.map} +1 -1
  20. package/dist/cjs/{nylas-api-request-27c25287.js → nylas-api-request-de316f1a.js} +2 -2
  21. package/dist/cjs/{nylas-api-request-27c25287.js.map → nylas-api-request-de316f1a.js.map} +1 -1
  22. package/dist/cjs/nylas-availability-picker.cjs.entry.js +4 -3
  23. package/dist/cjs/nylas-availability-picker.cjs.entry.js.map +1 -1
  24. package/dist/cjs/nylas-booked-event-card.cjs.entry.js +21 -5
  25. package/dist/cjs/nylas-booked-event-card.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nylas-booked-event-card_10.cjs.entry.js +54 -9
  27. package/dist/cjs/nylas-booked-event-card_10.cjs.entry.js.map +1 -1
  28. package/dist/cjs/nylas-booking-calendar-picker.cjs.entry.js +2 -2
  29. package/dist/cjs/nylas-booking-form.cjs.entry.js +2 -2
  30. package/dist/cjs/nylas-buffer-time.cjs.entry.js +4 -4
  31. package/dist/cjs/nylas-buffer-time.cjs.entry.js.map +1 -1
  32. package/dist/cjs/nylas-calendar-picker.cjs.entry.js +2 -2
  33. package/dist/cjs/nylas-cancel-booking-form.cjs.entry.js +2 -2
  34. package/dist/cjs/nylas-cancelled-event-card.cjs.entry.js +22 -5
  35. package/dist/cjs/nylas-cancelled-event-card.cjs.entry.js.map +1 -1
  36. package/dist/cjs/nylas-composer.cjs.entry.js +1 -1
  37. package/dist/cjs/nylas-custom-booking-flow.cjs.entry.js +2 -2
  38. package/dist/cjs/nylas-date-picker.cjs.entry.js +15 -3
  39. package/dist/cjs/nylas-date-picker.cjs.entry.js.map +1 -1
  40. package/dist/cjs/nylas-editor-tabs.cjs.entry.js +18 -12
  41. package/dist/cjs/nylas-editor-tabs.cjs.entry.js.map +1 -1
  42. package/dist/cjs/nylas-event-description.cjs.entry.js +2 -2
  43. package/dist/cjs/nylas-event-duration.cjs.entry.js +2 -2
  44. package/dist/cjs/nylas-event-info.cjs.entry.js +3 -3
  45. package/dist/cjs/nylas-event-info.cjs.entry.js.map +1 -1
  46. package/dist/cjs/nylas-event-limits.cjs.entry.js +3 -3
  47. package/dist/cjs/nylas-event-limits.cjs.entry.js.map +1 -1
  48. package/dist/cjs/nylas-event-title.cjs.entry.js +22 -11
  49. package/dist/cjs/nylas-event-title.cjs.entry.js.map +1 -1
  50. package/dist/cjs/nylas-form-card.cjs.entry.js +2 -2
  51. package/dist/cjs/nylas-if-state.cjs.entry.js +2 -2
  52. package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js +3 -3
  53. package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js.map +1 -1
  54. package/dist/cjs/nylas-list-configurations.cjs.entry.js +8 -6
  55. package/dist/cjs/nylas-list-configurations.cjs.entry.js.map +1 -1
  56. package/dist/cjs/nylas-list-folders.cjs.entry.js +2 -2
  57. package/dist/cjs/nylas-list-threads.cjs.entry.js +2 -2
  58. package/dist/cjs/nylas-locale-switch.cjs.entry.js +2 -2
  59. package/dist/cjs/nylas-location-component.cjs.entry.js +3 -3
  60. package/dist/cjs/nylas-location-component.cjs.entry.js.map +1 -1
  61. package/dist/cjs/nylas-login.cjs.entry.js +2 -2
  62. package/dist/cjs/nylas-mailbox-pagination.cjs.entry.js +2 -2
  63. package/dist/cjs/nylas-mailbox-toolbar-button.cjs.entry.js +2 -2
  64. package/dist/cjs/nylas-mailbox.cjs.entry.js +3 -3
  65. package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js +3 -3
  66. package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js.map +1 -1
  67. package/dist/cjs/nylas-notification.cjs.entry.js +1 -1
  68. package/dist/cjs/nylas-provider.cjs.entry.js +5 -5
  69. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +8 -14
  70. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js.map +1 -1
  71. package/dist/cjs/nylas-scheduling.cjs.entry.js +35 -12
  72. package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
  73. package/dist/cjs/nylas-selected-event-card.cjs.entry.js +2 -2
  74. package/dist/cjs/nylas-summarize-message-button.cjs.entry.js +2 -2
  75. package/dist/cjs/nylas-threads-refresh.cjs.entry.js +2 -2
  76. package/dist/cjs/nylas-threads-search.cjs.entry.js +2 -2
  77. package/dist/cjs/nylas-time-window-picker.cjs.entry.js +1 -1
  78. package/dist/cjs/nylas-timeslot-picker.cjs.entry.js +2 -2
  79. package/dist/cjs/nylas-view-email.cjs.entry.js +1 -1
  80. package/dist/cjs/nylas-view-thread.cjs.entry.js +2 -2
  81. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  82. package/dist/cjs/{register-component-09ebdf31.js → register-component-2c3ad1d1.js} +2 -2
  83. package/dist/cjs/{register-component-09ebdf31.js.map → register-component-2c3ad1d1.js.map} +1 -1
  84. package/dist/cjs/{register-component-c8b6e907.js → register-component-4f8ae42c.js} +2 -2
  85. package/dist/cjs/{register-component-c8b6e907.js.map → register-component-4f8ae42c.js.map} +1 -1
  86. package/dist/cjs/{scheduler-config-store-37690bf0.js → scheduler-config-store-918c20d5.js} +3 -4
  87. package/dist/cjs/scheduler-config-store-918c20d5.js.map +1 -0
  88. package/dist/cjs/{scheduler-config-store-529c8d7e.js → scheduler-config-store-a5b7c08b.js} +3 -4
  89. package/dist/cjs/scheduler-config-store-a5b7c08b.js.map +1 -0
  90. package/dist/cjs/{scheduler-store-67dc1986.js → scheduler-store-33e204ef.js} +39 -7
  91. package/dist/cjs/scheduler-store-33e204ef.js.map +1 -0
  92. package/dist/cjs/{scheduler-store-0081970d.js → scheduler-store-df23f511.js} +39 -7
  93. package/dist/cjs/scheduler-store-df23f511.js.map +1 -0
  94. package/dist/cjs/time-period-selector.cjs.entry.js +1 -1
  95. package/dist/cjs/{utils-2c7f0895.js → utils-85bd0909.js} +109 -2
  96. package/dist/cjs/utils-85bd0909.js.map +1 -0
  97. package/dist/cjs/{utils-20663d54.js → utils-e6d76818.js} +109 -2
  98. package/dist/cjs/utils-e6d76818.js.map +1 -0
  99. package/dist/collection/common/types.js.map +1 -1
  100. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.css +2 -1
  101. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js +56 -3
  102. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js.map +1 -1
  103. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js +75 -6
  104. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js.map +1 -1
  105. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +37 -3
  106. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js.map +1 -1
  107. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduling.js +41 -12
  108. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduling.js.map +1 -1
  109. package/dist/collection/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.js +2 -1
  110. package/dist/collection/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.js.map +1 -1
  111. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.css +23 -3
  112. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js +1 -1
  113. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js.map +1 -1
  114. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.css +7 -0
  115. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js +39 -14
  116. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js.map +1 -1
  117. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/tab-contents.js +1 -1
  118. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/tab-contents.js.map +1 -1
  119. package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js +1 -1
  120. package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js.map +1 -1
  121. package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js +1 -1
  122. package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js.map +1 -1
  123. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js +21 -10
  124. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js.map +1 -1
  125. package/dist/collection/components/scheduler-editor/nylas-limit-future-bookings/nylas-limit-future-bookings.css +7 -1
  126. package/dist/collection/components/scheduler-editor/nylas-list-configurations/nylas-list-configurations.css +20 -2
  127. package/dist/collection/components/scheduler-editor/nylas-list-configurations/nylas-list-configurations.js +5 -3
  128. package/dist/collection/components/scheduler-editor/nylas-list-configurations/nylas-list-configurations.js.map +1 -1
  129. package/dist/collection/components/scheduler-editor/nylas-location-component/nylas-location-component.css +5 -0
  130. package/dist/collection/components/scheduler-editor/nylas-min-cancellation-notice/nylas-min-cancellation-notice.css +7 -1
  131. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.css +20 -0
  132. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js +6 -13
  133. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js.map +1 -1
  134. package/dist/collection/connector/shared/api/scheduler-config.js +0 -1
  135. package/dist/collection/connector/shared/api/scheduler-config.js.map +1 -1
  136. package/dist/collection/connector/shared/api/scheduler.js +37 -5
  137. package/dist/collection/connector/shared/api/scheduler.js.map +1 -1
  138. package/dist/collection/stores/scheduler-config-store.js +2 -3
  139. package/dist/collection/stores/scheduler-config-store.js.map +1 -1
  140. package/dist/collection/stores/scheduler-store.js.map +1 -1
  141. package/dist/collection/utils/utils.js +104 -1
  142. package/dist/collection/utils/utils.js.map +1 -1
  143. package/dist/components/index.es.js +2 -2
  144. package/dist/components/index.es.js.map +1 -1
  145. package/dist/components/nylas-availability-picker2.js +2 -1
  146. package/dist/components/nylas-availability-picker2.js.map +1 -1
  147. package/dist/components/nylas-booked-event-card2.js +22 -5
  148. package/dist/components/nylas-booked-event-card2.js.map +1 -1
  149. package/dist/components/nylas-buffer-time2.js +2 -2
  150. package/dist/components/nylas-buffer-time2.js.map +1 -1
  151. package/dist/components/nylas-cancelled-event-card2.js +23 -4
  152. package/dist/components/nylas-cancelled-event-card2.js.map +1 -1
  153. package/dist/components/nylas-custom-booking-flow.js +170 -1
  154. package/dist/components/nylas-custom-booking-flow.js.map +1 -1
  155. package/dist/components/nylas-date-picker2.js +17 -3
  156. package/dist/components/nylas-date-picker2.js.map +1 -1
  157. package/dist/components/nylas-editor-tabs2.js +52 -51
  158. package/dist/components/nylas-editor-tabs2.js.map +1 -1
  159. package/dist/components/nylas-event-info2.js +1 -1
  160. package/dist/components/nylas-event-info2.js.map +1 -1
  161. package/dist/components/nylas-event-limits2.js +1 -1
  162. package/dist/components/nylas-event-limits2.js.map +1 -1
  163. package/dist/components/nylas-event-title2.js +21 -10
  164. package/dist/components/nylas-event-title2.js.map +1 -1
  165. package/dist/components/nylas-limit-future-bookings2.js +1 -1
  166. package/dist/components/nylas-limit-future-bookings2.js.map +1 -1
  167. package/dist/components/nylas-list-configurations2.js +7 -5
  168. package/dist/components/nylas-list-configurations2.js.map +1 -1
  169. package/dist/components/nylas-list-folders.js +1 -1
  170. package/dist/components/nylas-list-threads.js +1 -1
  171. package/dist/components/nylas-location-component2.js +1 -1
  172. package/dist/components/nylas-location-component2.js.map +1 -1
  173. package/dist/components/nylas-min-cancellation-notice2.js +1 -1
  174. package/dist/components/nylas-min-cancellation-notice2.js.map +1 -1
  175. package/dist/components/nylas-scheduler-editor.js +46 -59
  176. package/dist/components/nylas-scheduler-editor.js.map +1 -1
  177. package/dist/components/nylas-scheduling.js +34 -11
  178. package/dist/components/nylas-scheduling.js.map +1 -1
  179. package/dist/components/nylas-summarize-message-button2.js +1 -1
  180. package/dist/components/nylas-timeslot-picker2.js +1 -1
  181. package/dist/components/nylas-view-email2.js +1 -1
  182. package/dist/components/nylas-view-thread.js +1 -1
  183. package/dist/components/scheduler-config-store.js +2 -3
  184. package/dist/components/scheduler-config-store.js.map +1 -1
  185. package/dist/components/scheduler-store.js +37 -5
  186. package/dist/components/scheduler-store.js.map +1 -1
  187. package/dist/components/utils.js +105 -2
  188. package/dist/components/utils.js.map +1 -1
  189. package/dist/esm/{add-circle-icon_22.entry.js → add-circle-icon_21.entry.js} +56 -165
  190. package/dist/esm/add-circle-icon_21.entry.js.map +1 -0
  191. package/dist/esm/forward-icon_6.entry.js +2 -2
  192. package/dist/esm/google-logo-icon_4.entry.js +24 -16
  193. package/dist/esm/google-logo-icon_4.entry.js.map +1 -1
  194. package/dist/esm/{index.es-f57e612a.js → index.es-be19d2df.js} +3 -3
  195. package/dist/esm/index.es-be19d2df.js.map +1 -0
  196. package/dist/esm/{index.es-2842f8c8.js → index.es-eb477d56.js} +3 -3
  197. package/dist/esm/index.es-eb477d56.js.map +1 -0
  198. package/dist/esm/index.js +2 -2
  199. package/dist/esm/loader.js +1 -1
  200. package/dist/esm/{mailbox-store-47fc8a1a.js → mailbox-store-76540d24.js} +3 -3
  201. package/dist/{nylas-web-elements/mailbox-store-d48269de.js.map → esm/mailbox-store-76540d24.js.map} +1 -1
  202. package/dist/{nylas-web-elements/mailbox-store-d48269de.js → esm/mailbox-store-9f819402.js} +3 -3
  203. package/dist/esm/{mailbox-store-47fc8a1a.js.map → mailbox-store-9f819402.js.map} +1 -1
  204. package/dist/esm/multi-select-dropdown.entry.js +1 -1
  205. package/dist/esm/nylas-additional-participants.entry.js +2 -2
  206. package/dist/esm/{nylas-api-request-8932547a.js → nylas-api-request-59738f8c.js} +2 -2
  207. package/dist/esm/{nylas-api-request-8932547a.js.map → nylas-api-request-59738f8c.js.map} +1 -1
  208. package/dist/{nylas-web-elements/nylas-api-request-b085294d.js → esm/nylas-api-request-ff2869d7.js} +2 -2
  209. package/dist/esm/{nylas-api-request-b085294d.js.map → nylas-api-request-ff2869d7.js.map} +1 -1
  210. package/dist/esm/nylas-availability-picker.entry.js +4 -3
  211. package/dist/esm/nylas-availability-picker.entry.js.map +1 -1
  212. package/dist/esm/nylas-booked-event-card.entry.js +21 -5
  213. package/dist/esm/nylas-booked-event-card.entry.js.map +1 -1
  214. package/dist/esm/nylas-booked-event-card_10.entry.js +54 -9
  215. package/dist/esm/nylas-booked-event-card_10.entry.js.map +1 -1
  216. package/dist/esm/nylas-booking-calendar-picker.entry.js +2 -2
  217. package/dist/esm/nylas-booking-form.entry.js +2 -2
  218. package/dist/esm/nylas-buffer-time.entry.js +4 -4
  219. package/dist/esm/nylas-buffer-time.entry.js.map +1 -1
  220. package/dist/esm/nylas-calendar-picker.entry.js +2 -2
  221. package/dist/esm/nylas-cancel-booking-form.entry.js +2 -2
  222. package/dist/esm/nylas-cancelled-event-card.entry.js +22 -5
  223. package/dist/esm/nylas-cancelled-event-card.entry.js.map +1 -1
  224. package/dist/esm/nylas-composer.entry.js +1 -1
  225. package/dist/esm/nylas-custom-booking-flow.entry.js +2 -2
  226. package/dist/esm/nylas-date-picker.entry.js +15 -3
  227. package/dist/esm/nylas-date-picker.entry.js.map +1 -1
  228. package/dist/esm/nylas-editor-tabs.entry.js +18 -12
  229. package/dist/esm/nylas-editor-tabs.entry.js.map +1 -1
  230. package/dist/esm/nylas-event-description.entry.js +2 -2
  231. package/dist/esm/nylas-event-duration.entry.js +2 -2
  232. package/dist/esm/nylas-event-info.entry.js +3 -3
  233. package/dist/esm/nylas-event-info.entry.js.map +1 -1
  234. package/dist/esm/nylas-event-limits.entry.js +3 -3
  235. package/dist/esm/nylas-event-limits.entry.js.map +1 -1
  236. package/dist/esm/nylas-event-title.entry.js +22 -11
  237. package/dist/esm/nylas-event-title.entry.js.map +1 -1
  238. package/dist/esm/nylas-form-card.entry.js +2 -2
  239. package/dist/esm/nylas-if-state.entry.js +2 -2
  240. package/dist/esm/nylas-limit-future-bookings.entry.js +3 -3
  241. package/dist/esm/nylas-limit-future-bookings.entry.js.map +1 -1
  242. package/dist/esm/nylas-list-configurations.entry.js +8 -6
  243. package/dist/esm/nylas-list-configurations.entry.js.map +1 -1
  244. package/dist/esm/nylas-list-folders.entry.js +2 -2
  245. package/dist/esm/nylas-list-threads.entry.js +2 -2
  246. package/dist/esm/nylas-locale-switch.entry.js +2 -2
  247. package/dist/esm/nylas-location-component.entry.js +3 -3
  248. package/dist/esm/nylas-location-component.entry.js.map +1 -1
  249. package/dist/esm/nylas-login.entry.js +2 -2
  250. package/dist/esm/nylas-mailbox-pagination.entry.js +2 -2
  251. package/dist/esm/nylas-mailbox-toolbar-button.entry.js +2 -2
  252. package/dist/esm/nylas-mailbox.entry.js +3 -3
  253. package/dist/esm/nylas-min-cancellation-notice.entry.js +3 -3
  254. package/dist/esm/nylas-min-cancellation-notice.entry.js.map +1 -1
  255. package/dist/esm/nylas-notification.entry.js +1 -1
  256. package/dist/esm/nylas-provider.entry.js +5 -5
  257. package/dist/esm/nylas-scheduler-editor.entry.js +8 -14
  258. package/dist/esm/nylas-scheduler-editor.entry.js.map +1 -1
  259. package/dist/esm/nylas-scheduling.entry.js +35 -12
  260. package/dist/esm/nylas-scheduling.entry.js.map +1 -1
  261. package/dist/esm/nylas-selected-event-card.entry.js +2 -2
  262. package/dist/esm/nylas-summarize-message-button.entry.js +2 -2
  263. package/dist/esm/nylas-threads-refresh.entry.js +2 -2
  264. package/dist/esm/nylas-threads-search.entry.js +2 -2
  265. package/dist/esm/nylas-time-window-picker.entry.js +1 -1
  266. package/dist/esm/nylas-timeslot-picker.entry.js +2 -2
  267. package/dist/esm/nylas-view-email.entry.js +1 -1
  268. package/dist/esm/nylas-view-thread.entry.js +2 -2
  269. package/dist/esm/nylas-web-elements.js +1 -1
  270. package/dist/{nylas-web-elements/register-component-e5afe237.js → esm/register-component-0462b27d.js} +2 -2
  271. package/dist/esm/{register-component-cf5c8420.js.map → register-component-0462b27d.js.map} +1 -1
  272. package/dist/esm/{register-component-cf5c8420.js → register-component-83e24412.js} +2 -2
  273. package/dist/esm/{register-component-e5afe237.js.map → register-component-83e24412.js.map} +1 -1
  274. package/dist/{nylas-web-elements/scheduler-config-store-8f2e658e.js → esm/scheduler-config-store-8ccc8dc7.js} +3 -4
  275. package/dist/esm/scheduler-config-store-8ccc8dc7.js.map +1 -0
  276. package/dist/esm/{scheduler-config-store-07d98279.js → scheduler-config-store-ec3b6190.js} +3 -4
  277. package/dist/esm/scheduler-config-store-ec3b6190.js.map +1 -0
  278. package/dist/esm/{scheduler-store-a175fc3e.js → scheduler-store-8ca9003d.js} +39 -7
  279. package/dist/esm/scheduler-store-8ca9003d.js.map +1 -0
  280. package/dist/esm/{scheduler-store-66c2168c.js → scheduler-store-e314bbe6.js} +39 -7
  281. package/dist/esm/scheduler-store-e314bbe6.js.map +1 -0
  282. package/dist/esm/time-period-selector.entry.js +1 -1
  283. package/dist/esm/{utils-73d8a928.js → utils-157014b4.js} +106 -3
  284. package/dist/esm/utils-157014b4.js.map +1 -0
  285. package/dist/esm/{utils-d6204242.js → utils-e6b73120.js} +106 -3
  286. package/dist/esm/utils-e6b73120.js.map +1 -0
  287. package/dist/nylas-web-elements/{index.es-2842f8c8.js → index.es-eb477d56.js} +3 -3
  288. package/dist/nylas-web-elements/index.es-eb477d56.js.map +1 -0
  289. package/dist/nylas-web-elements/index.esm.js +2 -2
  290. package/dist/{esm/mailbox-store-d48269de.js → nylas-web-elements/mailbox-store-9f819402.js} +3 -3
  291. package/dist/{esm/mailbox-store-d48269de.js.map → nylas-web-elements/mailbox-store-9f819402.js.map} +1 -1
  292. package/dist/nylas-web-elements/multi-select-dropdown.entry.js +1 -1
  293. package/dist/nylas-web-elements/nylas-additional-participants.entry.js +2 -2
  294. package/dist/{esm/nylas-api-request-b085294d.js → nylas-web-elements/nylas-api-request-ff2869d7.js} +2 -2
  295. package/dist/nylas-web-elements/{nylas-api-request-b085294d.js.map → nylas-api-request-ff2869d7.js.map} +1 -1
  296. package/dist/nylas-web-elements/nylas-availability-picker.entry.js +4 -3
  297. package/dist/nylas-web-elements/nylas-availability-picker.entry.js.map +1 -1
  298. package/dist/nylas-web-elements/nylas-booked-event-card.entry.js +21 -5
  299. package/dist/nylas-web-elements/nylas-booked-event-card.entry.js.map +1 -1
  300. package/dist/nylas-web-elements/nylas-booking-calendar-picker.entry.js +2 -2
  301. package/dist/nylas-web-elements/nylas-booking-form.entry.js +2 -2
  302. package/dist/nylas-web-elements/nylas-buffer-time.entry.js +4 -4
  303. package/dist/nylas-web-elements/nylas-buffer-time.entry.js.map +1 -1
  304. package/dist/nylas-web-elements/nylas-calendar-picker.entry.js +2 -2
  305. package/dist/nylas-web-elements/nylas-cancel-booking-form.entry.js +2 -2
  306. package/dist/nylas-web-elements/nylas-cancelled-event-card.entry.js +22 -5
  307. package/dist/nylas-web-elements/nylas-cancelled-event-card.entry.js.map +1 -1
  308. package/dist/nylas-web-elements/nylas-composer.entry.js +1 -1
  309. package/dist/nylas-web-elements/nylas-custom-booking-flow.entry.js +2 -2
  310. package/dist/nylas-web-elements/nylas-date-picker.entry.js +15 -3
  311. package/dist/nylas-web-elements/nylas-date-picker.entry.js.map +1 -1
  312. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +18 -12
  313. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js.map +1 -1
  314. package/dist/nylas-web-elements/nylas-event-description.entry.js +2 -2
  315. package/dist/nylas-web-elements/nylas-event-duration.entry.js +2 -2
  316. package/dist/nylas-web-elements/nylas-event-info.entry.js +3 -3
  317. package/dist/nylas-web-elements/nylas-event-info.entry.js.map +1 -1
  318. package/dist/nylas-web-elements/nylas-event-limits.entry.js +3 -3
  319. package/dist/nylas-web-elements/nylas-event-limits.entry.js.map +1 -1
  320. package/dist/nylas-web-elements/nylas-event-title.entry.js +22 -11
  321. package/dist/nylas-web-elements/nylas-event-title.entry.js.map +1 -1
  322. package/dist/nylas-web-elements/nylas-form-card.entry.js +2 -2
  323. package/dist/nylas-web-elements/nylas-if-state.entry.js +2 -2
  324. package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js +3 -3
  325. package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js.map +1 -1
  326. package/dist/nylas-web-elements/nylas-list-configurations.entry.js +8 -6
  327. package/dist/nylas-web-elements/nylas-list-configurations.entry.js.map +1 -1
  328. package/dist/nylas-web-elements/nylas-list-folders.entry.js +2 -2
  329. package/dist/nylas-web-elements/nylas-list-threads.entry.js +2 -2
  330. package/dist/nylas-web-elements/nylas-locale-switch.entry.js +2 -2
  331. package/dist/nylas-web-elements/nylas-location-component.entry.js +3 -3
  332. package/dist/nylas-web-elements/nylas-location-component.entry.js.map +1 -1
  333. package/dist/nylas-web-elements/nylas-login.entry.js +2 -2
  334. package/dist/nylas-web-elements/nylas-mailbox-pagination.entry.js +2 -2
  335. package/dist/nylas-web-elements/nylas-mailbox-toolbar-button.entry.js +2 -2
  336. package/dist/nylas-web-elements/nylas-mailbox.entry.js +3 -3
  337. package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js +3 -3
  338. package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js.map +1 -1
  339. package/dist/nylas-web-elements/nylas-notification.entry.js +1 -1
  340. package/dist/nylas-web-elements/nylas-provider.entry.js +5 -5
  341. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +8 -14
  342. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js.map +1 -1
  343. package/dist/nylas-web-elements/nylas-scheduling.entry.js +35 -12
  344. package/dist/nylas-web-elements/nylas-scheduling.entry.js.map +1 -1
  345. package/dist/nylas-web-elements/nylas-selected-event-card.entry.js +2 -2
  346. package/dist/nylas-web-elements/nylas-summarize-message-button.entry.js +2 -2
  347. package/dist/nylas-web-elements/nylas-threads-refresh.entry.js +2 -2
  348. package/dist/nylas-web-elements/nylas-threads-search.entry.js +2 -2
  349. package/dist/nylas-web-elements/nylas-time-window-picker.entry.js +1 -1
  350. package/dist/nylas-web-elements/nylas-timeslot-picker.entry.js +2 -2
  351. package/dist/nylas-web-elements/nylas-view-email.entry.js +1 -1
  352. package/dist/nylas-web-elements/nylas-view-thread.entry.js +2 -2
  353. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  354. package/dist/nylas-web-elements/{p-41dc0d93.js → p-01e86103.js} +2 -2
  355. package/dist/nylas-web-elements/p-01e86103.js.map +1 -0
  356. package/dist/nylas-web-elements/{p-ad64c2b8.entry.js → p-0d1caebd.entry.js} +2 -2
  357. package/dist/nylas-web-elements/{p-a628eaeb.js → p-0dabcb4d.js} +2 -2
  358. package/dist/nylas-web-elements/{p-42791515.entry.js → p-2b63efd8.entry.js} +2 -2
  359. package/dist/nylas-web-elements/p-30f17ef2.entry.js +2 -0
  360. package/dist/nylas-web-elements/p-30f17ef2.entry.js.map +1 -0
  361. package/dist/nylas-web-elements/{p-f154a362.entry.js → p-38675cc5.entry.js} +2 -2
  362. package/dist/nylas-web-elements/p-39aa2263.js +2 -0
  363. package/dist/nylas-web-elements/p-39aa2263.js.map +1 -0
  364. package/dist/nylas-web-elements/{p-cc674b3b.entry.js → p-44a0f658.entry.js} +3 -3
  365. package/dist/nylas-web-elements/{p-cc674b3b.entry.js.map → p-44a0f658.entry.js.map} +1 -1
  366. package/dist/nylas-web-elements/{p-75a8d077.entry.js → p-47fa06de.entry.js} +2 -2
  367. package/dist/nylas-web-elements/{p-df6d54c7.entry.js → p-48b205a2.entry.js} +2 -2
  368. package/dist/nylas-web-elements/{p-6110351b.entry.js → p-551871cb.entry.js} +2 -2
  369. package/dist/nylas-web-elements/{p-bbf9aff2.entry.js → p-61b25ea6.entry.js} +2 -2
  370. package/dist/nylas-web-elements/p-74492776.entry.js +2 -0
  371. package/dist/nylas-web-elements/p-74492776.entry.js.map +1 -0
  372. package/dist/nylas-web-elements/{p-1d25ca06.entry.js → p-75bc6ef8.entry.js} +2 -2
  373. package/dist/nylas-web-elements/p-76461af6.entry.js +2 -0
  374. package/dist/nylas-web-elements/p-76461af6.entry.js.map +1 -0
  375. package/dist/nylas-web-elements/{p-7c55dfa0.entry.js → p-78e7f732.entry.js} +2 -2
  376. package/dist/nylas-web-elements/{p-eaa9151b.js → p-8b53becf.js} +2 -2
  377. package/dist/nylas-web-elements/{p-e22aa0b0.js → p-8f88a748.js} +2 -2
  378. package/dist/nylas-web-elements/p-8ffc644d.entry.js +2 -0
  379. package/dist/nylas-web-elements/p-8ffc644d.entry.js.map +1 -0
  380. package/dist/nylas-web-elements/{p-665ef10b.entry.js → p-933c6d32.entry.js} +4 -4
  381. package/dist/nylas-web-elements/p-933c6d32.entry.js.map +1 -0
  382. package/dist/nylas-web-elements/{p-e03b2592.entry.js → p-a002b4cf.entry.js} +2 -2
  383. package/dist/nylas-web-elements/p-ab09a78d.js +2 -0
  384. package/dist/nylas-web-elements/p-ab09a78d.js.map +1 -0
  385. package/dist/nylas-web-elements/p-b1b3eb52.entry.js +2 -0
  386. package/dist/nylas-web-elements/p-b1b3eb52.entry.js.map +1 -0
  387. package/dist/nylas-web-elements/{p-f1f8f745.entry.js → p-b302fbb1.entry.js} +2 -2
  388. package/dist/nylas-web-elements/{p-80d6175c.entry.js → p-b77c316c.entry.js} +2 -2
  389. package/dist/nylas-web-elements/{p-33b940fb.entry.js → p-d3065401.entry.js} +2 -2
  390. package/dist/nylas-web-elements/{p-343b8684.entry.js → p-da732fb1.entry.js} +2 -2
  391. package/dist/nylas-web-elements/p-ee91a2a0.js +2 -0
  392. package/dist/nylas-web-elements/p-ee91a2a0.js.map +1 -0
  393. package/dist/{esm/register-component-e5afe237.js → nylas-web-elements/register-component-0462b27d.js} +2 -2
  394. package/dist/nylas-web-elements/{register-component-e5afe237.js.map → register-component-0462b27d.js.map} +1 -1
  395. package/dist/{esm/scheduler-config-store-8f2e658e.js → nylas-web-elements/scheduler-config-store-8ccc8dc7.js} +3 -4
  396. package/dist/nylas-web-elements/scheduler-config-store-8ccc8dc7.js.map +1 -0
  397. package/dist/nylas-web-elements/{scheduler-store-66c2168c.js → scheduler-store-e314bbe6.js} +39 -7
  398. package/dist/nylas-web-elements/scheduler-store-e314bbe6.js.map +1 -0
  399. package/dist/nylas-web-elements/time-period-selector.entry.js +1 -1
  400. package/dist/nylas-web-elements/{utils-73d8a928.js → utils-157014b4.js} +106 -3
  401. package/dist/nylas-web-elements/utils-157014b4.js.map +1 -0
  402. package/dist/types/common/types.d.ts +10 -0
  403. package/dist/types/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.d.ts +8 -1
  404. package/dist/types/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.d.ts +8 -2
  405. package/dist/types/components/scheduler/nylas-date-picker/nylas-date-picker.d.ts +3 -0
  406. package/dist/types/components/scheduler/nylas-scheduler/nylas-scheduling.d.ts +2 -0
  407. package/dist/types/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.d.ts +1 -1
  408. package/dist/types/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.d.ts +2 -1
  409. package/dist/types/components/scheduler-editor/nylas-event-title/nylas-event-title.d.ts +1 -0
  410. package/dist/types/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.d.ts +1 -2
  411. package/dist/types/components.d.ts +87 -16
  412. package/dist/types/connector/shared/api/scheduler.d.ts +4 -1
  413. package/dist/types/stores/scheduler-config-store.d.ts +0 -1
  414. package/dist/types/stores/scheduler-store.d.ts +11 -0
  415. package/dist/types/utils/utils.d.ts +5 -0
  416. package/package.json +3 -3
  417. package/dist/cjs/add-circle-icon_22.cjs.entry.js.map +0 -1
  418. package/dist/cjs/index.es-0a0f2d87.js.map +0 -1
  419. package/dist/cjs/index.es-b12b7df1.js.map +0 -1
  420. package/dist/cjs/scheduler-config-store-37690bf0.js.map +0 -1
  421. package/dist/cjs/scheduler-config-store-529c8d7e.js.map +0 -1
  422. package/dist/cjs/scheduler-store-0081970d.js.map +0 -1
  423. package/dist/cjs/scheduler-store-67dc1986.js.map +0 -1
  424. package/dist/cjs/utils-20663d54.js.map +0 -1
  425. package/dist/cjs/utils-2c7f0895.js.map +0 -1
  426. package/dist/components/nylas-custom-booking-flow2.js +0 -174
  427. package/dist/components/nylas-custom-booking-flow2.js.map +0 -1
  428. package/dist/esm/add-circle-icon_22.entry.js.map +0 -1
  429. package/dist/esm/index.es-2842f8c8.js.map +0 -1
  430. package/dist/esm/index.es-f57e612a.js.map +0 -1
  431. package/dist/esm/scheduler-config-store-07d98279.js.map +0 -1
  432. package/dist/esm/scheduler-config-store-8f2e658e.js.map +0 -1
  433. package/dist/esm/scheduler-store-66c2168c.js.map +0 -1
  434. package/dist/esm/scheduler-store-a175fc3e.js.map +0 -1
  435. package/dist/esm/utils-73d8a928.js.map +0 -1
  436. package/dist/esm/utils-d6204242.js.map +0 -1
  437. package/dist/nylas-web-elements/index.es-2842f8c8.js.map +0 -1
  438. package/dist/nylas-web-elements/p-1a91cce5.entry.js +0 -2
  439. package/dist/nylas-web-elements/p-1a91cce5.entry.js.map +0 -1
  440. package/dist/nylas-web-elements/p-22e5436c.js +0 -2
  441. package/dist/nylas-web-elements/p-22e5436c.js.map +0 -1
  442. package/dist/nylas-web-elements/p-2b636359.entry.js +0 -2
  443. package/dist/nylas-web-elements/p-2b636359.entry.js.map +0 -1
  444. package/dist/nylas-web-elements/p-30784693.entry.js +0 -2
  445. package/dist/nylas-web-elements/p-30784693.entry.js.map +0 -1
  446. package/dist/nylas-web-elements/p-3909ec3f.entry.js +0 -2
  447. package/dist/nylas-web-elements/p-3909ec3f.entry.js.map +0 -1
  448. package/dist/nylas-web-elements/p-41dc0d93.js.map +0 -1
  449. package/dist/nylas-web-elements/p-665ef10b.entry.js.map +0 -1
  450. package/dist/nylas-web-elements/p-9ea458c3.js +0 -2
  451. package/dist/nylas-web-elements/p-9ea458c3.js.map +0 -1
  452. package/dist/nylas-web-elements/p-db15d382.js +0 -2
  453. package/dist/nylas-web-elements/p-db15d382.js.map +0 -1
  454. package/dist/nylas-web-elements/scheduler-config-store-8f2e658e.js.map +0 -1
  455. package/dist/nylas-web-elements/scheduler-store-66c2168c.js.map +0 -1
  456. package/dist/nylas-web-elements/utils-73d8a928.js.map +0 -1
  457. /package/dist/nylas-web-elements/{p-ad64c2b8.entry.js.map → p-0d1caebd.entry.js.map} +0 -0
  458. /package/dist/nylas-web-elements/{p-a628eaeb.js.map → p-0dabcb4d.js.map} +0 -0
  459. /package/dist/nylas-web-elements/{p-42791515.entry.js.map → p-2b63efd8.entry.js.map} +0 -0
  460. /package/dist/nylas-web-elements/{p-f154a362.entry.js.map → p-38675cc5.entry.js.map} +0 -0
  461. /package/dist/nylas-web-elements/{p-75a8d077.entry.js.map → p-47fa06de.entry.js.map} +0 -0
  462. /package/dist/nylas-web-elements/{p-df6d54c7.entry.js.map → p-48b205a2.entry.js.map} +0 -0
  463. /package/dist/nylas-web-elements/{p-6110351b.entry.js.map → p-551871cb.entry.js.map} +0 -0
  464. /package/dist/nylas-web-elements/{p-bbf9aff2.entry.js.map → p-61b25ea6.entry.js.map} +0 -0
  465. /package/dist/nylas-web-elements/{p-1d25ca06.entry.js.map → p-75bc6ef8.entry.js.map} +0 -0
  466. /package/dist/nylas-web-elements/{p-7c55dfa0.entry.js.map → p-78e7f732.entry.js.map} +0 -0
  467. /package/dist/nylas-web-elements/{p-eaa9151b.js.map → p-8b53becf.js.map} +0 -0
  468. /package/dist/nylas-web-elements/{p-e22aa0b0.js.map → p-8f88a748.js.map} +0 -0
  469. /package/dist/nylas-web-elements/{p-e03b2592.entry.js.map → p-a002b4cf.entry.js.map} +0 -0
  470. /package/dist/nylas-web-elements/{p-f1f8f745.entry.js.map → p-b302fbb1.entry.js.map} +0 -0
  471. /package/dist/nylas-web-elements/{p-80d6175c.entry.js.map → p-b77c316c.entry.js.map} +0 -0
  472. /package/dist/nylas-web-elements/{p-33b940fb.entry.js.map → p-d3065401.entry.js.map} +0 -0
  473. /package/dist/nylas-web-elements/{p-343b8684.entry.js.map → p-da732fb1.entry.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"file":"scheduler-config-store-8ccc8dc7.js","mappings":";;SA0CgB,+BAA+B,CAAC,eAAwD,EAAE;IACxG,MAAM,2BAA2B,GAAmC;QAClE,qBAAqB,EAAE,EAAE;QACzB,cAAc,EAAE,EAAE;QAClB,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,IAAI;QACZ,GAAG,YAAY;KAChB,CAAC;IACF,MAAM,KAAK,GAAG,WAAW,CAAiC,2BAA2B,CAAC,CAAC;IAMvF,SAAS,0BAA0B;QACjC,KAAK,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,GAAG,YAAY,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;KAClF;IAED,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAM,MAAM;QACnC,IAAI,CAAC,MAAM,EAAE;YACX,0BAA0B,EAAE,CAAC;SAC9B;KACF,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,KAAK;QACR,0BAA0B;KAC3B,CAAC;AACJ;;;;","names":[],"sources":["src/stores/scheduler-config-store.ts"],"sourcesContent":["import { Calendar, Configuration } from '@nylas/core';\nimport { ObservableMap, createStore } from '@stencil/store';\nimport { User } from '@/common/nylas-api-request';\n\nexport interface NylasSchedulerConfigStoreState {\n /**\n * The selected configuration.\n * This is the configuration that is currently selected, use it to populate default values for new configurations.\n */\n selectedConfiguration: Partial<Configuration>;\n /**\n * The list of configurations.\n * This is the list of configurations that the user has created.\n */\n configurations: Configuration[];\n /**\n * The list of calendars.\n * This is the list of calendars that the user has access to.\n */\n calendars: Calendar[];\n /**\n * The current user.\n * This is the user that is currently logged in.\n */\n currentUser: User | null;\n /**\n * The current action.\n * This is the current action that the user is performing.\n */\n action: 'create' | 'edit' | null;\n}\n\nexport type NylasSchedulerConfigStoreType = ReturnType<typeof CreateNylasSchedulerConfigStore>;\n\nexport type CreateNylasSchedulerConfigStoreReturnType = ObservableMap<NylasSchedulerConfigStoreState> & {\n /**\n * Reset the selected configuration to the default state.\n * This is used to reset the selected configuration to the default state instead of setting it to an empty object.\n */\n resetSelectedConfiguration: () => void;\n};\n\nexport function CreateNylasSchedulerConfigStore(defaultState: Partial<NylasSchedulerConfigStoreState> = {}): CreateNylasSchedulerConfigStoreReturnType {\n const defaultSchedulerConfigState: NylasSchedulerConfigStoreState = {\n selectedConfiguration: {},\n configurations: [],\n calendars: [],\n currentUser: null,\n action: null,\n ...defaultState,\n };\n const store = createStore<NylasSchedulerConfigStoreState>(defaultSchedulerConfigState);\n\n /**\n * Reset the selected configuration to the default state.\n * This is used to reset the selected configuration to the default state instead of setting it to an empty object.\n */\n function resetSelectedConfiguration() {\n store.set('selectedConfiguration', { ...defaultState['selectedConfiguration'] });\n }\n\n store.onChange('action', async action => {\n if (!action) {\n resetSelectedConfiguration();\n }\n });\n\n return {\n ...store,\n resetSelectedConfiguration,\n };\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { a as debug } from './utils-73d8a928.js';
1
+ import { a as debug } from './utils-157014b4.js';
2
2
  import { c as createStore } from './index-11d12497.js';
3
3
 
4
4
  var ErrorCategory;
@@ -157,6 +157,7 @@ class NylaSchedulerAPIConnector {
157
157
  method,
158
158
  headers: {
159
159
  'Content-Type': 'application/json',
160
+ 'Origin': window.location.origin,
160
161
  ...headers,
161
162
  },
162
163
  body,
@@ -207,12 +208,8 @@ class NylaSchedulerAPIConnector {
207
208
  },
208
209
  });
209
210
  }
210
- async setReschedule(bookingID) {
211
+ async resetStoreStateAndFetchAvailability() {
211
212
  const today = new Date();
212
- this.schedulerStore.set('rescheduleBookingId', bookingID);
213
- this.schedulerStore.set('selectedTimeslot', null);
214
- this.schedulerStore.set('eventInfo', null);
215
- this.schedulerStore.set('showBookingForm', false);
216
213
  const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;
217
214
  const endTime = new Date(today.getFullYear(), today.getMonth() + 1, 1).getTime() / 1000;
218
215
  const result = await this.getAvailability(startTime, endTime);
@@ -222,11 +219,25 @@ class NylaSchedulerAPIConnector {
222
219
  _selectedDate = firstAvailableDate.start_time;
223
220
  }
224
221
  this.schedulerStore.set('selectedDate', _selectedDate);
222
+ this.schedulerStore.set('eventInfo', null);
223
+ this.schedulerStore.set('showBookingForm', false);
224
+ this.schedulerStore.set('selectedTimeslot', null);
225
+ return result;
226
+ }
227
+ async setReschedule(bookingID) {
228
+ const result = await this.resetStoreStateAndFetchAvailability();
229
+ this.schedulerStore.set('rescheduleBookingId', bookingID);
225
230
  return result;
226
231
  }
227
232
  async setCancel(bookingID) {
228
233
  this.schedulerStore.set('cancelBookingId', bookingID);
229
234
  }
235
+ async resetCancel() {
236
+ const result = await this.resetStoreStateAndFetchAvailability();
237
+ this.schedulerStore.set('cancelBookingId', '');
238
+ this.schedulerStore.set('cancelledEventInfo', null);
239
+ return result;
240
+ }
230
241
  async bookTimeslot(data) {
231
242
  this.schedulerStore.set('isLoading', true);
232
243
  const { selectedTimeslot, selectedTimezone, bookingInfo } = this.schedulerStore.state;
@@ -269,6 +280,27 @@ class NylaSchedulerAPIConnector {
269
280
  this.schedulerStore.set('isLoading', false);
270
281
  return response;
271
282
  }
283
+ async getUISettings() {
284
+ this.schedulerStore.set('isLoading', true);
285
+ const headers = this.getHeaders();
286
+ const configIdParam = this.configId ? `?configuration_id=${this.configId}` : '';
287
+ const url = `/v3/scheduling/ui-settings${configIdParam}`;
288
+ const response = await this.makeAPIRequest(url, 'GET', undefined, headers);
289
+ if ('error' in response) {
290
+ this.schedulerStore.set('isLoading', false);
291
+ const errorType = response.error?.type;
292
+ let error = response.error;
293
+ if (errorType && errorType in this.errors.api('Get UI Settings')) {
294
+ error = this.errors.api('Get UI Settings')[errorType](error?.message || error?.title || 'Something went wrong');
295
+ }
296
+ return { error };
297
+ }
298
+ if ('data' in response) {
299
+ this.schedulerStore.set('configSettings', response.data);
300
+ }
301
+ this.schedulerStore.set('isLoading', false);
302
+ return response;
303
+ }
272
304
  async getAvailability(startTime = 0, endTime = 0) {
273
305
  this.schedulerStore.set('isLoading', true);
274
306
  const params = new URLSearchParams();
@@ -430,4 +462,4 @@ function CreateNylasSchedulerStore(defaultState = {}) {
430
462
 
431
463
  export { CreateNylasSchedulerStore as C, ErrorCategory as E, NylaSchedulerAPIConnector as N };
432
464
 
433
- //# sourceMappingURL=scheduler-store-66c2168c.js.map
465
+ //# sourceMappingURL=scheduler-store-e314bbe6.js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QACrB,YAAY,EAAE,EAAE;QAChB,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,IAAI;QACf,kBAAkB,EAAE,IAAI;QACxB,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;QACnB,GAAG,YAAY;KAChB,CAAC;IACF,KAAK,CAAC,4BAA4B,EAAE,sBAAsB,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,WAAW,CAA2B,sBAAsB,CAAC,CAAC;IAE5E,KAAK,CAAC,QAAQ,CAAC,cAAc,EAAE,YAAY;QACzC,KAAK,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QACxC,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC1E,KAAK,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;KAC/C,CAAC,CAAC;IAOH,KAAK,CAAC,KAAK,GAAG;QACZ,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE;YACxC,MAAM,KAAK,GAAG,sBAAsB,CAAC,GAA0C,CAAC,CAAC;YACjF,KAAK,CAAC,GAAG,CAAC,GAAU,EAAE,KAAK,CAAC,CAAC;SAC9B;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf;;;;","names":[],"sources":["src/connector/nylas-scheduler-connector/errors/index.ts","src/connector/shared/api/scheduler.ts","src/stores/scheduler-store.ts"],"sourcesContent":["export enum ErrorCategory {\n Component = 'component',\n Api = 'api',\n Auth = 'auth',\n}\n\nexport interface ErrorDetails {\n title: string;\n message: string;\n category: ErrorCategory;\n}\n\nexport enum ComponentErrorType {\n endtime_not_in_future = 'endtime_not_in_future',\n no_booking_info = 'no_booking_info',\n no_timeslot_selected = 'no_timeslot_selected',\n no_timezone_selected = 'no_timezone_selected',\n no_booking_id = 'no_booking_id',\n invalid_start_time = 'invalid_start_time',\n invalid_end_time = 'invalid_end_time',\n invalid_timezone = 'invalid_timezone',\n}\n\nexport enum APIErrorType {\n invalid_session = 'invalid_session',\n general_error = 'general_error',\n internal_error = 'internal_error',\n invalid_request_error = 'invalid_request_error',\n timeslot_not_available = 'timeslot_not_available',\n}\n\nexport class Errors {\n component = (_title: string): Record<ComponentErrorType, (message?: string) => ErrorDetails> => {\n const category = ErrorCategory.Component;\n const title = `${_title} error`;\n return {\n endtime_not_in_future: (message: string = '\"endtime\" can not be in the future') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_info: (message: string = 'No booking info provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timeslot_selected: (message: string = 'No timeslot selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timezone_selected: (message: string = 'No timezone selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_id: (message: string = 'No booking id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_start_time: (message: string = 'Invalid start time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_end_time: (message: string = 'Invalid end time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_timezone: (message: string = 'Invalid timezone') => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n\n api = (_title: string): Record<APIErrorType, (message: string) => ErrorDetails> => {\n const category = ErrorCategory.Api;\n const title = `${_title} error`;\n\n return {\n invalid_session: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n general_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n internal_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_request_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n timeslot_not_available: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n}\n","import { AvailabilityResponse, NylasEvent, UISettingsResponse } from '@/common/types';\nimport { NylasSchedulerStoreType } from '../../../components';\nimport type { NylasErrorResponse, NylasResponse, NylasSchedulerBookingData, NylasSchedulerResponse, Timeslot } from '@nylas/core';\nimport { APIErrorType, Errors } from '@/connector/nylas-scheduler-connector/errors';\n\ntype NylasSchedulerAPIConnectorOptions = {\n schedulerAPIURL: string;\n schedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n};\n\n/**\n * NylaSchedulerConnector\n * This class is used to make API requests to the scheduler.\n */\nexport class NylaSchedulerAPIConnector {\n private schedulerStore: NylasSchedulerStoreType;\n private schedulerAPIURL: string;\n private sessionId: string | undefined;\n private configId: string | undefined;\n private errors = new Errors();\n\n constructor({ schedulerAPIURL, schedulerStore, sessionId, configId }: NylasSchedulerAPIConnectorOptions) {\n this.schedulerStore = schedulerStore;\n this.schedulerAPIURL = schedulerAPIURL;\n this.sessionId = sessionId;\n this.configId = configId;\n }\n\n private getHeaders() {\n return !this.configId\n ? {\n Authorization: `Bearer ${this.sessionId}`,\n }\n : {};\n }\n\n /**\n * Makes an API request to the scheduler.\n * @param path The path to the API endpoint.\n * @param method The HTTP method.\n * @param body The request body (if any).\n * @returns {Promise<T>}\n */\n public async makeAPIRequest<T>(path: string, method: string, body: string | undefined, headers = {}): Promise<NylasResponse<T>> {\n try {\n const schedulerURL = new URL(this.schedulerAPIURL);\n schedulerURL.pathname = path;\n const response = await fetch(decodeURIComponent(schedulerURL.toString()), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Origin': window.location.origin,\n ...headers,\n },\n body,\n });\n // The server returns a json object for errors: eg.\n // {\n // \"request_id\": \"<request_id>\",\n // \"error\": {\n // \"type\": \"not_found_error\",\n // \"message\": \"Session not found\"\n // }\n // }\n const data = await response.json();\n return data as NylasResponse<T>;\n } catch (error: any) {\n // NOTE: current server implementation doesn't return a JSON object for errors on some endpoints\n // handle this case by returning the error response as a string to be handled downstream\n return {\n error: {\n message: error.message,\n title: 'API request failed',\n type: 'api',\n },\n } as NylasErrorResponse;\n }\n }\n\n /**\n * Selects a date in the scheduler.\n */\n public selectDate(date: Date) {\n this.schedulerStore.set('selectedDate', date);\n this.schedulerStore.set('selectedTimeslot', null);\n }\n\n /**\n * Selects a time in the scheduler.\n */\n public selectTime(time: Timeslot) {\n this.schedulerStore.set('selectedTimeslot', time);\n }\n\n /**\n * Sets the timezone in the scheduler.\n */\n public selectTimezone(timezone: string) {\n this.schedulerStore.set('selectedTimezone', timezone);\n }\n\n /**\n * Toggles showBookingForm\n * @param value boolean\n */\n public toggleAdditionalData(value: boolean) {\n this.schedulerStore.set('showBookingForm', value);\n }\n\n /**\n * Set/update the name of the participant booking the event.\n */\n public setParticipantName(name: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n name,\n },\n });\n }\n\n /**\n * Set/update the email of the participant booking the event.\n */\n public setParticipantEmail(email: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n email,\n },\n });\n }\n\n private async resetStoreStateAndFetchAvailability() {\n const today = new Date();\n // Refetch availability\n const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;\n const endTime = new Date(today.getFullYear(), today.getMonth() + 1, 1).getTime() / 1000;\n const result = await this.getAvailability(startTime, endTime);\n // Set selected date to first available date\n const firstAvailableDate = this.schedulerStore.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n let _selectedDate = today;\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n this.schedulerStore.set('selectedDate', _selectedDate);\n // Reset store state\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\n this.schedulerStore.set('selectedTimeslot', null);\n\n return result;\n }\n\n /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n // Set reschedule booking id\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n return result;\n }\n\n /**\n * Set cancel booking id\n */\n public async setCancel(bookingID: string) {\n this.schedulerStore.set('cancelBookingId', bookingID);\n }\n\n public async resetCancel() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('cancelBookingId', '');\n this.schedulerStore.set('cancelledEventInfo', null);\n return result;\n }\n\n /**\n * Book the selected timeslot.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async bookTimeslot(data?: NylasSchedulerBookingData & { timeslot?: Timeslot }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { selectedTimeslot, selectedTimezone, bookingInfo } = this.schedulerStore.state;\n if (!data && !bookingInfo) {\n return { error: this.errors.component('Booking').no_booking_info() };\n }\n\n const timeslot = data?.timeslot || selectedTimeslot;\n if (!timeslot) {\n return { error: this.errors.component('Create Booking').no_timeslot_selected() };\n }\n\n const timezone = data && data?.timezone ? data?.timezone : selectedTimezone;\n\n if (!timezone) {\n return { error: this.errors.component('Create Booking').no_timezone_selected() };\n }\n\n const primaryParticipant = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? { ...data?.additionalFields, guests } : { ...bookingInfo?.additionalFields, guests };\n\n const headers = this.getHeaders();\n const configIdParam = this.configId ? `?configuration_id=${this.configId}` : '';\n const url = `/v3/scheduling/bookings${configIdParam}`;\n\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n additional_fields,\n guest: { ...primaryParticipant },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone: timezone,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api('Create Booking')) {\n error = this.errors.api('Create Booking')[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Get UI settings for the scheduler.\n */\n public async getUISettings(): Promise<NylasSchedulerResponse<UISettingsResponse>> {\n this.schedulerStore.set('isLoading', true);\n const headers = this.getHeaders();\n const configIdParam = this.configId ? `?configuration_id=${this.configId}` : '';\n const url = `/v3/scheduling/ui-settings${configIdParam}`;\n\n const response = await this.makeAPIRequest<UISettingsResponse>(url, 'GET', undefined, headers);\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api('Get UI Settings')) {\n error = this.errors.api('Get UI Settings')[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n if ('data' in response) {\n this.schedulerStore.set('configSettings', response.data);\n }\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Gets the availability for a page.\n * @param startTime The start time.\n * @param endTime The end time.\n * @returns {Promise<AvailabilityResponse>}\n */\n public async getAvailability(startTime: number = 0, endTime: number = 0): Promise<NylasSchedulerResponse<AvailabilityResponse>> {\n this.schedulerStore.set('isLoading', true);\n const params = new URLSearchParams();\n const now = new Date();\n const nowTime = now.getTime();\n\n if (endTime && endTime < nowTime / 1000) {\n this.schedulerStore.set('isLoading', false);\n const error = this.errors.component('Get Availability').endtime_not_in_future();\n return { error };\n }\n\n // Calculate the start of the current month if startTime is not provided\n if (!startTime) {\n const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);\n startTime = Math.floor(startOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n // Calculate the end of the current month if endTime is not provided\n if (!endTime) {\n const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0); // Setting day to 0 gets the last day of the previous month, so in this case, the last day of the current month\n endTime = Math.floor(endOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n params.append('start_time', encodeURIComponent(startTime.toString()));\n params.append('end_time', encodeURIComponent(endTime.toString()));\n if (this.configId) {\n params.append('configuration_id', encodeURIComponent(this.configId));\n }\n const queryString = params.toString();\n const url = `/v3/scheduling/availability${queryString ? `?${queryString}` : ''}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<AvailabilityResponse>(decodeURIComponent(url), 'GET', undefined, headers);\n\n if ('error' in response) {\n this.schedulerStore.set('availability', []);\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api('Get Availability')) {\n error = this.errors.api('Get Availability')[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n\n if ('data' in response) {\n const availability =\n response.data?.time_slots?.map(timeslot => {\n return {\n ...timeslot,\n start_time: new Date(timeslot.start_time * 1000),\n end_time: new Date(timeslot.end_time * 1000),\n };\n }) || [];\n\n // Filter out timeslots that are in the past\n const availabilityTimeslotsFiltered = availability.filter(timeslot => timeslot.start_time.getTime() > nowTime);\n this.schedulerStore.set('availability', availabilityTimeslotsFiltered);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Cancels a booking.\n * @param bookingId The booking ID.\n */\n public async cancelBooking(bookingId: string): Promise<NylasSchedulerResponse<Partial<NylasEvent>>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component('Cancel Booking').no_booking_id() };\n }\n const configIdParam = this.configId ? `?configuration_id=${this.configId}` : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<Partial<NylasEvent>>(\n decodeURIComponent(url),\n 'DELETE',\n JSON.stringify({\n action: 'cancel',\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api('Cancel Booking')) {\n error = this.errors.api('Cancel Booking')[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Reschedules a booking.\n * @param bookingId The booking ID.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async rescheduleBooking(bookingId: string, data: NylasSchedulerBookingData): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component('Reschedule Booking').no_booking_id() };\n }\n const apiErrors = this.errors.api('Reschedule Booking');\n const componentErrors = this.errors.component('Reschedule Booking');\n const { bookingInfo, selectedTimeslot, selectedTimezone } = this.schedulerStore.state;\n // Validate data\n const { startTime, endTime, timezone } = data;\n const start_time = startTime || selectedTimeslot?.start_time;\n\n if (!start_time) {\n return { error: componentErrors.invalid_start_time('Please pass \"startTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n const end_time = endTime || selectedTimeslot?.end_time;\n if (!end_time) {\n return { error: componentErrors.invalid_end_time('Please pass \"endTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n const time_zone = timezone || selectedTimezone;\n if (!time_zone) {\n return { error: componentErrors.invalid_timezone('Please pass \"timezone\" in data or set \"selectedTimezone\" in the defaultSchedulerState.') };\n }\n\n const primaryParticipant = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? { ...data?.additionalFields, guests } : { ...bookingInfo?.additionalFields, guests };\n\n const configIdParam = this.configId ? `?configuration_id=${this.configId}` : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PATCH',\n JSON.stringify({\n start_time: start_time.getTime() / 1000,\n end_time: end_time.getTime() / 1000,\n time_zone,\n additional_fields,\n guest: { ...primaryParticipant },\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in apiErrors) {\n error = apiErrors[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n }\n\n if ('data' in response) this.schedulerStore.set('eventInfo', response?.data);\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n}\n","import { DataState, NylasEvent } from '@/common/types';\nimport { debug } from '@/utils/utils';\nimport { NylasSchedulerBookingData, Timeslot } from '@nylas/core';\nimport { createStore } from '@stencil/store';\n\nexport type AvailabilityTimeslot = {\n emails: string[];\n start_time: Date;\n end_time: Date;\n};\n\nexport type LoadingState = {\n api: 'availability' | 'createBooking' | 'cancelBooking' | 'rescheduleBooking';\n};\n\nexport type ConfigSettings = {\n scheduler: {\n available_days_in_future: number;\n min_cancellation_notice: number;\n };\n organizer: {\n name: string;\n email: string;\n };\n};\n\nexport interface NylasSchedulerStoreState {\n selectedDate: Date | null;\n selectedLanguage: string;\n selectedTimezone: string;\n selectedTimeslot: Timeslot | null;\n showBookingForm: boolean;\n selectableDates: Date[] | null;\n availability: AvailabilityTimeslot[];\n state: DataState;\n eventInfo: NylasEvent | null;\n cancelledEventInfo: Partial<NylasEvent> | null;\n bookingInfo?: NylasSchedulerBookingData;\n rescheduleBookingId?: string;\n cancelBookingId?: string;\n isLoading: boolean;\n nylasBranding?: boolean;\n configSettings?: ConfigSettings;\n}\n\nexport type NylasSchedulerStoreType = ReturnType<typeof CreateNylasSchedulerStore>;\n\nexport function CreateNylasSchedulerStore(defaultState: Partial<NylasSchedulerStoreState> = {}) {\n const defaultNylasStoreState: NylasSchedulerStoreState = {\n selectedDate: null,\n selectedLanguage: navigator.language,\n selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n selectedTimeslot: null,\n showBookingForm: false,\n selectableDates: null,\n availability: [],\n state: 'ready',\n eventInfo: null,\n cancelledEventInfo: null,\n isLoading: false,\n nylasBranding: true,\n ...defaultState,\n };\n debug(`[defaultNylasStoreState]: `, defaultNylasStoreState);\n const store = createStore<NylasSchedulerStoreState>(defaultNylasStoreState);\n\n store.onChange('availability', availability => {\n debug(`[availability]: `, availability);\n const selectableDates = availability.map(timeslot => timeslot.start_time);\n debug(`[selectableDates]: `, selectableDates);\n store.set('selectableDates', selectableDates);\n });\n\n /**\n * Reset the Nylas store to its default state.\n * There is something wrong with the stencil/store reset method,\n * so we have to do it via this hack.\n */\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n"],"version":3}
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as getElement } from './index-8362ce5c.js';
2
- import { a as debug } from './utils-73d8a928.js';
2
+ import { a as debug } from './utils-157014b4.js';
3
3
  import './_commonjsHelpers-7c16df4a.js';
4
4
 
5
5
  const timePeriodSelectorCss = ".time-period-selector.sc-time-period-selector{display:flex;gap:0.5rem}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){min-width:108px}.time-period-selector.sc-time-period-selector select-dropdown#time-number.sc-time-period-selector::part(sd_dropdown-button){min-width:84px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}";
@@ -3733,7 +3733,9 @@ function removeUndefined(obj) {
3733
3733
  }
3734
3734
  function debug(...args) {
3735
3735
  if (window && window.localStorage && window.localStorage.getItem('debug')) {
3736
- console.debug(...args);
3736
+ console.group(...args);
3737
+ console.trace();
3738
+ console.groupEnd();
3737
3739
  }
3738
3740
  }
3739
3741
  function error(...args) {
@@ -4025,7 +4027,108 @@ function parsePreviewLink(link, config) {
4025
4027
  });
4026
4028
  return link;
4027
4029
  }
4030
+ function isNonPrintableKey(event) {
4031
+ if (event.keyCode < 48 ||
4032
+ (event.keyCode > 90 && event.keyCode < 96) ||
4033
+ (event.keyCode > 111 && event.keyCode < 186) ||
4034
+ event.keyCode > 222 ||
4035
+ event.keyCode === 32 ||
4036
+ event.keyCode === 91 ||
4037
+ event.keyCode === 92 ||
4038
+ event.keyCode === 93 ||
4039
+ (event.keyCode >= 112 && event.keyCode <= 123) ||
4040
+ (event.keyCode >= 37 && event.keyCode <= 40)) {
4041
+ return true;
4042
+ }
4043
+ if (event.ctrlKey || event.altKey || event.metaKey) {
4044
+ return true;
4045
+ }
4046
+ const shiftSpecialChars = [
4047
+ 48,
4048
+ 49,
4049
+ 50,
4050
+ 51,
4051
+ 52,
4052
+ 53,
4053
+ 54,
4054
+ 55,
4055
+ 56,
4056
+ 57,
4057
+ 186,
4058
+ 187,
4059
+ 188,
4060
+ 189,
4061
+ 190,
4062
+ 191,
4063
+ 192,
4064
+ 219,
4065
+ 220,
4066
+ 221,
4067
+ 222,
4068
+ ];
4069
+ if (event.shiftKey && shiftSpecialChars.includes(event.keyCode)) {
4070
+ return false;
4071
+ }
4072
+ return false;
4073
+ }
4074
+ function addDaysToCurrentDate(startDate, days) {
4075
+ const currentDate = new Date(startDate);
4076
+ currentDate.setDate(currentDate.getDate() + days);
4077
+ currentDate.setHours(23);
4078
+ currentDate.setMinutes(59);
4079
+ currentDate.setSeconds(0);
4080
+ currentDate.setMilliseconds(0);
4081
+ return currentDate;
4082
+ }
4083
+ function addMinutesToCurrentTime(startDate, minutes) {
4084
+ const currentDate = new Date(startDate);
4085
+ currentDate.setMinutes(currentDate.getMinutes() + minutes);
4086
+ return currentDate;
4087
+ }
4088
+ function isObject(item) {
4089
+ return item && typeof item === 'object' && !Array.isArray(item);
4090
+ }
4091
+ function mergeDeep(target, source) {
4092
+ if (Array.isArray(target) && Array.isArray(source) && target !== source) {
4093
+ if (target.some(item => item.is_organizer) && source.some(item => item.is_organizer)) {
4094
+ target = target.map(participant => ({ ...participant, is_organizer: false }));
4095
+ }
4096
+ else if (!source.some(item => item.is_organizer)) {
4097
+ let foundOrganizer = false;
4098
+ target = target.map(participant => {
4099
+ if (!foundOrganizer) {
4100
+ foundOrganizer = true;
4101
+ return { ...participant, is_organizer: true };
4102
+ }
4103
+ return participant;
4104
+ });
4105
+ }
4106
+ return target
4107
+ .map((item, index) => {
4108
+ return source[index] ? mergeDeep(item, source[index]) : item;
4109
+ })
4110
+ .concat(source.slice(target.length));
4111
+ }
4112
+ else if (isObject(target) && isObject(source)) {
4113
+ const output = Object.assign({}, target);
4114
+ Object.keys(source).forEach(key => {
4115
+ if (isObject(source[key])) {
4116
+ if (!(key in target)) {
4117
+ output[key] = source[key];
4118
+ }
4119
+ else {
4120
+ output[key] = mergeDeep(target[key], source[key]);
4121
+ }
4122
+ }
4123
+ else {
4124
+ output[key] = source[key];
4125
+ }
4126
+ });
4127
+ return output;
4128
+ }
4129
+ return source;
4130
+ }
4028
4131
 
4029
- export { autocompleteTimeFormat as A, validateTimeFormatInput as B, roundToNearest15Minutes as C, validateExactTimeFormat as D, debug as a, formatParticipants as b, formatDateTime as c, dataResponse as d, error as e, formatFolderName as f, formatEventName as g, formatTimeAgo as h, formatRecipient as i, getLastDayOfMonth as j, getFirstDayOfMonth as k, isSameDay as l, isSameMonth as m, htmlToPlainText as n, detectIfMessageIsHTML as o, parsePreviewLink as p, detectHTMLOrPlainText as q, parsePlainTextToHTML as r, timeToMinutes as s, toTitleCase as t, uniqueID as u, convertTo12HourFormat as v, minutesToTime as w, convertTo24HourFormat as x, getBrowser as y, dayjs as z };
4132
+ export { convertTo24HourFormat as A, getBrowser as B, isNonPrintableKey as C, dayjs as D, autocompleteTimeFormat as E, validateTimeFormatInput as F, roundToNearest15Minutes as G, validateExactTimeFormat as H, debug as a, formatParticipants as b, formatDateTime as c, dataResponse as d, error as e, formatFolderName as f, formatEventName as g, addDaysToCurrentDate as h, formatTimeAgo as i, formatRecipient as j, addMinutesToCurrentTime as k, getLastDayOfMonth as l, getFirstDayOfMonth as m, isSameDay as n, isSameMonth as o, mergeDeep as p, parsePreviewLink as q, htmlToPlainText as r, detectIfMessageIsHTML as s, toTitleCase as t, uniqueID as u, detectHTMLOrPlainText as v, parsePlainTextToHTML as w, timeToMinutes as x, convertTo12HourFormat as y, minutesToTime as z };
4030
4133
 
4031
- //# sourceMappingURL=utils-73d8a928.js.map
4134
+ //# sourceMappingURL=utils-157014b4.js.map