@nylas/web-elements 1.3.2 → 1.3.3

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 (210) hide show
  1. package/dist/cdn/checkbox-component/checkbox-component.es.js +48 -38
  2. package/dist/cdn/multi-select-dropdown/multi-select-dropdown.es.js +554 -535
  3. package/dist/cdn/nylas-additional-participants/nylas-additional-participants.es.js +2 -2
  4. package/dist/cdn/nylas-booking-form/nylas-booking-form.es.js +25 -9
  5. package/dist/cdn/nylas-booking-form-config/nylas-booking-form-config.es.js +2182 -2171
  6. package/dist/cdn/nylas-buffer-time/nylas-buffer-time.es.js +13 -14
  7. package/dist/cdn/nylas-calendar-picker/nylas-calendar-picker.es.js +571 -552
  8. package/dist/cdn/nylas-connected-calendars/nylas-connected-calendars.es.js +26 -7
  9. package/dist/cdn/nylas-customize-booking-settings/nylas-customize-booking-settings.es.js +12 -2
  10. package/dist/cdn/nylas-date-component/nylas-date-component.es.js +13 -7
  11. package/dist/cdn/nylas-editor-tabs/nylas-editor-tabs.es.js +3550 -3473
  12. package/dist/cdn/nylas-event-location/nylas-event-location.es.js +633 -621
  13. package/dist/cdn/nylas-limit-future-bookings/nylas-limit-future-bookings.es.js +25 -2
  14. package/dist/cdn/nylas-min-booking-notice/nylas-min-booking-notice.es.js +25 -2
  15. package/dist/cdn/nylas-min-cancellation-notice/nylas-min-cancellation-notice.es.js +163 -140
  16. package/dist/cdn/nylas-page-styling/nylas-page-styling.es.js +5 -3
  17. package/dist/cdn/nylas-participants-custom-availability/nylas-participants-custom-availability.es.js +4 -3
  18. package/dist/cdn/nylas-provider/nylas-provider.es.js +1 -1
  19. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +173 -96
  20. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +28 -12
  21. package/dist/cdn/scheduler-store/scheduler-store.es.js +1 -1
  22. package/dist/cdn/time-period-selector/time-period-selector.es.js +25 -2
  23. package/dist/cjs/calendar-agenda-fill-icon_53.cjs.entry.js +88 -57
  24. package/dist/cjs/calendar-agenda-fill-icon_53.cjs.entry.js.map +1 -1
  25. package/dist/cjs/checkbox-component.cjs.entry.js +9 -1
  26. package/dist/cjs/checkbox-component.cjs.entry.js.map +1 -1
  27. package/dist/cjs/checkbox-component_3.cjs.entry.js +21 -8
  28. package/dist/cjs/checkbox-component_3.cjs.entry.js.map +1 -1
  29. package/dist/cjs/google-logo-icon_4.cjs.entry.js +2 -2
  30. package/dist/cjs/loader.cjs.js +1 -1
  31. package/dist/cjs/multi-select-dropdown.cjs.entry.js +19 -1
  32. package/dist/cjs/multi-select-dropdown.cjs.entry.js.map +1 -1
  33. package/dist/cjs/nylas-additional-participants.cjs.entry.js +1 -1
  34. package/dist/cjs/nylas-additional-participants.cjs.entry.js.map +1 -1
  35. package/dist/cjs/nylas-booking-form-config.cjs.entry.js +34 -27
  36. package/dist/cjs/nylas-booking-form-config.cjs.entry.js.map +1 -1
  37. package/dist/cjs/nylas-buffer-time.cjs.entry.js +13 -12
  38. package/dist/cjs/nylas-buffer-time.cjs.entry.js.map +1 -1
  39. package/dist/cjs/nylas-connected-calendars.cjs.entry.js +2 -2
  40. package/dist/cjs/nylas-connected-calendars.cjs.entry.js.map +1 -1
  41. package/dist/cjs/nylas-date-component.cjs.entry.js +12 -7
  42. package/dist/cjs/nylas-date-component.cjs.entry.js.map +1 -1
  43. package/dist/cjs/nylas-editor-tabs.cjs.entry.js +2 -2
  44. package/dist/cjs/nylas-event-location.cjs.entry.js +32 -11
  45. package/dist/cjs/nylas-event-location.cjs.entry.js.map +1 -1
  46. package/dist/cjs/nylas-page-styling.cjs.entry.js +3 -2
  47. package/dist/cjs/nylas-page-styling.cjs.entry.js.map +1 -1
  48. package/dist/cjs/nylas-participants-custom-availability.cjs.entry.js +3 -2
  49. package/dist/cjs/nylas-participants-custom-availability.cjs.entry.js.map +1 -1
  50. package/dist/cjs/nylas-provider.cjs.entry.js +1 -1
  51. package/dist/cjs/nylas-scheduling.cjs.entry.js +3 -3
  52. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  53. package/dist/cjs/{scheduler-store-37a0e152.js → scheduler-store-2cd220d1.js} +2 -2
  54. package/dist/cjs/{scheduler-store-37a0e152.js.map → scheduler-store-2cd220d1.js.map} +1 -1
  55. package/dist/cjs/{scheduler-store-373adf03.js → scheduler-store-70af2279.js} +2 -2
  56. package/dist/cjs/{scheduler-store-373adf03.js.map → scheduler-store-70af2279.js.map} +1 -1
  57. package/dist/cjs/time-period-selector.cjs.entry.js +21 -1
  58. package/dist/cjs/time-period-selector.cjs.entry.js.map +1 -1
  59. package/dist/collection/components/design-system/checkbox-component/checkbox-component.js +12 -1
  60. package/dist/collection/components/design-system/checkbox-component/checkbox-component.js.map +1 -1
  61. package/dist/collection/components/design-system/multi-select-dropdown/multi-select-dropdown.js +22 -1
  62. package/dist/collection/components/design-system/multi-select-dropdown/multi-select-dropdown.js.map +1 -1
  63. package/dist/collection/components/design-system/nylas-date-component/nylas-date-component.js +14 -8
  64. package/dist/collection/components/design-system/nylas-date-component/nylas-date-component.js.map +1 -1
  65. package/dist/collection/components/design-system/nylas-date-component/test/nylas-date-component.spec.js +39 -0
  66. package/dist/collection/components/design-system/nylas-date-component/test/nylas-date-component.spec.js.map +1 -0
  67. package/dist/collection/components/design-system/time-period-selector/time-period-selector.js +28 -1
  68. package/dist/collection/components/design-system/time-period-selector/time-period-selector.js.map +1 -1
  69. package/dist/collection/components/scheduler/nylas-date-picker/test/nylas-date-picker.spec.js +3 -1
  70. package/dist/collection/components/scheduler/nylas-date-picker/test/nylas-date-picker.spec.js.map +1 -1
  71. package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js +1 -1
  72. package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js.map +1 -1
  73. package/dist/collection/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.js +36 -27
  74. package/dist/collection/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.js.map +1 -1
  75. package/dist/collection/components/scheduler-editor/nylas-booking-form-config/test/nylas-booking-form-config.spec.js +23 -0
  76. package/dist/collection/components/scheduler-editor/nylas-booking-form-config/test/nylas-booking-form-config.spec.js.map +1 -1
  77. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js +13 -12
  78. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js.map +1 -1
  79. package/dist/collection/components/scheduler-editor/nylas-calendar-picker/test/nylas-calendar-picker.spec.js +13 -0
  80. package/dist/collection/components/scheduler-editor/nylas-calendar-picker/test/nylas-calendar-picker.spec.js.map +1 -1
  81. package/dist/collection/components/scheduler-editor/nylas-connected-calendars/nylas-connected-calendars.js +2 -2
  82. package/dist/collection/components/scheduler-editor/nylas-connected-calendars/nylas-connected-calendars.js.map +1 -1
  83. package/dist/collection/components/scheduler-editor/nylas-event-location/nylas-event-location.js +35 -10
  84. package/dist/collection/components/scheduler-editor/nylas-event-location/nylas-event-location.js.map +1 -1
  85. package/dist/collection/components/scheduler-editor/nylas-page-styling/nylas-page-styling.js +4 -1
  86. package/dist/collection/components/scheduler-editor/nylas-page-styling/nylas-page-styling.js.map +1 -1
  87. package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js +3 -2
  88. package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js.map +1 -1
  89. package/dist/components/checkbox-component2.js +12 -2
  90. package/dist/components/checkbox-component2.js.map +1 -1
  91. package/dist/components/multi-select-dropdown2.js +22 -2
  92. package/dist/components/multi-select-dropdown2.js.map +1 -1
  93. package/dist/components/nylas-additional-participants2.js +1 -1
  94. package/dist/components/nylas-additional-participants2.js.map +1 -1
  95. package/dist/components/nylas-booking-form-config2.js +35 -27
  96. package/dist/components/nylas-booking-form-config2.js.map +1 -1
  97. package/dist/components/nylas-buffer-time2.js +13 -12
  98. package/dist/components/nylas-buffer-time2.js.map +1 -1
  99. package/dist/components/nylas-connected-calendars2.js +2 -2
  100. package/dist/components/nylas-connected-calendars2.js.map +1 -1
  101. package/dist/components/nylas-date-component2.js +14 -8
  102. package/dist/components/nylas-date-component2.js.map +1 -1
  103. package/dist/components/nylas-editor-tabs2.js +2 -2
  104. package/dist/components/nylas-event-location2.js +35 -12
  105. package/dist/components/nylas-event-location2.js.map +1 -1
  106. package/dist/components/nylas-page-styling2.js +5 -3
  107. package/dist/components/nylas-page-styling2.js.map +1 -1
  108. package/dist/components/nylas-participants-custom-availability2.js +3 -2
  109. package/dist/components/nylas-participants-custom-availability2.js.map +1 -1
  110. package/dist/components/nylas-scheduling.js +2 -2
  111. package/dist/components/scheduler-store.js +1 -1
  112. package/dist/components/time-period-selector2.js +26 -2
  113. package/dist/components/time-period-selector2.js.map +1 -1
  114. package/dist/esm/calendar-agenda-fill-icon_53.entry.js +88 -57
  115. package/dist/esm/calendar-agenda-fill-icon_53.entry.js.map +1 -1
  116. package/dist/esm/checkbox-component.entry.js +9 -1
  117. package/dist/esm/checkbox-component.entry.js.map +1 -1
  118. package/dist/esm/checkbox-component_3.entry.js +21 -8
  119. package/dist/esm/checkbox-component_3.entry.js.map +1 -1
  120. package/dist/esm/google-logo-icon_4.entry.js +2 -2
  121. package/dist/esm/loader.js +1 -1
  122. package/dist/esm/multi-select-dropdown.entry.js +19 -1
  123. package/dist/esm/multi-select-dropdown.entry.js.map +1 -1
  124. package/dist/esm/nylas-additional-participants.entry.js +1 -1
  125. package/dist/esm/nylas-additional-participants.entry.js.map +1 -1
  126. package/dist/esm/nylas-booking-form-config.entry.js +34 -27
  127. package/dist/esm/nylas-booking-form-config.entry.js.map +1 -1
  128. package/dist/esm/nylas-buffer-time.entry.js +13 -12
  129. package/dist/esm/nylas-buffer-time.entry.js.map +1 -1
  130. package/dist/esm/nylas-connected-calendars.entry.js +2 -2
  131. package/dist/esm/nylas-connected-calendars.entry.js.map +1 -1
  132. package/dist/esm/nylas-date-component.entry.js +12 -7
  133. package/dist/esm/nylas-date-component.entry.js.map +1 -1
  134. package/dist/esm/nylas-editor-tabs.entry.js +2 -2
  135. package/dist/esm/nylas-event-location.entry.js +32 -11
  136. package/dist/esm/nylas-event-location.entry.js.map +1 -1
  137. package/dist/esm/nylas-page-styling.entry.js +3 -2
  138. package/dist/esm/nylas-page-styling.entry.js.map +1 -1
  139. package/dist/esm/nylas-participants-custom-availability.entry.js +3 -2
  140. package/dist/esm/nylas-participants-custom-availability.entry.js.map +1 -1
  141. package/dist/esm/nylas-provider.entry.js +1 -1
  142. package/dist/esm/nylas-scheduling.entry.js +3 -3
  143. package/dist/esm/nylas-web-elements.js +1 -1
  144. package/dist/esm/{scheduler-store-20151a77.js → scheduler-store-3acf4d70.js} +2 -2
  145. package/dist/esm/{scheduler-store-20151a77.js.map → scheduler-store-3acf4d70.js.map} +1 -1
  146. package/dist/esm/{scheduler-store-b6d12f40.js → scheduler-store-79dc16cc.js} +2 -2
  147. package/dist/esm/{scheduler-store-b6d12f40.js.map → scheduler-store-79dc16cc.js.map} +1 -1
  148. package/dist/esm/time-period-selector.entry.js +21 -1
  149. package/dist/esm/time-period-selector.entry.js.map +1 -1
  150. package/dist/nylas-web-elements/checkbox-component.entry.js +9 -1
  151. package/dist/nylas-web-elements/checkbox-component.entry.js.map +1 -1
  152. package/dist/nylas-web-elements/multi-select-dropdown.entry.js +19 -1
  153. package/dist/nylas-web-elements/multi-select-dropdown.entry.js.map +1 -1
  154. package/dist/nylas-web-elements/nylas-additional-participants.entry.js +1 -1
  155. package/dist/nylas-web-elements/nylas-additional-participants.entry.js.map +1 -1
  156. package/dist/nylas-web-elements/nylas-booking-form-config.entry.js +34 -27
  157. package/dist/nylas-web-elements/nylas-booking-form-config.entry.js.map +1 -1
  158. package/dist/nylas-web-elements/nylas-buffer-time.entry.js +13 -12
  159. package/dist/nylas-web-elements/nylas-buffer-time.entry.js.map +1 -1
  160. package/dist/nylas-web-elements/nylas-connected-calendars.entry.js +2 -2
  161. package/dist/nylas-web-elements/nylas-connected-calendars.entry.js.map +1 -1
  162. package/dist/nylas-web-elements/nylas-date-component.entry.js +12 -7
  163. package/dist/nylas-web-elements/nylas-date-component.entry.js.map +1 -1
  164. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +2 -2
  165. package/dist/nylas-web-elements/nylas-event-location.entry.js +32 -11
  166. package/dist/nylas-web-elements/nylas-event-location.entry.js.map +1 -1
  167. package/dist/nylas-web-elements/nylas-page-styling.entry.js +3 -2
  168. package/dist/nylas-web-elements/nylas-page-styling.entry.js.map +1 -1
  169. package/dist/nylas-web-elements/nylas-participants-custom-availability.entry.js +3 -2
  170. package/dist/nylas-web-elements/nylas-participants-custom-availability.entry.js.map +1 -1
  171. package/dist/nylas-web-elements/nylas-provider.entry.js +1 -1
  172. package/dist/nylas-web-elements/nylas-scheduling.entry.js +3 -3
  173. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  174. package/dist/nylas-web-elements/p-040b8553.entry.js +2 -0
  175. package/dist/nylas-web-elements/p-040b8553.entry.js.map +1 -0
  176. package/dist/nylas-web-elements/p-13a83f9a.entry.js +8 -0
  177. package/dist/nylas-web-elements/p-13a83f9a.entry.js.map +1 -0
  178. package/dist/nylas-web-elements/p-1a9fc29a.entry.js +2 -0
  179. package/dist/nylas-web-elements/p-1a9fc29a.entry.js.map +1 -0
  180. package/dist/nylas-web-elements/{p-e543a827.entry.js → p-1dedce7c.entry.js} +2 -2
  181. package/dist/nylas-web-elements/{p-284c14bb.js → p-53f7b360.js} +2 -2
  182. package/dist/nylas-web-elements/p-7f100474.entry.js +2 -0
  183. package/dist/nylas-web-elements/p-7f100474.entry.js.map +1 -0
  184. package/dist/nylas-web-elements/{p-70d36207.entry.js → p-84e69241.entry.js} +2 -2
  185. package/dist/nylas-web-elements/{p-36c73819.entry.js → p-ad7f8831.entry.js} +2 -2
  186. package/dist/nylas-web-elements/{scheduler-store-b6d12f40.js → scheduler-store-79dc16cc.js} +2 -2
  187. package/dist/nylas-web-elements/{scheduler-store-b6d12f40.js.map → scheduler-store-79dc16cc.js.map} +1 -1
  188. package/dist/nylas-web-elements/time-period-selector.entry.js +21 -1
  189. package/dist/nylas-web-elements/time-period-selector.entry.js.map +1 -1
  190. package/dist/types/components/design-system/checkbox-component/checkbox-component.d.ts +1 -0
  191. package/dist/types/components/design-system/multi-select-dropdown/multi-select-dropdown.d.ts +2 -0
  192. package/dist/types/components/design-system/nylas-date-component/nylas-date-component.d.ts +1 -0
  193. package/dist/types/components/design-system/time-period-selector/time-period-selector.d.ts +3 -0
  194. package/dist/types/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.d.ts +2 -0
  195. package/dist/types/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.d.ts +2 -0
  196. package/dist/types/components/scheduler-editor/nylas-event-location/nylas-event-location.d.ts +3 -0
  197. package/dist/types/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.d.ts +2 -2
  198. package/package.json +1 -1
  199. package/dist/nylas-web-elements/p-2fa604d7.entry.js +0 -2
  200. package/dist/nylas-web-elements/p-2fa604d7.entry.js.map +0 -1
  201. package/dist/nylas-web-elements/p-52b9c0cb.entry.js +0 -2
  202. package/dist/nylas-web-elements/p-52b9c0cb.entry.js.map +0 -1
  203. package/dist/nylas-web-elements/p-9db69aed.entry.js +0 -2
  204. package/dist/nylas-web-elements/p-9db69aed.entry.js.map +0 -1
  205. package/dist/nylas-web-elements/p-a1a75dc7.entry.js +0 -8
  206. package/dist/nylas-web-elements/p-a1a75dc7.entry.js.map +0 -1
  207. /package/dist/nylas-web-elements/{p-e543a827.entry.js.map → p-1dedce7c.entry.js.map} +0 -0
  208. /package/dist/nylas-web-elements/{p-284c14bb.js.map → p-53f7b360.js.map} +0 -0
  209. /package/dist/nylas-web-elements/{p-70d36207.entry.js.map → p-84e69241.entry.js.map} +0 -0
  210. /package/dist/nylas-web-elements/{p-36c73819.entry.js.map → p-ad7f8831.entry.js.map} +0 -0
@@ -63,6 +63,18 @@ export class NylasEventLocation {
63
63
  this.location = '';
64
64
  }
65
65
  }
66
+ currentUserChangedHandler(newValue) {
67
+ debug('nylas-custom-booking-flow', 'currentUserChangedHandler', newValue);
68
+ if (newValue?.provider) {
69
+ this.userProviderState = newValue?.provider;
70
+ this.setLocationOptionsForProvider(this.userProviderState);
71
+ }
72
+ }
73
+ conferenceProvidersChanged(newValue) {
74
+ if (newValue?.['zoom'] && !this.locationOptions.some(option => option.value === 'zoom')) {
75
+ this.locationOptions.push({ value: 'zoom', label: labels['zoom'], labelHTML: this.getLabelHTML('zoom') });
76
+ }
77
+ }
66
78
  connectedCallback() {
67
79
  debug('nylas-event-location', 'connectedCallback');
68
80
  }
@@ -79,15 +91,8 @@ export class NylasEventLocation {
79
91
  this.selectedLocationOption = this.setDefaultLocationOption(this.eventConferencing || null, this.eventLocation ?? '');
80
92
  }
81
93
  this.userProviderState = this.userProvider ?? this.currentUser?.provider ?? '';
82
- switch (this.userProviderState) {
83
- case 'google':
84
- this.locationOptions.push({ value: 'google', label: labels['google'], labelHTML: this.getLabelHTML('google') });
85
- break;
86
- case 'microsoft':
87
- this.locationOptions.push({ value: 'microsoft', label: labels['microsoft'], labelHTML: this.getLabelHTML('microsoft') });
88
- break;
89
- }
90
- if (this.conferenceProviders?.['zoom']) {
94
+ this.setLocationOptionsForProvider(this.userProviderState);
95
+ if (this.conferenceProviders?.['zoom'] && !this.locationOptions.some(option => option.value === 'zoom')) {
91
96
  this.locationOptions.push({ value: 'zoom', label: labels['zoom'], labelHTML: this.getLabelHTML('zoom') });
92
97
  }
93
98
  }
@@ -154,6 +159,20 @@ export class NylasEventLocation {
154
159
  break;
155
160
  }
156
161
  }
162
+ setLocationOptionsForProvider(provider) {
163
+ switch (provider) {
164
+ case 'google':
165
+ if (!this.locationOptions.some(option => option.value === 'google')) {
166
+ this.locationOptions.push({ value: 'google', label: labels['google'], labelHTML: this.getLabelHTML('google') });
167
+ }
168
+ break;
169
+ case 'microsoft':
170
+ if (!this.locationOptions.some(option => option.value === 'microsoft')) {
171
+ this.locationOptions.push({ value: 'microsoft', label: labels['microsoft'], labelHTML: this.getLabelHTML('microsoft') });
172
+ }
173
+ break;
174
+ }
175
+ }
157
176
  setDefaultLocationOption(eventConferencing, eventLocation) {
158
177
  if (eventConferencing != null && eventConferencing?.provider != null && eventConferencing?.autocreate != null) {
159
178
  return CONFERENCE_PROVIDER_MAP[eventConferencing?.provider];
@@ -204,7 +223,7 @@ export class NylasEventLocation {
204
223
  }
205
224
  render() {
206
225
  const defaultOption = typeof this.selectedLocationOption !== 'undefined' ? this.locationOptions.find(i => i.value == this.selectedLocationOption) : null;
207
- return (h(Host, { key: '6869d3c2f6316dc482becc022bc973783332658f' }, h("div", { key: 'e17b95b15e181f73efd5c666ff0074bcd5467b65', class: "nylas-event-location", part: "nel" }, h("label", { key: '9370ab01f5f730099dd5061ccf39ca3b53132244', htmlFor: "location" }, "Event meeting or location", h("span", { key: 'acd558f22ad18afc63b93456450a5aa946916fd4', class: "label-icon" }, h("tooltip-component", { key: 'bd2ea171a9eef9e9a377a0be2dc4a16b91bb1359' }, h("info-icon", { key: '745289e658441e9aadb245c94da890cdb3119179', slot: "tooltip-icon" }), h("span", { key: 'ffa4a9597a7d63e33b639dafd736a654a97589c9', slot: "tooltip-content" }, "Select a conferencing option or add a custom location.")))), h("div", { key: '59f930e30b758b740128b42a855608a02ee1a739', class: "location-input" }, defaultOption && defaultOption?.label && (h("select-dropdown", { withSearch: false, name: "location", options: this.locationOptions, defaultSelectedOption: defaultOption, exportparts: "sd_dropdown: nel__dropdown, sd_dropdown-button: nel__dropdown-button, sd_dropdown-content: nel__dropdown-content" }, h("span", { slot: "select-icon" }, this.getIcon(this.selectedLocationOption)))), this.selectedLocationOption === 'custom' && (h("input", { type: "text", part: "nel__location", id: "location", name: "location", maxlength: "1024", value: this.location, onInput: e => this.handleChange(e) }))))));
226
+ return (h(Host, { key: 'c91ef22df2a83a3c2ac66ca9011ad8633a085b9e' }, h("div", { key: '9e6823ce704cf4870f99936a39371b255b165afb', class: "nylas-event-location", part: "nel" }, h("label", { key: '2d1a71a258d0576460acd68a93cbace4a5c9254c', htmlFor: "location" }, "Event meeting or location", h("span", { key: '9dd7df66eec4e35a8659c88d4f26be99093e815a', class: "label-icon" }, h("tooltip-component", { key: '9299313bad5724106fa7108d0874e760945bcb30' }, h("info-icon", { key: '2490fbc28caa2547d8a3cecc747dc94254c59df3', slot: "tooltip-icon" }), h("span", { key: 'd6c73fef100e4f962507d58b4ed24a1bd19599c2', slot: "tooltip-content" }, "Select a conferencing option or add a custom location.")))), h("div", { key: '726f78440a3e65e379368b0a849bee94b2839dfd', class: "location-input" }, defaultOption && defaultOption?.label && (h("select-dropdown", { withSearch: false, name: "location", options: this.locationOptions, defaultSelectedOption: defaultOption, exportparts: "sd_dropdown: nel__dropdown, sd_dropdown-button: nel__dropdown-button, sd_dropdown-content: nel__dropdown-content" }, h("span", { slot: "select-icon" }, this.getIcon(this.selectedLocationOption)))), this.selectedLocationOption === 'custom' && (h("input", { type: "text", part: "nel__location", id: "location", name: "location", maxlength: "1024", value: this.location, onInput: e => this.handleChange(e) }))))));
208
227
  }
209
228
  static get is() { return "nylas-event-location"; }
210
229
  static get encapsulation() { return "shadow"; }
@@ -414,6 +433,12 @@ export class NylasEventLocation {
414
433
  }, {
415
434
  "propName": "selectedConfiguration",
416
435
  "methodName": "selectedConfigurationChangedHandler"
436
+ }, {
437
+ "propName": "currentUser",
438
+ "methodName": "currentUserChangedHandler"
439
+ }, {
440
+ "propName": "conferenceProviders",
441
+ "methodName": "conferenceProvidersChanged"
417
442
  }];
418
443
  }
419
444
  static get listeners() {
@@ -1 +1 @@
1
- {"version":3,"file":"nylas-event-location.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-event-location/nylas-event-location.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,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common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug, sanitize } from '@/utils/utils';\nimport { AttachInternals, Component, Host, State, h, Element, Prop, Watch, Event, EventEmitter, Listen } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Conference, Configuration } from '@nylas/core';\nimport { CONFERENCE_PROVIDER_MAP, PROVIDER_CONFERENCE_MAP } from '@/common/constants';\nimport { User } from '@/common/nylas-api-request';\n\nconst labels = {\n none: 'None',\n custom: 'Custom location',\n google: 'Google Meet',\n microsoft: 'Microsoft Teams',\n zoom: 'Zoom Meeting',\n};\n\n/**\n * The `nylas-event-location` component is a form input for the location of an event.\n *\n * @part nel - The event location container\n * @part nel__location - The event location input\n * @part nel__dropdown - The dropdown container\n * @part nel__dropdown-button - The dropdown button\n * @part nel__dropdown-content - The dropdown content\n */\n@Component({\n tag: 'nylas-event-location',\n styleUrl: 'nylas-event-location.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasEventLocation {\n /*\n * The host element <nylas-event-location>\n */\n @Element() host!: HTMLElement;\n /**\n * @standalone\n * The name of the event location input.\n */\n @Prop() name: string = 'location';\n\n /**\n * @standalone\n * The current user\n */\n @Prop() currentUser?: User;\n /**\n * @standalone\n * The users provider\n */\n @Prop() userProvider?: string;\n /**\n * @standalone\n * The event conferencing stored in the configuration\n */\n @Prop() eventConferencing?: Conference;\n /**\n * @standalone\n * The conference providers where the key is the provider name ('zoom') and the value is the grant id.\n * We currently support same provider ('google', 'microsoft') for all participants and 'zoom' for cross-provider conferencing.\n */\n @Prop() conferenceProviders?: Record<string, string>;\n\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The event location stored in the configuration\n */\n @Prop() eventLocation?: string;\n /**\n * The selected event location state. This defaults to the event location from the configuration or an empty string.\n */\n @State() location: string = this.eventLocation ?? '';\n /**\n * The grant id for the conferencing of non-default conferencing options.\n */\n @State() grantId: string = this.eventConferencing ? this.setDefaultGrantID(this.eventConferencing) : '';\n /**\n * The selected location option. This defaults to 'none'.\n */\n @State() selectedLocationOption!: string;\n /**\n * The current user provider state.\n */\n @State() userProviderState: string = this.userProvider ?? this.currentUser?.provider ?? '';\n\n /**\n * The state to store location options.\n */\n @State() locationOptions = [\n { value: 'none', label: labels['none'], labelHTML: this.getLabelHTML('none') },\n { value: 'custom', label: labels['custom'], labelHTML: this.getLabelHTML('custom') },\n ];\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\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-event-location', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-custom-booking-flow', 'selectedConfigurationChangedHandler', newValue);\n const configLocation = newValue?.event_booking?.location;\n const configConferencing = newValue?.event_booking?.conferencing;\n if (configConferencing?.provider) {\n this.selectedLocationOption = this.setDefaultLocationOption(configConferencing, configLocation ?? '');\n this.grantId = this.setDefaultGrantID(configConferencing);\n this.location = configLocation ? configLocation : '';\n } else if (configLocation) {\n this.selectedLocationOption = configLocation ? 'custom' : 'none';\n this.location = configLocation;\n } else {\n this.selectedLocationOption = 'none';\n this.location = '';\n }\n }\n\n /**\n * This event is fired when the value of the event location changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-event-location', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-event-location', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-event-location', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n } else {\n this.selectedLocationOption = this.setDefaultLocationOption(this.eventConferencing || null, this.eventLocation ?? '');\n }\n\n this.userProviderState = this.userProvider ?? this.currentUser?.provider ?? '';\n switch (this.userProviderState) {\n case 'google':\n this.locationOptions.push({ value: 'google', label: labels['google'], labelHTML: this.getLabelHTML('google') });\n break;\n case 'microsoft':\n this.locationOptions.push({ value: 'microsoft', label: labels['microsoft'], labelHTML: this.getLabelHTML('microsoft') });\n break;\n }\n\n if (this.conferenceProviders?.['zoom']) {\n this.locationOptions.push({ value: 'zoom', label: labels['zoom'], labelHTML: this.getLabelHTML('zoom') });\n }\n }\n\n disconnectedCallback() {\n debug('nylas-event-location', 'disconnectedCallback');\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string }>) {\n this.selectedLocationOption = event.detail.value;\n let payload;\n switch (this.selectedLocationOption) {\n case 'none':\n this.location = '';\n this.setFormValue('', this.name);\n this.valueChanged.emit({ value: '', name: this.name });\n this.valueChanged.emit({ value: JSON.stringify(null), name: 'conference' });\n break;\n case 'custom':\n this.valueChanged.emit({ value: JSON.stringify(null), name: 'conference' });\n break;\n case 'google':\n this.location = '';\n this.setFormValue('', this.name);\n const googleConfGrantId = this.conferenceProviders?.['google'];\n payload = {\n provider: PROVIDER_CONFERENCE_MAP.google,\n autocreate: googleConfGrantId\n ? {\n conf_grant_id: googleConfGrantId,\n }\n : {},\n };\n this.valueChanged.emit({ value: JSON.stringify(payload), name: 'conference' });\n this.valueChanged.emit({ value: '', name: this.name });\n break;\n case 'microsoft':\n this.location = '';\n this.setFormValue('', this.name);\n const microsoftConfGrantId = this.conferenceProviders?.['microsoft'];\n payload = {\n provider: PROVIDER_CONFERENCE_MAP.microsoft,\n autocreate: microsoftConfGrantId\n ? {\n conf_grant_id: microsoftConfGrantId,\n }\n : {},\n };\n this.valueChanged.emit({ value: JSON.stringify(payload), name: 'conference' });\n this.valueChanged.emit({ value: '', name: this.name });\n break;\n case 'zoom':\n this.location = '';\n this.setFormValue('', this.name);\n const zoomConfGrantId = this.conferenceProviders?.['zoom'];\n payload = {\n provider: PROVIDER_CONFERENCE_MAP.zoom,\n autocreate: zoomConfGrantId\n ? {\n conf_grant_id: zoomConfGrantId,\n }\n : {},\n };\n this.valueChanged.emit({ value: JSON.stringify(payload), name: 'conference' });\n this.valueChanged.emit({ value: '', name: this.name });\n break;\n }\n }\n\n setDefaultLocationOption(eventConferencing: Conference | null, eventLocation: string) {\n if (eventConferencing != null && eventConferencing?.provider != null && eventConferencing?.autocreate != null) {\n return CONFERENCE_PROVIDER_MAP[eventConferencing?.provider];\n }\n return eventLocation ? 'custom' : 'none';\n }\n setDefaultGrantID(eventConferencing: Conference) {\n if (eventConferencing != null && eventConferencing?.autocreate != null) {\n return eventConferencing?.autocreate?.conf_grant_id;\n }\n return '';\n }\n\n setFormValue(value: string, name: string) {\n if (typeof this.internals.setFormValue === 'function') {\n this.internals.setFormValue(value, name);\n }\n }\n\n handleChange(event) {\n const value = sanitize(event.target.value);\n this.location = value;\n this.setFormValue(value, this.name);\n this.valueChanged.emit({ value: value, name: this.name });\n }\n\n getIcon(location: string) {\n switch (location) {\n case 'none':\n return <location-off-icon />;\n case 'custom':\n return <location-icon />;\n case 'google':\n return <google-meet-icon />;\n case 'microsoft':\n return <microsoft-teams-icon />;\n case 'zoom':\n return <zoom-icon />;\n }\n }\n\n getLabelHTML(location: string) {\n return (\n <span\n class=\"location-label\"\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '16px',\n width: '-webkit-fill-available',\n }}\n >\n {this.getIcon(location)}\n <span\n class=\"location-text\"\n style={{\n fontSize: '14px',\n fontWeight: '400',\n }}\n >\n {labels[location]}\n </span>\n </span>\n );\n }\n\n @RegisterComponent<NylasEventLocation, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-event-location',\n stateToProps: new Map([\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.conferenceProviders', 'conferenceProviders'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n const defaultOption = typeof this.selectedLocationOption !== 'undefined' ? this.locationOptions.find(i => i.value == this.selectedLocationOption) : null;\n return (\n <Host>\n <div class=\"nylas-event-location\" part=\"nel\">\n <label htmlFor=\"location\">\n Event meeting or location\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">Select a conferencing option or add a custom location.</span>\n </tooltip-component>\n </span>\n </label>\n <div class=\"location-input\">\n {defaultOption && defaultOption?.label && (\n <select-dropdown\n withSearch={false}\n name=\"location\"\n options={this.locationOptions}\n defaultSelectedOption={defaultOption}\n exportparts=\"sd_dropdown: nel__dropdown, sd_dropdown-button: nel__dropdown-button, sd_dropdown-content: nel__dropdown-content\"\n >\n <span slot=\"select-icon\">{this.getIcon(this.selectedLocationOption)}</span>\n </select-dropdown>\n )}\n {this.selectedLocationOption === 'custom' && (\n <input type=\"text\" part=\"nel__location\" id=\"location\" name=\"location\" maxlength=\"1024\" value={this.location} onInput={e => this.handleChange(e)} />\n )}\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"nylas-event-location.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-event-location/nylas-event-location.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AAG9H,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CA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AI,CAAC,sBAAsB,KAAK,QAAQ,IAAI,CAC3C,aAAO,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,eAAe,EAAC,EAAE,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,SAAS,EAAC,MAAM,EAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAI,CACpJ,CACG,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAlCC;IAVC,iBAAiB,CAAwG;QACxH,IAAI,EAAE,sBAAsB;QAC5B,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,qCAAqC,EAAE,qBAAqB,CAAC;YAC9D,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;gDAkCD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug, sanitize } from '@/utils/utils';\nimport { AttachInternals, Component, Host, State, h, Element, Prop, Watch, Event, EventEmitter, Listen } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Conference, Configuration } from '@nylas/core';\nimport { CONFERENCE_PROVIDER_MAP, PROVIDER_CONFERENCE_MAP } from '@/common/constants';\nimport { User } from '@/common/nylas-api-request';\n\nconst labels = {\n none: 'None',\n custom: 'Custom location',\n google: 'Google Meet',\n microsoft: 'Microsoft Teams',\n zoom: 'Zoom Meeting',\n};\n\n/**\n * The `nylas-event-location` component is a form input for the location of an event.\n *\n * @part nel - The event location container\n * @part nel__location - The event location input\n * @part nel__dropdown - The dropdown container\n * @part nel__dropdown-button - The dropdown button\n * @part nel__dropdown-content - The dropdown content\n */\n@Component({\n tag: 'nylas-event-location',\n styleUrl: 'nylas-event-location.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasEventLocation {\n /*\n * The host element <nylas-event-location>\n */\n @Element() host!: HTMLElement;\n /**\n * @standalone\n * The name of the event location input.\n */\n @Prop() name: string = 'location';\n\n /**\n * @standalone\n * The current user\n */\n @Prop() currentUser?: User;\n /**\n * @standalone\n * The users provider\n */\n @Prop() userProvider?: string;\n /**\n * @standalone\n * The event conferencing stored in the configuration\n */\n @Prop() eventConferencing?: Conference;\n /**\n * @standalone\n * The conference providers where the key is the provider name ('zoom') and the value is the grant id.\n * We currently support same provider ('google', 'microsoft') for all participants and 'zoom' for cross-provider conferencing.\n */\n @Prop() conferenceProviders?: Record<string, string>;\n\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The event location stored in the configuration\n */\n @Prop() eventLocation?: string;\n /**\n * The selected event location state. This defaults to the event location from the configuration or an empty string.\n */\n @State() location: string = this.eventLocation ?? '';\n /**\n * The grant id for the conferencing of non-default conferencing options.\n */\n @State() grantId: string = this.eventConferencing ? this.setDefaultGrantID(this.eventConferencing) : '';\n /**\n * The selected location option. This defaults to 'none'.\n */\n @State() selectedLocationOption!: string;\n /**\n * The current user provider state.\n */\n @State() userProviderState: string = this.userProvider ?? this.currentUser?.provider ?? '';\n\n /**\n * The state to store location options.\n */\n @State() locationOptions = [\n { value: 'none', label: labels['none'], labelHTML: this.getLabelHTML('none') },\n { value: 'custom', label: labels['custom'], labelHTML: this.getLabelHTML('custom') },\n ];\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\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-event-location', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-custom-booking-flow', 'selectedConfigurationChangedHandler', newValue);\n const configLocation = newValue?.event_booking?.location;\n const configConferencing = newValue?.event_booking?.conferencing;\n if (configConferencing?.provider) {\n this.selectedLocationOption = this.setDefaultLocationOption(configConferencing, configLocation ?? '');\n this.grantId = this.setDefaultGrantID(configConferencing);\n this.location = configLocation ? configLocation : '';\n } else if (configLocation) {\n this.selectedLocationOption = configLocation ? 'custom' : 'none';\n this.location = configLocation;\n } else {\n this.selectedLocationOption = 'none';\n this.location = '';\n }\n }\n\n @Watch('currentUser')\n currentUserChangedHandler(newValue: User) {\n debug('nylas-custom-booking-flow', 'currentUserChangedHandler', newValue);\n if (newValue?.provider) {\n this.userProviderState = newValue?.provider;\n this.setLocationOptionsForProvider(this.userProviderState);\n }\n }\n\n @Watch('conferenceProviders')\n conferenceProvidersChanged(newValue: Record<string, string>) {\n if (newValue?.['zoom'] && !this.locationOptions.some(option => option.value === 'zoom')) {\n this.locationOptions.push({ value: 'zoom', label: labels['zoom'], labelHTML: this.getLabelHTML('zoom') });\n }\n }\n\n /**\n * This event is fired when the value of the event location changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-event-location', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-event-location', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-event-location', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n } else {\n this.selectedLocationOption = this.setDefaultLocationOption(this.eventConferencing || null, this.eventLocation ?? '');\n }\n\n this.userProviderState = this.userProvider ?? this.currentUser?.provider ?? '';\n this.setLocationOptionsForProvider(this.userProviderState);\n\n if (this.conferenceProviders?.['zoom'] && !this.locationOptions.some(option => option.value === 'zoom')) {\n this.locationOptions.push({ value: 'zoom', label: labels['zoom'], labelHTML: this.getLabelHTML('zoom') });\n }\n }\n\n disconnectedCallback() {\n debug('nylas-event-location', 'disconnectedCallback');\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string }>) {\n this.selectedLocationOption = event.detail.value;\n let payload;\n switch (this.selectedLocationOption) {\n case 'none':\n this.location = '';\n this.setFormValue('', this.name);\n this.valueChanged.emit({ value: '', name: this.name });\n this.valueChanged.emit({ value: JSON.stringify(null), name: 'conference' });\n break;\n case 'custom':\n this.valueChanged.emit({ value: JSON.stringify(null), name: 'conference' });\n break;\n case 'google':\n this.location = '';\n this.setFormValue('', this.name);\n const googleConfGrantId = this.conferenceProviders?.['google'];\n payload = {\n provider: PROVIDER_CONFERENCE_MAP.google,\n autocreate: googleConfGrantId\n ? {\n conf_grant_id: googleConfGrantId,\n }\n : {},\n };\n this.valueChanged.emit({ value: JSON.stringify(payload), name: 'conference' });\n this.valueChanged.emit({ value: '', name: this.name });\n break;\n case 'microsoft':\n this.location = '';\n this.setFormValue('', this.name);\n const microsoftConfGrantId = this.conferenceProviders?.['microsoft'];\n payload = {\n provider: PROVIDER_CONFERENCE_MAP.microsoft,\n autocreate: microsoftConfGrantId\n ? {\n conf_grant_id: microsoftConfGrantId,\n }\n : {},\n };\n this.valueChanged.emit({ value: JSON.stringify(payload), name: 'conference' });\n this.valueChanged.emit({ value: '', name: this.name });\n break;\n case 'zoom':\n this.location = '';\n this.setFormValue('', this.name);\n const zoomConfGrantId = this.conferenceProviders?.['zoom'];\n payload = {\n provider: PROVIDER_CONFERENCE_MAP.zoom,\n autocreate: zoomConfGrantId\n ? {\n conf_grant_id: zoomConfGrantId,\n }\n : {},\n };\n this.valueChanged.emit({ value: JSON.stringify(payload), name: 'conference' });\n this.valueChanged.emit({ value: '', name: this.name });\n break;\n }\n }\n\n setLocationOptionsForProvider(provider: string) {\n switch (provider) {\n case 'google':\n if (!this.locationOptions.some(option => option.value === 'google')) {\n this.locationOptions.push({ value: 'google', label: labels['google'], labelHTML: this.getLabelHTML('google') });\n }\n break;\n case 'microsoft':\n if (!this.locationOptions.some(option => option.value === 'microsoft')) {\n this.locationOptions.push({ value: 'microsoft', label: labels['microsoft'], labelHTML: this.getLabelHTML('microsoft') });\n }\n break;\n }\n }\n\n setDefaultLocationOption(eventConferencing: Conference | null, eventLocation: string) {\n if (eventConferencing != null && eventConferencing?.provider != null && eventConferencing?.autocreate != null) {\n return CONFERENCE_PROVIDER_MAP[eventConferencing?.provider];\n }\n return eventLocation ? 'custom' : 'none';\n }\n setDefaultGrantID(eventConferencing: Conference) {\n if (eventConferencing != null && eventConferencing?.autocreate != null) {\n return eventConferencing?.autocreate?.conf_grant_id;\n }\n return '';\n }\n\n setFormValue(value: string, name: string) {\n if (typeof this.internals.setFormValue === 'function') {\n this.internals.setFormValue(value, name);\n }\n }\n\n handleChange(event) {\n const value = sanitize(event.target.value);\n this.location = value;\n this.setFormValue(value, this.name);\n this.valueChanged.emit({ value: value, name: this.name });\n }\n\n getIcon(location: string) {\n switch (location) {\n case 'none':\n return <location-off-icon />;\n case 'custom':\n return <location-icon />;\n case 'google':\n return <google-meet-icon />;\n case 'microsoft':\n return <microsoft-teams-icon />;\n case 'zoom':\n return <zoom-icon />;\n }\n }\n\n getLabelHTML(location: string) {\n return (\n <span\n class=\"location-label\"\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '16px',\n width: '-webkit-fill-available',\n }}\n >\n {this.getIcon(location)}\n <span\n class=\"location-text\"\n style={{\n fontSize: '14px',\n fontWeight: '400',\n }}\n >\n {labels[location]}\n </span>\n </span>\n );\n }\n\n @RegisterComponent<NylasEventLocation, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-event-location',\n stateToProps: new Map([\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.conferenceProviders', 'conferenceProviders'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n const defaultOption = typeof this.selectedLocationOption !== 'undefined' ? this.locationOptions.find(i => i.value == this.selectedLocationOption) : null;\n return (\n <Host>\n <div class=\"nylas-event-location\" part=\"nel\">\n <label htmlFor=\"location\">\n Event meeting or location\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">Select a conferencing option or add a custom location.</span>\n </tooltip-component>\n </span>\n </label>\n <div class=\"location-input\">\n {defaultOption && defaultOption?.label && (\n <select-dropdown\n withSearch={false}\n name=\"location\"\n options={this.locationOptions}\n defaultSelectedOption={defaultOption}\n exportparts=\"sd_dropdown: nel__dropdown, sd_dropdown-button: nel__dropdown-button, sd_dropdown-content: nel__dropdown-content\"\n >\n <span slot=\"select-icon\">{this.getIcon(this.selectedLocationOption)}</span>\n </select-dropdown>\n )}\n {this.selectedLocationOption === 'custom' && (\n <input type=\"text\" part=\"nel__location\" id=\"location\" name=\"location\" maxlength=\"1024\" value={this.location} onInput={e => this.handleChange(e)} />\n )}\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -239,7 +239,7 @@ export class NylasPageStyling {
239
239
  this.isOpen = !this.isOpen;
240
240
  }
241
241
  render() {
242
- return (h(Host, { key: '1601b88e8e7e2c500cb105f237949faa4e9d8dbd' }, h("div", { key: '2a3072bc409f07961da51439a0f45f930d0725de', part: "nps", class: { 'nylas-page-styling': true, 'no-border': !this.customInputsSlot } }, this.customInputsSlot ? (h("div", { class: "header", part: "nps__header" }, h("div", null, h("h3", null, "Page styling and customization")), h("div", { class: "drawer-toggle", part: "nps__drawer-toggle--container" }, h("span", { class: `chevron ${this.isOpen ? 'open' : 'closed'} `, onClick: () => this.toggleConfirmationEmail() }, h("chevron-icon", { width: "24", height: "24" }))))) : null, h("div", { key: '404727336fdf8d0de2d8e769df1dcc21ae69f34b', id: "nylas-page-styling__body", class: "nylas-page-styling__body", part: "nps__body" }, h("div", { key: '2e7da0539b197347719a1202e04c1f7b238cdc9d', class: { 'nylas-page-styling__section': true, 'no-padding': !this.customInputsSlot } }, h("div", { key: '55ba3e932216f073238b8385071defa9139ca0f9', class: "nylas-page-styling__row" }, h("div", { key: '333576450039ea7f76bfb548c5947609bc813837', class: { subsection: true, hide: !this.isOpen } })))))));
242
+ return (h(Host, { key: 'c2ffa8ae940e9594f254903d45abc3f7c01d7d41' }, h("div", { key: '1813654e2aaa9c66d5a535186f227968b434654c', part: "nps", class: { 'nylas-page-styling': true, 'no-border': !this.customInputsSlot } }, this.customInputsSlot ? (h("div", { class: "header", part: "nps__header" }, h("div", null, h("h3", null, "Page styling and customization")), h("div", { class: "drawer-toggle", part: "nps__drawer-toggle--container" }, h("span", { class: `chevron ${this.isOpen ? 'open' : 'closed'} `, onClick: () => this.toggleConfirmationEmail() }, h("chevron-icon", { width: "24", height: "24" }))))) : null, h("div", { key: 'cff4891eeb1a958feb2a6b20623b97f908721c60', id: "nylas-page-styling__body", class: "nylas-page-styling__body", part: "nps__body" }, h("div", { key: '16b2398f10b6d7703d02bbbf5c43e3e229499b2d', class: { 'nylas-page-styling__section': true, 'no-padding': !this.customInputsSlot } }, h("div", { key: 'fd09434076ea4626ee9d7b2710ec8418325aa117', class: "nylas-page-styling__row" }, h("div", { key: '16a29cabadc4f1a4ba9f389fe232ea22125cfe36', class: { subsection: true, hide: !this.isOpen } })))))));
243
243
  }
244
244
  static get is() { return "nylas-page-styling"; }
245
245
  static get encapsulation() { return "shadow"; }
@@ -397,6 +397,9 @@ export class NylasPageStyling {
397
397
  return [{
398
398
  "propName": "name",
399
399
  "methodName": "elementNameChangedHandler"
400
+ }, {
401
+ "propName": "selectedConfiguration",
402
+ "methodName": "selectedConfigurationChangedHandler"
400
403
  }];
401
404
  }
402
405
  static get listeners() {
@@ -1 +1 @@
1
- {"version":3,"file":"nylas-page-styling.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-page-styling/nylas-page-styling.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAwC9H,MAAM,OAAO,gBAAgB;;;oBAWJ,cAAc;;sBAUX,IAAI;;gCAac,IAAI;;IAiBhD,iBAAiB;QACf,KAAK,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC;IACnD,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IACtD,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;QAChD,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC/B,IAAI,CAAC,mCAAmC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,mBAAmB;QACjB,KAAK,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,CAAC;IACrD,CAAC;IAED,kBAAkB;QAChB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,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AA5BC;IAjBC,iBAAiB,CAAsG;QACtH,IAAI,EAAE,oBAAoB;QAC1B,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,YAAY,EAAE;YACZ,YAAY,EAAE,KAAK,EACjB,KAAiI,EACjI,8BAA6D,EAC7D,EAAE;gBACF,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;gBAEtC,IAAI,YAAY,EAAE,CAAC;oBACjB,YAAY,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;8CA4BD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug, sanitize } 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 { Appearance, Configuration } from '@nylas/core';\n\n/**\n * The `nylas-page-styling` component is a UI component that allows users to customize the styling of the scheduling page.\n * To use this component, pass a slot `custom-page-style-inputs` to the `nylas-scheduler-editor` component with the input\n * fields you want to display. The component will automatically update the appearance object when the input fields are changed.\n * Ensure that the input fields have the `name` attribute set to the key in the appearance object.\n *\n * If you want to style the Nylas hosted scheduler page, you can use this component to customize the appearance of the page.\n * The fields that can be customized in the Nylas hosted scheduler page are:\n * - Primary color: (name: color)\n * - Company logo: (name: company_logo_url)\n * - Submit button label: (name: submit_button_label)\n * - Thank you message: (name: thank_you_message)\n *\n * This component cannot be used as an independent component. It must be used within the `nylas-scheduler-editor` component.\n *\n * @slot custom-page-style-inputs - This slot is used to pass a custom page style form to the Nylas Scheduler Editor component.\n * @part nps - The nylas-page-styling container\n * @part nps__header - The header of the page styling section\n * @part nps__drawer-toggle--container - The page styling drawer toggle container\n * @part nps__body - The body of the page styling section\n * @part nps__title-input-textfield - The page styling page title input textfield\n * @part nps__company-name-input-textfield - The page styling company name input textfield\n * @part nps__input-image-url - The page styling company logo input textfield\n * @part nps__color-picker - The page styling color picker\n * @part nps__color-picker-button - The page styling color picker button\n * @part nps__color-picker-button-label - The page styling color input field label *\n * @part nps__color-picker-button-selected-label - The page styling color picker label denoting which color is selected\n * @part nps__submit-button-label-input-textfield - The page styling submut button label input textfield\n * @part nps__message-textarea - The page styling thank you message textarea\n */\n@Component({\n tag: 'nylas-page-styling',\n styleUrl: 'nylas-page-styling.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasPageStyling {\n @Element() host!: HTMLNylasPageStylingElement;\n /**\n * @internal\n * The selected configuration.\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * @internal\n * The name of the component\n */\n @Prop() name: string = 'page-styling';\n /**\n * @internal\n * The appearance data to display\n */\n @Prop() appearance?: Appearance;\n /**\n * @internal\n * Is the page styling card open\n */\n @Prop() isOpen: boolean = true;\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The confirmation email template state.\n */\n @State() currentAppearance!: Appearance;\n /**\n * The confirmation email template state.\n */\n @State() customInputsSlot: Element | null = null;\n\n /**\n * This event is fired when the email reminders change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n /**\n * This event is fired when the form is submitted in the parent component.\n */\n @Event() bookingFormSubmitted!: EventEmitter<void>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-page-styling', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-page-styling', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-page-styling', '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-page-styling', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n }\n }\n\n componentWillUpdate() {\n debug('nylas-page-styling', 'componentWillUpdate');\n }\n\n componentDidUpdate() {\n debug('nylas-page-styling', 'componentDidUpdate');\n }\n\n componentWillRender() {\n debug('nylas-page-styling', 'componentWillRender');\n }\n\n componentDidRender() {\n debug('nylas-page-styling', '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-page-styling', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n customInputsSlotChangedHandler(newValue: Element | null) {\n debug('nylas-page-styling', 'customInputsSlotChangedHandler', newValue);\n\n const appearance = this.currentAppearance;\n\n function updateInputDefaultValues(element: HTMLElement) {\n // Process elements with a 'name' attribute\n if (element.hasAttribute && element.hasAttribute('name')) {\n const key = element.getAttribute('name');\n if (appearance && key && key in appearance && appearance[key] !== undefined) {\n // Update attributes based on component type\n const componentType = element.getAttribute('component-type');\n\n element.setAttribute('data-page-styling', 'true');\n\n if (componentType === 'checkbox') {\n element.setAttribute('checked', appearance[key]);\n } else if (componentType === 'radio-group') {\n element.setAttribute('default-selected-value', appearance[key]);\n } else if (componentType === 'color-picker') {\n element.setAttribute('default-selected-color', appearance[key]);\n } else if (componentType === 'select-dropdown') {\n const options = element.getAttribute('options');\n const selectedOption = options ? JSON.parse(options).find((option: { value: string }) => option.value === appearance[key]) : null;\n element.setAttribute('default-selected-option', JSON.stringify(selectedOption));\n } else if (componentType === 'image-url') {\n element.setAttribute('image-url', appearance[key]);\n } else {\n // Default case: set the default value\n element.setAttribute('default-value', appearance[key]);\n }\n }\n }\n\n // Recursively process child elements (skip text nodes)\n element.childNodes.forEach(child => {\n if (child.nodeType === Node.ELEMENT_NODE) {\n updateInputDefaultValues(child as HTMLElement); // Cast child to HTMLElement\n }\n });\n }\n\n // Start the recursive process with the cloned element (newValue)\n if (newValue) {\n updateInputDefaultValues(newValue as HTMLElement);\n }\n }\n\n cloneAndCopyProps(element: HTMLElement): HTMLElement {\n // Clone the current element\n const clonedElement = element.cloneNode(false) as HTMLElement; // Do a shallow clone first\n const componentType = element.getAttribute('component-type');\n const key = element.getAttribute('name');\n\n // Copy properties like 'options' and 'value' for custom elements\n if ((element as any).options) {\n const options = (element as any).getAttribute('options');\n console.log('page-styling options', element, options);\n if (typeof options === 'string') {\n try {\n const parsedOptions = JSON.parse(options);\n (clonedElement as any).options = parsedOptions; // Parse the 'options' string\n if (componentType === 'select-dropdown' && key && key in this.currentAppearance) {\n const selectedOption = parsedOptions.find((option: { value: string }) => option.value === this.currentAppearance[key]);\n (clonedElement as any).setAttribute('default-selected-option', JSON.stringify(selectedOption));\n }\n } catch (e) {\n console.error('Error parsing options', e);\n }\n } else {\n (clonedElement as any).options = (element as any).options; // Copy 'options' property\n }\n }\n\n if ((element as any).value) {\n (clonedElement as any).value = (element as any).value; // Copy 'value' property\n }\n\n // Recursively process child elements\n element.childNodes.forEach(child => {\n if (child.nodeType === Node.ELEMENT_NODE) {\n // If the child is an element, recursively clone and process it\n const clonedChild = this.cloneAndCopyProps(child as HTMLElement);\n clonedElement.appendChild(clonedChild); // Append the cloned child to the parent clone\n } else if (child.nodeType === Node.TEXT_NODE) {\n // For text nodes, just clone and append the text content\n clonedElement.appendChild(child.cloneNode(true));\n }\n });\n\n return clonedElement; // Return the cloned element with its children\n }\n\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-page-styling', 'selectedConfigurationChangedHandler', newValue);\n this.currentAppearance = newValue?.appearance || {};\n // Get the slot element\n const editor = document.querySelector('nylas-scheduler-editor');\n const slotElement = editor?.shadowRoot?.querySelector('slot[name=\"custom-page-style-inputs\"]') as HTMLSlotElement;\n if (!slotElement) {\n return;\n }\n\n const divElement = document.createElement('div');\n\n // Get the slotted content (the nodes passed into the slot)\n const slottedElements = slotElement?.assignedElements({ flatten: true });\n // Clone each of the slotted nodes and append them to the cloned slot\n slottedElements?.forEach(element => {\n const clonedElement = this.cloneAndCopyProps(element as HTMLElement); // Clone recursively and copy properties\n\n // Clone the slotted element (deep clone)\n this.customInputsSlotChangedHandler(clonedElement);\n // Append the cloned element to the document fragment\n divElement.appendChild(clonedElement);\n });\n\n // Replace the original content with the new cloned and updated content\n const bodyElement = this.host.shadowRoot?.querySelector('.nylas-page-styling');\n const slotContainer = bodyElement?.querySelector('.nylas-page-styling__body .subsection');\n\n if (slotContainer) {\n // Remove existing children (if necessary) and append the new content\n slotContainer.innerHTML = ''; // Clear existing content\n divElement.childNodes.forEach(child => {\n slotContainer.appendChild(child); // Append each child of divElement\n });\n this.customInputsSlot = divElement;\n }\n }\n\n checkIfElementIsInSlot(name: string): boolean {\n const findElement = document?.querySelector(`[slot=\"custom-page-style-inputs\"] [name=\"${name}\"]`);\n return findElement ? true : false;\n }\n\n @Listen('nylasFormInputChanged', { target: 'document' })\n async nylasFormInputChangeHandler(event: CustomEvent<{ value: string; name: string; type?: string }>) {\n const { name, value } = event.detail;\n const type = event.detail?.type;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n switch (name) {\n case 'submit_button_label':\n this.currentAppearance = { ...this.currentAppearance, submit_button_label: value };\n break;\n case 'thank_you_message':\n if (type === 'multi_line_text') {\n const value = sanitize(event.detail.value);\n this.currentAppearance = { ...this.currentAppearance, thank_you_message: value };\n }\n break;\n default:\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n break;\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormDropdownChanged', { target: 'document' })\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-page-styling', 'nylasFormDropdownChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n if (name === 'color') {\n this.currentAppearance = { ...this.currentAppearance, color: value };\n } else {\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('valueChanged', { target: 'document' })\n valueChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-page-styling', 'valueChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n if (name === 'company_logo_url') {\n this.currentAppearance = { ...this.currentAppearance, company_logo_url: value };\n } else {\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormCheckboxToggled', { target: 'document' })\n checkboxToggledHandler(event: CustomEvent<{ checked: boolean; name: string; label: string }>) {\n const { checked, name } = event.detail;\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n this.currentAppearance = { ...this.currentAppearance, [name]: checked };\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormRadioChanged', { target: 'document' })\n radioChangedHandler(event: CustomEvent<{ value: string; name: string; label: string; type: string }>) {\n const { value, name } = event.detail;\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n this.updateConfirmationFormValue();\n }\n\n updateConfirmationFormValue() {\n debug('nylas-page-styling', 'updateConfirmationFormValue');\n this.internals.setFormValue(JSON.stringify(this.currentAppearance), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.currentAppearance), name: this.name });\n }\n\n toggleConfirmationEmail() {\n this.isOpen = !this.isOpen;\n }\n\n @RegisterComponent<NylasPageStyling, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-page-styling',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\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 return (\n <Host>\n <div part=\"nps\" class={{ 'nylas-page-styling': true, 'no-border': !this.customInputsSlot }}>\n {this.customInputsSlot ? (\n <div class=\"header\" part=\"nps__header\">\n <div>\n <h3>Page styling and customization</h3>\n </div>\n <div class=\"drawer-toggle\" part=\"nps__drawer-toggle--container\">\n <span class={`chevron ${this.isOpen ? 'open' : 'closed'} `} onClick={() => this.toggleConfirmationEmail()}>\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n </div>\n ) : null}\n\n <div id=\"nylas-page-styling__body\" class=\"nylas-page-styling__body\" part=\"nps__body\">\n <div class={{ 'nylas-page-styling__section': true, 'no-padding': !this.customInputsSlot }}>\n <div class=\"nylas-page-styling__row\">\n <div class={{ subsection: true, hide: !this.isOpen }}></div>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"nylas-page-styling.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-page-styling/nylas-page-styling.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,M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AC,MAAM,CAAC;gBAEtC,IAAI,YAAY,EAAE,CAAC;oBACjB,YAAY,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;8CA4BD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug, sanitize } 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 { Appearance, Configuration } from '@nylas/core';\n\n/**\n * The `nylas-page-styling` component is a UI component that allows users to customize the styling of the scheduling page.\n * To use this component, pass a slot `custom-page-style-inputs` to the `nylas-scheduler-editor` component with the input\n * fields you want to display. The component will automatically update the appearance object when the input fields are changed.\n * Ensure that the input fields have the `name` attribute set to the key in the appearance object.\n *\n * If you want to style the Nylas hosted scheduler page, you can use this component to customize the appearance of the page.\n * The fields that can be customized in the Nylas hosted scheduler page are:\n * - Primary color: (name: color)\n * - Company logo: (name: company_logo_url)\n * - Submit button label: (name: submit_button_label)\n * - Thank you message: (name: thank_you_message)\n *\n * This component cannot be used as an independent component. It must be used within the `nylas-scheduler-editor` component.\n *\n * @slot custom-page-style-inputs - This slot is used to pass a custom page style form to the Nylas Scheduler Editor component.\n * @part nps - The nylas-page-styling container\n * @part nps__header - The header of the page styling section\n * @part nps__drawer-toggle--container - The page styling drawer toggle container\n * @part nps__body - The body of the page styling section\n * @part nps__title-input-textfield - The page styling page title input textfield\n * @part nps__company-name-input-textfield - The page styling company name input textfield\n * @part nps__input-image-url - The page styling company logo input textfield\n * @part nps__color-picker - The page styling color picker\n * @part nps__color-picker-button - The page styling color picker button\n * @part nps__color-picker-button-label - The page styling color input field label *\n * @part nps__color-picker-button-selected-label - The page styling color picker label denoting which color is selected\n * @part nps__submit-button-label-input-textfield - The page styling submut button label input textfield\n * @part nps__message-textarea - The page styling thank you message textarea\n */\n@Component({\n tag: 'nylas-page-styling',\n styleUrl: 'nylas-page-styling.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasPageStyling {\n @Element() host!: HTMLNylasPageStylingElement;\n /**\n * @internal\n * The selected configuration.\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * @internal\n * The name of the component\n */\n @Prop() name: string = 'page-styling';\n /**\n * @internal\n * The appearance data to display\n */\n @Prop() appearance?: Appearance;\n /**\n * @internal\n * Is the page styling card open\n */\n @Prop() isOpen: boolean = true;\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The confirmation email template state.\n */\n @State() currentAppearance!: Appearance;\n /**\n * The confirmation email template state.\n */\n @State() customInputsSlot: Element | null = null;\n\n /**\n * This event is fired when the email reminders change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n /**\n * This event is fired when the form is submitted in the parent component.\n */\n @Event() bookingFormSubmitted!: EventEmitter<void>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-page-styling', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-page-styling', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-page-styling', '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-page-styling', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n }\n }\n\n componentWillUpdate() {\n debug('nylas-page-styling', 'componentWillUpdate');\n }\n\n componentDidUpdate() {\n debug('nylas-page-styling', 'componentDidUpdate');\n }\n\n componentWillRender() {\n debug('nylas-page-styling', 'componentWillRender');\n }\n\n componentDidRender() {\n debug('nylas-page-styling', '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-page-styling', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n customInputsSlotChangedHandler(newValue: Element | null) {\n debug('nylas-page-styling', 'customInputsSlotChangedHandler', newValue);\n\n const appearance = this.currentAppearance;\n\n function updateInputDefaultValues(element: HTMLElement) {\n // Process elements with a 'name' attribute\n if (element.hasAttribute && element.hasAttribute('name')) {\n const key = element.getAttribute('name');\n if (appearance && key && key in appearance && appearance[key] !== undefined) {\n // Update attributes based on component type\n const componentType = element.getAttribute('component-type');\n\n element.setAttribute('data-page-styling', 'true');\n\n if (componentType === 'checkbox') {\n element.setAttribute('checked', appearance[key]);\n } else if (componentType === 'radio-group') {\n element.setAttribute('default-selected-value', appearance[key]);\n } else if (componentType === 'color-picker') {\n element.setAttribute('default-selected-color', appearance[key]);\n } else if (componentType === 'select-dropdown') {\n const options = element.getAttribute('options');\n const selectedOption = options ? JSON.parse(options).find((option: { value: string }) => option.value === appearance[key]) : null;\n element.setAttribute('default-selected-option', JSON.stringify(selectedOption));\n } else if (componentType === 'image-url') {\n element.setAttribute('image-url', appearance[key]);\n } else {\n // Default case: set the default value\n element.setAttribute('default-value', appearance[key]);\n }\n }\n }\n\n // Recursively process child elements (skip text nodes)\n element.childNodes.forEach(child => {\n if (child.nodeType === Node.ELEMENT_NODE) {\n updateInputDefaultValues(child as HTMLElement); // Cast child to HTMLElement\n }\n });\n }\n\n // Start the recursive process with the cloned element (newValue)\n if (newValue) {\n updateInputDefaultValues(newValue as HTMLElement);\n }\n }\n\n cloneAndCopyProps(element: HTMLElement): HTMLElement {\n // Clone the current element\n const clonedElement = element.cloneNode(false) as HTMLElement; // Do a shallow clone first\n const componentType = element.getAttribute('component-type');\n const key = element.getAttribute('name');\n\n // Copy properties like 'options' and 'value' for custom elements\n if ((element as any).options) {\n const options = (element as any).getAttribute('options');\n console.log('page-styling options', element, options);\n if (typeof options === 'string') {\n try {\n const parsedOptions = JSON.parse(options);\n (clonedElement as any).options = parsedOptions; // Parse the 'options' string\n if (componentType === 'select-dropdown' && key && key in this.currentAppearance) {\n const selectedOption = parsedOptions.find((option: { value: string }) => option.value === this.currentAppearance[key]);\n (clonedElement as any).setAttribute('default-selected-option', JSON.stringify(selectedOption));\n }\n } catch (e) {\n console.error('Error parsing options', e);\n }\n } else {\n (clonedElement as any).options = (element as any).options; // Copy 'options' property\n }\n }\n\n if ((element as any).value) {\n (clonedElement as any).value = (element as any).value; // Copy 'value' property\n }\n\n // Recursively process child elements\n element.childNodes.forEach(child => {\n if (child.nodeType === Node.ELEMENT_NODE) {\n // If the child is an element, recursively clone and process it\n const clonedChild = this.cloneAndCopyProps(child as HTMLElement);\n clonedElement.appendChild(clonedChild); // Append the cloned child to the parent clone\n } else if (child.nodeType === Node.TEXT_NODE) {\n // For text nodes, just clone and append the text content\n clonedElement.appendChild(child.cloneNode(true));\n }\n });\n\n return clonedElement; // Return the cloned element with its children\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-page-styling', 'selectedConfigurationChangedHandler', newValue);\n this.currentAppearance = newValue?.appearance || {};\n // Get the slot element\n const editor = document.querySelector('nylas-scheduler-editor');\n const slotElement = editor?.shadowRoot?.querySelector('slot[name=\"custom-page-style-inputs\"]') as HTMLSlotElement;\n if (!slotElement) {\n return;\n }\n\n const divElement = document.createElement('div');\n\n // Get the slotted content (the nodes passed into the slot)\n const slottedElements = slotElement?.assignedElements({ flatten: true });\n // Clone each of the slotted nodes and append them to the cloned slot\n slottedElements?.forEach(element => {\n const clonedElement = this.cloneAndCopyProps(element as HTMLElement); // Clone recursively and copy properties\n\n // Clone the slotted element (deep clone)\n this.customInputsSlotChangedHandler(clonedElement);\n // Append the cloned element to the document fragment\n divElement.appendChild(clonedElement);\n });\n\n // Replace the original content with the new cloned and updated content\n const bodyElement = this.host.shadowRoot?.querySelector('.nylas-page-styling');\n const slotContainer = bodyElement?.querySelector('.nylas-page-styling__body .subsection');\n\n if (slotContainer) {\n // Remove existing children (if necessary) and append the new content\n slotContainer.innerHTML = ''; // Clear existing content\n divElement.childNodes.forEach(child => {\n slotContainer.appendChild(child); // Append each child of divElement\n });\n this.customInputsSlot = divElement;\n }\n }\n\n checkIfElementIsInSlot(name: string): boolean {\n const findElement = document?.querySelector(`[slot=\"custom-page-style-inputs\"] [name=\"${name}\"]`);\n return findElement ? true : false;\n }\n\n @Listen('nylasFormInputChanged', { target: 'document' })\n async nylasFormInputChangeHandler(event: CustomEvent<{ value: string; name: string; type?: string }>) {\n const { name, value } = event.detail;\n const type = event.detail?.type;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n switch (name) {\n case 'submit_button_label':\n this.currentAppearance = { ...this.currentAppearance, submit_button_label: value };\n break;\n case 'thank_you_message':\n if (type === 'multi_line_text') {\n const value = sanitize(event.detail.value);\n this.currentAppearance = { ...this.currentAppearance, thank_you_message: value };\n }\n break;\n default:\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n break;\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormDropdownChanged', { target: 'document' })\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-page-styling', 'nylasFormDropdownChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n if (name === 'color') {\n this.currentAppearance = { ...this.currentAppearance, color: value };\n } else {\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('valueChanged', { target: 'document' })\n valueChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-page-styling', 'valueChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n if (name === 'company_logo_url') {\n this.currentAppearance = { ...this.currentAppearance, company_logo_url: value };\n } else {\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormCheckboxToggled', { target: 'document' })\n checkboxToggledHandler(event: CustomEvent<{ checked: boolean; name: string; label: string }>) {\n const { checked, name } = event.detail;\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n this.currentAppearance = { ...this.currentAppearance, [name]: checked };\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormRadioChanged', { target: 'document' })\n radioChangedHandler(event: CustomEvent<{ value: string; name: string; label: string; type: string }>) {\n const { value, name } = event.detail;\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n this.updateConfirmationFormValue();\n }\n\n updateConfirmationFormValue() {\n debug('nylas-page-styling', 'updateConfirmationFormValue');\n this.internals.setFormValue(JSON.stringify(this.currentAppearance), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.currentAppearance), name: this.name });\n }\n\n toggleConfirmationEmail() {\n this.isOpen = !this.isOpen;\n }\n\n @RegisterComponent<NylasPageStyling, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-page-styling',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\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 return (\n <Host>\n <div part=\"nps\" class={{ 'nylas-page-styling': true, 'no-border': !this.customInputsSlot }}>\n {this.customInputsSlot ? (\n <div class=\"header\" part=\"nps__header\">\n <div>\n <h3>Page styling and customization</h3>\n </div>\n <div class=\"drawer-toggle\" part=\"nps__drawer-toggle--container\">\n <span class={`chevron ${this.isOpen ? 'open' : 'closed'} `} onClick={() => this.toggleConfirmationEmail()}>\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n </div>\n ) : null}\n\n <div id=\"nylas-page-styling__body\" class=\"nylas-page-styling__body\" part=\"nps__body\">\n <div class={{ 'nylas-page-styling__section': true, 'no-padding': !this.customInputsSlot }}>\n <div class=\"nylas-page-styling__row\">\n <div class={{ subsection: true, hide: !this.isOpen }}></div>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -122,8 +122,9 @@ export class NylasParticipantsCustomAvailability {
122
122
  return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';
123
123
  }
124
124
  render() {
125
- return (h(Host, { key: '5034211537411e732ffee5f7420884e5908cc4e5' }, h("div", { key: '6d016a9b8a3dd204521d9f63de90cd848e9c49e7', class: "nylas-participants-custom-availability", part: "npca" }, h("div", { key: 'fff77ce67f19e5b0bdc7a8b491ff38b1b7d9af55', class: "header", part: "npca__header" }, h("h3", { key: '656016ac8ee26636fad2e725237b1bb538563864' }, "Participant open hours"), h("p", { key: '87ab243b9f3402150c6dae36fc702d7f675350c3' }, "If not set, the default open hours will be used to calculate availability for this participant.")), h("div", { key: 'ba6c30fbb85fc26d6471494716b18f7f815900ec', class: "content", part: "npca__content" }, h("form", { key: '7cc553b6730ead929fc45efa67b29b56e41f022e', ref: el => (this.participantFormRef = el) }, Object.keys(this.selectedParticipants).map((key, index) => {
125
+ return (h(Host, { key: '64198b8231e1739484f81d02167d7b5f456eda69' }, h("div", { key: '68eb8279c510ef937e19dec06960867c98a5b02a', class: "nylas-participants-custom-availability", part: "npca" }, h("div", { key: '9622d8a7fbc124723cb7135a3a3846fad0e4e458', class: "header", part: "npca__header" }, h("h3", { key: '6424eeeb937ce2225a63d76482ec633efacd9e7a' }, "Participant open hours"), h("p", { key: 'ac021fef4d4b0de03d5e2ca335563ec4f328156c' }, "If not set, the default open hours will be used to calculate availability for this participant.")), h("div", { key: 'e9412e214011b575954196e39ea265dcf86801ec', class: "content", part: "npca__content" }, h("form", { key: 'ab5b4239f2d2b31fcd69d0f2e2d61a8a13003739', ref: el => (this.participantFormRef = el) }, Object.keys(this.selectedParticipants).map((key, index) => {
126
126
  const participant = this.selectedParticipants[key];
127
+ const participantOpenHours = participant.availability?.open_hours || [];
127
128
  if (!participant || !participant.name || !participant.availability)
128
129
  return;
129
130
  return (h("div", { class: "participant-container", part: "npca__participant-container", key: `participant-conatiner-${index}` }, h("div", { class: "participant-title", part: "npca__participant-title" }, h("p", null, participant.name, "'s open hours"), h("div", { class: "participant-toggle", part: "npca__participant-toggle--container" }, h("toggle-switch", { exportparts: "ts_label: npca__toggle-label, ts_input: npca_toggle-input, ts_slider: npca_toggle-slider", name: key, checked: !!participant?.openHours && participant?.openHours.length > 0 }), h("span", { class: `chevron ${participant.isOpen ? 'open' : 'closed'} ${participant.setCustom ? '' : 'disabled'}`, onClick: () => {
@@ -131,7 +132,7 @@ export class NylasParticipantsCustomAvailability {
131
132
  return;
132
133
  this.selectedParticipants[key].isOpen = !participant.isOpen;
133
134
  this.selectedParticipants = { ...this.selectedParticipants };
134
- } }, h("chevron-icon", { width: "24", height: "24" })))), participant.isOpen && (h("nylas-availability-picker", { key: index, name: `participant-${index}-${key}`, openHours: participant.openHours, defaultTimezone: participant.timezone, hideHeader: true }))));
135
+ } }, h("chevron-icon", { width: "24", height: "24" })))), participant.isOpen && (h("nylas-availability-picker", { key: index, name: `participant-${index}-${key}`, openHours: participantOpenHours, defaultTimezone: participant.timezone, hideHeader: true }))));
135
136
  }))))));
136
137
  }
137
138
  static get is() { return "nylas-participants-custom-availability"; }
@@ -1 +1 @@
1
- {"version":3,"file":"nylas-participants-custom-availability.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAA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IAAI,EAAE,eAAe,KAAK,IAAI,GAAG,EAAE,EACnC,SAAS,EAAE,WAAW,CAAC,SAAS,EAChC,eAAe,EAAE,WAAW,CAAC,QAAQ,EACrC,UAAU,EAAE,IAAI,GAChB,CACH,CACG,CACP,CAAC;oBACJ,CAAC,CAAC,CACG,CACH,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AArDC;IANC,iBAAiB,CAAyH;QACzI,IAAI,EAAE,wCAAwC;QAC9C,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iEAqDD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } 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 { Availability, Configuration, OpenHours, Participant } from '@nylas/core';\nimport { DEFAULT_OPEN_HOURS } from '@/common/constants';\n\n/**\n * The `nylas-participants-custom-availability` component is a form input for setting custom availability for participants.\n *\n * @part npca - The participants custom availability container\n * @part npca__header - The header of the participants custom availability\n * @part npca__content - The content of the participants custom availability\n * @part npca__participant-container - The participant container\n * @part npca__participant-title - The title of the participant\n * @part npca__participant-toggle--container - The toggle container for the participant\n * @part npca__toggle-label - The label of the toggle\n * @part npca_toggle-input - The input of the toggle\n * @part npca_toggle-slider - The slider of the toggle\n */\n@Component({\n tag: 'nylas-participants-custom-availability',\n styleUrl: 'nylas-participants-custom-availability.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasParticipantsCustomAvailability {\n @Element() host!: HTMLNylasParticipantsCustomAvailabilityElement;\n private participantFormRef!: HTMLFormElement;\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The name of the participants custom availability.\n */\n @Prop() name: string = 'participant-custom-availability';\n\n /**\n * @standalone\n * The participants selected in the add participants section.\n */\n @Prop() participants: Participant[] = this.selectedConfiguration?.participants || [];\n\n /**\n * This event is fired when the participants custom availability changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The state to store the custom availability setting for participants.\n */\n @State() selectedParticipants: {\n [key: string]: {\n setCustom: boolean;\n isOpen: boolean;\n openHours: OpenHours[];\n name: string;\n availability?: Availability;\n timezone?: string;\n };\n } = this.setParticipants(this.participants);\n\n // Watchers\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-participants-custom-availability', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('participants')\n participantsChangedHandler(newValue: Participant[], oldValue: Participant[]) {\n debug('nylas-participants-custom-availability', 'participantsChangedHandler', newValue, oldValue);\n this.selectedParticipants = this.setParticipants(newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration, oldValue: Configuration) {\n debug('nylas-participants-custom-availability', 'selectedConfigurationChangedHandler', newValue, oldValue);\n if (newValue?.participants) {\n this.selectedParticipants = this.setParticipants(newValue?.participants);\n }\n }\n\n // Lifecycle Methods\n connectedCallback() {\n debug('nylas-participants-custom-availability', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-participants-custom-availability', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-participants-custom-availability', 'componentWillLoad');\n }\n\n componentDidLoad() {\n debug('nylas-participants-custom-availability', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedParticipants = this.setParticipants(this.selectedConfiguration?.participants);\n } else {\n this.selectedParticipants = this.setParticipants(this.participants);\n }\n }\n\n // Event Handlers\n @Listen('nylasFormSwitchToggled')\n nylasFormSwitchToggledHandler(event: CustomEvent<{ checked: boolean; name: string; label: boolean }>) {\n debug('nylas-participants-custom-availability', 'nylasFormSwitchToggledHandler', event.detail);\n const existingParticipant = this.selectedConfiguration?.participants.find(participant => participant.email === event.detail.name);\n const existingOpenHours = existingParticipant?.availability?.open_hours;\n const openHours = existingOpenHours || this.selectedConfiguration?.availability?.availability_rules?.default_open_hours || [];\n const timeZone =\n existingOpenHours && existingOpenHours.length > 0\n ? existingParticipant?.timezone\n : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours?.at(0)?.timezone ||\n this.selectedConfiguration?.event_booking?.timezone ||\n window.Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n this.selectedParticipants[event.detail.name]['isOpen'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['setCustom'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['openHours'] = event.detail.checked ? (openHours?.length > 0 ? openHours : DEFAULT_OPEN_HOURS) : [];\n this.selectedParticipants[event.detail.name]['timezone'] = event.detail.checked ? timeZone : undefined;\n this.selectedParticipants = { ...this.selectedParticipants };\n this.updateFormValue();\n }\n\n @Listen('valueChanged')\n handleValueChanged(event: CustomEvent) {\n debug('[nylas-editor-tabs]', 'handleValueChanged', event);\n const { name, value } = event.detail;\n if (!name.startsWith('participant-')) {\n return;\n }\n // Validate the form\n if (this.isInternalsAvailable) {\n if (!this.participantFormRef.checkValidity()) {\n this.internals.setValidity({ customError: true }, 'Please fix the overlapping time ranges.');\n return;\n } else {\n this.internals.setValidity({});\n }\n }\n\n const jsonValue = JSON.parse(value);\n\n const key = name.split('-')[2];\n if (!this.selectedParticipants[key]) return;\n this.selectedParticipants[key]['openHours'] = jsonValue.openHours;\n this.selectedParticipants = { ...this.selectedParticipants };\n\n this.updateFormValue();\n }\n\n updateFormValue() {\n const participantOpenHours = {};\n const participants = this.selectedConfiguration?.participants || this.participants;\n participants.forEach(participant => {\n participantOpenHours[participant.email] = this.selectedParticipants[participant.email].openHours;\n });\n this.isInternalsAvailable && this.internals.setFormValue(JSON.stringify(participantOpenHours), this.name);\n this.valueChanged.emit({ value: JSON.stringify(participantOpenHours), name: this.name });\n }\n\n setParticipants(participants: Participant[]) {\n const selectedParticipants = {};\n participants?.forEach(participant => {\n selectedParticipants[participant.email] = {\n isOpen: false,\n setCustom: Boolean(participant.availability?.open_hours),\n openHours: participant.availability?.open_hours || [],\n name: participant.name || participant.email,\n availability: participant.availability,\n timezone: participant.timezone,\n };\n });\n return selectedParticipants;\n }\n\n /**\n * This method is essentially a workaround to check if the internals are available because\n * the unit tests in stencil do not support the internals.\n * @returns boolean\n */\n get isInternalsAvailable() {\n return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';\n }\n\n @RegisterComponent<NylasParticipantsCustomAvailability, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-participants-custom-availability',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class=\"nylas-participants-custom-availability\" part=\"npca\">\n <div class=\"header\" part=\"npca__header\">\n <h3>Participant open hours</h3>\n <p>If not set, the default open hours will be used to calculate availability for this participant.</p>\n </div>\n <div class=\"content\" part=\"npca__content\">\n <form ref={el => (this.participantFormRef = el as HTMLFormElement)}>\n {Object.keys(this.selectedParticipants).map((key, index) => {\n const participant = this.selectedParticipants[key];\n if (!participant || !participant.name || !participant.availability) return;\n return (\n <div class=\"participant-container\" part=\"npca__participant-container\" key={`participant-conatiner-${index}`}>\n <div class=\"participant-title\" part=\"npca__participant-title\">\n <p>{participant.name}'s open hours</p>\n <div class=\"participant-toggle\" part=\"npca__participant-toggle--container\">\n <toggle-switch\n exportparts=\"ts_label: npca__toggle-label, ts_input: npca_toggle-input, ts_slider: npca_toggle-slider\"\n name={key}\n checked={!!participant?.openHours && participant?.openHours.length > 0}\n />\n <span\n class={`chevron ${participant.isOpen ? 'open' : 'closed'} ${participant.setCustom ? '' : 'disabled'}`}\n onClick={() => {\n if (!participant.setCustom) return;\n this.selectedParticipants[key].isOpen = !participant.isOpen;\n this.selectedParticipants = { ...this.selectedParticipants };\n }}\n >\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n </div>\n {participant.isOpen && (\n <nylas-availability-picker\n key={index}\n name={`participant-${index}-${key}`}\n openHours={participant.openHours}\n defaultTimezone={participant.timezone}\n hideHeader={true}\n />\n )}\n </div>\n );\n })}\n </form>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"nylas-participants-custom-availability.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAG9H,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAqBxD,MAAM,OAAO,mCAAmC;;;oBAavB,iCAAiC;4BAMlB,IAAI,CAAC,qBAAqB,EAAE,YAAY,IAAI,EAAE;oCA2BhF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC;;IAI3C,yBAAyB,CAAC,QAAgB;QACxC,KAAK,CAAC,wCAAwC,EAAE,2BAA2B,EAAE,QAAQ,CAAC,CAAC;QACvF,IAA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EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iEAsDD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } 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 { Configuration, OpenHours, Participant, ParticipantAvailability } from '@nylas/core';\nimport { DEFAULT_OPEN_HOURS } from '@/common/constants';\n\n/**\n * The `nylas-participants-custom-availability` component is a form input for setting custom availability for participants.\n *\n * @part npca - The participants custom availability container\n * @part npca__header - The header of the participants custom availability\n * @part npca__content - The content of the participants custom availability\n * @part npca__participant-container - The participant container\n * @part npca__participant-title - The title of the participant\n * @part npca__participant-toggle--container - The toggle container for the participant\n * @part npca__toggle-label - The label of the toggle\n * @part npca_toggle-input - The input of the toggle\n * @part npca_toggle-slider - The slider of the toggle\n */\n@Component({\n tag: 'nylas-participants-custom-availability',\n styleUrl: 'nylas-participants-custom-availability.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasParticipantsCustomAvailability {\n @Element() host!: HTMLNylasParticipantsCustomAvailabilityElement;\n private participantFormRef!: HTMLFormElement;\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The name of the participants custom availability.\n */\n @Prop() name: string = 'participant-custom-availability';\n\n /**\n * @standalone\n * The participants selected in the add participants section.\n */\n @Prop() participants: Participant[] = this.selectedConfiguration?.participants || [];\n\n /**\n * This event is fired when the participants custom availability changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The state to store the custom availability setting for participants.\n */\n @State() selectedParticipants: {\n [key: string]: {\n setCustom: boolean;\n isOpen: boolean;\n openHours: OpenHours[];\n name: string;\n availability?: ParticipantAvailability;\n timezone?: string;\n };\n } = this.setParticipants(this.participants);\n\n // Watchers\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-participants-custom-availability', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('participants')\n participantsChangedHandler(newValue: Participant[], oldValue: Participant[]) {\n debug('nylas-participants-custom-availability', 'participantsChangedHandler', newValue, oldValue);\n this.selectedParticipants = this.setParticipants(newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration, oldValue: Configuration) {\n debug('nylas-participants-custom-availability', 'selectedConfigurationChangedHandler', newValue, oldValue);\n if (newValue?.participants) {\n this.selectedParticipants = this.setParticipants(newValue?.participants);\n }\n }\n\n // Lifecycle Methods\n connectedCallback() {\n debug('nylas-participants-custom-availability', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-participants-custom-availability', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-participants-custom-availability', 'componentWillLoad');\n }\n\n componentDidLoad() {\n debug('nylas-participants-custom-availability', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedParticipants = this.setParticipants(this.selectedConfiguration?.participants);\n } else {\n this.selectedParticipants = this.setParticipants(this.participants);\n }\n }\n\n // Event Handlers\n @Listen('nylasFormSwitchToggled')\n nylasFormSwitchToggledHandler(event: CustomEvent<{ checked: boolean; name: string; label: boolean }>) {\n debug('nylas-participants-custom-availability', 'nylasFormSwitchToggledHandler', event.detail);\n const existingParticipant = this.selectedConfiguration?.participants.find(participant => participant.email === event.detail.name);\n const existingOpenHours = existingParticipant?.availability?.open_hours;\n const openHours = existingOpenHours || this.selectedConfiguration?.availability?.availability_rules?.default_open_hours || [];\n const timeZone =\n existingOpenHours && existingOpenHours.length > 0\n ? existingParticipant?.timezone\n : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours?.at(0)?.timezone ||\n this.selectedConfiguration?.event_booking?.timezone ||\n window.Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n this.selectedParticipants[event.detail.name]['isOpen'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['setCustom'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['openHours'] = event.detail.checked ? (openHours?.length > 0 ? openHours : DEFAULT_OPEN_HOURS) : [];\n this.selectedParticipants[event.detail.name]['timezone'] = event.detail.checked ? timeZone : undefined;\n this.selectedParticipants = { ...this.selectedParticipants };\n this.updateFormValue();\n }\n\n @Listen('valueChanged')\n handleValueChanged(event: CustomEvent) {\n debug('[nylas-editor-tabs]', 'handleValueChanged', event);\n const { name, value } = event.detail;\n if (!name.startsWith('participant-')) {\n return;\n }\n // Validate the form\n if (this.isInternalsAvailable) {\n if (!this.participantFormRef.checkValidity()) {\n this.internals.setValidity({ customError: true }, 'Please fix the overlapping time ranges.');\n return;\n } else {\n this.internals.setValidity({});\n }\n }\n\n const jsonValue = JSON.parse(value);\n\n const key = name.split('-')[2];\n if (!this.selectedParticipants[key]) return;\n this.selectedParticipants[key]['openHours'] = jsonValue.openHours;\n this.selectedParticipants = { ...this.selectedParticipants };\n\n this.updateFormValue();\n }\n\n updateFormValue() {\n const participantOpenHours = {};\n const participants = this.selectedConfiguration?.participants || this.participants;\n participants.forEach(participant => {\n participantOpenHours[participant.email] = this.selectedParticipants[participant.email].openHours;\n });\n this.isInternalsAvailable && this.internals.setFormValue(JSON.stringify(participantOpenHours), this.name);\n this.valueChanged.emit({ value: JSON.stringify(participantOpenHours), name: this.name });\n }\n\n setParticipants(participants: Participant[]) {\n const selectedParticipants = {};\n participants?.forEach(participant => {\n selectedParticipants[participant.email] = {\n isOpen: false,\n setCustom: Boolean(participant.availability?.open_hours),\n openHours: participant.availability?.open_hours || [],\n name: participant.name || participant.email,\n availability: participant.availability,\n timezone: participant.timezone,\n };\n });\n return selectedParticipants;\n }\n\n /**\n * This method is essentially a workaround to check if the internals are available because\n * the unit tests in stencil do not support the internals.\n * @returns boolean\n */\n get isInternalsAvailable() {\n return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';\n }\n\n @RegisterComponent<NylasParticipantsCustomAvailability, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-participants-custom-availability',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class=\"nylas-participants-custom-availability\" part=\"npca\">\n <div class=\"header\" part=\"npca__header\">\n <h3>Participant open hours</h3>\n <p>If not set, the default open hours will be used to calculate availability for this participant.</p>\n </div>\n <div class=\"content\" part=\"npca__content\">\n <form ref={el => (this.participantFormRef = el as HTMLFormElement)}>\n {Object.keys(this.selectedParticipants).map((key, index) => {\n const participant = this.selectedParticipants[key];\n const participantOpenHours = participant.availability?.open_hours || [];\n if (!participant || !participant.name || !participant.availability) return;\n return (\n <div class=\"participant-container\" part=\"npca__participant-container\" key={`participant-conatiner-${index}`}>\n <div class=\"participant-title\" part=\"npca__participant-title\">\n <p>{participant.name}'s open hours</p>\n <div class=\"participant-toggle\" part=\"npca__participant-toggle--container\">\n <toggle-switch\n exportparts=\"ts_label: npca__toggle-label, ts_input: npca_toggle-input, ts_slider: npca_toggle-slider\"\n name={key}\n checked={!!participant?.openHours && participant?.openHours.length > 0}\n />\n <span\n class={`chevron ${participant.isOpen ? 'open' : 'closed'} ${participant.setCustom ? '' : 'disabled'}`}\n onClick={() => {\n if (!participant.setCustom) return;\n this.selectedParticipants[key].isOpen = !participant.isOpen;\n this.selectedParticipants = { ...this.selectedParticipants };\n }}\n >\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n </div>\n {participant.isOpen && (\n <nylas-availability-picker\n key={index}\n name={`participant-${index}-${key}`}\n openHours={participantOpenHours}\n defaultTimezone={participant.timezone}\n hideHeader={true}\n />\n )}\n </div>\n );\n })}\n </form>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -16,6 +16,11 @@ const CheckboxComponent = proxyCustomElement(class CheckboxComponent extends HTM
16
16
  this.isChecked = undefined;
17
17
  this.error = '';
18
18
  }
19
+ checkedPropChangedHandler(newValue) {
20
+ if (typeof newValue === 'boolean') {
21
+ this.isChecked = newValue;
22
+ }
23
+ }
19
24
  componentWillLoad() {
20
25
  this.el.setAttribute('component-type', this.componentType);
21
26
  }
@@ -41,9 +46,12 @@ const CheckboxComponent = proxyCustomElement(class CheckboxComponent extends HTM
41
46
  });
42
47
  }
43
48
  render() {
44
- return (h("div", { key: 'f4dfab5a5da9f9c79424930bfd5497c24dc1bfe5', class: "checkbox-container" }, h("label", { key: '78e192f2eddcfd788ac16e80be3ac0b9c47e6f6a' }, h("input", { key: '6e3aa50fb6542cb134dc5454e9fc0052be22e36f', type: "checkbox", name: this.name, checked: this.isChecked, onChange: () => this.toggleCheck() }), h("span", { key: 'abbd103b06bf934eff294b443b468e446901c371', class: "checkmark" }), h("slot", { key: 'f11d669ba02b705ba7679985e83b91086a17ccc9', name: "label" }, h("span", { key: '1298c44fbbe9ce75638b00ac07e6e83bab1394c2', class: "label" }, this.label))), this.error && h("p", { class: "error" }, this.error)));
49
+ return (h("div", { key: '0be06ba2c6b6ed277b3ba736827f9f60e18c6056', class: "checkbox-container" }, h("label", { key: 'a0a0cf6b1f546b8d1485dd3aee1b686f0e9c9cba' }, h("input", { key: '96bdb407b3ab6f668cf94b83e8091a604743f93f', type: "checkbox", name: this.name, checked: this.isChecked, onChange: () => this.toggleCheck() }), h("span", { key: 'd345d3b47c14213487a9108d78abbf0db26f25af', class: "checkmark" }), h("slot", { key: 'aba536e12ed7a97d18790f1a212ead284c1253ec', name: "label" }, h("span", { key: 'e7767302bc6865b99cf42949e8bd032e237d2ad9', class: "label" }, this.label))), this.error && h("p", { class: "error" }, this.error)));
45
50
  }
46
51
  get el() { return this; }
52
+ static get watchers() { return {
53
+ "checked": ["checkedPropChangedHandler"]
54
+ }; }
47
55
  static get style() { return checkboxComponentCss; }
48
56
  }, [1, "checkbox-component", {
49
57
  "name": [1],
@@ -52,7 +60,9 @@ const CheckboxComponent = proxyCustomElement(class CheckboxComponent extends HTM
52
60
  "required": [4],
53
61
  "isChecked": [32],
54
62
  "error": [32]
55
- }, [[4, "bookingFormSubmitted", "handleBookingFormSubmitted"]]]);
63
+ }, [[4, "bookingFormSubmitted", "handleBookingFormSubmitted"]], {
64
+ "checked": ["checkedPropChangedHandler"]
65
+ }]);
56
66
  function defineCustomElement() {
57
67
  if (typeof customElements === "undefined") {
58
68
  return;
@@ -1 +1 @@
1
- {"file":"checkbox-component2.js","mappings":";;AAAA,MAAM,oBAAoB,GAAG,0pEAA0pE;;MCW1qE,iBAAiB;;;;;;QAEX,kBAAa,GAAW,UAAU,CAAC;oBAK7B,UAAU;;qBAQT,EAAE;wBAKE,KAAK;;qBAQR,EAAE;;IAY3B,iBAAiB;QACf,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;KAC5D;IAED,gBAAgB;QACd,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC;KACxC;IAOD,0BAA0B,CAAC,KAAkB;QAC3C,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACpC,IAAI,CAAC,KAAK,GAAG,GAAG,IAAI,CAAC,KAAK,eAAe,CAAC;YAC1C,OAAO;SACR;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;KACF;IAGD,WAAW;QACT,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC;YACjC,OAAO,EAAE,IAAI,CAAC,SAAS;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,oBAAoB,IAC7B,gEACE,8DAAO,IAAI,EAAC,UAAU,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE,GAAI,EACvG,6DAAM,KAAK,EAAC,WAAW,GAAQ,EAC/B,6DAAM,IAAI,EAAC,OAAO,IAChB,6DAAM,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAQ,CAClC,CACD,EACP,IAAI,CAAC,KAAK,IAAI,SAAG,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAK,CAC5C,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/design-system/checkbox-component/checkbox-component.scss?tag=checkbox-component&encapsulation=shadow","src/components/design-system/checkbox-component/checkbox-component.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n.checkbox-container {\n @include default-css-variables;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n p.error {\n color: var(--nylas-error);\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n font-family: var(--nylas-font-family);\n margin: 0;\n }\n}\n\nlabel {\n display: flex;\n align-items: center;\n font-family: var(--nylas-font-family);\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n\n input[type='checkbox'] {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n\n &:focus ~ .checkmark,\n &:hover ~ .checkmark {\n border-color: var(--nylas-primary);\n }\n\n &:checked ~ .checkmark {\n color: var(--nylas-base-0);\n background: var(--nylas-primary)\n url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSI5IiB2aWV3Qm94PSIwIDAgMTIgOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPHBhdGggZD0iTTQuNTc1IDguOTc3cy0uNDA0LS4wMDctLjUzNi0uMTY1TC4wNTcgNS42NGwuODI5LTEuMjI3TDQuNDcgNy4yNjggMTAuOTIxLjA4NmwuOTIzIDEuMTAzLTYuODYzIDcuNjRjLS4xMzQtLjAwMy0uNDA2LjE0OC0uNDA2LjE0OHoiIGZpbGw9IiNGRkYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPg0KPC9zdmc+)\n 50% 40% no-repeat;\n border: 2px solid var(--nylas-primary);\n }\n }\n\n .checkmark {\n border-radius: var(--nylas-border-radius);\n border: 2px solid var(--nylas-base-800);\n position: absolute;\n left: 0;\n top: 2px;\n width: 18px;\n height: 18px;\n cursor: pointer;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .label {\n margin-left: 32px;\n font-size: 16px;\n font-weight: 400;\n color: var(--nylas-base-800);\n line-height: 24px;\n }\n}\n","import { Component, h, Prop, State, Event, EventEmitter, Listen, Element } from '@stencil/core';\n\n/**\n * The `checkbox-component` component is a UI component that allows users to select a checkbox.\n * This component is used in the scheduling form to input checkbox type inputs.\n */\n@Component({\n tag: 'checkbox-component',\n styleUrl: 'checkbox-component.scss',\n shadow: true,\n})\nexport class CheckboxComponent {\n @Element() el!: HTMLElement;\n private readonly componentType: string = 'checkbox';\n\n /**\n * The name of the checkbox. This is used to identify the checkbox when submitting a form.\n */\n @Prop() name: string = 'checkbox';\n /**\n * The default value of the checkbox. This is the value that is displayed when the checkbox is rendered.\n */\n @Prop() checked?: boolean;\n /**\n * The label of the checkbox. This is displayed next to the checkbox.\n */\n @Prop() label: string = '';\n /**\n * Whether the checkbox is required. If true, the checkbox must be checked when submitting a form.\n * Default is false. If the checkbox is required and not checked, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * The checked state of the checkbox.\n */\n @State() isChecked!: boolean;\n /**\n * The error message state.\n */\n @State() error: string = '';\n\n /**\n * This event is fired when the checkbox is toggled.\n */\n @Event() nylasFormCheckboxToggled!: EventEmitter<{\n checked: boolean;\n name: string;\n label: string;\n }>;\n\n // Lifecycle events\n componentWillLoad() {\n this.el.setAttribute('component-type', this.componentType);\n }\n\n componentDidLoad() {\n this.isChecked = this.checked || false;\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n if (this.required && !this.isChecked) {\n this.error = `${this.label} is required.`;\n return;\n }\n if (this.error) {\n event.preventDefault();\n }\n }\n\n // Methods\n toggleCheck() {\n this.error = '';\n this.isChecked = !this.isChecked;\n this.nylasFormCheckboxToggled.emit({\n checked: this.isChecked,\n name: this.name,\n label: this.label,\n });\n }\n\n render() {\n return (\n <div class=\"checkbox-container\">\n <label>\n <input type=\"checkbox\" name={this.name} checked={this.isChecked} onChange={() => this.toggleCheck()} />\n <span class=\"checkmark\"></span>\n <slot name=\"label\">\n <span class=\"label\">{this.label}</span>\n </slot>\n </label>\n {this.error && <p class=\"error\">{this.error}</p>}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"checkbox-component2.js","mappings":";;AAAA,MAAM,oBAAoB,GAAG,0pEAA0pE;;MCW1qE,iBAAiB;;;;;;QAEX,kBAAa,GAAW,UAAU,CAAC;oBAK7B,UAAU;;qBAQT,EAAE;wBAKE,KAAK;;qBAQR,EAAE;;IAY3B,yBAAyB,CAAC,QAAiB;QACzC,IAAI,OAAO,QAAQ,KAAK,SAAS,EAAE;YACjC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;SAC3B;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;;;;;;;;;","names":[],"sources":["src/components/design-system/checkbox-component/checkbox-component.scss?tag=checkbox-component&encapsulation=shadow","src/components/design-system/checkbox-component/checkbox-component.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n.checkbox-container {\n @include default-css-variables;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n p.error {\n color: var(--nylas-error);\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n font-family: var(--nylas-font-family);\n margin: 0;\n }\n}\n\nlabel {\n display: flex;\n align-items: center;\n font-family: var(--nylas-font-family);\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n\n input[type='checkbox'] {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n\n &:focus ~ .checkmark,\n &:hover ~ .checkmark {\n border-color: var(--nylas-primary);\n }\n\n &:checked ~ .checkmark {\n color: var(--nylas-base-0);\n background: var(--nylas-primary)\n url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSI5IiB2aWV3Qm94PSIwIDAgMTIgOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPHBhdGggZD0iTTQuNTc1IDguOTc3cy0uNDA0LS4wMDctLjUzNi0uMTY1TC4wNTcgNS42NGwuODI5LTEuMjI3TDQuNDcgNy4yNjggMTAuOTIxLjA4NmwuOTIzIDEuMTAzLTYuODYzIDcuNjRjLS4xMzQtLjAwMy0uNDA2LjE0OC0uNDA2LjE0OHoiIGZpbGw9IiNGRkYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPg0KPC9zdmc+)\n 50% 40% no-repeat;\n border: 2px solid var(--nylas-primary);\n }\n }\n\n .checkmark {\n border-radius: var(--nylas-border-radius);\n border: 2px solid var(--nylas-base-800);\n position: absolute;\n left: 0;\n top: 2px;\n width: 18px;\n height: 18px;\n cursor: pointer;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .label {\n margin-left: 32px;\n font-size: 16px;\n font-weight: 400;\n color: var(--nylas-base-800);\n line-height: 24px;\n }\n}\n","import { Component, h, Prop, State, Event, EventEmitter, Listen, Element, Watch } from '@stencil/core';\n\n/**\n * The `checkbox-component` component is a UI component that allows users to select a checkbox.\n * This component is used in the scheduling form to input checkbox type inputs.\n */\n@Component({\n tag: 'checkbox-component',\n styleUrl: 'checkbox-component.scss',\n shadow: true,\n})\nexport class CheckboxComponent {\n @Element() el!: HTMLElement;\n private readonly componentType: string = 'checkbox';\n\n /**\n * The name of the checkbox. This is used to identify the checkbox when submitting a form.\n */\n @Prop() name: string = 'checkbox';\n /**\n * The default value of the checkbox. This is the value that is displayed when the checkbox is rendered.\n */\n @Prop() checked?: boolean;\n /**\n * The label of the checkbox. This is displayed next to the checkbox.\n */\n @Prop() label: string = '';\n /**\n * Whether the checkbox is required. If true, the checkbox must be checked when submitting a form.\n * Default is false. If the checkbox is required and not checked, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * The checked state of the checkbox.\n */\n @State() isChecked!: boolean;\n /**\n * The error message state.\n */\n @State() error: string = '';\n\n /**\n * This event is fired when the checkbox is toggled.\n */\n @Event() nylasFormCheckboxToggled!: EventEmitter<{\n checked: boolean;\n name: string;\n label: string;\n }>;\n\n @Watch('checked')\n checkedPropChangedHandler(newValue: boolean) {\n if (typeof newValue === 'boolean') {\n this.isChecked = newValue;\n }\n }\n\n // Lifecycle events\n componentWillLoad() {\n this.el.setAttribute('component-type', this.componentType);\n }\n\n componentDidLoad() {\n this.isChecked = this.checked || false;\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n if (this.required && !this.isChecked) {\n this.error = `${this.label} is required.`;\n return;\n }\n if (this.error) {\n event.preventDefault();\n }\n }\n\n // Methods\n toggleCheck() {\n this.error = '';\n this.isChecked = !this.isChecked;\n this.nylasFormCheckboxToggled.emit({\n checked: this.isChecked,\n name: this.name,\n label: this.label,\n });\n }\n\n render() {\n return (\n <div class=\"checkbox-container\">\n <label>\n <input type=\"checkbox\" name={this.name} checked={this.isChecked} onChange={() => this.toggleCheck()} />\n <span class=\"checkmark\"></span>\n <slot name=\"label\">\n <span class=\"label\">{this.label}</span>\n </slot>\n </label>\n {this.error && <p class=\"error\">{this.error}</p>}\n </div>\n );\n }\n}\n"],"version":3}