@nylas/web-elements 1.1.0-canary.15 → 1.1.0-canary.16

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 (430) hide show
  1. package/dist/cjs/add-circle-icon_2.cjs.entry.js +10 -17
  2. package/dist/cjs/add-circle-icon_2.cjs.entry.js.map +1 -1
  3. package/dist/cjs/{calendar-info-icon_25.cjs.entry.js → calendar-info-icon_27.cjs.entry.js} +161 -27
  4. package/dist/cjs/calendar-info-icon_27.cjs.entry.js.map +1 -0
  5. package/dist/cjs/google-logo-icon_4.cjs.entry.js +12 -7
  6. package/dist/cjs/google-logo-icon_4.cjs.entry.js.map +1 -1
  7. package/dist/cjs/index-7af03e3f.js +8 -16
  8. package/dist/cjs/index-c14ea8f5.js +12 -12
  9. package/dist/cjs/input-dropdown.cjs.entry.js +9 -2
  10. package/dist/cjs/input-dropdown.cjs.entry.js.map +1 -1
  11. package/dist/cjs/input-dropdown_2.cjs.entry.js +9 -2
  12. package/dist/cjs/input-dropdown_2.cjs.entry.js.map +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/nylas-additional-participants.cjs.entry.js +34 -14
  15. package/dist/cjs/nylas-additional-participants.cjs.entry.js.map +1 -1
  16. package/dist/cjs/nylas-booked-event-card_10.cjs.entry.js +2 -2
  17. package/dist/cjs/nylas-booked-event-card_10.cjs.entry.js.map +1 -1
  18. package/dist/cjs/nylas-booking-form.cjs.entry.js +2 -2
  19. package/dist/cjs/nylas-booking-form.cjs.entry.js.map +1 -1
  20. package/dist/cjs/nylas-cancellation-policy.cjs.entry.js +1 -1
  21. package/dist/cjs/nylas-custom-booking-flow.cjs.entry.js +1 -1
  22. package/dist/cjs/nylas-customize-booking-settings.cjs.entry.js +4 -4
  23. package/dist/cjs/nylas-customize-booking-settings.cjs.entry.js.map +1 -1
  24. package/dist/cjs/nylas-editor-tabs.cjs.entry.js +12 -7
  25. package/dist/cjs/nylas-editor-tabs.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nylas-event-info.cjs.entry.js +1 -1
  27. package/dist/cjs/nylas-event-limits.cjs.entry.js +1 -1
  28. package/dist/cjs/nylas-event-location.cjs.entry.js +3 -3
  29. package/dist/cjs/nylas-form-card.cjs.entry.js +1 -1
  30. package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js +1 -1
  31. package/dist/cjs/nylas-min-booking-notice.cjs.entry.js +1 -1
  32. package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js +1 -1
  33. package/dist/cjs/nylas-provider.cjs.entry.js +1 -1
  34. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +4 -2
  35. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js.map +1 -1
  36. package/dist/cjs/nylas-scheduling.cjs.entry.js +1 -1
  37. package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
  38. package/dist/cjs/nylas-time-window-picker.cjs.entry.js +1 -1
  39. package/dist/cjs/nylas-timeslot-interval.cjs.entry.js +2 -2
  40. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  41. package/dist/cjs/{scheduler-config-store-a5b7c08b.js → scheduler-config-store-0266631b.js} +2 -1
  42. package/dist/cjs/scheduler-config-store-0266631b.js.map +1 -0
  43. package/dist/cjs/{scheduler-config-store-918c20d5.js → scheduler-config-store-9f19c7a9.js} +2 -1
  44. package/dist/cjs/scheduler-config-store-9f19c7a9.js.map +1 -0
  45. package/dist/cjs/scheduler-store-0f7328f1.js.map +1 -1
  46. package/dist/cjs/scheduler-store-743ed238.js.map +1 -1
  47. package/dist/collection/components/design-system/input-dropdown/input-dropdown.js +10 -1
  48. package/dist/collection/components/design-system/input-dropdown/input-dropdown.js.map +1 -1
  49. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +2 -2
  50. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js.map +1 -1
  51. package/dist/collection/components/scheduler/nylas-cancel-booking-form/nylas-cancel-booking-form.js +1 -1
  52. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js +1 -1
  53. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +1 -1
  54. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.css +1 -0
  55. package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.css +20 -1
  56. package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js +62 -13
  57. package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js.map +1 -1
  58. package/dist/collection/components/scheduler-editor/nylas-cancellation-policy/nylas-cancellation-policy.js +1 -1
  59. package/dist/collection/components/scheduler-editor/nylas-custom-booking-flow/nylas-custom-booking-flow.js +1 -1
  60. package/dist/collection/components/scheduler-editor/nylas-customize-booking-settings/nylas-customize-booking-settings.js +5 -5
  61. package/dist/collection/components/scheduler-editor/nylas-customize-booking-settings/nylas-customize-booking-settings.js.map +1 -1
  62. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js +9 -7
  63. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js.map +1 -1
  64. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/tab-contents.js +2 -0
  65. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/tab-contents.js.map +1 -1
  66. package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js +1 -1
  67. package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js +1 -1
  68. package/dist/collection/components/scheduler-editor/nylas-event-location/nylas-event-location.js +3 -3
  69. package/dist/collection/components/scheduler-editor/nylas-form-card/nylas-form-card.js +1 -1
  70. package/dist/collection/components/scheduler-editor/nylas-limit-future-bookings/nylas-limit-future-bookings.js +1 -1
  71. package/dist/collection/components/scheduler-editor/nylas-min-booking-notice/nylas-min-booking-notice.js +1 -1
  72. package/dist/collection/components/scheduler-editor/nylas-min-cancellation-notice/nylas-min-cancellation-notice.js +1 -1
  73. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js +25 -2
  74. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js.map +1 -1
  75. package/dist/collection/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.js +1 -1
  76. package/dist/collection/components/scheduler-editor/nylas-timeslot-interval/nylas-timeslot-interval.js +2 -2
  77. package/dist/collection/stores/scheduler-config-store.js +1 -0
  78. package/dist/collection/stores/scheduler-config-store.js.map +1 -1
  79. package/dist/collection/stores/scheduler-store.js.map +1 -1
  80. package/dist/components/input-dropdown2.js +11 -3
  81. package/dist/components/input-dropdown2.js.map +1 -1
  82. package/dist/components/nylas-additional-participants.js +1 -127
  83. package/dist/components/nylas-additional-participants.js.map +1 -1
  84. package/dist/components/nylas-additional-participants2.js +164 -0
  85. package/dist/components/nylas-additional-participants2.js.map +1 -0
  86. package/dist/components/nylas-booking-form2.js +2 -2
  87. package/dist/components/nylas-booking-form2.js.map +1 -1
  88. package/dist/components/nylas-cancellation-policy2.js +1 -1
  89. package/dist/components/nylas-custom-booking-flow.js +1 -1
  90. package/dist/components/nylas-customize-booking-settings2.js +4 -4
  91. package/dist/components/nylas-customize-booking-settings2.js.map +1 -1
  92. package/dist/components/nylas-editor-tabs2.js +90 -73
  93. package/dist/components/nylas-editor-tabs2.js.map +1 -1
  94. package/dist/components/nylas-event-info2.js +1 -1
  95. package/dist/components/nylas-event-limits2.js +1 -1
  96. package/dist/components/nylas-event-location2.js +3 -3
  97. package/dist/components/nylas-form-card2.js +1 -1
  98. package/dist/components/nylas-limit-future-bookings2.js +1 -1
  99. package/dist/components/nylas-min-booking-notice2.js +1 -1
  100. package/dist/components/nylas-min-cancellation-notice2.js +1 -1
  101. package/dist/components/nylas-scheduler-editor.js +92 -77
  102. package/dist/components/nylas-scheduler-editor.js.map +1 -1
  103. package/dist/components/nylas-scheduling.js +1 -1
  104. package/dist/components/nylas-scheduling.js.map +1 -1
  105. package/dist/components/nylas-time-window-picker2.js +1 -1
  106. package/dist/components/nylas-timeslot-interval2.js +2 -2
  107. package/dist/components/people-icon.js +1 -32
  108. package/dist/components/people-icon.js.map +1 -1
  109. package/dist/components/people.js +36 -0
  110. package/dist/components/people.js.map +1 -0
  111. package/dist/components/scheduler-config-store.js +1 -0
  112. package/dist/components/scheduler-config-store.js.map +1 -1
  113. package/dist/components/scheduler-store.js.map +1 -1
  114. package/dist/esm/add-circle-icon.entry.js +1 -1
  115. package/dist/esm/add-circle-icon_2.entry.js +10 -17
  116. package/dist/esm/add-circle-icon_2.entry.js.map +1 -1
  117. package/dist/esm/archive-icon.entry.js +1 -1
  118. package/dist/esm/arrow-icon.entry.js +1 -1
  119. package/dist/esm/bold-icon.entry.js +1 -1
  120. package/dist/esm/button-component.entry.js +1 -1
  121. package/dist/esm/calendar-cancel-icon.entry.js +1 -1
  122. package/dist/esm/calendar-check-icon.entry.js +1 -1
  123. package/dist/esm/calendar-icon.entry.js +1 -1
  124. package/dist/esm/calendar-info-icon.entry.js +1 -1
  125. package/dist/esm/{calendar-info-icon_25.entry.js → calendar-info-icon_27.entry.js} +160 -28
  126. package/dist/esm/calendar-info-icon_27.entry.js.map +1 -0
  127. package/dist/esm/calendar-patterns-icon.entry.js +1 -1
  128. package/dist/esm/checkbox-component.entry.js +1 -1
  129. package/dist/esm/checkmark-circle-icon.entry.js +1 -1
  130. package/dist/esm/chevron-icon.entry.js +1 -1
  131. package/dist/esm/clock-icon.entry.js +1 -1
  132. package/dist/esm/close-icon.entry.js +1 -1
  133. package/dist/esm/document-refresh-icon.entry.js +1 -1
  134. package/dist/esm/flow-icon.entry.js +1 -1
  135. package/dist/esm/folder-icon.entry.js +1 -1
  136. package/dist/esm/forward-icon.entry.js +1 -1
  137. package/dist/esm/globe-icon.entry.js +1 -1
  138. package/dist/esm/google-logo-icon.entry.js +1 -1
  139. package/dist/esm/google-logo-icon_4.entry.js +12 -7
  140. package/dist/esm/google-logo-icon_4.entry.js.map +1 -1
  141. package/dist/esm/inbox-icon.entry.js +1 -1
  142. package/dist/esm/{index-11d12497.js → index-2c7e4f4b.js} +2 -2
  143. package/dist/esm/{index-11d12497.js.map → index-2c7e4f4b.js.map} +1 -1
  144. package/dist/esm/{index-8362ce5c.js → index-582cfc93.js} +14 -14
  145. package/dist/esm/{index-8362ce5c.js.map → index-582cfc93.js.map} +1 -1
  146. package/dist/esm/index-7cb0dd3d.js +8 -16
  147. package/dist/esm/index.js +2 -2
  148. package/dist/esm/info-icon.entry.js +1 -1
  149. package/dist/esm/input-component.entry.js +1 -1
  150. package/dist/esm/input-dropdown.entry.js +10 -3
  151. package/dist/esm/input-dropdown.entry.js.map +1 -1
  152. package/dist/esm/input-dropdown_2.entry.js +9 -2
  153. package/dist/esm/input-dropdown_2.entry.js.map +1 -1
  154. package/dist/esm/italic-icon.entry.js +1 -1
  155. package/dist/esm/loader.js +3 -3
  156. package/dist/esm/loading-icon.entry.js +1 -1
  157. package/dist/esm/location-icon.entry.js +1 -1
  158. package/dist/esm/location-off-icon.entry.js +1 -1
  159. package/dist/esm/{mailbox-store-11fa8387.js → mailbox-store-c9b2a4fd.js} +2 -2
  160. package/dist/esm/{mailbox-store-11fa8387.js.map → mailbox-store-c9b2a4fd.js.map} +1 -1
  161. package/dist/esm/microsoft-logo-icon.entry.js +1 -1
  162. package/dist/esm/multi-select-dropdown.entry.js +1 -1
  163. package/dist/esm/nylas-additional-participants.entry.js +36 -16
  164. package/dist/esm/nylas-additional-participants.entry.js.map +1 -1
  165. package/dist/esm/nylas-availability-picker.entry.js +2 -2
  166. package/dist/esm/nylas-booked-event-card.entry.js +2 -2
  167. package/dist/esm/nylas-booked-event-card_10.entry.js +2 -2
  168. package/dist/esm/nylas-booked-event-card_10.entry.js.map +1 -1
  169. package/dist/esm/nylas-booking-calendar-picker.entry.js +2 -2
  170. package/dist/esm/nylas-booking-form.entry.js +4 -4
  171. package/dist/esm/nylas-booking-form.entry.js.map +1 -1
  172. package/dist/esm/nylas-buffer-time.entry.js +2 -2
  173. package/dist/esm/nylas-calendar-picker.entry.js +2 -2
  174. package/dist/esm/nylas-cancel-booking-form.entry.js +2 -2
  175. package/dist/esm/nylas-cancellation-policy.entry.js +3 -3
  176. package/dist/esm/nylas-cancelled-event-card.entry.js +2 -2
  177. package/dist/esm/nylas-composer.entry.js +1 -1
  178. package/dist/esm/nylas-custom-booking-flow.entry.js +3 -3
  179. package/dist/esm/nylas-customize-booking-settings.entry.js +6 -6
  180. package/dist/esm/nylas-customize-booking-settings.entry.js.map +1 -1
  181. package/dist/esm/nylas-date-picker.entry.js +2 -2
  182. package/dist/esm/nylas-editor-tabs.entry.js +14 -9
  183. package/dist/esm/nylas-editor-tabs.entry.js.map +1 -1
  184. package/dist/esm/nylas-event-description.entry.js +2 -2
  185. package/dist/esm/nylas-event-duration.entry.js +2 -2
  186. package/dist/esm/nylas-event-info.entry.js +3 -3
  187. package/dist/esm/nylas-event-limits.entry.js +3 -3
  188. package/dist/esm/nylas-event-location.entry.js +5 -5
  189. package/dist/esm/nylas-event-title.entry.js +2 -2
  190. package/dist/esm/nylas-form-card.entry.js +3 -3
  191. package/dist/esm/nylas-if-state.entry.js +2 -2
  192. package/dist/esm/nylas-limit-future-bookings.entry.js +3 -3
  193. package/dist/esm/nylas-list-configurations.entry.js +2 -2
  194. package/dist/esm/nylas-list-folders.entry.js +2 -2
  195. package/dist/esm/nylas-list-threads.entry.js +2 -2
  196. package/dist/esm/nylas-locale-switch.entry.js +2 -2
  197. package/dist/esm/nylas-login.entry.js +2 -2
  198. package/dist/esm/nylas-logo.entry.js +1 -1
  199. package/dist/esm/nylas-mailbox-pagination.entry.js +2 -2
  200. package/dist/esm/nylas-mailbox-toolbar-button.entry.js +2 -2
  201. package/dist/esm/nylas-mailbox.entry.js +3 -3
  202. package/dist/esm/nylas-min-booking-notice.entry.js +3 -3
  203. package/dist/esm/nylas-min-cancellation-notice.entry.js +3 -3
  204. package/dist/esm/nylas-notification.entry.js +1 -1
  205. package/dist/esm/nylas-provider.entry.js +5 -5
  206. package/dist/esm/nylas-scheduler-editor.entry.js +6 -4
  207. package/dist/esm/nylas-scheduler-editor.entry.js.map +1 -1
  208. package/dist/esm/nylas-scheduling.entry.js +4 -4
  209. package/dist/esm/nylas-scheduling.entry.js.map +1 -1
  210. package/dist/esm/nylas-selected-event-card.entry.js +2 -2
  211. package/dist/esm/nylas-summarize-message-button.entry.js +2 -2
  212. package/dist/esm/nylas-threads-refresh.entry.js +2 -2
  213. package/dist/esm/nylas-threads-search.entry.js +2 -2
  214. package/dist/esm/nylas-time-window-picker.entry.js +2 -2
  215. package/dist/esm/nylas-timeslot-interval.entry.js +4 -4
  216. package/dist/esm/nylas-timeslot-picker.entry.js +2 -2
  217. package/dist/esm/nylas-view-email.entry.js +1 -1
  218. package/dist/esm/nylas-view-thread.entry.js +2 -2
  219. package/dist/esm/nylas-web-elements.js +3 -3
  220. package/dist/esm/people-icon.entry.js +1 -1
  221. package/dist/esm/person-icon.entry.js +1 -1
  222. package/dist/esm/play-icon.entry.js +1 -1
  223. package/dist/esm/radio-button-group.entry.js +1 -1
  224. package/dist/esm/refresh-icon.entry.js +1 -1
  225. package/dist/esm/{register-component-8e4e394f.js → register-component-6ae95538.js} +2 -2
  226. package/dist/esm/{register-component-8e4e394f.js.map → register-component-6ae95538.js.map} +1 -1
  227. package/dist/esm/reply-all-icon.entry.js +1 -1
  228. package/dist/esm/reply-icon.entry.js +1 -1
  229. package/dist/esm/{scheduler-config-store-ec3b6190.js → scheduler-config-store-4a50a03d.js} +2 -1
  230. package/dist/esm/scheduler-config-store-4a50a03d.js.map +1 -0
  231. package/dist/{nylas-web-elements/scheduler-config-store-8ccc8dc7.js → esm/scheduler-config-store-f20845ad.js} +3 -2
  232. package/dist/esm/scheduler-config-store-f20845ad.js.map +1 -0
  233. package/dist/{nylas-web-elements/scheduler-store-c3af2560.js → esm/scheduler-store-17f7f1c8.js} +2 -2
  234. package/dist/esm/{scheduler-store-c3af2560.js.map → scheduler-store-17f7f1c8.js.map} +1 -1
  235. package/dist/esm/scheduler-store-f02ce045.js.map +1 -1
  236. package/dist/esm/search-icon.entry.js +1 -1
  237. package/dist/esm/select-dropdown.entry.js +1 -1
  238. package/dist/esm/sent-icon.entry.js +1 -1
  239. package/dist/esm/spam-icon.entry.js +1 -1
  240. package/dist/esm/star-icon.entry.js +1 -1
  241. package/dist/esm/stop-icon.entry.js +1 -1
  242. package/dist/esm/textarea-component.entry.js +1 -1
  243. package/dist/esm/time-period-selector.entry.js +1 -1
  244. package/dist/esm/toggle-switch.entry.js +1 -1
  245. package/dist/esm/tooltip-component.entry.js +1 -1
  246. package/dist/esm/translate-icon.entry.js +1 -1
  247. package/dist/esm/trash-icon.entry.js +1 -1
  248. package/dist/esm/underline-icon.entry.js +1 -1
  249. package/dist/esm/warning-icon.entry.js +1 -1
  250. package/dist/nylas-web-elements/add-circle-icon.entry.js +1 -1
  251. package/dist/nylas-web-elements/archive-icon.entry.js +1 -1
  252. package/dist/nylas-web-elements/arrow-icon.entry.js +1 -1
  253. package/dist/nylas-web-elements/bold-icon.entry.js +1 -1
  254. package/dist/nylas-web-elements/button-component.entry.js +1 -1
  255. package/dist/nylas-web-elements/calendar-cancel-icon.entry.js +1 -1
  256. package/dist/nylas-web-elements/calendar-check-icon.entry.js +1 -1
  257. package/dist/nylas-web-elements/calendar-icon.entry.js +1 -1
  258. package/dist/nylas-web-elements/calendar-info-icon.entry.js +1 -1
  259. package/dist/nylas-web-elements/calendar-patterns-icon.entry.js +1 -1
  260. package/dist/nylas-web-elements/checkbox-component.entry.js +1 -1
  261. package/dist/nylas-web-elements/checkmark-circle-icon.entry.js +1 -1
  262. package/dist/nylas-web-elements/chevron-icon.entry.js +1 -1
  263. package/dist/nylas-web-elements/clock-icon.entry.js +1 -1
  264. package/dist/nylas-web-elements/close-icon.entry.js +1 -1
  265. package/dist/nylas-web-elements/document-refresh-icon.entry.js +1 -1
  266. package/dist/nylas-web-elements/flow-icon.entry.js +1 -1
  267. package/dist/nylas-web-elements/folder-icon.entry.js +1 -1
  268. package/dist/nylas-web-elements/forward-icon.entry.js +1 -1
  269. package/dist/nylas-web-elements/globe-icon.entry.js +1 -1
  270. package/dist/nylas-web-elements/google-logo-icon.entry.js +1 -1
  271. package/dist/nylas-web-elements/inbox-icon.entry.js +1 -1
  272. package/dist/nylas-web-elements/{index-11d12497.js → index-2c7e4f4b.js} +2 -2
  273. package/dist/nylas-web-elements/{index-11d12497.js.map → index-2c7e4f4b.js.map} +1 -1
  274. package/dist/nylas-web-elements/{index-8362ce5c.js → index-582cfc93.js} +2 -2
  275. package/dist/nylas-web-elements/{index-8362ce5c.js.map → index-582cfc93.js.map} +1 -1
  276. package/dist/nylas-web-elements/index.esm.js +2 -2
  277. package/dist/nylas-web-elements/info-icon.entry.js +1 -1
  278. package/dist/nylas-web-elements/input-component.entry.js +1 -1
  279. package/dist/nylas-web-elements/input-dropdown.entry.js +10 -3
  280. package/dist/nylas-web-elements/input-dropdown.entry.js.map +1 -1
  281. package/dist/nylas-web-elements/italic-icon.entry.js +1 -1
  282. package/dist/nylas-web-elements/loading-icon.entry.js +1 -1
  283. package/dist/nylas-web-elements/location-icon.entry.js +1 -1
  284. package/dist/nylas-web-elements/location-off-icon.entry.js +1 -1
  285. package/dist/nylas-web-elements/{mailbox-store-11fa8387.js → mailbox-store-c9b2a4fd.js} +2 -2
  286. package/dist/nylas-web-elements/{mailbox-store-11fa8387.js.map → mailbox-store-c9b2a4fd.js.map} +1 -1
  287. package/dist/nylas-web-elements/microsoft-logo-icon.entry.js +1 -1
  288. package/dist/nylas-web-elements/multi-select-dropdown.entry.js +1 -1
  289. package/dist/nylas-web-elements/nylas-additional-participants.entry.js +36 -16
  290. package/dist/nylas-web-elements/nylas-additional-participants.entry.js.map +1 -1
  291. package/dist/nylas-web-elements/nylas-availability-picker.entry.js +2 -2
  292. package/dist/nylas-web-elements/nylas-booked-event-card.entry.js +2 -2
  293. package/dist/nylas-web-elements/nylas-booking-calendar-picker.entry.js +2 -2
  294. package/dist/nylas-web-elements/nylas-booking-form.entry.js +4 -4
  295. package/dist/nylas-web-elements/nylas-booking-form.entry.js.map +1 -1
  296. package/dist/nylas-web-elements/nylas-buffer-time.entry.js +2 -2
  297. package/dist/nylas-web-elements/nylas-calendar-picker.entry.js +2 -2
  298. package/dist/nylas-web-elements/nylas-cancel-booking-form.entry.js +2 -2
  299. package/dist/nylas-web-elements/nylas-cancellation-policy.entry.js +3 -3
  300. package/dist/nylas-web-elements/nylas-cancelled-event-card.entry.js +2 -2
  301. package/dist/nylas-web-elements/nylas-composer.entry.js +1 -1
  302. package/dist/nylas-web-elements/nylas-custom-booking-flow.entry.js +3 -3
  303. package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.js +6 -6
  304. package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.js.map +1 -1
  305. package/dist/nylas-web-elements/nylas-date-picker.entry.js +2 -2
  306. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +14 -9
  307. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js.map +1 -1
  308. package/dist/nylas-web-elements/nylas-event-description.entry.js +2 -2
  309. package/dist/nylas-web-elements/nylas-event-duration.entry.js +2 -2
  310. package/dist/nylas-web-elements/nylas-event-info.entry.js +3 -3
  311. package/dist/nylas-web-elements/nylas-event-limits.entry.js +3 -3
  312. package/dist/nylas-web-elements/nylas-event-location.entry.js +5 -5
  313. package/dist/nylas-web-elements/nylas-event-title.entry.js +2 -2
  314. package/dist/nylas-web-elements/nylas-form-card.entry.js +3 -3
  315. package/dist/nylas-web-elements/nylas-if-state.entry.js +2 -2
  316. package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js +3 -3
  317. package/dist/nylas-web-elements/nylas-list-configurations.entry.js +2 -2
  318. package/dist/nylas-web-elements/nylas-list-folders.entry.js +2 -2
  319. package/dist/nylas-web-elements/nylas-list-threads.entry.js +2 -2
  320. package/dist/nylas-web-elements/nylas-locale-switch.entry.js +2 -2
  321. package/dist/nylas-web-elements/nylas-login.entry.js +2 -2
  322. package/dist/nylas-web-elements/nylas-logo.entry.js +1 -1
  323. package/dist/nylas-web-elements/nylas-mailbox-pagination.entry.js +2 -2
  324. package/dist/nylas-web-elements/nylas-mailbox-toolbar-button.entry.js +2 -2
  325. package/dist/nylas-web-elements/nylas-mailbox.entry.js +3 -3
  326. package/dist/nylas-web-elements/nylas-min-booking-notice.entry.js +3 -3
  327. package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js +3 -3
  328. package/dist/nylas-web-elements/nylas-notification.entry.js +1 -1
  329. package/dist/nylas-web-elements/nylas-provider.entry.js +5 -5
  330. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +6 -4
  331. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js.map +1 -1
  332. package/dist/nylas-web-elements/nylas-scheduling.entry.js +4 -4
  333. package/dist/nylas-web-elements/nylas-scheduling.entry.js.map +1 -1
  334. package/dist/nylas-web-elements/nylas-selected-event-card.entry.js +2 -2
  335. package/dist/nylas-web-elements/nylas-summarize-message-button.entry.js +2 -2
  336. package/dist/nylas-web-elements/nylas-threads-refresh.entry.js +2 -2
  337. package/dist/nylas-web-elements/nylas-threads-search.entry.js +2 -2
  338. package/dist/nylas-web-elements/nylas-time-window-picker.entry.js +2 -2
  339. package/dist/nylas-web-elements/nylas-timeslot-interval.entry.js +4 -4
  340. package/dist/nylas-web-elements/nylas-timeslot-picker.entry.js +2 -2
  341. package/dist/nylas-web-elements/nylas-view-email.entry.js +1 -1
  342. package/dist/nylas-web-elements/nylas-view-thread.entry.js +2 -2
  343. package/dist/nylas-web-elements/nylas-web-elements.esm.js +3 -3
  344. package/dist/nylas-web-elements/p-05833164.entry.js +2 -0
  345. package/dist/nylas-web-elements/p-05833164.entry.js.map +1 -0
  346. package/dist/nylas-web-elements/{p-a804616a.entry.js → p-09fec39c.entry.js} +2 -2
  347. package/dist/nylas-web-elements/{p-df2b34ee.entry.js → p-13b003b5.entry.js} +2 -2
  348. package/dist/nylas-web-elements/p-29938263.js +2 -0
  349. package/dist/nylas-web-elements/p-29938263.js.map +1 -0
  350. package/dist/nylas-web-elements/{p-afd34a25.entry.js → p-2f656fb3.entry.js} +3 -3
  351. package/dist/nylas-web-elements/p-2f656fb3.entry.js.map +1 -0
  352. package/dist/nylas-web-elements/p-427548f5.entry.js +2 -0
  353. package/dist/nylas-web-elements/p-427548f5.entry.js.map +1 -0
  354. package/dist/nylas-web-elements/p-470536e0.entry.js +2 -0
  355. package/dist/nylas-web-elements/p-470536e0.entry.js.map +1 -0
  356. package/dist/nylas-web-elements/p-4f548e66.entry.js +2 -0
  357. package/dist/nylas-web-elements/p-4f548e66.entry.js.map +1 -0
  358. package/dist/nylas-web-elements/p-823c8aa2.js.map +1 -1
  359. package/dist/nylas-web-elements/p-96418bc6.entry.js +2 -0
  360. package/dist/nylas-web-elements/p-96418bc6.entry.js.map +1 -0
  361. package/dist/nylas-web-elements/p-9acfea5f.entry.js +2 -0
  362. package/dist/nylas-web-elements/p-9acfea5f.entry.js.map +1 -0
  363. package/dist/nylas-web-elements/{p-84529d9b.entry.js → p-b27e34a9.entry.js} +2 -2
  364. package/dist/nylas-web-elements/p-efd5b80a.entry.js +2 -0
  365. package/dist/nylas-web-elements/p-efd5b80a.entry.js.map +1 -0
  366. package/dist/nylas-web-elements/people-icon.entry.js +1 -1
  367. package/dist/nylas-web-elements/person-icon.entry.js +1 -1
  368. package/dist/nylas-web-elements/play-icon.entry.js +1 -1
  369. package/dist/nylas-web-elements/radio-button-group.entry.js +1 -1
  370. package/dist/nylas-web-elements/refresh-icon.entry.js +1 -1
  371. package/dist/nylas-web-elements/{register-component-8e4e394f.js → register-component-6ae95538.js} +2 -2
  372. package/dist/nylas-web-elements/{register-component-8e4e394f.js.map → register-component-6ae95538.js.map} +1 -1
  373. package/dist/nylas-web-elements/reply-all-icon.entry.js +1 -1
  374. package/dist/nylas-web-elements/reply-icon.entry.js +1 -1
  375. package/dist/{esm/scheduler-config-store-8ccc8dc7.js → nylas-web-elements/scheduler-config-store-f20845ad.js} +3 -2
  376. package/dist/nylas-web-elements/scheduler-config-store-f20845ad.js.map +1 -0
  377. package/dist/{esm/scheduler-store-c3af2560.js → nylas-web-elements/scheduler-store-17f7f1c8.js} +2 -2
  378. package/dist/nylas-web-elements/{scheduler-store-c3af2560.js.map → scheduler-store-17f7f1c8.js.map} +1 -1
  379. package/dist/nylas-web-elements/search-icon.entry.js +1 -1
  380. package/dist/nylas-web-elements/select-dropdown.entry.js +1 -1
  381. package/dist/nylas-web-elements/sent-icon.entry.js +1 -1
  382. package/dist/nylas-web-elements/spam-icon.entry.js +1 -1
  383. package/dist/nylas-web-elements/star-icon.entry.js +1 -1
  384. package/dist/nylas-web-elements/stop-icon.entry.js +1 -1
  385. package/dist/nylas-web-elements/textarea-component.entry.js +1 -1
  386. package/dist/nylas-web-elements/time-period-selector.entry.js +1 -1
  387. package/dist/nylas-web-elements/toggle-switch.entry.js +1 -1
  388. package/dist/nylas-web-elements/tooltip-component.entry.js +1 -1
  389. package/dist/nylas-web-elements/translate-icon.entry.js +1 -1
  390. package/dist/nylas-web-elements/trash-icon.entry.js +1 -1
  391. package/dist/nylas-web-elements/underline-icon.entry.js +1 -1
  392. package/dist/nylas-web-elements/warning-icon.entry.js +1 -1
  393. package/dist/types/components/design-system/input-dropdown/input-dropdown.d.ts +1 -0
  394. package/dist/types/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.d.ts +11 -1
  395. package/dist/types/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.d.ts +2 -0
  396. package/dist/types/components.d.ts +12 -2
  397. package/dist/types/stores/scheduler-config-store.d.ts +2 -1
  398. package/dist/types/stores/scheduler-store.d.ts +1 -1
  399. package/package.json +2 -2
  400. package/dist/cjs/calendar-info-icon_25.cjs.entry.js.map +0 -1
  401. package/dist/cjs/scheduler-config-store-918c20d5.js.map +0 -1
  402. package/dist/cjs/scheduler-config-store-a5b7c08b.js.map +0 -1
  403. package/dist/esm/calendar-info-icon_25.entry.js.map +0 -1
  404. package/dist/esm/scheduler-config-store-8ccc8dc7.js.map +0 -1
  405. package/dist/esm/scheduler-config-store-ec3b6190.js.map +0 -1
  406. package/dist/nylas-web-elements/p-155942d0.entry.js +0 -2
  407. package/dist/nylas-web-elements/p-155942d0.entry.js.map +0 -1
  408. package/dist/nylas-web-elements/p-237d2b4e.entry.js +0 -2
  409. package/dist/nylas-web-elements/p-237d2b4e.entry.js.map +0 -1
  410. package/dist/nylas-web-elements/p-2e813dd0.entry.js +0 -2
  411. package/dist/nylas-web-elements/p-2e813dd0.entry.js.map +0 -1
  412. package/dist/nylas-web-elements/p-35b66ab6.entry.js +0 -2
  413. package/dist/nylas-web-elements/p-35b66ab6.entry.js.map +0 -1
  414. package/dist/nylas-web-elements/p-6239608c.entry.js +0 -2
  415. package/dist/nylas-web-elements/p-6239608c.entry.js.map +0 -1
  416. package/dist/nylas-web-elements/p-86895fc4.entry.js +0 -2
  417. package/dist/nylas-web-elements/p-86895fc4.entry.js.map +0 -1
  418. package/dist/nylas-web-elements/p-afd34a25.entry.js.map +0 -1
  419. package/dist/nylas-web-elements/p-b406bf70.entry.js +0 -2
  420. package/dist/nylas-web-elements/p-b406bf70.entry.js.map +0 -1
  421. package/dist/nylas-web-elements/p-ee91a2a0.js +0 -2
  422. package/dist/nylas-web-elements/p-ee91a2a0.js.map +0 -1
  423. package/dist/nylas-web-elements/p-f1bd124d.entry.js +0 -2
  424. package/dist/nylas-web-elements/p-f1bd124d.entry.js.map +0 -1
  425. package/dist/nylas-web-elements/p-fac4d89e.entry.js +0 -2
  426. package/dist/nylas-web-elements/p-fac4d89e.entry.js.map +0 -1
  427. package/dist/nylas-web-elements/scheduler-config-store-8ccc8dc7.js.map +0 -1
  428. /package/dist/nylas-web-elements/{p-a804616a.entry.js.map → p-09fec39c.entry.js.map} +0 -0
  429. /package/dist/nylas-web-elements/{p-df2b34ee.entry.js.map → p-13b003b5.entry.js.map} +0 -0
  430. /package/dist/nylas-web-elements/{p-84529d9b.entry.js.map → p-b27e34a9.entry.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{h as e,F as t,r as n,c as i,H as s,a}from"./p-68c2fadf.js";import{N as o,n as r}from"./p-36e3bf97.js";import{a as l,i as d,h as c}from"./p-6c11737d.js";import{N as h,C as p,E as g}from"./p-823c8aa2.js";import"./p-02aa5f03.js";import"./p-cb65c223.js";import"./p-cabb2e68.js";class f{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i){throw new Error("sessionId is required for private configs, if not config id is required for public configs")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t}init(){l("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new h({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}const u=(n,i)=>{const s=n.isLoading;const a=n.showNotification;const o=n.nylasBranding;return e(t,null,a&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},o&&e(t,null,"Powered by ",e("nylas-logo",null))))};const b=(t,n)=>e("div",{class:"message-banner"},n);const m=':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;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin-top:1rem}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:384px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:496px}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}';const y=m;const v={title:"Something went wrong...",type:r.Error,category:g.Component};const x=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.mode="app";this.defaultSchedulerState=undefined;this.sessionId=undefined;this.schedulerApiUrl="https://api.us.nylas.com";this.bookingInfo=undefined;this.rescheduleBookingRef=undefined;this.cancelBookingRef=undefined;this.configurationId=undefined;this.nylasBranding=true;this.eventOverrides={};this.isLoading=undefined;this.themeConfig=undefined;this.showNotification=true;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(undefined,{dateStyle:"full"})||"No date selected";this.refConfigId=undefined}connectedCallback(){l(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){l(`[nylas-scheduler] Component will load`);const e=this.schedulerWillLoad.emit(this.host);if(e.defaultPrevented){return}this.stores={scheduler:p({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,...this.defaultSchedulerState})};this.baseProvider=new o(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;if(this.rescheduleBookingRef){const[e,t]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}if(!this.checkIfSessionIdOrConfigIdExists()){return}const t=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new f({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,nylasSchedulerStore:t});this.init.emit(this.host);this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);if(this.themeConfig){for(const[e,t]of Object.entries(this.themeConfig)){this.host.style.setProperty(`${e}`,t)}}}async componentDidLoad(){this.baseProvider?.componentDidLoad();if(!this.checkIfSessionIdOrConfigIdExists()){return}const e=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!e||"error"in e){this.nylasSchedulerError.emit({...this.getErrorObject(e?.error)})}const t=this.baseProvider?.getStore("scheduler");const n=t?.get("configSettings")?.scheduler?.available_days_in_future;const i=t?.get("selectedTimeslot");if(i&&i?.start_time){if(!this.isTimeslotValid(i)){return}if(t?.get("showBookingForm")){t?.set("selectedDate",i.start_time);return}}const s=t?.get("selectedDate");const a=t?.get("availability");let o;if(a&&a.length>0){return}if(!s){const e=new Date;const{startTime:t,endTime:i,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,n||30);if(e.getTime()<s*1e3){o=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,i))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:i}=this.validateAvailableDaysInFuture(s,n||30);if(s.getTime()<i*1e3){o=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!o||"error"in o){this.nylasSchedulerError.emit({...this.getErrorObject(o?.error)})}if(!s){let e=new Date;const n=t?.get("availability").find((e=>new Date(e.start_time)>new Date));if(n){e=n.start_time}t?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e)}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:a}=this.validateAvailableDaysInFuture(t,n||30);if(i<a&&t.getTime()<a*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({...this.getErrorObject(e?.error)})}}}async bookButtonClickedHandler(e){const t=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const n=t;if(n){const t=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(n,e.detail));if(!t||"error"in t){this.nylasSchedulerError.emit({...this.getErrorObject(t?.error)})}return}const i=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(e.detail));if(!i||"error"in i){this.nylasSchedulerError.emit({...this.getErrorObject(i?.error)})}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(undefined,{dateStyle:"full"}):"No date selected"}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({...this.getErrorObject(e.detail.error)})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({...this.getErrorObject(e.detail.error)})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({...this.getErrorObject(e.detail.error)})}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||v.title,category:e?.category||v.category,type:r.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId){this.nylasSchedulerError.emit({title:"No sessionId!",category:g.Component,type:r.Error,description:"Session ID is required",id:(new Date).getTime().toString(),ttl:"none"});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({title:"Invalid tiemslot!",category:g.Component,type:r.Error,description:"The selected timeslot is invalid.",id:(new Date).getTime().toString(),ttl:"none"});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const a=Math.floor(c(n,t).getTime()/1e3);const o=Math.min(a,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:o,endTimeForAvailableDaysInFuture:a}}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const a=n?.get("showBookingForm");const o=n?.get("cancelledEventInfo");const r=n?.get("cancelBookingId");const l=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const c=n?.get("nylasBranding")||this.nylasBranding;const h=n?.get("selectedDate");this.selectedDateLabel=h?h.toLocaleDateString(undefined,{dateStyle:"full"}):"No date selected";if(t&&r&&!o){return e(s,null,e(u,{nylasBranding:c,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{cancelBookingId:r,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))))}if(t&&o){return e(s,null,e(u,{nylasBranding:c,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))))}if(t&&i){return e(s,null,e(u,{nylasBranding:c,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:l,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))))}if(t&&(!i||!!d)&&!a){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(u,{nylasBranding:c,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(b,null,"Choose another time slot to reschedule your meeting"),e("div",{class:"select-date-page",part:"select-date-page"},e("div",{class:"left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",null)),e("div",{class:"right-panel"},e("h2",null,e("calendar-icon",null),e("span",{id:"selectedDate"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))))}if(t&&!i&&a){const t=this.host.querySelector('[slot="custom-booking-form"]');return e(s,null,e(u,{nylasBranding:c,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(b,null,"Choose another time slot to reschedule your meeting"),e("div",{class:"additional-data-page",part:"additional-data-page"},e("div",{class:"left-panel"},e("div",{class:"wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time"}))),e("div",{class:"right-panel"},e("nylas-booking-form",{exportparts:"nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline"},t&&e("div",{slot:"custom-booking-form"},e("slot",{name:"custom-booking-form"})))))))}return e(s,null,e("slot",null))}get host(){return a(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"]}}};x.style=y;export{x as nylas_scheduling};
2
+ //# sourceMappingURL=p-05833164.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NylasSchedulerConnector","constructor","schedulerAPIURL","nylasSchedulerStore","sessionId","configId","Error","url","URL","window","location","href","origin","this","init","debug","schedulerStore","scheduler","_schedulerAPIConnector","NylaSchedulerAPIConnector","resetStores","reset","SchedulerView","props","children","isLoading","showNotification","nylasBranding","h","Fragment","class","MessageBanner","_props","nylasSchedulingCss","NylasSchedulingStyle0","genericError","title","type","NotificationType","category","ErrorCategory","Component","NylasScheduling","Date","toLocaleDateString","undefined","dateStyle","connectedCallback","componentWillLoad","schedulerWillLoadEvent","schedulerWillLoad","emit","host","defaultPrevented","stores","CreateNylasSchedulerStore","bookingInfo","defaultSchedulerState","baseProvider","NylasBaseProvider","automaticComponentRegistration","eventOverrides","refConfigId","configurationId","rescheduleBookingRef","rescheduleConfigId","rescheduleBookingId","compactStringToUUIDs","set","bookingRefExtracted","bookingId","cancelBookingRef","cancelConfigId","cancelBookingId","checkIfSessionIdOrConfigIdExists","getStore","nylasSchedulerConnector","schedulerApiUrl","themeConfig","key","value","Object","entries","style","setProperty","componentDidLoad","settings","getUISettings","nylasSchedulerError","getErrorObject","error","availableDaysInFuture","get","available_days_in_future","selectedTimeslot","start_time","isTimeslotValid","selectedDate","availability","result","length","today","startTime","endTime","endTimeForAvailableDaysInFuture","validateAvailableDaysInFuture","getTime","getAvailability","_selectedDate","firstAvailableDate","find","timeslot","componentDisconnected","bookingInfoChanged","newVal","rescheduleBookingRefChanged","setConfigId","cancelBookingRefChanged","registerComponentHandler","event","registerComponent","detail","unregisterComponentHandler","unregisterComponent","monthChangedHandler","date","bookButtonClickedHandler","storeRescheduleId","rescheduleBooking","bookTimeslot","dateSelectedHandler","selectedDateLabel","cancelBookedEventErrorHandler","cancelBookedEventValidationErrorHandler","rescheduleBookedEventErrorHandler","getNylasSchedulerStore","getNylasSchedulerConnector","getRef","description","message","id","toString","ttl","startDate","getFullYear","getMonth","endTimeForCurrentMonth","Math","floor","addDaysToCurrentDate","min","startTimeWithOffset","render","showDefaultScheduler","mode","eventInfo","showBookingForm","cancelledEventInfo","Host","part","exportparts","timeslotPickerCTALabel","querySelector","slot","name","customTemplateSlot"],"sources":["src/connector/nylas-scheduler-connector/index.ts","src/components/scheduler/nylas-scheduling/scheduler-view.tsx","src/components/scheduler/nylas-scheduling/message-banner.tsx","src/components/scheduler/nylas-scheduling/nylas-scheduling.scss?tag=nylas-scheduling&encapsulation=shadow","src/components/scheduler/nylas-scheduling/nylas-scheduling.tsx"],"sourcesContent":["import { NylasSchedulerStoreType } from '@/stores/scheduler-store';\nimport { debug } from '@/utils/utils';\nimport { NylasSchedulerConnectorInterface } from '../connector-interface';\nimport { NylaSchedulerAPIConnector } from '../shared/api/scheduler';\n\ntype NylasSchedulerConnectorOptions = {\n schedulerAPIURL: string;\n nylasSchedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n};\n/**\n * Base class for the Nylas connector.\n */\nexport class NylasSchedulerConnector implements NylasSchedulerConnectorInterface {\n public schedulerAPIURL: string;\n public nylasSchedulerStore: NylasSchedulerStoreType;\n public sessionId: string | undefined;\n public configId: string | undefined;\n\n private _schedulerAPIConnector: NylaSchedulerAPIConnector | undefined;\n\n constructor({ schedulerAPIURL, nylasSchedulerStore, sessionId, configId }: NylasSchedulerConnectorOptions) {\n if (!schedulerAPIURL) {\n throw new Error('schedulerAPIURL is required');\n }\n\n if (!nylasSchedulerStore) {\n throw new Error('nylasSchedulerStore is required');\n }\n\n if (!sessionId && !configId) {\n throw new Error('sessionId is required for private configs, if not config id is required for public configs');\n }\n\n // If the url is only /, then we need to add the base url.\n // We assume that the base url is the same as the current url.\n if (schedulerAPIURL === '/') {\n const url = new URL(window.location.href);\n schedulerAPIURL = url.origin;\n }\n\n this.configId = configId;\n this.sessionId = sessionId;\n this.schedulerAPIURL = schedulerAPIURL;\n this.nylasSchedulerStore = nylasSchedulerStore;\n }\n\n public init() {\n debug('NylasConnector init');\n }\n\n public get schedulerStore() {\n return this.nylasSchedulerStore;\n }\n\n public get scheduler() {\n if (this._schedulerAPIConnector) {\n return this._schedulerAPIConnector;\n }\n this._schedulerAPIConnector = new NylaSchedulerAPIConnector({\n schedulerAPIURL: this.schedulerAPIURL,\n schedulerStore: this.schedulerStore,\n sessionId: this.sessionId,\n configId: this.configId,\n });\n return this._schedulerAPIConnector;\n }\n\n public resetStores() {\n this.nylasSchedulerStore.reset();\n }\n}\nexport type PublicMethods<T> = {\n [K in keyof T]: T[K] extends Function ? (string extends K ? never : K) : never;\n}[keyof T];\n\nexport type NylasSchedulerConnectorPublicMethods = PublicMethods<NylasSchedulerConnector>;\n","import { Fragment, FunctionalComponent, h } from '@stencil/core';\n\nexport type SchedulerViewProps = {\n isLoading?: boolean;\n showNotification?: boolean;\n nylasBranding?: boolean;\n};\n\n/**\n * The Scheduler view component.\n */\nexport const SchedulerView: FunctionalComponent<SchedulerViewProps> = (props: SchedulerViewProps, children) => {\n const isLoading = props.isLoading;\n const showNotification = props.showNotification;\n const nylasBranding = props.nylasBranding;\n\n return (\n <Fragment>\n {showNotification && <nylas-notification></nylas-notification>}\n\n {isLoading && (\n <div class={'loading'}>\n <div class={'left'}>\n <div class={'skeleton'} />\n </div>\n <div class={'right'}>\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n </div>\n </div>\n )}\n {!isLoading && children}\n <div class={'footer'}>\n {nylasBranding && (\n <Fragment>\n Powered by&nbsp;\n <nylas-logo />\n </Fragment>\n )}\n </div>\n </Fragment>\n );\n};\n","import { FunctionalComponent, h } from '@stencil/core';\n\nexport type HeaderBannerProps = {};\n\nexport const MessageBanner: FunctionalComponent<HeaderBannerProps> = (_props: HeaderBannerProps, children) => <div class=\"message-banner\">{children}</div>;\n","@import '../../../common/styles/variables.scss';\n\n:host {\n display: flex;\n flex-direction: column;\n overflow: visible;\n border-radius: var(--nylas-border-radius-2x);\n width: fit-content;\n @media #{$mobile} {\n width: auto;\n min-width: 325px;\n }\n background: var(--nylas-base-0);\n position: relative;\n box-shadow:\n 0px 4px 6px -2px rgba(0, 0, 0, 0.05),\n 0px 10px 15px -3px rgba(0, 0, 0, 0.1);\n @include default-css-variables;\n font-family: var(--nylas-font-family);\n font-optical-sizing: auto;\n font-style: normal;\n font-variation-settings: 'slnt' 0;\n}\n\n:root {\n font-family: inherit;\n}\n\n.error {\n padding: 8rem 12rem;\n color: var(--nylas-base-0);\n background-color: var(--nylas-error);\n margin: 1.5rem;\n border-radius: var(--nylas-border-radius-2x);\n}\n\n.message-banner {\n text-align: right;\n color: var(--nylas-base-800);\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-color-primary-200);\n margin-top: 1rem;\n}\n\n.loading {\n margin: 1.5rem;\n display: flex;\n gap: 1rem;\n\n .skeleton {\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite;\n &:nth-child(2) {\n animation-delay: -100ms;\n }\n &:nth-child(3) {\n animation-delay: -200ms;\n }\n &:nth-child(4) {\n animation-delay: -300ms;\n }\n &:nth-child(5) {\n animation-delay: -400ms;\n }\n }\n\n .left .skeleton {\n height: 100%;\n width: 400px;\n }\n .right .skeleton {\n height: 5rem;\n width: 300px;\n margin-bottom: 1rem;\n &:last-child {\n margin-bottom: 0;\n }\n }\n}\n\n@keyframes pulsate {\n 0% {\n background-color: var(--nylas-base-50);\n }\n 50% {\n background-color: var(--nylas-base-100);\n }\n 100% {\n background-color: var(--nylas-base-50);\n }\n}\n\n.select-date-page,\n.additional-data-page,\n.booked-event-page,\n.cancelled-event-page,\n.cancel-flow-page {\n border-top-left-radius: var(--nylas-border-radius-2x);\n border-top-right-radius: var(--nylas-border-radius-2x);\n}\n\n.select-date-page,\n.additional-data-page {\n display: flex;\n\n @media #{$mobile} {\n flex-direction: column;\n }\n}\n\n.booked-event-page {\n background-color: var(--nylas-base-50);\n}\n\n.cancelled-event-page,\n.cancel-flow-page {\n padding: 1rem;\n height: 496px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.booked-event-page,\n.cancelled-event-page,\n.cancel-flow-page {\n min-width: 784px;\n @media #{$mobile} {\n min-width: 90%;\n }\n background: var(--nylas-base-50);\n}\n\n.left-panel {\n display: flex;\n flex-direction: column;\n min-width: 384px;\n border-top-left-radius: inherit;\n background: var(--nylas-base-0);\n position: relative;\n padding: 1rem 0 0 0;\n height: 624px;\n @media #{$mobile} {\n border-top-right-radius: inherit;\n min-width: unset;\n height: auto;\n }\n}\n\n.select-date-page .left-panel {\n @media #{$mobile} {\n padding: 0.5rem 4px 0;\n height: 624px;\n }\n}\n\n.border {\n margin-left: -20px; // Offset left padding\n margin-right: -20px; // Offset right padding\n border-top-width: 1px;\n height: 0.5px;\n background-color: var(--nylas-base-200);\n @media #{$mobile} {\n display: none;\n }\n}\n\n.right-panel {\n min-width: 360px;\n width: 360px;\n background-color: var(--nylas-base-50);\n height: 624px;\n padding-top: 16px;\n border-left: 1px solid var(--nylas-base-200);\n border-top-right-radius: inherit;\n @media #{$mobile} {\n border-top-right-radius: 0px;\n width: inherit;\n min-width: unset;\n height: auto;\n }\n h2 {\n display: flex;\n margin: 0;\n height: 48px;\n gap: 0.5rem;\n justify-content: center;\n align-items: center;\n width: auto;\n font-size: 1.125rem;\n line-height: 1.5rem;\n font-weight: 500;\n text-align: center;\n color: var(--nylas-base-800);\n }\n}\n\n.additional-data-page {\n .left-panel {\n background-color: var(--nylas-base-50);\n }\n .right-panel {\n background-color: var(--nylas-base-0);\n }\n}\n\nnylas-selected-event-card {\n height: 496px;\n\n @media #{$mobile} {\n height: 250px;\n }\n}\n\n.footer {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n padding: 16px;\n font-size: 14px;\n font-weight: 300;\n color: var(--nylas-base-500);\n border-top: 1px solid var(--nylas-base-200);\n min-height: 24px;\n svg {\n fill: var(--nylas-base-500);\n }\n}\n\n.footer svg {\n margin-top: 1px;\n}\n\nnylas-selected-event-card::part(nsec__timezone) {\n position: absolute;\n bottom: 0;\n}\n\nnylas-notification {\n margin: 1.5rem;\n width: -webkit-fill-available;\n position: absolute;\n}\n\nnylas-locale-switch {\n position: absolute;\n padding: 18px 20px;\n bottom: 0;\n width: -webkit-fill-available;\n border-top: 1px solid var(--nylas-base-200);\n @media #{$mobile} {\n height: auto;\n }\n}\n\nnylas-date-picker {\n padding: 0 20px;\n}\n","import { NylasBaseProvider } from '@/common/abstract-provider';\nimport { RegisteredComponent } from '@/common/register-component';\nimport type { SchedulerEventOverride } from '@/common/component-types';\nimport { NylasSchedulerConnector } from '@/connector/nylas-scheduler-connector';\nimport { CreateNylasSchedulerStore, NylasSchedulerStoreState, NylasSchedulerStoreType } from '@/stores/scheduler-store';\nimport { NylasSchedulerBookingData, ThemeConfig, Notification, NotificationType, NylasSchedulerErrorResponse, Timeslot } from '@nylas/core';\nimport { Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { addDaysToCurrentDate, compactStringToUUIDs, debug } from '@/utils/utils';\nimport { SchedulerView } from './scheduler-view';\nimport { ErrorCategory } from '@/connector/nylas-scheduler-connector/errors';\nimport { MessageBanner } from './message-banner';\n\nconst genericError = { title: 'Something went wrong...', type: NotificationType.Error, category: ErrorCategory.Component };\n\n/**\n * The `nylas-scheduling` component is used to display the Nylas Scheduling UI.\n *\n * @slot custom-booking-form - This slot is used to pass a custom booking form to the Nylas Scheduling component.\n * @slot timeslot-picker-cta-label - This slot is used to pass a custom label to the timeslot picker CTA. The default label is \"Next\".\n *\n * @part ndp - [nylas-date-picker] The date picker host.\n * @part ndp__month-header - [nylas-date-picker] The month header.\n * @part ndp__month-button - [nylas-date-picker] The month button.\n * @part ndp__day - [nylas-date-picker] The day.\n * @part ndp__date - [nylas-date-picker] The date.\n * @part ndp__date--selected - [nylas-date-picker] The selected date.\n * @part ndp__date--current-day - [nylas-date-picker] The current day.\n * @part ndp__date--current-month - [nylas-date-picker] The dates in the current month.\n * @part ntp - [nylas-timeslot-picker] The timeslot picker component.\n * @part ntp__timeslot - [nylas-timeslot-picker] The timeslot button.\n * @part ntp__timeslot--selected - [nylas-timeslot-picker] The selected timeslot button.\n * @part ntp__button-primary - [nylas-timeslot-picker] The timeslot picker CTA.\n * @part nsec - [nylas-selected-event-card] The selected event card component.\n * @part nsec__card - [nylas-selected-event-card] The card component.\n * @part nsec__icon - [nylas-selected-event-card] The calendar icon.\n * @part nsec__date - [nylas-selected-event-card] The date selected.\n * @part nsec__time - [nylas-selected-event-card] The timeslot selected.\n * @part nbf - [nylas-booking-form] The booking form host.\n * @part nbf__input-label - [nylas-booking-form] The input label.\n * @part nbf__input-textfield - [nylas-booking-form] The input textfield.\n * @part nbf__button-ghost - [nylas-booking-form] The ghost button for adding guests.\n * @part nbf__button-primary - [nylas-booking-form] The primary button for booking.\n * @part nbf__button-outline - [nylas-booking-form] The outline button for canceling.\n * @part ncec - [nylas-cancelled-event-card] The cancelled event card host.\n * @part ncec__icon - [nylas-cancelled-event-card] The calendar icon.\n * @part ncec__title - [nylas-cancelled-event-card] The title of the cancelled event card.\n * @part ncec__description - [nylas-cancelled-event-card] The description of the cancelled event card.\n * @part ncec__button-outline - [nylas-cancelled-event-card] The close button CTA.\n * @part ncec__card - [nylas-cancelled-event-card] The cancelled event card.\n * @part nbec - [nylas-booked-event-card] The booked event card host.\n * @part nbec__card - [nylas-booked-event-card] The booked event card.\n * @part nbec__title - [nylas-booked-event-card] The title of the booked event card.\n * @part nbec__description - [nylas-booked-event-card] The description of the booked event card.\n * @part nbec__button-outline - [nylas-booked-event-card] The cancel & reschedule button CTA.\n * @part nbec__cancel-cta - [nylas-booked-event-card] The cancel button CTA.\n * @part nbec__reschedule-cta - [nylas-booked-event-card] The reschedule button CTA.\n */\n@Component({\n tag: 'nylas-scheduling',\n styleUrl: 'nylas-scheduling.scss',\n shadow: true,\n})\nexport class NylasScheduling {\n /**\n * Stores to be used by the provider.\n */\n private stores?: { scheduler: NylasSchedulerStoreType };\n\n /**\n * This is a base provide that defines the common methods and properties\n * that all providers should have.\n *\n * Because stencil does not support abstract classes, we have to use a\n * property to store the base provider instance.\n */\n private baseProvider?: NylasBaseProvider<Exclude<typeof this.stores, undefined>>;\n\n /**\n * The Nylas Scheduler Connector instance.\n * The branins of the provider. It manages data fetching and state synchronization.\n */\n private nylasSchedulerConnector?: NylasSchedulerConnector;\n\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasSchedulingElement;\n\n /**\n * This is used to set the mode for the Nylas Scheduler.\n * The mode can be either `app` or `composable`. The default mode is `app`.\n * - `app`: This mode is used to show the default Nylas Scheduler UI.\n * - `composable`: This mode is used to show the composable Nylas Scheduler UI\n * by passing the individual scheduler components as children.\n */\n @Prop() readonly mode: 'app' | 'composable' = 'app';\n\n /**\n * The default scheduler store state.\n * Used to set the initial state of the scheduler store.\n */\n @Prop({ attribute: 'default-scheduler-store-state' }) readonly defaultSchedulerState?: Partial<NylasSchedulerStoreState>;\n\n /**\n * The session ID for the Nylas Scheduler.\n * This is used to authenticate the user.\n */\n @Prop() readonly sessionId?: string;\n\n /**\n * The URL for the Nylas Scheduler API. (staging or production URL)\n */\n @Prop() readonly schedulerApiUrl: string = 'https://api.us.nylas.com';\n\n /**\n * This enables passing the bookingInfo object to the Scheduler UI for direct booking event creation.\n * When used with timeslotConfirmedHandler, it bypasses the additional data page and immediately\n * invokes the handler after booking.\n */\n @Prop() readonly bookingInfo?: NylasSchedulerBookingData;\n\n /**\n * Booking Ref required for rescheduling flow.\n */\n @Prop() readonly rescheduleBookingRef?: string;\n\n /**\n * Booking Ref required for cancelling flow.\n */\n @Prop() readonly cancelBookingRef?: string;\n\n /**\n * The config ID for the Nylas Scheduler. This should be passed in when using a public config,\n * in which case the sessionId is not required.\n */\n @Prop() readonly configurationId?: string;\n\n /**\n * This prop lets you hide the Nylas branding.\n * Default is true.\n */\n @Prop() readonly nylasBranding?: boolean = true;\n\n /**\n * This provides an easy way to override the default function of the event emitter.\n * An example of this is the `timeslotConfirmed` event. By default, this event will set the scheduler store state for `showBookingForm` to `true` which will\n * show the booking form. However, if you want to override this behavior, you can pass in the prop `eventOverride` like:\n * ```html\n * <nylas-scheduling eventOverride={{\"timeslotConfirmed\": (event, nylasConnector) => { console.log(\"Timeslot confirmed event fired!\"); } }} />\n * ```\n */\n @Prop({ attribute: 'event-overrides' }) readonly eventOverrides: SchedulerEventOverride = {};\n\n /**\n * The loading state. This is used to set the loading state for the Nylas Scheduler when fetching data.\n */\n @Prop() readonly isLoading?: boolean;\n\n /**\n * Theme config, used to automatically generate a theme with color palette and\n * CSS variables to customize the look and feel of the Nylas Scheduler.\n */\n @Prop() readonly themeConfig?: ThemeConfig;\n\n /*\n * Displays notifications for errors by default. When enabled (`true`), errors\n * automatically appear as notifications. Disabling this feature (`false`) allows\n * the parent application to capture and manage errors by listening to the\n * `nylasSchedulerError` event, providing flexibility in error handling.\n */\n @Prop() readonly showNotification?: boolean = true;\n\n /**\n * Automatically register components that have the `@RegisterComponent` decorator.\n * If this is set to false, you will need to manually register components using the\n * `registerComponent` method.\n * @default true\n */\n @State() automaticComponentRegistration: boolean = true;\n\n /**\n * The selected date label for the Nylas Scheduler.\n * This is used to set the initial date label for the Nylas Scheduler.\n */\n @State() selectedDateLabel: string = new Date().toLocaleDateString(undefined, { dateStyle: 'full' }) || 'No date selected';\n\n /**\n * The config id extracted from the rescheduleBookingRef or cancelBookingRef.\n */\n @State() refConfigId?: string;\n\n /**\n * This event is fired when the provider is initialized.\n * It can be used to set the initial state of the provider,\n * or to prevent the provider from firing some default behavior.\n */\n @Event({ cancelable: true }) init!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentWillLoad lifecycle.\n */\n @Event() schedulerWillLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentDidLoad lifecycle.\n */\n @Event() schedulerDidLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n @Event({\n eventName: 'nylasSchedulerError',\n })\n nylasSchedulerError!: EventEmitter<Notification>;\n\n /**\n * This event is triggered if either the rescheduleBookingRef or cancelBookingRef prop\n * is supplied and the component has been attached to the DOM. It emits the configurationId\n * and bookingId derived from the rescheduleBookingRef or cancelBookingRef. Subscribe to this\n * event to obtain the extracted configurationId, which is necessary to generate the sessionID\n * for configurations that are not public.\n */\n @Event() bookingRefExtracted!: EventEmitter<{ configurationId: string; bookingId: string }>;\n\n /**\n * This function is called when the component is connected to the DOM.\n * At this point in the component lifecycle, the base provider has not yet\n * been initialized. So avoid using the base provider in this method or stores\n * in this method.\n */\n connectedCallback() {\n debug(`[nylas-scheduler] connectedCallback`);\n }\n\n async componentWillLoad() {\n debug(`[nylas-scheduler] Component will load`);\n\n // Emit the schedulerWillLoad event to allow the parent application to set the initial\n // state of the provider or to prevent the provider from firing some default behavior.\n const schedulerWillLoadEvent = this.schedulerWillLoad.emit(this.host);\n if (schedulerWillLoadEvent.defaultPrevented) {\n return;\n }\n\n this.stores = {\n scheduler: CreateNylasSchedulerStore({\n bookingInfo: this.bookingInfo,\n nylasBranding: this.nylasBranding,\n ...this.defaultSchedulerState,\n }),\n };\n\n this.baseProvider = new NylasBaseProvider(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);\n\n // Set the configId to the reschedule configId if rescheduleBookingRef is provided or\n // Set the configId to the cancel configId if cancelBookingRef is provided\n this.refConfigId = this.configurationId;\n if (this.rescheduleBookingRef) {\n const [rescheduleConfigId, rescheduleBookingId] = compactStringToUUIDs(this.rescheduleBookingRef);\n this.refConfigId = rescheduleConfigId;\n this.stores.scheduler.set('rescheduleBookingId', rescheduleBookingId);\n this.bookingRefExtracted.emit({ configurationId: rescheduleConfigId, bookingId: rescheduleBookingId });\n } else if (this.cancelBookingRef) {\n const [cancelConfigId, cancelBookingId] = compactStringToUUIDs(this.cancelBookingRef);\n this.refConfigId = cancelConfigId;\n this.stores.scheduler.set('cancelBookingId', cancelBookingId);\n this.bookingRefExtracted.emit({ configurationId: cancelConfigId, bookingId: cancelBookingId });\n }\n\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n this.nylasSchedulerConnector = new NylasSchedulerConnector({\n schedulerAPIURL: this.schedulerApiUrl,\n sessionId: this.sessionId,\n configId: this.refConfigId,\n nylasSchedulerStore,\n });\n this.init.emit(this.host);\n\n this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);\n // Override theme\n if (this.themeConfig) {\n for (const [key, value] of Object.entries(this.themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n async componentDidLoad() {\n this.baseProvider?.componentDidLoad();\n\n // If sessionId is not provided, do not fetch availability\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n\n const settings = await this.nylasSchedulerConnector?.scheduler.getUISettings();\n if (!settings || 'error' in settings) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(settings?.error) });\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const availableDaysInFuture = nylasSchedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot');\n\n if (selectedTimeslot && selectedTimeslot?.start_time) {\n if (!this.isTimeslotValid(selectedTimeslot)) {\n return;\n }\n\n // If the selected timeslot is already set, do not fetch availability\n if (nylasSchedulerStore?.get('showBookingForm')) {\n nylasSchedulerStore?.set('selectedDate', selectedTimeslot.start_time);\n return;\n }\n }\n\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n const availability = nylasSchedulerStore?.get('availability');\n let result;\n\n if (availability && availability.length > 0) {\n return;\n }\n\n if (!selectedDate) {\n const today = new Date();\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(today, availableDaysInFuture || 30);\n if (today.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n } else {\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(selectedDate, availableDaysInFuture || 30);\n if (selectedDate.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n }\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(result?.error) });\n }\n\n if (!selectedDate) {\n let _selectedDate = new Date();\n const firstAvailableDate = nylasSchedulerStore?.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n nylasSchedulerStore?.set('selectedDate', _selectedDate);\n }\n }\n\n componentDisconnected() {\n this.baseProvider?.componentDisconnected();\n }\n\n @Watch('bookingInfo')\n bookingInfoChanged(newVal?: NylasSchedulerBookingData) {\n this.stores?.scheduler.set('bookingInfo', newVal);\n }\n\n @Watch('rescheduleBookingRef')\n rescheduleBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('rescheduleBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('cancelBookingRef')\n cancelBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('cancelBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n /**\n * This is a custom event handler that is used to register a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to register\n * @returns Promise<void>\n */\n @Listen('registerComponent')\n async registerComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.registerComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to unregister a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to unregister\n * @returns Promise<void>\n */\n @Listen('unregisterComponent')\n async unregisterComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.unregisterComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to refetch the availability when the month is changed.\n */\n @Listen('monthChanged')\n async monthChangedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n const availableDaysInFuture = this.nylasSchedulerConnector?.schedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(date, availableDaysInFuture || 30);\n\n if (startTime < endTimeForAvailableDaysInFuture && date.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n const result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(result?.error) });\n }\n }\n }\n\n /**\n * This is a custom event handler to book an event.\n */\n @Listen('detailsConfirmed')\n async bookButtonClickedHandler(event: CustomEvent<NylasSchedulerBookingData>) {\n const storeRescheduleId = this.nylasSchedulerConnector?.schedulerStore?.get('rescheduleBookingId');\n const rescheduleBookingId = storeRescheduleId;\n if (rescheduleBookingId) {\n const result = await this.nylasSchedulerConnector?.scheduler.rescheduleBooking(rescheduleBookingId, event.detail);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(result?.error) });\n }\n return;\n }\n const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(event.detail);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(result?.error) });\n }\n }\n\n /**\n * This is a custom event handler to update the selected date label.\n */\n @Listen('dateSelected')\n dateSelectedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n this.selectedDateLabel = date ? date.toLocaleDateString(undefined, { dateStyle: 'full' }) : 'No date selected';\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * cancel booking button is clicked on the cancel booking form.\n */\n @Listen('cancelBookedEventError')\n cancelBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(event.detail.error) });\n }\n\n @Listen('cancelBookedEventValidationError')\n cancelBookedEventValidationErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(event.detail.error) });\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * reschedule button is clicked on the booked event card.\n */\n @Listen('rescheduleBookedEventError')\n rescheduleBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ ...this.getErrorObject(event.detail.error) });\n }\n\n /**\n * This method is used to retrieve the NylasScheduler instance\n * @returns The NylasScheduler instance\n */\n @Method()\n async getNylasSchedulerStore(): Promise<NylasSchedulerStoreType | undefined> {\n return this.baseProvider?.getStore('scheduler');\n }\n\n /**\n * This method is used to retrieve the NylasConnector instance\n * @returns The NylasConnector instance\n */\n @Method()\n async getNylasSchedulerConnector() {\n return this.nylasSchedulerConnector;\n }\n\n @Method()\n async getRef() {\n return this.host;\n }\n\n private getErrorObject(error: NylasSchedulerErrorResponse['error']): Notification {\n return {\n title: error?.title || genericError.title,\n category: error?.category || genericError.category,\n type: NotificationType.Error,\n description: error?.message || '',\n id: new Date().getTime().toString(),\n ttl: 'none',\n };\n }\n\n private checkIfSessionIdOrConfigIdExists(): boolean {\n if (!this.sessionId && !this.refConfigId) {\n this.nylasSchedulerError.emit({\n title: 'No sessionId!',\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: 'Session ID is required',\n id: new Date().getTime().toString(),\n ttl: 'none',\n });\n return false;\n }\n return true;\n }\n\n private isTimeslotValid(timeslot: Timeslot): boolean {\n const selectedDate = new Date(timeslot.start_time);\n if (selectedDate < new Date()) {\n this.nylasSchedulerError.emit({\n title: 'Invalid tiemslot!',\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: 'The selected timeslot is invalid.',\n id: new Date().getTime().toString(),\n ttl: 'none',\n });\n return false;\n }\n return true;\n }\n\n private validateAvailableDaysInFuture(\n startDate: Date,\n availableDaysInFuture: number,\n ): {\n startTime: number;\n endTime: number;\n endTimeForAvailableDaysInFuture: number;\n } {\n const today = new Date();\n const startTime = new Date(startDate.getFullYear(), startDate.getMonth(), 1).getTime() / 1000;\n const endTimeForCurrentMonth = new Date(startDate.getFullYear(), startDate.getMonth() + 1, 1).getTime() / 1000;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTime = Math.min(endTimeForAvailableDaysInFuture, endTimeForCurrentMonth);\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n return { startTime: startTimeWithOffset, endTime, endTimeForAvailableDaysInFuture };\n }\n\n render() {\n const showDefaultScheduler = this.mode === 'app';\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const eventInfo = nylasSchedulerStore?.get('eventInfo');\n const showBookingForm = nylasSchedulerStore?.get('showBookingForm');\n const cancelledEventInfo = nylasSchedulerStore?.get('cancelledEventInfo');\n const cancelBookingId = nylasSchedulerStore?.get('cancelBookingId');\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot') as Timeslot;\n const rescheduleBookingId = nylasSchedulerStore?.get('rescheduleBookingId');\n const nylasBranding = nylasSchedulerStore?.get('nylasBranding') || this.nylasBranding;\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n this.selectedDateLabel = selectedDate ? selectedDate.toLocaleDateString(undefined, { dateStyle: 'full' }) : 'No date selected';\n\n if (showDefaultScheduler && cancelBookingId && !cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancel-flow-page\" part=\"cancel-flow-page\">\n <nylas-cancel-booking-form cancelBookingId={cancelBookingId} exportparts=\"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label\" />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Cancelled event card is shown when the event is cancelled\n if (showDefaultScheduler && cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancelled-event-page\" part=\"cancelled-event-page\">\n <nylas-cancelled-event-card\n cancelledEventInfo={cancelledEventInfo}\n exportparts=\"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n // Booked event card is shown when the event is booked\n if (showDefaultScheduler && eventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"booked-event-page\" part=\"booked-event-page\">\n <nylas-booked-event-card\n selectedTimeslot={selectedTimeslot}\n eventInfo={eventInfo}\n exportparts=\"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n // Date and time picker is shown when the event is not booked and no additional data is shown\n if (showDefaultScheduler && (!eventInfo || !!rescheduleBookingId) && !showBookingForm) {\n const timeslotPickerCTALabel = this.host.querySelector('[slot=\"timeslot-picker-cta-label\"]');\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>Choose another time slot to reschedule your meeting</MessageBanner>}\n <div class=\"select-date-page\" part=\"select-date-page\">\n <div class=\"left-panel\">\n <nylas-date-picker exportparts=\"ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month\"></nylas-date-picker>\n <nylas-locale-switch></nylas-locale-switch>\n </div>\n <div class=\"right-panel\">\n <h2>\n <calendar-icon></calendar-icon>\n <span id=\"selectedDate\">{this.selectedDateLabel}</span>\n </h2>\n <nylas-timeslot-picker exportparts=\"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary\">\n {timeslotPickerCTALabel && (\n <span slot=\"timeslot-picker-cta-label\">\n <slot name=\"timeslot-picker-cta-label\"></slot>\n </span>\n )}\n </nylas-timeslot-picker>\n </div>\n </div>\n </SchedulerView>\n </Host>\n );\n }\n // Additional data is shown when the time is selected, event is not booked and additional data is shown\n if (showDefaultScheduler && !eventInfo && showBookingForm) {\n // Check if a \"custom-booking-form\" slot is provided\n const customTemplateSlot = this.host.querySelector('[slot=\"custom-booking-form\"]');\n\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>Choose another time slot to reschedule your meeting</MessageBanner>}\n <div class=\"additional-data-page\" part=\"additional-data-page\">\n <div class=\"left-panel\">\n <div class=\"wrapper\">\n <nylas-selected-event-card exportparts=\"nsec, nsec__card, nsec__icon, nsec__date, nsec__time\"></nylas-selected-event-card>\n </div>\n </div>\n <div class=\"right-panel\">\n <nylas-booking-form exportparts=\"nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline\">\n {customTemplateSlot && (\n <div slot=\"custom-booking-form\">\n <slot name=\"custom-booking-form\"></slot>\n </div>\n )}\n </nylas-booking-form>\n </div>\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n return (\n <Host>\n <slot />\n </Host>\n );\n }\n}\n"],"mappings":"+RAcaA,EAQX,WAAAC,EAAYC,gBAAEA,EAAeC,oBAAEA,EAAmBC,UAAEA,EAASC,SAAEA,IAC7D,IAAKH,EAAiB,CACpB,MAAM,IAAII,MAAM,8B,CAGlB,IAAKH,EAAqB,CACxB,MAAM,IAAIG,MAAM,kC,CAGlB,IAAKF,IAAcC,EAAU,CAC3B,MAAM,IAAIC,MAAM,6F,CAKlB,GAAIJ,IAAoB,IAAK,CAC3B,MAAMK,EAAM,IAAIC,IAAIC,OAAOC,SAASC,MACpCT,EAAkBK,EAAIK,M,CAGxBC,KAAKR,SAAWA,EAChBQ,KAAKT,UAAYA,EACjBS,KAAKX,gBAAkBA,EACvBW,KAAKV,oBAAsBA,C,CAGtB,IAAAW,GACLC,EAAM,sB,CAGR,kBAAWC,GACT,OAAOH,KAAKV,mB,CAGd,aAAWc,GACT,GAAIJ,KAAKK,uBAAwB,CAC/B,OAAOL,KAAKK,sB,CAEdL,KAAKK,uBAAyB,IAAIC,EAA0B,CAC1DjB,gBAAiBW,KAAKX,gBACtBc,eAAgBH,KAAKG,eACrBZ,UAAWS,KAAKT,UAChBC,SAAUQ,KAAKR,WAEjB,OAAOQ,KAAKK,sB,CAGP,WAAAE,GACLP,KAAKV,oBAAoBkB,O,EC3DtB,MAAMC,EAAyD,CAACC,EAA2BC,KAChG,MAAMC,EAAYF,EAAME,UACxB,MAAMC,EAAmBH,EAAMG,iBAC/B,MAAMC,EAAgBJ,EAAMI,cAE5B,OACEC,EAACC,EAAQ,KACNH,GAAoBE,EAAA,2BAEpBH,GACCG,EAAA,OAAKE,MAAO,WACVF,EAAA,OAAKE,MAAO,QACVF,EAAA,OAAKE,MAAO,cAEdF,EAAA,OAAKE,MAAO,SACVF,EAAA,OAAKE,MAAO,aACZF,EAAA,OAAKE,MAAO,aACZF,EAAA,OAAKE,MAAO,aACZF,EAAA,OAAKE,MAAO,aACZF,EAAA,OAAKE,MAAO,gBAIhBL,GAAaD,EACfI,EAAA,OAAKE,MAAO,UACTH,GACCC,EAACC,EAAQ,K,cAEPD,EAAA,qBAIG,ECvCR,MAAMG,EAAwD,CAACC,EAA2BR,IAAaI,EAAA,OAAKE,MAAM,kBAAkBN,GCJ3I,MAAMS,EAAqB,2rJAC3B,MAAAC,EAAeD,ECWf,MAAME,EAAe,CAAEC,MAAO,0BAA2BC,KAAMC,EAAiBhC,MAAOiC,SAAUC,EAAcC,W,MAkDlGC,EAAe,M,wRAkCoB,M,mFAiBH,2B,iJA6BA,K,oBAU+C,G,0EAmB5C,K,oCAQK,K,wBAMd,IAAIC,MAAOC,mBAAmBC,UAAW,CAAEC,UAAW,UAAa,mB,2BA4CxG,iBAAAC,GACEhC,EAAM,sC,CAGR,uBAAMiC,GACJjC,EAAM,yCAIN,MAAMkC,EAAyBpC,KAAKqC,kBAAkBC,KAAKtC,KAAKuC,MAChE,GAAIH,EAAuBI,iBAAkB,CAC3C,M,CAGFxC,KAAKyC,OAAS,CACZrC,UAAWsC,EAA0B,CACnCC,YAAa3C,KAAK2C,YAClB7B,cAAed,KAAKc,iBACjBd,KAAK4C,yBAIZ5C,KAAK6C,aAAe,IAAIC,EAAkB9C,KAAKuC,KAAMvC,KAAKyC,OAAQzC,KAAK+C,+BAAgC/C,KAAKgD,gBAI5GhD,KAAKiD,YAAcjD,KAAKkD,gBACxB,GAAIlD,KAAKmD,qBAAsB,CAC7B,MAAOC,EAAoBC,GAAuBC,EAAqBtD,KAAKmD,sBAC5EnD,KAAKiD,YAAcG,EACnBpD,KAAKyC,OAAOrC,UAAUmD,IAAI,sBAAuBF,GACjDrD,KAAKwD,oBAAoBlB,KAAK,CAAEY,gBAAiBE,EAAoBK,UAAWJ,G,MAC3E,GAAIrD,KAAK0D,iBAAkB,CAChC,MAAOC,EAAgBC,GAAmBN,EAAqBtD,KAAK0D,kBACpE1D,KAAKiD,YAAcU,EACnB3D,KAAKyC,OAAOrC,UAAUmD,IAAI,kBAAmBK,GAC7C5D,KAAKwD,oBAAoBlB,KAAK,CAAEY,gBAAiBS,EAAgBF,UAAWG,G,CAG9E,IAAK5D,KAAK6D,mCAAoC,CAC5C,M,CAGF,MAAMvE,EAAsBU,KAAK6C,cAAciB,SAAS,aACxD9D,KAAK+D,wBAA0B,IAAI5E,EAAwB,CACzDE,gBAAiBW,KAAKgE,gBACtBzE,UAAWS,KAAKT,UAChBC,SAAUQ,KAAKiD,YACf3D,wBAEFU,KAAKC,KAAKqC,KAAKtC,KAAKuC,MAEpBvC,KAAK6C,cAAcV,kBAAkBnC,KAAK+D,yBAE1C,GAAI/D,KAAKiE,YAAa,CACpB,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQrE,KAAKiE,aAAc,CAC3DjE,KAAKuC,KAAK+B,MAAMC,YAAY,GAAGL,IAAOC,E,GAK5C,sBAAMK,GACJxE,KAAK6C,cAAc2B,mBAGnB,IAAKxE,KAAK6D,mCAAoC,CAC5C,M,CAGF,MAAMY,QAAiBzE,KAAK+D,yBAAyB3D,UAAUsE,iBAC/D,IAAKD,GAAY,UAAWA,EAAU,CACpCzE,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAeH,GAAUI,Q,CAGnE,MAAMvF,EAAsBU,KAAK6C,cAAciB,SAAS,aACxD,MAAMgB,EAAwBxF,GAAqByF,IAAI,mBAAmB3E,WAAW4E,yBACrF,MAAMC,EAAmB3F,GAAqByF,IAAI,oBAElD,GAAIE,GAAoBA,GAAkBC,WAAY,CACpD,IAAKlF,KAAKmF,gBAAgBF,GAAmB,CAC3C,M,CAIF,GAAI3F,GAAqByF,IAAI,mBAAoB,CAC/CzF,GAAqBiE,IAAI,eAAgB0B,EAAiBC,YAC1D,M,EAIJ,MAAME,EAAe9F,GAAqByF,IAAI,gBAC9C,MAAMM,EAAe/F,GAAqByF,IAAI,gBAC9C,IAAIO,EAEJ,GAAID,GAAgBA,EAAaE,OAAS,EAAG,CAC3C,M,CAGF,IAAKH,EAAc,CACjB,MAAMI,EAAQ,IAAI1D,KAClB,MAAM2D,UAAEA,EAASC,QAAEA,EAAOC,gCAAEA,GAAoC3F,KAAK4F,8BAA8BJ,EAAOV,GAAyB,IACnI,GAAIU,EAAMK,UAAYF,EAAkC,IAAM,CAC5DL,QAAetF,KAAK+D,yBAAyB3D,UAAU0F,gBAAgBL,EAAWC,G,MAE/E,CACL,MAAMD,UAAEA,EAASC,QAAEA,EAAOC,gCAAEA,GAAoC3F,KAAK4F,8BAA8BR,EAAcN,GAAyB,IAC1I,GAAIM,EAAaS,UAAYF,EAAkC,IAAM,CACnEL,QAAetF,KAAK+D,yBAAyB3D,UAAU0F,gBAAgBL,EAAWC,G,EAItF,IAAKJ,GAAU,UAAWA,EAAQ,CAChCtF,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAeU,GAAQT,Q,CAGjE,IAAKO,EAAc,CACjB,IAAIW,EAAgB,IAAIjE,KACxB,MAAMkE,EAAqB1G,GAAqByF,IAAI,gBAAgBkB,MAAMC,GAAkB,IAAIpE,KAAKoE,EAAShB,YAAc,IAAIpD,OAChI,GAAIkE,EAAoB,CACtBD,EAAgBC,EAAmBd,U,CAErC5F,GAAqBiE,IAAI,eAAgBwC,E,EAI7C,qBAAAI,GACEnG,KAAK6C,cAAcsD,uB,CAIrB,kBAAAC,CAAmBC,GACjBrG,KAAKyC,QAAQrC,UAAUmD,IAAI,cAAe8C,E,CAI5C,2BAAAC,CAA4BD,GAC1B,GAAIA,EAAQ,CACV,MAAO7G,EAAUiE,GAAaH,EAAqB+C,GACnDrG,KAAKyC,QAAQrC,UAAUmD,IAAI,sBAAuBE,GAClDzD,KAAKiD,YAAczD,EACnBQ,KAAK+D,yBAAyB3D,UAAUmG,YAAY/G,E,EAKxD,uBAAAgH,CAAwBH,GACtB,GAAIA,EAAQ,CACV,MAAO7G,EAAUiE,GAAaH,EAAqB+C,GACnDrG,KAAKyC,QAAQrC,UAAUmD,IAAI,kBAAmBE,GAC9CzD,KAAKiD,YAAczD,EACnBQ,KAAK+D,yBAAyB3D,UAAUmG,YAAY/G,E,EAWxD,8BAAMiH,CAAyBC,GAC7B1G,KAAK6C,cAAc8D,kBAAkBD,EAAME,O,CAU7C,gCAAMC,CAA2BH,GAC/B1G,KAAK6C,cAAciE,oBAAoBJ,EAAME,O,CAO/C,yBAAMG,CAAoBL,GACxB,MAAMM,EAAON,EAAME,OACnB,MAAM9B,EAAwB9E,KAAK+D,yBAAyB5D,gBAAgB4E,IAAI,mBAAmB3E,WAAW4E,yBAC9G,MAAMS,UAAEA,EAASC,QAAEA,EAAOC,gCAAEA,GAAoC3F,KAAK4F,8BAA8BoB,EAAMlC,GAAyB,IAElI,GAAIW,EAAYE,GAAmCqB,EAAKnB,UAAYF,EAAkC,IAAM,CAC1G,MAAML,QAAetF,KAAK+D,yBAAyB3D,UAAU0F,gBAAgBL,EAAWC,IAExF,IAAKJ,GAAU,UAAWA,EAAQ,CAChCtF,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAeU,GAAQT,Q,GASrE,8BAAMoC,CAAyBP,GAC7B,MAAMQ,EAAoBlH,KAAK+D,yBAAyB5D,gBAAgB4E,IAAI,uBAC5E,MAAM1B,EAAsB6D,EAC5B,GAAI7D,EAAqB,CACvB,MAAMiC,QAAetF,KAAK+D,yBAAyB3D,UAAU+G,kBAAkB9D,EAAqBqD,EAAME,SAC1G,IAAKtB,GAAU,UAAWA,EAAQ,CAChCtF,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAeU,GAAQT,Q,CAEjE,M,CAEF,MAAMS,QAAetF,KAAK+D,yBAAyB3D,UAAUgH,aAAaV,EAAME,SAChF,IAAKtB,GAAU,UAAWA,EAAQ,CAChCtF,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAeU,GAAQT,Q,EAQnE,mBAAAwC,CAAoBX,GAClB,MAAMM,EAAON,EAAME,OACnB5G,KAAKsH,kBAAoBN,EAAOA,EAAKjF,mBAAmBC,UAAW,CAAEC,UAAW,SAAY,kB,CAQ9F,6BAAAsF,CAA8Bb,GAC5B1G,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAe8B,EAAME,OAAO/B,Q,CAItE,uCAAA2C,CAAwCd,GACtC1G,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAe8B,EAAME,OAAO/B,Q,CAQtE,iCAAA4C,CAAkCf,GAChC1G,KAAK2E,oBAAoBrC,KAAK,IAAKtC,KAAK4E,eAAe8B,EAAME,OAAO/B,Q,CAQtE,4BAAM6C,GACJ,OAAO1H,KAAK6C,cAAciB,SAAS,Y,CAQrC,gCAAM6D,GACJ,OAAO3H,KAAK+D,uB,CAId,YAAM6D,GACJ,OAAO5H,KAAKuC,I,CAGN,cAAAqC,CAAeC,GACrB,MAAO,CACLtD,MAAOsD,GAAOtD,OAASD,EAAaC,MACpCG,SAAUmD,GAAOnD,UAAYJ,EAAaI,SAC1CF,KAAMC,EAAiBhC,MACvBoI,YAAahD,GAAOiD,SAAW,GAC/BC,IAAI,IAAIjG,MAAO+D,UAAUmC,WACzBC,IAAK,O,CAID,gCAAApE,GACN,IAAK7D,KAAKT,YAAcS,KAAKiD,YAAa,CACxCjD,KAAK2E,oBAAoBrC,KAAK,CAC5Bf,MAAO,gBACPG,SAAUC,EAAcC,UACxBJ,KAAMC,EAAiBhC,MACvBoI,YAAa,yBACbE,IAAI,IAAIjG,MAAO+D,UAAUmC,WACzBC,IAAK,SAEP,OAAO,K,CAET,OAAO,I,CAGD,eAAA9C,CAAgBe,GACtB,MAAMd,EAAe,IAAItD,KAAKoE,EAAShB,YACvC,GAAIE,EAAe,IAAItD,KAAQ,CAC7B9B,KAAK2E,oBAAoBrC,KAAK,CAC5Bf,MAAO,oBACPG,SAAUC,EAAcC,UACxBJ,KAAMC,EAAiBhC,MACvBoI,YAAa,oCACbE,IAAI,IAAIjG,MAAO+D,UAAUmC,WACzBC,IAAK,SAEP,OAAO,K,CAET,OAAO,I,CAGD,6BAAArC,CACNsC,EACApD,GAMA,MAAMU,EAAQ,IAAI1D,KAClB,MAAM2D,EAAY,IAAI3D,KAAKoG,EAAUC,cAAeD,EAAUE,WAAY,GAAGvC,UAAY,IACzF,MAAMwC,EAAyB,IAAIvG,KAAKoG,EAAUC,cAAeD,EAAUE,WAAa,EAAG,GAAGvC,UAAY,IAC1G,MAAMF,EAAkC2C,KAAKC,MAAMC,EAAqBhD,EAAOV,GAAuBe,UAAY,KAClH,MAAMH,EAAU4C,KAAKG,IAAI9C,EAAiC0C,GAC1D,MAAMK,EAAsBjD,EAAYD,EAAMK,UAAY,IAAOyC,KAAKC,MAAM/C,EAAMK,UAAY,KAAQJ,EACtG,MAAO,CAAEA,UAAWiD,EAAqBhD,UAASC,kC,CAGpD,MAAAgD,GACE,MAAMC,EAAuB5I,KAAK6I,OAAS,MAC3C,MAAMvJ,EAAsBU,KAAK6C,cAAciB,SAAS,aACxD,MAAMgF,EAAYxJ,GAAqByF,IAAI,aAC3C,MAAMgE,EAAkBzJ,GAAqByF,IAAI,mBACjD,MAAMiE,EAAqB1J,GAAqByF,IAAI,sBACpD,MAAMnB,EAAkBtE,GAAqByF,IAAI,mBACjD,MAAME,EAAmB3F,GAAqByF,IAAI,oBAClD,MAAM1B,EAAsB/D,GAAqByF,IAAI,uBACrD,MAAMjE,EAAgBxB,GAAqByF,IAAI,kBAAoB/E,KAAKc,cACxE,MAAMsE,EAAe9F,GAAqByF,IAAI,gBAC9C/E,KAAKsH,kBAAoBlC,EAAeA,EAAarD,mBAAmBC,UAAW,CAAEC,UAAW,SAAY,mBAE5G,GAAI2G,GAAwBhF,IAAoBoF,EAAoB,CAClE,OACEjI,EAACkI,EAAI,KACHlI,EAACN,EAAa,CAACK,cAAeA,EAAeF,UAAWZ,KAAKY,UAAWC,iBAAkBb,KAAKa,kBAC7FE,EAAA,OAAKE,MAAM,mBAAmBiI,KAAK,oBACjCnI,EAAA,6BAA2B6C,gBAAiBA,EAAiBuF,YAAY,6F,CAQnF,GAAIP,GAAwBI,EAAoB,CAC9C,OACEjI,EAACkI,EAAI,KACHlI,EAACN,EAAa,CAACK,cAAeA,EAAeF,UAAWZ,KAAKY,UAAWC,iBAAkBb,KAAKa,kBAC7FE,EAAA,OAAKE,MAAM,uBAAuBiI,KAAK,wBACrCnI,EAAA,8BACEiI,mBAAoBA,EACpBG,YAAY,yF,CAQxB,GAAIP,GAAwBE,EAAW,CACrC,OACE/H,EAACkI,EAAI,KACHlI,EAACN,EAAa,CAACK,cAAeA,EAAeF,UAAWZ,KAAKY,UAAWC,iBAAkBb,KAAKa,kBAC7FE,EAAA,OAAKE,MAAM,oBAAoBiI,KAAK,qBAClCnI,EAAA,2BACEkE,iBAAkBA,EAClB6D,UAAWA,EACXK,YAAY,qH,CAQxB,GAAIP,KAA0BE,KAAezF,KAAyB0F,EAAiB,CACrF,MAAMK,EAAyBpJ,KAAKuC,KAAK8G,cAAc,sCACvD,OACEtI,EAACkI,EAAI,KACHlI,EAACN,EAAa,CAACK,cAAeA,EAAeF,UAAWZ,KAAKY,UAAWC,iBAAkBb,KAAKa,kBAC5FwC,GAAuBtC,EAACG,EAAa,4DACtCH,EAAA,OAAKE,MAAM,mBAAmBiI,KAAK,oBACjCnI,EAAA,OAAKE,MAAM,cACTF,EAAA,qBAAmBoI,YAAY,0IAC/BpI,EAAA,6BAEFA,EAAA,OAAKE,MAAM,eACTF,EAAA,UACEA,EAAA,sBACAA,EAAA,QAAMgH,GAAG,gBAAgB/H,KAAKsH,oBAEhCvG,EAAA,yBAAuBoI,YAAY,oEAChCC,GACCrI,EAAA,QAAMuI,KAAK,6BACTvI,EAAA,QAAMwI,KAAK,mC,CAW7B,GAAIX,IAAyBE,GAAaC,EAAiB,CAEzD,MAAMS,EAAqBxJ,KAAKuC,KAAK8G,cAAc,gCAEnD,OACEtI,EAACkI,EAAI,KACHlI,EAACN,EAAa,CAACK,cAAeA,EAAeF,UAAWZ,KAAKY,UAAWC,iBAAkBb,KAAKa,kBAC5FwC,GAAuBtC,EAACG,EAAa,4DACtCH,EAAA,OAAKE,MAAM,uBAAuBiI,KAAK,wBACrCnI,EAAA,OAAKE,MAAM,cACTF,EAAA,OAAKE,MAAM,WACTF,EAAA,6BAA2BoI,YAAY,2DAG3CpI,EAAA,OAAKE,MAAM,eACTF,EAAA,sBAAoBoI,YAAY,4GAC7BK,GACCzI,EAAA,OAAKuI,KAAK,uBACRvI,EAAA,QAAMwI,KAAK,6B,CAW7B,OACExI,EAACkI,EAAI,KACHlI,EAAA,a"}
@@ -1,2 +1,2 @@
1
- import{r as o,c as n,h as e,H as a,a as s}from"./p-68c2fadf.js";import{R as l}from"./p-795b324a.js";import{a as t}from"./p-6c11737d.js";import"./p-02aa5f03.js";import"./p-cb65c223.js";const i=':host{display:block;--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;width:inherit}.nylas-custom-booking-flow{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-custom-booking-flow .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading{padding-bottom:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .label{display:flex;align-items:center;gap:0.5rem;margin:1rem 1rem 0;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button{margin:0 1rem;padding:0;width:inherit;height:48px;color:black;font-size:1rem;cursor:not-allowed;display:flex;gap:0.5rem;justify-content:space-between;align-items:center;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button span{padding:0 1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown{padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label{display:flex;align-items:center;gap:4px;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label tooltip-component{display:flex}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown){width:100%}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button){width:100%;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-content){width:100%;max-width:unset}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}';const d=i;var r=undefined&&undefined.__decorate||function(o,n,e,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,e):a,t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")l=Reflect.decorate(o,n,e,a);else for(var i=o.length-1;i>=0;i--)if(t=o[i])l=(s<3?t(l):s>3?t(n,e,l):t(n,e))||l;return s>3&&l&&Object.defineProperty(n,e,l),l};var c=undefined&&undefined.__metadata||function(o,n){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(o,n)};const b=class{constructor(e){o(this,e);this.valueChanged=n(this,"valueChanged",7);if(e.$hostElement$["s-ei"]){this.internals=e.$hostElement$["s-ei"]}else{this.internals=e.$hostElement$.attachInternals();e.$hostElement$["s-ei"]=this.internals}this.selectedConfiguration=undefined;this.name="booking-type";this.bookingType="";this.selectedBookingType=""}elementNameChangedHandler(o){t("nylas-custom-booking-flow","elementNameChangedHandler",o);this.host.setAttribute("name",o)}selectedConfigurationChangedHandler(o,n){t("nylas-custom-booking-flow","selectedConfigurationChangedHandler",o,n);if(o?.event_booking?.booking_type){this.bookingType=o?.event_booking?.booking_type}if(typeof this.internals.setFormValue==="function"){this.internals.setFormValue(this.bookingType.toString(),"booking-calendar")}this.selectedBookingType=this.bookingType}connectedCallback(){t("nylas-custom-booking-flow","connectedCallback")}disconnectedCallback(){t("nylas-custom-booking-flow","disconnectedCallback")}componentWillLoad(){t("nylas-custom-booking-flow","componentWillLoad");this.host.setAttribute("name",this.name)}componentDidLoad(){t("nylas-custom-booking-flow","componentDidLoad")}componentWillUpdate(){t("nylas-custom-booking-flow","componentWillUpdate")}componentDidUpdate(){t("nylas-custom-booking-flow","componentDidUpdate")}componentWillRender(){t("nylas-custom-booking-flow","componentWillRender")}componentDidRender(){t("nylas-custom-booking-flow","componentDidRender")}nylasFormDropdownChangedHandler(o){t("nylas-custom-booking-flow","nylasFormDropdownChangedHandler",o.detail);const n=o=>{const{value:n}=o.detail;this.selectedBookingType=n;this.internals.setFormValue(n.toString(),"booking-calendar")};this.valueChanged.emit({...o.detail,valueChanged:n})}render(){const o=[{label:"Automatically accept bookings",value:"booking"},{label:"Manually confirm/decline bookings",value:"pre-booking"}];return e(a,{key:"6202233ce5955be9542db05e648ef2ea2d8c45c2"},e("div",{key:"990ca595cc8f541902a4bccc7b0bf7f9f029c32a",class:"nylas-custom-booking-flow",part:"ncbf"},e("div",{key:"fc8e126be280ce56f968b4759ce549ebfcba5883",class:"header",part:"ncbf__header"},e("h3",{key:"b08624ee0a3fbb31c136be140e7c63d2862ae55d"},"Customize booking flow"),e("p",{key:"0a21993fc37169030332858b01a6b4a4ad838424"},"Customize how new bookings are handled when a booking is completed.")),o.length>0?e("div",{class:"nylas-custom-booking-flow__dropdown"},e("span",{class:"label"},"After a booking is confirmed",e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},"Choose how you’d like to handle new bookings. If you choose to manually confirm/decline bookings, you will be able to review and accept or decline each booking request."))),e("select-dropdown",{name:"booking-type",options:o,withSearch:false,exportparts:"sd_dropdown: ncbf__dropdown, sd_dropdown-button: ncbf__dropdown-button, sd_dropdown-content: ncbf__dropdown-content",defaultSelectedOption:o.find((o=>o.value==this.bookingType))??o[0]})):e("div",{class:"nylas-custom-booking-flow__loading"},e("span",{class:"label"},"Select a calendar to book meetings on ",e("info-icon",null)),e("div",{class:"loading-button"},e("span",null,"Loading...")))))}static get formAssociated(){return true}get host(){return s(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedConfiguration:["selectedConfigurationChangedHandler"]}}};r([l({name:"nylas-custom-booking-flow",stateToProps:new Map([["schedulerConfig.selectedConfiguration","selectedConfiguration"]]),eventToProps:{valueChanged:async(o,n)=>{const{valueChanged:e}=o.detail;if(e){e(o)}}},fireRegisterEvent:true}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],b.prototype,"render",null);b.style=d;export{b as nylas_custom_booking_flow};
2
- //# sourceMappingURL=p-a804616a.entry.js.map
1
+ import{r as o,c as n,h as e,H as a,a as s}from"./p-68c2fadf.js";import{R as l}from"./p-795b324a.js";import{a as t}from"./p-6c11737d.js";import"./p-02aa5f03.js";import"./p-cb65c223.js";const i=':host{display:block;--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;width:inherit}.nylas-custom-booking-flow{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-custom-booking-flow .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading{padding-bottom:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .label{display:flex;align-items:center;gap:0.5rem;margin:1rem 1rem 0;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button{margin:0 1rem;padding:0;width:inherit;height:48px;color:black;font-size:1rem;cursor:not-allowed;display:flex;gap:0.5rem;justify-content:space-between;align-items:center;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button span{padding:0 1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown{padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label{display:flex;align-items:center;gap:4px;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label tooltip-component{display:flex}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown){width:100%}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button){width:100%;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-content){width:100%;max-width:unset}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}';const d=i;var r=undefined&&undefined.__decorate||function(o,n,e,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,e):a,t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")l=Reflect.decorate(o,n,e,a);else for(var i=o.length-1;i>=0;i--)if(t=o[i])l=(s<3?t(l):s>3?t(n,e,l):t(n,e))||l;return s>3&&l&&Object.defineProperty(n,e,l),l};var c=undefined&&undefined.__metadata||function(o,n){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(o,n)};const b=class{constructor(e){o(this,e);this.valueChanged=n(this,"valueChanged",7);if(e.$hostElement$["s-ei"]){this.internals=e.$hostElement$["s-ei"]}else{this.internals=e.$hostElement$.attachInternals();e.$hostElement$["s-ei"]=this.internals}this.selectedConfiguration=undefined;this.name="booking-type";this.bookingType="";this.selectedBookingType=""}elementNameChangedHandler(o){t("nylas-custom-booking-flow","elementNameChangedHandler",o);this.host.setAttribute("name",o)}selectedConfigurationChangedHandler(o,n){t("nylas-custom-booking-flow","selectedConfigurationChangedHandler",o,n);if(o?.event_booking?.booking_type){this.bookingType=o?.event_booking?.booking_type}if(typeof this.internals.setFormValue==="function"){this.internals.setFormValue(this.bookingType.toString(),"booking-calendar")}this.selectedBookingType=this.bookingType}connectedCallback(){t("nylas-custom-booking-flow","connectedCallback")}disconnectedCallback(){t("nylas-custom-booking-flow","disconnectedCallback")}componentWillLoad(){t("nylas-custom-booking-flow","componentWillLoad");this.host.setAttribute("name",this.name)}componentDidLoad(){t("nylas-custom-booking-flow","componentDidLoad")}componentWillUpdate(){t("nylas-custom-booking-flow","componentWillUpdate")}componentDidUpdate(){t("nylas-custom-booking-flow","componentDidUpdate")}componentWillRender(){t("nylas-custom-booking-flow","componentWillRender")}componentDidRender(){t("nylas-custom-booking-flow","componentDidRender")}nylasFormDropdownChangedHandler(o){t("nylas-custom-booking-flow","nylasFormDropdownChangedHandler",o.detail);const n=o=>{const{value:n}=o.detail;this.selectedBookingType=n;this.internals.setFormValue(n.toString(),"booking-calendar")};this.valueChanged.emit({...o.detail,valueChanged:n})}render(){const o=[{label:"Automatically accept bookings",value:"booking"},{label:"Manually confirm/decline bookings",value:"pre-booking"}];return e(a,{key:"21319a4631f1c0990936623d6458ad80c424e508"},e("div",{key:"314ed4bd9b3057d209825cd93b3bcdde32c00a0d",class:"nylas-custom-booking-flow",part:"ncbf"},e("div",{key:"ce531904154c284cd4692ab3e31564be5fe826b1",class:"header",part:"ncbf__header"},e("h3",{key:"403ef6532fcf5b0ecd79944a02aa287537c677e1"},"Customize booking flow"),e("p",{key:"c8a5fb5fb02b7b4687778654b91b983ca210a0da"},"Customize how new bookings are handled when a booking is completed.")),o.length>0?e("div",{class:"nylas-custom-booking-flow__dropdown"},e("span",{class:"label"},"After a booking is confirmed",e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},"Choose how you’d like to handle new bookings. If you choose to manually confirm/decline bookings, you will be able to review and accept or decline each booking request."))),e("select-dropdown",{name:"booking-type",options:o,withSearch:false,exportparts:"sd_dropdown: ncbf__dropdown, sd_dropdown-button: ncbf__dropdown-button, sd_dropdown-content: ncbf__dropdown-content",defaultSelectedOption:o.find((o=>o.value==this.bookingType))??o[0]})):e("div",{class:"nylas-custom-booking-flow__loading"},e("span",{class:"label"},"Select a calendar to book meetings on ",e("info-icon",null)),e("div",{class:"loading-button"},e("span",null,"Loading...")))))}static get formAssociated(){return true}get host(){return s(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedConfiguration:["selectedConfigurationChangedHandler"]}}};r([l({name:"nylas-custom-booking-flow",stateToProps:new Map([["schedulerConfig.selectedConfiguration","selectedConfiguration"]]),eventToProps:{valueChanged:async(o,n)=>{const{valueChanged:e}=o.detail;if(e){e(o)}}},fireRegisterEvent:true}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],b.prototype,"render",null);b.style=d;export{b as nylas_custom_booking_flow};
2
+ //# sourceMappingURL=p-09fec39c.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,h as a,H as s,a as n}from"./p-68c2fadf.js";import{R as r}from"./p-795b324a.js";import{a as t,C as c}from"./p-6c11737d.js";import"./p-02aa5f03.js";import"./p-cb65c223.js";const d=':host{display:block;--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}.nylas-form-card{width:100%;border-radius:8px;border:1px solid var(--nylas-base-200)}.nylas-form-card__header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}';const o=d;var l=undefined&&undefined.__decorate||function(e,a,s,n){var r=arguments.length,t=r<3?a:n===null?n=Object.getOwnPropertyDescriptor(a,s):n,c;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")t=Reflect.decorate(e,a,s,n);else for(var d=e.length-1;d>=0;d--)if(c=e[d])t=(r<3?c(t):r>3?c(a,s,t):c(a,s))||t;return r>3&&t&&Object.defineProperty(a,s,t),t};var f=undefined&&undefined.__metadata||function(e,a){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,a)};const b=class{constructor(a){e(this,a);if(a.$hostElement$["s-ei"]){this.internals=a.$hostElement$["s-ei"]}else{this.internals=a.$hostElement$.attachInternals();a.$hostElement$["s-ei"]=this.internals}}connectedCallback(){t("nylas-event-card","connectedCallback")}componentWillLoad(){t("nylas-event-card","componentWillLoad")}componentDidLoad(){t("nylas-event-card","componentDidLoad")}disconnectedCallback(){t("nylas-event-card","disconnectedCallback");const e=["header-title","header-subtitle","content"];c(e,this.host)}render(){return a(s,{key:"452748a2f5bbe760d62bc430c206e76e1d662cdc"},a("div",{key:"5960063b44a6c0d70f85f2a4ca151b3f9cf12b21",class:"nylas-form-card"},a("div",{key:"40a34de1891b375ee143ef27d71ab18a6ac8e1ae",class:"nylas-form-card__header"},a("slot",{key:"ad166ef70620dd2c9f29943220534920d643a615",name:"header-title"}),a("slot",{key:"567c259cb3d5db843bd4eea56d134060f0730e2b",name:"header-subtitle"})),a("div",{key:"092edbf7aec788c1b1feaa1328e56896c8bb25f9",class:"nylas-form-card__content"},a("slot",{key:"598dc69a824032ae31ab03259bf61e38ef52b661",name:"content"}))))}static get formAssociated(){return true}get host(){return n(this)}};l([r({name:"nylas-form-card",eventToProps:{},fireRegisterEvent:true}),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",void 0)],b.prototype,"render",null);b.style=o;export{b as nylas_form_card};
2
- //# sourceMappingURL=p-df2b34ee.entry.js.map
1
+ import{r as e,h as a,H as s,a as n}from"./p-68c2fadf.js";import{R as r}from"./p-795b324a.js";import{a as t,C as c}from"./p-6c11737d.js";import"./p-02aa5f03.js";import"./p-cb65c223.js";const d=':host{display:block;--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}.nylas-form-card{width:100%;border-radius:8px;border:1px solid var(--nylas-base-200)}.nylas-form-card__header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}';const o=d;var l=undefined&&undefined.__decorate||function(e,a,s,n){var r=arguments.length,t=r<3?a:n===null?n=Object.getOwnPropertyDescriptor(a,s):n,c;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")t=Reflect.decorate(e,a,s,n);else for(var d=e.length-1;d>=0;d--)if(c=e[d])t=(r<3?c(t):r>3?c(a,s,t):c(a,s))||t;return r>3&&t&&Object.defineProperty(a,s,t),t};var f=undefined&&undefined.__metadata||function(e,a){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,a)};const b=class{constructor(a){e(this,a);if(a.$hostElement$["s-ei"]){this.internals=a.$hostElement$["s-ei"]}else{this.internals=a.$hostElement$.attachInternals();a.$hostElement$["s-ei"]=this.internals}}connectedCallback(){t("nylas-event-card","connectedCallback")}componentWillLoad(){t("nylas-event-card","componentWillLoad")}componentDidLoad(){t("nylas-event-card","componentDidLoad")}disconnectedCallback(){t("nylas-event-card","disconnectedCallback");const e=["header-title","header-subtitle","content"];c(e,this.host)}render(){return a(s,{key:"481f5b89040a4b88cd2524dec46e228a2f495672"},a("div",{key:"bec08ca1ce504d6a6c797ac5995ce682a020256c",class:"nylas-form-card"},a("div",{key:"aa6be7ede7ee3595d7b1eeb31fe53cb2d26ea724",class:"nylas-form-card__header"},a("slot",{key:"a5053d6f0fd8b16d0001c92afa6fc8313a0f7044",name:"header-title"}),a("slot",{key:"18b2f5b6868def67b2e66a722d617e820d430858",name:"header-subtitle"})),a("div",{key:"89e52a3ea00fa5505129d5986858d18867d9f4cd",class:"nylas-form-card__content"},a("slot",{key:"6b5087f1de1b228bf4b4ed57ba93bf39c489bcca",name:"content"}))))}static get formAssociated(){return true}get host(){return n(this)}};l([r({name:"nylas-form-card",eventToProps:{},fireRegisterEvent:true}),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",void 0)],b.prototype,"render",null);b.style=o;export{b as nylas_form_card};
2
+ //# sourceMappingURL=p-13b003b5.entry.js.map
@@ -0,0 +1,2 @@
1
+ import{c as n}from"./p-cabb2e68.js";function t(t={}){const i={selectedConfiguration:{},configurations:[],calendars:[],currentUser:null,action:null,additionalParticipants:[],...t};const o=n(i);function e(){o.set("selectedConfiguration",{...t["selectedConfiguration"]})}o.onChange("action",(async n=>{if(!n){e()}}));return{...o,resetSelectedConfiguration:e}}export{t as C};
2
+ //# sourceMappingURL=p-29938263.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CreateNylasSchedulerConfigStore","defaultState","defaultSchedulerConfigState","selectedConfiguration","configurations","calendars","currentUser","action","additionalParticipants","store","createStore","resetSelectedConfiguration","set","onChange","async"],"sources":["src/stores/scheduler-config-store.ts"],"sourcesContent":["import { Calendar, Configuration, Participant } from '@nylas/core';\nimport { ObservableMap, createStore } from '@stencil/store';\nimport { User } from '@/common/nylas-api-request';\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];\n};\n\nexport interface NylasSchedulerConfigStoreState {\n /**\n * The selected configuration.\n * This is the configuration that is currently selected, use it to populate default values for new configurations.\n */\n selectedConfiguration: RecursivePartial<Configuration>;\n /**\n * The list of configurations.\n * This is the list of configurations that the user has created.\n */\n configurations: Configuration[];\n /**\n * The list of calendars.\n * This is the list of calendars that the user has access to.\n */\n calendars: Calendar[];\n /**\n * The current user.\n * This is the user that is currently logged in.\n */\n currentUser: User | null;\n /**\n * The current action.\n * This is the current action that the user is performing.\n */\n action: 'create' | 'edit' | null;\n /**\n * The additional participants.\n */\n additionalParticipants: Participant[];\n}\n\nexport type NylasSchedulerConfigStoreType = ReturnType<typeof CreateNylasSchedulerConfigStore>;\n\nexport type CreateNylasSchedulerConfigStoreReturnType = ObservableMap<NylasSchedulerConfigStoreState> & {\n /**\n * Reset the selected configuration to the default state.\n * This is used to reset the selected configuration to the default state instead of setting it to an empty object.\n */\n resetSelectedConfiguration: () => void;\n};\n\nexport function CreateNylasSchedulerConfigStore(defaultState: Partial<NylasSchedulerConfigStoreState> = {}): CreateNylasSchedulerConfigStoreReturnType {\n const defaultSchedulerConfigState: NylasSchedulerConfigStoreState = {\n selectedConfiguration: {},\n configurations: [],\n calendars: [],\n currentUser: null,\n action: null,\n additionalParticipants: [],\n ...defaultState,\n };\n const store = createStore<NylasSchedulerConfigStoreState>(defaultSchedulerConfigState);\n\n /**\n * Reset the selected configuration to the default state.\n * This is used to reset the selected configuration to the default state instead of setting it to an empty object.\n */\n function resetSelectedConfiguration() {\n store.set('selectedConfiguration', { ...defaultState['selectedConfiguration'] });\n }\n\n store.onChange('action', async action => {\n if (!action) {\n resetSelectedConfiguration();\n }\n });\n\n return {\n ...store,\n resetSelectedConfiguration,\n };\n}\n"],"mappings":"6CAkDgBA,EAAgCC,EAAwD,IACtG,MAAMC,EAA8D,CAClEC,sBAAuB,GACvBC,eAAgB,GAChBC,UAAW,GACXC,YAAa,KACbC,OAAQ,KACRC,uBAAwB,MACrBP,GAEL,MAAMQ,EAAQC,EAA4CR,GAM1D,SAASS,IACPF,EAAMG,IAAI,wBAAyB,IAAKX,EAAa,0B,CAGvDQ,EAAMI,SAAS,UAAUC,MAAMP,IAC7B,IAAKA,EAAQ,CACXI,G,KAIJ,MAAO,IACFF,EACHE,6BAEJ,Q"}
@@ -1,4 +1,4 @@
1
- import{h,F as Fragment,r as registerInstance,c as createEvent,H as Host,a as getElement}from"./p-68c2fadf.js";import{X as Xr,N as NylasBaseProvider}from"./p-36e3bf97.js";import{N as NylasIdentityRequestWrapper}from"./p-613c070f.js";import{d as dataResponse,a as debug}from"./p-6c11737d.js";import{C as CreateNylasSchedulerConfigStore}from"./p-ee91a2a0.js";import{B as Buffer}from"./p-02aa5f03.js";import{p as process}from"./p-1ffbe196.js";import{c as commonjsGlobal}from"./p-cb65c223.js";import"./p-cabb2e68.js";class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:e}){this.nylasApiRequest=t;this.nylasSchedulerConfigStore=e}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[t,e]=await this.nylasApiRequest.request({method:"GET",path:`calendars`});if(e){return dataResponse(null,{message:"Error fetching calendars: "+e.message})}if(Xr(t)){return dataResponse(null,{message:"Error fetching calendars: "+t.error?.message})}this.nylasSchedulerConfigStore.state.calendars=t.data;return dataResponse(t.data)}async getConfigurationById(t,e=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(!e){const e=this.nylasSchedulerConfigStore.state.configurations.find((e=>e.id===t));if(e){this.nylasSchedulerConfigStore.state.selectedConfiguration=e;return dataResponse(e)}}const[n,i]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${t}`});if(i){return dataResponse(null,{message:"Error fetching configuration: "+i.message})}if(Xr(n)){return dataResponse(null,{message:"Error fetching configuration: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data;if(this.nylasSchedulerConfigStore.state.configurations.find((e=>e.id===t))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((e=>e.id===t?n.data:e))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data]}return dataResponse(n.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[t,e]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations`});if(e){return dataResponse(null,{message:"Error fetching configurations: "+e.message})}if(Xr(t)){return dataResponse(null,{message:"Error fetching configurations: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=t.data;return dataResponse(t.data)}async createConfiguration(t){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}const[e,n]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:t});if(n){return dataResponse(null,{message:"Error creating configuration: "+n.message})}if(Xr(e)){return dataResponse(null,{message:"Error creating configuration: "+e.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=e.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,e.data];return dataResponse(e.data)}async updateConfiguration(t){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[e,n]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${t.id}`,body:t});if(n){return dataResponse(null,{message:"Error updating configuration: "+n.message})}if(Xr(e)){return dataResponse(null,{message:"Error updating configuration: "+e.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=e.data;if(this.nylasSchedulerConfigStore.state.configurations.find((e=>e.id===t.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((n=>n.id===t.id?e.data:n))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,e.data]}return dataResponse(e.data)}async deleteConfiguration(t){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[e,n]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}`});if(n){return dataResponse(null,{message:"Error deleting configuration: "+n.message})}if(Xr(e)){return dataResponse(null,{message:"Error deleting configuration: "+e.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((e=>e.id!==t));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===t){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return dataResponse(e.data)}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:e}){this.nylasApiRequest=t;this.nylasSchedulerConfigStore=e}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()}}class LocalStorage{get(t){return new Promise((e=>{const n=window.localStorage.getItem(t);if(!n){e(null)}else{e(JSON.parse(n))}}))}async remove(t){window.localStorage.removeItem(t);return new Promise((t=>{t(null)}))}set(t,e){window.localStorage.setItem(t,JSON.stringify(e));return new Promise((t=>{t(null)}))}}const PKCE_KEY="pkce";const GRANT_KEY="grant";const USER_KEY="user";class Storage{Storage=new LocalStorage;constructor(t){if(t){this.Storage=t;return}}setPKCE(t){const e=Buffer.from(t);this.Storage.set(PKCE_KEY,e.toString("base64"))}async getPKCE(){try{const t=await this.Storage.get(PKCE_KEY);if(t){const e=Buffer.from(t,"base64");return e.toString("utf8")}}catch(t){return null}return null}removePKCE(){this.Storage.remove(PKCE_KEY)}setGrant(t,e=false){const{grant_id:n}=t;this.Storage.set(`${GRANT_KEY}${e?"-"+n:""}`,t)}removeGrant(t,e=false){this.Storage.remove(`${GRANT_KEY}${e?"-"+t:""}`)}async getGrant(t,e=false){const n=await this.Storage.get(`${GRANT_KEY}${e?"-"+t:""}`);if(n){return n}return null}async setUserToken(t){const e=await this.getUserTokens();if(e){const n=e.find((e=>e.sub===t.sub));if(!n){const n=[...e,t];this.Storage.set(USER_KEY,n)}else{const n=e.map((e=>{if(e.sub===t.sub){e=t}return e}));this.Storage.set(USER_KEY,n)}}else{this.Storage.set(USER_KEY,[t])}}async getUserToken(t=""){const e=await this.Storage.get(USER_KEY);if(e){if(t===""){return e[0]}const n=e.find((e=>e.sub===t));return n}return null}async getUserTokens(){const t=await this.Storage.get(USER_KEY);if(t){return t}return null}removeUserTokens(){this.Storage.remove(USER_KEY)}async removeUserToken(t){const e=await this.getUserTokens();const n=e?.filter((e=>e.sub!==t));this.Storage.set(USER_KEY,n)}async clearSession(){const t=await this.getUserTokens();t?.forEach((t=>{this.removeGrant(t.sub)}));this.removePKCE();this.removeUserTokens()}}class IndexedDBStorage{databaseName="identity-db";storeName="identity";get(t){const e=this;return new Promise(((n,i)=>{e.openDatabase().then((function(r){const s=r.transaction(e.storeName,"readwrite");const o=s.objectStore(e.storeName);const a=o.get(t);a.onsuccess=()=>{n(a.result)};a.onerror=()=>{i(a.error)};s.oncomplete=()=>{r.close()}}))}))}async remove(t){const e=this;return new Promise(((n,i)=>{const r=indexedDB.open(this.databaseName);r.onupgradeneeded=function(t){const n=t.target.result;n.createObjectStore(e.storeName)};r.onerror=()=>{i(r.error)};r.onsuccess=e=>{const r=e.target.result;const s=r.transaction(this.storeName,"readwrite");const o=s.objectStore(this.storeName);const a=o.delete(t);a.onsuccess=()=>{n(null)};a.onerror=()=>{i(a.error)};s.oncomplete=()=>{r.close()}}}))}set(t,e){return new Promise(((n,i)=>{const r=indexedDB.open(this.databaseName);r.onerror=()=>{i(r.error)};r.onupgradeneeded=t=>{const e=t.target.result;e.createObjectStore(this.storeName)};r.onsuccess=r=>{const s=r.target.result;const o=s.transaction(this.storeName,"readwrite");const a=o.objectStore(this.storeName);const c=a.put(e,t);c.onsuccess=()=>{n(e)};c.onerror=()=>{i(c.error)};o.oncomplete=()=>{s.close()}}}))}openDatabase(){const t=this;return new Promise((function(e,n){const i=indexedDB.open(t.databaseName,2);i.onupgradeneeded=function(e){const n=e.target.result;n.createObjectStore(t.storeName)};i.onsuccess=function(t){e(t.target.result)};i.onerror=function(t){n(t.error)}}))}}var sha256={exports:{}};(function(module){(function(){var ERROR="input is invalid type";var WINDOW=typeof window==="object";var root=WINDOW?window:{};if(root.JS_SHA256_NO_WINDOW){WINDOW=false}var WEB_WORKER=!WINDOW&&typeof self==="object";var NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process==="object"&&process.versions&&process.versions.node;if(NODE_JS){root=commonjsGlobal}else if(WEB_WORKER){root=self}var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&"object"==="object"&&module.exports;var ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!=="undefined";var HEX_CHARS="0123456789abcdef".split("");var EXTRA=[-2147483648,8388608,32768,128];var SHIFT=[24,16,8,0];var K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];var OUTPUT_TYPES=["hex","array","digest","arrayBuffer"];var blocks=[];if(root.JS_SHA256_NO_NODE_JS||!Array.isArray){Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}}if(ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)){ArrayBuffer.isView=function(t){return typeof t==="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer}}var createOutputMethod=function(t,e){return function(n){return new Sha256(e,true).update(n)[t]()}};var createMethod=function(t){var e=createOutputMethod("hex",t);if(NODE_JS){e=nodeWrap(e,t)}e.create=function(){return new Sha256(t)};e.update=function(t){return e.create().update(t)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];e[i]=createOutputMethod(i,t)}return e};var nodeWrap=function(method,is224){var crypto=eval("require('crypto')");var Buffer=eval("require('buffer').Buffer");var algorithm=is224?"sha224":"sha256";var nodeMethod=function(t){if(typeof t==="string"){return crypto.createHash(algorithm).update(t,"utf8").digest("hex")}else{if(t===null||t===undefined){throw new Error(ERROR)}else if(t.constructor===ArrayBuffer){t=new Uint8Array(t)}}if(Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer){return crypto.createHash(algorithm).update(new Buffer(t)).digest("hex")}else{return method(t)}};return nodeMethod};var createHmacOutputMethod=function(t,e){return function(n,i){return new HmacSha256(n,e,true).update(i)[t]()}};var createHmacMethod=function(t){var e=createHmacOutputMethod("hex",t);e.create=function(e){return new HmacSha256(e,t)};e.update=function(t,n){return e.create(t).update(n)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];e[i]=createHmacOutputMethod(i,t)}return e};function Sha256(t,e){if(e){blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0;this.blocks=blocks}else{this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}if(t){this.h0=3238371032;this.h1=914150663;this.h2=812702999;this.h3=4144912697;this.h4=4290775857;this.h5=1750603025;this.h6=1694076839;this.h7=3204075428}else{this.h0=1779033703;this.h1=3144134277;this.h2=1013904242;this.h3=2773480762;this.h4=1359893119;this.h5=2600822924;this.h6=528734635;this.h7=1541459225}this.block=this.start=this.bytes=this.hBytes=0;this.finalized=this.hashed=false;this.first=true;this.is224=t}Sha256.prototype.update=function(t){if(this.finalized){return}var e,n=typeof t;if(n!=="string"){if(n==="object"){if(t===null){throw new Error(ERROR)}else if(ARRAY_BUFFER&&t.constructor===ArrayBuffer){t=new Uint8Array(t)}else if(!Array.isArray(t)){if(!ARRAY_BUFFER||!ArrayBuffer.isView(t)){throw new Error(ERROR)}}}else{throw new Error(ERROR)}e=true}var i,r=0,s,o=t.length,a=this.blocks;while(r<o){if(this.hashed){this.hashed=false;a[0]=this.block;a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0}if(e){for(s=this.start;r<o&&s<64;++r){a[s>>2]|=t[r]<<SHIFT[s++&3]}}else{for(s=this.start;r<o&&s<64;++r){i=t.charCodeAt(r);if(i<128){a[s>>2]|=i<<SHIFT[s++&3]}else if(i<2048){a[s>>2]|=(192|i>>6)<<SHIFT[s++&3];a[s>>2]|=(128|i&63)<<SHIFT[s++&3]}else if(i<55296||i>=57344){a[s>>2]|=(224|i>>12)<<SHIFT[s++&3];a[s>>2]|=(128|i>>6&63)<<SHIFT[s++&3];a[s>>2]|=(128|i&63)<<SHIFT[s++&3]}else{i=65536+((i&1023)<<10|t.charCodeAt(++r)&1023);a[s>>2]|=(240|i>>18)<<SHIFT[s++&3];a[s>>2]|=(128|i>>12&63)<<SHIFT[s++&3];a[s>>2]|=(128|i>>6&63)<<SHIFT[s++&3];a[s>>2]|=(128|i&63)<<SHIFT[s++&3]}}}this.lastByteIndex=s;this.bytes+=s-this.start;if(s>=64){this.block=a[16];this.start=s-64;this.hash();this.hashed=true}else{this.start=s}}if(this.bytes>4294967295){this.hBytes+=this.bytes/4294967296<<0;this.bytes=this.bytes%4294967296}return this};Sha256.prototype.finalize=function(){if(this.finalized){return}this.finalized=true;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block;t[e>>2]|=EXTRA[e&3];this.block=t[16];if(e>=56){if(!this.hashed){this.hash()}t[0]=this.block;t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0}t[14]=this.hBytes<<3|this.bytes>>>29;t[15]=this.bytes<<3;this.hash()};Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,n=this.h2,i=this.h3,r=this.h4,s=this.h5,o=this.h6,a=this.h7,c=this.blocks,u,l,h,d,f,p,y,w,g,m,b;for(u=16;u<64;++u){f=c[u-15];l=(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;f=c[u-2];h=(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10;c[u]=c[u-16]+l+c[u-7]+h<<0}b=e&n;for(u=0;u<64;u+=4){if(this.first){if(this.is224){w=300032;f=c[0]-1413257819;a=f-150054599<<0;i=f+24177077<<0}else{w=704751109;f=c[0]-210244248;a=f-1521486534<<0;i=f+143694565<<0}this.first=false}else{l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10);h=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7);w=t&e;d=w^t&n^b;y=r&s^~r&o;f=a+h+y+K[u]+c[u];p=l+d;a=i+f<<0;i=f+p<<0}l=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10);h=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7);g=i&t;d=g^i&e^w;y=a&r^~a&s;f=o+h+y+K[u+1]+c[u+1];p=l+d;o=n+f<<0;n=f+p<<0;l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10);h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7);m=n&i;d=m^n&t^g;y=o&a^~o&r;f=s+h+y+K[u+2]+c[u+2];p=l+d;s=e+f<<0;e=f+p<<0;l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10);h=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7);b=e&n;d=b^e&i^m;y=s&o^~s&a;f=r+h+y+K[u+3]+c[u+3];p=l+d;r=t+f<<0;t=f+p<<0}this.h0=this.h0+t<<0;this.h1=this.h1+e<<0;this.h2=this.h2+n<<0;this.h3=this.h3+i<<0;this.h4=this.h4+r<<0;this.h5=this.h5+s<<0;this.h6=this.h6+o<<0;this.h7=this.h7+a<<0};Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,i=this.h3,r=this.h4,s=this.h5,o=this.h6,a=this.h7;var c=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];if(!this.is224){c+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]}return c};Sha256.prototype.toString=Sha256.prototype.hex;Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,i=this.h3,r=this.h4,s=this.h5,o=this.h6,a=this.h7;var c=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,r>>24&255,r>>16&255,r>>8&255,r&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];if(!this.is224){c.push(a>>24&255,a>>16&255,a>>8&255,a&255)}return c};Sha256.prototype.array=Sha256.prototype.digest;Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32);var e=new DataView(t);e.setUint32(0,this.h0);e.setUint32(4,this.h1);e.setUint32(8,this.h2);e.setUint32(12,this.h3);e.setUint32(16,this.h4);e.setUint32(20,this.h5);e.setUint32(24,this.h6);if(!this.is224){e.setUint32(28,this.h7)}return t};function HmacSha256(t,e,n){var i,r=typeof t;if(r==="string"){var s=[],o=t.length,a=0,c;for(i=0;i<o;++i){c=t.charCodeAt(i);if(c<128){s[a++]=c}else if(c<2048){s[a++]=192|c>>6;s[a++]=128|c&63}else if(c<55296||c>=57344){s[a++]=224|c>>12;s[a++]=128|c>>6&63;s[a++]=128|c&63}else{c=65536+((c&1023)<<10|t.charCodeAt(++i)&1023);s[a++]=240|c>>18;s[a++]=128|c>>12&63;s[a++]=128|c>>6&63;s[a++]=128|c&63}}t=s}else{if(r==="object"){if(t===null){throw new Error(ERROR)}else if(ARRAY_BUFFER&&t.constructor===ArrayBuffer){t=new Uint8Array(t)}else if(!Array.isArray(t)){if(!ARRAY_BUFFER||!ArrayBuffer.isView(t)){throw new Error(ERROR)}}}else{throw new Error(ERROR)}}if(t.length>64){t=new Sha256(e,true).update(t).array()}var u=[],l=[];for(i=0;i<64;++i){var h=t[i]||0;u[i]=92^h;l[i]=54^h}Sha256.call(this,e,n);this.update(l);this.oKeyPad=u;this.inner=true;this.sharedMemory=n}HmacSha256.prototype=new Sha256;HmacSha256.prototype.finalize=function(){Sha256.prototype.finalize.call(this);if(this.inner){this.inner=false;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory);this.update(this.oKeyPad);this.update(t);Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports;exports.sha224=createMethod(true);exports.sha256.hmac=createHmacMethod();exports.sha224.hmac=createHmacMethod(true);if(COMMON_JS){module.exports=exports}else{root.sha256=exports.sha256;root.sha224=exports.sha224}})()})(sha256);var getRandomValues;var rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){getRandomValues=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!=="undefined"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto);if(!getRandomValues){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return getRandomValues(rnds8)}const REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(t){return typeof t==="string"&&REGEX.test(t)}var byteToHex=[];for(var i=0;i<256;++i){byteToHex.push((i+256).toString(16).substr(1))}function stringify(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=(byteToHex[t[e+0]]+byteToHex[t[e+1]]+byteToHex[t[e+2]]+byteToHex[t[e+3]]+"-"+byteToHex[t[e+4]]+byteToHex[t[e+5]]+"-"+byteToHex[t[e+6]]+byteToHex[t[e+7]]+"-"+byteToHex[t[e+8]]+byteToHex[t[e+9]]+"-"+byteToHex[t[e+10]]+byteToHex[t[e+11]]+byteToHex[t[e+12]]+byteToHex[t[e+13]]+byteToHex[t[e+14]]+byteToHex[t[e+15]]).toLowerCase();if(!validate(n)){throw TypeError("Stringified UUID is invalid")}return n}function v4(t,e,n){t=t||{};var i=t.random||(t.rng||rng)();i[6]=i[6]&15|64;i[8]=i[8]&63|128;if(e){n=n||0;for(var r=0;r<16;++r){e[n+r]=i[r]}return e}return stringify(i)}async function getBytes(t,e){const n=t.getReader();let i;while(!(i=await n.read()).done){e(i.value)}}function getLines(t){let e;let n;let i;let r=false;return function s(o){if(e===undefined){e=o;n=0;i=-1}else{e=concat(e,o)}const a=e.length;let c=0;while(n<a){if(r){if(e[n]===10){c=++n}r=false}let s=-1;for(;n<a&&s===-1;++n){switch(e[n]){case 58:if(i===-1){i=n-c}break;case 13:r=true;case 10:s=n;break}}if(s===-1){break}t(e.subarray(c,s),i);c=n;i=-1}if(c===a){e=undefined}else if(c!==0){e=e.subarray(c);n-=c}}}function getMessages(t,e,n){let i=newMessage();const r=new TextDecoder;return function s(o,a){if(o.length===0){n===null||n===void 0?void 0:n(i);i=newMessage()}else if(a>0){const n=r.decode(o.subarray(0,a));const s=a+(o[a+1]===32?2:1);const c=r.decode(o.subarray(s));switch(n){case"data":i.data=i.data?i.data+"\n"+c:c;break;case"event":i.event=c;break;case"id":t(i.id=c);break;case"retry":const n=parseInt(c,10);if(!isNaN(n)){e(i.retry=n)}break}}}}function concat(t,e){const n=new Uint8Array(t.length+e.length);n.set(t);n.set(e,t.length);return n}function newMessage(){return{data:"",event:"",id:"",retry:undefined}}var __rest=undefined&&undefined.__rest||function(t,e){var n={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0)n[i]=t[i];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++){if(e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r]))n[i[r]]=t[i[r]]}return n};const EventStreamContentType="text/event-stream";const DefaultRetryInterval=1e3;const LastEventId="last-event-id";function fetchEventSource(t,e){var{signal:n,headers:i,onopen:r,onmessage:s,onclose:o,onerror:a,openWhenHidden:c,fetch:u}=e,l=__rest(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(((e,h)=>{const d=Object.assign({},i);if(!d.accept){d.accept=EventStreamContentType}let f;function p(){f.abort();if(!document.hidden){_()}}if(!c){document.addEventListener("visibilitychange",p)}let y=DefaultRetryInterval;let w=0;function g(){document.removeEventListener("visibilitychange",p);window.clearTimeout(w);f.abort()}n===null||n===void 0?void 0:n.addEventListener("abort",(()=>{g();e()}));const m=u!==null&&u!==void 0?u:window.fetch;const b=r!==null&&r!==void 0?r:defaultOnOpen;async function _(){var n;f=new AbortController;try{const n=await m(t,Object.assign(Object.assign({},l),{headers:d,signal:f.signal}));await b(n);await getBytes(n.body,getLines(getMessages((t=>{if(t){d[LastEventId]=t}else{delete d[LastEventId]}}),(t=>{y=t}),s)));o===null||o===void 0?void 0:o();g();e()}catch(t){if(!f.signal.aborted){try{const e=(n=a===null||a===void 0?void 0:a(t))!==null&&n!==void 0?n:y;window.clearTimeout(w);w=window.setTimeout(_,e)}catch(t){g();h(t)}}}}_()}))}function defaultOnOpen(t){const e=t.headers.get("content-type");if(!(e===null||e===void 0?void 0:e.startsWith(EventStreamContentType))){throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${e}`)}}function Base64EncodeUrl(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function getTimestamp(){return Math.floor(Date.now()/1e3)}function e(t){this.message=t}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r$1="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var n=String(t).replace(/=+$/,"");if(n.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,r,s=0,o=0,a="";r=n.charAt(o++);~r&&(i=s%4?64*i+r:r,s++%4)?a+=String.fromCharCode(255&i>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function t$1(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(r$1(t).replace(/(.)/g,(function(t,e){var n=e.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(e)}catch(t){return r$1(e)}}function n$1(t){this.message=t}function o(t,e){if("string"!=typeof t)throw new n$1("Invalid token specified");var n=!0===(e=e||{}).header?0:1;try{return JSON.parse(t$1(t.split(".")[n]))}catch(t){throw new n$1("Invalid token specified: "+t.message)}}n$1.prototype=new Error,n$1.prototype.name="InvalidTokenError";class NylasSessions{clientId;redirectUri;accessType="online";domain="http://api.nylas.com";versioned=false;Storage;hosted=false;multiAccount=false;loginId="";constructor(t){this.clientId=t.clientId;this.redirectUri=t.redirectUri;if(t.domain){this.domain=t.domain;const e=this.domain.substring(this.domain.length-3);if(e.includes("/v")){this.versioned=true}}if(t.multiAccount){this.multiAccount=t.multiAccount}if(t.sw){const t=new IndexedDBStorage;this.Storage=new Storage(t)}else{this.Storage=new Storage}if(t.accessType){this.accessType=t.accessType}if(t.loginId){this.loginId=t.loginId}if(t.hosted){this.hosted=t.hosted}this.codeExchange(null)}async validateAccessToken(t=""){const e=await this.Storage.getGrant(t,this.multiAccount);if(!e){return false}const{access_token:n}=e;try{const t=await fetch(`${this.domain}/connect/tokeninfo?access_token=${n}`,{method:"GET"});const e=await t.json();if(!e.data){return false}return true}catch(t){return false}}async validateIDToken(t=""){const e=await this.Storage.getGrant(t,this.multiAccount);if(!e){return false}const{id_token:n}=e;try{const t=await fetch(`${this.domain}/connect/tokeninfo?id_token=${n}`,{method:"GET"});if(t.status!==200){return false}const e=await t.json();if(!e.data){return false}return true}catch(t){return false}}getDomain(){return this.domain}async auth(t){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){await this.hostedSetCodeChallenge()}const e=await this.generateAuthURL(t);if(t.popup){this.popUp(e);return}return e}async generateAuthURL(t){const e=await this.getCodeChallege();let n=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(e){n+=`&code_challenge=${e}&code_challenge_method=S256&options=rotate_refresh_token`}if(t.provider){n+=`&provider=${t.provider}`}if(t.loginHint){n+=`&login_hint=${t.loginHint}`;if(t.includeGrantScopes){n+=`&include_grant_scopes=${t.includeGrantScopes}`}}if(t.scope){n+=`&scope=${t.scope.join(" ")}`}if(t.prompt){n+=`&prompt=${t.prompt}`}if(t.metadata){n+=`&metadata=${t.metadata}`}if(t.state||this.loginId){n+=`&state=${this.loginId?this.loginId:t.state}`}return n}async generateReauthURL(t,e){if(!t){throw new Error("Grant ID is required")}const n=await this.Storage.getUserToken(t);const i=await this.getCodeChallege();let r=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(i){r+=`&code_challenge=${i}&code_challenge_method=S256&options=rotate_refresh_token`}if(n?.provider){r+=`&provider=${n.provider}`}if(n?.email){r+=`&login_hint=${n.email}`}if(e){r+=`&scope=${e.join(" ")}`}return r}async generateCodeChallenge(){const t=await this.Storage.getPKCE();if(t){return}const e=v4();this.Storage.setPKCE(e);return}async hostedSetCodeChallenge(){if(!this.hosted){throw console.error("Method only used with hosted flag enabled")}const t=new URLSearchParams(window.location.search);const e=t.get("code_challenge");if(!e){const t=await this.Storage.getPKCE();if(t){return}console.warn("Code challenge is recomended");return}this.Storage.setPKCE(e)}async getCodeChallege(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){const t=new URLSearchParams(window.location.search);const e=t.get("code_challenge");if(!e){console.warn("Code challenge is recomended");return""}return e}const t=await this.Storage.getPKCE();if(t){const e=sha256.exports.sha256(t);let n=Buffer.from(e).toString("base64");n=Base64EncodeUrl(n);return n}return""}async isLoggedIn(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){return false}const t=await this.Storage.getUserTokens();if(t&&t.length>0){if(this.multiAccount){await this.generateCodeChallenge()}return true}await this.generateCodeChallenge();return false}isMultiAccount(){return this.multiAccount}async logout(){const t=await this.getProfile();await this.Storage.clearSession();const e={detail:t};window.dispatchEvent(new CustomEvent("onLogoutSuccess",e))}async getProfile(t=""){let e;if(t){e=await this.Storage.getUserToken(t)}else{e=await this.Storage.getUserToken()}if(e){return e}return null}async getProfiles(){const t=await this.Storage.getUserTokens();if(t){return t}return null}async removeProfile(t){await this.Storage.removeUserToken(t);await this.Storage.removeGrant(t);return null}async authIMAP(t){const e=await this.getCodeChallege();const n={imap_username:t.username,imap_password:t.password,imap_host:t.hostIMAP,imap_port:t.portIMAP,type:t.type,smtp_host:t.hostSMTP,smtp_port:t.portSMTP,provider:t.provider,redirect_uri:this.redirectUri,state:t.state,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e!=""){n.code_challenge=e;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const r=await i.json();return r}async authEWS(t){const e=await this.getCodeChallege();const n={...t,redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e!=""){n.code_challenge=e;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const r=await i.json();return r}async detectEmail(t){const e=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${t}`,{method:"POST",headers:new Headers({"content-type":"application/json"})});const n=await e.json();return n.data}async applicationInfo(){const t=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});const e=await t.json();return e.data}async getAvailableProviders(){const t=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});if(t){const e=await t.json();const n=e.data;return n}return null}onLoginSuccess(t){window.addEventListener("onLoginSuccess",(e=>t(e)))}onLogoutSuccess(t){window.addEventListener("onLogoutSuccess",(e=>t(e)))}onLoginFail(t){window.addEventListener("onLoginFail",(e=>t(e)))}onTokenRefreshSuccess(t){window.addEventListener("onTokenRefreshSuccess",(e=>t(e)))}onTokenRefreshFail(t){window.addEventListener("onTokenRefreshFail",(e=>t(e)))}onSessionExpired(t){window.addEventListener("onSessionExpired",(e=>t(e)))}async codeExchange(t){let e=new URLSearchParams(window.location.search);if(t){e=new URLSearchParams(t)}const n=e.get("code");const i=e.get("state");const r=e.get("error");const s=e.get("error_description");const o=e.get("error_code");if(r&&s&&o){const t={detail:{error:r,error_description:s,error_code:o}};window.dispatchEvent(new CustomEvent("onLoginFail",t));window.history.pushState({},document.title,window.location.pathname);return false}if(!n){console.warn("No code found");return false}if(window.opener&&window.name==="uas-popup"){console.warn("Popup window detected");return false}const a=await this.Storage.getPKCE();if(!a){console.warn("No code verifier found");return false}try{const t={client_id:this.clientId,redirect_uri:this.redirectUri,code:n,grant_type:"authorization_code",code_verifier:a};const e=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(t)});const r=await e.json();if(r){if(r.error){const t={detail:r};window.dispatchEvent(new CustomEvent("onLoginFail",t));return true}const t=await this.handleCodeExchangeResponse(r);if(!t.valid){const e={detail:t.data};window.dispatchEvent(new CustomEvent("onLoginFail",e));return true}else{if(i){t.data.state=i}const e={detail:t.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",e));window.history.pushState({},document.title,window.location.pathname)}}this.Storage.removePKCE();return true}catch(r){const t={detail:r};window.dispatchEvent(new CustomEvent("onLoginFail",t));window.history.pushState({},document.title,window.location.pathname);return false}}async tokenExchange(t=""){const e=await this.Storage.getGrant(t,this.multiAccount);if(!e){return false}const n=e.refresh_token;try{const e={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:n,grant_type:"refresh_token"};const i=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(e)});const r=await i.json();if(r){if(r.error){const t={detail:r};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return true}const e=getTimestamp();r.expires_in=e+r.expires_in;this.Storage.setGrant(r,this.multiAccount);const n=await this.validateIDToken(t);if(!n){const t={detail:r};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return true}const i={detail:r};window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",i));return true}this.Storage.removePKCE()}catch(t){const e={detail:t};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return false}}async handleCodeExchangeResponse(t){const e=true;if(t.error){return{data:t,valid:false}}const n=getTimestamp();t.expires_in=n+t.expires_in;this.Storage.setGrant(t,this.multiAccount);const i=o(t.id_token);i.status="authenticated";this.Storage.setUserToken(i);const r=await this.validateIDToken(i.sub);if(!r){return{data:t,valid:false}}return{data:t,valid:e}}async popUp(t){const e=500;const n=600;const i=window.screenX+(window.outerWidth-e)/2;const r=window.screenY+(window.outerHeight-n)/2.5;const s=`uas-popup`;const o=t;const a=window.open(o,s,`width=${e},height=${n},left=${i},top=${r}`);if(!a){return}const c=setInterval((async()=>{if(a.closed){const t={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",t));c&&clearInterval(c);return}try{const t=a.location.href.split("?");if(!t[0]){return}const e=a.location.search;a.history.pushState({},document.title,window.location.pathname);if(t[0]===this.redirectUri&&t.length>1){const t=await this.codeExchange(e);a.close();if(t){location.reload()}c&&clearInterval(c);return}}catch(t){return}}),1e3)}async getAccessToken(t=""){const e=getTimestamp();const n=await this.Storage.getGrant(t,this.multiAccount);if(!n){return null}const{access_token:i,expires_in:r}=n;const s=i;if(s){if(r&&r>getTimestamp()){const t=r-e;if(t>30){return s}}}await this.tokenExchange(t);const o=await this.Storage.getGrant(t,this.multiAccount);return o.access_token}async sse(t,e){const n=e.headers||{};const i=n["Grant-ID"];let r="";if(this.multiAccount){if(!i){this.logout();throw new Error("Grant ID is required for multi account calls")}r=await this.getAccessToken(i)}else{r=await this.getAccessToken()}delete n["Grant-ID"];n["Authorization"]=`Bearer ${r}`;if(!n["content-type"]){n["content-type"]="application/json"}return fetchEventSource(`${this.domain}/${t}`,{...e,headers:n})}async fetch(t,e,n=true,i){let r="";let s=1;if(this.multiAccount){if(!e.grant_id){this.logout();throw new Error("Grant ID is required for multi account calls")}const t=await this.getProfiles();s=t?t.length:1;r=await this.getAccessToken(e.grant_id)}else{r=await this.getAccessToken()}if(!r){throw new Error("Access token not found")}let o=e.headers;if(!Headers.prototype.isPrototypeOf(o)){o=new Headers({Authorization:`Bearer ${r}`,"content-type":"application/json"})}else{o.append("Authorization",`Bearer ${r}`);if(!o.has("content-type")){o.append("content-type","application/json")}}try{if(e?.body){e.body=JSON.stringify(e?.body)}const r=await fetch(`${i||this.domain}/${t}`,{...e,headers:o});if(!n){return r}const a=await(r?.json());const c=await this.isAuthenticatedResponse(r.status,a);if(!c){if(s>1){const t=await this.getProfile(e.grant_id);if(t){t.status="unauthorized";await this.Storage.setUserToken(t);const e={detail:{user:t}};window.dispatchEvent(new CustomEvent("onSessionExpired",e))}}else{const t=await this.Storage.getUserToken();const e={detail:{user:t}};window.dispatchEvent(new CustomEvent("onSessionExpired",e))}this.logout();return}return a}catch(t){throw t}}async fetchRequest(t,e,n,i=true,r,s){const o=await this.isLoggedIn();const a=new URL(t,r??this.domain);const c=new Headers;c.append("Accept","application/json");c.append("Content-Type","application/json");c.append("User-Agent","nylas-identity");if(o){const t=await this.getAccessToken();c.append("Authorization",`Bearer ${t}`)}const u=await fetch(a.toString(),{method:e||"GET",headers:c,mode:"cors",referrer:location.origin,body:n?JSON.stringify(n):undefined,...s||{}});if(!i){return u.body}const l=await u.json();return l}async isAuthenticatedResponse(t,e){if(t==401&&e?.error?.type=="token.unauthorized_access"){return false}return true}addAPIKey(t,e,n){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:true,iat:getTimestamp(),iss:"",email:e,provider:"virtual-calendar",status:"authenticated",name:e,sub:t});this.Storage.setGrant({grant_id:t,access_token:n,expires_in:2e9},this.multiAccount)}}var react_production_min={};
1
+ import{h,F as Fragment,r as registerInstance,c as createEvent,H as Host,a as getElement}from"./p-68c2fadf.js";import{X as Xr,N as NylasBaseProvider}from"./p-36e3bf97.js";import{N as NylasIdentityRequestWrapper}from"./p-613c070f.js";import{d as dataResponse,a as debug}from"./p-6c11737d.js";import{C as CreateNylasSchedulerConfigStore}from"./p-29938263.js";import{B as Buffer}from"./p-02aa5f03.js";import{p as process}from"./p-1ffbe196.js";import{c as commonjsGlobal}from"./p-cb65c223.js";import"./p-cabb2e68.js";class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:e}){this.nylasApiRequest=t;this.nylasSchedulerConfigStore=e}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[t,e]=await this.nylasApiRequest.request({method:"GET",path:`calendars`});if(e){return dataResponse(null,{message:"Error fetching calendars: "+e.message})}if(Xr(t)){return dataResponse(null,{message:"Error fetching calendars: "+t.error?.message})}this.nylasSchedulerConfigStore.state.calendars=t.data;return dataResponse(t.data)}async getConfigurationById(t,e=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(!e){const e=this.nylasSchedulerConfigStore.state.configurations.find((e=>e.id===t));if(e){this.nylasSchedulerConfigStore.state.selectedConfiguration=e;return dataResponse(e)}}const[n,i]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${t}`});if(i){return dataResponse(null,{message:"Error fetching configuration: "+i.message})}if(Xr(n)){return dataResponse(null,{message:"Error fetching configuration: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data;if(this.nylasSchedulerConfigStore.state.configurations.find((e=>e.id===t))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((e=>e.id===t?n.data:e))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data]}return dataResponse(n.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[t,e]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations`});if(e){return dataResponse(null,{message:"Error fetching configurations: "+e.message})}if(Xr(t)){return dataResponse(null,{message:"Error fetching configurations: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=t.data;return dataResponse(t.data)}async createConfiguration(t){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return dataResponse(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}const[e,n]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:t});if(n){return dataResponse(null,{message:"Error creating configuration: "+n.message})}if(Xr(e)){return dataResponse(null,{message:"Error creating configuration: "+e.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=e.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,e.data];return dataResponse(e.data)}async updateConfiguration(t){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[e,n]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${t.id}`,body:t});if(n){return dataResponse(null,{message:"Error updating configuration: "+n.message})}if(Xr(e)){return dataResponse(null,{message:"Error updating configuration: "+e.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=e.data;if(this.nylasSchedulerConfigStore.state.configurations.find((e=>e.id===t.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((n=>n.id===t.id?e.data:n))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,e.data]}return dataResponse(e.data)}async deleteConfiguration(t){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[e,n]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}`});if(n){return dataResponse(null,{message:"Error deleting configuration: "+n.message})}if(Xr(e)){return dataResponse(null,{message:"Error deleting configuration: "+e.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((e=>e.id!==t));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===t){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return dataResponse(e.data)}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:e}){this.nylasApiRequest=t;this.nylasSchedulerConfigStore=e}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()}}class LocalStorage{get(t){return new Promise((e=>{const n=window.localStorage.getItem(t);if(!n){e(null)}else{e(JSON.parse(n))}}))}async remove(t){window.localStorage.removeItem(t);return new Promise((t=>{t(null)}))}set(t,e){window.localStorage.setItem(t,JSON.stringify(e));return new Promise((t=>{t(null)}))}}const PKCE_KEY="pkce";const GRANT_KEY="grant";const USER_KEY="user";class Storage{Storage=new LocalStorage;constructor(t){if(t){this.Storage=t;return}}setPKCE(t){const e=Buffer.from(t);this.Storage.set(PKCE_KEY,e.toString("base64"))}async getPKCE(){try{const t=await this.Storage.get(PKCE_KEY);if(t){const e=Buffer.from(t,"base64");return e.toString("utf8")}}catch(t){return null}return null}removePKCE(){this.Storage.remove(PKCE_KEY)}setGrant(t,e=false){const{grant_id:n}=t;this.Storage.set(`${GRANT_KEY}${e?"-"+n:""}`,t)}removeGrant(t,e=false){this.Storage.remove(`${GRANT_KEY}${e?"-"+t:""}`)}async getGrant(t,e=false){const n=await this.Storage.get(`${GRANT_KEY}${e?"-"+t:""}`);if(n){return n}return null}async setUserToken(t){const e=await this.getUserTokens();if(e){const n=e.find((e=>e.sub===t.sub));if(!n){const n=[...e,t];this.Storage.set(USER_KEY,n)}else{const n=e.map((e=>{if(e.sub===t.sub){e=t}return e}));this.Storage.set(USER_KEY,n)}}else{this.Storage.set(USER_KEY,[t])}}async getUserToken(t=""){const e=await this.Storage.get(USER_KEY);if(e){if(t===""){return e[0]}const n=e.find((e=>e.sub===t));return n}return null}async getUserTokens(){const t=await this.Storage.get(USER_KEY);if(t){return t}return null}removeUserTokens(){this.Storage.remove(USER_KEY)}async removeUserToken(t){const e=await this.getUserTokens();const n=e?.filter((e=>e.sub!==t));this.Storage.set(USER_KEY,n)}async clearSession(){const t=await this.getUserTokens();t?.forEach((t=>{this.removeGrant(t.sub)}));this.removePKCE();this.removeUserTokens()}}class IndexedDBStorage{databaseName="identity-db";storeName="identity";get(t){const e=this;return new Promise(((n,i)=>{e.openDatabase().then((function(r){const s=r.transaction(e.storeName,"readwrite");const o=s.objectStore(e.storeName);const a=o.get(t);a.onsuccess=()=>{n(a.result)};a.onerror=()=>{i(a.error)};s.oncomplete=()=>{r.close()}}))}))}async remove(t){const e=this;return new Promise(((n,i)=>{const r=indexedDB.open(this.databaseName);r.onupgradeneeded=function(t){const n=t.target.result;n.createObjectStore(e.storeName)};r.onerror=()=>{i(r.error)};r.onsuccess=e=>{const r=e.target.result;const s=r.transaction(this.storeName,"readwrite");const o=s.objectStore(this.storeName);const a=o.delete(t);a.onsuccess=()=>{n(null)};a.onerror=()=>{i(a.error)};s.oncomplete=()=>{r.close()}}}))}set(t,e){return new Promise(((n,i)=>{const r=indexedDB.open(this.databaseName);r.onerror=()=>{i(r.error)};r.onupgradeneeded=t=>{const e=t.target.result;e.createObjectStore(this.storeName)};r.onsuccess=r=>{const s=r.target.result;const o=s.transaction(this.storeName,"readwrite");const a=o.objectStore(this.storeName);const c=a.put(e,t);c.onsuccess=()=>{n(e)};c.onerror=()=>{i(c.error)};o.oncomplete=()=>{s.close()}}}))}openDatabase(){const t=this;return new Promise((function(e,n){const i=indexedDB.open(t.databaseName,2);i.onupgradeneeded=function(e){const n=e.target.result;n.createObjectStore(t.storeName)};i.onsuccess=function(t){e(t.target.result)};i.onerror=function(t){n(t.error)}}))}}var sha256={exports:{}};(function(module){(function(){var ERROR="input is invalid type";var WINDOW=typeof window==="object";var root=WINDOW?window:{};if(root.JS_SHA256_NO_WINDOW){WINDOW=false}var WEB_WORKER=!WINDOW&&typeof self==="object";var NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process==="object"&&process.versions&&process.versions.node;if(NODE_JS){root=commonjsGlobal}else if(WEB_WORKER){root=self}var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&"object"==="object"&&module.exports;var ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!=="undefined";var HEX_CHARS="0123456789abcdef".split("");var EXTRA=[-2147483648,8388608,32768,128];var SHIFT=[24,16,8,0];var K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];var OUTPUT_TYPES=["hex","array","digest","arrayBuffer"];var blocks=[];if(root.JS_SHA256_NO_NODE_JS||!Array.isArray){Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}}if(ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)){ArrayBuffer.isView=function(t){return typeof t==="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer}}var createOutputMethod=function(t,e){return function(n){return new Sha256(e,true).update(n)[t]()}};var createMethod=function(t){var e=createOutputMethod("hex",t);if(NODE_JS){e=nodeWrap(e,t)}e.create=function(){return new Sha256(t)};e.update=function(t){return e.create().update(t)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];e[i]=createOutputMethod(i,t)}return e};var nodeWrap=function(method,is224){var crypto=eval("require('crypto')");var Buffer=eval("require('buffer').Buffer");var algorithm=is224?"sha224":"sha256";var nodeMethod=function(t){if(typeof t==="string"){return crypto.createHash(algorithm).update(t,"utf8").digest("hex")}else{if(t===null||t===undefined){throw new Error(ERROR)}else if(t.constructor===ArrayBuffer){t=new Uint8Array(t)}}if(Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer){return crypto.createHash(algorithm).update(new Buffer(t)).digest("hex")}else{return method(t)}};return nodeMethod};var createHmacOutputMethod=function(t,e){return function(n,i){return new HmacSha256(n,e,true).update(i)[t]()}};var createHmacMethod=function(t){var e=createHmacOutputMethod("hex",t);e.create=function(e){return new HmacSha256(e,t)};e.update=function(t,n){return e.create(t).update(n)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];e[i]=createHmacOutputMethod(i,t)}return e};function Sha256(t,e){if(e){blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0;this.blocks=blocks}else{this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}if(t){this.h0=3238371032;this.h1=914150663;this.h2=812702999;this.h3=4144912697;this.h4=4290775857;this.h5=1750603025;this.h6=1694076839;this.h7=3204075428}else{this.h0=1779033703;this.h1=3144134277;this.h2=1013904242;this.h3=2773480762;this.h4=1359893119;this.h5=2600822924;this.h6=528734635;this.h7=1541459225}this.block=this.start=this.bytes=this.hBytes=0;this.finalized=this.hashed=false;this.first=true;this.is224=t}Sha256.prototype.update=function(t){if(this.finalized){return}var e,n=typeof t;if(n!=="string"){if(n==="object"){if(t===null){throw new Error(ERROR)}else if(ARRAY_BUFFER&&t.constructor===ArrayBuffer){t=new Uint8Array(t)}else if(!Array.isArray(t)){if(!ARRAY_BUFFER||!ArrayBuffer.isView(t)){throw new Error(ERROR)}}}else{throw new Error(ERROR)}e=true}var i,r=0,s,o=t.length,a=this.blocks;while(r<o){if(this.hashed){this.hashed=false;a[0]=this.block;a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0}if(e){for(s=this.start;r<o&&s<64;++r){a[s>>2]|=t[r]<<SHIFT[s++&3]}}else{for(s=this.start;r<o&&s<64;++r){i=t.charCodeAt(r);if(i<128){a[s>>2]|=i<<SHIFT[s++&3]}else if(i<2048){a[s>>2]|=(192|i>>6)<<SHIFT[s++&3];a[s>>2]|=(128|i&63)<<SHIFT[s++&3]}else if(i<55296||i>=57344){a[s>>2]|=(224|i>>12)<<SHIFT[s++&3];a[s>>2]|=(128|i>>6&63)<<SHIFT[s++&3];a[s>>2]|=(128|i&63)<<SHIFT[s++&3]}else{i=65536+((i&1023)<<10|t.charCodeAt(++r)&1023);a[s>>2]|=(240|i>>18)<<SHIFT[s++&3];a[s>>2]|=(128|i>>12&63)<<SHIFT[s++&3];a[s>>2]|=(128|i>>6&63)<<SHIFT[s++&3];a[s>>2]|=(128|i&63)<<SHIFT[s++&3]}}}this.lastByteIndex=s;this.bytes+=s-this.start;if(s>=64){this.block=a[16];this.start=s-64;this.hash();this.hashed=true}else{this.start=s}}if(this.bytes>4294967295){this.hBytes+=this.bytes/4294967296<<0;this.bytes=this.bytes%4294967296}return this};Sha256.prototype.finalize=function(){if(this.finalized){return}this.finalized=true;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block;t[e>>2]|=EXTRA[e&3];this.block=t[16];if(e>=56){if(!this.hashed){this.hash()}t[0]=this.block;t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0}t[14]=this.hBytes<<3|this.bytes>>>29;t[15]=this.bytes<<3;this.hash()};Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,n=this.h2,i=this.h3,r=this.h4,s=this.h5,o=this.h6,a=this.h7,c=this.blocks,u,l,h,d,f,p,y,w,g,m,b;for(u=16;u<64;++u){f=c[u-15];l=(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;f=c[u-2];h=(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10;c[u]=c[u-16]+l+c[u-7]+h<<0}b=e&n;for(u=0;u<64;u+=4){if(this.first){if(this.is224){w=300032;f=c[0]-1413257819;a=f-150054599<<0;i=f+24177077<<0}else{w=704751109;f=c[0]-210244248;a=f-1521486534<<0;i=f+143694565<<0}this.first=false}else{l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10);h=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7);w=t&e;d=w^t&n^b;y=r&s^~r&o;f=a+h+y+K[u]+c[u];p=l+d;a=i+f<<0;i=f+p<<0}l=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10);h=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7);g=i&t;d=g^i&e^w;y=a&r^~a&s;f=o+h+y+K[u+1]+c[u+1];p=l+d;o=n+f<<0;n=f+p<<0;l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10);h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7);m=n&i;d=m^n&t^g;y=o&a^~o&r;f=s+h+y+K[u+2]+c[u+2];p=l+d;s=e+f<<0;e=f+p<<0;l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10);h=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7);b=e&n;d=b^e&i^m;y=s&o^~s&a;f=r+h+y+K[u+3]+c[u+3];p=l+d;r=t+f<<0;t=f+p<<0}this.h0=this.h0+t<<0;this.h1=this.h1+e<<0;this.h2=this.h2+n<<0;this.h3=this.h3+i<<0;this.h4=this.h4+r<<0;this.h5=this.h5+s<<0;this.h6=this.h6+o<<0;this.h7=this.h7+a<<0};Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,i=this.h3,r=this.h4,s=this.h5,o=this.h6,a=this.h7;var c=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];if(!this.is224){c+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]}return c};Sha256.prototype.toString=Sha256.prototype.hex;Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,i=this.h3,r=this.h4,s=this.h5,o=this.h6,a=this.h7;var c=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,r>>24&255,r>>16&255,r>>8&255,r&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];if(!this.is224){c.push(a>>24&255,a>>16&255,a>>8&255,a&255)}return c};Sha256.prototype.array=Sha256.prototype.digest;Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32);var e=new DataView(t);e.setUint32(0,this.h0);e.setUint32(4,this.h1);e.setUint32(8,this.h2);e.setUint32(12,this.h3);e.setUint32(16,this.h4);e.setUint32(20,this.h5);e.setUint32(24,this.h6);if(!this.is224){e.setUint32(28,this.h7)}return t};function HmacSha256(t,e,n){var i,r=typeof t;if(r==="string"){var s=[],o=t.length,a=0,c;for(i=0;i<o;++i){c=t.charCodeAt(i);if(c<128){s[a++]=c}else if(c<2048){s[a++]=192|c>>6;s[a++]=128|c&63}else if(c<55296||c>=57344){s[a++]=224|c>>12;s[a++]=128|c>>6&63;s[a++]=128|c&63}else{c=65536+((c&1023)<<10|t.charCodeAt(++i)&1023);s[a++]=240|c>>18;s[a++]=128|c>>12&63;s[a++]=128|c>>6&63;s[a++]=128|c&63}}t=s}else{if(r==="object"){if(t===null){throw new Error(ERROR)}else if(ARRAY_BUFFER&&t.constructor===ArrayBuffer){t=new Uint8Array(t)}else if(!Array.isArray(t)){if(!ARRAY_BUFFER||!ArrayBuffer.isView(t)){throw new Error(ERROR)}}}else{throw new Error(ERROR)}}if(t.length>64){t=new Sha256(e,true).update(t).array()}var u=[],l=[];for(i=0;i<64;++i){var h=t[i]||0;u[i]=92^h;l[i]=54^h}Sha256.call(this,e,n);this.update(l);this.oKeyPad=u;this.inner=true;this.sharedMemory=n}HmacSha256.prototype=new Sha256;HmacSha256.prototype.finalize=function(){Sha256.prototype.finalize.call(this);if(this.inner){this.inner=false;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory);this.update(this.oKeyPad);this.update(t);Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports;exports.sha224=createMethod(true);exports.sha256.hmac=createHmacMethod();exports.sha224.hmac=createHmacMethod(true);if(COMMON_JS){module.exports=exports}else{root.sha256=exports.sha256;root.sha224=exports.sha224}})()})(sha256);var getRandomValues;var rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){getRandomValues=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!=="undefined"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto);if(!getRandomValues){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return getRandomValues(rnds8)}const REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(t){return typeof t==="string"&&REGEX.test(t)}var byteToHex=[];for(var i=0;i<256;++i){byteToHex.push((i+256).toString(16).substr(1))}function stringify(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=(byteToHex[t[e+0]]+byteToHex[t[e+1]]+byteToHex[t[e+2]]+byteToHex[t[e+3]]+"-"+byteToHex[t[e+4]]+byteToHex[t[e+5]]+"-"+byteToHex[t[e+6]]+byteToHex[t[e+7]]+"-"+byteToHex[t[e+8]]+byteToHex[t[e+9]]+"-"+byteToHex[t[e+10]]+byteToHex[t[e+11]]+byteToHex[t[e+12]]+byteToHex[t[e+13]]+byteToHex[t[e+14]]+byteToHex[t[e+15]]).toLowerCase();if(!validate(n)){throw TypeError("Stringified UUID is invalid")}return n}function v4(t,e,n){t=t||{};var i=t.random||(t.rng||rng)();i[6]=i[6]&15|64;i[8]=i[8]&63|128;if(e){n=n||0;for(var r=0;r<16;++r){e[n+r]=i[r]}return e}return stringify(i)}async function getBytes(t,e){const n=t.getReader();let i;while(!(i=await n.read()).done){e(i.value)}}function getLines(t){let e;let n;let i;let r=false;return function s(o){if(e===undefined){e=o;n=0;i=-1}else{e=concat(e,o)}const a=e.length;let c=0;while(n<a){if(r){if(e[n]===10){c=++n}r=false}let s=-1;for(;n<a&&s===-1;++n){switch(e[n]){case 58:if(i===-1){i=n-c}break;case 13:r=true;case 10:s=n;break}}if(s===-1){break}t(e.subarray(c,s),i);c=n;i=-1}if(c===a){e=undefined}else if(c!==0){e=e.subarray(c);n-=c}}}function getMessages(t,e,n){let i=newMessage();const r=new TextDecoder;return function s(o,a){if(o.length===0){n===null||n===void 0?void 0:n(i);i=newMessage()}else if(a>0){const n=r.decode(o.subarray(0,a));const s=a+(o[a+1]===32?2:1);const c=r.decode(o.subarray(s));switch(n){case"data":i.data=i.data?i.data+"\n"+c:c;break;case"event":i.event=c;break;case"id":t(i.id=c);break;case"retry":const n=parseInt(c,10);if(!isNaN(n)){e(i.retry=n)}break}}}}function concat(t,e){const n=new Uint8Array(t.length+e.length);n.set(t);n.set(e,t.length);return n}function newMessage(){return{data:"",event:"",id:"",retry:undefined}}var __rest=undefined&&undefined.__rest||function(t,e){var n={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0)n[i]=t[i];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++){if(e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r]))n[i[r]]=t[i[r]]}return n};const EventStreamContentType="text/event-stream";const DefaultRetryInterval=1e3;const LastEventId="last-event-id";function fetchEventSource(t,e){var{signal:n,headers:i,onopen:r,onmessage:s,onclose:o,onerror:a,openWhenHidden:c,fetch:u}=e,l=__rest(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(((e,h)=>{const d=Object.assign({},i);if(!d.accept){d.accept=EventStreamContentType}let f;function p(){f.abort();if(!document.hidden){_()}}if(!c){document.addEventListener("visibilitychange",p)}let y=DefaultRetryInterval;let w=0;function g(){document.removeEventListener("visibilitychange",p);window.clearTimeout(w);f.abort()}n===null||n===void 0?void 0:n.addEventListener("abort",(()=>{g();e()}));const m=u!==null&&u!==void 0?u:window.fetch;const b=r!==null&&r!==void 0?r:defaultOnOpen;async function _(){var n;f=new AbortController;try{const n=await m(t,Object.assign(Object.assign({},l),{headers:d,signal:f.signal}));await b(n);await getBytes(n.body,getLines(getMessages((t=>{if(t){d[LastEventId]=t}else{delete d[LastEventId]}}),(t=>{y=t}),s)));o===null||o===void 0?void 0:o();g();e()}catch(t){if(!f.signal.aborted){try{const e=(n=a===null||a===void 0?void 0:a(t))!==null&&n!==void 0?n:y;window.clearTimeout(w);w=window.setTimeout(_,e)}catch(t){g();h(t)}}}}_()}))}function defaultOnOpen(t){const e=t.headers.get("content-type");if(!(e===null||e===void 0?void 0:e.startsWith(EventStreamContentType))){throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${e}`)}}function Base64EncodeUrl(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function getTimestamp(){return Math.floor(Date.now()/1e3)}function e(t){this.message=t}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r$1="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var n=String(t).replace(/=+$/,"");if(n.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,r,s=0,o=0,a="";r=n.charAt(o++);~r&&(i=s%4?64*i+r:r,s++%4)?a+=String.fromCharCode(255&i>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function t$1(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(r$1(t).replace(/(.)/g,(function(t,e){var n=e.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(e)}catch(t){return r$1(e)}}function n$1(t){this.message=t}function o(t,e){if("string"!=typeof t)throw new n$1("Invalid token specified");var n=!0===(e=e||{}).header?0:1;try{return JSON.parse(t$1(t.split(".")[n]))}catch(t){throw new n$1("Invalid token specified: "+t.message)}}n$1.prototype=new Error,n$1.prototype.name="InvalidTokenError";class NylasSessions{clientId;redirectUri;accessType="online";domain="http://api.nylas.com";versioned=false;Storage;hosted=false;multiAccount=false;loginId="";constructor(t){this.clientId=t.clientId;this.redirectUri=t.redirectUri;if(t.domain){this.domain=t.domain;const e=this.domain.substring(this.domain.length-3);if(e.includes("/v")){this.versioned=true}}if(t.multiAccount){this.multiAccount=t.multiAccount}if(t.sw){const t=new IndexedDBStorage;this.Storage=new Storage(t)}else{this.Storage=new Storage}if(t.accessType){this.accessType=t.accessType}if(t.loginId){this.loginId=t.loginId}if(t.hosted){this.hosted=t.hosted}this.codeExchange(null)}async validateAccessToken(t=""){const e=await this.Storage.getGrant(t,this.multiAccount);if(!e){return false}const{access_token:n}=e;try{const t=await fetch(`${this.domain}/connect/tokeninfo?access_token=${n}`,{method:"GET"});const e=await t.json();if(!e.data){return false}return true}catch(t){return false}}async validateIDToken(t=""){const e=await this.Storage.getGrant(t,this.multiAccount);if(!e){return false}const{id_token:n}=e;try{const t=await fetch(`${this.domain}/connect/tokeninfo?id_token=${n}`,{method:"GET"});if(t.status!==200){return false}const e=await t.json();if(!e.data){return false}return true}catch(t){return false}}getDomain(){return this.domain}async auth(t){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){await this.hostedSetCodeChallenge()}const e=await this.generateAuthURL(t);if(t.popup){this.popUp(e);return}return e}async generateAuthURL(t){const e=await this.getCodeChallege();let n=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(e){n+=`&code_challenge=${e}&code_challenge_method=S256&options=rotate_refresh_token`}if(t.provider){n+=`&provider=${t.provider}`}if(t.loginHint){n+=`&login_hint=${t.loginHint}`;if(t.includeGrantScopes){n+=`&include_grant_scopes=${t.includeGrantScopes}`}}if(t.scope){n+=`&scope=${t.scope.join(" ")}`}if(t.prompt){n+=`&prompt=${t.prompt}`}if(t.metadata){n+=`&metadata=${t.metadata}`}if(t.state||this.loginId){n+=`&state=${this.loginId?this.loginId:t.state}`}return n}async generateReauthURL(t,e){if(!t){throw new Error("Grant ID is required")}const n=await this.Storage.getUserToken(t);const i=await this.getCodeChallege();let r=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(i){r+=`&code_challenge=${i}&code_challenge_method=S256&options=rotate_refresh_token`}if(n?.provider){r+=`&provider=${n.provider}`}if(n?.email){r+=`&login_hint=${n.email}`}if(e){r+=`&scope=${e.join(" ")}`}return r}async generateCodeChallenge(){const t=await this.Storage.getPKCE();if(t){return}const e=v4();this.Storage.setPKCE(e);return}async hostedSetCodeChallenge(){if(!this.hosted){throw console.error("Method only used with hosted flag enabled")}const t=new URLSearchParams(window.location.search);const e=t.get("code_challenge");if(!e){const t=await this.Storage.getPKCE();if(t){return}console.warn("Code challenge is recomended");return}this.Storage.setPKCE(e)}async getCodeChallege(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){const t=new URLSearchParams(window.location.search);const e=t.get("code_challenge");if(!e){console.warn("Code challenge is recomended");return""}return e}const t=await this.Storage.getPKCE();if(t){const e=sha256.exports.sha256(t);let n=Buffer.from(e).toString("base64");n=Base64EncodeUrl(n);return n}return""}async isLoggedIn(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){return false}const t=await this.Storage.getUserTokens();if(t&&t.length>0){if(this.multiAccount){await this.generateCodeChallenge()}return true}await this.generateCodeChallenge();return false}isMultiAccount(){return this.multiAccount}async logout(){const t=await this.getProfile();await this.Storage.clearSession();const e={detail:t};window.dispatchEvent(new CustomEvent("onLogoutSuccess",e))}async getProfile(t=""){let e;if(t){e=await this.Storage.getUserToken(t)}else{e=await this.Storage.getUserToken()}if(e){return e}return null}async getProfiles(){const t=await this.Storage.getUserTokens();if(t){return t}return null}async removeProfile(t){await this.Storage.removeUserToken(t);await this.Storage.removeGrant(t);return null}async authIMAP(t){const e=await this.getCodeChallege();const n={imap_username:t.username,imap_password:t.password,imap_host:t.hostIMAP,imap_port:t.portIMAP,type:t.type,smtp_host:t.hostSMTP,smtp_port:t.portSMTP,provider:t.provider,redirect_uri:this.redirectUri,state:t.state,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e!=""){n.code_challenge=e;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const r=await i.json();return r}async authEWS(t){const e=await this.getCodeChallege();const n={...t,redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e!=""){n.code_challenge=e;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const r=await i.json();return r}async detectEmail(t){const e=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${t}`,{method:"POST",headers:new Headers({"content-type":"application/json"})});const n=await e.json();return n.data}async applicationInfo(){const t=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});const e=await t.json();return e.data}async getAvailableProviders(){const t=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});if(t){const e=await t.json();const n=e.data;return n}return null}onLoginSuccess(t){window.addEventListener("onLoginSuccess",(e=>t(e)))}onLogoutSuccess(t){window.addEventListener("onLogoutSuccess",(e=>t(e)))}onLoginFail(t){window.addEventListener("onLoginFail",(e=>t(e)))}onTokenRefreshSuccess(t){window.addEventListener("onTokenRefreshSuccess",(e=>t(e)))}onTokenRefreshFail(t){window.addEventListener("onTokenRefreshFail",(e=>t(e)))}onSessionExpired(t){window.addEventListener("onSessionExpired",(e=>t(e)))}async codeExchange(t){let e=new URLSearchParams(window.location.search);if(t){e=new URLSearchParams(t)}const n=e.get("code");const i=e.get("state");const r=e.get("error");const s=e.get("error_description");const o=e.get("error_code");if(r&&s&&o){const t={detail:{error:r,error_description:s,error_code:o}};window.dispatchEvent(new CustomEvent("onLoginFail",t));window.history.pushState({},document.title,window.location.pathname);return false}if(!n){console.warn("No code found");return false}if(window.opener&&window.name==="uas-popup"){console.warn("Popup window detected");return false}const a=await this.Storage.getPKCE();if(!a){console.warn("No code verifier found");return false}try{const t={client_id:this.clientId,redirect_uri:this.redirectUri,code:n,grant_type:"authorization_code",code_verifier:a};const e=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(t)});const r=await e.json();if(r){if(r.error){const t={detail:r};window.dispatchEvent(new CustomEvent("onLoginFail",t));return true}const t=await this.handleCodeExchangeResponse(r);if(!t.valid){const e={detail:t.data};window.dispatchEvent(new CustomEvent("onLoginFail",e));return true}else{if(i){t.data.state=i}const e={detail:t.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",e));window.history.pushState({},document.title,window.location.pathname)}}this.Storage.removePKCE();return true}catch(r){const t={detail:r};window.dispatchEvent(new CustomEvent("onLoginFail",t));window.history.pushState({},document.title,window.location.pathname);return false}}async tokenExchange(t=""){const e=await this.Storage.getGrant(t,this.multiAccount);if(!e){return false}const n=e.refresh_token;try{const e={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:n,grant_type:"refresh_token"};const i=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(e)});const r=await i.json();if(r){if(r.error){const t={detail:r};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return true}const e=getTimestamp();r.expires_in=e+r.expires_in;this.Storage.setGrant(r,this.multiAccount);const n=await this.validateIDToken(t);if(!n){const t={detail:r};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return true}const i={detail:r};window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",i));return true}this.Storage.removePKCE()}catch(t){const e={detail:t};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return false}}async handleCodeExchangeResponse(t){const e=true;if(t.error){return{data:t,valid:false}}const n=getTimestamp();t.expires_in=n+t.expires_in;this.Storage.setGrant(t,this.multiAccount);const i=o(t.id_token);i.status="authenticated";this.Storage.setUserToken(i);const r=await this.validateIDToken(i.sub);if(!r){return{data:t,valid:false}}return{data:t,valid:e}}async popUp(t){const e=500;const n=600;const i=window.screenX+(window.outerWidth-e)/2;const r=window.screenY+(window.outerHeight-n)/2.5;const s=`uas-popup`;const o=t;const a=window.open(o,s,`width=${e},height=${n},left=${i},top=${r}`);if(!a){return}const c=setInterval((async()=>{if(a.closed){const t={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",t));c&&clearInterval(c);return}try{const t=a.location.href.split("?");if(!t[0]){return}const e=a.location.search;a.history.pushState({},document.title,window.location.pathname);if(t[0]===this.redirectUri&&t.length>1){const t=await this.codeExchange(e);a.close();if(t){location.reload()}c&&clearInterval(c);return}}catch(t){return}}),1e3)}async getAccessToken(t=""){const e=getTimestamp();const n=await this.Storage.getGrant(t,this.multiAccount);if(!n){return null}const{access_token:i,expires_in:r}=n;const s=i;if(s){if(r&&r>getTimestamp()){const t=r-e;if(t>30){return s}}}await this.tokenExchange(t);const o=await this.Storage.getGrant(t,this.multiAccount);return o.access_token}async sse(t,e){const n=e.headers||{};const i=n["Grant-ID"];let r="";if(this.multiAccount){if(!i){this.logout();throw new Error("Grant ID is required for multi account calls")}r=await this.getAccessToken(i)}else{r=await this.getAccessToken()}delete n["Grant-ID"];n["Authorization"]=`Bearer ${r}`;if(!n["content-type"]){n["content-type"]="application/json"}return fetchEventSource(`${this.domain}/${t}`,{...e,headers:n})}async fetch(t,e,n=true,i){let r="";let s=1;if(this.multiAccount){if(!e.grant_id){this.logout();throw new Error("Grant ID is required for multi account calls")}const t=await this.getProfiles();s=t?t.length:1;r=await this.getAccessToken(e.grant_id)}else{r=await this.getAccessToken()}if(!r){throw new Error("Access token not found")}let o=e.headers;if(!Headers.prototype.isPrototypeOf(o)){o=new Headers({Authorization:`Bearer ${r}`,"content-type":"application/json"})}else{o.append("Authorization",`Bearer ${r}`);if(!o.has("content-type")){o.append("content-type","application/json")}}try{if(e?.body){e.body=JSON.stringify(e?.body)}const r=await fetch(`${i||this.domain}/${t}`,{...e,headers:o});if(!n){return r}const a=await(r?.json());const c=await this.isAuthenticatedResponse(r.status,a);if(!c){if(s>1){const t=await this.getProfile(e.grant_id);if(t){t.status="unauthorized";await this.Storage.setUserToken(t);const e={detail:{user:t}};window.dispatchEvent(new CustomEvent("onSessionExpired",e))}}else{const t=await this.Storage.getUserToken();const e={detail:{user:t}};window.dispatchEvent(new CustomEvent("onSessionExpired",e))}this.logout();return}return a}catch(t){throw t}}async fetchRequest(t,e,n,i=true,r,s){const o=await this.isLoggedIn();const a=new URL(t,r??this.domain);const c=new Headers;c.append("Accept","application/json");c.append("Content-Type","application/json");c.append("User-Agent","nylas-identity");if(o){const t=await this.getAccessToken();c.append("Authorization",`Bearer ${t}`)}const u=await fetch(a.toString(),{method:e||"GET",headers:c,mode:"cors",referrer:location.origin,body:n?JSON.stringify(n):undefined,...s||{}});if(!i){return u.body}const l=await u.json();return l}async isAuthenticatedResponse(t,e){if(t==401&&e?.error?.type=="token.unauthorized_access"){return false}return true}addAPIKey(t,e,n){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:true,iat:getTimestamp(),iss:"",email:e,provider:"virtual-calendar",status:"authenticated",name:e,sub:t});this.Storage.setGrant({grant_id:t,access_token:n,expires_in:2e9},this.multiAccount)}}var react_production_min={};
2
2
  /**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -7,5 +7,5 @@ import{h,F as Fragment,r as registerInstance,c as createEvent,H as Host,a as get
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */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(t){if(null===t||"object"!==typeof t)return null;t=z&&t[z]||t["@@iterator"];return"function"===typeof t?t:null}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(t,e,n){this.props=t;this.context=e;this.refs=D;this.updater=n||B}E.prototype.isReactComponent={};E.prototype.setState=function(t,e){if("object"!==typeof t&&"function"!==typeof t&&null!=t)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,t,e,"setState")};E.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(t,e,n){this.props=t;this.context=e;this.refs=D;this.updater=n||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(t,e,n){var i,r={},s=null,o=null;if(null!=e)for(i in void 0!==e.ref&&(o=e.ref),void 0!==e.key&&(s=""+e.key),e)J.call(e,i)&&!L.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(1===a)r.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];r.children=c}if(t&&t.defaultProps)for(i in a=t.defaultProps,a)void 0===r[i]&&(r[i]=a[i]);return{$$typeof:l,type:t,key:s,ref:o,props:r,_owner:K.current}}function N(t,e){return{$$typeof:l,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function O(t){return"object"===typeof t&&null!==t&&t.$$typeof===l}function escape(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,(function(t){return e[t]}))}var P=/\/+/g;function Q(t,e){return"object"===typeof t&&null!==t&&null!=t.key?escape(""+t.key):e.toString(36)}function R(t,e,i,r,s){var o=typeof t;if("undefined"===o||"boolean"===o)t=null;var a=!1;if(null===t)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case l:case n:a=!0}}if(a)return a=t,s=s(a),t=""===r?"."+Q(a,0):r,I(s)?(i="",null!=t&&(i=t.replace(P,"$&/")+"/"),R(s,e,i,"",(function(t){return t}))):null!=s&&(O(s)&&(s=N(s,i+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(P,"$&/")+"/")+t)),e.push(s)),1;a=0;r=""===r?".":r+":";if(I(t))for(var c=0;c<t.length;c++){o=t[c];var u=r+Q(o,c);a+=R(o,e,i,u,s)}else if(u=A(t),"function"===typeof u)for(t=u.call(t),c=0;!(o=t.next()).done;)o=o.value,u=r+Q(o,c++),a+=R(o,e,i,u,s);else if("object"===o)throw e=String(t),Error("Objects are not valid as a React child (found: "+("[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function S(t,e,n){if(null==t)return t;var i=[],r=0;R(t,i,"","",(function(t){return e.call(n,t,r++)}));return i}function T(t){if(-1===t._status){var e=t._result;e=e();e.then((function(e){if(0===t._status||-1===t._status)t._status=1,t._result=e}),(function(e){if(0===t._status||-1===t._status)t._status=2,t._result=e}));-1===t._status&&(t._status=0,t._result=e)}if(1===t._status)return t._result.default;throw t._result}var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};react_production_min.Children={map:S,forEach:function(t,e,n){S(t,(function(){e.apply(this,arguments)}),n)},count:function(t){var e=0;S(t,(function(){e++}));return e},toArray:function(t){return S(t,(function(t){return t}))||[]},only:function(t){if(!O(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};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(t,e,n){if(null===t||void 0===t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=C({},t.props),r=t.key,s=t.ref,o=t._owner;if(null!=e){void 0!==e.ref&&(s=e.ref,o=K.current);void 0!==e.key&&(r=""+e.key);if(t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(c in e)J.call(e,c)&&!L.hasOwnProperty(c)&&(i[c]=void 0===e[c]&&void 0!==a?a[c]:e[c])}var c=arguments.length-2;if(1===c)i.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];i.children=a}return{$$typeof:l,type:t.type,key:r,ref:s,props:i,_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(t){var e=M.bind(null,t);e.type=t;return e};react_production_min.createRef=function(){return{current:null}};react_production_min.forwardRef=function(t){return{$$typeof:v,render:t}};react_production_min.isValidElement=O;react_production_min.lazy=function(t){return{$$typeof:y,_payload:{_status:-1,_result:t},_init:T}};react_production_min.memo=function(t,e){return{$$typeof:x,type:t,compare:void 0===e?null:e}};react_production_min.startTransition=function(t){var e=V.transition;V.transition={};try{t()}finally{V.transition=e}};react_production_min.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};react_production_min.useCallback=function(t,e){return U.current.useCallback(t,e)};react_production_min.useContext=function(t){return U.current.useContext(t)};react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(t){return U.current.useDeferredValue(t)};react_production_min.useEffect=function(t,e){return U.current.useEffect(t,e)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(t,e,n){return U.current.useImperativeHandle(t,e,n)};react_production_min.useInsertionEffect=function(t,e){return U.current.useInsertionEffect(t,e)};react_production_min.useLayoutEffect=function(t,e){return U.current.useLayoutEffect(t,e)};react_production_min.useMemo=function(t,e){return U.current.useMemo(t,e)};react_production_min.useReducer=function(t,e,n){return U.current.useReducer(t,e,n)};react_production_min.useRef=function(t){return U.current.useRef(t)};react_production_min.useState=function(t){return U.current.useState(t)};react_production_min.useSyncExternalStore=function(t,e,n){return U.current.useSyncExternalStore(t,e,n)};react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";const LoginRequired=({authenticationUrl:t})=>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 e=>{e.preventDefault();const n=await t("google");if(n){window.location.href=n}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 e=>{e.preventDefault();const n=await t("microsoft");if(n){window.location.href=n}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 e=>{e.preventDefault();const n=await t();if(n){window.location.href=n}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 ExpressFlow=()=>h(Fragment,null,h("nylas-event-info",null,h("div",{slot:"inputs"},h("nylas-event-title",null),h("nylas-event-duration",null),h("nylas-event-location",null))),h("nylas-booking-calendar-picker",null));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 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 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{height:554px;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.login-required{height:auto}}.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;height:554px;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.list-configurations{height:auto}}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}';const NylasSchedulerEditorStyle0=nylasSchedulerEditorCss;const NylasSchedulerEditor=class{constructor(t){registerInstance(this,t);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=t=>{const e=this.schedulerConfigCloseClicked.emit(this.host);if(!e.defaultPrevented){localStorage.removeItem("grant");localStorage.removeItem("user");window.location.reload()}};this.authenticationUrl=async t=>{if(!this.nylasApiRequest){console.error(`[nylas-scheduler-editor] Nylas API Request is not initialized.`);return""}const e=await this.nylasApiRequest.authenticationUrl({provider:t});return e||""};this.configurationId=undefined;this.nylasApiRequest=undefined;this.nylasSessionsConfig=undefined;this.defaultAuthArgs=undefined;this.eventOverrides={};this.schedulerPreviewLink="";this.defaultSchedulerConfigState=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.defaultSchedulerConfigState})};if(!this.nylasApiRequest&&this.nylasSessionsConfig){const t=new NylasSessions(this.nylasSessionsConfig);await t.isLoggedIn();t.onLoginSuccess((async()=>{const t=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(t){this.loggedIn.emit(this.host);this.loggedInHandler(t)}}));t.onLoginFail((async()=>{this.stores?.schedulerConfig?.set("currentUser",null);this.loggedOut.emit(this.host)}));this.nylasApiRequest=new NylasIdentityRequestWrapper(t)}if(this.nylasApiRequest&&this.defaultAuthArgs){this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs)}this.baseProvider=new NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new NylasSchedulerConfigConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:t});const e=this.init.emit(this.host);if(!e.defaultPrevented){const t=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(t){this.loggedIn.emit(this.host);await this.loggedInHandler(t)}else{this.stores?.schedulerConfig?.set("currentUser",null);this.loggedOut.emit(this.host)}}this.stores?.schedulerConfig?.onChange("selectedConfiguration",(async t=>{if(t&&t.id){this.configurationId=t.id}}));this.baseProvider?.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){debug(`[nylas-scheduler-editor] componentDidLoad`);this.baseProvider?.componentDidLoad()}componentDisconnected(){this.baseProvider?.componentDisconnected()}async configurationIdChanged(t){if(t){await(this.nylasSchedulerConfigConnector?.schedulerConfig?.getConfigurationById(t));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(t){this.baseProvider?.registerComponent(t.detail)}async unregisterComponentHandler(t){this.baseProvider?.unregisterComponent(t.detail)}async loggedInHandler(t){this.stores?.schedulerConfig?.set("currentUser",t);if(!this.nylasSchedulerConfigConnector){return}if(this.configurationId){const t=await(this.nylasSchedulerConfigConnector.schedulerConfig?.getConfigurationById(this.configurationId));if(t&&t[0]?.id){this.stores?.schedulerConfig?.set("action","edit")}}await(this.nylasSchedulerConfigConnector.schedulerConfig?.getCalendars())}render(){return h(Host,{key:"e002a44eed281858acbac383ed43cbecc33f8787"},h("div",{key:"45b6210474e128efb8b9ed9652fb193ba4116483",class:"scheduler-editor-header",part:"nse__header"},h("h1",{key:"4a32b5953b88d41abe3c461cc009b4810e307e29",class:"scheduler-editor-title",part:"nse__title"},h("calendar-icon",{key:"14d24a40119d1f3aa37efe37a468c8abceae3903",width:"18",height:"18"}),"Scheduler editor"),h("button",{key:"dcbf3accf800d65dbd268da096ddd8ec93854096",class:"scheduler-editor-close",title:"logout",onClick:t=>this.handleSchedulerConfigCloseClicked(t),part:"nse__close-button"},h("close-icon",{key:"1f2b11860228f8d83a30427f7f1fd8412b61047b",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(ExpressFlow,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{configurationId:["configurationIdChanged"]}}};NylasSchedulerEditor.style=NylasSchedulerEditorStyle0;export{NylasSchedulerEditor as nylas_scheduler_editor};
11
- //# sourceMappingURL=p-afd34a25.entry.js.map
10
+ */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(t){if(null===t||"object"!==typeof t)return null;t=z&&t[z]||t["@@iterator"];return"function"===typeof t?t:null}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(t,e,n){this.props=t;this.context=e;this.refs=D;this.updater=n||B}E.prototype.isReactComponent={};E.prototype.setState=function(t,e){if("object"!==typeof t&&"function"!==typeof t&&null!=t)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,t,e,"setState")};E.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(t,e,n){this.props=t;this.context=e;this.refs=D;this.updater=n||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(t,e,n){var i,r={},s=null,o=null;if(null!=e)for(i in void 0!==e.ref&&(o=e.ref),void 0!==e.key&&(s=""+e.key),e)J.call(e,i)&&!L.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(1===a)r.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];r.children=c}if(t&&t.defaultProps)for(i in a=t.defaultProps,a)void 0===r[i]&&(r[i]=a[i]);return{$$typeof:l,type:t,key:s,ref:o,props:r,_owner:K.current}}function N(t,e){return{$$typeof:l,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function O(t){return"object"===typeof t&&null!==t&&t.$$typeof===l}function escape(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,(function(t){return e[t]}))}var P=/\/+/g;function Q(t,e){return"object"===typeof t&&null!==t&&null!=t.key?escape(""+t.key):e.toString(36)}function R(t,e,i,r,s){var o=typeof t;if("undefined"===o||"boolean"===o)t=null;var a=!1;if(null===t)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case l:case n:a=!0}}if(a)return a=t,s=s(a),t=""===r?"."+Q(a,0):r,I(s)?(i="",null!=t&&(i=t.replace(P,"$&/")+"/"),R(s,e,i,"",(function(t){return t}))):null!=s&&(O(s)&&(s=N(s,i+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(P,"$&/")+"/")+t)),e.push(s)),1;a=0;r=""===r?".":r+":";if(I(t))for(var c=0;c<t.length;c++){o=t[c];var u=r+Q(o,c);a+=R(o,e,i,u,s)}else if(u=A(t),"function"===typeof u)for(t=u.call(t),c=0;!(o=t.next()).done;)o=o.value,u=r+Q(o,c++),a+=R(o,e,i,u,s);else if("object"===o)throw e=String(t),Error("Objects are not valid as a React child (found: "+("[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function S(t,e,n){if(null==t)return t;var i=[],r=0;R(t,i,"","",(function(t){return e.call(n,t,r++)}));return i}function T(t){if(-1===t._status){var e=t._result;e=e();e.then((function(e){if(0===t._status||-1===t._status)t._status=1,t._result=e}),(function(e){if(0===t._status||-1===t._status)t._status=2,t._result=e}));-1===t._status&&(t._status=0,t._result=e)}if(1===t._status)return t._result.default;throw t._result}var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};react_production_min.Children={map:S,forEach:function(t,e,n){S(t,(function(){e.apply(this,arguments)}),n)},count:function(t){var e=0;S(t,(function(){e++}));return e},toArray:function(t){return S(t,(function(t){return t}))||[]},only:function(t){if(!O(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};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(t,e,n){if(null===t||void 0===t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=C({},t.props),r=t.key,s=t.ref,o=t._owner;if(null!=e){void 0!==e.ref&&(s=e.ref,o=K.current);void 0!==e.key&&(r=""+e.key);if(t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(c in e)J.call(e,c)&&!L.hasOwnProperty(c)&&(i[c]=void 0===e[c]&&void 0!==a?a[c]:e[c])}var c=arguments.length-2;if(1===c)i.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];i.children=a}return{$$typeof:l,type:t.type,key:r,ref:s,props:i,_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(t){var e=M.bind(null,t);e.type=t;return e};react_production_min.createRef=function(){return{current:null}};react_production_min.forwardRef=function(t){return{$$typeof:v,render:t}};react_production_min.isValidElement=O;react_production_min.lazy=function(t){return{$$typeof:y,_payload:{_status:-1,_result:t},_init:T}};react_production_min.memo=function(t,e){return{$$typeof:x,type:t,compare:void 0===e?null:e}};react_production_min.startTransition=function(t){var e=V.transition;V.transition={};try{t()}finally{V.transition=e}};react_production_min.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};react_production_min.useCallback=function(t,e){return U.current.useCallback(t,e)};react_production_min.useContext=function(t){return U.current.useContext(t)};react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(t){return U.current.useDeferredValue(t)};react_production_min.useEffect=function(t,e){return U.current.useEffect(t,e)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(t,e,n){return U.current.useImperativeHandle(t,e,n)};react_production_min.useInsertionEffect=function(t,e){return U.current.useInsertionEffect(t,e)};react_production_min.useLayoutEffect=function(t,e){return U.current.useLayoutEffect(t,e)};react_production_min.useMemo=function(t,e){return U.current.useMemo(t,e)};react_production_min.useReducer=function(t,e,n){return U.current.useReducer(t,e,n)};react_production_min.useRef=function(t){return U.current.useRef(t)};react_production_min.useState=function(t){return U.current.useState(t)};react_production_min.useSyncExternalStore=function(t,e,n){return U.current.useSyncExternalStore(t,e,n)};react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";const LoginRequired=({authenticationUrl:t})=>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 e=>{e.preventDefault();const n=await t("google");if(n){window.location.href=n}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 e=>{e.preventDefault();const n=await t("microsoft");if(n){window.location.href=n}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 e=>{e.preventDefault();const n=await t();if(n){window.location.href=n}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 ExpressFlow=()=>h(Fragment,null,h("nylas-event-info",null,h("div",{slot:"inputs"},h("nylas-event-title",null),h("nylas-event-duration",null),h("nylas-event-location",null))),h("nylas-booking-calendar-picker",null));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 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 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{height:554px;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.login-required{height:auto}}.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;height:554px;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.list-configurations{height:auto}}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}';const NylasSchedulerEditorStyle0=nylasSchedulerEditorCss;const NylasSchedulerEditor=class{constructor(t){registerInstance(this,t);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=t=>{const e=this.schedulerConfigCloseClicked.emit(this.host);if(!e.defaultPrevented){localStorage.removeItem("grant");localStorage.removeItem("user");window.location.reload()}};this.authenticationUrl=async t=>{if(!this.nylasApiRequest){console.error(`[nylas-scheduler-editor] Nylas API Request is not initialized.`);return""}const e=await this.nylasApiRequest.authenticationUrl({provider:t});return e||""};this.configurationId=undefined;this.nylasApiRequest=undefined;this.nylasSessionsConfig=undefined;this.defaultAuthArgs=undefined;this.eventOverrides={};this.schedulerPreviewLink="";this.defaultSchedulerConfigState=undefined;this.mode="app";this.additionalParticipants=undefined;this.automaticComponentRegistration=true}connectedCallback(){debug(`[nylas-scheduler-editor] connectedCallback`)}async componentWillLoad(){debug(`[nylas-scheduler-editor] componentWillLoad`);this.stores={schedulerConfig:CreateNylasSchedulerConfigStore({...this.defaultSchedulerConfigState,additionalParticipants:this.additionalParticipants})};if(!this.nylasApiRequest&&this.nylasSessionsConfig){const t=new NylasSessions(this.nylasSessionsConfig);await t.isLoggedIn();t.onLoginSuccess((async()=>{const t=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(t){this.loggedIn.emit(this.host);this.loggedInHandler(t)}}));t.onLoginFail((async()=>{this.stores?.schedulerConfig?.set("currentUser",null);this.loggedOut.emit(this.host)}));this.nylasApiRequest=new NylasIdentityRequestWrapper(t)}if(this.nylasApiRequest&&this.defaultAuthArgs){this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs)}this.baseProvider=new NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new NylasSchedulerConfigConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:t});const e=this.init.emit(this.host);if(!e.defaultPrevented){const t=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(t){this.loggedIn.emit(this.host);await this.loggedInHandler(t)}else{this.stores?.schedulerConfig?.set("currentUser",null);this.loggedOut.emit(this.host)}}this.stores?.schedulerConfig?.onChange("selectedConfiguration",(async t=>{if(t&&t.id){this.configurationId=t.id}}));this.baseProvider?.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){debug(`[nylas-scheduler-editor] componentDidLoad`);this.baseProvider?.componentDidLoad()}componentDisconnected(){this.baseProvider?.componentDisconnected()}async configurationIdChanged(t){if(t){await(this.nylasSchedulerConfigConnector?.schedulerConfig?.getConfigurationById(t));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(t){this.baseProvider?.registerComponent(t.detail)}async unregisterComponentHandler(t){this.baseProvider?.unregisterComponent(t.detail)}async loggedInHandler(t){this.stores?.schedulerConfig?.set("currentUser",t);if(!this.nylasSchedulerConfigConnector){return}if(this.configurationId){const t=await(this.nylasSchedulerConfigConnector.schedulerConfig?.getConfigurationById(this.configurationId));if(t&&t[0]?.id){this.stores?.schedulerConfig?.set("action","edit")}}await(this.nylasSchedulerConfigConnector.schedulerConfig?.getCalendars())}render(){return h(Host,{key:"d5f019173d3ec4f80d802de6989182b0e8e4c2d0"},h("div",{key:"7b1d14281fe950b0cd693349bb8cdd2cb428722f",class:"scheduler-editor-header",part:"nse__header"},h("h1",{key:"b24cf796d8db6a169757c552b9749568794b87fd",class:"scheduler-editor-title",part:"nse__title"},h("calendar-icon",{key:"d6721ba544b1c3c5f6e003034d491355de6b0cc7",width:"18",height:"18"}),"Scheduler editor"),h("button",{key:"bb9ce5bfa2e6df362b55c7f8cd1a2f1e06056ce7",class:"scheduler-editor-close",title:"logout",onClick:t=>this.handleSchedulerConfigCloseClicked(t),part:"nse__close-button"},h("close-icon",{key:"22dced4538079f05c5d036c9eef4882d79739cf9",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(ExpressFlow,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{configurationId:["configurationIdChanged"]}}};NylasSchedulerEditor.style=NylasSchedulerEditorStyle0;export{NylasSchedulerEditor as nylas_scheduler_editor};
11
+ //# sourceMappingURL=p-2f656fb3.entry.js.map