@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
@@ -1,6 +1,6 @@
1
- import { c as createStore } from './index-11d12497.js';
1
+ import { c as createStore } from './index-2c7e4f4b.js';
2
2
  export { N as NylasIdentityRequestWrapper } from './nylas-api-request-27e81d64.js';
3
- import './index-8362ce5c.js';
3
+ import './index-582cfc93.js';
4
4
  import './utils-49a1d17b.js';
5
5
  import './buffer-es6-5510d761.js';
6
6
  import './_commonjsHelpers-6cbf8316.js';
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-8362ce5c.js';
1
+ import { r as registerInstance, h } from './index-582cfc93.js';
2
2
 
3
3
  const iconCss = ".sc-info-icon-h{display:flex}";
4
4
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, i as createEvent, h } from './index-8362ce5c.js';
1
+ import { r as registerInstance, a as createEvent, h } from './index-582cfc93.js';
2
2
  import { s as sanitizeHtml_1 } from './index-ac065dce.js';
3
3
  import './_commonjsHelpers-6cbf8316.js';
4
4
  import './index-e7777c5d.js';
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, i as createEvent, h, e as getElement } from './index-8362ce5c.js';
1
+ import { r as registerInstance, a as createEvent, h, i as getElement } from './index-582cfc93.js';
2
2
 
3
3
  const inputDropdownCss = ":host{display:block;position:relative;--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{position:unset}}.dropdown{display:inline-block}.dropbtn{color:var(--nylas-base-800);padding:10px;font-size:1rem;font-family:var(--nylas-font-family);cursor:pointer;display:flex;gap:0.5rem;background:transparent;border:none;border-radius:var(--nylas-border-radius-2x);width:50px;padding:14px 16px;border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn:hover,.dropbtn:active{outline:1px solid var(--nylas-primary)}.dropbtn:active{outline:2px solid var(--nylas-primary)}.dropbtn span.chevron{display:flex;align-self:center}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropbtn span.selected-option{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:144px;font-size:14px;line-height:20px}@media screen and (max-width: 768px){.dropbtn span.selected-option{max-width:124px;font-size:16px}}.dropdown-content{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);max-width:306px;width:max-content;max-height:336px;overflow:auto;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1)}@media screen and (max-width: 768px){.dropdown-content{right:0;width:325px;max-width:unset}}.search-box{border-bottom:1px solid var(--nylas-base-200);padding:10px;position:sticky;top:0;background:var(--nylas-base-0)}.search-box .icon{position:absolute;top:1.25rem;left:1.25rem;color:var(--nylas-base-300)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:left;cursor:pointer}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content .selected{background-color:#e7e7e7}input[type=text]{width:-webkit-fill-available;padding:inherit;border:1px solid #ccc;border-radius:4px;position:sticky;background:no-repeat scroll 7px 7px;padding-left:30px;background-size:16px 16px}";
4
4
 
@@ -29,6 +29,12 @@ const InputDropdown = class {
29
29
  }
30
30
  this.selectedOption = newValue;
31
31
  }
32
+ inputValueChangedHandler(newValue, oldValue) {
33
+ if (newValue === oldValue) {
34
+ return;
35
+ }
36
+ this.inputValue = newValue;
37
+ }
32
38
  componentWillLoad() {
33
39
  this.filteredOptions = this.options;
34
40
  if (!this.selectedOption && !!this.defaultInputOption) {
@@ -174,7 +180,7 @@ const InputDropdown = class {
174
180
  }
175
181
  }
176
182
  render() {
177
- return (h("div", { key: '763e9bef7edb44ff217147c9ee63ec0076c4cc4a', class: "dropdown", part: "id_dropdown" }, h("input", { key: '579022217510a4be6a23c6b2f65910c4b993b42d', type: "text", name: this.name, id: this.name, part: "id_dropdown-input", class: { dropbtn: true, open: this.isOpen }, value: this.inputValue, onClick: (e) => {
183
+ return (h("div", { key: '24c46ff43e7ff2701790b5e7cd69833a4c0fa02f', class: "dropdown", part: "id_dropdown" }, h("input", { key: '86724f295c643d3edda0de987b17f85389a0a716', type: "text", name: this.name, id: this.name, part: "id_dropdown-input", class: { dropbtn: true, open: this.isOpen }, value: this.inputValue, onClick: (e) => {
178
184
  this.toggleDropdown();
179
185
  this.shouldAutoScroll = true;
180
186
  this.handleClick(e);
@@ -185,7 +191,8 @@ const InputDropdown = class {
185
191
  get el() { return getElement(this); }
186
192
  static get watchers() { return {
187
193
  "options": ["optionsChangedHandler"],
188
- "defaultInputOption": ["defaultSelectedOptionChangedHandler"]
194
+ "defaultInputOption": ["defaultSelectedOptionChangedHandler"],
195
+ "inputValue": ["inputValueChangedHandler"]
189
196
  }; }
190
197
  };
191
198
  InputDropdown.style = inputDropdownCss;
@@ -1 +1 @@
1
- {"file":"input-dropdown.entry.esm.js","mappings":";;AAAA,MAAM,gBAAgB,GAAG,myFAAmyF;;MCmB/yF,aAAa;;;;;uBAcY,EAAE;;;+BAYJ,EAAE;8BAMa,IAAI,CAAC,kBAAkB,IAA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,CAAC,oBAAoB,EAAE,SAAS,EAAE,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,IACnJ,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,KAC9B,UACE,QAAQ,EAAC,GAAG,EACZ,GAAG,EAAE,MAAM,CAAC,KAAK,EACjB,EAAE,EAAE,MAAM,CAAC,KAAK,EAChB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EACxC,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,oBAAoB,KAAK,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;aAC/D,IAEA,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,CAChD,CACN,CAAC,CACC,CACD,IACJ,IAAI,CACJ,EACN;KACH;;;;;;;;;;;","names":[],"sources":["src/components/design-system/input-dropdown/input-dropdown.scss?tag=input-dropdown&encapsulation=shadow","src/components/design-system/input-dropdown/input-dropdown.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n position: relative;\n @media #{$mobile} {\n position: unset;\n }\n @include default-css-variables;\n}\n\n.dropdown {\n display: inline-block;\n}\n\n.dropbtn {\n color: var(--nylas-base-800);\n padding: 10px;\n font-size: 1rem;\n font-family: var(--nylas-font-family);\n cursor: pointer;\n display: flex;\n gap: 0.5rem;\n background: transparent;\n border: none;\n border-radius: var(--nylas-border-radius-2x);\n width: 50px;\n padding: 14px 16px;\n border-radius: var(--nylas-border-radius-2x);\n &.focus {\n background: transparent;\n }\n &:hover,\n &:active {\n outline: 1px solid var(--nylas-primary);\n }\n &:active {\n outline: 2px solid var(--nylas-primary);\n }\n span {\n &.chevron {\n display: flex;\n align-self: center;\n }\n &.open {\n transform: rotate(90deg);\n }\n &.closed {\n transform: rotate(270deg);\n }\n &.selected-option {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n max-width: 144px;\n font-size: 14px;\n line-height: 20px;\n @media #{$mobile} {\n max-width: 124px;\n font-size: 16px;\n }\n }\n }\n}\n\n.dropdown-content {\n display: block;\n margin-top: 0.5rem;\n background-color: var(--nylas-base-0);\n max-width: 306px;\n width: max-content;\n max-height: 336px;\n overflow: auto;\n z-index: 1;\n border-radius: 4px;\n position: absolute;\n @media #{$mobile} {\n right: 0;\n width: 325px;\n max-width: unset;\n }\n box-shadow: 0px 4px 6px -2px rgba(0, 0, 0, 0.05);\n box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1);\n}\n\n.search-box {\n border-bottom: 1px solid var(--nylas-base-200);\n padding: 10px;\n position: sticky;\n top: 0;\n background: var(--nylas-base-0);\n .icon {\n position: absolute;\n top: 1.25rem;\n left: 1.25rem;\n color: var(--nylas-base-300);\n }\n}\n\n.dropdown-content ul {\n padding: 0;\n list-style-type: none;\n color: var(--nylas-base-900);\n max-height: 336px;\n li {\n padding: 16px, 12px, 16px, 12px;\n color: black;\n padding: 12px 16px;\n text-decoration: none;\n display: block;\n font-family: inherit;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n letter-spacing: 0px;\n text-align: left;\n cursor: pointer;\n &:hover,\n &:focus {\n background-color: var(--nylas-base-100);\n }\n }\n}\n\n.dropdown-content .selected {\n background-color: #e7e7e7;\n}\n\ninput[type='text'] {\n width: -webkit-fill-available;\n padding: inherit;\n border: 1px solid #ccc;\n border-radius: 4px;\n position: sticky;\n background: no-repeat scroll 7px 7px;\n padding-left: 30px;\n background-size: 16px 16px;\n}\n","import { Component, Element, Event, EventEmitter, h, Listen, Prop, State, Watch } from '@stencil/core';\n\ninterface DropdownOption {\n labelHTML?: HTMLElement;\n label: string;\n value: string;\n}\n\n/**\n * The `input-dropdown` component is a dropdown that allows users to input an option and/or select from a list of options.\n * @part id_dropdown - The dropdown container\n * @part id_dropdown-input - The dropdown button\n * @part id_dropdown-content - The dropdown content\n */\n@Component({\n tag: 'input-dropdown',\n styleUrl: 'input-dropdown.scss',\n shadow: true,\n})\nexport class InputDropdown {\n @Element() el!: HTMLElement;\n\n private inputRef?: HTMLInputElement;\n private optionsRef!: HTMLElement;\n\n // Props\n /**\n * The name of the dropdown\n */\n @Prop() name!: string;\n /**\n * The options to display in the dropdown\n */\n @Prop() options: DropdownOption[] = [];\n /**\n * The default selected option\n */\n @Prop() defaultInputOption?: DropdownOption;\n /**\n * Should show search input\n */\n @Prop() inputValue!: string;\n /**\n * Show pluralized label for the selected option. This is s tring that is appended to the selected option label as a suffix.\n */\n @Prop() pluralizedLabel: string = '';\n\n // States\n /**\n * The selected option\n */\n @State() selectedOption: DropdownOption | null = this.defaultInputOption || null;\n /**\n * The open state of the dropdown\n */\n @State() isOpen: boolean = false;\n\n /**\n * The filtered options based on the search value\n */\n @State() filteredOptions: DropdownOption[] = [...this.options];\n /**\n * The aria-activedescendant attribute for the listbox element to indicate the currently active\n * option in the list box to screen readers. The value of aria-activedescendant is the ID of\n * the active option.\n */\n @State() ariaActivedescendant: string = '';\n\n /**\n * This is used to scroll to the input value.\n */\n @State() shouldAutoScroll: boolean = false;\n\n // Events\n /**\n * This event is fired when the selected option is changed\n */\n @Event({ bubbles: true, composed: true }) inputOptionChanged!: EventEmitter<{\n value: DropdownOption['value'];\n name: string;\n }>;\n\n @Watch('options')\n optionsChangedHandler(newValue: DropdownOption[], oldValue: DropdownOption[]) {\n if (newValue === oldValue) {\n return;\n }\n this.filteredOptions = newValue;\n }\n\n @Watch('defaultInputOption')\n defaultSelectedOptionChangedHandler(newValue: DropdownOption, oldValue: DropdownOption) {\n if (newValue.label === oldValue.label) {\n return;\n }\n this.selectedOption = newValue;\n }\n\n // Lifecycle methods\n componentWillLoad() {\n this.filteredOptions = this.options;\n // Set the selected option to the first option if no option is selected\n if (!this.selectedOption && !!this.defaultInputOption) {\n this.selectedOption = this.defaultInputOption;\n }\n if (!this.selectedOption && this.options.length > 0) {\n this.selectedOption = this.options[0];\n }\n }\n\n // Methods\n toggleDropdown(): void {\n this.isOpen = !this.isOpen;\n }\n\n selectOption(option: DropdownOption): void {\n this.selectedOption = option;\n this.toggleDropdown();\n this.inputOptionChanged.emit({\n value: option.value,\n name: this.name,\n });\n }\n\n handleOnInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n const optionIndex = this.options.findIndex(option => option.label.toLowerCase().includes(value.toLowerCase()));\n if (optionIndex > -1) {\n this.scrollToViewWithinParent(optionIndex);\n }\n this.inputOptionChanged.emit({\n value,\n name: this.name,\n });\n }\n\n scrollToViewWithinParent(optionIndex: number) {\n const option = this.options[optionIndex];\n const childElement = this.el.shadowRoot?.getElementById(option.value.toString()) as HTMLLIElement;\n const parentElement = this.optionsRef;\n\n this.ariaActivedescendant = option.value.toString();\n\n // Scroll child into view within parent\n const childRect = childElement.getBoundingClientRect();\n const parentRect = parentElement.getBoundingClientRect();\n\n if (childRect.top < parentRect.top) {\n // Child is above the visible area of the parent\n parentElement.scrollTop -= parentRect.top - childRect.top;\n } else if (childRect.bottom > parentRect.bottom) {\n // Child is below the visible area of the parent\n parentElement.scrollTop += childRect.bottom - parentRect.bottom;\n }\n }\n\n handleSelectButtonKeyDown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowDown':\n case 'Enter':\n event.preventDefault();\n if (!this.isOpen) {\n this.toggleDropdown();\n }\n this.inputRef?.focus();\n break;\n case 'Escape':\n this.isOpen = false;\n break;\n }\n }\n\n handleClick(event: Event): void {\n if (this.isOpen) {\n const value = (event.target as HTMLInputElement).value;\n const optionIndex = this.options.findIndex(option => option.label.toLowerCase().includes(value.toLowerCase()));\n if (optionIndex > -1) {\n setTimeout(() => {\n this.scrollToViewWithinParent(optionIndex);\n }, 10);\n }\n }\n }\n\n handleListboxKeydown(e) {\n const items = this.filteredOptions;\n const currentIndex = items.findIndex(item => item.value === this.ariaActivedescendant);\n if (e.key === 'ArrowDown' || (e.key === 'Tab' && !e.shiftKey)) {\n e.preventDefault();\n if (currentIndex === items.length - 1) {\n this.ariaActivedescendant = '';\n this.inputRef?.focus();\n return;\n }\n const nextIndex = currentIndex + 1 < items.length ? currentIndex + 1 : 0;\n this.ariaActivedescendant = items[nextIndex].value;\n this.focusOption(nextIndex);\n } else if (e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)) {\n e.preventDefault();\n if (currentIndex === 0) {\n this.ariaActivedescendant = '';\n this.inputRef?.focus();\n return;\n }\n const prevIndex = currentIndex - 1 >= 0 ? currentIndex - 1 : items.length - 1;\n this.ariaActivedescendant = items[prevIndex].value;\n this.focusOption(prevIndex);\n } else if (e.key === 'Enter') {\n e.preventDefault();\n if (this.ariaActivedescendant) {\n this.selectOption(items[currentIndex]);\n }\n } else if (e.key === 'Escape') {\n this.isOpen = false;\n }\n }\n\n focusOption(index) {\n const option = this.filteredOptions[index];\n if (!option) return; // Guard clause in case index is out of bounds\n\n const elementId = option.value;\n const element = this.el.shadowRoot?.getElementById(elementId) as HTMLLIElement;\n\n if (element) {\n element.focus(); // Set focus on the element\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n }\n }\n\n handleComboboxKeyDown(event: KeyboardEvent): void {\n if (event.key === 'ArrowDown' || (event.key == 'Tab' && !event.shiftKey)) {\n event.preventDefault();\n if (!this.isOpen) {\n this.isOpen = true;\n this.shouldAutoScroll = true;\n return;\n }\n this.ariaActivedescendant = this.filteredOptions[0].value;\n this.focusOption(0);\n } else if (event.key === 'ArrowUp' || (event.key === 'Tab' && event.shiftKey)) {\n event.preventDefault();\n this.ariaActivedescendant = this.filteredOptions[this.filteredOptions.length - 1].value;\n this.focusOption(this.filteredOptions.length - 1);\n } else if (event.key === 'Escape') {\n this.isOpen = false;\n }\n }\n\n // Event listeners\n @Listen('click', { target: 'document', capture: true })\n handleOutsideClick(event: MouseEvent) {\n // Get the path of the event\n const path = event.composedPath();\n\n // Check if the path includes the host element\n const isClickInside = path.includes(this.el);\n\n if (!isClickInside && this.isOpen) {\n this.isOpen = false;\n }\n }\n\n render() {\n return (\n <div class=\"dropdown\" part=\"id_dropdown\">\n <input\n type=\"text\"\n name={this.name}\n id={this.name}\n part=\"id_dropdown-input\"\n class={{ dropbtn: true, open: this.isOpen }}\n value={this.inputValue}\n onClick={(e: Event) => {\n this.toggleDropdown();\n this.shouldAutoScroll = true;\n this.handleClick(e);\n }}\n aria-haspopup=\"listbox\"\n aria-label={this.name}\n aria-expanded={this.isOpen ? 'true' : 'false'}\n onKeyDown={e => this.handleComboboxKeyDown(e)}\n onInput={event => this.handleOnInput(event)}\n />\n {this.isOpen ? (\n <div class=\"dropdown-content\" part=\"id_dropdown-content\" ref={el => (this.optionsRef = el as HTMLElement)}>\n <ul tabindex=\"-1\" role=\"listbox\" aria-label={this.name} aria-activedescendant={this.ariaActivedescendant} onKeyDown={e => this.handleListboxKeydown(e)}>\n {this.filteredOptions.map(option => (\n <li\n tabindex=\"0\"\n key={option.value}\n id={option.value}\n onClick={() => this.selectOption(option)}\n role=\"option\"\n class={{\n focused: this.ariaActivedescendant === option.value.toString(),\n }}\n >\n {option.labelHTML ? option.labelHTML : option.label}\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"input-dropdown.entry.esm.js","mappings":";;AAAA,MAAM,gBAAgB,GAAG,myFAAmyF;;MCmB/yF,aAAa;;;;;uBAcY,EAAE;;;+BAYJ,EAAE;8BAMa,IAAI,CAAC,kBAAkB,IAAI,IAAI;sBAIrD,KAAK;+BAKa,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;oCAMtB,EAAE;gCAKL,KAAK;;IAY1C,qBAAqB,CAAC,QAA0B,EAAE,QAA0B;QAC1E,IAAI,QAAQ,KAAK,QAAQ,EAAE;YACzB,OAAO;SACR;QACD,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;KACjC;IAGD,mCAAmC,CAAC,QAAwB,EAAE,QAAwB;QACpF,IAAI,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,EAA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AK,EACjB,EAAE,EAAE,MAAM,CAAC,KAAK,EAChB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EACxC,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,oBAAoB,KAAK,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;aAC/D,IAEA,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,CAChD,CACN,CAAC,CACC,CACD,IACJ,IAAI,CACJ,EACN;KACH;;;;;;;;;;;;","names":[],"sources":["src/components/design-system/input-dropdown/input-dropdown.scss?tag=input-dropdown&encapsulation=shadow","src/components/design-system/input-dropdown/input-dropdown.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n position: relative;\n @media #{$mobile} {\n position: unset;\n }\n @include default-css-variables;\n}\n\n.dropdown {\n display: inline-block;\n}\n\n.dropbtn {\n color: var(--nylas-base-800);\n padding: 10px;\n font-size: 1rem;\n font-family: var(--nylas-font-family);\n cursor: pointer;\n display: flex;\n gap: 0.5rem;\n background: transparent;\n border: none;\n border-radius: var(--nylas-border-radius-2x);\n width: 50px;\n padding: 14px 16px;\n border-radius: var(--nylas-border-radius-2x);\n &.focus {\n background: transparent;\n }\n &:hover,\n &:active {\n outline: 1px solid var(--nylas-primary);\n }\n &:active {\n outline: 2px solid var(--nylas-primary);\n }\n span {\n &.chevron {\n display: flex;\n align-self: center;\n }\n &.open {\n transform: rotate(90deg);\n }\n &.closed {\n transform: rotate(270deg);\n }\n &.selected-option {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n max-width: 144px;\n font-size: 14px;\n line-height: 20px;\n @media #{$mobile} {\n max-width: 124px;\n font-size: 16px;\n }\n }\n }\n}\n\n.dropdown-content {\n display: block;\n margin-top: 0.5rem;\n background-color: var(--nylas-base-0);\n max-width: 306px;\n width: max-content;\n max-height: 336px;\n overflow: auto;\n z-index: 1;\n border-radius: 4px;\n position: absolute;\n @media #{$mobile} {\n right: 0;\n width: 325px;\n max-width: unset;\n }\n box-shadow: 0px 4px 6px -2px rgba(0, 0, 0, 0.05);\n box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1);\n}\n\n.search-box {\n border-bottom: 1px solid var(--nylas-base-200);\n padding: 10px;\n position: sticky;\n top: 0;\n background: var(--nylas-base-0);\n .icon {\n position: absolute;\n top: 1.25rem;\n left: 1.25rem;\n color: var(--nylas-base-300);\n }\n}\n\n.dropdown-content ul {\n padding: 0;\n list-style-type: none;\n color: var(--nylas-base-900);\n max-height: 336px;\n li {\n padding: 16px, 12px, 16px, 12px;\n color: black;\n padding: 12px 16px;\n text-decoration: none;\n display: block;\n font-family: inherit;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n letter-spacing: 0px;\n text-align: left;\n cursor: pointer;\n &:hover,\n &:focus {\n background-color: var(--nylas-base-100);\n }\n }\n}\n\n.dropdown-content .selected {\n background-color: #e7e7e7;\n}\n\ninput[type='text'] {\n width: -webkit-fill-available;\n padding: inherit;\n border: 1px solid #ccc;\n border-radius: 4px;\n position: sticky;\n background: no-repeat scroll 7px 7px;\n padding-left: 30px;\n background-size: 16px 16px;\n}\n","import { Component, Element, Event, EventEmitter, h, Listen, Prop, State, Watch } from '@stencil/core';\n\ninterface DropdownOption {\n labelHTML?: HTMLElement;\n label: string;\n value: string;\n}\n\n/**\n * The `input-dropdown` component is a dropdown that allows users to input an option and/or select from a list of options.\n * @part id_dropdown - The dropdown container\n * @part id_dropdown-input - The dropdown button\n * @part id_dropdown-content - The dropdown content\n */\n@Component({\n tag: 'input-dropdown',\n styleUrl: 'input-dropdown.scss',\n shadow: true,\n})\nexport class InputDropdown {\n @Element() el!: HTMLElement;\n\n private inputRef?: HTMLInputElement;\n private optionsRef!: HTMLElement;\n\n // Props\n /**\n * The name of the dropdown\n */\n @Prop() name!: string;\n /**\n * The options to display in the dropdown\n */\n @Prop() options: DropdownOption[] = [];\n /**\n * The default selected option\n */\n @Prop() defaultInputOption?: DropdownOption;\n /**\n * Should show search input\n */\n @Prop() inputValue!: string;\n /**\n * Show pluralized label for the selected option. This is s tring that is appended to the selected option label as a suffix.\n */\n @Prop() pluralizedLabel: string = '';\n\n // States\n /**\n * The selected option\n */\n @State() selectedOption: DropdownOption | null = this.defaultInputOption || null;\n /**\n * The open state of the dropdown\n */\n @State() isOpen: boolean = false;\n\n /**\n * The filtered options based on the search value\n */\n @State() filteredOptions: DropdownOption[] = [...this.options];\n /**\n * The aria-activedescendant attribute for the listbox element to indicate the currently active\n * option in the list box to screen readers. The value of aria-activedescendant is the ID of\n * the active option.\n */\n @State() ariaActivedescendant: string = '';\n\n /**\n * This is used to scroll to the input value.\n */\n @State() shouldAutoScroll: boolean = false;\n\n // Events\n /**\n * This event is fired when the selected option is changed\n */\n @Event({ bubbles: true, composed: true }) inputOptionChanged!: EventEmitter<{\n value: DropdownOption['value'];\n name: string;\n }>;\n\n @Watch('options')\n optionsChangedHandler(newValue: DropdownOption[], oldValue: DropdownOption[]) {\n if (newValue === oldValue) {\n return;\n }\n this.filteredOptions = newValue;\n }\n\n @Watch('defaultInputOption')\n defaultSelectedOptionChangedHandler(newValue: DropdownOption, oldValue: DropdownOption) {\n if (newValue.label === oldValue.label) {\n return;\n }\n this.selectedOption = newValue;\n }\n\n @Watch('inputValue')\n inputValueChangedHandler(newValue: string, oldValue: string) {\n if (newValue === oldValue) {\n return;\n }\n this.inputValue = newValue;\n }\n\n // Lifecycle methods\n componentWillLoad() {\n this.filteredOptions = this.options;\n // Set the selected option to the first option if no option is selected\n if (!this.selectedOption && !!this.defaultInputOption) {\n this.selectedOption = this.defaultInputOption;\n }\n if (!this.selectedOption && this.options.length > 0) {\n this.selectedOption = this.options[0];\n }\n }\n\n // Methods\n toggleDropdown(): void {\n this.isOpen = !this.isOpen;\n }\n\n selectOption(option: DropdownOption): void {\n this.selectedOption = option;\n this.toggleDropdown();\n this.inputOptionChanged.emit({\n value: option.value,\n name: this.name,\n });\n }\n\n handleOnInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n const optionIndex = this.options.findIndex(option => option.label.toLowerCase().includes(value.toLowerCase()));\n if (optionIndex > -1) {\n this.scrollToViewWithinParent(optionIndex);\n }\n this.inputOptionChanged.emit({\n value,\n name: this.name,\n });\n }\n\n scrollToViewWithinParent(optionIndex: number) {\n const option = this.options[optionIndex];\n const childElement = this.el.shadowRoot?.getElementById(option.value.toString()) as HTMLLIElement;\n const parentElement = this.optionsRef;\n\n this.ariaActivedescendant = option.value.toString();\n\n // Scroll child into view within parent\n const childRect = childElement.getBoundingClientRect();\n const parentRect = parentElement.getBoundingClientRect();\n\n if (childRect.top < parentRect.top) {\n // Child is above the visible area of the parent\n parentElement.scrollTop -= parentRect.top - childRect.top;\n } else if (childRect.bottom > parentRect.bottom) {\n // Child is below the visible area of the parent\n parentElement.scrollTop += childRect.bottom - parentRect.bottom;\n }\n }\n\n handleSelectButtonKeyDown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowDown':\n case 'Enter':\n event.preventDefault();\n if (!this.isOpen) {\n this.toggleDropdown();\n }\n this.inputRef?.focus();\n break;\n case 'Escape':\n this.isOpen = false;\n break;\n }\n }\n\n handleClick(event: Event): void {\n if (this.isOpen) {\n const value = (event.target as HTMLInputElement).value;\n const optionIndex = this.options.findIndex(option => option.label.toLowerCase().includes(value.toLowerCase()));\n if (optionIndex > -1) {\n setTimeout(() => {\n this.scrollToViewWithinParent(optionIndex);\n }, 10);\n }\n }\n }\n\n handleListboxKeydown(e) {\n const items = this.filteredOptions;\n const currentIndex = items.findIndex(item => item.value === this.ariaActivedescendant);\n if (e.key === 'ArrowDown' || (e.key === 'Tab' && !e.shiftKey)) {\n e.preventDefault();\n if (currentIndex === items.length - 1) {\n this.ariaActivedescendant = '';\n this.inputRef?.focus();\n return;\n }\n const nextIndex = currentIndex + 1 < items.length ? currentIndex + 1 : 0;\n this.ariaActivedescendant = items[nextIndex].value;\n this.focusOption(nextIndex);\n } else if (e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)) {\n e.preventDefault();\n if (currentIndex === 0) {\n this.ariaActivedescendant = '';\n this.inputRef?.focus();\n return;\n }\n const prevIndex = currentIndex - 1 >= 0 ? currentIndex - 1 : items.length - 1;\n this.ariaActivedescendant = items[prevIndex].value;\n this.focusOption(prevIndex);\n } else if (e.key === 'Enter') {\n e.preventDefault();\n if (this.ariaActivedescendant) {\n this.selectOption(items[currentIndex]);\n }\n } else if (e.key === 'Escape') {\n this.isOpen = false;\n }\n }\n\n focusOption(index) {\n const option = this.filteredOptions[index];\n if (!option) return; // Guard clause in case index is out of bounds\n\n const elementId = option.value;\n const element = this.el.shadowRoot?.getElementById(elementId) as HTMLLIElement;\n\n if (element) {\n element.focus(); // Set focus on the element\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n }\n }\n\n handleComboboxKeyDown(event: KeyboardEvent): void {\n if (event.key === 'ArrowDown' || (event.key == 'Tab' && !event.shiftKey)) {\n event.preventDefault();\n if (!this.isOpen) {\n this.isOpen = true;\n this.shouldAutoScroll = true;\n return;\n }\n this.ariaActivedescendant = this.filteredOptions[0].value;\n this.focusOption(0);\n } else if (event.key === 'ArrowUp' || (event.key === 'Tab' && event.shiftKey)) {\n event.preventDefault();\n this.ariaActivedescendant = this.filteredOptions[this.filteredOptions.length - 1].value;\n this.focusOption(this.filteredOptions.length - 1);\n } else if (event.key === 'Escape') {\n this.isOpen = false;\n }\n }\n\n // Event listeners\n @Listen('click', { target: 'document', capture: true })\n handleOutsideClick(event: MouseEvent) {\n // Get the path of the event\n const path = event.composedPath();\n\n // Check if the path includes the host element\n const isClickInside = path.includes(this.el);\n\n if (!isClickInside && this.isOpen) {\n this.isOpen = false;\n }\n }\n\n render() {\n return (\n <div class=\"dropdown\" part=\"id_dropdown\">\n <input\n type=\"text\"\n name={this.name}\n id={this.name}\n part=\"id_dropdown-input\"\n class={{ dropbtn: true, open: this.isOpen }}\n value={this.inputValue}\n onClick={(e: Event) => {\n this.toggleDropdown();\n this.shouldAutoScroll = true;\n this.handleClick(e);\n }}\n aria-haspopup=\"listbox\"\n aria-label={this.name}\n aria-expanded={this.isOpen ? 'true' : 'false'}\n onKeyDown={e => this.handleComboboxKeyDown(e)}\n onInput={event => this.handleOnInput(event)}\n />\n {this.isOpen ? (\n <div class=\"dropdown-content\" part=\"id_dropdown-content\" ref={el => (this.optionsRef = el as HTMLElement)}>\n <ul tabindex=\"-1\" role=\"listbox\" aria-label={this.name} aria-activedescendant={this.ariaActivedescendant} onKeyDown={e => this.handleListboxKeydown(e)}>\n {this.filteredOptions.map(option => (\n <li\n tabindex=\"0\"\n key={option.value}\n id={option.value}\n onClick={() => this.selectOption(option)}\n role=\"option\"\n class={{\n focused: this.ariaActivedescendant === option.value.toString(),\n }}\n >\n {option.labelHTML ? option.labelHTML : option.label}\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-8362ce5c.js';
1
+ import { r as registerInstance, h } from './index-582cfc93.js';
2
2
 
3
3
  const iconCss = ".sc-italic-icon-h{display:flex}";
4
4
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-8362ce5c.js';
1
+ import { r as registerInstance, h } from './index-582cfc93.js';
2
2
 
3
3
  const loadingCss = ".wave{display:flex;align-items:center;justify-content:center}.dot{width:4px;height:4px;background-color:var(--dot-color, white);border-radius:50%;margin:0 2px;animation:wave 1.5s infinite ease-in-out}.dot:nth-child(2){animation-delay:0.2s}.dot:nth-child(3){animation-delay:0.4s}@keyframes wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-4px)}}";
4
4
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-8362ce5c.js';
1
+ import { r as registerInstance, h } from './index-582cfc93.js';
2
2
 
3
3
  const iconCss = ".sc-location-icon-h{display:flex}";
4
4
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-8362ce5c.js';
1
+ import { r as registerInstance, h } from './index-582cfc93.js';
2
2
 
3
3
  const iconCss = ".sc-location-off-icon-h{display:flex}";
4
4
 
@@ -1,6 +1,6 @@
1
1
  import { a as debug } from './utils-49a1d17b.js';
2
2
  import { X as Xr, Z as Zr } from './index.es-896126fc.js';
3
- import { c as createStore } from './index-11d12497.js';
3
+ import { c as createStore } from './index-2c7e4f4b.js';
4
4
 
5
5
  class NylasAuthConnector {
6
6
  constructor(nylasAuth, nylasAuthStore) {
@@ -518,4 +518,4 @@ function CreateNylasMailboxStore(defaultState = {}) {
518
518
 
519
519
  export { CreateNylasAuthStore as C, HashRouter as H, NylasAuthConnector as N, NylasThreadsConnector as a, NylasMessagesConnector as b, NylasFoldersConnector as c, CreateNylasMailboxStore as d };
520
520
 
521
- //# sourceMappingURL=mailbox-store-11fa8387.js.map
521
+ //# sourceMappingURL=mailbox-store-c9b2a4fd.js.map
@@ -1 +1 @@
1
- {"file":"mailbox-store-11fa8387.js","mappings":";;;;MAGa,kBAAkB;IAI7B,YAAY,SAAwB,EAAE,cAAkC;QACtE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;KACtC;IAQM,MAAM,eAAe;QAC1B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxD,IAAI,CAAC,eAAe,EAAE;YAEpB,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;aAAM;YAEL,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YACpD,IAAI,SAAS,EAAE;gBAEb,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;gBACtC,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;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AuB,EAAE,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACzE,CAAC,CAAC;IAGH,KAAK,CAAC,QAAQ,CAAC,oBAAoB,EAAE,kBAAkB;QAErD,KAAK,CAAC,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC;QAE9D,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;KACxE,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,GAAG;QACZ,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE;YACxC,MAAM,KAAK,GAAG,sBAAsB,CAAC,GAA0C,CAAC,CAAC;YACjF,KAAK,CAAC,GAAG,CAAC,GAAU,EAAE,KAAK,CAAC,CAAC;SAC9B;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf;;;;","names":["isNylasErrorResponse","NylasAPIError"],"sources":["src/connector/shared/api/auth.ts","src/connector/shared/api/messages.ts","src/connector/shared/api/threads.ts","src/connector/shared/api/folders.ts","src/routers/hash-router.ts","src/stores/auth-store.ts","src/stores/mailbox-store.ts"],"sourcesContent":["import { debug } from '@/utils/utils';\nimport { NylasAuthStoreType, NylasAuthType, TokenInfo } from '../../..';\n\nexport class NylasAuthConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n }\n\n /**\n * Validates the current session and updates the store with the token info\n * if the user is authenticated.\n * If the user is not authenticated, the store is reset.\n * @returns {Promise<void>}\n */\n public async validateSession(): Promise<void> {\n const isAuthenticated = await this.isAccessTokenValid();\n if (!isAuthenticated) {\n // Reset the store if the access token is not valid\n this.logout();\n } else {\n // If the user is authenticated, update the store with the token info\n let tokenInfo = await this.nylasAuth.getTokenInfo();\n if (tokenInfo) {\n // If token is expired or about to expire (in 5 minutes), refresh it\n const expireTimeCheck = 5 * 60 * 1000; // 5 minutes\n const currentTimeInSeconds = Math.floor(Date.now() / 1000);\n\n if (tokenInfo.expires_in && tokenInfo.expires_in - currentTimeInSeconds < expireTimeCheck) {\n debug('[NylasAuthConnectorMixin] Refreshing access token');\n tokenInfo = await this.nylasAuth.refreshAccessToken();\n if (!tokenInfo) {\n debug('[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out.');\n this.logout();\n return;\n }\n }\n\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n }\n }\n this.nylasAuthStore.state.isAuthenticated = isAuthenticated;\n }\n\n /**\n * Returns true if the user is authenticated.\n * @returns {Promise<boolean>}\n */\n public async isAuthenticated(): Promise<boolean> {\n return this.nylasAuth.isAuthenticated();\n }\n\n /**\n * Returns the token info if the user is authenticated.\n * @returns {Promise<TokenInfo>}\n */\n public async getTokenInfo(): Promise<TokenInfo | null> {\n return this.nylasAuth.getTokenInfo();\n }\n\n /**\n * Returns true if the access token is valid.\n * @returns {Promise<boolean>}\n */\n public async isAccessTokenValid(): Promise<boolean> {\n return this.nylasAuth.isAccessTokenValid();\n }\n\n /**\n * Removes the token info from the store and logs the user out.\n * @returns {Promise<void>}\n */\n public async logout(): Promise<void> {\n await this.nylasAuth.logout();\n }\n\n /**\n * Returns the URL to redirect the user to for authentication.\n * @param scopes An array of scopes to request from the user.\n * @param email The email address of the user to authenticate.\n * @param provider The provider to use for authentication.\n * @returns {Promise<string>}\n */\n public async getHostedAuthRedirectURL(scopes?: string[], email?: string, provider?: string): Promise<string> {\n return this.nylasAuth.getHostedAuthRedirectURL(scopes, email, provider);\n }\n\n /**\n * Exchanges the auth code for a token info and updates the store.\n * @param currentUrl The current URL of the page.\n * @returns {Promise<TokenInfo | null>}\n */\n public async manageHostedAuthCodeExchange(currentUrl: string): Promise<TokenInfo | null> {\n const url = new URL(currentUrl);\n const code = url.searchParams.get('code');\n\n if (code) {\n const tokenInfo = await this.nylasAuth.exchangeAuthCodeForTokenInfo(code);\n if (tokenInfo) {\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n this.nylasAuthStore.state.isAuthenticated = true;\n return tokenInfo;\n }\n }\n\n return null;\n }\n}\n","import { Message, NylasAPIError, NylasAuthType, NylasResponse, isNylasErrorResponse } from '@nylas/core';\nimport { NylasAuthStoreType, NylasMailboxStoreType } from '../../../components';\n\nexport class NylasMessagesConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n private nylasMailboxStore: NylasMailboxStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType, nylasMailboxStore: NylasMailboxStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n this.nylasMailboxStore = nylasMailboxStore;\n }\n\n /**\n * Returns the list of messages.\n * @returns {Promise<Message[]>}\n */\n public async getMessages(): Promise<Message[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n // Set the state to loading.\n this.nylasMailboxStore.state.state = 'loading';\n\n // Get the message query parameters from the store.\n const queryParams = this.nylasMailboxStore.state.messgeQueryParams;\n\n // Build the URLSearchParams object.\n const params = new URLSearchParams();\n for (const key in queryParams) {\n const value = queryParams[key as keyof typeof queryParams]?.toString();\n if (value) {\n params.append(key, value);\n }\n }\n\n // Build the URL with the query parameters\n const path = `/v3/grants/me/messages?${params.toString()}`;\n\n // Make the API request.\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Message[]>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the messages in the store.\n const messages = response.data;\n this.nylasMailboxStore.state.messages = messages;\n\n // Set the state to ready.\n this.nylasMailboxStore.state.state = 'ready';\n\n return messages;\n }\n\n /**\n * Returns the list of messages for a given thread.\n * @param {string} threadId The thread ID.\n * @returns {Promise<Message[]>}\n * @throws {NylasAPIError}\n */\n public async getThreadMessages(threadId: string): Promise<Message[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Message[]>>(`/v3/grants/me/messages?thread_id=${threadId}&fields=include_headers`);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n const messages = response.data;\n this.nylasMailboxStore.state.messages = messages;\n\n return messages;\n }\n\n /**\n * Downloads the attachments for a given message.\n * @param message The message to download attachments for.\n * @returns {Promise<Blob>[]} An array of promises that will resolve to a Blob.\n */\n public downloadMessageAttachments(message: Message): Promise<Blob>[] {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n // We'll go through each attachment and download it.\n const blobPromises: Promise<Blob>[] = [];\n const attachments = message.attachments || [];\n for (const attachment of attachments) {\n const blob = this.nylasAuth.nylasDownloadFileRequest(`/v3/grants/me/attachments/${attachment.id}?message_id=${message.id}`);\n blobPromises.push(blob);\n }\n\n return blobPromises;\n }\n\n /**\n * Returns a summarized version of the given text.\n * @param text The non-HTML text to summarize.\n * @returns {Promise<string>} The summarized text.\n */\n public async summarizeText(text: string): Promise<string> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<{ summary: string }>>(\n `/v3/grants/me/mailbox/summarize`,\n 'POST',\n {\n message: {\n body: text,\n },\n },\n true,\n this.nylasAuth.config.elementsApiUri,\n );\n\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n return response.data.summary;\n }\n\n /**\n * Returns a summarized version of the given message.\n * @param message The message to summarize.\n * @returns {Promise<ReadableStream<Uint8Array> | null>} Returns a Fetch API response.\n */\n public async textToSpeech(text: string, abortController?: AbortController): Promise<ReadableStream<Uint8Array> | null> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n return this.nylasAuth.nylasAPIRequest(\n `/v3/grants/me/mailbox/tts`,\n 'POST',\n {\n text,\n },\n false,\n this.nylasAuth.config.elementsApiUri,\n {\n ...(abortController ? { signal: abortController?.signal } : {}),\n },\n );\n }\n}\n","import { debug } from '@/utils/utils';\nimport { NylasAPIError, NylasAuthType, NylasResponse, Thread, ThreadQueryParameters, isNylasErrorResponse } from '@nylas/core';\nimport { NylasAuthStoreType, NylasMailboxStoreType } from '../../../components';\nimport { RouterInterface } from '@/routers/router-interface';\n\nexport class NylasThreadsConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n private nylasMailboxStore: NylasMailboxStoreType;\n private router: RouterInterface;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType, nylasMailboxStore: NylasMailboxStoreType, router: RouterInterface) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n this.nylasMailboxStore = nylasMailboxStore;\n this.router = router;\n }\n\n /**\n * Returns the list of threads.\n * @todo Re-think how we handle pagination (previous/next page tokens) - there is a separation of logic here that might be confusing.\n * @param {Partial<ThreadQueryParameters> | undefined} overrideQueryParams The query parameters to override from the store.\n * @param {'prepend' | 'append' | 'overwrite'} updateMethod How to update the store with the threads (default: overwrite).\n * @param {boolean} updateState Whether to update the state or not (default: true).\n * @returns {Promise<Thread[]>}\n */\n public async getThreads(\n overrideQueryParams?: Partial<ThreadQueryParameters>,\n updateMethod: 'prepend' | 'append' | 'overwrite' = 'overwrite',\n updateState: boolean = true,\n ): Promise<Thread[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing thread:read-only scope');\n }\n\n // Set the state to loading.\n if (updateState) {\n this.nylasMailboxStore.state.state = 'loading';\n }\n\n // Build the URL with the query parameters\n const queryParams = overrideQueryParams || this.nylasMailboxStore.state.threadsQueryParams;\n const params = new URLSearchParams();\n for (const key in queryParams) {\n const value = queryParams[key as keyof typeof queryParams]?.toString();\n if (typeof value !== 'undefined' && value !== null) {\n params.append(key, value);\n }\n }\n\n // TODO: Re-think how to update the router, this seems wrong\n if (queryParams.search_query_native) {\n this.router.navigate(`/?query=${queryParams.search_query_native}`, true);\n } else if (this.nylasMailboxStore.state.threadsQueryParams.search_query_native && !queryParams.search_query_native) {\n this.router.navigate('/', true);\n }\n\n // If page_token is not set, reset the previous page tokens.\n if (!queryParams.page_token) {\n this.nylasMailboxStore.state.previousThreadPageTokens = [];\n }\n\n this.nylasMailboxStore.state.threadsQueryParams = queryParams;\n\n // Make the API request.\n const path = `/v3/grants/me/threads?${params.toString()}`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Thread[]>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the threads in the store.\n const threads = response.data;\n switch (updateMethod) {\n case 'prepend':\n this.nylasMailboxStore.state.threads = [...threads, ...this.nylasMailboxStore.state.threads];\n break;\n case 'append':\n this.nylasMailboxStore.state.threads = [...this.nylasMailboxStore.state.threads, ...threads];\n break;\n case 'overwrite':\n default:\n this.nylasMailboxStore.state.threads = threads;\n break;\n }\n\n // If we have a next cursor, set it in the store.\n if (response.next_cursor) {\n this.nylasMailboxStore.state.nextThreadPageToken = response.next_cursor;\n } else {\n this.nylasMailboxStore.state.nextThreadPageToken = null;\n }\n\n // Set the state to ready.\n if (updateState) {\n this.nylasMailboxStore.state.state = 'ready';\n }\n\n return threads;\n }\n\n public async getThread(threadId: string): Promise<Thread> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing thread:read-only scope');\n }\n\n // Check if we have the thread in the store already.\n const storeThread = this.nylasMailboxStore.state.threads.find(t => t.id === threadId);\n if (storeThread) {\n return storeThread;\n }\n\n // Set the state to loading.\n this.nylasMailboxStore.state.state = 'loading';\n\n // Make the API request.\n const path = `/v3/grants/me/threads/${threadId}`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Thread>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the threads in the store.\n const thread = response.data;\n this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map(t => {\n if (t.id === thread.id) {\n return thread;\n }\n return t;\n });\n\n // Set the state to ready.\n this.nylasMailboxStore.state.state = 'ready';\n\n return thread;\n }\n\n /**\n * Returns the next page of threads.\n * @param {'prepend' | 'append' | 'overwrite'} updateMethod How to update the store with the threads (default: overwrite).\n * @param {boolean} updateLoadingState Whether to update the loading state or not.\n * @returns {Promise<Thread[]>} The previous page of threads.\n */\n public async nextThreadPage(updateMethod: 'prepend' | 'append' | 'overwrite' = 'overwrite', updateLoadingState: boolean = true): Promise<Thread[]> {\n if (!this.nylasMailboxStore.state.nextThreadPageToken) {\n throw new Error('No next page token');\n }\n\n // If we have a next page token, add it to the previous page tokens.\n this.nylasMailboxStore.state.previousThreadPageTokens = Array.from(\n new Set([...this.nylasMailboxStore.state.previousThreadPageTokens, this.nylasMailboxStore.state.threadsQueryParams.page_token ?? null]),\n );\n\n // Get the last next page token.\n const nextPageToken = this.nylasMailboxStore.state.nextThreadPageToken;\n\n return this.getThreads(\n {\n ...this.nylasMailboxStore.state.threadsQueryParams,\n page_token: nextPageToken,\n },\n updateMethod,\n updateLoadingState,\n );\n }\n\n /**\n * Returns the previous page of threads.\n * @param {'prepend' | 'append' | 'overwrite'} updateMethod How to update the store with the threads (default: overwrite).\n * @param {boolean} updateLoadingState Whether to update the loading state or not.\n * @returns {Promise<Thread[]>} The previous page of threads.\n */\n public async previousThreadPage(aupdateMethod: 'prepend' | 'append' | 'overwrite' = 'overwrite', updateLoadingState: boolean = true): Promise<Thread[]> {\n if (!this.nylasMailboxStore.state.previousThreadPageTokens.length) {\n throw new Error('No previous page token');\n }\n\n // Remove the the last two next page tokens.\n const previousThreadPageTokens = [...this.nylasMailboxStore.state.previousThreadPageTokens];\n const pageToken = previousThreadPageTokens.pop();\n\n // Update the store.\n this.nylasMailboxStore.state.previousThreadPageTokens = previousThreadPageTokens;\n\n return this.getThreads(\n {\n ...this.nylasMailboxStore.state.threadsQueryParams,\n page_token: pageToken ?? undefined,\n },\n aupdateMethod,\n updateLoadingState,\n );\n }\n\n /**\n * Updates the thread query parameters in the store.\n * @param params Partial<ThreadQueryParameters>\n * @returns {void}\n */\n public updateThreadQueryParams(params: Partial<ThreadQueryParameters>): void {\n this.nylasMailboxStore.state.threadsQueryParams = {\n ...this.nylasMailboxStore.state.threadsQueryParams,\n ...params,\n };\n }\n\n /**\n * Back to the mailbox.\n */\n public back(): void {\n this.router.navigate('/', true);\n this.nylasMailboxStore.state.selectedThread = null;\n }\n\n /**\n * Unselects a thread.\n */\n public unSelectThread(): void {\n this.nylasMailboxStore.state.selectedThread = null;\n }\n\n /**\n * Selects a thread.\n * @param {Thread} thread The thread to select.\n * @returns {Promise<void>}\n */\n public async selectThread(thread: Thread): Promise<void> {\n this.router.navigate(`/thread/${thread.id}`, true);\n this.nylasMailboxStore.state.selectedThread = thread;\n\n // Mark the thread as read (async) if it is unread.\n if (thread.unread) {\n this.markThreadAsRead(thread).catch(error => {\n debug('Error marking thread as read', error);\n });\n }\n }\n\n /**\n * Marks a thread as read.\n * @param thread\n * @returns {Promise<Thread>}\n */\n public async markThreadAsRead(thread: Thread): Promise<Thread> {\n return this.updateThread(thread, { unread: false });\n }\n\n /**\n * Updates a thread.\n * @param thread The thread to update.\n * @returns {Promise<Thread>}\n */\n public async updateThread(thread: Thread, updateThread: Partial<Thread>): Promise<Thread> {\n // Make sure we have an authenticated user.\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a modify scope at least.\n if (!this.nylasAuth.hasScopeByType('email', 'modify')) {\n throw new Error('Missing thread:modify scope');\n }\n\n // Make the API request.\n const path = `/v3/grants/me/threads/${thread.id}`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Thread>>(path, 'PUT', updateThread);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Update the thread in the store.\n const updatedThread = response.data;\n this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map(t => {\n if (t.id === updatedThread.id) {\n return updatedThread;\n }\n return t;\n });\n this.nylasMailboxStore.state.selectedThread = updatedThread;\n\n return updatedThread;\n }\n}\n","import { Folder, NylasAPIError, NylasAuthType, NylasResponse, isNylasErrorResponse } from '@nylas/core';\nimport { NylasAuthStoreType, NylasMailboxStoreType } from '../../../components';\n\nexport class NylasFoldersConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n private nylasMailboxStore: NylasMailboxStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType, nylasMailboxStore: NylasMailboxStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n this.nylasMailboxStore = nylasMailboxStore;\n }\n\n /**\n * Returns the list of folders.\n */\n public async getFolders(): Promise<Folder[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing thread:read-only scope');\n }\n\n // Set the state to loading.\n this.nylasMailboxStore.state.state = 'loading';\n\n // Make the API request.\n const path = `/v3/grants/me/folders`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Folder[]>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the threads in the store.\n const folders = response.data;\n this.nylasMailboxStore.state.folders = folders;\n\n // Set the state to ready.\n this.nylasMailboxStore.state.state = 'ready';\n\n return folders;\n }\n\n public async selectFolder(folder: Folder) {\n this.nylasMailboxStore.state.threadsQueryParams = {\n in: folder.id,\n ...(this.nylasMailboxStore.state.threadsQueryParams || {}),\n };\n }\n}\n","import { debug } from '@/utils/utils';\nimport { RouteListener, RouteParams, RoutePath, RouterInterface } from './router-interface';\n\nexport class PolyFillHashChangeEvent extends Event {\n oldURL?: string;\n newURL?: string;\n\n constructor(type: string, eventInitDict: HashChangeEventInit) {\n super(type, eventInitDict);\n this.oldURL = eventInitDict.oldURL;\n this.newURL = eventInitDict.newURL;\n }\n}\n\nexport class HashRouter implements RouterInterface {\n private routeChangeListeners: [route: RoutePath, RouteListener<any>][] = [];\n\n constructor() {\n debug('HashRouter constructor');\n }\n\n // Destroy the router\n public destroy(): void {\n debug('HashRouter destroy');\n window.removeEventListener('hashchange', this.onRouteChange.bind(this));\n }\n\n // Initialize the router\n public init(): void {\n debug('HashRouter init');\n window.addEventListener('hashchange', this.onRouteChange.bind(this));\n\n // Trigger the initial route change\n if (typeof HashChangeEvent !== 'undefined') {\n const event: HashChangeEvent = new HashChangeEvent('hashchange', { oldURL: '', newURL: window.location.href });\n this.onRouteChange(event);\n } else {\n const event: Event = new PolyFillHashChangeEvent('hashchange', { oldURL: '', newURL: window.location.href });\n this.onRouteChange(event as HashChangeEvent);\n }\n }\n\n public addRouteChangeListener<Path extends RoutePath>(route: Path, listener: RouteListener<Path>): void {\n debug('HashRouter addRouteChangeListener');\n this.routeChangeListeners.push([route, listener]);\n }\n\n public navigate(route: string, shallow: boolean): void {\n debug('HashRouter navigate');\n\n // If we're navigating shallow, don't add a new history entry\n if (shallow) {\n return window.history.pushState(null, '', `#${route}`);\n }\n\n window.location.hash = route;\n }\n\n public setRoute(route: string): void {\n debug('HashRouter setRoute');\n window.location.hash = route;\n }\n\n // Matches a route and executes the callback\n public matchRoute(route: string, path: string): boolean {\n const routeParts = route.split('/');\n const pathParts = path.split('/');\n\n // If the route is `/` an the hash is empty, match the route\n debug(`HashRouter matchRoute route=${route} path=${path}`, { routeParts, pathParts });\n if (routeParts[1] === '' && pathParts[0] === '') {\n return true;\n }\n\n if (routeParts.length !== pathParts.length) {\n return false;\n }\n\n for (let i = 0; i < routeParts.length; i++) {\n const routePart = routeParts[i];\n const pathPart = pathParts[i];\n if (routePart.startsWith(':')) {\n continue;\n }\n if (routePart !== pathPart) {\n return false;\n }\n }\n\n return true;\n }\n\n // Parse the route and return the route params\n public getRouteParams<Path extends RoutePath>(route: Path): RouteParams<Path> {\n debug('HashRouter getRouteParams');\n const routeParams: RouteParams<Path> = {} as RouteParams<Path>;\n const routeParts = route.split('/');\n const routeConfigParts = window.location.hash.split('/');\n routeParts.forEach((routePart, index) => {\n if (routePart.startsWith(':')) {\n const key = routePart.substring(1) as keyof RouteParams<Path>;\n routeParams[key] = routeConfigParts[index] as RouteParams<Path>[keyof RouteParams<Path>]; // Cast the value to string\n }\n });\n return routeParams;\n }\n\n public getRouteWithParams(route: string, routeParams: Record<string, any>): string {\n debug('HashRouter getRouteWithParams');\n let routeWithParams = route;\n Object.keys(routeParams).forEach(key => {\n routeWithParams = routeWithParams.replace(`:${key}`, routeParams[key]);\n });\n return routeWithParams;\n }\n\n public getRoute(): string {\n debug('HashRouter getRoute');\n return window.location.hash;\n }\n\n public onRouteChange(event: HashChangeEvent): void {\n this.routeChangeListeners.forEach(async ([route, listener]) => {\n const path = event.newURL.indexOf('#') === -1 ? '' : event.newURL.substring(event.newURL.indexOf('#') + 1);\n debug(`HashRouter onRouteChange route=${route} path=${path}`, { event });\n if (!this.matchRoute(route, path)) {\n debug(`HashRouter onRouteChange route=${route} path=${path} does not match`);\n return;\n }\n const routeParams = this.getRouteParams(route) as RouteParams<RoutePath>;\n await listener(route, path, routeParams);\n });\n }\n\n public getBasePath(): string {\n debug('HashRouter getBasePath');\n return '';\n }\n}\n","import { TokenInfo } from '@nylas/core/dist/auth';\nimport { createStore } from '@stencil/store';\nimport { DataState } from '..';\n\nexport interface NylasAuthStoreState {\n isAuthenticated: boolean;\n tokenInfo: TokenInfo | null;\n state: DataState;\n}\n\nexport type NylasAuthStoreType = ReturnType<typeof CreateNylasAuthStore>;\n\nexport function CreateNylasAuthStore(defaultState: Partial<NylasAuthStoreState> = {}) {\n const defaultNylasStoreState: NylasAuthStoreState = {\n isAuthenticated: false,\n tokenInfo: null,\n state: 'ready',\n ...defaultState,\n };\n const store = createStore<NylasAuthStoreState>(defaultNylasStoreState);\n\n /**\n * Reset the Nylas store to its default state.\n * There is something wrong with the stencil/store reset method,\n * so we have to do it via this hack.\n */\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n","import type { Folder, Message, MessageQueryParameters, Thread, ThreadQueryParameters } from '@nylas/core';\nimport { createStore } from '@stencil/store';\nimport { DataState } from '../components';\n\nexport interface NylasMailboxStoreState {\n state: DataState;\n messages: Message[];\n threads: Thread[];\n folders: Folder[];\n selectedThread: Thread | null;\n selectedFolder: string;\n searchQuery: string;\n\n nextThreadPageToken: string | null;\n previousThreadPageTokens: (string | null)[];\n hasNextThreadPage: boolean;\n hasPreviousThreadPage: boolean;\n threadsQueryParams: Partial<ThreadQueryParameters>;\n messgeQueryParams: Partial<MessageQueryParameters>;\n}\n\nexport type NylasMailboxStoreType = ReturnType<typeof CreateNylasMailboxStore>;\n\nexport function CreateNylasMailboxStore(defaultState: Partial<NylasMailboxStoreState> = {}) {\n const defaultNylasStoreState: NylasMailboxStoreState = {\n state: 'ready',\n\n messages: [],\n threads: [],\n folders: [],\n selectedThread: null,\n nextThreadPageToken: null,\n previousThreadPageTokens: [],\n searchQuery: '',\n\n hasNextThreadPage: false,\n hasPreviousThreadPage: false,\n\n selectedFolder: 'inbox',\n\n threadsQueryParams: {\n in: 'inbox',\n },\n messgeQueryParams: {\n fields: 'include_headers',\n },\n ...defaultState,\n };\n\n const store = createStore<NylasMailboxStoreState>({ ...defaultNylasStoreState });\n\n // Set our hasNextThreadPage if nextThreadPageToken is not null.\n store.onChange('nextThreadPageToken', nextThreadPageToken => {\n store.set('hasNextThreadPage', nextThreadPageToken !== null);\n });\n // Set our hasPreviousThreadPage if previousThreadPageTokens is not empty.\n store.onChange('previousThreadPageTokens', previousThreadPageTokens => {\n store.set('hasPreviousThreadPage', previousThreadPageTokens.length > 0);\n });\n\n // When threadsQueryParams changes...\n store.onChange('threadsQueryParams', threadsQueryParams => {\n // set our selectedFolder to the in param.\n store.set('selectedFolder', threadsQueryParams.in || 'inbox');\n // set our searchQuery to the search_query_native param.\n store.set('searchQuery', threadsQueryParams.search_query_native || '');\n });\n\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n"],"version":3}
1
+ {"file":"mailbox-store-c9b2a4fd.js","mappings":";;;;MAGa,kBAAkB;IAI7B,YAAY,SAAwB,EAAE,cAAkC;QACtE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;KACtC;IAQM,MAAM,eAAe;QAC1B,MAAM,eAAe,GAAG,MAAM,IAAI,CAA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BAAiB;SAC1B;QACD,GAAG,YAAY;KAChB,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CAAyB,EAAE,GAAG,sBAAsB,EAAE,CAAC,CAAC;IAGjF,KAAK,CAAC,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB;QACvD,KAAK,CAAC,GAAG,CAAC,mBAAmB,EAAE,mBAAmB,KAAK,IAAI,CAAC,CAAC;KAC9D,CAAC,CAAC;IAEH,KAAK,CAAC,QAAQ,CAAC,0BAA0B,EAAE,wBAAwB;QACjE,KAAK,CAAC,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACzE,CAAC,CAAC;IAGH,KAAK,CAAC,QAAQ,CAAC,oBAAoB,EAAE,kBAAkB;QAErD,KAAK,CAAC,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC;QAE9D,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;KACxE,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,GAAG;QACZ,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE;YACxC,MAAM,KAAK,GAAG,sBAAsB,CAAC,GAA0C,CAAC,CAAC;YACjF,KAAK,CAAC,GAAG,CAAC,GAAU,EAAE,KAAK,CAAC,CAAC;SAC9B;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf;;;;","names":["isNylasErrorResponse","NylasAPIError"],"sources":["src/connector/shared/api/auth.ts","src/connector/shared/api/messages.ts","src/connector/shared/api/threads.ts","src/connector/shared/api/folders.ts","src/routers/hash-router.ts","src/stores/auth-store.ts","src/stores/mailbox-store.ts"],"sourcesContent":["import { debug } from '@/utils/utils';\nimport { NylasAuthStoreType, NylasAuthType, TokenInfo } from '../../..';\n\nexport class NylasAuthConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n }\n\n /**\n * Validates the current session and updates the store with the token info\n * if the user is authenticated.\n * If the user is not authenticated, the store is reset.\n * @returns {Promise<void>}\n */\n public async validateSession(): Promise<void> {\n const isAuthenticated = await this.isAccessTokenValid();\n if (!isAuthenticated) {\n // Reset the store if the access token is not valid\n this.logout();\n } else {\n // If the user is authenticated, update the store with the token info\n let tokenInfo = await this.nylasAuth.getTokenInfo();\n if (tokenInfo) {\n // If token is expired or about to expire (in 5 minutes), refresh it\n const expireTimeCheck = 5 * 60 * 1000; // 5 minutes\n const currentTimeInSeconds = Math.floor(Date.now() / 1000);\n\n if (tokenInfo.expires_in && tokenInfo.expires_in - currentTimeInSeconds < expireTimeCheck) {\n debug('[NylasAuthConnectorMixin] Refreshing access token');\n tokenInfo = await this.nylasAuth.refreshAccessToken();\n if (!tokenInfo) {\n debug('[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out.');\n this.logout();\n return;\n }\n }\n\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n }\n }\n this.nylasAuthStore.state.isAuthenticated = isAuthenticated;\n }\n\n /**\n * Returns true if the user is authenticated.\n * @returns {Promise<boolean>}\n */\n public async isAuthenticated(): Promise<boolean> {\n return this.nylasAuth.isAuthenticated();\n }\n\n /**\n * Returns the token info if the user is authenticated.\n * @returns {Promise<TokenInfo>}\n */\n public async getTokenInfo(): Promise<TokenInfo | null> {\n return this.nylasAuth.getTokenInfo();\n }\n\n /**\n * Returns true if the access token is valid.\n * @returns {Promise<boolean>}\n */\n public async isAccessTokenValid(): Promise<boolean> {\n return this.nylasAuth.isAccessTokenValid();\n }\n\n /**\n * Removes the token info from the store and logs the user out.\n * @returns {Promise<void>}\n */\n public async logout(): Promise<void> {\n await this.nylasAuth.logout();\n }\n\n /**\n * Returns the URL to redirect the user to for authentication.\n * @param scopes An array of scopes to request from the user.\n * @param email The email address of the user to authenticate.\n * @param provider The provider to use for authentication.\n * @returns {Promise<string>}\n */\n public async getHostedAuthRedirectURL(scopes?: string[], email?: string, provider?: string): Promise<string> {\n return this.nylasAuth.getHostedAuthRedirectURL(scopes, email, provider);\n }\n\n /**\n * Exchanges the auth code for a token info and updates the store.\n * @param currentUrl The current URL of the page.\n * @returns {Promise<TokenInfo | null>}\n */\n public async manageHostedAuthCodeExchange(currentUrl: string): Promise<TokenInfo | null> {\n const url = new URL(currentUrl);\n const code = url.searchParams.get('code');\n\n if (code) {\n const tokenInfo = await this.nylasAuth.exchangeAuthCodeForTokenInfo(code);\n if (tokenInfo) {\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n this.nylasAuthStore.state.isAuthenticated = true;\n return tokenInfo;\n }\n }\n\n return null;\n }\n}\n","import { Message, NylasAPIError, NylasAuthType, NylasResponse, isNylasErrorResponse } from '@nylas/core';\nimport { NylasAuthStoreType, NylasMailboxStoreType } from '../../../components';\n\nexport class NylasMessagesConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n private nylasMailboxStore: NylasMailboxStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType, nylasMailboxStore: NylasMailboxStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n this.nylasMailboxStore = nylasMailboxStore;\n }\n\n /**\n * Returns the list of messages.\n * @returns {Promise<Message[]>}\n */\n public async getMessages(): Promise<Message[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n // Set the state to loading.\n this.nylasMailboxStore.state.state = 'loading';\n\n // Get the message query parameters from the store.\n const queryParams = this.nylasMailboxStore.state.messgeQueryParams;\n\n // Build the URLSearchParams object.\n const params = new URLSearchParams();\n for (const key in queryParams) {\n const value = queryParams[key as keyof typeof queryParams]?.toString();\n if (value) {\n params.append(key, value);\n }\n }\n\n // Build the URL with the query parameters\n const path = `/v3/grants/me/messages?${params.toString()}`;\n\n // Make the API request.\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Message[]>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the messages in the store.\n const messages = response.data;\n this.nylasMailboxStore.state.messages = messages;\n\n // Set the state to ready.\n this.nylasMailboxStore.state.state = 'ready';\n\n return messages;\n }\n\n /**\n * Returns the list of messages for a given thread.\n * @param {string} threadId The thread ID.\n * @returns {Promise<Message[]>}\n * @throws {NylasAPIError}\n */\n public async getThreadMessages(threadId: string): Promise<Message[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Message[]>>(`/v3/grants/me/messages?thread_id=${threadId}&fields=include_headers`);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n const messages = response.data;\n this.nylasMailboxStore.state.messages = messages;\n\n return messages;\n }\n\n /**\n * Downloads the attachments for a given message.\n * @param message The message to download attachments for.\n * @returns {Promise<Blob>[]} An array of promises that will resolve to a Blob.\n */\n public downloadMessageAttachments(message: Message): Promise<Blob>[] {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n // We'll go through each attachment and download it.\n const blobPromises: Promise<Blob>[] = [];\n const attachments = message.attachments || [];\n for (const attachment of attachments) {\n const blob = this.nylasAuth.nylasDownloadFileRequest(`/v3/grants/me/attachments/${attachment.id}?message_id=${message.id}`);\n blobPromises.push(blob);\n }\n\n return blobPromises;\n }\n\n /**\n * Returns a summarized version of the given text.\n * @param text The non-HTML text to summarize.\n * @returns {Promise<string>} The summarized text.\n */\n public async summarizeText(text: string): Promise<string> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<{ summary: string }>>(\n `/v3/grants/me/mailbox/summarize`,\n 'POST',\n {\n message: {\n body: text,\n },\n },\n true,\n this.nylasAuth.config.elementsApiUri,\n );\n\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n return response.data.summary;\n }\n\n /**\n * Returns a summarized version of the given message.\n * @param message The message to summarize.\n * @returns {Promise<ReadableStream<Uint8Array> | null>} Returns a Fetch API response.\n */\n public async textToSpeech(text: string, abortController?: AbortController): Promise<ReadableStream<Uint8Array> | null> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing message:read-only scope');\n }\n\n return this.nylasAuth.nylasAPIRequest(\n `/v3/grants/me/mailbox/tts`,\n 'POST',\n {\n text,\n },\n false,\n this.nylasAuth.config.elementsApiUri,\n {\n ...(abortController ? { signal: abortController?.signal } : {}),\n },\n );\n }\n}\n","import { debug } from '@/utils/utils';\nimport { NylasAPIError, NylasAuthType, NylasResponse, Thread, ThreadQueryParameters, isNylasErrorResponse } from '@nylas/core';\nimport { NylasAuthStoreType, NylasMailboxStoreType } from '../../../components';\nimport { RouterInterface } from '@/routers/router-interface';\n\nexport class NylasThreadsConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n private nylasMailboxStore: NylasMailboxStoreType;\n private router: RouterInterface;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType, nylasMailboxStore: NylasMailboxStoreType, router: RouterInterface) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n this.nylasMailboxStore = nylasMailboxStore;\n this.router = router;\n }\n\n /**\n * Returns the list of threads.\n * @todo Re-think how we handle pagination (previous/next page tokens) - there is a separation of logic here that might be confusing.\n * @param {Partial<ThreadQueryParameters> | undefined} overrideQueryParams The query parameters to override from the store.\n * @param {'prepend' | 'append' | 'overwrite'} updateMethod How to update the store with the threads (default: overwrite).\n * @param {boolean} updateState Whether to update the state or not (default: true).\n * @returns {Promise<Thread[]>}\n */\n public async getThreads(\n overrideQueryParams?: Partial<ThreadQueryParameters>,\n updateMethod: 'prepend' | 'append' | 'overwrite' = 'overwrite',\n updateState: boolean = true,\n ): Promise<Thread[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing thread:read-only scope');\n }\n\n // Set the state to loading.\n if (updateState) {\n this.nylasMailboxStore.state.state = 'loading';\n }\n\n // Build the URL with the query parameters\n const queryParams = overrideQueryParams || this.nylasMailboxStore.state.threadsQueryParams;\n const params = new URLSearchParams();\n for (const key in queryParams) {\n const value = queryParams[key as keyof typeof queryParams]?.toString();\n if (typeof value !== 'undefined' && value !== null) {\n params.append(key, value);\n }\n }\n\n // TODO: Re-think how to update the router, this seems wrong\n if (queryParams.search_query_native) {\n this.router.navigate(`/?query=${queryParams.search_query_native}`, true);\n } else if (this.nylasMailboxStore.state.threadsQueryParams.search_query_native && !queryParams.search_query_native) {\n this.router.navigate('/', true);\n }\n\n // If page_token is not set, reset the previous page tokens.\n if (!queryParams.page_token) {\n this.nylasMailboxStore.state.previousThreadPageTokens = [];\n }\n\n this.nylasMailboxStore.state.threadsQueryParams = queryParams;\n\n // Make the API request.\n const path = `/v3/grants/me/threads?${params.toString()}`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Thread[]>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the threads in the store.\n const threads = response.data;\n switch (updateMethod) {\n case 'prepend':\n this.nylasMailboxStore.state.threads = [...threads, ...this.nylasMailboxStore.state.threads];\n break;\n case 'append':\n this.nylasMailboxStore.state.threads = [...this.nylasMailboxStore.state.threads, ...threads];\n break;\n case 'overwrite':\n default:\n this.nylasMailboxStore.state.threads = threads;\n break;\n }\n\n // If we have a next cursor, set it in the store.\n if (response.next_cursor) {\n this.nylasMailboxStore.state.nextThreadPageToken = response.next_cursor;\n } else {\n this.nylasMailboxStore.state.nextThreadPageToken = null;\n }\n\n // Set the state to ready.\n if (updateState) {\n this.nylasMailboxStore.state.state = 'ready';\n }\n\n return threads;\n }\n\n public async getThread(threadId: string): Promise<Thread> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing thread:read-only scope');\n }\n\n // Check if we have the thread in the store already.\n const storeThread = this.nylasMailboxStore.state.threads.find(t => t.id === threadId);\n if (storeThread) {\n return storeThread;\n }\n\n // Set the state to loading.\n this.nylasMailboxStore.state.state = 'loading';\n\n // Make the API request.\n const path = `/v3/grants/me/threads/${threadId}`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Thread>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the threads in the store.\n const thread = response.data;\n this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map(t => {\n if (t.id === thread.id) {\n return thread;\n }\n return t;\n });\n\n // Set the state to ready.\n this.nylasMailboxStore.state.state = 'ready';\n\n return thread;\n }\n\n /**\n * Returns the next page of threads.\n * @param {'prepend' | 'append' | 'overwrite'} updateMethod How to update the store with the threads (default: overwrite).\n * @param {boolean} updateLoadingState Whether to update the loading state or not.\n * @returns {Promise<Thread[]>} The previous page of threads.\n */\n public async nextThreadPage(updateMethod: 'prepend' | 'append' | 'overwrite' = 'overwrite', updateLoadingState: boolean = true): Promise<Thread[]> {\n if (!this.nylasMailboxStore.state.nextThreadPageToken) {\n throw new Error('No next page token');\n }\n\n // If we have a next page token, add it to the previous page tokens.\n this.nylasMailboxStore.state.previousThreadPageTokens = Array.from(\n new Set([...this.nylasMailboxStore.state.previousThreadPageTokens, this.nylasMailboxStore.state.threadsQueryParams.page_token ?? null]),\n );\n\n // Get the last next page token.\n const nextPageToken = this.nylasMailboxStore.state.nextThreadPageToken;\n\n return this.getThreads(\n {\n ...this.nylasMailboxStore.state.threadsQueryParams,\n page_token: nextPageToken,\n },\n updateMethod,\n updateLoadingState,\n );\n }\n\n /**\n * Returns the previous page of threads.\n * @param {'prepend' | 'append' | 'overwrite'} updateMethod How to update the store with the threads (default: overwrite).\n * @param {boolean} updateLoadingState Whether to update the loading state or not.\n * @returns {Promise<Thread[]>} The previous page of threads.\n */\n public async previousThreadPage(aupdateMethod: 'prepend' | 'append' | 'overwrite' = 'overwrite', updateLoadingState: boolean = true): Promise<Thread[]> {\n if (!this.nylasMailboxStore.state.previousThreadPageTokens.length) {\n throw new Error('No previous page token');\n }\n\n // Remove the the last two next page tokens.\n const previousThreadPageTokens = [...this.nylasMailboxStore.state.previousThreadPageTokens];\n const pageToken = previousThreadPageTokens.pop();\n\n // Update the store.\n this.nylasMailboxStore.state.previousThreadPageTokens = previousThreadPageTokens;\n\n return this.getThreads(\n {\n ...this.nylasMailboxStore.state.threadsQueryParams,\n page_token: pageToken ?? undefined,\n },\n aupdateMethod,\n updateLoadingState,\n );\n }\n\n /**\n * Updates the thread query parameters in the store.\n * @param params Partial<ThreadQueryParameters>\n * @returns {void}\n */\n public updateThreadQueryParams(params: Partial<ThreadQueryParameters>): void {\n this.nylasMailboxStore.state.threadsQueryParams = {\n ...this.nylasMailboxStore.state.threadsQueryParams,\n ...params,\n };\n }\n\n /**\n * Back to the mailbox.\n */\n public back(): void {\n this.router.navigate('/', true);\n this.nylasMailboxStore.state.selectedThread = null;\n }\n\n /**\n * Unselects a thread.\n */\n public unSelectThread(): void {\n this.nylasMailboxStore.state.selectedThread = null;\n }\n\n /**\n * Selects a thread.\n * @param {Thread} thread The thread to select.\n * @returns {Promise<void>}\n */\n public async selectThread(thread: Thread): Promise<void> {\n this.router.navigate(`/thread/${thread.id}`, true);\n this.nylasMailboxStore.state.selectedThread = thread;\n\n // Mark the thread as read (async) if it is unread.\n if (thread.unread) {\n this.markThreadAsRead(thread).catch(error => {\n debug('Error marking thread as read', error);\n });\n }\n }\n\n /**\n * Marks a thread as read.\n * @param thread\n * @returns {Promise<Thread>}\n */\n public async markThreadAsRead(thread: Thread): Promise<Thread> {\n return this.updateThread(thread, { unread: false });\n }\n\n /**\n * Updates a thread.\n * @param thread The thread to update.\n * @returns {Promise<Thread>}\n */\n public async updateThread(thread: Thread, updateThread: Partial<Thread>): Promise<Thread> {\n // Make sure we have an authenticated user.\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a modify scope at least.\n if (!this.nylasAuth.hasScopeByType('email', 'modify')) {\n throw new Error('Missing thread:modify scope');\n }\n\n // Make the API request.\n const path = `/v3/grants/me/threads/${thread.id}`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Thread>>(path, 'PUT', updateThread);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Update the thread in the store.\n const updatedThread = response.data;\n this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map(t => {\n if (t.id === updatedThread.id) {\n return updatedThread;\n }\n return t;\n });\n this.nylasMailboxStore.state.selectedThread = updatedThread;\n\n return updatedThread;\n }\n}\n","import { Folder, NylasAPIError, NylasAuthType, NylasResponse, isNylasErrorResponse } from '@nylas/core';\nimport { NylasAuthStoreType, NylasMailboxStoreType } from '../../../components';\n\nexport class NylasFoldersConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n private nylasMailboxStore: NylasMailboxStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType, nylasMailboxStore: NylasMailboxStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n this.nylasMailboxStore = nylasMailboxStore;\n }\n\n /**\n * Returns the list of folders.\n */\n public async getFolders(): Promise<Folder[]> {\n if (!this.nylasAuthStore.state.isAuthenticated) {\n throw new Error('Not authenticated');\n }\n\n // Now make sure we have a read-only or modify scopes\n if (!this.nylasAuth.hasScopeByType('email', ['read-only', 'modify'])) {\n throw new Error('Missing thread:read-only scope');\n }\n\n // Set the state to loading.\n this.nylasMailboxStore.state.state = 'loading';\n\n // Make the API request.\n const path = `/v3/grants/me/folders`;\n const response = await this.nylasAuth.nylasAPIRequest<NylasResponse<Folder[]>>(path);\n if (isNylasErrorResponse(response)) {\n throw new NylasAPIError(response.error);\n }\n\n // Set the threads in the store.\n const folders = response.data;\n this.nylasMailboxStore.state.folders = folders;\n\n // Set the state to ready.\n this.nylasMailboxStore.state.state = 'ready';\n\n return folders;\n }\n\n public async selectFolder(folder: Folder) {\n this.nylasMailboxStore.state.threadsQueryParams = {\n in: folder.id,\n ...(this.nylasMailboxStore.state.threadsQueryParams || {}),\n };\n }\n}\n","import { debug } from '@/utils/utils';\nimport { RouteListener, RouteParams, RoutePath, RouterInterface } from './router-interface';\n\nexport class PolyFillHashChangeEvent extends Event {\n oldURL?: string;\n newURL?: string;\n\n constructor(type: string, eventInitDict: HashChangeEventInit) {\n super(type, eventInitDict);\n this.oldURL = eventInitDict.oldURL;\n this.newURL = eventInitDict.newURL;\n }\n}\n\nexport class HashRouter implements RouterInterface {\n private routeChangeListeners: [route: RoutePath, RouteListener<any>][] = [];\n\n constructor() {\n debug('HashRouter constructor');\n }\n\n // Destroy the router\n public destroy(): void {\n debug('HashRouter destroy');\n window.removeEventListener('hashchange', this.onRouteChange.bind(this));\n }\n\n // Initialize the router\n public init(): void {\n debug('HashRouter init');\n window.addEventListener('hashchange', this.onRouteChange.bind(this));\n\n // Trigger the initial route change\n if (typeof HashChangeEvent !== 'undefined') {\n const event: HashChangeEvent = new HashChangeEvent('hashchange', { oldURL: '', newURL: window.location.href });\n this.onRouteChange(event);\n } else {\n const event: Event = new PolyFillHashChangeEvent('hashchange', { oldURL: '', newURL: window.location.href });\n this.onRouteChange(event as HashChangeEvent);\n }\n }\n\n public addRouteChangeListener<Path extends RoutePath>(route: Path, listener: RouteListener<Path>): void {\n debug('HashRouter addRouteChangeListener');\n this.routeChangeListeners.push([route, listener]);\n }\n\n public navigate(route: string, shallow: boolean): void {\n debug('HashRouter navigate');\n\n // If we're navigating shallow, don't add a new history entry\n if (shallow) {\n return window.history.pushState(null, '', `#${route}`);\n }\n\n window.location.hash = route;\n }\n\n public setRoute(route: string): void {\n debug('HashRouter setRoute');\n window.location.hash = route;\n }\n\n // Matches a route and executes the callback\n public matchRoute(route: string, path: string): boolean {\n const routeParts = route.split('/');\n const pathParts = path.split('/');\n\n // If the route is `/` an the hash is empty, match the route\n debug(`HashRouter matchRoute route=${route} path=${path}`, { routeParts, pathParts });\n if (routeParts[1] === '' && pathParts[0] === '') {\n return true;\n }\n\n if (routeParts.length !== pathParts.length) {\n return false;\n }\n\n for (let i = 0; i < routeParts.length; i++) {\n const routePart = routeParts[i];\n const pathPart = pathParts[i];\n if (routePart.startsWith(':')) {\n continue;\n }\n if (routePart !== pathPart) {\n return false;\n }\n }\n\n return true;\n }\n\n // Parse the route and return the route params\n public getRouteParams<Path extends RoutePath>(route: Path): RouteParams<Path> {\n debug('HashRouter getRouteParams');\n const routeParams: RouteParams<Path> = {} as RouteParams<Path>;\n const routeParts = route.split('/');\n const routeConfigParts = window.location.hash.split('/');\n routeParts.forEach((routePart, index) => {\n if (routePart.startsWith(':')) {\n const key = routePart.substring(1) as keyof RouteParams<Path>;\n routeParams[key] = routeConfigParts[index] as RouteParams<Path>[keyof RouteParams<Path>]; // Cast the value to string\n }\n });\n return routeParams;\n }\n\n public getRouteWithParams(route: string, routeParams: Record<string, any>): string {\n debug('HashRouter getRouteWithParams');\n let routeWithParams = route;\n Object.keys(routeParams).forEach(key => {\n routeWithParams = routeWithParams.replace(`:${key}`, routeParams[key]);\n });\n return routeWithParams;\n }\n\n public getRoute(): string {\n debug('HashRouter getRoute');\n return window.location.hash;\n }\n\n public onRouteChange(event: HashChangeEvent): void {\n this.routeChangeListeners.forEach(async ([route, listener]) => {\n const path = event.newURL.indexOf('#') === -1 ? '' : event.newURL.substring(event.newURL.indexOf('#') + 1);\n debug(`HashRouter onRouteChange route=${route} path=${path}`, { event });\n if (!this.matchRoute(route, path)) {\n debug(`HashRouter onRouteChange route=${route} path=${path} does not match`);\n return;\n }\n const routeParams = this.getRouteParams(route) as RouteParams<RoutePath>;\n await listener(route, path, routeParams);\n });\n }\n\n public getBasePath(): string {\n debug('HashRouter getBasePath');\n return '';\n }\n}\n","import { TokenInfo } from '@nylas/core/dist/auth';\nimport { createStore } from '@stencil/store';\nimport { DataState } from '..';\n\nexport interface NylasAuthStoreState {\n isAuthenticated: boolean;\n tokenInfo: TokenInfo | null;\n state: DataState;\n}\n\nexport type NylasAuthStoreType = ReturnType<typeof CreateNylasAuthStore>;\n\nexport function CreateNylasAuthStore(defaultState: Partial<NylasAuthStoreState> = {}) {\n const defaultNylasStoreState: NylasAuthStoreState = {\n isAuthenticated: false,\n tokenInfo: null,\n state: 'ready',\n ...defaultState,\n };\n const store = createStore<NylasAuthStoreState>(defaultNylasStoreState);\n\n /**\n * Reset the Nylas store to its default state.\n * There is something wrong with the stencil/store reset method,\n * so we have to do it via this hack.\n */\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n","import type { Folder, Message, MessageQueryParameters, Thread, ThreadQueryParameters } from '@nylas/core';\nimport { createStore } from '@stencil/store';\nimport { DataState } from '../components';\n\nexport interface NylasMailboxStoreState {\n state: DataState;\n messages: Message[];\n threads: Thread[];\n folders: Folder[];\n selectedThread: Thread | null;\n selectedFolder: string;\n searchQuery: string;\n\n nextThreadPageToken: string | null;\n previousThreadPageTokens: (string | null)[];\n hasNextThreadPage: boolean;\n hasPreviousThreadPage: boolean;\n threadsQueryParams: Partial<ThreadQueryParameters>;\n messgeQueryParams: Partial<MessageQueryParameters>;\n}\n\nexport type NylasMailboxStoreType = ReturnType<typeof CreateNylasMailboxStore>;\n\nexport function CreateNylasMailboxStore(defaultState: Partial<NylasMailboxStoreState> = {}) {\n const defaultNylasStoreState: NylasMailboxStoreState = {\n state: 'ready',\n\n messages: [],\n threads: [],\n folders: [],\n selectedThread: null,\n nextThreadPageToken: null,\n previousThreadPageTokens: [],\n searchQuery: '',\n\n hasNextThreadPage: false,\n hasPreviousThreadPage: false,\n\n selectedFolder: 'inbox',\n\n threadsQueryParams: {\n in: 'inbox',\n },\n messgeQueryParams: {\n fields: 'include_headers',\n },\n ...defaultState,\n };\n\n const store = createStore<NylasMailboxStoreState>({ ...defaultNylasStoreState });\n\n // Set our hasNextThreadPage if nextThreadPageToken is not null.\n store.onChange('nextThreadPageToken', nextThreadPageToken => {\n store.set('hasNextThreadPage', nextThreadPageToken !== null);\n });\n // Set our hasPreviousThreadPage if previousThreadPageTokens is not empty.\n store.onChange('previousThreadPageTokens', previousThreadPageTokens => {\n store.set('hasPreviousThreadPage', previousThreadPageTokens.length > 0);\n });\n\n // When threadsQueryParams changes...\n store.onChange('threadsQueryParams', threadsQueryParams => {\n // set our selectedFolder to the in param.\n store.set('selectedFolder', threadsQueryParams.in || 'inbox');\n // set our searchQuery to the search_query_native param.\n store.set('searchQuery', threadsQueryParams.search_query_native || '');\n });\n\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-8362ce5c.js';
1
+ import { r as registerInstance, h } from './index-582cfc93.js';
2
2
 
3
3
  const iconCss = ".sc-microsoft-logo-icon-h{display:flex}";
4
4
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, i as createEvent, h, a as Host, e as getElement } from './index-8362ce5c.js';
1
+ import { r as registerInstance, a as createEvent, h, e as Host, i as getElement } from './index-582cfc93.js';
2
2
  import { a as debug } from './utils-49a1d17b.js';
3
3
  import './buffer-es6-5510d761.js';
4
4
  import './_commonjsHelpers-6cbf8316.js';
@@ -1,10 +1,10 @@
1
- import { r as registerInstance, h, a as Host, e as getElement } from './index-8362ce5c.js';
2
- import { R as RegisterComponent } from './register-component-8e4e394f.js';
1
+ import { r as registerInstance, h, e as Host, i as getElement } from './index-582cfc93.js';
2
+ import { R as RegisterComponent } from './register-component-6ae95538.js';
3
3
  import { a as debug } from './utils-49a1d17b.js';
4
4
  import './buffer-es6-5510d761.js';
5
5
  import './_commonjsHelpers-6cbf8316.js';
6
6
 
7
- const nylasAdditionalParticipantsCss = ":host{display:block;margin:1rem;--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-additional-participants__title{color:var(--nylas-base-nylas-base-900-aaa, #101323);font-size:16px;font-style:normal;font-weight:600;line-height:20px;margin:0;text-align:left}.nylas-additional-participants__subtitle{color:var(--nylas-base-600);font-size:14px;font-style:normal;font-weight:400;line-height:20px;margin:0.25rem 0px 0px;text-align:left}.nylas-additional-participants__content{padding:1rem;display:flex;flex-direction:column;gap:1rem}.nylas-additional-participants__input_group{padding-top:8px;display:flex;flex-direction:column;gap:4px}.nylas-additional-participants__input_group label{display:flex;align-items:center;color:var(--nylas-base-800);font-size:14px;font-style:normal;font-weight:400;line-height:150%}.nylas-additional-participants__input_wrapper{display:flex;border-width:1;border-radius:8px;border:1px solid var(--nylas-base-300)}.nylas-additional-participants__input_wrapper button{padding:12px;border:none;background:none;cursor:pointer}.nylas-additional-participants__input_wrapper button:hover,.nylas-additional-participants__input_wrapper button:active{color:var(--nylas-primary)}.nylas-additional-participants__input_wrapper_organizer{background:var(--nylas-base-50)}.nylas-additional-participants__input{flex:1;padding:12px 16px;border-right:1px solid var(--nylas-base-300)}.nylas-additional-participants__input input{border:none;outline:none;background:none;width:100%}.nylas-additional-participants__add{padding:12px;display:flex;align-items:center;border:none;background:none;cursor:pointer}.nylas-additional-participants__add span{padding:0 8px;font-size:16px;font-style:normal;font-weight:500}.nylas-additional-participants__add:hover,.nylas-additional-participants__add:active{color:var(--nylas-primary)}";
7
+ const nylasAdditionalParticipantsCss = ":host{display:block;margin:1rem;--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-additional-participants__title{color:var(--nylas-base-nylas-base-900-aaa, #101323);font-size:16px;font-style:normal;font-weight:600;line-height:20px;margin:0;text-align:left}.nylas-additional-participants__subtitle{color:var(--nylas-base-600);font-size:14px;font-style:normal;font-weight:400;line-height:20px;margin:0.25rem 0px 0px;text-align:left}.nylas-additional-participants__content{padding:1rem;display:flex;flex-direction:column;gap:1rem}.nylas-additional-participants__input_group{padding-top:8px;display:flex;flex-direction:column;gap:4px}.nylas-additional-participants__input_group label{display:flex;align-items:center;color:var(--nylas-base-800);font-size:14px;font-style:normal;font-weight:400;line-height:150%}.nylas-additional-participants__input_wrapper{display:flex;border-width:1;border-radius:8px;border:1px solid var(--nylas-base-300)}.nylas-additional-participants__input_wrapper button{padding:12px;border:none;border-left:1px solid var(--nylas-base-300);background:none;cursor:pointer}.nylas-additional-participants__input_wrapper button:hover,.nylas-additional-participants__input_wrapper button:active{color:var(--nylas-primary)}.nylas-additional-participants__input_wrapper_organizer{background:var(--nylas-base-50)}.nylas-additional-participants__input{flex:1;display:flex;justify-content:space-between}.nylas-additional-participants__input.organizer{padding:12px 16px}.nylas-additional-participants__input input{border:none;outline:none;background:none;width:100%}.nylas-additional-participants__input input-dropdown{width:100%}.nylas-additional-participants__input input-dropdown::part(id_dropdown){width:100%;height:100%}.nylas-additional-participants__input input-dropdown::part(id_dropdown-input){height:100%;border-radius:var(--nylas-border-radius-2x);border:none;border-top-right-radius:initial;border-bottom-right-radius:initial;padding-left:16px}.nylas-additional-participants__add{padding:12px;display:flex;align-items:center;border:none;background:none;cursor:pointer}.nylas-additional-participants__add span{padding:0 8px;font-size:16px;font-style:normal;font-weight:500}.nylas-additional-participants__add:hover,.nylas-additional-participants__add:active{color:var(--nylas-primary)}";
8
8
 
9
9
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10
10
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -32,6 +32,7 @@ const NylasAdditionalParticipants = class {
32
32
  }
33
33
  this.name = 'participants';
34
34
  this.eventParticipants = undefined;
35
+ this.participantOptions = undefined;
35
36
  this.participants = this.eventParticipants ?? [];
36
37
  this.participantsValid = true;
37
38
  }
@@ -48,39 +49,57 @@ const NylasAdditionalParticipants = class {
48
49
  }
49
50
  componentDidLoad() {
50
51
  debug('nylas-additional-participants', 'componentDidLoad');
51
- this.internals.setFormValue(JSON.stringify(this.participants), 'participants');
52
+ this.internals.setFormValue(JSON.stringify(this.participantsWithouOrganizer()), 'participants');
52
53
  }
53
54
  disconnectedCallback() {
54
55
  debug('nylas-additional-participants', 'disconnectedCallback');
55
56
  }
57
+ onInputOptionChanged(event) {
58
+ debug('nylas-additional-participants', 'onInputOptionChanged');
59
+ const index = event.detail.name;
60
+ this.participants[index].email = event.detail.value;
61
+ const participant = this.participantOptions?.find(participant => participant.email === event.detail.value);
62
+ this.participants[index].name = participant?.name || event.detail.value;
63
+ this.participants = [...this.participants];
64
+ this.internals.setFormValue(JSON.stringify(this.participantsWithouOrganizer()), 'participants');
65
+ }
56
66
  onParticipantChange(event, index) {
57
67
  debug('nylas-additional-participants', 'onParticipantChange');
58
68
  this.participants[index].email = event.target.value;
59
- this.internals.setFormValue(JSON.stringify(this.participants), 'participants');
69
+ this.internals.setFormValue(JSON.stringify(this.participantsWithouOrganizer()), 'participants');
60
70
  }
61
71
  addParticipant() {
62
72
  debug('nylas-additional-participants', 'addParticipant');
63
- this.participants = [...this.participants, { email: '', is_organizer: false, availability: { calendar_ids: ['primary'] } }];
64
- this.internals.setFormValue(JSON.stringify(this.participants), 'participants');
73
+ this.participants = [...this.participants, { name: '', email: '', is_organizer: false, availability: { calendar_ids: ['primary'] } }];
74
+ this.internals.setFormValue(JSON.stringify(this.participantsWithouOrganizer()), 'participants');
65
75
  }
66
- removeParticipant(email) {
67
- debug('nylas-additional-participants', 'addParticipant');
68
- this.participants = this.participants.filter(p => p.email !== email);
69
- this.internals.setFormValue(JSON.stringify(this.participants), 'participants');
76
+ removeParticipant(index) {
77
+ debug('nylas-additional-participants', 'removeParticipant');
78
+ this.participants = this.participants.filter((_, i) => i !== index);
79
+ this.internals.setFormValue(JSON.stringify(this.participantsWithouOrganizer()), 'participants');
70
80
  }
71
81
  validate(email, index) {
72
82
  debug('nylas-additional-participants', 'validate');
73
83
  const regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
74
84
  const valid = regex.test(String(email).toLowerCase());
75
85
  this.participants[index].is_valid = valid;
76
- this.internals.setFormValue(JSON.stringify(this.participants), 'participants');
86
+ this.internals.setFormValue(JSON.stringify(this.participantsWithouOrganizer()), 'participants');
87
+ }
88
+ participantsWithouOrganizer() {
89
+ return this.participants.filter(participant => !participant.is_organizer);
90
+ }
91
+ getArrayDifference(array1, array2) {
92
+ const filtered = array1.filter(participant1 => !array2.some(participant2 => participant1.email === participant2.email));
93
+ return filtered.map(participant => {
94
+ return { value: participant.email, label: participant.email };
95
+ });
77
96
  }
78
97
  render() {
79
- return (h(Host, { key: '91518d593ecd43e88105d3137746e9d95653e0e7' }, h("nylas-form-card", { key: 'd05f897f3d5109ce3b31d2aad8ca09af05793b58' }, h("h3", { key: 'fcc5ae151fb84bf60abf58e44eb8e043cd4cefac', slot: "header-title", class: "nylas-additional-participants__title", part: "nap__title" }, "Additional participants"), h("p", { key: '7e8e8354258dc9884cef56c1e4bdbe0d1fc724c5', slot: "header-subtitle", class: "nylas-additional-participants__subtitle", part: "nap__subtitle" }, "Add anyone else who would be joining for this event."), h("div", { key: '3376539a53c39a2e43fd4a817a83511eb852cd87', slot: "content", class: "nylas-additional-participants__content" }, h("div", { key: 'b782dad233ad8ca25030d9ea45092eea93c2f0dd' }, this.participants.map((participant, index) => {
80
- return (h("div", { class: 'nylas-additional-participants__input_group', part: "nap__input_group" }, h("label", null, participant.is_organizer ? 'Organizer' : `Participant ${index}`), h("div", { part: "nap__input_wrapper", class: `nylas-additional-participants__input_wrapper ${participant.is_organizer && 'nylas-additional-participants__input_wrapper_organizer'} ${participant.is_valid === false && 'nylas-additional-participants__input_wrapper_invalid'}` }, h("div", { class: "nylas-additional-participants__input", part: "nap__input" }, h("input", { type: "text", value: participant.email, onInput: e => {
98
+ return (h(Host, { key: '5f2ab58dd16c4052b17111fa260d676c908bcf58' }, h("nylas-form-card", { key: 'a636c3ef694cc333b15830c35eb13fb51ff69ca0' }, h("h3", { key: '13425f0338b7b88746844c79104f008323bdcbf1', slot: "header-title", class: "nylas-additional-participants__title", part: "nap__title" }, "Additional participants"), h("p", { key: '7ebe90bb5ef933b7632c8b30aa9b1ccf8f08c6a6', slot: "header-subtitle", class: "nylas-additional-participants__subtitle", part: "nap__subtitle" }, "Add anyone else who would be joining for this event."), h("div", { key: '3662713253e568cbf70b4d73e4eb883bb6c329a2', slot: "content", class: "nylas-additional-participants__content" }, h("div", { key: '577176dfd841875992a420e243be2905968452d5' }, this.participants.map((participant, index) => {
99
+ return (h("div", { class: 'nylas-additional-participants__input_group', part: "nap__input_group" }, h("label", null, participant.is_organizer ? 'Organizer' : `Participant ${index}`), h("div", { part: "nap__input_wrapper", class: `nylas-additional-participants__input_wrapper ${participant.is_organizer && 'nylas-additional-participants__input_wrapper_organizer'} ${participant.is_valid === false && 'nylas-additional-participants__input_wrapper_invalid'}` }, h("div", { class: { 'nylas-additional-participants__input': true, 'organizer': participant.is_organizer }, part: "nap__input" }, participant.is_organizer ? (h("input", { type: "text", value: participant.email, onInput: e => {
81
100
  this.onParticipantChange(e, index);
82
- }, readOnly: participant.is_organizer, onBlur: () => this.validate(participant.email, index) })), !participant.is_organizer && (h("button", { onClick: () => this.removeParticipant(participant.email), part: "nap__remove-participant" }, h("close-icon", null))))));
83
- }))))));
101
+ }, readOnly: participant.is_organizer, onBlur: () => this.validate(participant.email, index) })) : (h("input-dropdown", { name: `${index}`, inputValue: participant.email, options: this.getArrayDifference(this.participantOptions || [], this.participants) })), !participant.is_organizer && (h("button", { onClick: () => this.removeParticipant(index), part: "nap__remove-participant" }, h("close-icon", null)))))));
102
+ })), h("button", { key: '74f99ea0eb6a5a5873a7b5dbed5caa4bf557fa4e', class: "nylas-additional-participants__add", part: "nap__add-participant", onClick: () => this.addParticipant() }, h("add-circle-icon", { key: '9d139a5ba18bdec17acaa1dc9d9d773d0a7b1a5d' }), " ", h("span", { key: '89778f530c53d8ffa55c7e3bb67bdd5b19c4f881' }, "Add ", this.participants.length > 1 ? 'another' : 'a', " participant"))))));
84
103
  }
85
104
  static get formAssociated() { return true; }
86
105
  get host() { return getElement(this); }
@@ -91,6 +110,7 @@ const NylasAdditionalParticipants = class {
91
110
  __decorate([
92
111
  RegisterComponent({
93
112
  name: 'nylas-additional-participants',
113
+ stateToProps: new Map([['schedulerConfig.additionalParticipants', 'participantOptions']]),
94
114
  eventToProps: {},
95
115
  fireRegisterEvent: true,
96
116
  }),