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

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 (289) hide show
  1. package/dist/cjs/add-circle-icon_22.cjs.entry.js +22 -11
  2. package/dist/cjs/add-circle-icon_22.cjs.entry.js.map +1 -1
  3. package/dist/cjs/forward-icon_6.cjs.entry.js +2 -2
  4. package/dist/cjs/google-logo-icon_4.cjs.entry.js +2 -2
  5. package/dist/cjs/index-7af03e3f.js +158 -1
  6. package/dist/cjs/index-c14ea8f5.js +362 -1
  7. package/dist/cjs/index.cjs.js +2 -2
  8. package/dist/cjs/{index.es-b12b7df1.js → index.es-4a7d8d3f.js} +2 -2
  9. package/dist/cjs/{index.es-b12b7df1.js.map → index.es-4a7d8d3f.js.map} +1 -1
  10. package/dist/cjs/{index.es-0a0f2d87.js → index.es-b2cce060.js} +2 -2
  11. package/dist/cjs/{index.es-0a0f2d87.js.map → index.es-b2cce060.js.map} +1 -1
  12. package/dist/cjs/{mailbox-store-05fa3bec.js → mailbox-store-a2f858b7.js} +3 -3
  13. package/dist/cjs/{mailbox-store-05fa3bec.js.map → mailbox-store-a2f858b7.js.map} +1 -1
  14. package/dist/cjs/{mailbox-store-14531fd4.js → mailbox-store-ecceb918.js} +3 -3
  15. package/dist/cjs/{mailbox-store-14531fd4.js.map → mailbox-store-ecceb918.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-27c25287.js → nylas-api-request-28b4576a.js} +2 -2
  19. package/dist/cjs/{nylas-api-request-27c25287.js.map → nylas-api-request-28b4576a.js.map} +1 -1
  20. package/dist/cjs/{nylas-api-request-abdb8dd8.js → nylas-api-request-c9e0e347.js} +2 -2
  21. package/dist/cjs/{nylas-api-request-abdb8dd8.js.map → nylas-api-request-c9e0e347.js.map} +1 -1
  22. package/dist/cjs/nylas-availability-picker.cjs.entry.js +2 -2
  23. package/dist/cjs/nylas-booked-event-card.cjs.entry.js +2 -2
  24. package/dist/cjs/nylas-booked-event-card_10.cjs.entry.js +2 -2
  25. package/dist/cjs/nylas-booking-calendar-picker.cjs.entry.js +2 -2
  26. package/dist/cjs/nylas-booking-form.cjs.entry.js +2 -2
  27. package/dist/cjs/nylas-buffer-time.cjs.entry.js +2 -2
  28. package/dist/cjs/nylas-calendar-picker.cjs.entry.js +2 -2
  29. package/dist/cjs/nylas-cancel-booking-form.cjs.entry.js +2 -2
  30. package/dist/cjs/nylas-cancelled-event-card.cjs.entry.js +2 -2
  31. package/dist/cjs/nylas-composer.cjs.entry.js +1 -1
  32. package/dist/cjs/nylas-custom-booking-flow.cjs.entry.js +2 -2
  33. package/dist/cjs/nylas-date-picker.cjs.entry.js +2 -2
  34. package/dist/cjs/nylas-editor-tabs.cjs.entry.js +2 -2
  35. package/dist/cjs/nylas-event-description.cjs.entry.js +2 -2
  36. package/dist/cjs/nylas-event-duration.cjs.entry.js +2 -2
  37. package/dist/cjs/nylas-event-info.cjs.entry.js +2 -2
  38. package/dist/cjs/nylas-event-limits.cjs.entry.js +2 -2
  39. package/dist/cjs/nylas-event-title.cjs.entry.js +22 -11
  40. package/dist/cjs/nylas-event-title.cjs.entry.js.map +1 -1
  41. package/dist/cjs/nylas-form-card.cjs.entry.js +2 -2
  42. package/dist/cjs/nylas-if-state.cjs.entry.js +2 -2
  43. package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js +2 -2
  44. package/dist/cjs/nylas-list-configurations.cjs.entry.js +2 -2
  45. package/dist/cjs/nylas-list-folders.cjs.entry.js +2 -2
  46. package/dist/cjs/nylas-list-threads.cjs.entry.js +2 -2
  47. package/dist/cjs/nylas-locale-switch.cjs.entry.js +2 -2
  48. package/dist/cjs/nylas-location-component.cjs.entry.js +2 -2
  49. package/dist/cjs/nylas-login.cjs.entry.js +2 -2
  50. package/dist/cjs/nylas-mailbox-pagination.cjs.entry.js +2 -2
  51. package/dist/cjs/nylas-mailbox-toolbar-button.cjs.entry.js +2 -2
  52. package/dist/cjs/nylas-mailbox.cjs.entry.js +3 -3
  53. package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js +2 -2
  54. package/dist/cjs/nylas-notification.cjs.entry.js +1 -1
  55. package/dist/cjs/nylas-provider.cjs.entry.js +4 -4
  56. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +3 -3
  57. package/dist/cjs/nylas-scheduling.cjs.entry.js +3 -3
  58. package/dist/cjs/nylas-selected-event-card.cjs.entry.js +2 -2
  59. package/dist/cjs/nylas-summarize-message-button.cjs.entry.js +2 -2
  60. package/dist/cjs/nylas-threads-refresh.cjs.entry.js +2 -2
  61. package/dist/cjs/nylas-threads-search.cjs.entry.js +2 -2
  62. package/dist/cjs/nylas-time-window-picker.cjs.entry.js +1 -1
  63. package/dist/cjs/nylas-timeslot-picker.cjs.entry.js +2 -2
  64. package/dist/cjs/nylas-view-email.cjs.entry.js +1 -1
  65. package/dist/cjs/nylas-view-thread.cjs.entry.js +2 -2
  66. package/dist/cjs/{register-component-c8b6e907.js → register-component-7ecacf90.js} +2 -2
  67. package/dist/cjs/{register-component-09ebdf31.js.map → register-component-7ecacf90.js.map} +1 -1
  68. package/dist/cjs/{register-component-09ebdf31.js → register-component-98ab6f54.js} +2 -2
  69. package/dist/cjs/{register-component-c8b6e907.js.map → register-component-98ab6f54.js.map} +1 -1
  70. package/dist/cjs/{scheduler-store-67dc1986.js → scheduler-store-22103c86.js} +2 -2
  71. package/dist/cjs/{scheduler-store-0081970d.js.map → scheduler-store-22103c86.js.map} +1 -1
  72. package/dist/cjs/{scheduler-store-0081970d.js → scheduler-store-fad9ed7a.js} +2 -2
  73. package/dist/cjs/{scheduler-store-67dc1986.js.map → scheduler-store-fad9ed7a.js.map} +1 -1
  74. package/dist/cjs/time-period-selector.cjs.entry.js +1 -1
  75. package/dist/cjs/{utils-20663d54.js → utils-9fc33c77.js} +46 -1
  76. package/dist/cjs/utils-9fc33c77.js.map +1 -0
  77. package/dist/cjs/{utils-2c7f0895.js → utils-d8cfc3be.js} +46 -1
  78. package/dist/cjs/{utils-2c7f0895.js.map → utils-d8cfc3be.js.map} +1 -1
  79. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js +21 -10
  80. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js.map +1 -1
  81. package/dist/collection/utils/utils.js +44 -0
  82. package/dist/collection/utils/utils.js.map +1 -1
  83. package/dist/components/index.es.js +1 -1
  84. package/dist/components/nylas-event-title2.js +21 -10
  85. package/dist/components/nylas-event-title2.js.map +1 -1
  86. package/dist/components/nylas-list-folders.js +1 -1
  87. package/dist/components/nylas-list-threads.js +1 -1
  88. package/dist/components/nylas-summarize-message-button2.js +1 -1
  89. package/dist/components/nylas-view-email2.js +1 -1
  90. package/dist/components/nylas-view-thread.js +1 -1
  91. package/dist/components/utils.js +45 -1
  92. package/dist/components/utils.js.map +1 -1
  93. package/dist/esm/add-circle-icon_22.entry.js +22 -11
  94. package/dist/esm/add-circle-icon_22.entry.js.map +1 -1
  95. package/dist/esm/forward-icon_6.entry.js +2 -2
  96. package/dist/esm/google-logo-icon_4.entry.js +2 -2
  97. package/dist/esm/index-7cb0dd3d.js +158 -1
  98. package/dist/esm/index-8362ce5c.js +362 -1
  99. package/dist/esm/{index.es-f57e612a.js → index.es-df564f87.js} +2 -2
  100. package/dist/esm/{index.es-f57e612a.js.map → index.es-df564f87.js.map} +1 -1
  101. package/dist/{nylas-web-elements/index.es-2842f8c8.js → esm/index.es-e4f027a2.js} +2 -2
  102. package/dist/esm/{index.es-2842f8c8.js.map → index.es-e4f027a2.js.map} +1 -1
  103. package/dist/esm/index.js +2 -2
  104. package/dist/{nylas-web-elements/mailbox-store-d48269de.js → esm/mailbox-store-5075f820.js} +3 -3
  105. package/dist/{nylas-web-elements/mailbox-store-d48269de.js.map → esm/mailbox-store-5075f820.js.map} +1 -1
  106. package/dist/esm/{mailbox-store-47fc8a1a.js → mailbox-store-69c5c5f6.js} +3 -3
  107. package/dist/esm/{mailbox-store-47fc8a1a.js.map → mailbox-store-69c5c5f6.js.map} +1 -1
  108. package/dist/esm/multi-select-dropdown.entry.js +1 -1
  109. package/dist/esm/nylas-additional-participants.entry.js +2 -2
  110. package/dist/{nylas-web-elements/nylas-api-request-b085294d.js → esm/nylas-api-request-6a19db25.js} +2 -2
  111. package/dist/esm/{nylas-api-request-b085294d.js.map → nylas-api-request-6a19db25.js.map} +1 -1
  112. package/dist/esm/{nylas-api-request-8932547a.js → nylas-api-request-b49b1da6.js} +2 -2
  113. package/dist/esm/{nylas-api-request-8932547a.js.map → nylas-api-request-b49b1da6.js.map} +1 -1
  114. package/dist/esm/nylas-availability-picker.entry.js +2 -2
  115. package/dist/esm/nylas-booked-event-card.entry.js +2 -2
  116. package/dist/esm/nylas-booked-event-card_10.entry.js +2 -2
  117. package/dist/esm/nylas-booking-calendar-picker.entry.js +2 -2
  118. package/dist/esm/nylas-booking-form.entry.js +2 -2
  119. package/dist/esm/nylas-buffer-time.entry.js +2 -2
  120. package/dist/esm/nylas-calendar-picker.entry.js +2 -2
  121. package/dist/esm/nylas-cancel-booking-form.entry.js +2 -2
  122. package/dist/esm/nylas-cancelled-event-card.entry.js +2 -2
  123. package/dist/esm/nylas-composer.entry.js +1 -1
  124. package/dist/esm/nylas-custom-booking-flow.entry.js +2 -2
  125. package/dist/esm/nylas-date-picker.entry.js +2 -2
  126. package/dist/esm/nylas-editor-tabs.entry.js +2 -2
  127. package/dist/esm/nylas-event-description.entry.js +2 -2
  128. package/dist/esm/nylas-event-duration.entry.js +2 -2
  129. package/dist/esm/nylas-event-info.entry.js +2 -2
  130. package/dist/esm/nylas-event-limits.entry.js +2 -2
  131. package/dist/esm/nylas-event-title.entry.js +22 -11
  132. package/dist/esm/nylas-event-title.entry.js.map +1 -1
  133. package/dist/esm/nylas-form-card.entry.js +2 -2
  134. package/dist/esm/nylas-if-state.entry.js +2 -2
  135. package/dist/esm/nylas-limit-future-bookings.entry.js +2 -2
  136. package/dist/esm/nylas-list-configurations.entry.js +2 -2
  137. package/dist/esm/nylas-list-folders.entry.js +2 -2
  138. package/dist/esm/nylas-list-threads.entry.js +2 -2
  139. package/dist/esm/nylas-locale-switch.entry.js +2 -2
  140. package/dist/esm/nylas-location-component.entry.js +2 -2
  141. package/dist/esm/nylas-login.entry.js +2 -2
  142. package/dist/esm/nylas-mailbox-pagination.entry.js +2 -2
  143. package/dist/esm/nylas-mailbox-toolbar-button.entry.js +2 -2
  144. package/dist/esm/nylas-mailbox.entry.js +3 -3
  145. package/dist/esm/nylas-min-cancellation-notice.entry.js +2 -2
  146. package/dist/esm/nylas-notification.entry.js +1 -1
  147. package/dist/esm/nylas-provider.entry.js +4 -4
  148. package/dist/esm/nylas-scheduler-editor.entry.js +3 -3
  149. package/dist/esm/nylas-scheduling.entry.js +3 -3
  150. package/dist/esm/nylas-selected-event-card.entry.js +2 -2
  151. package/dist/esm/nylas-summarize-message-button.entry.js +2 -2
  152. package/dist/esm/nylas-threads-refresh.entry.js +2 -2
  153. package/dist/esm/nylas-threads-search.entry.js +2 -2
  154. package/dist/esm/nylas-time-window-picker.entry.js +1 -1
  155. package/dist/esm/nylas-timeslot-picker.entry.js +2 -2
  156. package/dist/esm/nylas-view-email.entry.js +1 -1
  157. package/dist/esm/nylas-view-thread.entry.js +2 -2
  158. package/dist/esm/{register-component-cf5c8420.js → register-component-b9cfcbaf.js} +2 -2
  159. package/dist/esm/{register-component-cf5c8420.js.map → register-component-b9cfcbaf.js.map} +1 -1
  160. package/dist/{nylas-web-elements/register-component-e5afe237.js → esm/register-component-ff6f5df4.js} +2 -2
  161. package/dist/esm/{register-component-e5afe237.js.map → register-component-ff6f5df4.js.map} +1 -1
  162. package/dist/esm/{scheduler-store-a175fc3e.js → scheduler-store-24fd0e91.js} +2 -2
  163. package/dist/{nylas-web-elements/scheduler-store-66c2168c.js.map → esm/scheduler-store-24fd0e91.js.map} +1 -1
  164. package/dist/esm/{scheduler-store-66c2168c.js → scheduler-store-e62b2146.js} +2 -2
  165. package/dist/esm/{scheduler-store-66c2168c.js.map → scheduler-store-e62b2146.js.map} +1 -1
  166. package/dist/esm/time-period-selector.entry.js +1 -1
  167. package/dist/{nylas-web-elements/utils-73d8a928.js → esm/utils-3e18e0b2.js} +46 -2
  168. package/dist/esm/{utils-73d8a928.js.map → utils-3e18e0b2.js.map} +1 -1
  169. package/dist/esm/{utils-d6204242.js → utils-db11d29c.js} +46 -2
  170. package/dist/esm/utils-db11d29c.js.map +1 -0
  171. package/dist/{esm/index.es-2842f8c8.js → nylas-web-elements/index.es-e4f027a2.js} +2 -2
  172. package/dist/nylas-web-elements/{index.es-2842f8c8.js.map → index.es-e4f027a2.js.map} +1 -1
  173. package/dist/nylas-web-elements/index.esm.js +2 -2
  174. package/dist/{esm/mailbox-store-d48269de.js → nylas-web-elements/mailbox-store-5075f820.js} +3 -3
  175. package/dist/{esm/mailbox-store-d48269de.js.map → nylas-web-elements/mailbox-store-5075f820.js.map} +1 -1
  176. package/dist/nylas-web-elements/multi-select-dropdown.entry.js +1 -1
  177. package/dist/nylas-web-elements/nylas-additional-participants.entry.js +2 -2
  178. package/dist/{esm/nylas-api-request-b085294d.js → nylas-web-elements/nylas-api-request-6a19db25.js} +2 -2
  179. package/dist/nylas-web-elements/{nylas-api-request-b085294d.js.map → nylas-api-request-6a19db25.js.map} +1 -1
  180. package/dist/nylas-web-elements/nylas-availability-picker.entry.js +2 -2
  181. package/dist/nylas-web-elements/nylas-booked-event-card.entry.js +2 -2
  182. package/dist/nylas-web-elements/nylas-booking-calendar-picker.entry.js +2 -2
  183. package/dist/nylas-web-elements/nylas-booking-form.entry.js +2 -2
  184. package/dist/nylas-web-elements/nylas-buffer-time.entry.js +2 -2
  185. package/dist/nylas-web-elements/nylas-calendar-picker.entry.js +2 -2
  186. package/dist/nylas-web-elements/nylas-cancel-booking-form.entry.js +2 -2
  187. package/dist/nylas-web-elements/nylas-cancelled-event-card.entry.js +2 -2
  188. package/dist/nylas-web-elements/nylas-composer.entry.js +1 -1
  189. package/dist/nylas-web-elements/nylas-custom-booking-flow.entry.js +2 -2
  190. package/dist/nylas-web-elements/nylas-date-picker.entry.js +2 -2
  191. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +2 -2
  192. package/dist/nylas-web-elements/nylas-event-description.entry.js +2 -2
  193. package/dist/nylas-web-elements/nylas-event-duration.entry.js +2 -2
  194. package/dist/nylas-web-elements/nylas-event-info.entry.js +2 -2
  195. package/dist/nylas-web-elements/nylas-event-limits.entry.js +2 -2
  196. package/dist/nylas-web-elements/nylas-event-title.entry.js +22 -11
  197. package/dist/nylas-web-elements/nylas-event-title.entry.js.map +1 -1
  198. package/dist/nylas-web-elements/nylas-form-card.entry.js +2 -2
  199. package/dist/nylas-web-elements/nylas-if-state.entry.js +2 -2
  200. package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js +2 -2
  201. package/dist/nylas-web-elements/nylas-list-configurations.entry.js +2 -2
  202. package/dist/nylas-web-elements/nylas-list-folders.entry.js +2 -2
  203. package/dist/nylas-web-elements/nylas-list-threads.entry.js +2 -2
  204. package/dist/nylas-web-elements/nylas-locale-switch.entry.js +2 -2
  205. package/dist/nylas-web-elements/nylas-location-component.entry.js +2 -2
  206. package/dist/nylas-web-elements/nylas-login.entry.js +2 -2
  207. package/dist/nylas-web-elements/nylas-mailbox-pagination.entry.js +2 -2
  208. package/dist/nylas-web-elements/nylas-mailbox-toolbar-button.entry.js +2 -2
  209. package/dist/nylas-web-elements/nylas-mailbox.entry.js +3 -3
  210. package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js +2 -2
  211. package/dist/nylas-web-elements/nylas-notification.entry.js +1 -1
  212. package/dist/nylas-web-elements/nylas-provider.entry.js +4 -4
  213. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +3 -3
  214. package/dist/nylas-web-elements/nylas-scheduling.entry.js +3 -3
  215. package/dist/nylas-web-elements/nylas-selected-event-card.entry.js +2 -2
  216. package/dist/nylas-web-elements/nylas-summarize-message-button.entry.js +2 -2
  217. package/dist/nylas-web-elements/nylas-threads-refresh.entry.js +2 -2
  218. package/dist/nylas-web-elements/nylas-threads-search.entry.js +2 -2
  219. package/dist/nylas-web-elements/nylas-time-window-picker.entry.js +1 -1
  220. package/dist/nylas-web-elements/nylas-timeslot-picker.entry.js +2 -2
  221. package/dist/nylas-web-elements/nylas-view-email.entry.js +1 -1
  222. package/dist/nylas-web-elements/nylas-view-thread.entry.js +2 -2
  223. package/dist/nylas-web-elements/{p-30784693.entry.js → p-074919b0.entry.js} +2 -2
  224. package/dist/nylas-web-elements/{p-f154a362.entry.js → p-21c3dcad.entry.js} +2 -2
  225. package/dist/nylas-web-elements/{p-42791515.entry.js → p-22531c3d.entry.js} +2 -2
  226. package/dist/nylas-web-elements/{p-7c55dfa0.entry.js → p-2d151de9.entry.js} +2 -2
  227. package/dist/nylas-web-elements/{p-3909ec3f.entry.js → p-349f07e3.entry.js} +2 -2
  228. package/dist/nylas-web-elements/{p-e03b2592.entry.js → p-4154e97e.entry.js} +2 -2
  229. package/dist/nylas-web-elements/{p-bbf9aff2.entry.js → p-434fcde2.entry.js} +2 -2
  230. package/dist/nylas-web-elements/{p-e22aa0b0.js → p-47b99cf5.js} +2 -2
  231. package/dist/nylas-web-elements/{p-22e5436c.js → p-4c12e1e9.js} +2 -2
  232. package/dist/nylas-web-elements/{p-80d6175c.entry.js → p-5caa0f36.entry.js} +2 -2
  233. package/dist/nylas-web-elements/{p-df6d54c7.entry.js → p-7614e31e.entry.js} +2 -2
  234. package/dist/nylas-web-elements/{p-1d25ca06.entry.js → p-7687925d.entry.js} +2 -2
  235. package/dist/nylas-web-elements/{p-75a8d077.entry.js → p-828165d3.entry.js} +2 -2
  236. package/dist/nylas-web-elements/{p-cc674b3b.entry.js → p-980c32d9.entry.js} +2 -2
  237. package/dist/nylas-web-elements/{p-ad64c2b8.entry.js → p-a17f542c.entry.js} +2 -2
  238. package/dist/nylas-web-elements/{p-a628eaeb.js → p-a3b1a98c.js} +2 -2
  239. package/dist/nylas-web-elements/{p-41dc0d93.js → p-ad7cf473.js} +2 -2
  240. package/dist/nylas-web-elements/p-ad7cf473.js.map +1 -0
  241. package/dist/nylas-web-elements/{p-343b8684.entry.js → p-bb89e973.entry.js} +2 -2
  242. package/dist/nylas-web-elements/{p-1a91cce5.entry.js → p-c529dced.entry.js} +2 -2
  243. package/dist/nylas-web-elements/{p-33b940fb.entry.js → p-d5375409.entry.js} +2 -2
  244. package/dist/nylas-web-elements/p-da74ec1c.entry.js +2 -0
  245. package/dist/nylas-web-elements/p-da74ec1c.entry.js.map +1 -0
  246. package/dist/nylas-web-elements/{p-9ea458c3.js → p-f0250b7d.js} +2 -2
  247. package/dist/nylas-web-elements/{p-eaa9151b.js → p-f0f3f350.js} +2 -2
  248. package/dist/nylas-web-elements/{p-6110351b.entry.js → p-f3974e14.entry.js} +2 -2
  249. package/dist/nylas-web-elements/{p-f1f8f745.entry.js → p-f47163ac.entry.js} +2 -2
  250. package/dist/nylas-web-elements/{p-665ef10b.entry.js → p-f5d17746.entry.js} +2 -2
  251. package/dist/{esm/register-component-e5afe237.js → nylas-web-elements/register-component-ff6f5df4.js} +2 -2
  252. package/dist/nylas-web-elements/{register-component-e5afe237.js.map → register-component-ff6f5df4.js.map} +1 -1
  253. package/dist/nylas-web-elements/{scheduler-store-66c2168c.js → scheduler-store-e62b2146.js} +2 -2
  254. package/dist/{esm/scheduler-store-a175fc3e.js.map → nylas-web-elements/scheduler-store-e62b2146.js.map} +1 -1
  255. package/dist/nylas-web-elements/time-period-selector.entry.js +1 -1
  256. package/dist/{esm/utils-73d8a928.js → nylas-web-elements/utils-3e18e0b2.js} +46 -2
  257. package/dist/nylas-web-elements/{utils-73d8a928.js.map → utils-3e18e0b2.js.map} +1 -1
  258. package/dist/types/components/scheduler-editor/nylas-event-title/nylas-event-title.d.ts +1 -0
  259. package/dist/types/utils/utils.d.ts +1 -0
  260. package/package.json +1 -1
  261. package/dist/cjs/utils-20663d54.js.map +0 -1
  262. package/dist/esm/utils-d6204242.js.map +0 -1
  263. package/dist/nylas-web-elements/p-2b636359.entry.js +0 -2
  264. package/dist/nylas-web-elements/p-2b636359.entry.js.map +0 -1
  265. package/dist/nylas-web-elements/p-41dc0d93.js.map +0 -1
  266. /package/dist/nylas-web-elements/{p-30784693.entry.js.map → p-074919b0.entry.js.map} +0 -0
  267. /package/dist/nylas-web-elements/{p-f154a362.entry.js.map → p-21c3dcad.entry.js.map} +0 -0
  268. /package/dist/nylas-web-elements/{p-42791515.entry.js.map → p-22531c3d.entry.js.map} +0 -0
  269. /package/dist/nylas-web-elements/{p-7c55dfa0.entry.js.map → p-2d151de9.entry.js.map} +0 -0
  270. /package/dist/nylas-web-elements/{p-3909ec3f.entry.js.map → p-349f07e3.entry.js.map} +0 -0
  271. /package/dist/nylas-web-elements/{p-e03b2592.entry.js.map → p-4154e97e.entry.js.map} +0 -0
  272. /package/dist/nylas-web-elements/{p-bbf9aff2.entry.js.map → p-434fcde2.entry.js.map} +0 -0
  273. /package/dist/nylas-web-elements/{p-e22aa0b0.js.map → p-47b99cf5.js.map} +0 -0
  274. /package/dist/nylas-web-elements/{p-22e5436c.js.map → p-4c12e1e9.js.map} +0 -0
  275. /package/dist/nylas-web-elements/{p-80d6175c.entry.js.map → p-5caa0f36.entry.js.map} +0 -0
  276. /package/dist/nylas-web-elements/{p-df6d54c7.entry.js.map → p-7614e31e.entry.js.map} +0 -0
  277. /package/dist/nylas-web-elements/{p-1d25ca06.entry.js.map → p-7687925d.entry.js.map} +0 -0
  278. /package/dist/nylas-web-elements/{p-75a8d077.entry.js.map → p-828165d3.entry.js.map} +0 -0
  279. /package/dist/nylas-web-elements/{p-cc674b3b.entry.js.map → p-980c32d9.entry.js.map} +0 -0
  280. /package/dist/nylas-web-elements/{p-ad64c2b8.entry.js.map → p-a17f542c.entry.js.map} +0 -0
  281. /package/dist/nylas-web-elements/{p-a628eaeb.js.map → p-a3b1a98c.js.map} +0 -0
  282. /package/dist/nylas-web-elements/{p-343b8684.entry.js.map → p-bb89e973.entry.js.map} +0 -0
  283. /package/dist/nylas-web-elements/{p-1a91cce5.entry.js.map → p-c529dced.entry.js.map} +0 -0
  284. /package/dist/nylas-web-elements/{p-33b940fb.entry.js.map → p-d5375409.entry.js.map} +0 -0
  285. /package/dist/nylas-web-elements/{p-9ea458c3.js.map → p-f0250b7d.js.map} +0 -0
  286. /package/dist/nylas-web-elements/{p-eaa9151b.js.map → p-f0f3f350.js.map} +0 -0
  287. /package/dist/nylas-web-elements/{p-6110351b.entry.js.map → p-f3974e14.entry.js.map} +0 -0
  288. /package/dist/nylas-web-elements/{p-f1f8f745.entry.js.map → p-f47163ac.entry.js.map} +0 -0
  289. /package/dist/nylas-web-elements/{p-665ef10b.entry.js.map → p-f5d17746.entry.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{h,r as registerInstance,c as createEvent,H as Host,a as getElement}from"./p-68c2fadf.js";import{X as Xr,g as global,N as NylasBaseProvider}from"./p-9ea458c3.js";import{N as NylasIdentityRequestWrapper}from"./p-a628eaeb.js";import{d as dataResponse,a as debug}from"./p-41dc0d93.js";import{C as CreateNylasSchedulerConfigStore}from"./p-db15d382.js";import{c as commonjsGlobal}from"./p-cb65c223.js";import"./p-cabb2e68.js";class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}async currentUser(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return null}return this.nylasApiRequest.currentUser()}async getCalendars(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error fetching calendars: Nylas API Request is not initialized"})}const[e,t]=await this.nylasApiRequest.request({method:"GET",path:`calendars`});if(t){return dataResponse(null,{message:"Error fetching calendars: "+t.message})}if(Xr(e)){return dataResponse(null,{message:"Error fetching calendars: "+e.error?.message})}this.nylasSchedulerConfigStore.state.calendars=e.data;return dataResponse(e.data)}async getConfigurationById(e,t=false){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error fetching configuration: Nylas API Request is not initialized"})}if(!t){const t=this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e));if(t){this.nylasSchedulerConfigStore.state.selectedConfiguration=t;return dataResponse(t)}}const[r,n]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}`});if(n){return dataResponse(null,{message:"Error fetching configuration: "+n.message})}if(Xr(r)){return dataResponse(null,{message:"Error fetching configuration: "+r.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=r.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((t=>t.id===e?r.data:t))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,r.data]}return dataResponse(r.data)}async getConfigurations(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error fetching configurations: Nylas API Request is not initialized"})}const[e,t]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations`});if(t){return dataResponse(null,{message:"Error fetching configurations: "+t.message})}if(Xr(e)){return dataResponse(null,{message:"Error fetching configurations: "+e.error?.message})}this.nylasSchedulerConfigStore.state.configurations=e.data;return dataResponse(e.data)}async createConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}e.requires_session_auth=this.nylasSchedulerConfigStore.state.defaultRequiresSessionAuth;const[t,r]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:e});if(r){return dataResponse(null,{message:"Error creating configuration: "+r.message})}if(Xr(t)){return dataResponse(null,{message:"Error creating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data];return dataResponse(t.data)}async updateConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error updating configuration: Nylas API Request is not initialized"})}const[t,r]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${e.id}`,body:e});if(r){return dataResponse(null,{message:"Error updating configuration: "+r.message})}if(Xr(t)){return dataResponse(null,{message:"Error updating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((r=>r.id===e.id?t.data:r))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data]}return dataResponse(t.data)}async deleteConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error deleting configuration: Nylas API Request is not initialized"})}const[t,r]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${e}`});if(r){return dataResponse(null,{message:"Error deleting configuration: "+r.message})}if(Xr(t)){return dataResponse(null,{message:"Error deleting configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((t=>t.id!==e));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===e){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return dataResponse(t.data)}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}init(){debug("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){if(this._schedulerConfigConnector){return this._schedulerConfigConnector}this._schedulerConfigConnector=new NylasSchedulerConfigAPIConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore});return this._schedulerConfigConnector}resetStores(){debug("NylasSchedulerConfigConnector resetStores");this.nylasSchedulerConfigStore.reset()}async logout(){debug("NylasSchedulerConfigConnector logout");this.resetStores()}}var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var inited=false;function init(){inited=true;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var t=0,r=e.length;t<r;++t){lookup[t]=e[t];revLookup[e.charCodeAt(t)]=t}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63}function toByteArray(e){if(!inited){init()}var t,r,n,i,s,o;var a=e.length;if(a%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}s=e[a-2]==="="?2:e[a-1]==="="?1:0;o=new Arr(a*3/4-s);n=s>0?a-4:a;var f=0;for(t=0,r=0;t<n;t+=4,r+=3){i=revLookup[e.charCodeAt(t)]<<18|revLookup[e.charCodeAt(t+1)]<<12|revLookup[e.charCodeAt(t+2)]<<6|revLookup[e.charCodeAt(t+3)];o[f++]=i>>16&255;o[f++]=i>>8&255;o[f++]=i&255}if(s===2){i=revLookup[e.charCodeAt(t)]<<2|revLookup[e.charCodeAt(t+1)]>>4;o[f++]=i&255}else if(s===1){i=revLookup[e.charCodeAt(t)]<<10|revLookup[e.charCodeAt(t+1)]<<4|revLookup[e.charCodeAt(t+2)]>>2;o[f++]=i>>8&255;o[f++]=i&255}return o}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[e&63]}function encodeChunk(e,t,r){var n;var i=[];for(var s=t;s<r;s+=3){n=(e[s]<<16)+(e[s+1]<<8)+e[s+2];i.push(tripletToBase64(n))}return i.join("")}function fromByteArray(e){if(!inited){init()}var t;var r=e.length;var n=r%3;var i="";var s=[];var o=16383;for(var a=0,f=r-n;a<f;a+=o){s.push(encodeChunk(e,a,a+o>f?f:a+o))}if(n===1){t=e[r-1];i+=lookup[t>>2];i+=lookup[t<<4&63];i+="=="}else if(n===2){t=(e[r-2]<<8)+e[r-1];i+=lookup[t>>10];i+=lookup[t>>4&63];i+=lookup[t<<2&63];i+="="}s.push(i);return s.join("")}function read(e,t,r,n,i){var s,o;var a=i*8-n-1;var f=(1<<a)-1;var u=f>>1;var c=-7;var h=r?i-1:0;var l=r?-1:1;var d=e[t+h];h+=l;s=d&(1<<-c)-1;d>>=-c;c+=a;for(;c>0;s=s*256+e[t+h],h+=l,c-=8){}o=s&(1<<-c)-1;s>>=-c;c+=n;for(;c>0;o=o*256+e[t+h],h+=l,c-=8){}if(s===0){s=1-u}else if(s===f){return o?NaN:(d?-1:1)*Infinity}else{o=o+Math.pow(2,n);s=s-u}return(d?-1:1)*o*Math.pow(2,s-n)}function write(e,t,r,n,i,s){var o,a,f;var u=s*8-i-1;var c=(1<<u)-1;var h=c>>1;var l=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var d=n?0:s-1;var y=n?1:-1;var p=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){a=isNaN(t)?1:0;o=c}else{o=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-o))<1){o--;f*=2}if(o+h>=1){t+=l/f}else{t+=l*Math.pow(2,1-h)}if(t*f>=2){o++;f/=2}if(o+h>=c){a=0;o=c}else if(o+h>=1){a=(t*f-1)*Math.pow(2,i);o=o+h}else{a=t*Math.pow(2,h-1)*Math.pow(2,i);o=0}}for(;i>=8;e[r+d]=a&255,d+=y,a/=256,i-=8){}o=o<<i|a;u+=i;for(;u>0;e[r+d]=o&255,d+=y,o/=256,u-=8){}e[r+d-y]|=p*128}var toString={}.toString;var isArray=Array.isArray||function(e){return toString.call(e)=="[object Array]"};
1
+ import{h,r as registerInstance,c as createEvent,H as Host,a as getElement}from"./p-68c2fadf.js";import{X as Xr,g as global,N as NylasBaseProvider}from"./p-f0250b7d.js";import{N as NylasIdentityRequestWrapper}from"./p-a3b1a98c.js";import{d as dataResponse,a as debug}from"./p-ad7cf473.js";import{C as CreateNylasSchedulerConfigStore}from"./p-db15d382.js";import{c as commonjsGlobal}from"./p-cb65c223.js";import"./p-cabb2e68.js";class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}async currentUser(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return null}return this.nylasApiRequest.currentUser()}async getCalendars(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error fetching calendars: Nylas API Request is not initialized"})}const[e,t]=await this.nylasApiRequest.request({method:"GET",path:`calendars`});if(t){return dataResponse(null,{message:"Error fetching calendars: "+t.message})}if(Xr(e)){return dataResponse(null,{message:"Error fetching calendars: "+e.error?.message})}this.nylasSchedulerConfigStore.state.calendars=e.data;return dataResponse(e.data)}async getConfigurationById(e,t=false){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error fetching configuration: Nylas API Request is not initialized"})}if(!t){const t=this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e));if(t){this.nylasSchedulerConfigStore.state.selectedConfiguration=t;return dataResponse(t)}}const[r,n]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}`});if(n){return dataResponse(null,{message:"Error fetching configuration: "+n.message})}if(Xr(r)){return dataResponse(null,{message:"Error fetching configuration: "+r.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=r.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((t=>t.id===e?r.data:t))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,r.data]}return dataResponse(r.data)}async getConfigurations(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error fetching configurations: Nylas API Request is not initialized"})}const[e,t]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations`});if(t){return dataResponse(null,{message:"Error fetching configurations: "+t.message})}if(Xr(e)){return dataResponse(null,{message:"Error fetching configurations: "+e.error?.message})}this.nylasSchedulerConfigStore.state.configurations=e.data;return dataResponse(e.data)}async createConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}e.requires_session_auth=this.nylasSchedulerConfigStore.state.defaultRequiresSessionAuth;const[t,r]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:e});if(r){return dataResponse(null,{message:"Error creating configuration: "+r.message})}if(Xr(t)){return dataResponse(null,{message:"Error creating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data];return dataResponse(t.data)}async updateConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error updating configuration: Nylas API Request is not initialized"})}const[t,r]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${e.id}`,body:e});if(r){return dataResponse(null,{message:"Error updating configuration: "+r.message})}if(Xr(t)){return dataResponse(null,{message:"Error updating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((r=>r.id===e.id?t.data:r))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data]}return dataResponse(t.data)}async deleteConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error deleting configuration: Nylas API Request is not initialized"})}const[t,r]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${e}`});if(r){return dataResponse(null,{message:"Error deleting configuration: "+r.message})}if(Xr(t)){return dataResponse(null,{message:"Error deleting configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((t=>t.id!==e));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===e){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return dataResponse(t.data)}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}init(){debug("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){if(this._schedulerConfigConnector){return this._schedulerConfigConnector}this._schedulerConfigConnector=new NylasSchedulerConfigAPIConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore});return this._schedulerConfigConnector}resetStores(){debug("NylasSchedulerConfigConnector resetStores");this.nylasSchedulerConfigStore.reset()}async logout(){debug("NylasSchedulerConfigConnector logout");this.resetStores()}}var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var inited=false;function init(){inited=true;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var t=0,r=e.length;t<r;++t){lookup[t]=e[t];revLookup[e.charCodeAt(t)]=t}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63}function toByteArray(e){if(!inited){init()}var t,r,n,i,s,o;var a=e.length;if(a%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}s=e[a-2]==="="?2:e[a-1]==="="?1:0;o=new Arr(a*3/4-s);n=s>0?a-4:a;var f=0;for(t=0,r=0;t<n;t+=4,r+=3){i=revLookup[e.charCodeAt(t)]<<18|revLookup[e.charCodeAt(t+1)]<<12|revLookup[e.charCodeAt(t+2)]<<6|revLookup[e.charCodeAt(t+3)];o[f++]=i>>16&255;o[f++]=i>>8&255;o[f++]=i&255}if(s===2){i=revLookup[e.charCodeAt(t)]<<2|revLookup[e.charCodeAt(t+1)]>>4;o[f++]=i&255}else if(s===1){i=revLookup[e.charCodeAt(t)]<<10|revLookup[e.charCodeAt(t+1)]<<4|revLookup[e.charCodeAt(t+2)]>>2;o[f++]=i>>8&255;o[f++]=i&255}return o}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[e&63]}function encodeChunk(e,t,r){var n;var i=[];for(var s=t;s<r;s+=3){n=(e[s]<<16)+(e[s+1]<<8)+e[s+2];i.push(tripletToBase64(n))}return i.join("")}function fromByteArray(e){if(!inited){init()}var t;var r=e.length;var n=r%3;var i="";var s=[];var o=16383;for(var a=0,f=r-n;a<f;a+=o){s.push(encodeChunk(e,a,a+o>f?f:a+o))}if(n===1){t=e[r-1];i+=lookup[t>>2];i+=lookup[t<<4&63];i+="=="}else if(n===2){t=(e[r-2]<<8)+e[r-1];i+=lookup[t>>10];i+=lookup[t>>4&63];i+=lookup[t<<2&63];i+="="}s.push(i);return s.join("")}function read(e,t,r,n,i){var s,o;var a=i*8-n-1;var f=(1<<a)-1;var u=f>>1;var c=-7;var h=r?i-1:0;var l=r?-1:1;var d=e[t+h];h+=l;s=d&(1<<-c)-1;d>>=-c;c+=a;for(;c>0;s=s*256+e[t+h],h+=l,c-=8){}o=s&(1<<-c)-1;s>>=-c;c+=n;for(;c>0;o=o*256+e[t+h],h+=l,c-=8){}if(s===0){s=1-u}else if(s===f){return o?NaN:(d?-1:1)*Infinity}else{o=o+Math.pow(2,n);s=s-u}return(d?-1:1)*o*Math.pow(2,s-n)}function write(e,t,r,n,i,s){var o,a,f;var u=s*8-i-1;var c=(1<<u)-1;var h=c>>1;var l=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var d=n?0:s-1;var y=n?1:-1;var p=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){a=isNaN(t)?1:0;o=c}else{o=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-o))<1){o--;f*=2}if(o+h>=1){t+=l/f}else{t+=l*Math.pow(2,1-h)}if(t*f>=2){o++;f/=2}if(o+h>=c){a=0;o=c}else if(o+h>=1){a=(t*f-1)*Math.pow(2,i);o=o+h}else{a=t*Math.pow(2,h-1)*Math.pow(2,i);o=0}}for(;i>=8;e[r+d]=a&255,d+=y,a/=256,i-=8){}o=o<<i|a;u+=i;for(;u>0;e[r+d]=o&255,d+=y,o/=256,u-=8){}e[r+d-y]|=p*128}var toString={}.toString;var isArray=Array.isArray||function(e){return toString.call(e)=="[object Array]"};
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *
@@ -14,4 +14,4 @@ import{h,r as registerInstance,c as createEvent,H as Host,a as getElement}from".
14
14
  * This source code is licensed under the MIT license found in the
15
15
  * LICENSE file in the root directory of this source tree.
16
16
  */var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(e){if(null===e||"object"!==typeof e)return null;e=z&&e[z]||e["@@iterator"];return"function"===typeof e?e:null}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(e,t,r){this.props=e;this.context=t;this.refs=D;this.updater=r||B}E.prototype.isReactComponent={};E.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};E.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(e,t,r){this.props=e;this.context=t;this.refs=D;this.updater=r||B}var H=G.prototype=new F;H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function M(e,t,r){var n,i={},s=null,o=null;if(null!=t)for(n in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(s=""+t.key),t)J.call(t,n)&&!L.hasOwnProperty(n)&&(i[n]=t[n]);var a=arguments.length-2;if(1===a)i.children=r;else if(1<a){for(var f=Array(a),u=0;u<a;u++)f[u]=arguments[u+2];i.children=f}if(e&&e.defaultProps)for(n in a=e.defaultProps,a)void 0===i[n]&&(i[n]=a[n]);return{$$typeof:l,type:e,key:s,ref:o,props:i,_owner:K.current}}function N(e,t){return{$$typeof:l,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function O(e){return"object"===typeof e&&null!==e&&e.$$typeof===l}function escape(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}var P=/\/+/g;function Q(e,t){return"object"===typeof e&&null!==e&&null!=e.key?escape(""+e.key):t.toString(36)}function R(e,t,r,i,s){var o=typeof e;if("undefined"===o||"boolean"===o)e=null;var a=!1;if(null===e)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case l:case n:a=!0}}if(a)return a=e,s=s(a),e=""===i?"."+Q(a,0):i,I(s)?(r="",null!=e&&(r=e.replace(P,"$&/")+"/"),R(s,t,r,"",(function(e){return e}))):null!=s&&(O(s)&&(s=N(s,r+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(P,"$&/")+"/")+e)),t.push(s)),1;a=0;i=""===i?".":i+":";if(I(e))for(var f=0;f<e.length;f++){o=e[f];var u=i+Q(o,f);a+=R(o,t,r,u,s)}else if(u=A(e),"function"===typeof u)for(e=u.call(e),f=0;!(o=e.next()).done;)o=o.value,u=i+Q(o,f++),a+=R(o,t,r,u,s);else if("object"===o)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function S(e,t,r){if(null==e)return e;var n=[],i=0;R(e,n,"","",(function(e){return t.call(r,e,i++)}));return n}function T(e){if(-1===e._status){var t=e._result;t=t();t.then((function(t){if(0===e._status||-1===e._status)e._status=1,e._result=t}),(function(t){if(0===e._status||-1===e._status)e._status=2,e._result=t}));-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};react_production_min.Children={map:S,forEach:function(e,t,r){S(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;S(e,(function(){t++}));return t},toArray:function(e){return S(e,(function(e){return e}))||[]},only:function(e){if(!O(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};react_production_min.Component=E;react_production_min.Fragment=p;react_production_min.Profiler=r;react_production_min.PureComponent=G;react_production_min.StrictMode=q;react_production_min.Suspense=w;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;react_production_min.cloneElement=function(e,t,r){if(null===e||void 0===e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=C({},e.props),i=e.key,s=e.ref,o=e._owner;if(null!=t){void 0!==t.ref&&(s=t.ref,o=K.current);void 0!==t.key&&(i=""+t.key);if(e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(f in t)J.call(t,f)&&!L.hasOwnProperty(f)&&(n[f]=void 0===t[f]&&void 0!==a?a[f]:t[f])}var f=arguments.length-2;if(1===f)n.children=r;else if(1<f){a=Array(f);for(var u=0;u<f;u++)a[u]=arguments[u+2];n.children=a}return{$$typeof:l,type:e.type,key:i,ref:s,props:n,_owner:o}};react_production_min.createContext=function(e){e={$$typeof:u,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};e.Provider={$$typeof:t,_context:e};return e.Consumer=e};react_production_min.createElement=M;react_production_min.createFactory=function(e){var t=M.bind(null,e);t.type=e;return t};react_production_min.createRef=function(){return{current:null}};react_production_min.forwardRef=function(e){return{$$typeof:v,render:e}};react_production_min.isValidElement=O;react_production_min.lazy=function(e){return{$$typeof:y,_payload:{_status:-1,_result:e},_init:T}};react_production_min.memo=function(e,t){return{$$typeof:x,type:e,compare:void 0===t?null:t}};react_production_min.startTransition=function(e){var t=V.transition;V.transition={};try{e()}finally{V.transition=t}};react_production_min.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};react_production_min.useCallback=function(e,t){return U.current.useCallback(e,t)};react_production_min.useContext=function(e){return U.current.useContext(e)};react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(e){return U.current.useDeferredValue(e)};react_production_min.useEffect=function(e,t){return U.current.useEffect(e,t)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(e,t,r){return U.current.useImperativeHandle(e,t,r)};react_production_min.useInsertionEffect=function(e,t){return U.current.useInsertionEffect(e,t)};react_production_min.useLayoutEffect=function(e,t){return U.current.useLayoutEffect(e,t)};react_production_min.useMemo=function(e,t){return U.current.useMemo(e,t)};react_production_min.useReducer=function(e,t,r){return U.current.useReducer(e,t,r)};react_production_min.useRef=function(e){return U.current.useRef(e)};react_production_min.useState=function(e){return U.current.useState(e)};react_production_min.useSyncExternalStore=function(e,t,r){return U.current.useSyncExternalStore(e,t,r)};react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";const LoginRequired=({authenticationUrl:e})=>h("div",{class:"login-required"},h("div",{class:"card"},h("p",null,"Log into your account to use the Scheduler Editor."),h("button",{class:"google-button",onClick:async t=>{t.preventDefault();const r=await e("google");if(r){window.location.href=r}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},h("span",{class:"icon"},h("google-logo-icon",{width:"15",height:"15"})),"Continue with Google"),h("button",{class:"microsoft-button",onClick:async t=>{t.preventDefault();const r=await e("microsoft");if(r){window.location.href=r}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},h("span",{class:"icon"},h("microsoft-logo-icon",{width:"15",height:"15"})),"Continue with Microsoft"),h("button",{class:"other-provider-button",onClick:async t=>{t.preventDefault();const r=await e();if(r){window.location.href=r}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},"View all providers ",h("chevron-icon",{width:"17",height:"17"})),h("small",{class:"disclaimer-text"},"* You will be redirected to authenticate your account.")));const nylasSchedulerEditorCss=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}div.scheduler-editor-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900)}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;width:858px;margin:0;font-size:18px;line-height:24px;font-weight:600}@media screen and (max-width: 768px){div.scheduler-editor-header h1.scheduler-editor-title{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}nylas-editor-tabs{width:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;max-width:fit-content;align-self:center}.login-required{display:flex;flex-direction:column;padding:2rem 1rem;background-color:var(--nylas-base-25)}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}.list-configurations{padding:2rem}';const NylasSchedulerEditorStyle0=nylasSchedulerEditorCss;const NylasSchedulerEditor=class{constructor(e){registerInstance(this,e);this.init=createEvent(this,"init",7);this.loggedIn=createEvent(this,"loggedIn",7);this.loggedOut=createEvent(this,"loggedOut",7);this.schedulerConfigCloseClicked=createEvent(this,"schedulerConfigCloseClicked",7);this.handleSchedulerConfigCloseClicked=e=>{this.schedulerConfigCloseClicked.emit(this.host)};this.authenticationUrl=async e=>{if(!this.nylasApiRequest){console.error(`[nylas-scheduler-editor] Nylas API Request is not initialized.`);return""}const t=await this.nylasApiRequest.authenticationUrl({provider:e});return t||""};this.defaultRequiresSessionAuth=true;this.configurationId=undefined;this.nylasApiRequest=undefined;this.nylasSessionsConfig=undefined;this.defaultAuthArgs=undefined;this.eventOverrides={};this.schedulerPreviewLink="";this.defaultSchedulerConfigStoreState=undefined;this.mode="app";this.automaticComponentRegistration=true}connectedCallback(){debug(`[nylas-scheduler-editor] connectedCallback`)}async componentWillLoad(){debug(`[nylas-scheduler-editor] componentWillLoad`);this.stores={schedulerConfig:CreateNylasSchedulerConfigStore({...this.defaultSchedulerConfigStoreState})};this.stores?.schedulerConfig?.set("defaultRequiresSessionAuth",this.defaultRequiresSessionAuth);if(!this.nylasApiRequest&&this.nylasSessionsConfig){const e=new NylasSessions(this.nylasSessionsConfig);await e.isLoggedIn();e.onLoginSuccess((async()=>{const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){this.loggedIn.emit(this.host);this.loggedInHandler(e)}}));e.onLoginFail((async()=>{this.stores?.schedulerConfig?.set("currentUser",null);this.loggedOut.emit(this.host)}));this.nylasApiRequest=new NylasIdentityRequestWrapper(e)}if(this.nylasApiRequest&&this.defaultAuthArgs){this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs)}this.baseProvider=new NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new NylasSchedulerConfigConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:e});const t=this.init.emit(this.host);if(!t.defaultPrevented){const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){this.loggedIn.emit(this.host);await this.loggedInHandler(e)}else{this.stores?.schedulerConfig?.set("currentUser",null);this.loggedOut.emit(this.host)}}this.stores?.schedulerConfig?.onChange("selectedConfiguration",(async e=>{if(e&&e.id){this.configurationId=e.id}}));this.baseProvider?.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){debug(`[nylas-scheduler-editor] componentDidLoad`);this.baseProvider?.componentDidLoad()}componentDisconnected(){this.baseProvider?.componentDisconnected()}defaultRequiresSessionAuthChanged(e){this.stores?.schedulerConfig?.set("defaultRequiresSessionAuth",e)}async configurationIdChanged(e){if(e){await(this.nylasSchedulerConfigConnector?.schedulerConfig?.getConfigurationById(e));this.stores?.schedulerConfig?.set("action","edit")}else{this.stores?.schedulerConfig?.set("selectedConfiguration",{});this.stores?.schedulerConfig?.set("action",null)}}async store(){return this.stores?.schedulerConfig}async schedulerConnector(){return this.nylasSchedulerConfigConnector}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async loggedInHandler(e){this.stores?.schedulerConfig?.set("currentUser",e);if(!this.nylasSchedulerConfigConnector){return}if(this.configurationId){await(this.nylasSchedulerConfigConnector.schedulerConfig?.getConfigurationById(this.configurationId))}await(this.nylasSchedulerConfigConnector.schedulerConfig?.getCalendars())}render(){return h(Host,{key:"14880638bcb9c031f748d72fe0052b6eb0df463d"},h("div",{key:"f0ee0e9a97eddbd350dfc41469257475e6178e3d",class:"scheduler-editor-header",part:"nse__header"},h("h1",{key:"eb85113f9650853bb6f3f348e6517ba83112f28f",class:"scheduler-editor-title",part:"nse__title"},h("calendar-icon",{key:"48e6edb5828fbdb111a3360a5c49ef762008c69a",width:"18",height:"18"}),"Scheduler editor"),h("button",{key:"f3d02137c2a999e6305b20b6735efc77370a6a83",class:"scheduler-editor-close",onClick:e=>this.handleSchedulerConfigCloseClicked(e),part:"nse__close-button"},h("close-icon",{key:"05280d7af113731d30b659d9de308b23aa3ea014",width:"18",height:"18"}))),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action===null&&h("div",{class:"list-configurations"},h("nylas-list-configurations",null)),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create"&&h("nylas-editor-tabs",{mode:"composable"},h("nylas-event-info",null,h("div",{slot:"inputs"},h("nylas-event-title",null),h("nylas-event-duration",null),h("nylas-location-component",null))),h("nylas-booking-calendar-picker",null)),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="edit"&&h("nylas-editor-tabs",{mode:this.mode},this.mode==="composable"&&h("slot",null)),!this.stores?.schedulerConfig?.state.currentUser&&h("slot",{name:"login-required"},h(LoginRequired,{authenticationUrl:this.authenticationUrl})))}get host(){return getElement(this)}static get watchers(){return{defaultRequiresSessionAuth:["defaultRequiresSessionAuthChanged"],configurationId:["configurationIdChanged"]}}};NylasSchedulerEditor.style=NylasSchedulerEditorStyle0;export{NylasSchedulerEditor as nylas_scheduler_editor};
17
- //# sourceMappingURL=p-665ef10b.entry.js.map
17
+ //# sourceMappingURL=p-f5d17746.entry.js.map
@@ -1,4 +1,4 @@
1
- import { a as debug, e as error } from './utils-73d8a928.js';
1
+ import { a as debug, e as error } from './utils-3e18e0b2.js';
2
2
  import { e as getElement } from './index-8362ce5c.js';
3
3
 
4
4
  function createComponentEvent(instance, registeredComponent, eventName = 'registerComponent') {
@@ -141,4 +141,4 @@ function RegisterComponent(config) {
141
141
 
142
142
  export { RegisterComponent as R };
143
143
 
144
- //# sourceMappingURL=register-component-e5afe237.js.map
144
+ //# sourceMappingURL=register-component-ff6f5df4.js.map
@@ -1 +1 @@
1
- {"file":"register-component-e5afe237.js","mappings":";;;SAkBgB,oBAAoB,CAClC,QAAW,EACX,mBAA8C,EAC9C,YAAoB,mBAAmB;IAEvC,OAAO,IAAI,WAAW,CAA0C,SAAS,EAAE;QACzE,OAAO,EAAE,IAAI;QACb,Q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AM,EAAE,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC;gBAC9F,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;oBAC7B,KAAK,CAAC,IAAI,aAAa,eAAe,aAAa,wCAAwC,CAAC,CAAC;iBAC9F;gBAED,OAAO,eAAe,CAAC;aACxB,CAAC;YAEF,MAAM,CAAC,oBAAoB,GAAG;gBAC5B,MAAM,eAAe,GAAG,2BAA2B,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChE,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;gBAI9B,MAAM,mBAAmB,GAA8B;oBACrD,OAAO,EAAE,IAAI;oBACb,GAAG,MAAM;oBACT,YAAY,EAAE,eAAe;iBAC9B,CAAC;gBACF,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;gBACpG,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;oBAC7B,KAAK,CAAC,IAAI,aAAa,eAAe,aAAa,0CAA0C,CAAC,CAAC;iBAChG;gBAED,OAAO,eAAe,CAAC;aACxB,CAAC;SACH;KACF,CAAC;AACJ;;;;","names":[],"sources":["src/common/register-component.ts"],"sourcesContent":["import { BaseNylasConnectorInterface } from '@/connector/connector-interface';\nimport { debug, error } from '@/utils/utils';\nimport { ComponentInterface, getElement } from '@stencil/core';\nimport { CombinedStoreStateKeys, EventEmitterEventType, ExtractEventEmitterKeys, ExtractEventEmitterProperties } from './types';\nexport interface RegisteredComponent<H extends ComponentInterface, B extends BaseNylasConnectorInterface, MailboxStores = string> {\n name: string;\n element: HTMLElement;\n getStoresToProp?: keyof H;\n storeToProps?: Map<string, keyof H>;\n stateToProps?: Map<MailboxStores, keyof H>;\n eventToProps?: Map<ExtractEventEmitterKeys<H>, (event: CustomEvent<EventEmitterEventType<H[ExtractEventEmitterKeys<H>]>>, nylasConnector: B) => Promise<void>>;\n localPropsToProp?: Map<string, keyof H>;\n authToProp?: keyof H;\n connectorToProp?: keyof H;\n registrationEventName?: string;\n unregistrationEventName?: string;\n}\n\nexport function createComponentEvent<T extends ComponentInterface, B extends BaseNylasConnectorInterface>(\n instance: T,\n registeredComponent: RegisteredComponent<T, B>,\n eventName: string = 'registerComponent',\n) {\n return new CustomEvent<RegisteredComponent<typeof instance, B>>(eventName, {\n bubbles: true,\n composed: true,\n detail: registeredComponent,\n });\n}\n\nexport function unregisterComponentEvent<T extends ComponentInterface, B extends BaseNylasConnectorInterface>(\n instance: T,\n registeredComponent: RegisteredComponent<T, B>,\n eventName: string = 'unregisterComponent',\n) {\n return new CustomEvent<RegisteredComponent<typeof instance, B>>(eventName, {\n bubbles: true,\n composed: true,\n detail: registeredComponent,\n });\n}\n\nexport interface RegisterComponentConfig<H extends ComponentInterface, B extends BaseNylasConnectorInterface, MailboxStores>\n extends Omit<RegisteredComponent<H, B, MailboxStores>, 'eventToProps' | 'name' | 'element'> {\n name: string;\n eventToProps?: Partial<{\n [P in ExtractEventEmitterProperties<H> as P['key']]: (event: CustomEvent<P['eventType']>, nylasConnector: B) => Promise<void>;\n }>;\n fireRegisterEvent?: boolean;\n}\n\nexport interface NylasComponentInterface extends ComponentInterface {\n authToProp?: keyof this;\n connectorToProp?: keyof this;\n}\n\nexport function RegisterComponent<H extends NylasComponentInterface, B extends BaseNylasConnectorInterface, MailboxStores extends Record<string, any>>(\n config: RegisterComponentConfig<H, B, CombinedStoreStateKeys<keyof MailboxStores, MailboxStores>>,\n) {\n return (target: H, propKey: string) => {\n const componentName = config.name;\n debug(`[${componentName}] Registering component ${componentName} being called on ${propKey}`);\n\n const origionalCallback = target.componentWillLoad;\n if (!origionalCallback) {\n error(`[${componentName}] componentWillLoad lifecycle method in ${componentName} missing. Required for RegisterComponent decorator.`);\n return;\n }\n\n const origionalConnectCallback = target.connectedCallback;\n if (!origionalConnectCallback) {\n error(`[${componentName}] connectedCallback lifecycle method in ${componentName} missing. Required for RegisterComponent decorator.`);\n return;\n }\n\n const origionalDisconnectCallback = target.disconnectedCallback;\n if (!origionalDisconnectCallback) {\n error(`[${componentName}] disconnectedCallback lifecycle method in ${componentName} missing. Required for RegisterComponent decorator.`);\n return;\n }\n\n // Detect a conflict if config.storeToProps and config.stateToProps are both defined\n // for overlapping prop keys\n if (config.storeToProps && config.stateToProps) {\n const storeToPropsKeys = Array.from(config.storeToProps.values());\n const stateToPropsKeys = Array.from(config.stateToProps.values());\n const intersection = storeToPropsKeys.filter(key => stateToPropsKeys.includes(key));\n if (intersection.length > 0) {\n error(\n `[${componentName}] Overlapping prop keys detected in ${componentName} for storeToProps and stateToProps. Make sure to only define them once. Overlapping keys: ${intersection.join(\n ', ',\n )}`,\n );\n return;\n }\n }\n\n // Convert the record of eventToProps to a map\n const eventToPropsMap = new Map<ExtractEventEmitterKeys<H>, (event: CustomEvent<EventEmitterEventType<H[ExtractEventEmitterKeys<H>]>>, nylasConnector: B) => Promise<void>>();\n if (config.eventToProps) {\n Object.keys(config.eventToProps).forEach(key => {\n eventToPropsMap.set(\n key as ExtractEventEmitterKeys<H>,\n config.eventToProps?.[key as ExtractEventEmitterKeys<H>] as (\n event: CustomEvent<EventEmitterEventType<H[ExtractEventEmitterKeys<H>]>>,\n nylasConnector: B,\n ) => Promise<void>,\n );\n });\n }\n\n target.connectedCallback = function () {\n debug(`[~${componentName}] connectedCallback called`);\n const origionalResult = origionalConnectCallback?.call(this);\n const host = getElement(this);\n\n // If the nylas id is already set, then we don't need to do anything\n if (host.dataset.nylasId) {\n return origionalResult;\n }\n\n Object.defineProperty(host, 'registerNylasComponent', {\n get() {\n return true;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'stateToProps', {\n get() {\n return config.stateToProps;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'getStoresToProp', {\n get() {\n return config.getStoresToProp;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'storeToProps', {\n get() {\n return config.storeToProps;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'eventToProps', {\n get() {\n return eventToPropsMap;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'authToProp', {\n get() {\n return config.authToProp;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'connectorToProp', {\n get() {\n return config.connectorToProp;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'localPropsToProp', {\n get() {\n return config.localPropsToProp;\n },\n enumerable: true,\n });\n return origionalResult;\n };\n\n if (config.fireRegisterEvent) {\n target.componentWillLoad = function () {\n const origionalResult = origionalCallback?.call(this);\n const host = getElement(this);\n\n // We use our host element to dispatch a registration event that is picked up by the\n // the nylas-provider component.\n const registeredComponent: RegisteredComponent<H, B> = {\n element: host,\n ...config,\n eventToProps: eventToPropsMap,\n };\n const event = createComponentEvent(target, registeredComponent, config.registrationEventName);\n if (host.dispatchEvent(event)) {\n debug(`[${componentName}] Component ${componentName} successfully fired registration event`);\n }\n\n return origionalResult;\n };\n\n target.disconnectedCallback = function () {\n const origionalResult = origionalDisconnectCallback?.call(this);\n const host = getElement(this);\n\n // We use our host element to dispatch a registration event that is picked up by the\n // the nylas-provider component.\n const registeredComponent: RegisteredComponent<H, B> = {\n element: host,\n ...config,\n eventToProps: eventToPropsMap,\n };\n const event = unregisterComponentEvent(target, registeredComponent, config.unregistrationEventName);\n if (host.dispatchEvent(event)) {\n debug(`[${componentName}] Component ${componentName} successfully fired unregistration event`);\n }\n\n return origionalResult;\n };\n }\n };\n}\n"],"version":3}
1
+ {"file":"register-component-ff6f5df4.js","mappings":";;;SAkBgB,oBAAoB,CAClC,QAAW,EACX,mBAA8C,EAC9C,YAAoB,mBAAmB;IAEvC,OAAO,IAAI,WAAW,CAA0C,SAAS,EAAE;QACzE,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,mBAAmB;KAC5B,CAAC,CAAC;AACL,CAAC;SAEe,wBAAwB,CACtC,QAAW,EACX,mBAA8C,EAC9C,YAAoB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,CAAC,IAAI,aAAa,eAAe,aAAa,wCAAwC,CAAC,CAAC;iBAC9F;gBAED,OAAO,eAAe,CAAC;aACxB,CAAC;YAEF,MAAM,CAAC,oBAAoB,GAAG;gBAC5B,MAAM,eAAe,GAAG,2BAA2B,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChE,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;gBAI9B,MAAM,mBAAmB,GAA8B;oBACrD,OAAO,EAAE,IAAI;oBACb,GAAG,MAAM;oBACT,YAAY,EAAE,eAAe;iBAC9B,CAAC;gBACF,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;gBACpG,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;oBAC7B,KAAK,CAAC,IAAI,aAAa,eAAe,aAAa,0CAA0C,CAAC,CAAC;iBAChG;gBAED,OAAO,eAAe,CAAC;aACxB,CAAC;SACH;KACF,CAAC;AACJ;;;;","names":[],"sources":["src/common/register-component.ts"],"sourcesContent":["import { BaseNylasConnectorInterface } from '@/connector/connector-interface';\nimport { debug, error } from '@/utils/utils';\nimport { ComponentInterface, getElement } from '@stencil/core';\nimport { CombinedStoreStateKeys, EventEmitterEventType, ExtractEventEmitterKeys, ExtractEventEmitterProperties } from './types';\nexport interface RegisteredComponent<H extends ComponentInterface, B extends BaseNylasConnectorInterface, MailboxStores = string> {\n name: string;\n element: HTMLElement;\n getStoresToProp?: keyof H;\n storeToProps?: Map<string, keyof H>;\n stateToProps?: Map<MailboxStores, keyof H>;\n eventToProps?: Map<ExtractEventEmitterKeys<H>, (event: CustomEvent<EventEmitterEventType<H[ExtractEventEmitterKeys<H>]>>, nylasConnector: B) => Promise<void>>;\n localPropsToProp?: Map<string, keyof H>;\n authToProp?: keyof H;\n connectorToProp?: keyof H;\n registrationEventName?: string;\n unregistrationEventName?: string;\n}\n\nexport function createComponentEvent<T extends ComponentInterface, B extends BaseNylasConnectorInterface>(\n instance: T,\n registeredComponent: RegisteredComponent<T, B>,\n eventName: string = 'registerComponent',\n) {\n return new CustomEvent<RegisteredComponent<typeof instance, B>>(eventName, {\n bubbles: true,\n composed: true,\n detail: registeredComponent,\n });\n}\n\nexport function unregisterComponentEvent<T extends ComponentInterface, B extends BaseNylasConnectorInterface>(\n instance: T,\n registeredComponent: RegisteredComponent<T, B>,\n eventName: string = 'unregisterComponent',\n) {\n return new CustomEvent<RegisteredComponent<typeof instance, B>>(eventName, {\n bubbles: true,\n composed: true,\n detail: registeredComponent,\n });\n}\n\nexport interface RegisterComponentConfig<H extends ComponentInterface, B extends BaseNylasConnectorInterface, MailboxStores>\n extends Omit<RegisteredComponent<H, B, MailboxStores>, 'eventToProps' | 'name' | 'element'> {\n name: string;\n eventToProps?: Partial<{\n [P in ExtractEventEmitterProperties<H> as P['key']]: (event: CustomEvent<P['eventType']>, nylasConnector: B) => Promise<void>;\n }>;\n fireRegisterEvent?: boolean;\n}\n\nexport interface NylasComponentInterface extends ComponentInterface {\n authToProp?: keyof this;\n connectorToProp?: keyof this;\n}\n\nexport function RegisterComponent<H extends NylasComponentInterface, B extends BaseNylasConnectorInterface, MailboxStores extends Record<string, any>>(\n config: RegisterComponentConfig<H, B, CombinedStoreStateKeys<keyof MailboxStores, MailboxStores>>,\n) {\n return (target: H, propKey: string) => {\n const componentName = config.name;\n debug(`[${componentName}] Registering component ${componentName} being called on ${propKey}`);\n\n const origionalCallback = target.componentWillLoad;\n if (!origionalCallback) {\n error(`[${componentName}] componentWillLoad lifecycle method in ${componentName} missing. Required for RegisterComponent decorator.`);\n return;\n }\n\n const origionalConnectCallback = target.connectedCallback;\n if (!origionalConnectCallback) {\n error(`[${componentName}] connectedCallback lifecycle method in ${componentName} missing. Required for RegisterComponent decorator.`);\n return;\n }\n\n const origionalDisconnectCallback = target.disconnectedCallback;\n if (!origionalDisconnectCallback) {\n error(`[${componentName}] disconnectedCallback lifecycle method in ${componentName} missing. Required for RegisterComponent decorator.`);\n return;\n }\n\n // Detect a conflict if config.storeToProps and config.stateToProps are both defined\n // for overlapping prop keys\n if (config.storeToProps && config.stateToProps) {\n const storeToPropsKeys = Array.from(config.storeToProps.values());\n const stateToPropsKeys = Array.from(config.stateToProps.values());\n const intersection = storeToPropsKeys.filter(key => stateToPropsKeys.includes(key));\n if (intersection.length > 0) {\n error(\n `[${componentName}] Overlapping prop keys detected in ${componentName} for storeToProps and stateToProps. Make sure to only define them once. Overlapping keys: ${intersection.join(\n ', ',\n )}`,\n );\n return;\n }\n }\n\n // Convert the record of eventToProps to a map\n const eventToPropsMap = new Map<ExtractEventEmitterKeys<H>, (event: CustomEvent<EventEmitterEventType<H[ExtractEventEmitterKeys<H>]>>, nylasConnector: B) => Promise<void>>();\n if (config.eventToProps) {\n Object.keys(config.eventToProps).forEach(key => {\n eventToPropsMap.set(\n key as ExtractEventEmitterKeys<H>,\n config.eventToProps?.[key as ExtractEventEmitterKeys<H>] as (\n event: CustomEvent<EventEmitterEventType<H[ExtractEventEmitterKeys<H>]>>,\n nylasConnector: B,\n ) => Promise<void>,\n );\n });\n }\n\n target.connectedCallback = function () {\n debug(`[~${componentName}] connectedCallback called`);\n const origionalResult = origionalConnectCallback?.call(this);\n const host = getElement(this);\n\n // If the nylas id is already set, then we don't need to do anything\n if (host.dataset.nylasId) {\n return origionalResult;\n }\n\n Object.defineProperty(host, 'registerNylasComponent', {\n get() {\n return true;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'stateToProps', {\n get() {\n return config.stateToProps;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'getStoresToProp', {\n get() {\n return config.getStoresToProp;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'storeToProps', {\n get() {\n return config.storeToProps;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'eventToProps', {\n get() {\n return eventToPropsMap;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'authToProp', {\n get() {\n return config.authToProp;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'connectorToProp', {\n get() {\n return config.connectorToProp;\n },\n enumerable: true,\n });\n Object.defineProperty(host, 'localPropsToProp', {\n get() {\n return config.localPropsToProp;\n },\n enumerable: true,\n });\n return origionalResult;\n };\n\n if (config.fireRegisterEvent) {\n target.componentWillLoad = function () {\n const origionalResult = origionalCallback?.call(this);\n const host = getElement(this);\n\n // We use our host element to dispatch a registration event that is picked up by the\n // the nylas-provider component.\n const registeredComponent: RegisteredComponent<H, B> = {\n element: host,\n ...config,\n eventToProps: eventToPropsMap,\n };\n const event = createComponentEvent(target, registeredComponent, config.registrationEventName);\n if (host.dispatchEvent(event)) {\n debug(`[${componentName}] Component ${componentName} successfully fired registration event`);\n }\n\n return origionalResult;\n };\n\n target.disconnectedCallback = function () {\n const origionalResult = origionalDisconnectCallback?.call(this);\n const host = getElement(this);\n\n // We use our host element to dispatch a registration event that is picked up by the\n // the nylas-provider component.\n const registeredComponent: RegisteredComponent<H, B> = {\n element: host,\n ...config,\n eventToProps: eventToPropsMap,\n };\n const event = unregisterComponentEvent(target, registeredComponent, config.unregistrationEventName);\n if (host.dispatchEvent(event)) {\n debug(`[${componentName}] Component ${componentName} successfully fired unregistration event`);\n }\n\n return origionalResult;\n };\n }\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-3e18e0b2.js';
2
2
  import { c as createStore } from './index-11d12497.js';
3
3
 
4
4
  var ErrorCategory;
@@ -430,4 +430,4 @@ function CreateNylasSchedulerStore(defaultState = {}) {
430
430
 
431
431
  export { CreateNylasSchedulerStore as C, ErrorCategory as E, NylaSchedulerAPIConnector as N };
432
432
 
433
- //# sourceMappingURL=scheduler-store-66c2168c.js.map
433
+ //# sourceMappingURL=scheduler-store-e62b2146.js.map
@@ -1 +1 @@
1
- {"file":"scheduler-store-a175fc3e.js","mappings":";;;IAAY;AAAZ,WAAY,aAAa;IACvB,wCAAuB,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U,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 } 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 ...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 /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n const today = new Date();\n // Set reschedule booking id\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n // Reset store state\n this.schedulerStore.set('selectedTimeslot', null);\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\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 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 /**\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 * 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 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}\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
+ {"file":"scheduler-store-e62b2146.js","mappings":";;;IAAY;AAAZ,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,4BAAW,CAAA;IACX,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAQD,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qEAA+C,CAAA;IAC/C,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,mEAA6C,CAAA;IAC7C,qDAA+B,CAAA;IAC/B,+DAAyC,CAAA;IACzC,2DAAqC,CAAA;IACrC,2DAAqC,CAAA;AACvC,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,QAS7B;AAED,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,mDAAmC,CAAA;IACnC,+CAA+B,CAAA;IAC/B,iDAAiC,CAAA;IACjC,+DAA+C,CAAA;IAC/C,iEAAiD,CAAA;AACnD,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB;MAEY,MAAM;IAAnB;QACE,cAAS,GAAG,CAAC,MAAc;YACzB,MAAM,QAAQ,GAAG,aAAa,CAAC,SAAS,CAAC;YACzC,MAAM,KAAK,GAAG,GAAG,MAAM,QAAQ,CAAC;YAChC,OAAO;gBACL,qBAAqB,EAAE,CAAC,UAAkB,oCAAoC;oBAC5E,OAAO;wBACL,KAAK;wBACL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,EAAE,IAAI;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 } 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 ...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 /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n const today = new Date();\n // Set reschedule booking id\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n // Reset store state\n this.schedulerStore.set('selectedTimeslot', null);\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\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 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 /**\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 * 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 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}\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-3e18e0b2.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}";
@@ -4025,7 +4025,51 @@ function parsePreviewLink(link, config) {
4025
4025
  });
4026
4026
  return link;
4027
4027
  }
4028
+ function isNonPrintableKey(event) {
4029
+ if (event.keyCode < 48 ||
4030
+ (event.keyCode > 90 && event.keyCode < 96) ||
4031
+ (event.keyCode > 111 && event.keyCode < 186) ||
4032
+ event.keyCode > 222 ||
4033
+ event.keyCode === 32 ||
4034
+ event.keyCode === 91 ||
4035
+ event.keyCode === 92 ||
4036
+ event.keyCode === 93 ||
4037
+ (event.keyCode >= 112 && event.keyCode <= 123) ||
4038
+ (event.keyCode >= 37 && event.keyCode <= 40)) {
4039
+ return true;
4040
+ }
4041
+ if (event.ctrlKey || event.altKey || event.metaKey) {
4042
+ return true;
4043
+ }
4044
+ const shiftSpecialChars = [
4045
+ 48,
4046
+ 49,
4047
+ 50,
4048
+ 51,
4049
+ 52,
4050
+ 53,
4051
+ 54,
4052
+ 55,
4053
+ 56,
4054
+ 57,
4055
+ 186,
4056
+ 187,
4057
+ 188,
4058
+ 189,
4059
+ 190,
4060
+ 191,
4061
+ 192,
4062
+ 219,
4063
+ 220,
4064
+ 221,
4065
+ 222,
4066
+ ];
4067
+ if (event.shiftKey && shiftSpecialChars.includes(event.keyCode)) {
4068
+ return false;
4069
+ }
4070
+ return false;
4071
+ }
4028
4072
 
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 };
4073
+ export { dayjs as A, autocompleteTimeFormat as B, validateTimeFormatInput as C, roundToNearest15Minutes as D, validateExactTimeFormat as E, 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, isNonPrintableKey as z };
4030
4074
 
4031
- //# sourceMappingURL=utils-73d8a928.js.map
4075
+ //# sourceMappingURL=utils-3e18e0b2.js.map