@nylas/web-elements 1.1.0-canary.10 → 1.1.0-canary.11

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 (226) hide show
  1. package/dist/cjs/add-circle-icon_21.cjs.entry.js +73 -40
  2. package/dist/cjs/add-circle-icon_21.cjs.entry.js.map +1 -1
  3. package/dist/cjs/google-logo-icon_4.cjs.entry.js +5 -4
  4. package/dist/cjs/google-logo-icon_4.cjs.entry.js.map +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/nylas-api-request-05f1e068.js.map +1 -1
  7. package/dist/cjs/nylas-api-request-de316f1a.js.map +1 -1
  8. package/dist/cjs/nylas-availability-picker.cjs.entry.js +14 -7
  9. package/dist/cjs/nylas-availability-picker.cjs.entry.js.map +1 -1
  10. package/dist/cjs/nylas-booked-event-card.cjs.entry.js +1 -1
  11. package/dist/cjs/nylas-booked-event-card_10.cjs.entry.js +9 -9
  12. package/dist/cjs/nylas-booking-calendar-picker.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nylas-booking-form.cjs.entry.js +3 -3
  14. package/dist/cjs/nylas-buffer-time.cjs.entry.js +7 -6
  15. package/dist/cjs/nylas-buffer-time.cjs.entry.js.map +1 -1
  16. package/dist/cjs/nylas-calendar-picker.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nylas-date-picker.cjs.entry.js +1 -1
  18. package/dist/cjs/nylas-editor-tabs.cjs.entry.js +5 -4
  19. package/dist/cjs/nylas-editor-tabs.cjs.entry.js.map +1 -1
  20. package/dist/cjs/nylas-event-description.cjs.entry.js +2 -2
  21. package/dist/cjs/nylas-event-description.cjs.entry.js.map +1 -1
  22. package/dist/cjs/nylas-event-duration.cjs.entry.js +1 -1
  23. package/dist/cjs/nylas-event-duration.cjs.entry.js.map +1 -1
  24. package/dist/cjs/nylas-event-info.cjs.entry.js +1 -1
  25. package/dist/cjs/nylas-event-info.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nylas-event-limits.cjs.entry.js +1 -1
  27. package/dist/cjs/nylas-event-limits.cjs.entry.js.map +1 -1
  28. package/dist/cjs/nylas-event-title.cjs.entry.js +2 -2
  29. package/dist/cjs/nylas-if-state.cjs.entry.js +1 -1
  30. package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js +1 -1
  31. package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js.map +1 -1
  32. package/dist/cjs/nylas-locale-switch.cjs.entry.js +3 -3
  33. package/dist/cjs/nylas-location-component.cjs.entry.js +4 -4
  34. package/dist/cjs/nylas-location-component.cjs.entry.js.map +1 -1
  35. package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js +1 -1
  36. package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js.map +1 -1
  37. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +1 -1
  38. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js.map +1 -1
  39. package/dist/cjs/nylas-selected-event-card.cjs.entry.js +1 -1
  40. package/dist/cjs/nylas-time-window-picker.cjs.entry.js +39 -14
  41. package/dist/cjs/nylas-time-window-picker.cjs.entry.js.map +1 -1
  42. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  43. package/dist/cjs/scheduler-config-store-918c20d5.js.map +1 -1
  44. package/dist/cjs/scheduler-config-store-a5b7c08b.js.map +1 -1
  45. package/dist/collection/collection-manifest.json +3 -3
  46. package/dist/collection/common/nylas-api-request.js.map +1 -1
  47. package/dist/collection/components/nylas-if-state/nylas-if-state.js +1 -1
  48. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js +1 -1
  49. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +3 -3
  50. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +1 -1
  51. package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.js +3 -3
  52. package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js +1 -1
  53. package/dist/collection/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.js +35 -14
  54. package/dist/collection/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.js.map +1 -1
  55. package/dist/collection/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.js +1 -1
  56. package/dist/collection/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.js.map +1 -1
  57. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.css +1 -1
  58. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js +6 -5
  59. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js.map +1 -1
  60. package/dist/collection/components/scheduler-editor/nylas-buffer-time/test/nylas-buffer-time.spec.js +2 -2
  61. package/dist/collection/components/scheduler-editor/nylas-buffer-time/test/nylas-buffer-time.spec.js.map +1 -1
  62. package/dist/collection/components/scheduler-editor/nylas-calendar-picker/nylas-calendar-picker.js +1 -1
  63. package/dist/collection/components/scheduler-editor/nylas-calendar-picker/nylas-calendar-picker.js.map +1 -1
  64. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js +6 -5
  65. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js.map +1 -1
  66. package/dist/collection/components/scheduler-editor/nylas-event-description/nylas-event-description.js +5 -5
  67. package/dist/collection/components/scheduler-editor/nylas-event-description/nylas-event-description.js.map +1 -1
  68. package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js +4 -4
  69. package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js.map +1 -1
  70. package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js +1 -1
  71. package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js.map +1 -1
  72. package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js +1 -1
  73. package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js.map +1 -1
  74. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js +2 -2
  75. package/dist/collection/components/scheduler-editor/nylas-limit-future-bookings/nylas-limit-future-bookings.js +4 -4
  76. package/dist/collection/components/scheduler-editor/nylas-limit-future-bookings/nylas-limit-future-bookings.js.map +1 -1
  77. package/dist/collection/components/scheduler-editor/nylas-location-component/nylas-location-component.js +23 -23
  78. package/dist/collection/components/scheduler-editor/nylas-location-component/nylas-location-component.js.map +1 -1
  79. package/dist/collection/components/scheduler-editor/nylas-min-cancellation-notice/nylas-min-cancellation-notice.js +3 -3
  80. package/dist/collection/components/scheduler-editor/nylas-min-cancellation-notice/nylas-min-cancellation-notice.js.map +1 -1
  81. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js +9 -9
  82. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js.map +1 -1
  83. package/dist/collection/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.js +56 -57
  84. package/dist/collection/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.js.map +1 -1
  85. package/dist/collection/stores/scheduler-config-store.js.map +1 -1
  86. package/dist/collection/types/index.js +6 -0
  87. package/dist/collection/types/index.js.map +1 -0
  88. package/dist/components/nylas-api-request.js.map +1 -1
  89. package/dist/components/nylas-availability-picker2.js +15 -8
  90. package/dist/components/nylas-availability-picker2.js.map +1 -1
  91. package/dist/components/nylas-booked-event-card2.js +1 -1
  92. package/dist/components/nylas-booking-calendar-picker2.js.map +1 -1
  93. package/dist/components/nylas-booking-form2.js +3 -3
  94. package/dist/components/nylas-buffer-time2.js +7 -6
  95. package/dist/components/nylas-buffer-time2.js.map +1 -1
  96. package/dist/components/nylas-calendar-picker2.js.map +1 -1
  97. package/dist/components/nylas-date-picker2.js +1 -1
  98. package/dist/components/nylas-editor-tabs2.js +5 -4
  99. package/dist/components/nylas-editor-tabs2.js.map +1 -1
  100. package/dist/components/nylas-event-description2.js +2 -2
  101. package/dist/components/nylas-event-description2.js.map +1 -1
  102. package/dist/components/nylas-event-duration2.js +1 -1
  103. package/dist/components/nylas-event-duration2.js.map +1 -1
  104. package/dist/components/nylas-event-info2.js +1 -1
  105. package/dist/components/nylas-event-info2.js.map +1 -1
  106. package/dist/components/nylas-event-limits2.js +1 -1
  107. package/dist/components/nylas-event-limits2.js.map +1 -1
  108. package/dist/components/nylas-event-title2.js +2 -2
  109. package/dist/components/nylas-if-state.js +1 -1
  110. package/dist/components/nylas-limit-future-bookings2.js +1 -1
  111. package/dist/components/nylas-limit-future-bookings2.js.map +1 -1
  112. package/dist/components/nylas-locale-switch2.js +3 -3
  113. package/dist/components/nylas-location-component2.js +5 -5
  114. package/dist/components/nylas-location-component2.js.map +1 -1
  115. package/dist/components/nylas-min-cancellation-notice2.js +1 -1
  116. package/dist/components/nylas-min-cancellation-notice2.js.map +1 -1
  117. package/dist/components/nylas-scheduler-editor.js +1 -1
  118. package/dist/components/nylas-scheduler-editor.js.map +1 -1
  119. package/dist/components/nylas-selected-event-card2.js +1 -1
  120. package/dist/components/nylas-time-window-picker2.js +39 -16
  121. package/dist/components/nylas-time-window-picker2.js.map +1 -1
  122. package/dist/components/scheduler-config-store.js.map +1 -1
  123. package/dist/esm/add-circle-icon_21.entry.js +73 -40
  124. package/dist/esm/add-circle-icon_21.entry.js.map +1 -1
  125. package/dist/esm/google-logo-icon_4.entry.js +5 -4
  126. package/dist/esm/google-logo-icon_4.entry.js.map +1 -1
  127. package/dist/esm/loader.js +1 -1
  128. package/dist/esm/nylas-api-request-59738f8c.js.map +1 -1
  129. package/dist/esm/nylas-api-request-ff2869d7.js.map +1 -1
  130. package/dist/esm/nylas-availability-picker.entry.js +14 -7
  131. package/dist/esm/nylas-availability-picker.entry.js.map +1 -1
  132. package/dist/esm/nylas-booked-event-card.entry.js +1 -1
  133. package/dist/esm/nylas-booked-event-card_10.entry.js +9 -9
  134. package/dist/esm/nylas-booking-calendar-picker.entry.js.map +1 -1
  135. package/dist/esm/nylas-booking-form.entry.js +3 -3
  136. package/dist/esm/nylas-buffer-time.entry.js +7 -6
  137. package/dist/esm/nylas-buffer-time.entry.js.map +1 -1
  138. package/dist/esm/nylas-calendar-picker.entry.js.map +1 -1
  139. package/dist/esm/nylas-date-picker.entry.js +1 -1
  140. package/dist/esm/nylas-editor-tabs.entry.js +5 -4
  141. package/dist/esm/nylas-editor-tabs.entry.js.map +1 -1
  142. package/dist/esm/nylas-event-description.entry.js +2 -2
  143. package/dist/esm/nylas-event-description.entry.js.map +1 -1
  144. package/dist/esm/nylas-event-duration.entry.js +1 -1
  145. package/dist/esm/nylas-event-duration.entry.js.map +1 -1
  146. package/dist/esm/nylas-event-info.entry.js +1 -1
  147. package/dist/esm/nylas-event-info.entry.js.map +1 -1
  148. package/dist/esm/nylas-event-limits.entry.js +1 -1
  149. package/dist/esm/nylas-event-limits.entry.js.map +1 -1
  150. package/dist/esm/nylas-event-title.entry.js +2 -2
  151. package/dist/esm/nylas-if-state.entry.js +1 -1
  152. package/dist/esm/nylas-limit-future-bookings.entry.js +1 -1
  153. package/dist/esm/nylas-limit-future-bookings.entry.js.map +1 -1
  154. package/dist/esm/nylas-locale-switch.entry.js +3 -3
  155. package/dist/esm/nylas-location-component.entry.js +4 -4
  156. package/dist/esm/nylas-location-component.entry.js.map +1 -1
  157. package/dist/esm/nylas-min-cancellation-notice.entry.js +1 -1
  158. package/dist/esm/nylas-min-cancellation-notice.entry.js.map +1 -1
  159. package/dist/esm/nylas-scheduler-editor.entry.js +1 -1
  160. package/dist/esm/nylas-scheduler-editor.entry.js.map +1 -1
  161. package/dist/esm/nylas-selected-event-card.entry.js +1 -1
  162. package/dist/esm/nylas-time-window-picker.entry.js +39 -14
  163. package/dist/esm/nylas-time-window-picker.entry.js.map +1 -1
  164. package/dist/esm/nylas-web-elements.js +1 -1
  165. package/dist/esm/scheduler-config-store-8ccc8dc7.js.map +1 -1
  166. package/dist/esm/scheduler-config-store-ec3b6190.js.map +1 -1
  167. package/dist/nylas-web-elements/nylas-api-request-ff2869d7.js.map +1 -1
  168. package/dist/nylas-web-elements/nylas-availability-picker.entry.js +14 -7
  169. package/dist/nylas-web-elements/nylas-availability-picker.entry.js.map +1 -1
  170. package/dist/nylas-web-elements/nylas-booked-event-card.entry.js +1 -1
  171. package/dist/nylas-web-elements/nylas-booking-calendar-picker.entry.js.map +1 -1
  172. package/dist/nylas-web-elements/nylas-booking-form.entry.js +3 -3
  173. package/dist/nylas-web-elements/nylas-buffer-time.entry.js +7 -6
  174. package/dist/nylas-web-elements/nylas-buffer-time.entry.js.map +1 -1
  175. package/dist/nylas-web-elements/nylas-calendar-picker.entry.js.map +1 -1
  176. package/dist/nylas-web-elements/nylas-date-picker.entry.js +1 -1
  177. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +5 -4
  178. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js.map +1 -1
  179. package/dist/nylas-web-elements/nylas-event-description.entry.js +2 -2
  180. package/dist/nylas-web-elements/nylas-event-description.entry.js.map +1 -1
  181. package/dist/nylas-web-elements/nylas-event-duration.entry.js +1 -1
  182. package/dist/nylas-web-elements/nylas-event-duration.entry.js.map +1 -1
  183. package/dist/nylas-web-elements/nylas-event-info.entry.js +1 -1
  184. package/dist/nylas-web-elements/nylas-event-info.entry.js.map +1 -1
  185. package/dist/nylas-web-elements/nylas-event-limits.entry.js +1 -1
  186. package/dist/nylas-web-elements/nylas-event-limits.entry.js.map +1 -1
  187. package/dist/nylas-web-elements/nylas-event-title.entry.js +2 -2
  188. package/dist/nylas-web-elements/nylas-if-state.entry.js +1 -1
  189. package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js +1 -1
  190. package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js.map +1 -1
  191. package/dist/nylas-web-elements/nylas-locale-switch.entry.js +3 -3
  192. package/dist/nylas-web-elements/nylas-location-component.entry.js +4 -4
  193. package/dist/nylas-web-elements/nylas-location-component.entry.js.map +1 -1
  194. package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js +1 -1
  195. package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js.map +1 -1
  196. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +1 -1
  197. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js.map +1 -1
  198. package/dist/nylas-web-elements/nylas-selected-event-card.entry.js +1 -1
  199. package/dist/nylas-web-elements/nylas-time-window-picker.entry.js +39 -14
  200. package/dist/nylas-web-elements/nylas-time-window-picker.entry.js.map +1 -1
  201. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  202. package/dist/nylas-web-elements/p-0dabcb4d.js.map +1 -1
  203. package/dist/nylas-web-elements/{p-933c6d32.entry.js → p-181654f5.entry.js} +3 -3
  204. package/dist/nylas-web-elements/{p-933c6d32.entry.js.map → p-181654f5.entry.js.map} +1 -1
  205. package/dist/nylas-web-elements/{p-b1b3eb52.entry.js → p-1871c702.entry.js} +2 -2
  206. package/dist/nylas-web-elements/p-4f4e83d0.entry.js +2 -0
  207. package/dist/nylas-web-elements/p-4f4e83d0.entry.js.map +1 -0
  208. package/dist/nylas-web-elements/p-a219b2c7.entry.js +2 -0
  209. package/dist/nylas-web-elements/p-a219b2c7.entry.js.map +1 -0
  210. package/dist/nylas-web-elements/{p-a002b4cf.entry.js → p-e92690a2.entry.js} +2 -2
  211. package/dist/nylas-web-elements/p-ee91a2a0.js.map +1 -1
  212. package/dist/nylas-web-elements/scheduler-config-store-8ccc8dc7.js.map +1 -1
  213. package/dist/types/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.d.ts +10 -5
  214. package/dist/types/components/scheduler-editor/nylas-event-description/nylas-event-description.d.ts +2 -2
  215. package/dist/types/components/scheduler-editor/nylas-location-component/nylas-location-component.d.ts +2 -2
  216. package/dist/types/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.d.ts +8 -3
  217. package/dist/types/components.d.ts +125 -32
  218. package/dist/types/stores/scheduler-config-store.d.ts +5 -1
  219. package/dist/types/types/index.d.ts +73 -0
  220. package/package.json +4 -2
  221. package/dist/nylas-web-elements/p-74492776.entry.js +0 -2
  222. package/dist/nylas-web-elements/p-74492776.entry.js.map +0 -1
  223. package/dist/nylas-web-elements/p-76461af6.entry.js +0 -2
  224. package/dist/nylas-web-elements/p-76461af6.entry.js.map +0 -1
  225. /package/dist/nylas-web-elements/{p-b1b3eb52.entry.js.map → p-1871c702.entry.js.map} +0 -0
  226. /package/dist/nylas-web-elements/{p-a002b4cf.entry.js.map → p-e92690a2.entry.js.map} +0 -0
@@ -52,9 +52,9 @@ const NylasAvailabilityPicker = class {
52
52
  this.host.setAttribute('name', newValue);
53
53
  }
54
54
  configChangedHandler(newConfig) {
55
- const organizerParticipant = newConfig?.participants?.find(p => p.is_organizer);
56
- if (organizerParticipant && organizerParticipant?.availability?.open_hours) {
57
- this.openHoursToSchedule(organizerParticipant?.availability?.open_hours);
55
+ const organizer = newConfig?.participants?.find(p => p.is_organizer);
56
+ if (organizer && organizer?.availability?.open_hours) {
57
+ this.openHoursToSchedule(organizer?.availability?.open_hours);
58
58
  }
59
59
  }
60
60
  scheduleChanged(newValue, oldValue) {
@@ -203,7 +203,13 @@ const NylasAvailabilityPicker = class {
203
203
  this.schedule[day].splice(index, 1);
204
204
  this.schedule = { ...this.schedule };
205
205
  }
206
- setTime(key, _event, value) {
206
+ setTime(event) {
207
+ console.log('timeChanged', event);
208
+ const { key, value } = event.detail;
209
+ console.log({
210
+ key,
211
+ value,
212
+ });
207
213
  const [dayIndex, timeType] = key.split('_');
208
214
  const [day, index] = dayIndex.split(':');
209
215
  if (timeType === 'start') {
@@ -215,7 +221,8 @@ const NylasAvailabilityPicker = class {
215
221
  this.internals.setValidity({ customError: false });
216
222
  this.schedule = { ...this.schedule };
217
223
  }
218
- setFormError(key, _event, _errorMessage) {
224
+ setFormError(event) {
225
+ const { key } = event.detail;
219
226
  const [_, timeType] = key.split('_');
220
227
  const element = this.host.shadowRoot?.getElementById(key);
221
228
  if (element) {
@@ -297,7 +304,7 @@ const NylasAvailabilityPicker = class {
297
304
  label: TIMEZONE_MAP[key],
298
305
  value: key,
299
306
  }));
300
- return (h(Host, { key: 'ba1266dfd7debd6f7efa1f5ddc48052806e8f594' }, h("div", { key: '34a52a728438348052f5159d347ff43071742bd4', class: "nylas-availability-picker" }, h("div", { key: '3a5e39e6e3d3ceaef4ce85fba1d2b1e5e7a52cda', class: "header", part: "nap__header" }, h("h3", { key: '4aad60a39b816631b0c9cb89741ceca1da22e05b' }, "General availability"), h("p", { key: '71755be3b152af545828336c3601c24434f764b4' }, "Set your availability for scheduling meetings.")), h("div", { key: 'db86358f996a6b7f75572f65ad469c1c80dee5a2', class: "content" }, h("div", { key: '63a90d8094f600815e2b7e8a13c9cbd25a8a14c1', class: "select-timezone", part: "nap__select-timezone" }, h("h4", { key: '612b2808fe828cf8867c98ea0f80f5a3b3a5ab52', class: "sub-header" }, "Select timezone", h("span", { key: '467c6940b46b12101074211216c920d4c7db40af', class: "icon" }, h("tooltip-component", { key: '8f98c2efd0ebe318854857bcb5a0d56794f5d454' }, h("info-icon", { key: 'e35b77bdd317ff9f25e0c1157acfe734ea81541f', slot: "tooltip-icon" }), h("span", { key: '4fb700e4030ae345e872f2da8352ca00078b57a6', slot: "tooltip-content" }, "Select your timezone for displaying availability.")))), h("select-dropdown", { key: '78270f32b150107baf43fbd7b2a882221ecf33f6', name: "timezone", exportparts: "sd_dropdown: nap__timezone-container, sd_dropdown-button: nap__timezone-button, sd_dropdown-content: nap__timezone-dropdown-content", options: timezoneOptions, defaultSelectedOption: timezoneOptions.find(i => i.value === this.defaultTimezone) }, h("span", { key: '8c76fd5d2396e75a07a2b922d9b44a27a6b4baf0', slot: "select-icon" }, h("globe-icon", { key: '885b683dd6496ed199d576d6a8139609b04ad661', width: "20", height: "20" })))), h("div", { key: 'e6541508d6d99ab9ba7b752c5eb14be33bd517d9', class: "availability", part: "nap__availability" }, Object.keys(this.schedule).map(key => {
307
+ return (h(Host, { key: 'ebdf308b5d2e38cbbe9c01915a8704cdc137b56f' }, h("div", { key: '81557accec232465b3e86d5d0bdc1ae25aa8d6de', class: "nylas-availability-picker" }, h("div", { key: 'f5c2a5ef92fc59568672b536a9e604547561b8d6', class: "header", part: "nap__header" }, h("h3", { key: 'cbccae32847e68a5fe47f9f1f901e55546621c36' }, "General availability"), h("p", { key: '34600ddd459b5d681574458f4f4acdb5ed26f7ac' }, "Set your availability for scheduling meetings.")), h("div", { key: '65785316b94376cf4d79de9c875e39060226ca31', class: "content" }, h("div", { key: '5c30c0bd916460f668dc3f881b4b01a1792e59b0', class: "select-timezone", part: "nap__select-timezone" }, h("h4", { key: '0638898cae070a5d9eae8cd1dca83e39e5bb735f', class: "sub-header" }, "Select timezone", h("span", { key: 'd6746b3329ba92bf5c759895444d08924ba7769c', class: "icon" }, h("tooltip-component", { key: '76dbc460bd91fa0f33a65c65ce092ad966ce6535' }, h("info-icon", { key: '5778fb41c006172a125a4430186ad85d4cdbaf3c', slot: "tooltip-icon" }), h("span", { key: '76132f33db5dce9d7d7e5e111065ad9d1ec64d3f', slot: "tooltip-content" }, "Select your timezone for displaying availability.")))), h("select-dropdown", { key: '9a0a3702b4868109ccc8f77e1143727de1e3f1fa', name: "timezone", exportparts: "sd_dropdown: nap__timezone-container, sd_dropdown-button: nap__timezone-button, sd_dropdown-content: nap__timezone-dropdown-content", options: timezoneOptions, defaultSelectedOption: timezoneOptions.find(i => i.value === this.defaultTimezone) }, h("span", { key: 'ed0756090602c8a52ffdae493f09cfa7d61dd1e9', slot: "select-icon" }, h("globe-icon", { key: '6e5e5234210ba8cc50ef57338a2f4e926521cb70', width: "20", height: "20" })))), h("div", { key: 'eac4322bf2aa8f5ea84e4d7ccee293803c70b2ac', class: "availability", part: "nap__availability" }, Object.keys(this.schedule).map(key => {
301
308
  const day = key;
302
309
  const timeRanges = this.schedule[key];
303
310
  return (h("div", { class: "availability-day" }, h("div", { class: "day", part: "nap__day" }, h("input", { type: "checkbox", name: day, id: day, checked: timeRanges.length > 0, onClick: () => {
@@ -312,7 +319,7 @@ const NylasAvailabilityPicker = class {
312
319
  timeRanges.map((timeRange, timeRangeIndex) => {
313
320
  const startKey = `${key}:${timeRangeIndex}_start`;
314
321
  const endKey = `${key}:${timeRangeIndex}_end`;
315
- return (h("div", { class: "time-range", part: "nap__time-range" }, h("div", { class: "pickers" }, h("nylas-time-window-picker", { id: startKey, hasError: this.overlapDays[day]?.includes(timeRangeIndex), time: timeRange.start, name: startKey, key: startKey, exportparts: "time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times", setTime: (event, additionalData) => this.setTime(startKey, event, additionalData), setFormError: (event, additionalData) => this.setFormError(startKey, event, additionalData) }), h("span", null, " - "), h("nylas-time-window-picker", { id: endKey, hasError: this.overlapDays[day]?.includes(timeRangeIndex), time: timeRange.end, name: endKey, key: endKey, minimumStartTime: timeRange.start, exportparts: "time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times", setTime: (event, additionalData) => this.setTime(endKey, event, additionalData), setFormError: (event, additionalData) => this.setFormError(endKey, event, additionalData) })), h("button", { onClick: () => this.removeTimeRange(day, timeRangeIndex) }, h("close-icon", null))));
322
+ return (h("div", { class: "time-range", part: "nap__time-range" }, h("div", { class: "pickers" }, h("nylas-time-window-picker", { id: startKey, hasError: this.overlapDays[day]?.includes(timeRangeIndex), time: timeRange.start, name: startKey, key: startKey, exportparts: "time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times" }), h("span", null, " - "), h("nylas-time-window-picker", { id: endKey, hasError: this.overlapDays[day]?.includes(timeRangeIndex), time: timeRange.end, name: endKey, key: endKey, minimumStartTime: timeRange.start, exportparts: "time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times" })), h("button", { onClick: () => this.removeTimeRange(day, timeRangeIndex) }, h("close-icon", null))));
316
323
  }), h("p", { class: "error" }, this.overlapDays[day] ? 'Overlapping time ranges' : '')), h("div", null, timeRanges.length > 0 ? (h("button", { onClick: () => this.addTimeRange(day), part: "nap__add-time-range" }, h("add-circle-icon", null))) : null)));
317
324
  }))))));
318
325
  }
@@ -1 +1 @@
1
- {"file":"nylas-availability-picker.entry.js","mappings":";;;;;;AAAA,MAAM,0BAA0B,GAAG,m/IAAm/I;;;;;;;;;;;;;;;;MC8CzgJ,uBAAuB;;;;;;;;;;;;;oBAIX,cAAc;+BACH,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;wBAiB9D;YAClB,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,EAAE;SACR;wBAC2B,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;2BACxB,EAAE;;IAQtD,yBAAyB,CAAC,QAAgB;QACxC,KAAK,CAAC,uBAAuB,EAAE,2BAA2B,EAAE,QAAQ,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KAC1C;IAGD,oBAAoB,CAAC,SAAwB;QAC3C,MAAM,oBAAoB,GAAG,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;QAChF,IAAI,oBAAoB,IAAI,oB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I,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,GACzF,CACE,EACN,cAAQ,OAAO,EAAE,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,cAAc,CAAC,IAC9D,qBAAc,CACP,CACL,EACN;iBACH,CAAC,EACJ,SAAG,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,yBAAyB,GAAG,EAAE,CAAK,CACzE,EACN,eACG,UAAU,CAAC,MAAM,GAAG,CAAC,IACpB,cAAQ,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,qBAAqB,IACvE,0BAAmB,CACZ,IACP,IAAI,CACJ,CACF,EACN;SACH,CAAC,CACE,CACF,CACF,CACD,EACP;KACH;;;;;;;;;AAnHD;IALC,iBAAiB,CAA6G;QAC7H,IAAI,EAAE,2BAA2B;QACjC,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;qDAoHD;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.scss?tag=nylas-availability-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-availability-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .content {\n padding: 1rem;\n color: var(--nylas-base-900);\n font-size: 16px;\n font-family: var(--nylas-font-family);\n @media #{$small-mobile} {\n font-size: 15px;\n }\n .select-timezone {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid var(--nylas-base-200);\n padding-bottom: 1rem;\n gap: 1rem;\n h4 {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n margin: 0;\n font-size: 16px;\n @media #{$small-mobile} {\n font-size: 15px;\n }\n font-weight: 500;\n line-height: 20px;\n }\n select-dropdown {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n }\n }\n .availability {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n padding: 0 0.5rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n padding: 0;\n }\n margin: 1rem 0;\n .availability-day {\n display: grid;\n grid-template-columns: minmax(auto, 65px) 1fr minmax(auto, 40px);\n @media #{$mobile} {\n grid-template-columns: 78px 1fr auto;\n }\n @media #{$small-mobile} {\n display: inline-grid;\n gap: 8px;\n grid-template-columns: 60px 1fr auto;\n }\n gap: 1rem;\n align-items: baseline;\n .day {\n display: flex;\n gap: 0.5rem;\n @media #{$small-mobile} {\n gap: 0.25rem;\n }\n align-items: center;\n\n input[type='checkbox'] {\n transform: scale(1.3);\n }\n }\n .time-ranges {\n span.unavailable {\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .time-range {\n display: flex;\n gap: 1.5rem;\n justify-content: space-between;\n align-items: baseline;\n @media #{$small-mobile} {\n justify-content: unset;\n gap: 0.5rem;\n }\n .pickers {\n display: flex;\n gap: 1rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n }\n span {\n margin-top: 0.75rem;\n }\n }\n &:not(:last-of-type) {\n margin-bottom: 1rem;\n }\n }\n p.error {\n color: var(--nylas-error);\n }\n }\n button {\n border: none;\n background: transparent;\n height: 40px;\n cursor: pointer;\n color: var(--nylas-base-800);\n &:hover,\n &:active {\n color: var(--nylas-primary);\n }\n }\n }\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { convertTo12HourFormat, convertTo24HourFormat, debug, minutesToTime, timeToMinutes } from '@/utils/utils';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { TIMEZONE_MAP } from '@/common/constants';\nimport { Configuration } from '@nylas/core';\n\ntype OpenHours = {\n days: number[];\n start: string;\n end: string;\n timezone: string;\n};\n\ntype Schedule = {\n SUN: { start: string; end: string }[];\n MON: { start: string; end: string }[];\n TUE: { start: string; end: string }[];\n WED: { start: string; end: string }[];\n THU: { start: string; end: string }[];\n FRI: { start: string; end: string }[];\n SAT: { start: string; end: string }[];\n};\n\n/**\n * The `nylas-availability-picker` component is a form input for selecting availability (open hours).\n * @part nap__header - The header of the availability picker\n * @part nap__select-timezone - The timezone selection container\n * @part nap__select-timezone-button - The timezone selection button\n * @part nap__select-timezone-dropdown-content - The timezone selection dropdown content\n * @part nap__availability - The availability container\n * @part nap__day - The day container\n * @part nap__time-ranges - The time ranges container\n * @part nap__time-range - The time range container\n * @part nap__add-time-range - The add time range button\n * @part nap__time-picker-container - The time picker container\n * @part nap__time-picker-input - The time picker input\n * @part nap__time-picker-times - The time picker times\n */\n@Component({\n tag: 'nylas-availability-picker',\n styleUrl: 'nylas-availability-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasAvailabilityPicker {\n @Element() host!: HTMLNylasAvailabilityPickerElement;\n @Prop() selectedConfiguration?: Configuration;\n @Prop() openHours?: OpenHours[];\n @Prop() name: string = 'availability';\n @Prop() defaultTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * This event is fired when the selected availability / open hours change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: {\n openHours: OpenHours[];\n timezone: string;\n };\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n @State() schedule = {\n SUN: [],\n MON: [{ start: '09:00am', end: '05:00pm' }],\n TUE: [{ start: '09:00am', end: '05:00pm' }],\n WED: [{ start: '09:00am', end: '05:00pm' }],\n THU: [{ start: '09:00am', end: '05:00pm' }],\n FRI: [{ start: '09:00am', end: '05:00pm' }],\n SAT: [],\n };\n @State() timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n @State() overlapDays: { [key: string]: number[] } = {};\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n configChangedHandler(newConfig: Configuration) {\n const organizerParticipant = newConfig?.participants?.find(p => p.is_organizer);\n if (organizerParticipant && organizerParticipant?.availability?.open_hours) {\n this.openHoursToSchedule(organizerParticipant?.availability?.open_hours);\n }\n }\n\n @Watch('schedule')\n scheduleChanged(newValue: Schedule, oldValue: Schedule) {\n if (newValue !== oldValue) {\n this.valueChanged.emit({\n value: {\n openHours: this.scheduleToOpenHours(newValue),\n timezone: this.timezone,\n },\n name: this.name,\n });\n let overlapDays: { [key: string]: number[] } = {};\n Object.keys(newValue).forEach(key => {\n const dayTimeRanges = newValue[key];\n if (dayTimeRanges.length > 0) {\n const overlaps = this.getOverlaps(dayTimeRanges);\n if (overlaps.length > 0) {\n overlapDays[key] = overlaps;\n }\n }\n });\n this.overlapDays = overlapDays;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n if (Object.keys(overlapDays).length > 0) {\n const element = this.host.shadowRoot?.getElementById(Object.keys(overlapDays)[0]) as HTMLInputElement;\n if (element) {\n this.internals.setValidity({ customError: true }, 'Overlapping time ranges found', element);\n }\n } else {\n this.internals.setValidity({ customError: false });\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(\n event: CustomEvent<{\n value: string;\n name: string;\n }>,\n ) {\n const { name, value } = event.detail;\n if (name === 'timezone') {\n this.timezone = value;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n\n connectedCallback() {\n debug('nylas-availability-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-availability-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-availability-picker', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-availability-picker', 'componentDidLoad');\n if (this.openHours && this.openHours.length > 0) {\n this.openHoursToSchedule(this.openHours);\n }\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n\n getOverlaps(timeRanges) {\n // Convert times to minutes and add to the array\n let timeRangesInMinutes = timeRanges.map((range, index) => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n originalIndex: index,\n }));\n\n // Sort by start time\n timeRangesInMinutes.sort((a, b) => a.start - b.start);\n let overlaps: number[] = [];\n // Check for overlap\n for (let i = 1; i < timeRangesInMinutes.length; i++) {\n if (timeRangesInMinutes[i].start < timeRangesInMinutes[i - 1].end) {\n // Add both overlapping time range indices if they are not already included\n if (!overlaps.includes(timeRangesInMinutes[i].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i].originalIndex);\n }\n if (!overlaps.includes(timeRangesInMinutes[i - 1].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i - 1].originalIndex);\n }\n }\n }\n return overlaps.sort((a, b) => a - b); // Return sorted list of indices\n }\n\n addTimeRange(day) {\n const currentTimeRanges = this.schedule[day];\n\n // Default working hours are from 00:00 to 23:45 for calculation purposes\n const dayStart = 0; // Start of the day in minutes (00:00)\n const dayEnd = 1425; // End of the day in minutes (23:45)\n\n if (currentTimeRanges.length === 0) {\n // If there are no existing time ranges, add one at the start of the day\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }]; // Example range\n } else {\n // Convert all time ranges to minutes for comparison\n const timeRangesInMinutes = currentTimeRanges\n .map(range => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n }))\n .sort((a, b) => a.start - b.start); // Sort by start time\n\n // Attempt to add a new time range at the end of the day\n const lastRangeEnd = timeRangesInMinutes[timeRangesInMinutes.length - 1].end;\n if (lastRangeEnd + 60 <= dayEnd) {\n // There's room at the end of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(lastRangeEnd)),\n end: convertTo12HourFormat(minutesToTime(lastRangeEnd + 60)),\n });\n } else {\n // No room at the end, look for gaps at the beginning of the day\n let gapFound = false;\n if (timeRangesInMinutes[0].start > dayStart + 60) {\n // There's room for at least a 1-hour meeting at the beginning of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(dayStart)),\n end: convertTo12HourFormat(minutesToTime(dayStart + 60)),\n });\n gapFound = true;\n }\n\n if (!gapFound) {\n // Search for gaps between scheduled time ranges\n for (let i = 0; i < timeRangesInMinutes.length - 1; i++) {\n const currentEnd = timeRangesInMinutes[i].end;\n const nextStart = timeRangesInMinutes[i + 1].start;\n\n if (nextStart - currentEnd >= 60) {\n // Found a gap\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(currentEnd)),\n end: convertTo12HourFormat(minutesToTime(currentEnd + 60)),\n });\n break; // Exit the loop after adding a time range\n }\n }\n }\n }\n }\n\n // Sort the updated schedule to maintain order\n this.schedule[day].sort((a, b) => timeToMinutes(a.start) - timeToMinutes(b.start));\n\n this.schedule = { ...this.schedule };\n }\n\n removeTimeRange(day, index) {\n this.schedule[day].splice(index, 1);\n this.schedule = { ...this.schedule };\n }\n\n setTime(key: string, _event: Event, value: string) {\n const [dayIndex, timeType] = key.split('_');\n const [day, index] = dayIndex.split(':');\n\n if (timeType === 'start') {\n this.schedule[day][index].start = value;\n } else if (timeType === 'end') {\n this.schedule[day][index].end = value;\n }\n this.internals.setValidity({ customError: false });\n this.schedule = { ...this.schedule };\n }\n\n setFormError(key: string, _event: Event, _errorMessage: string) {\n const [_, timeType] = key.split('_');\n const element = this.host.shadowRoot?.getElementById(key);\n if (element) {\n this.internals.setValidity({ customError: true }, `Invalid ${timeType} time`, element as HTMLInputElement);\n }\n }\n\n openHoursToSchedule(openHours: OpenHours[]) {\n const newSchedule = {\n SUN: [],\n MON: [],\n TUE: [],\n WED: [],\n THU: [],\n FRI: [],\n SAT: [],\n };\n openHours.forEach(openHour => {\n openHour.days.forEach(day => {\n const dayKey = this.getDayKey(day);\n const start12hr = convertTo12HourFormat(openHour.start);\n const end12hr = convertTo12HourFormat(openHour.end);\n const timeRange = { start: start12hr, end: end12hr };\n\n // Check if the time range already exists for the day\n let timeRangeExists = false;\n if (newSchedule[dayKey]) {\n // Search for an existing time range that matches the current one\n timeRangeExists = newSchedule[dayKey].some(range => range.start === timeRange.start && range.end === timeRange.end);\n }\n\n if (!timeRangeExists) {\n if (newSchedule[dayKey]) {\n newSchedule[dayKey].push(timeRange);\n } else {\n newSchedule[dayKey] = [timeRange];\n }\n }\n });\n });\n\n this.timezone = this.defaultTimezone;\n this.schedule = newSchedule;\n }\n\n getDayKey(dayIndex: number): string {\n const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n return days[dayIndex];\n }\n\n scheduleToOpenHours(schedule: Schedule): OpenHours[] {\n const dayKeys = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n let openHoursMap: Map<string, { days: number[]; start: string; end: string }> = new Map();\n\n dayKeys.forEach((dayKey, index) => {\n if (schedule[dayKey]) {\n // Check if schedule for the day exists\n schedule[dayKey].forEach(timeRange => {\n const start24hr = convertTo24HourFormat(timeRange.start);\n const end24hr = convertTo24HourFormat(timeRange.end);\n const key = `${start24hr}-${end24hr}`;\n\n if (!openHoursMap.has(key)) {\n openHoursMap.set(key, { days: [index], start: start24hr, end: end24hr });\n } else {\n let entry = openHoursMap.get(key);\n if (entry) {\n entry.days.push(index);\n openHoursMap.set(key, entry);\n }\n }\n });\n }\n });\n\n let selectedOpenHours: OpenHours[] = [];\n openHoursMap.forEach((value, _key) => {\n selectedOpenHours.push({\n days: value.days,\n start: value.start,\n end: value.end,\n timezone: this.timezone,\n });\n });\n\n return selectedOpenHours;\n }\n\n @RegisterComponent<NylasAvailabilityPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-availability-picker',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n fireRegisterEvent: true,\n })\n render() {\n const timezoneOptions = Object.keys(TIMEZONE_MAP).map(key => ({\n label: TIMEZONE_MAP[key],\n value: key,\n }));\n\n return (\n <Host>\n <div class=\"nylas-availability-picker\">\n <div class=\"header\" part=\"nap__header\">\n <h3>General availability</h3>\n <p>Set your availability for scheduling meetings.</p>\n </div>\n <div class=\"content\">\n <div class=\"select-timezone\" part=\"nap__select-timezone\">\n <h4 class=\"sub-header\">\n Select timezone\n <span class=\"icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">Select your timezone for displaying availability.</span>\n </tooltip-component>\n </span>\n </h4>\n <select-dropdown\n name=\"timezone\"\n exportparts=\"sd_dropdown: nap__timezone-container, sd_dropdown-button: nap__timezone-button, sd_dropdown-content: nap__timezone-dropdown-content\"\n options={timezoneOptions}\n defaultSelectedOption={timezoneOptions.find(i => i.value === this.defaultTimezone)}\n >\n <span slot=\"select-icon\">\n <globe-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n <div class=\"availability\" part=\"nap__availability\">\n {Object.keys(this.schedule).map(key => {\n const day = key;\n const timeRanges = this.schedule[key] as { start: string; end: string }[];\n return (\n <div class=\"availability-day\">\n <div class=\"day\" part=\"nap__day\">\n <input\n type=\"checkbox\"\n name={day}\n id={day}\n checked={timeRanges.length > 0}\n onClick={() => {\n if (timeRanges.length > 0) {\n this.schedule[day] = [];\n } else {\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }];\n }\n this.schedule = { ...this.schedule };\n }}\n />\n <label htmlFor={day} aria-label=\"Select day\">\n {day}\n </label>\n </div>\n <div class=\"time-ranges\" part=\"nap__time-ranges\">\n {timeRanges.length ? null : <span class=\"unavailable\">Unavailable</span>}\n {timeRanges.length > 0 &&\n timeRanges.map((timeRange, timeRangeIndex) => {\n const startKey = `${key}:${timeRangeIndex}_start`;\n const endKey = `${key}:${timeRangeIndex}_end`;\n return (\n <div class=\"time-range\" part=\"nap__time-range\">\n <div class=\"pickers\">\n <nylas-time-window-picker\n id={startKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.start}\n name={startKey}\n key={startKey}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n setTime={(event, additionalData) => this.setTime(startKey, event, additionalData)}\n setFormError={(event, additionalData) => this.setFormError(startKey, event, additionalData)}\n />\n <span> - </span>\n <nylas-time-window-picker\n id={endKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.end}\n name={endKey}\n key={endKey}\n minimumStartTime={timeRange.start}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n setTime={(event, additionalData) => this.setTime(endKey, event, additionalData)}\n setFormError={(event, additionalData) => this.setFormError(endKey, event, additionalData)}\n />\n </div>\n <button onClick={() => this.removeTimeRange(day, timeRangeIndex)}>\n <close-icon />\n </button>\n </div>\n );\n })}\n <p class=\"error\">{this.overlapDays[day] ? 'Overlapping time ranges' : ''}</p>\n </div>\n <div>\n {timeRanges.length > 0 ? (\n <button onClick={() => this.addTimeRange(day)} part=\"nap__add-time-range\">\n <add-circle-icon />\n </button>\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"nylas-availability-picker.entry.js","mappings":";;;;;;AAAA,MAAM,0BAA0B,GAAG,m/IAAm/I;;;;;;;;;;;;;;;;MC8CzgJ,uBAAuB;;;;;;;;;;;;;oBAgBX,cAAc;+BAIH,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;wBAiB9D;YAClB,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3C,GAAG,EAAE,EAAE;SACR;wBAI2B,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;2BAIxB,EAAE;;IAQtD,yBAAyB,CAAC,QAAgB;QACxC,KAAK,CAAC,uBAAuB,EAAE,2BAA2B,EAAE,QAAQ,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KAC1C;IAGD,oB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,OAAO,EAAE,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,cAAc,CAAC,IAC9D,qBAAc,CACP,CACL,EACN;iBACH,CAAC,EACJ,SAAG,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,yBAAyB,GAAG,EAAE,CAAK,CACzE,EACN,eACG,UAAU,CAAC,MAAM,GAAG,CAAC,IACpB,cAAQ,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,qBAAqB,IACvE,0BAAmB,CACZ,IACP,IAAI,CACJ,CACF,EACN;SACH,CAAC,CACE,CACF,CACF,CACD,EACP;KACH;;;;;;;;;AAnHD;IALC,iBAAiB,CAA6G;QAC7H,IAAI,EAAE,2BAA2B;QACjC,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;qDAoHD;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.scss?tag=nylas-availability-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-availability-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .content {\n padding: 1rem;\n color: var(--nylas-base-900);\n font-size: 16px;\n font-family: var(--nylas-font-family);\n @media #{$small-mobile} {\n font-size: 15px;\n }\n .select-timezone {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid var(--nylas-base-200);\n padding-bottom: 1rem;\n gap: 1rem;\n h4 {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n margin: 0;\n font-size: 16px;\n @media #{$small-mobile} {\n font-size: 15px;\n }\n font-weight: 500;\n line-height: 20px;\n }\n select-dropdown {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n }\n }\n .availability {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n padding: 0 0.5rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n padding: 0;\n }\n margin: 1rem 0;\n .availability-day {\n display: grid;\n grid-template-columns: minmax(auto, 65px) 1fr minmax(auto, 40px);\n @media #{$mobile} {\n grid-template-columns: 78px 1fr auto;\n }\n @media #{$small-mobile} {\n display: inline-grid;\n gap: 8px;\n grid-template-columns: 60px 1fr auto;\n }\n gap: 1rem;\n align-items: baseline;\n .day {\n display: flex;\n gap: 0.5rem;\n @media #{$small-mobile} {\n gap: 0.25rem;\n }\n align-items: center;\n\n input[type='checkbox'] {\n transform: scale(1.3);\n }\n }\n .time-ranges {\n span.unavailable {\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .time-range {\n display: flex;\n gap: 1.5rem;\n justify-content: space-between;\n align-items: baseline;\n @media #{$small-mobile} {\n justify-content: unset;\n gap: 0.5rem;\n }\n .pickers {\n display: flex;\n gap: 1rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n }\n span {\n margin-top: 0.75rem;\n }\n }\n &:not(:last-of-type) {\n margin-bottom: 1rem;\n }\n }\n p.error {\n color: var(--nylas-error);\n }\n }\n button {\n border: none;\n background: transparent;\n height: 40px;\n cursor: pointer;\n color: var(--nylas-base-800);\n &:hover,\n &:active {\n color: var(--nylas-primary);\n }\n }\n }\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { convertTo12HourFormat, convertTo24HourFormat, debug, minutesToTime, timeToMinutes } from '@/utils/utils';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { TIMEZONE_MAP } from '@/common/constants';\nimport { Configuration } from '@nylas/core';\n\nexport type OpenHours = {\n days: number[];\n start: string;\n end: string;\n timezone: string;\n};\n\nexport type Schedule = {\n SUN: { start: string; end: string }[];\n MON: { start: string; end: string }[];\n TUE: { start: string; end: string }[];\n WED: { start: string; end: string }[];\n THU: { start: string; end: string }[];\n FRI: { start: string; end: string }[];\n SAT: { start: string; end: string }[];\n};\n\n/**\n * The `nylas-availability-picker` component is a form input for selecting availability (open hours).\n * @part nap__header - The header of the availability picker\n * @part nap__select-timezone - The timezone selection container\n * @part nap__select-timezone-button - The timezone selection button\n * @part nap__select-timezone-dropdown-content - The timezone selection dropdown content\n * @part nap__availability - The availability container\n * @part nap__day - The day container\n * @part nap__time-ranges - The time ranges container\n * @part nap__time-range - The time range container\n * @part nap__add-time-range - The add time range button\n * @part nap__time-picker-container - The time picker container\n * @part nap__time-picker-input - The time picker input\n * @part nap__time-picker-times - The time picker times\n */\n@Component({\n tag: 'nylas-availability-picker',\n styleUrl: 'nylas-availability-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasAvailabilityPicker {\n /**\n * The element <nylas-availability-picker> itself.\n */\n @Element() host!: HTMLNylasAvailabilityPickerElement;\n /**\n * The selected configuration.\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * The open hours to display.\n */\n @Prop() openHours?: OpenHours[];\n /**\n * The name of the availability picker.\n */\n @Prop() name: string = 'availability';\n /*\n * The default timezone or preset timezone.\n */\n @Prop() defaultTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * This event is fired when the selected availability / open hours change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: {\n openHours: OpenHours[];\n timezone: string;\n };\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n @State() schedule = {\n SUN: [],\n MON: [{ start: '09:00am', end: '05:00pm' }],\n TUE: [{ start: '09:00am', end: '05:00pm' }],\n WED: [{ start: '09:00am', end: '05:00pm' }],\n THU: [{ start: '09:00am', end: '05:00pm' }],\n FRI: [{ start: '09:00am', end: '05:00pm' }],\n SAT: [],\n };\n /**\n * The selected timezone state.\n */\n @State() timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The overlapping time ranges state. This is used to display an error message when there are overlapping time ranges.\n */\n @State() overlapDays: { [key: string]: number[] } = {};\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n configChangedHandler(newConfig: Configuration) {\n const organizer = newConfig?.participants?.find(p => p.is_organizer);\n if (organizer && organizer?.availability?.open_hours) {\n this.openHoursToSchedule(organizer?.availability?.open_hours);\n }\n }\n\n @Watch('schedule')\n scheduleChanged(newValue: Schedule, oldValue: Schedule) {\n if (newValue !== oldValue) {\n this.valueChanged.emit({\n value: {\n openHours: this.scheduleToOpenHours(newValue),\n timezone: this.timezone,\n },\n name: this.name,\n });\n let overlapDays: { [key: string]: number[] } = {};\n Object.keys(newValue).forEach(key => {\n const dayTimeRanges = newValue[key];\n if (dayTimeRanges.length > 0) {\n const overlaps = this.getOverlaps(dayTimeRanges);\n if (overlaps.length > 0) {\n overlapDays[key] = overlaps;\n }\n }\n });\n this.overlapDays = overlapDays;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n if (Object.keys(overlapDays).length > 0) {\n const element = this.host.shadowRoot?.getElementById(Object.keys(overlapDays)[0]) as HTMLInputElement;\n if (element) {\n this.internals.setValidity({ customError: true }, 'Overlapping time ranges found', element);\n }\n } else {\n this.internals.setValidity({ customError: false });\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(\n event: CustomEvent<{\n value: string;\n name: string;\n }>,\n ) {\n const { name, value } = event.detail;\n if (name === 'timezone') {\n this.timezone = value;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n\n connectedCallback() {\n debug('nylas-availability-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-availability-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-availability-picker', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-availability-picker', 'componentDidLoad');\n if (this.openHours && this.openHours.length > 0) {\n this.openHoursToSchedule(this.openHours);\n }\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n\n getOverlaps(timeRanges) {\n // Convert times to minutes and add to the array\n let timeRangesInMinutes = timeRanges.map((range, index) => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n originalIndex: index,\n }));\n\n // Sort by start time\n timeRangesInMinutes.sort((a, b) => a.start - b.start);\n let overlaps: number[] = [];\n // Check for overlap\n for (let i = 1; i < timeRangesInMinutes.length; i++) {\n if (timeRangesInMinutes[i].start < timeRangesInMinutes[i - 1].end) {\n // Add both overlapping time range indices if they are not already included\n if (!overlaps.includes(timeRangesInMinutes[i].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i].originalIndex);\n }\n if (!overlaps.includes(timeRangesInMinutes[i - 1].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i - 1].originalIndex);\n }\n }\n }\n return overlaps.sort((a, b) => a - b); // Return sorted list of indices\n }\n\n addTimeRange(day) {\n const currentTimeRanges = this.schedule[day];\n\n // Default working hours are from 00:00 to 23:45 for calculation purposes\n const dayStart = 0; // Start of the day in minutes (00:00)\n const dayEnd = 1425; // End of the day in minutes (23:45)\n\n if (currentTimeRanges.length === 0) {\n // If there are no existing time ranges, add one at the start of the day\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }]; // Example range\n } else {\n // Convert all time ranges to minutes for comparison\n const timeRangesInMinutes = currentTimeRanges\n .map(range => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n }))\n .sort((a, b) => a.start - b.start); // Sort by start time\n\n // Attempt to add a new time range at the end of the day\n const lastRangeEnd = timeRangesInMinutes[timeRangesInMinutes.length - 1].end;\n if (lastRangeEnd + 60 <= dayEnd) {\n // There's room at the end of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(lastRangeEnd)),\n end: convertTo12HourFormat(minutesToTime(lastRangeEnd + 60)),\n });\n } else {\n // No room at the end, look for gaps at the beginning of the day\n let gapFound = false;\n if (timeRangesInMinutes[0].start > dayStart + 60) {\n // There's room for at least a 1-hour meeting at the beginning of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(dayStart)),\n end: convertTo12HourFormat(minutesToTime(dayStart + 60)),\n });\n gapFound = true;\n }\n\n if (!gapFound) {\n // Search for gaps between scheduled time ranges\n for (let i = 0; i < timeRangesInMinutes.length - 1; i++) {\n const currentEnd = timeRangesInMinutes[i].end;\n const nextStart = timeRangesInMinutes[i + 1].start;\n\n if (nextStart - currentEnd >= 60) {\n // Found a gap\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(currentEnd)),\n end: convertTo12HourFormat(minutesToTime(currentEnd + 60)),\n });\n break; // Exit the loop after adding a time range\n }\n }\n }\n }\n }\n\n // Sort the updated schedule to maintain order\n this.schedule[day].sort((a, b) => timeToMinutes(a.start) - timeToMinutes(b.start));\n\n this.schedule = { ...this.schedule };\n }\n\n removeTimeRange(day, index) {\n this.schedule[day].splice(index, 1);\n this.schedule = { ...this.schedule };\n }\n\n @Listen('timeChange')\n setTime(event: CustomEvent<{ key: string; value: string }>) {\n console.log('timeChanged', event);\n const { key, value } = event.detail;\n console.log({\n key,\n value,\n });\n const [dayIndex, timeType] = key.split('_');\n const [day, index] = dayIndex.split(':');\n\n if (timeType === 'start') {\n this.schedule[day][index].start = value;\n } else if (timeType === 'end') {\n this.schedule[day][index].end = value;\n }\n this.internals.setValidity({ customError: false });\n this.schedule = { ...this.schedule };\n }\n\n @Listen('formError')\n setFormError(event: CustomEvent<{ key: string; message: string }>) {\n const { key } = event.detail;\n const [_, timeType] = key.split('_');\n const element = this.host.shadowRoot?.getElementById(key);\n if (element) {\n this.internals.setValidity({ customError: true }, `Invalid ${timeType} time`, element as HTMLInputElement);\n }\n }\n\n openHoursToSchedule(openHours: OpenHours[]) {\n const newSchedule = {\n SUN: [],\n MON: [],\n TUE: [],\n WED: [],\n THU: [],\n FRI: [],\n SAT: [],\n };\n openHours.forEach(openHour => {\n openHour.days.forEach(day => {\n const dayKey = this.getDayKey(day);\n const start12hr = convertTo12HourFormat(openHour.start);\n const end12hr = convertTo12HourFormat(openHour.end);\n const timeRange = { start: start12hr, end: end12hr };\n\n // Check if the time range already exists for the day\n let timeRangeExists = false;\n if (newSchedule[dayKey]) {\n // Search for an existing time range that matches the current one\n timeRangeExists = newSchedule[dayKey].some(range => range.start === timeRange.start && range.end === timeRange.end);\n }\n\n if (!timeRangeExists) {\n if (newSchedule[dayKey]) {\n newSchedule[dayKey].push(timeRange);\n } else {\n newSchedule[dayKey] = [timeRange];\n }\n }\n });\n });\n\n this.timezone = this.defaultTimezone;\n this.schedule = newSchedule;\n }\n\n getDayKey(dayIndex: number): string {\n const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n return days[dayIndex];\n }\n\n scheduleToOpenHours(schedule: Schedule): OpenHours[] {\n const dayKeys = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n let openHoursMap: Map<string, { days: number[]; start: string; end: string }> = new Map();\n\n dayKeys.forEach((dayKey, index) => {\n if (schedule[dayKey]) {\n // Check if schedule for the day exists\n schedule[dayKey].forEach(timeRange => {\n const start24hr = convertTo24HourFormat(timeRange.start);\n const end24hr = convertTo24HourFormat(timeRange.end);\n const key = `${start24hr}-${end24hr}`;\n\n if (!openHoursMap.has(key)) {\n openHoursMap.set(key, { days: [index], start: start24hr, end: end24hr });\n } else {\n let entry = openHoursMap.get(key);\n if (entry) {\n entry.days.push(index);\n openHoursMap.set(key, entry);\n }\n }\n });\n }\n });\n\n let selectedOpenHours: OpenHours[] = [];\n openHoursMap.forEach((value, _key) => {\n selectedOpenHours.push({\n days: value.days,\n start: value.start,\n end: value.end,\n timezone: this.timezone,\n });\n });\n\n return selectedOpenHours;\n }\n\n @RegisterComponent<NylasAvailabilityPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-availability-picker',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n fireRegisterEvent: true,\n })\n render() {\n const timezoneOptions = Object.keys(TIMEZONE_MAP).map(key => ({\n label: TIMEZONE_MAP[key],\n value: key,\n }));\n\n return (\n <Host>\n <div class=\"nylas-availability-picker\">\n <div class=\"header\" part=\"nap__header\">\n <h3>General availability</h3>\n <p>Set your availability for scheduling meetings.</p>\n </div>\n <div class=\"content\">\n <div class=\"select-timezone\" part=\"nap__select-timezone\">\n <h4 class=\"sub-header\">\n Select timezone\n <span class=\"icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">Select your timezone for displaying availability.</span>\n </tooltip-component>\n </span>\n </h4>\n <select-dropdown\n name=\"timezone\"\n exportparts=\"sd_dropdown: nap__timezone-container, sd_dropdown-button: nap__timezone-button, sd_dropdown-content: nap__timezone-dropdown-content\"\n options={timezoneOptions}\n defaultSelectedOption={timezoneOptions.find(i => i.value === this.defaultTimezone)}\n >\n <span slot=\"select-icon\">\n <globe-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n <div class=\"availability\" part=\"nap__availability\">\n {Object.keys(this.schedule).map(key => {\n const day = key;\n const timeRanges = this.schedule[key] as { start: string; end: string }[];\n return (\n <div class=\"availability-day\">\n <div class=\"day\" part=\"nap__day\">\n <input\n type=\"checkbox\"\n name={day}\n id={day}\n checked={timeRanges.length > 0}\n onClick={() => {\n if (timeRanges.length > 0) {\n this.schedule[day] = [];\n } else {\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }];\n }\n this.schedule = { ...this.schedule };\n }}\n />\n <label htmlFor={day} aria-label=\"Select day\">\n {day}\n </label>\n </div>\n <div class=\"time-ranges\" part=\"nap__time-ranges\">\n {timeRanges.length ? null : <span class=\"unavailable\">Unavailable</span>}\n {timeRanges.length > 0 &&\n timeRanges.map((timeRange, timeRangeIndex) => {\n const startKey = `${key}:${timeRangeIndex}_start`;\n const endKey = `${key}:${timeRangeIndex}_end`;\n return (\n <div class=\"time-range\" part=\"nap__time-range\">\n <div class=\"pickers\">\n <nylas-time-window-picker\n id={startKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.start}\n name={startKey}\n key={startKey}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n // setTime={(event, additionalData) => this.setTime(startKey, event, additionalData)}\n // setFormError={(event, additionalData) => this.setFormError(startKey, event, additionalData)}\n />\n <span> - </span>\n <nylas-time-window-picker\n id={endKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.end}\n name={endKey}\n key={endKey}\n minimumStartTime={timeRange.start}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n // setTime={(event, additionalData) => this.setTime(endKey, event, additionalData)}\n // setFormError={(event, additionalData) => this.setFormError(endKey, event, additionalData)}\n />\n </div>\n <button onClick={() => this.removeTimeRange(day, timeRangeIndex)}>\n <close-icon />\n </button>\n </div>\n );\n })}\n <p class=\"error\">{this.overlapDays[day] ? 'Overlapping time ranges' : ''}</p>\n </div>\n <div>\n {timeRanges.length > 0 ? (\n <button onClick={() => this.addTimeRange(day)} part=\"nap__add-time-range\">\n <add-circle-icon />\n </button>\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -79,7 +79,7 @@ const NylasBookedEventCard = class {
79
79
  debug(`[nylas-booked-event-card] Component did load`);
80
80
  }
81
81
  render() {
82
- return (h(Host, { key: 'fd31424392865287d5a696d2ea4a0840974324c1', part: "nbec" }, h("sp-theme", { key: '5e4fab19061fd773200fc8856355d2efc6c7f767', theme: "spectrum", color: "dark", scale: "medium" }, h("div", { key: '5effb33fcc0492a2f968e5b29229a974fb1bf2a3', class: "booked-event-timezone" }, h("globe-icon", { key: '7be37ec8323f0c36112e4a8c5903c2078fe0ae0e' }), TIMEZONE_MAP[this.selectedTimezone]), h("div", { key: '594e1cffea71361c2a52f5ed3f480b7fc7a6c0f4', class: "event-card-wrapper", part: "nbec__card" }, h("div", { key: 'e2bcea8c2cd100f6291846d29524ee08a2c6d6ad', class: "calendar-icon" }, h("calendar-check-icon", { key: '412d634ebd082474581d8ceba417bcefb45d10eb' })), h("div", { key: '97f9f06776a64a9ceed5f8b7c84ed9d03983e083', class: "booked-event-header" }, h("h2", { key: '7453ad8f16ca9e477a5c6f7791dbf2aa89514394', slot: "card-title", part: "nbec__title" }, "Booking ", !!this.rescheduleBookingId ? 'rescheduled' : 'confirmed', "!"), h("div", { key: '5877c31296ad8821c822b8447a9adb495eea9756', part: "nbec__description" }, this.getOrganizer(this.eventInfo)?.name || this.getOrganizer(this.eventInfo)?.email, "\u00A0&\u00A0", this.bookingInfo?.primaryParticipant?.name || this.bookingInfo?.primaryParticipant?.email)), h("sp-divider", { key: '3845e25500160ac43e0c19af3c3c3c446caca39e' }), h("div", { key: '349d849d49be4e71264436c6add7039b889f8933', class: "booking-date-time" }, h("checkmark-circle-icon", { key: 'bccea293108ed90eece51494c79c8e5ae2db1411' }), h("h3", { key: 'ee98cd2b9c877a7e8342940892ff08be4ee647e0' }, "Booking date and time"), h("p", { key: '1efd072abb08a6606299911e594a07b2de396113' }, new Date(this.selectedTimeslot?.start_time).toLocaleDateString(undefined, { dateStyle: 'full' }), " ", h("br", { key: 'e014d22678d84c7541854985d945672efde047e9' }), new Date(this.selectedTimeslot?.start_time).toLocaleTimeString(undefined, { timeStyle: 'short' }), " -", ' ', new Date(this.selectedTimeslot?.end_time).toLocaleTimeString(undefined, { timeStyle: 'short' }))), h("div", { key: '0870d9969b572bf688c4c12de934066ed36f421a', class: "booking-participants" }), h("sp-divider", { key: '85674fadb92fc69826e738545a9f9bd1c478d522' }), h("div", { key: 'c60007a3d63af3cca707736386f7cbc1d2963626', class: "footer" }, h("sp-button", { key: 'f1295268e7f3341e37e7d66d460eabc28ad56482', variant: "secondary", treatment: "outline", class: "cancel", onClick: this.handleCancelBookingButtonClicked, part: "nbec__button-outline nbec__cancel-cta" }, "Cancel booking"), h("sp-button", { key: '276674ce1eb225cfb7ea95936e1cb05056b921cc', variant: "secondary", treatment: "outline", class: "reschedule", onClick: this.handleRescheduleButtonClicked, part: "nbec__button-outline nbec__reschedule-cta" }, "Reschedule"))))));
82
+ return (h(Host, { key: '5bd3216b60b7cdb86a44435706fb43b6a898e61c', part: "nbec" }, h("sp-theme", { key: 'f6059be8647e7340db11f12db85596b2493a3032', theme: "spectrum", color: "dark", scale: "medium" }, h("div", { key: '5f6cf3edb7b911c7c2c24d4ce82357298cc10108', class: "booked-event-timezone" }, h("globe-icon", { key: 'b23ca20aa43dc402a2071ed0019ff103f455e769' }), TIMEZONE_MAP[this.selectedTimezone]), h("div", { key: '664f226bd33a6ee1ee938ac76eca60085e822915', class: "event-card-wrapper", part: "nbec__card" }, h("div", { key: '0de5fccaf726cc6a6fb1917249ffcccbaf45190f', class: "calendar-icon" }, h("calendar-check-icon", { key: '94bbe15e7acddbc88916355337170a6753fa70b3' })), h("div", { key: 'f3876bccacb3a99e7c337aff930095884b3e6be3', class: "booked-event-header" }, h("h2", { key: 'da46d3cb4865421827cd7b3f499cae06ca09e365', slot: "card-title", part: "nbec__title" }, "Booking ", !!this.rescheduleBookingId ? 'rescheduled' : 'confirmed', "!"), h("div", { key: '57ed93864ee0cbdbf5755b0fe9a6b2803ca7a869', part: "nbec__description" }, this.getOrganizer(this.eventInfo)?.name || this.getOrganizer(this.eventInfo)?.email, "\u00A0&\u00A0", this.bookingInfo?.primaryParticipant?.name || this.bookingInfo?.primaryParticipant?.email)), h("sp-divider", { key: '4fab8afdbdc7e9a2b55e35779ff087a5497b0c3e' }), h("div", { key: '54ffc748a0da3bd9ae866137b600d0dc1da5eb5e', class: "booking-date-time" }, h("checkmark-circle-icon", { key: '674edd7058565b837a618089c653d20b8b8f08e7' }), h("h3", { key: '51f406b68b2e310e354e79703aea3efd14236d57' }, "Booking date and time"), h("p", { key: '404211c1b06bb80da3eb7274f4a41fba962ce0b9' }, new Date(this.selectedTimeslot?.start_time).toLocaleDateString(undefined, { dateStyle: 'full' }), " ", h("br", { key: '221f96d994e440affff5a347fbb9da5a2566ab29' }), new Date(this.selectedTimeslot?.start_time).toLocaleTimeString(undefined, { timeStyle: 'short' }), " -", ' ', new Date(this.selectedTimeslot?.end_time).toLocaleTimeString(undefined, { timeStyle: 'short' }))), h("div", { key: 'd333515e59086254d2484c5f55ad9b69a21bf0bb', class: "booking-participants" }), h("sp-divider", { key: 'f6ee5cd38d186d943a345f037357419f2af7e3c7' }), h("div", { key: 'c6eb21904c9db747ceb7a2daed88bf86057f4046', class: "footer" }, h("sp-button", { key: 'ee4a439cd71eb0c9c6a1a82be35698a3b027c6c5', variant: "secondary", treatment: "outline", class: "cancel", onClick: this.handleCancelBookingButtonClicked, part: "nbec__button-outline nbec__cancel-cta" }, "Cancel booking"), h("sp-button", { key: '36aa6cc83eb259f21098787e61d36c4a8ca5b3df', variant: "secondary", treatment: "outline", class: "reschedule", onClick: this.handleRescheduleButtonClicked, part: "nbec__button-outline nbec__reschedule-cta" }, "Reschedule"))))));
83
83
  }
84
84
  };
85
85
  __decorate([
@@ -80,7 +80,7 @@ const NylasBookedEventCard = class {
80
80
  debug(`[nylas-booked-event-card] Component did load`);
81
81
  }
82
82
  render() {
83
- return (h(Host, { key: 'fd31424392865287d5a696d2ea4a0840974324c1', part: "nbec" }, h("sp-theme", { key: '5e4fab19061fd773200fc8856355d2efc6c7f767', theme: "spectrum", color: "dark", scale: "medium" }, h("div", { key: '5effb33fcc0492a2f968e5b29229a974fb1bf2a3', class: "booked-event-timezone" }, h("globe-icon", { key: '7be37ec8323f0c36112e4a8c5903c2078fe0ae0e' }), TIMEZONE_MAP[this.selectedTimezone]), h("div", { key: '594e1cffea71361c2a52f5ed3f480b7fc7a6c0f4', class: "event-card-wrapper", part: "nbec__card" }, h("div", { key: 'e2bcea8c2cd100f6291846d29524ee08a2c6d6ad', class: "calendar-icon" }, h("calendar-check-icon", { key: '412d634ebd082474581d8ceba417bcefb45d10eb' })), h("div", { key: '97f9f06776a64a9ceed5f8b7c84ed9d03983e083', class: "booked-event-header" }, h("h2", { key: '7453ad8f16ca9e477a5c6f7791dbf2aa89514394', slot: "card-title", part: "nbec__title" }, "Booking ", !!this.rescheduleBookingId ? 'rescheduled' : 'confirmed', "!"), h("div", { key: '5877c31296ad8821c822b8447a9adb495eea9756', part: "nbec__description" }, this.getOrganizer(this.eventInfo)?.name || this.getOrganizer(this.eventInfo)?.email, "\u00A0&\u00A0", this.bookingInfo?.primaryParticipant?.name || this.bookingInfo?.primaryParticipant?.email)), h("sp-divider", { key: '3845e25500160ac43e0c19af3c3c3c446caca39e' }), h("div", { key: '349d849d49be4e71264436c6add7039b889f8933', class: "booking-date-time" }, h("checkmark-circle-icon", { key: 'bccea293108ed90eece51494c79c8e5ae2db1411' }), h("h3", { key: 'ee98cd2b9c877a7e8342940892ff08be4ee647e0' }, "Booking date and time"), h("p", { key: '1efd072abb08a6606299911e594a07b2de396113' }, new Date(this.selectedTimeslot?.start_time).toLocaleDateString(undefined, { dateStyle: 'full' }), " ", h("br", { key: 'e014d22678d84c7541854985d945672efde047e9' }), new Date(this.selectedTimeslot?.start_time).toLocaleTimeString(undefined, { timeStyle: 'short' }), " -", ' ', new Date(this.selectedTimeslot?.end_time).toLocaleTimeString(undefined, { timeStyle: 'short' }))), h("div", { key: '0870d9969b572bf688c4c12de934066ed36f421a', class: "booking-participants" }), h("sp-divider", { key: '85674fadb92fc69826e738545a9f9bd1c478d522' }), h("div", { key: 'c60007a3d63af3cca707736386f7cbc1d2963626', class: "footer" }, h("sp-button", { key: 'f1295268e7f3341e37e7d66d460eabc28ad56482', variant: "secondary", treatment: "outline", class: "cancel", onClick: this.handleCancelBookingButtonClicked, part: "nbec__button-outline nbec__cancel-cta" }, "Cancel booking"), h("sp-button", { key: '276674ce1eb225cfb7ea95936e1cb05056b921cc', variant: "secondary", treatment: "outline", class: "reschedule", onClick: this.handleRescheduleButtonClicked, part: "nbec__button-outline nbec__reschedule-cta" }, "Reschedule"))))));
83
+ return (h(Host, { key: '5bd3216b60b7cdb86a44435706fb43b6a898e61c', part: "nbec" }, h("sp-theme", { key: 'f6059be8647e7340db11f12db85596b2493a3032', theme: "spectrum", color: "dark", scale: "medium" }, h("div", { key: '5f6cf3edb7b911c7c2c24d4ce82357298cc10108', class: "booked-event-timezone" }, h("globe-icon", { key: 'b23ca20aa43dc402a2071ed0019ff103f455e769' }), TIMEZONE_MAP[this.selectedTimezone]), h("div", { key: '664f226bd33a6ee1ee938ac76eca60085e822915', class: "event-card-wrapper", part: "nbec__card" }, h("div", { key: '0de5fccaf726cc6a6fb1917249ffcccbaf45190f', class: "calendar-icon" }, h("calendar-check-icon", { key: '94bbe15e7acddbc88916355337170a6753fa70b3' })), h("div", { key: 'f3876bccacb3a99e7c337aff930095884b3e6be3', class: "booked-event-header" }, h("h2", { key: 'da46d3cb4865421827cd7b3f499cae06ca09e365', slot: "card-title", part: "nbec__title" }, "Booking ", !!this.rescheduleBookingId ? 'rescheduled' : 'confirmed', "!"), h("div", { key: '57ed93864ee0cbdbf5755b0fe9a6b2803ca7a869', part: "nbec__description" }, this.getOrganizer(this.eventInfo)?.name || this.getOrganizer(this.eventInfo)?.email, "\u00A0&\u00A0", this.bookingInfo?.primaryParticipant?.name || this.bookingInfo?.primaryParticipant?.email)), h("sp-divider", { key: '4fab8afdbdc7e9a2b55e35779ff087a5497b0c3e' }), h("div", { key: '54ffc748a0da3bd9ae866137b600d0dc1da5eb5e', class: "booking-date-time" }, h("checkmark-circle-icon", { key: '674edd7058565b837a618089c653d20b8b8f08e7' }), h("h3", { key: '51f406b68b2e310e354e79703aea3efd14236d57' }, "Booking date and time"), h("p", { key: '404211c1b06bb80da3eb7274f4a41fba962ce0b9' }, new Date(this.selectedTimeslot?.start_time).toLocaleDateString(undefined, { dateStyle: 'full' }), " ", h("br", { key: '221f96d994e440affff5a347fbb9da5a2566ab29' }), new Date(this.selectedTimeslot?.start_time).toLocaleTimeString(undefined, { timeStyle: 'short' }), " -", ' ', new Date(this.selectedTimeslot?.end_time).toLocaleTimeString(undefined, { timeStyle: 'short' }))), h("div", { key: 'd333515e59086254d2484c5f55ad9b69a21bf0bb', class: "booking-participants" }), h("sp-divider", { key: 'f6ee5cd38d186d943a345f037357419f2af7e3c7' }), h("div", { key: 'c6eb21904c9db747ceb7a2daed88bf86057f4046', class: "footer" }, h("sp-button", { key: 'ee4a439cd71eb0c9c6a1a82be35698a3b027c6c5', variant: "secondary", treatment: "outline", class: "cancel", onClick: this.handleCancelBookingButtonClicked, part: "nbec__button-outline nbec__cancel-cta" }, "Cancel booking"), h("sp-button", { key: '36aa6cc83eb259f21098787e61d36c4a8ca5b3df', variant: "secondary", treatment: "outline", class: "reschedule", onClick: this.handleRescheduleButtonClicked, part: "nbec__button-outline nbec__reschedule-cta" }, "Reschedule"))))));
84
84
  }
85
85
  };
86
86
  __decorate$7([
@@ -282,13 +282,13 @@ const NylasBookingForm = class {
282
282
  this.guestEmailErrors = { ...errors };
283
283
  }
284
284
  render() {
285
- return (h(Host, { key: '5a255277a21fa84d100bb53d13bb9dce0ce58e24' }, h("form", { key: '19b7aecb9223557f0ff9d4c062968c3242026f0c', onSubmit: e => this.bookButtonClickedHandler(e), noValidate: true }, h("div", { key: '49276b2a59934eeaeb38c06db6968f957b7b9bee', class: "nylas-booking-form" }, h("slot", { key: 'ee0a8c29c1fb6b7273d6a2d3c8cb88180f0e9dbf', name: "custom-booking-form" }, h("div", { key: '662e46f3a7925282f824547a069f52584b94d564', class: "input-wrapper" }, h("label", { key: 'a01c1903ee983e1555006ad14e75cd1b2c3036ff', htmlFor: "name", class: { 'input-label': true, 'error': !this.isNameValid }, part: "nbf__input-label" }, "Name ", h("span", { key: '4729d580bbf9d851c2ac8b686dc826c4e3e4616f', class: "required" }, "*")), h("input", { key: '51754a63345f1d0332a38f646dde6a8a998c8dee', id: "name", type: "text", placeholder: "Enter your name", value: this.name, class: {
285
+ return (h(Host, { key: '018357db1ce7dbbeb11ebc236b869a3baf246c69' }, h("form", { key: '5f26a98903372d4c587df1d1045bcb240c4ee7cd', onSubmit: e => this.bookButtonClickedHandler(e), noValidate: true }, h("div", { key: '4ad84c89bb19933cb5d8403939104c38705ddfba', class: "nylas-booking-form" }, h("slot", { key: 'c594f51e9d8cbd40e1d42f9aa86baae536a9c7e7', name: "custom-booking-form" }, h("div", { key: 'fe026c1562cb85c773e31cec8a0a3574b3515e0c', class: "input-wrapper" }, h("label", { key: '27ecf20858dd3133ec4914970f7148720bc603ed', htmlFor: "name", class: { 'input-label': true, 'error': !this.isNameValid }, part: "nbf__input-label" }, "Name ", h("span", { key: '4a39ea8d7aa693f860c17aa28b2130ae49f31a1c', class: "required" }, "*")), h("input", { key: '69fb70d74fe3b3cd883ca7fc0a9f174b6f81936a', id: "name", type: "text", placeholder: "Enter your name", value: this.name, class: {
286
286
  input: true,
287
287
  error: !this.isNameValid,
288
- }, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), h("p", { key: 'b8a6660e959a877421bdfffdb87279d8f09123b8', class: "help-text" }, this.validationError.name)), h("div", { key: 'e78a74e67abde7e61c1d3c555c234817770a4040', class: "input-wrapper" }, h("label", { key: 'd5507037f5c668f58e14031dba4276900ef5ed09', htmlFor: "email", class: { 'input-label': true, 'error': !this.isEmailValid }, part: "nbf__input-label" }, "Email ", h("span", { key: '514f00587069ac1cfc6d16bfd30750d6d501817d', class: "required" }, "*")), h("input", { key: '0b80ded98b2174f783fa9e7c951a47661aa894f6', id: "email", type: "email", placeholder: "Enter your email", value: this.email, class: {
288
+ }, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), h("p", { key: 'e4be03fd299cbc94713e5561fb9ed69a78af200c', class: "help-text" }, this.validationError.name)), h("div", { key: '017e724bfd408c5bde7714ae8b2a941d4a1194d9', class: "input-wrapper" }, h("label", { key: 'ed19f30d50d5d2ae95bcbf567b5c888b7906463d', htmlFor: "email", class: { 'input-label': true, 'error': !this.isEmailValid }, part: "nbf__input-label" }, "Email ", h("span", { key: '9b3ab493851edfcc407a38fad0994da171ac9976', class: "required" }, "*")), h("input", { key: '768690b3cc350537be1fa39cc7a295f688c1d91d', id: "email", type: "email", placeholder: "Enter your email", value: this.email, class: {
289
289
  input: true,
290
290
  error: !this.isEmailValid,
291
- }, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), h("p", { key: 'ba185ccb2bec87049e94d8c5f8d211a838de0025', class: "help-text" }, this.validationError.email)))), h("div", { key: '56e2cce79371533ad66cccad95a79dd8935fe3eb', class: "cta" }, h("sp-button", { key: '2b6410b3cf2b7634737aa858396290ad065dfcfc', treatment: "outline", variant: "secondary", class: 'back', part: "nbf__button-outline", onClick: this.handleBackButtonClicked }, h("slot", { key: '4ba60a2fb3542434ede16ea382ec4ca80cb8d422', name: "booking-form-back-label" }, "Back")), h("sp-button", { key: '49dd32531d7b55529bb73bc82eb0b91820c6ea33', variant: "primary", class: 'book', part: "nbf__button-primary", type: "submit" }, this.isLoading && h("loading-icon", { slot: "icon" }), h("slot", { key: 'a57ae44c1c3a1b020a110f0156435f27897410c6', name: "booking-form-book-label" }, "Book now"))))));
291
+ }, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), h("p", { key: '24a39d859e700d000a363fe8df2f000365542fb0', class: "help-text" }, this.validationError.email)))), h("div", { key: '40b4b99dcf471afb8079d49fb9a0efe6bb7e406c', class: "cta" }, h("sp-button", { key: 'ae6bc3f620953f355184c7aef3ce692c2509c81d', treatment: "outline", variant: "secondary", class: 'back', part: "nbf__button-outline", onClick: this.handleBackButtonClicked }, h("slot", { key: 'e5a10ff0978756f7c3f8751a7aca6e3281f5046b', name: "booking-form-back-label" }, "Back")), h("sp-button", { key: '3aa5fe99000d52ef64db4191950109caeb526878', variant: "primary", class: 'book', part: "nbf__button-primary", type: "submit" }, this.isLoading && h("loading-icon", { slot: "icon" }), h("slot", { key: '83c5332efd5eb82617dc0a0f5275950431d95c26', name: "booking-form-book-label" }, "Book now"))))));
292
292
  }
293
293
  get host() { return getElement(this); }
294
294
  static get watchers() { return {
@@ -642,7 +642,7 @@ const NylasDatePicker = class {
642
642
  return date && selectableDates?.find(d => isSameDay(d, date)) === undefined;
643
643
  }
644
644
  render() {
645
- return (h(Host, { key: 'fd7de67053417b11844a66e5b978f7feb80efe18', part: "ndp" }, h("div", { key: 'a08943851e2239ad12121b90f35760d73a085441', class: "nylas-date-picker" }, h("div", { key: '832ad38012c55eb04ab2c5b0ceb50052ab3edd42', class: 'header flex-row' }, h("h2", { key: '2df451227e57dfee081c1d4435443e479cf8871c', part: 'ndp__month-header' }, h("strong", { key: '63421dca4b9bf36207ba05e9eff795c7c198287c' }, this.month.toLocaleDateString(undefined, { month: 'long' })), "\u00A0", this.month.toLocaleDateString(undefined, { year: 'numeric' })), h("div", { key: 'ca982a82d87baf5658674624c1153f14e77470aa', class: 'pagination' }, h("button", { key: 'd2a41582014f92c23784c71fe1df9834d77fd355', onClick: () => this.changeMonth(-1), class: { 'chevron-left': true, 'button': true }, disabled: !this.selectableDates?.length || this.month <= new Date(), part: "ndp__month-button" }, h("chevron-icon", { key: '4f319da7e440236edb9bfa711fb0b05cd046dc8e' })), h("button", { key: 'ff00426293e1857592ebae58557ea46e5db9858d', onClick: () => this.changeMonth(1), class: { 'chevron-right': true, 'button': true }, disabled: !this.selectableDates?.length || this.disableNextMonthButton, part: "ndp__month-button" }, h("chevron-icon", { key: '7075f5e8da61c9d91fb612771a3d7672f1521b6f' })))), h("div", { key: '3ad884077d163de5182731c03bf856c9e204f411', class: 'dates' }, ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].map(day => {
645
+ return (h(Host, { key: 'd6122ec547ac33e6febfe41497a1bd3de1eeb6b3', part: "ndp" }, h("div", { key: 'cee58b509bf57156342c7506a020b64611f62209', class: "nylas-date-picker" }, h("div", { key: 'bb3a8356004b07fd86fb05961eb400215b824e3a', class: 'header flex-row' }, h("h2", { key: '681f87b531eaa6c26b99bb2616fd59cd388e6bd9', part: 'ndp__month-header' }, h("strong", { key: 'e93fb4feacb91042cbfa8bb65b0a196fafb343d2' }, this.month.toLocaleDateString(undefined, { month: 'long' })), "\u00A0", this.month.toLocaleDateString(undefined, { year: 'numeric' })), h("div", { key: 'fb4c4671c2cf24d4ae2ddf1077d0431a8a6261a8', class: 'pagination' }, h("button", { key: '6810b244baf594e6a9c69b2916704744a0d18f74', onClick: () => this.changeMonth(-1), class: { 'chevron-left': true, 'button': true }, disabled: !this.selectableDates?.length || this.month <= new Date(), part: "ndp__month-button" }, h("chevron-icon", { key: '8a14ef5e447da88e3c1c19b77f7d42454243dd4e' })), h("button", { key: 'aa6efd17b59da3308fec14032c64017849750702', onClick: () => this.changeMonth(1), class: { 'chevron-right': true, 'button': true }, disabled: !this.selectableDates?.length || this.disableNextMonthButton, part: "ndp__month-button" }, h("chevron-icon", { key: '3a1704b4c41d92ac54a6936e487402a98bba5de1' })))), h("div", { key: '85910baac9b8b411ebfede44c0a11bff2e489efe', class: 'dates' }, ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].map(day => {
646
646
  return (h("div", { class: 'day', part: "ndp__day" }, day));
647
647
  }), this.dates.map((date, i) => {
648
648
  const isDisabled = this.isDisabled(date, this.selectableDates);
@@ -751,13 +751,13 @@ const NylasLocaleSwitch = class {
751
751
  label: LANGUAGE_MAP[key],
752
752
  value: key,
753
753
  }));
754
- return (h(Host, { key: '688b90cbd1410a8025a8becfd3f979fc854c60a2' }, h("div", { key: 'a4f485ce6204d89e16336c93809dbcf5ebf862ef', class: "nylas-locale-switch" }, h("div", { key: '5525e493d2f8e3258a2fe8b4c739db49d7ef1a35', class: {
754
+ return (h(Host, { key: '9b59f6361d95bf132b22ff7d03edd20c58d81f9a' }, h("div", { key: 'f2ebeeaed33b6e750f71d23ca24aa2d1ad858a10', class: "nylas-locale-switch" }, h("div", { key: '3bb086e794c113b62d88b458f213beaeb28bf5c7', class: {
755
755
  'select-wrapper': true,
756
756
  'timezone': true,
757
- } }, h("select-dropdown", { key: '68f7f48a2cada4cc0c7327431f15384d17ebc261', name: "timezone", options: timezoneOptions, defaultSelectedOption: timezoneOptions.find(op => op.value == this.selectedTimezone) }, h("span", { key: 'd1213a8cba28b2163997cdb4bce7e13d7485e869', slot: "select-icon" }, h("globe-icon", { key: 'f11285b20c93a42a0f195f89966bc7ff7b2d7322', width: "20", height: "20" })))), h("div", { key: '0287627954a80ef5092ded694e61ec2a19606667', class: {
757
+ } }, h("select-dropdown", { key: '169822d4f1c58f795f0a9189c074699814a2790e', name: "timezone", options: timezoneOptions, defaultSelectedOption: timezoneOptions.find(op => op.value == this.selectedTimezone) }, h("span", { key: '54fd84316990a375e60291bc68406a2fd1a43f57', slot: "select-icon" }, h("globe-icon", { key: '2cd6a94baef61202b97411e10cb212b48ddd527a', width: "20", height: "20" })))), h("div", { key: '39e1a7f52109e87ebfcd41f5eb35146a21ab7911', class: {
758
758
  'select-wrapper': true,
759
759
  'language': true,
760
- } }, h("select-dropdown", { key: '1bd58884de605b22cb6a5631b8e9f960cfa058d4', name: "language", options: languageOptions, defaultSelectedOption: languageOptions.find(lang => lang.value == this.selectedLanguage) }, h("span", { key: '0681b6c8296d60c258c2df3bcb60d895c0e0c533', slot: "select-icon" }, h("translate-icon", { key: 'bd3f346f56da2a139c5050799c9e2774d311d72c', width: "20", height: "20" })))))));
760
+ } }, h("select-dropdown", { key: 'b803b2685efe46673d125b3d10714bafd48197c1', name: "language", options: languageOptions, defaultSelectedOption: languageOptions.find(lang => lang.value == this.selectedLanguage) }, h("span", { key: 'b8a7d37f9bd60a14f2652fd17d7572b2bd853ee7', slot: "select-icon" }, h("translate-icon", { key: 'b36f31c8ddec7a70fdce4154006fce11af4e3bb3', width: "20", height: "20" })))))));
761
761
  }
762
762
  };
763
763
  __decorate$2([
@@ -890,7 +890,7 @@ const NylasSelectedEventCard = class {
890
890
  this.endTime = new Date(selectedTimeslot?.end_time).toLocaleString(undefined, { timeStyle: 'short' });
891
891
  }
892
892
  render() {
893
- return (h(Host, { key: '1104fd2969ab03bb794c17bbf08f1600a200448c', part: "nsec" }, h("sp-theme", { key: '674934ecb54519d9e8c227a9946b9725518b77e5', theme: "spectrum", color: "dark", scale: "medium" }, h("div", { key: '4d492e825e93b93ff96af4970812178656de4ab8', class: "event-card", part: "nsec__card" }, h("div", { key: '239131412dab45da5b1f7bfe3b4a2eda45a2978b', class: "calendar-icon", part: "nsec__icon" }, h("calendar-icon", { key: 'a2fa2f47b94a2c331d4cac88ef736faef3e30dae' })), h("div", { key: '81c873d5c2019b6ae1d8b746685dbe5efc2d7d0b', class: "nylas-selected-event-card__date", part: "nsec__date" }, this.selectedDate?.toLocaleDateString(undefined, { dateStyle: 'full' })), h("div", { key: '67348e66fd879ead10594b216a2d66cf7da272aa', class: "nylas-selected-event-card__time", part: "nsec__time" }, this.startTime, " - ", this.endTime)), h("div", { key: '0fc6452dae7c5998a70d116c9bdfe25ab109661c', class: "event-timezone", part: "nsec__timezone" }, h("globe-icon", { key: '86c4a1e2728a30e34805a7c286378fe9adef110e' }), TIMEZONE_MAP[this.selectedTimezone]))));
893
+ return (h(Host, { key: 'c84565db48fc177fd6f8af71db7f9776516cf46f', part: "nsec" }, h("sp-theme", { key: '7de2e148c85b878e735ac6a69a62892110de9b65', theme: "spectrum", color: "dark", scale: "medium" }, h("div", { key: '0a9f43a55c68fdd7d93b42600b94e2f10d551dd4', class: "event-card", part: "nsec__card" }, h("div", { key: '18b16b39d4c3d7c1a0f9c16c084d99f1b9b9ff5b', class: "calendar-icon", part: "nsec__icon" }, h("calendar-icon", { key: '92202409a7e922975ab31216d8f68c3fb8767cbe' })), h("div", { key: '79006fdf073ed56acec50e1e11ddf101fcfca81c', class: "nylas-selected-event-card__date", part: "nsec__date" }, this.selectedDate?.toLocaleDateString(undefined, { dateStyle: 'full' })), h("div", { key: '1f605b2bc03f290b5a5b3ac858256f438ac33651', class: "nylas-selected-event-card__time", part: "nsec__time" }, this.startTime, " - ", this.endTime)), h("div", { key: '03f9f64e0229904519984305751c388886838b99', class: "event-timezone", part: "nsec__timezone" }, h("globe-icon", { key: '7bd33f03d96671423199113ee24fe913f78c1bca' }), TIMEZONE_MAP[this.selectedTimezone]))));
894
894
  }
895
895
  static get watchers() { return {
896
896
  "selectedTimeslot": ["handleSelectedTimeslotChange"]
@@ -1 +1 @@
1
- {"file":"nylas-booking-calendar-picker.entry.js","mappings":";;;;;AAAA,MAAM,6BAA6B,GAAG,0kGAA0kG;;;;;;;;;;;;;;;;MC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AAkB,EACvB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,KAAK,EACjB,WAAW,EAAC,qHAAqH,EACjI,qBAAqB,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,sBAAsB,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAClH,CACE,KAEN,WAAK,KAAK,EAAC,wCAAwC,IACjD,YAAM,KAAK,EAAC,OAAO,8CACqB,oBAAa,CAC9C,EACP,WAAK,KAAK,EAAC,gBAAgB,IACzB,6BAAuB,CACnB,CACF,CACP,CACG,CACD,EACP;KACH;;;;;;;AAjDD;IApBC,iBAAiB,CAAgH;QAChI,IAAI,EAAE,+BAA+B;QACrC,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,2BAA2B,EAAE,WAAW,CAAC;YAC1C,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;QACF,YAAY,EAAE;YACZ,YAAY,EAAE,OACZ,KAAiI,EACjI,8BAA6D;gBAE7D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;gBAEtC,IAAI,YAAY,EAAE;oBAChB,YAAY,CAAC,KAAK,CAAC,CAAC;iBACrB;aACF;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;wDAkDD;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.scss?tag=nylas-booking-calendar-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-booking-calendar-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 1rem;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .nylas-booking-calendar-picker__loading {\n padding-bottom: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n .label {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 1rem 1rem 0;\n color: var(--nylas-base-800);\n }\n .loading-button {\n margin: 0 1rem;\n padding: 0;\n width: inherit;\n height: 48px;\n color: black;\n font-size: 1rem;\n cursor: not-allowed;\n display: flex;\n gap: 0.5rem;\n justify-content: space-between;\n align-items: center;\n background: transparent;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n span {\n padding: 0 1rem;\n }\n }\n }\n .nylas-booking-calendar-picker__dropdown {\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n span.label {\n display: flex;\n align-items: center;\n gap: 4px;\n color: var(--nylas-base-800);\n tooltip-component {\n display: flex;\n }\n }\n select-dropdown::part(sd_dropdown) {\n width: 100%;\n }\n select-dropdown::part(sd_dropdown-content) {\n width: 100%;\n max-width: unset;\n }\n select-dropdown::part(sd_dropdown-button) {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 1rem;\n }\n select-dropdown::part(sd_dropdown-button-selected-label) {\n max-width: calc(100% - 2rem);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { Calendar } from '@nylas/core';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { User } from '@/common/nylas-api-request';\n\n/**\n * The `nylas-booking-calendar-picker` component is a UI component that displays the booking calendar picker.\n * @part nbcp - The booking calendar picker container\n * @part nbcp__header - The header of the booking calendar picker\n * @part nbcp__input-label - The input label of the booking calendar picker\n * @part nbcp__dropdown - The dropdown container\n * @part nbcp__dropdown-button - The dropdown button\n * @part nbcp__dropdown-content - The dropdown content\n */\n@Component({\n tag: 'nylas-booking-calendar-picker',\n styleUrl: 'nylas-booking-calendar-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasBookingCalendarPicker {\n @Element() host!: HTMLNylasCalendarPickerElement;\n /**\n * The calendars to choose from.\n */\n @Prop() calendars?: Calendar[];\n /**\n * The current logged in user.\n */\n @Prop() currentUser?: User;\n /**\n * The name of the calendar picker.\n */\n @Prop() name: string = 'booking-calendar';\n /**\n * The default selected calendars.\n */\n @Prop() defaultBookingCalendar: string = '';\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The selected calendars.\n */\n @State() selectedCalendar: string = '';\n\n /**\n * This event is fired when the selected calendars change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-booking-calendar-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-booking-calendar-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-booking-calendar-picker', 'componentWillLoad');\n // See comment in the @Watch('name') decorator for more information.\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-booking-calendar-picker', 'componentDidLoad');\n this.defaultBookingCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n\n // TODO: Remove this when the internals in tests are fixed.\n if (typeof this.internals.setFormValue === 'function') {\n this.internals.setFormValue(this.defaultBookingCalendar.toString(), 'booking-calendar');\n }\n this.selectedCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n }\n\n componentWillUpdate() {\n debug('nylas-booking-calendar-picker', 'componentWillUpdate');\n }\n\n componentDidUpdate() {\n debug('nylas-booking-calendar-picker', 'componentDidUpdate');\n }\n\n componentWillRender() {\n debug('nylas-booking-calendar-picker', 'componentWillRender');\n }\n\n componentDidRender() {\n debug('nylas-booking-calendar-picker', 'componentDidRender');\n }\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-booking-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-booking-calendar-picker', 'selectedOptionChangedHandler', event.detail);\n // Pass as handler so that if event.defaultPrevented by parent app, this will be skipped.\n const valueChanged = (event: CustomEvent<{ value: string; name: string }>) => {\n const { value } = event.detail;\n this.selectedCalendar = value;\n this.internals.setFormValue(value.toString(), this.name);\n };\n this.valueChanged.emit({ value: event.detail.value, name: this.name, valueChanged });\n }\n\n @RegisterComponent<NylasBookingCalendarPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-booking-calendar-picker',\n stateToProps: new Map([\n ['schedulerConfig.calendars', 'calendars'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {\n valueChanged: async (\n event: CustomEvent<{ value: string; name: string; valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void }>,\n _nylasSchedulerConfigConnector: NylasSchedulerConfigConnector,\n ) => {\n const { valueChanged } = event.detail;\n // If a handler is passed, call it.\n if (valueChanged) {\n valueChanged(event);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const calendarOptions =\n this.calendars?.map(calendar => {\n return {\n value: calendar.id,\n label: calendar.name,\n };\n }) ?? [];\n\n return (\n <Host>\n <div class=\"nylas-booking-calendar-picker\" part=\"nbcp\">\n <div class=\"header\" part=\"nbcp__header\">\n <h3>Calendar booking</h3>\n <p>Choose calendar where you’d like the event bookings to show up.</p>\n </div>\n\n {calendarOptions.length > 0 ? (\n <div class=\"nylas-booking-calendar-picker__dropdown\">\n <span class=\"label\" part=\"nbcp__input-label\">\n Select a calendar to book meetings on\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n Check availability across one or multiple calendars. If multiple calendars are selected, you must be available across all of them to be considered available.\n </span>\n </tooltip-component>\n </span>\n <select-dropdown\n name=\"booking-calendar\"\n options={calendarOptions}\n withSearch={false}\n exportparts=\"sd_dropdown: nbcp__dropdown, sd_dropdown-button: nbcp__dropdown-button, sd_dropdown-content: nbcp__dropdown-content\"\n defaultSelectedOption={calendarOptions.find(cal => cal.value == this.defaultBookingCalendar) ?? calendarOptions[0]}\n />\n </div>\n ) : (\n <div class=\"nylas-booking-calendar-picker__loading\">\n <span class=\"label\">\n Select a calendar to book meetings on <info-icon />\n </span>\n <div class=\"loading-button\">\n <span>Loading...</span>\n </div>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"nylas-booking-calendar-picker.entry.js","mappings":";;;;;AAAA,MAAM,6BAA6B,GAAG,0kGAA0kG;;;;;;;;;;;;;;;;MCuBnmG,0BAA0B;;;;;;;;;;;;;oBAad,kBAAkB;sCAIA,EAAE;gCASP,EAAE;;IAYtC,iBAAiB;QACf,KAAK,CAAC,+BAA+B,EAAE,mBAAmB,CAAC,CAAC;KAC7D;IAED,oBAAoB;QAClB,KAAK,CAAC,+BAA+B,EAAE,sBAAsB,CAAC,CAAC;KAChE;IAED,iBAAiB;QACf,KAAK,CAAC,+BAA+B,EAAE,mBAAmB,CAAC,CAAC;QAE5D,IAAI,CAAC,IAAI,CA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C,EACP,WAAK,KAAK,EAAC,gBAAgB,IACzB,6BAAuB,CACnB,CACF,CACP,CACG,CACD,EACP;KACH;;;;;;;AAjDD;IApBC,iBAAiB,CAAgH;QAChI,IAAI,EAAE,+BAA+B;QACrC,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,2BAA2B,EAAE,WAAW,CAAC;YAC1C,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;QACF,YAAY,EAAE;YACZ,YAAY,EAAE,OACZ,KAAiI,EACjI,8BAA6D;gBAE7D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;gBAEtC,IAAI,YAAY,EAAE;oBAChB,YAAY,CAAC,KAAK,CAAC,CAAC;iBACrB;aACF;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;wDAkDD;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.scss?tag=nylas-booking-calendar-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-booking-calendar-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 1rem;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .nylas-booking-calendar-picker__loading {\n padding-bottom: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n .label {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 1rem 1rem 0;\n color: var(--nylas-base-800);\n }\n .loading-button {\n margin: 0 1rem;\n padding: 0;\n width: inherit;\n height: 48px;\n color: black;\n font-size: 1rem;\n cursor: not-allowed;\n display: flex;\n gap: 0.5rem;\n justify-content: space-between;\n align-items: center;\n background: transparent;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n span {\n padding: 0 1rem;\n }\n }\n }\n .nylas-booking-calendar-picker__dropdown {\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n span.label {\n display: flex;\n align-items: center;\n gap: 4px;\n color: var(--nylas-base-800);\n tooltip-component {\n display: flex;\n }\n }\n select-dropdown::part(sd_dropdown) {\n width: 100%;\n }\n select-dropdown::part(sd_dropdown-content) {\n width: 100%;\n max-width: unset;\n }\n select-dropdown::part(sd_dropdown-button) {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 1rem;\n }\n select-dropdown::part(sd_dropdown-button-selected-label) {\n max-width: calc(100% - 2rem);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { Calendar } from '@nylas/core';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { User } from '@/common/nylas-api-request';\n\n/**\n * The `nylas-booking-calendar-picker` component is a UI component that displays the booking calendar picker.\n * @part nbcp - The booking calendar picker container\n * @part nbcp__header - The header of the booking calendar picker\n * @part nbcp__input-label - The input label of the booking calendar picker\n * @part nbcp__dropdown - The dropdown container\n * @part nbcp__dropdown-button - The dropdown button\n * @part nbcp__dropdown-content - The dropdown content\n */\n@Component({\n tag: 'nylas-booking-calendar-picker',\n styleUrl: 'nylas-booking-calendar-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasBookingCalendarPicker {\n @Element() host!: HTMLNylasCalendarPickerElement;\n /**\n * The calendars to choose from.\n */\n @Prop() calendars?: Calendar[];\n /**\n * The current logged in user.\n */\n @Prop() currentUser?: User;\n /**\n * The name of the calendar picker.\n */\n @Prop() name: string = 'booking-calendar';\n /**\n * The default selected calendar.\n */\n @Prop() defaultBookingCalendar: string = '';\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The selected calendars.\n */\n @State() selectedCalendar: string = '';\n\n /**\n * This event is fired when the selected calendars change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-booking-calendar-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-booking-calendar-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-booking-calendar-picker', 'componentWillLoad');\n // See comment in the @Watch('name') decorator for more information.\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-booking-calendar-picker', 'componentDidLoad');\n this.defaultBookingCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n\n // TODO: Remove this when the internals in tests are fixed.\n if (typeof this.internals.setFormValue === 'function') {\n this.internals.setFormValue(this.defaultBookingCalendar.toString(), 'booking-calendar');\n }\n this.selectedCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n }\n\n componentWillUpdate() {\n debug('nylas-booking-calendar-picker', 'componentWillUpdate');\n }\n\n componentDidUpdate() {\n debug('nylas-booking-calendar-picker', 'componentDidUpdate');\n }\n\n componentWillRender() {\n debug('nylas-booking-calendar-picker', 'componentWillRender');\n }\n\n componentDidRender() {\n debug('nylas-booking-calendar-picker', 'componentDidRender');\n }\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-booking-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-booking-calendar-picker', 'selectedOptionChangedHandler', event.detail);\n // Pass as handler so that if event.defaultPrevented by parent app, this will be skipped.\n const valueChanged = (event: CustomEvent<{ value: string; name: string }>) => {\n const { value } = event.detail;\n this.selectedCalendar = value;\n this.internals.setFormValue(value.toString(), this.name);\n };\n this.valueChanged.emit({ value: event.detail.value, name: this.name, valueChanged });\n }\n\n @RegisterComponent<NylasBookingCalendarPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-booking-calendar-picker',\n stateToProps: new Map([\n ['schedulerConfig.calendars', 'calendars'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {\n valueChanged: async (\n event: CustomEvent<{ value: string; name: string; valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void }>,\n _nylasSchedulerConfigConnector: NylasSchedulerConfigConnector,\n ) => {\n const { valueChanged } = event.detail;\n // If a handler is passed, call it.\n if (valueChanged) {\n valueChanged(event);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const calendarOptions =\n this.calendars?.map(calendar => {\n return {\n value: calendar.id,\n label: calendar.name,\n };\n }) ?? [];\n\n return (\n <Host>\n <div class=\"nylas-booking-calendar-picker\" part=\"nbcp\">\n <div class=\"header\" part=\"nbcp__header\">\n <h3>Calendar booking</h3>\n <p>Choose calendar where you’d like the event bookings to show up.</p>\n </div>\n\n {calendarOptions.length > 0 ? (\n <div class=\"nylas-booking-calendar-picker__dropdown\">\n <span class=\"label\" part=\"nbcp__input-label\">\n Select a calendar to book meetings on\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n Check availability across one or multiple calendars. If multiple calendars are selected, you must be available across all of them to be considered available.\n </span>\n </tooltip-component>\n </span>\n <select-dropdown\n name=\"booking-calendar\"\n options={calendarOptions}\n withSearch={false}\n exportparts=\"sd_dropdown: nbcp__dropdown, sd_dropdown-button: nbcp__dropdown-button, sd_dropdown-content: nbcp__dropdown-content\"\n defaultSelectedOption={calendarOptions.find(cal => cal.value == this.defaultBookingCalendar) ?? calendarOptions[0]}\n />\n </div>\n ) : (\n <div class=\"nylas-booking-calendar-picker__loading\">\n <span class=\"label\">\n Select a calendar to book meetings on <info-icon />\n </span>\n <div class=\"loading-button\">\n <span>Loading...</span>\n </div>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -171,13 +171,13 @@ const NylasBookingForm = class {
171
171
  this.guestEmailErrors = { ...errors };
172
172
  }
173
173
  render() {
174
- return (h(Host, { key: '5a255277a21fa84d100bb53d13bb9dce0ce58e24' }, h("form", { key: '19b7aecb9223557f0ff9d4c062968c3242026f0c', onSubmit: e => this.bookButtonClickedHandler(e), noValidate: true }, h("div", { key: '49276b2a59934eeaeb38c06db6968f957b7b9bee', class: "nylas-booking-form" }, h("slot", { key: 'ee0a8c29c1fb6b7273d6a2d3c8cb88180f0e9dbf', name: "custom-booking-form" }, h("div", { key: '662e46f3a7925282f824547a069f52584b94d564', class: "input-wrapper" }, h("label", { key: 'a01c1903ee983e1555006ad14e75cd1b2c3036ff', htmlFor: "name", class: { 'input-label': true, 'error': !this.isNameValid }, part: "nbf__input-label" }, "Name ", h("span", { key: '4729d580bbf9d851c2ac8b686dc826c4e3e4616f', class: "required" }, "*")), h("input", { key: '51754a63345f1d0332a38f646dde6a8a998c8dee', id: "name", type: "text", placeholder: "Enter your name", value: this.name, class: {
174
+ return (h(Host, { key: '018357db1ce7dbbeb11ebc236b869a3baf246c69' }, h("form", { key: '5f26a98903372d4c587df1d1045bcb240c4ee7cd', onSubmit: e => this.bookButtonClickedHandler(e), noValidate: true }, h("div", { key: '4ad84c89bb19933cb5d8403939104c38705ddfba', class: "nylas-booking-form" }, h("slot", { key: 'c594f51e9d8cbd40e1d42f9aa86baae536a9c7e7', name: "custom-booking-form" }, h("div", { key: 'fe026c1562cb85c773e31cec8a0a3574b3515e0c', class: "input-wrapper" }, h("label", { key: '27ecf20858dd3133ec4914970f7148720bc603ed', htmlFor: "name", class: { 'input-label': true, 'error': !this.isNameValid }, part: "nbf__input-label" }, "Name ", h("span", { key: '4a39ea8d7aa693f860c17aa28b2130ae49f31a1c', class: "required" }, "*")), h("input", { key: '69fb70d74fe3b3cd883ca7fc0a9f174b6f81936a', id: "name", type: "text", placeholder: "Enter your name", value: this.name, class: {
175
175
  input: true,
176
176
  error: !this.isNameValid,
177
- }, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), h("p", { key: 'b8a6660e959a877421bdfffdb87279d8f09123b8', class: "help-text" }, this.validationError.name)), h("div", { key: 'e78a74e67abde7e61c1d3c555c234817770a4040', class: "input-wrapper" }, h("label", { key: 'd5507037f5c668f58e14031dba4276900ef5ed09', htmlFor: "email", class: { 'input-label': true, 'error': !this.isEmailValid }, part: "nbf__input-label" }, "Email ", h("span", { key: '514f00587069ac1cfc6d16bfd30750d6d501817d', class: "required" }, "*")), h("input", { key: '0b80ded98b2174f783fa9e7c951a47661aa894f6', id: "email", type: "email", placeholder: "Enter your email", value: this.email, class: {
177
+ }, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), h("p", { key: 'e4be03fd299cbc94713e5561fb9ed69a78af200c', class: "help-text" }, this.validationError.name)), h("div", { key: '017e724bfd408c5bde7714ae8b2a941d4a1194d9', class: "input-wrapper" }, h("label", { key: 'ed19f30d50d5d2ae95bcbf567b5c888b7906463d', htmlFor: "email", class: { 'input-label': true, 'error': !this.isEmailValid }, part: "nbf__input-label" }, "Email ", h("span", { key: '9b3ab493851edfcc407a38fad0994da171ac9976', class: "required" }, "*")), h("input", { key: '768690b3cc350537be1fa39cc7a295f688c1d91d', id: "email", type: "email", placeholder: "Enter your email", value: this.email, class: {
178
178
  input: true,
179
179
  error: !this.isEmailValid,
180
- }, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), h("p", { key: 'ba185ccb2bec87049e94d8c5f8d211a838de0025', class: "help-text" }, this.validationError.email)))), h("div", { key: '56e2cce79371533ad66cccad95a79dd8935fe3eb', class: "cta" }, h("sp-button", { key: '2b6410b3cf2b7634737aa858396290ad065dfcfc', treatment: "outline", variant: "secondary", class: 'back', part: "nbf__button-outline", onClick: this.handleBackButtonClicked }, h("slot", { key: '4ba60a2fb3542434ede16ea382ec4ca80cb8d422', name: "booking-form-back-label" }, "Back")), h("sp-button", { key: '49dd32531d7b55529bb73bc82eb0b91820c6ea33', variant: "primary", class: 'book', part: "nbf__button-primary", type: "submit" }, this.isLoading && h("loading-icon", { slot: "icon" }), h("slot", { key: 'a57ae44c1c3a1b020a110f0156435f27897410c6', name: "booking-form-book-label" }, "Book now"))))));
180
+ }, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), h("p", { key: '24a39d859e700d000a363fe8df2f000365542fb0', class: "help-text" }, this.validationError.email)))), h("div", { key: '40b4b99dcf471afb8079d49fb9a0efe6bb7e406c', class: "cta" }, h("sp-button", { key: 'ae6bc3f620953f355184c7aef3ce692c2509c81d', treatment: "outline", variant: "secondary", class: 'back', part: "nbf__button-outline", onClick: this.handleBackButtonClicked }, h("slot", { key: 'e5a10ff0978756f7c3f8751a7aca6e3281f5046b', name: "booking-form-back-label" }, "Back")), h("sp-button", { key: '3aa5fe99000d52ef64db4191950109caeb526878', variant: "primary", class: 'book', part: "nbf__button-primary", type: "submit" }, this.isLoading && h("loading-icon", { slot: "icon" }), h("slot", { key: '83c5332efd5eb82617dc0a0f5275950431d95c26', name: "booking-form-book-label" }, "Book now"))))));
181
181
  }
182
182
  get host() { return getElement(this); }
183
183
  static get watchers() { return {
@@ -3,7 +3,7 @@ import { R as RegisterComponent } from './register-component-0462b27d.js';
3
3
  import { a as debug } from './utils-157014b4.js';
4
4
  import './_commonjsHelpers-7c16df4a.js';
5
5
 
6
- const nylasBufferTimeCss = ":host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:\"Inter\", sans-serif;width:inherit}.nylas-buffer-time{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200);text-align:left}.nylas-buffer-time .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-buffer-time .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-buffer-time .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-buffer-time .nylas-buffer-time__body{display:grid;grid-template-columns:1fr auto}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body{grid-template-columns:1fr}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{padding:1rem;display:flex;flex-direction:column;gap:1rem;border-right:1px solid var(--nylas-base-200);color:var(--nylas-base-800)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{border:none}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row label{width:200px}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row .dropdown-container{display:flex;gap:1rem;align-items:center;justify-content:flex-end}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:208px;background:var(--nylas-base-25);border-bottom-right-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:inherit;border-bottom-left-radius:var(--nylas-border-radius-2x)}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview h4{font-size:14px;line-height:24px;color:var(--nylas-base-600);font-family:var(--nylas-font-family);font-weight:500;text-align:center}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container{padding:0 2rem 1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot{background-color:transparent;border-top:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot.active{background-color:var(--nylas-base-100)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot:last-of-type{border-bottom:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .event-slot{background-color:var(--nylas-base-600);border-top:1px solid var(--nylas-base-300);border-bottom:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-button){width:104px;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);padding:1rem}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-content){width:100%}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}";
6
+ const nylasBufferTimeCss = ":host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:\"Inter\", sans-serif;width:inherit}.nylas-buffer-time{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200);text-align:left}.nylas-buffer-time .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-buffer-time .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-buffer-time .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-buffer-time .nylas-buffer-time__body{display:grid;grid-template-columns:1fr auto}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body{grid-template-columns:1fr}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{padding:1rem;display:flex;flex-direction:column;gap:1rem;border-right:1px solid var(--nylas-base-200);color:var(--nylas-base-800)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{border:none}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row label{width:200px}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row .dropdown-container{display:flex;gap:1rem;align-items:center;justify-content:flex-end}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:208px;background:var(--nylas-base-25);border-bottom-right-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:inherit;border-bottom-left-radius:var(--nylas-border-radius-2x)}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview h4{font-size:14px;line-height:24px;color:var(--nylas-base-600);font-family:var(--nylas-font-family);font-weight:500;text-align:center;margin:0.75rem 0}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container{padding:0 2rem 1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot{background-color:transparent;border-top:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot.active{background-color:var(--nylas-base-100)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot:last-of-type{border-bottom:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .event-slot{background-color:var(--nylas-base-600);border-top:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-button){width:104px;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);padding:1rem}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-content){width:100%}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}";
7
7
 
8
8
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
9
9
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -93,7 +93,7 @@ const NylasBufferTime = class {
93
93
  }
94
94
  renderPreview() {
95
95
  const totalSlots = 4;
96
- const slotHeight = 16;
96
+ const slotHeight = 10;
97
97
  const eventSlotHeight = slotHeight * 2;
98
98
  const slotFill = minutes => {
99
99
  const fullSlots = Math.floor(minutes / 30);
@@ -142,13 +142,14 @@ const NylasBufferTime = class {
142
142
  return (h("div", { class: "preview-container" }, createBeforeSlots(), h("div", { class: "event-slot", style: { height: `${eventSlotHeight}px` } }), createAfterSlots()));
143
143
  }
144
144
  render() {
145
- const minuteOptions = Array.from({ length: 121 }, (_, i) => {
145
+ const minuteOptions = Array.from({ length: 24 }, (_, i) => {
146
+ const value = (i + 1) * 5;
146
147
  return {
147
- label: i.toString(),
148
- value: i,
148
+ label: value.toString(),
149
+ value: value,
149
150
  };
150
151
  });
151
- return (h(Host, null, h("div", { class: "nylas-buffer-time", part: "nbt" }, h("div", { class: "header", part: "nbt__header" }, h("h3", null, "Buffer time"), h("p", null, "Add buffer time before and after the event.")), h("div", { class: "nylas-buffer-time__body", part: "nbt__body" }, h("div", { class: "nylas-buffer-time__dropdown" }, h("div", { class: "nylas-buffer-time__row" }, h("label", null, "Before the event"), h("div", { class: "dropdown-container" }, h("select-dropdown", { id: "before-buffer-time", name: "before-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-before, sd_dropdown-button: nbt__dropdown-button-before, sd_dropdown-content: nbt__dropdown-content-before", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedBeforeBufferTime) ?? minuteOptions[0] }), h("span", null, "mins"))), h("div", { class: "nylas-buffer-time__row" }, h("label", null, "After the event"), h("div", { class: "dropdown-container" }, h("select-dropdown", { id: "after-buffer-time", name: "after-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-after, sd_dropdown-button: nbt__dropdown-button-after, sd_dropdown-content: nbt__dropdown-content-after", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedAfterBufferTime) ?? minuteOptions[0] }), h("span", null, "mins")))), h("div", { class: "nylas-buffer-time__preview", part: "nbt__preview" }, h("h4", null, "PREVIEW"), this.renderPreview())))));
152
+ return (h(Host, null, h("div", { class: "nylas-buffer-time", part: "nbt" }, h("div", { class: "header", part: "nbt__header" }, h("h3", null, "Buffer time"), h("p", null, "Add buffer time before and after the event.")), h("div", { class: "nylas-buffer-time__body", part: "nbt__body" }, h("div", { class: "nylas-buffer-time__dropdown" }, h("div", { class: "nylas-buffer-time__row" }, h("label", null, "Before the event"), h("div", { class: "dropdown-container" }, h("select-dropdown", { id: "before-buffer-time", withSearch: false, name: "before-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-before, sd_dropdown-button: nbt__dropdown-button-before, sd_dropdown-content: nbt__dropdown-content-before", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedBeforeBufferTime) ?? minuteOptions[0] }), h("span", null, "mins"))), h("div", { class: "nylas-buffer-time__row" }, h("label", null, "After the event"), h("div", { class: "dropdown-container" }, h("select-dropdown", { id: "after-buffer-time", withSearch: false, name: "after-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-after, sd_dropdown-button: nbt__dropdown-button-after, sd_dropdown-content: nbt__dropdown-content-after", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedAfterBufferTime) ?? minuteOptions[0] }), h("span", null, "mins")))), h("div", { class: "nylas-buffer-time__preview", part: "nbt__preview" }, h("h4", null, "PREVIEW"), this.renderPreview())))));
152
153
  }
153
154
  static get formAssociated() { return true; }
154
155
  get host() { return getElement(this); }