@nylas/web-elements 0.0.0-test-20250319204140 → 0.0.0-test-20250320184617

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 (172) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +26 -26
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4813 -4805
  3. package/dist/cjs/button-component_2.cjs.entry.js +1 -1
  4. package/dist/cjs/button-component_2.cjs.entry.js.map +1 -1
  5. package/dist/cjs/calendar-agenda-fill-icon_36.cjs.entry.js +17 -18
  6. package/dist/cjs/calendar-agenda-fill-icon_36.cjs.entry.js.map +1 -1
  7. package/dist/cjs/chevron-icon_3.cjs.entry.js +1 -1
  8. package/dist/cjs/chevron-icon_3.cjs.entry.js.map +1 -1
  9. package/dist/cjs/google-logo-icon_6.cjs.entry.js +5 -5
  10. package/dist/cjs/google-logo-icon_6.cjs.entry.js.map +1 -1
  11. package/dist/cjs/input-dropdown_2.cjs.entry.js +2 -2
  12. package/dist/cjs/input-dropdown_2.cjs.entry.js.map +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/multi-select-dropdown_2.cjs.entry.js +2 -2
  15. package/dist/cjs/multi-select-dropdown_2.cjs.entry.js.map +1 -1
  16. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +14 -10
  17. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js.map +1 -1
  18. package/dist/cjs/nylas-key-points.cjs.entry.js +1 -1
  19. package/dist/cjs/nylas-key-points.cjs.entry.js.map +1 -1
  20. package/dist/cjs/nylas-provider.cjs.entry.js +1 -1
  21. package/dist/cjs/nylas-provider.cjs.entry.js.map +1 -1
  22. package/dist/cjs/nylas-scheduling.cjs.entry.js +1 -1
  23. package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
  24. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  25. package/dist/cjs/{scheduler-store-c1fc5cf3.js → scheduler-store-df3a9a3a.js} +9 -1
  26. package/dist/cjs/scheduler-store-df3a9a3a.js.map +1 -0
  27. package/dist/collection/components/design-system/button-component/button-component.js +4 -3
  28. package/dist/collection/components/design-system/button-component/button-component.js.map +1 -1
  29. package/dist/collection/components/design-system/input-dropdown/input-dropdown.js +10 -7
  30. package/dist/collection/components/design-system/input-dropdown/input-dropdown.js.map +1 -1
  31. package/dist/collection/components/design-system/multi-select-dropdown/multi-select-dropdown.js +5 -4
  32. package/dist/collection/components/design-system/multi-select-dropdown/multi-select-dropdown.js.map +1 -1
  33. package/dist/collection/components/design-system/select-dropdown/select-dropdown.js +13 -9
  34. package/dist/collection/components/design-system/select-dropdown/select-dropdown.js.map +1 -1
  35. package/dist/collection/components/design-system/time-period-selector/time-period-selector.js +3 -3
  36. package/dist/collection/components/design-system/time-period-selector/time-period-selector.js.map +1 -1
  37. package/dist/collection/components/nylas-notebook/nylas-key-points/nylas-key-points.js +4 -3
  38. package/dist/collection/components/nylas-notebook/nylas-key-points/nylas-key-points.js.map +1 -1
  39. package/dist/collection/components/nylas-provider/nylas-provider.js +1 -1
  40. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js +13 -11
  41. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js.map +1 -1
  42. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +3 -3
  43. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js.map +1 -1
  44. package/dist/collection/components/scheduler/nylas-booking-form/test/nylas-booking-form.spec.js +8 -6
  45. package/dist/collection/components/scheduler/nylas-booking-form/test/nylas-booking-form.spec.js.map +1 -1
  46. package/dist/collection/components/scheduler/nylas-organizer-confirmation-card/nylas-organizer-confirmation-card.js +8 -10
  47. package/dist/collection/components/scheduler/nylas-organizer-confirmation-card/nylas-organizer-confirmation-card.js.map +1 -1
  48. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js +2 -2
  49. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js.map +1 -1
  50. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js +2 -2
  51. package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js.map +1 -1
  52. package/dist/collection/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.js +36 -21
  53. package/dist/collection/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.js.map +1 -1
  54. package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js +15 -16
  55. package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js.map +1 -1
  56. package/dist/collection/connector/nylas-scheduler-connector/errors/index.js +1 -29
  57. package/dist/collection/connector/nylas-scheduler-connector/errors/index.js.map +1 -1
  58. package/dist/collection/connector/shared/api/auth.js.map +1 -1
  59. package/dist/collection/connector/shared/api/scheduler.js.map +1 -1
  60. package/dist/collection/types/index.js +29 -0
  61. package/dist/collection/types/index.js.map +1 -1
  62. package/dist/components/button-component2.js +1 -1
  63. package/dist/components/button-component2.js.map +1 -1
  64. package/dist/components/input-dropdown2.js +1 -1
  65. package/dist/components/input-dropdown2.js.map +1 -1
  66. package/dist/components/multi-select-dropdown2.js +2 -2
  67. package/dist/components/multi-select-dropdown2.js.map +1 -1
  68. package/dist/components/nylas-booked-event-card2.js +9 -5
  69. package/dist/components/nylas-booked-event-card2.js.map +1 -1
  70. package/dist/components/nylas-booking-form2.js +3 -3
  71. package/dist/components/nylas-booking-form2.js.map +1 -1
  72. package/dist/components/nylas-buffer-time2.js +2 -2
  73. package/dist/components/nylas-buffer-time2.js.map +1 -1
  74. package/dist/components/nylas-editor-tabs-group2.js +5 -5
  75. package/dist/components/nylas-editor-tabs-group2.js.map +1 -1
  76. package/dist/components/nylas-event-duration2.js +15 -16
  77. package/dist/components/nylas-event-duration2.js.map +1 -1
  78. package/dist/components/nylas-key-points.js +1 -1
  79. package/dist/components/nylas-key-points.js.map +1 -1
  80. package/dist/components/nylas-organizer-confirmation-card2.js +4 -4
  81. package/dist/components/nylas-organizer-confirmation-card2.js.map +1 -1
  82. package/dist/components/nylas-provider.js.map +1 -1
  83. package/dist/components/nylas-scheduling.js.map +1 -1
  84. package/dist/components/scheduler-store.js +8 -0
  85. package/dist/components/scheduler-store.js.map +1 -1
  86. package/dist/components/select-dropdown2.js +1 -1
  87. package/dist/components/select-dropdown2.js.map +1 -1
  88. package/dist/components/time-period-selector2.js +1 -1
  89. package/dist/components/time-period-selector2.js.map +1 -1
  90. package/dist/esm/button-component_2.entry.js +1 -1
  91. package/dist/esm/button-component_2.entry.js.map +1 -1
  92. package/dist/esm/calendar-agenda-fill-icon_36.entry.js +17 -18
  93. package/dist/esm/calendar-agenda-fill-icon_36.entry.js.map +1 -1
  94. package/dist/esm/chevron-icon_3.entry.js +1 -1
  95. package/dist/esm/chevron-icon_3.entry.js.map +1 -1
  96. package/dist/esm/google-logo-icon_6.entry.js +5 -5
  97. package/dist/esm/google-logo-icon_6.entry.js.map +1 -1
  98. package/dist/esm/input-dropdown_2.entry.js +2 -2
  99. package/dist/esm/input-dropdown_2.entry.js.map +1 -1
  100. package/dist/esm/loader.js +1 -1
  101. package/dist/esm/multi-select-dropdown_2.entry.js +2 -2
  102. package/dist/esm/multi-select-dropdown_2.entry.js.map +1 -1
  103. package/dist/esm/nylas-booked-event-card_12.entry.js +14 -10
  104. package/dist/esm/nylas-booked-event-card_12.entry.js.map +1 -1
  105. package/dist/esm/nylas-key-points.entry.js +1 -1
  106. package/dist/esm/nylas-key-points.entry.js.map +1 -1
  107. package/dist/esm/nylas-provider.entry.js +1 -1
  108. package/dist/esm/nylas-provider.entry.js.map +1 -1
  109. package/dist/esm/nylas-scheduling.entry.js +1 -1
  110. package/dist/esm/nylas-scheduling.entry.js.map +1 -1
  111. package/dist/esm/nylas-web-elements.js +1 -1
  112. package/dist/esm/{scheduler-store-bbb4cf8d.js → scheduler-store-ef022be9.js} +9 -1
  113. package/dist/esm/scheduler-store-ef022be9.js.map +1 -0
  114. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  115. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  116. package/dist/nylas-web-elements/{p-c3cfe486.entry.js → p-09bbd467.entry.js} +2 -2
  117. package/dist/nylas-web-elements/p-09bbd467.entry.js.map +1 -0
  118. package/dist/nylas-web-elements/{p-6371e0a3.entry.js → p-0d80f50b.entry.js} +2 -2
  119. package/dist/nylas-web-elements/p-0d80f50b.entry.js.map +1 -0
  120. package/dist/nylas-web-elements/p-13a6c977.entry.js +2 -0
  121. package/dist/nylas-web-elements/p-13a6c977.entry.js.map +1 -0
  122. package/dist/nylas-web-elements/{p-14569ed8.entry.js → p-1fb32e0e.entry.js} +2 -2
  123. package/dist/nylas-web-elements/p-1fb32e0e.entry.js.map +1 -0
  124. package/dist/nylas-web-elements/{p-19f6fcf8.entry.js → p-3ca36162.entry.js} +2 -2
  125. package/dist/nylas-web-elements/p-3ca36162.entry.js.map +1 -0
  126. package/dist/nylas-web-elements/{p-78bd1f85.entry.js → p-51434e4a.entry.js} +2 -2
  127. package/dist/nylas-web-elements/p-51434e4a.entry.js.map +1 -0
  128. package/dist/nylas-web-elements/p-731a856b.js +2 -0
  129. package/dist/nylas-web-elements/p-731a856b.js.map +1 -0
  130. package/dist/nylas-web-elements/p-7b787c73.entry.js +8 -0
  131. package/dist/nylas-web-elements/p-7b787c73.entry.js.map +1 -0
  132. package/dist/nylas-web-elements/{p-f7ea608d.entry.js → p-a906d005.entry.js} +2 -2
  133. package/dist/nylas-web-elements/p-a906d005.entry.js.map +1 -0
  134. package/dist/nylas-web-elements/p-ab3ba8dc.entry.js +2 -0
  135. package/dist/nylas-web-elements/p-ab3ba8dc.entry.js.map +1 -0
  136. package/dist/nylas-web-elements/{p-91bc630c.entry.js → p-b1c57792.entry.js} +2 -2
  137. package/dist/nylas-web-elements/p-b1c57792.entry.js.map +1 -0
  138. package/dist/types/components/design-system/button-component/button-component.d.ts +1 -2
  139. package/dist/types/components/design-system/input-dropdown/input-dropdown.d.ts +1 -6
  140. package/dist/types/components/design-system/multi-select-dropdown/multi-select-dropdown.d.ts +1 -7
  141. package/dist/types/components/design-system/select-dropdown/select-dropdown.d.ts +1 -6
  142. package/dist/types/components/design-system/time-period-selector/time-period-selector.d.ts +1 -1
  143. package/dist/types/components/nylas-notebook/nylas-key-points/nylas-key-points.d.ts +1 -6
  144. package/dist/types/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.d.ts +2 -1
  145. package/dist/types/components/scheduler/nylas-booking-form/nylas-booking-form.d.ts +1 -1
  146. package/dist/types/components/scheduler/nylas-organizer-confirmation-card/nylas-organizer-confirmation-card.d.ts +1 -1
  147. package/dist/types/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.d.ts +17 -16
  148. package/dist/types/components/scheduler-editor/nylas-event-duration/nylas-event-duration.d.ts +2 -2
  149. package/dist/types/components.d.ts +17 -17
  150. package/dist/types/connector/nylas-connector/index.d.ts +1 -1
  151. package/dist/types/connector/nylas-scheduler-connector/errors/index.d.ts +1 -31
  152. package/dist/types/connector/shared/api/auth.d.ts +1 -1
  153. package/dist/types/connector/shared/api/scheduler.d.ts +1 -1
  154. package/dist/types/types/index.d.ts +36 -0
  155. package/package.json +2 -2
  156. package/dist/cjs/scheduler-store-c1fc5cf3.js.map +0 -1
  157. package/dist/esm/scheduler-store-bbb4cf8d.js.map +0 -1
  158. package/dist/nylas-web-elements/p-14569ed8.entry.js.map +0 -1
  159. package/dist/nylas-web-elements/p-19f6fcf8.entry.js.map +0 -1
  160. package/dist/nylas-web-elements/p-463d9c42.entry.js +0 -8
  161. package/dist/nylas-web-elements/p-463d9c42.entry.js.map +0 -1
  162. package/dist/nylas-web-elements/p-6371e0a3.entry.js.map +0 -1
  163. package/dist/nylas-web-elements/p-78bd1f85.entry.js.map +0 -1
  164. package/dist/nylas-web-elements/p-91bc630c.entry.js.map +0 -1
  165. package/dist/nylas-web-elements/p-ac757a7b.entry.js +0 -2
  166. package/dist/nylas-web-elements/p-ac757a7b.entry.js.map +0 -1
  167. package/dist/nylas-web-elements/p-b0f18064.entry.js +0 -2
  168. package/dist/nylas-web-elements/p-b0f18064.entry.js.map +0 -1
  169. package/dist/nylas-web-elements/p-c3cfe486.entry.js.map +0 -1
  170. package/dist/nylas-web-elements/p-f0c25e38.js +0 -2
  171. package/dist/nylas-web-elements/p-f0c25e38.js.map +0 -1
  172. package/dist/nylas-web-elements/p-f7ea608d.entry.js.map +0 -1
@@ -27,10 +27,10 @@ export class NylasEventDuration {
27
27
  this.durationIncrement = undefined;
28
28
  this.error = '';
29
29
  this.durationMinutesOptions = [
30
- { value: 15, label: '15' },
31
- { value: 30, label: '30' },
32
- { value: 45, label: '45' },
33
- { value: 60, label: '60' },
30
+ { value: (15).toString(), label: '15' },
31
+ { value: (30).toString(), label: '30' },
32
+ { value: (45).toString(), label: '45' },
33
+ { value: (60).toString(), label: '60' },
34
34
  ];
35
35
  }
36
36
  elementNameChangedHandler(newValue) {
@@ -81,14 +81,14 @@ export class NylasEventDuration {
81
81
  setDurationMintueOptions() {
82
82
  if (this.durationIncrement === 1) {
83
83
  this.durationMinutesOptions = [
84
- { value: 15, label: '15' },
85
- { value: 30, label: '30' },
86
- { value: 45, label: '45' },
87
- { value: 60, label: '60' },
84
+ { value: (15).toString(), label: '15' },
85
+ { value: (30).toString(), label: '30' },
86
+ { value: (45).toString(), label: '45' },
87
+ { value: (60).toString(), label: '60' },
88
88
  ];
89
89
  }
90
90
  else {
91
- this.durationMinutesOptions = Array.from({ length: 23 }, (_, i) => ({ value: i + 1, label: (i + 1).toString() }));
91
+ this.durationMinutesOptions = Array.from({ length: 23 }, (_, i) => ({ value: (i + 1).toString(), label: (i + 1).toString() }));
92
92
  }
93
93
  return this.durationMinutesOptions;
94
94
  }
@@ -110,7 +110,7 @@ export class NylasEventDuration {
110
110
  nylasFormDropdownChangedHandler(event) {
111
111
  debug('nylas-calendar-picker', 'nylasFormDropdownChangedHandler', event.detail);
112
112
  const { value } = event.detail;
113
- this.durationIncrement = parseInt(value);
113
+ this.durationIncrement = parseInt(value.toString());
114
114
  if (this.durationIncrement === 1) {
115
115
  this.duration = 60;
116
116
  }
@@ -128,9 +128,8 @@ export class NylasEventDuration {
128
128
  inputOptionChangedHandler(event) {
129
129
  debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);
130
130
  const { value } = event.detail;
131
- this.duration = value;
131
+ this.duration = parseFloat(value.toString());
132
132
  this.durationMinutes = this.duration * this.durationIncrement;
133
- console.log('###errror:', this.validateDuration(), this.durationMinutes, this.durationIncrement);
134
133
  if (this.validateDuration() !== '') {
135
134
  return;
136
135
  }
@@ -139,12 +138,12 @@ export class NylasEventDuration {
139
138
  }
140
139
  render() {
141
140
  const durationOptions = [
142
- { value: 1, label: i18next.t('timeDuration', { context: 'minute' }) },
143
- { value: 60, label: i18next.t('timeDuration', { context: 'hour' }) },
141
+ { value: (1).toString(), label: i18next.t('timeDuration', { context: 'minute' }) },
142
+ { value: (60).toString(), label: i18next.t('timeDuration', { context: 'hour' }) },
144
143
  ];
145
- return (h(Host, { key: 'c0525f28dbeb2398489d58d64d7b8e400ca13424' }, h("div", { key: '5ae98592a0364146987a3d2e4eee5e5f80a80097', class: "nylas-event-duration", part: "ned" }, h("label", { key: 'dc4ebcc5dbf749afbdbe27373a8d9904c2343433', htmlFor: "duration" }, i18next.t('nylasEventDuration.headerTitle'), h("span", { key: '449d71a0f7479fad65ab3c00481cdf3f2cb6ed55', class: "required" }, "*")), h("div", { key: '807948b6f03032d24d5d93013f64f279bc92682b', class: "nylas-event-duration__wrapper" }, h("input-dropdown", { key: '2e47a704274e2cb19a7045ddd31e8c10e0a668b8', class: this.error ? 'error' : '', name: 'event-duration', options: this.durationMinutesOptions, inputValue: this.duration.toString(), exportparts: "id_dropdown: ned__input_dropdown, id_dropdown-input: ned__input_dropdown-input, id_dropdown-content: ned__input_dropdown-content", defaultInputOption: this.durationMinutesOptions.find(i => i.value == this.duration) }), this.durationIncrement && (h("select-dropdown", { name: 'event-duration', options: durationOptions, pluralizedLabel: this.duration > 1
144
+ return (h(Host, { key: '291d5aada4656f1e7a3ad639459090a164c667cd' }, h("div", { key: '389ed738c72f9af0b2413360ca30048a903fe834', class: "nylas-event-duration", part: "ned" }, h("label", { key: '3ab5ae91a80a98386cd77ffc2ed9bee1773e2cce', htmlFor: "duration" }, i18next.t('nylasEventDuration.headerTitle'), h("span", { key: 'a3eb28826f0237e227c6b9c4fbbbbb96544df143', class: "required" }, "*")), h("div", { key: '48e6f8aebb8f14fbe0ff74a600c1d06f0b65d2b4', class: "nylas-event-duration__wrapper" }, h("input-dropdown", { key: '4502e6a0eea47789edb136886dc0de048893b639', class: this.error ? 'error' : '', name: 'event-duration', options: this.durationMinutesOptions, inputValue: this.duration.toString(), exportparts: "id_dropdown: ned__input_dropdown, id_dropdown-input: ned__input_dropdown-input, id_dropdown-content: ned__input_dropdown-content", defaultInputOption: this.durationMinutesOptions.find(i => i.value === this.duration.toString()) }), this.durationIncrement && (h("select-dropdown", { name: 'event-duration', options: durationOptions, pluralizedLabel: this.duration > 1
146
145
  ? i18next.t(`time.${this.durationIncrement === 60 ? 'hours' : 'minutes'}`)
147
- : i18next.t(`time.${this.durationIncrement === 60 ? 'hour' : 'minute'}`), exportparts: "sd_dropdown: ned__dropdown, sd_dropdown-button: ned__dropdown-button, sd_dropdown-content: ned__dropdown-content", defaultSelectedOption: durationOptions.find(i => i.value == this.durationIncrement), withSearch: false }))), h("div", { key: '1b7710bb059db3bde722f17ed7660698e3f6988a', class: `nylas-event-duration__error-container ${this.error ? 'visible' : ''}`, part: "ned__error-container" }, h("div", { key: '7e90795969a0fb22703217671cca38ffbb23d2a8', class: "nylas-event-duration__error", part: "ned__error" }, this.error)))));
146
+ : i18next.t(`time.${this.durationIncrement === 60 ? 'hour' : 'minute'}`), exportparts: "sd_dropdown: ned__dropdown, sd_dropdown-button: ned__dropdown-button, sd_dropdown-content: ned__dropdown-content", defaultSelectedOption: durationOptions.find(i => i.value === this.durationIncrement.toString()), withSearch: false }))), h("div", { key: 'f847e873066be7c174f7c5eea94e4cdc473d1ecd', class: `nylas-event-duration__error-container ${this.error ? 'visible' : ''}`, part: "ned__error-container" }, h("div", { key: '7cac0c1055ce71dd4de9cf08558d74c051527eb5', class: "nylas-event-duration__error", part: "ned__error" }, this.error)))));
148
147
  }
149
148
  static get is() { return "nylas-event-duration"; }
150
149
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"nylas-event-duration.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-event-duration/nylas-event-duration.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,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAG9H,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAmBnD,MAAM,OAAO,kBAAkB;;;oBAeN,UAAU;;;wBAeL,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAAE;;;qBAYlI,EAAE;sCAIO;YAChC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;YAC1B,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;YAC1B,EAAE,KAAK,EAAE,EAAE,EAAE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4DAAK,KAAK,EAAE,yCAAyC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAC,sBAAsB;oBAC7G,4DAAK,KAAK,EAAC,6BAA6B,EAAC,IAAI,EAAC,YAAY,IACvD,IAAI,CAAC,KAAK,CACP,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AA9CC;IATC,iBAAiB,CAAwG;QACxH,IAAI,EAAE,sBAAsB;QAC5B,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,kCAAkC,EAAE,kBAAkB,CAAC;SACzD,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;gDA8CD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Listen, State, h, Element, Prop, Watch, Event, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Configuration } from '@nylas/core';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE } from '@/common/constants';\n\n/**\n * The `nylas-event-duration` component is a form input for the duration of an event.\n *\n * @part ned - The event duration container\n * @part ned__dropdown - The dropdown container for the duration increment\n * @part ned__dropdown-button - The dropdown button for the duration increment\n * @part ned__dropdown-content - The dropdown content for the duration increment\n * @part ned__input_dropdown - The input dropdown container for the duration minutes\n * @part ned__input_dropdown-input - The input for the duration minutes\n * @part ned__input_dropdown-content - The dropdown content for the input duration minutes\n */\n@Component({\n tag: 'nylas-event-duration',\n styleUrl: 'nylas-event-duration.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasEventDuration {\n /**\n * The host element <nylas-event-duration>\n */\n @Element() host!: HTMLElement;\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The name of the event duration. Default is 'duration'.\n */\n @Prop() name: string = 'duration';\n /**\n * @standalone\n * The event duration in minutes as set in the configuration.\n */\n @Prop() eventDurationMinutes?: number;\n\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: LANGUAGE_CODE;\n\n /**\n * The selected event duration state. This defaults to the event duration from the configuration or 30 minutes.\n */\n @State() duration: number = this.eventDurationMinutes ? (this.eventDurationMinutes >= 60 ? this.eventDurationMinutes / 60 : this.eventDurationMinutes) : 30;\n /**\n * The duration in minutes. This defaults to the event duration from the configuration or 30 minutes.\n */\n @State() durationMinutes!: number;\n /**\n * The duration increment. This defaults to minute(s).\n */\n @State() durationIncrement!: number;\n /**\n * The error message for the duration.\n */\n @State() error: string = '';\n /**\n * The durationMinutesOptions for the dropdown.\n */\n @State() durationMinutesOptions = [\n { value: 15, label: '15' },\n { value: 30, label: '30' },\n { value: 45, label: '45' },\n { value: 60, label: '60' },\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-duration', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newVal: Configuration) {\n const configDuration = newVal?.availability?.duration_minutes;\n if (configDuration) {\n this.duration = configDuration >= 60 ? configDuration / 60 : configDuration;\n this.durationMinutes = configDuration ? configDuration : 30;\n this.durationIncrement = configDuration >= 60 ? 60 : 1;\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), 'duration');\n }\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChangedHandler(newVal: LANGUAGE_CODE, oldVal: LANGUAGE_CODE) {\n if (newVal === oldVal) return;\n i18next.changeLanguage(newVal);\n if (this.error) {\n this.validateDuration();\n }\n }\n\n /**\n * Event emitted when the event duration changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-event-duration', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-event-duration', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-event-duration', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n }\n this.duration = this.duration ? this.duration : this.eventDurationMinutes ? (this.eventDurationMinutes >= 60 ? this.eventDurationMinutes / 60 : this.eventDurationMinutes) : 30;\n this.durationMinutes = this.durationMinutes ? this.durationMinutes : this.duration ? this.duration : 30;\n this.durationIncrement = this.durationIncrement ? this.durationIncrement : this.duration >= 60 ? 60 : 1;\n this.setDurationMintueOptions();\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), 'duration');\n }\n\n disconnectedCallback() {\n debug('nylas-event-duration', 'disconnectedCallback');\n }\n\n get isInternalsAvailable() {\n return typeof this.internals !== 'undefined' && typeof this.internals.setFormValue === 'function';\n }\n\n setDurationMintueOptions() {\n if (this.durationIncrement === 1) {\n this.durationMinutesOptions = [\n { value: 15, label: '15' },\n { value: 30, label: '30' },\n { value: 45, label: '45' },\n { value: 60, label: '60' },\n ];\n } else {\n this.durationMinutesOptions = Array.from({ length: 23 }, (_, i) => ({ value: i + 1, label: (i + 1).toString() }));\n }\n return this.durationMinutesOptions;\n }\n\n validateDuration() {\n if (this.durationMinutes % 5 !== 0) {\n this.error = i18next.t('nylasEventDuration.error.durationMustBeMultipleOf5');\n this.isInternalsAvailable && this.internals.setValidity({ customError: true }, this.error);\n } else if (this.durationMinutes <= 0) {\n this.error = i18next.t('nylasEventDuration.error.durationMustBeGreaterThan0');\n this.isInternalsAvailable && this.internals.setValidity({ customError: true }, this.error);\n } else {\n this.error = '';\n this.isInternalsAvailable && this.internals.setValidity({});\n }\n return this.error;\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-calendar-picker', 'nylasFormDropdownChangedHandler', event.detail);\n const { value } = event.detail;\n this.durationIncrement = parseInt(value);\n if (this.durationIncrement === 1) {\n this.duration = 60;\n } else {\n this.duration = 1;\n }\n this.setDurationMintueOptions();\n this.durationMinutes = this.duration * this.durationIncrement;\n if (this.validateDuration() !== '') {\n return;\n }\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), this.name);\n this.valueChanged.emit({ value: this.durationMinutes.toString(), name: this.name });\n }\n\n @Listen('inputOptionChanged')\n inputOptionChangedHandler(event: CustomEvent<{ value: number; name: string }>) {\n debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);\n const { value } = event.detail;\n this.duration = value;\n this.durationMinutes = this.duration * this.durationIncrement;\n console.log('###errror:', this.validateDuration(), this.durationMinutes, this.durationIncrement);\n if (this.validateDuration() !== '') {\n return;\n }\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), this.name);\n this.valueChanged.emit({ value: this.durationMinutes.toString(), name: this.name });\n }\n\n @RegisterComponent<NylasEventDuration, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-event-duration',\n stateToProps: new Map([\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.selectedLanguage', 'selectedLanguage'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n const durationOptions = [\n { value: 1, label: i18next.t('timeDuration', { context: 'minute' }) },\n { value: 60, label: i18next.t('timeDuration', { context: 'hour' }) },\n ];\n\n return (\n <Host>\n <div class=\"nylas-event-duration\" part=\"ned\">\n <label htmlFor=\"duration\">\n {i18next.t('nylasEventDuration.headerTitle')}\n <span class=\"required\">*</span>\n </label>\n <div class=\"nylas-event-duration__wrapper\">\n <input-dropdown\n class={this.error ? 'error' : ''}\n name={'event-duration'}\n options={this.durationMinutesOptions}\n inputValue={this.duration.toString()}\n exportparts=\"id_dropdown: ned__input_dropdown, id_dropdown-input: ned__input_dropdown-input, id_dropdown-content: ned__input_dropdown-content\"\n defaultInputOption={this.durationMinutesOptions.find(i => i.value == this.duration)}\n />\n {this.durationIncrement && (\n <select-dropdown\n name={'event-duration'}\n options={durationOptions}\n pluralizedLabel={\n this.duration > 1\n ? i18next.t(`time.${this.durationIncrement === 60 ? 'hours' : 'minutes'}`)\n : i18next.t(`time.${this.durationIncrement === 60 ? 'hour' : 'minute'}`)\n }\n exportparts=\"sd_dropdown: ned__dropdown, sd_dropdown-button: ned__dropdown-button, sd_dropdown-content: ned__dropdown-content\"\n defaultSelectedOption={durationOptions.find(i => i.value == this.durationIncrement)}\n withSearch={false}\n />\n )}\n </div>\n <div class={`nylas-event-duration__error-container ${this.error ? 'visible' : ''}`} part=\"ned__error-container\">\n <div class=\"nylas-event-duration__error\" part=\"ned__error\">\n {this.error}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"nylas-event-duration.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-event-duration/nylas-event-duration.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,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAg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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AA9CC;IATC,iBAAiB,CAAwG;QACxH,IAAI,EAAE,sBAAsB;QAC5B,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,kCAAkC,EAAE,kBAAkB,CAAC;SACzD,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;gDA8CD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Listen, State, h, Element, Prop, Watch, Event, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Configuration } from '@nylas/core';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE } from '@/common/constants';\n\n/**\n * The `nylas-event-duration` component is a form input for the duration of an event.\n *\n * @part ned - The event duration container\n * @part ned__dropdown - The dropdown container for the duration increment\n * @part ned__dropdown-button - The dropdown button for the duration increment\n * @part ned__dropdown-content - The dropdown content for the duration increment\n * @part ned__input_dropdown - The input dropdown container for the duration minutes\n * @part ned__input_dropdown-input - The input for the duration minutes\n * @part ned__input_dropdown-content - The dropdown content for the input duration minutes\n */\n@Component({\n tag: 'nylas-event-duration',\n styleUrl: 'nylas-event-duration.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasEventDuration {\n /**\n * The host element <nylas-event-duration>\n */\n @Element() host!: HTMLElement;\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The name of the event duration. Default is 'duration'.\n */\n @Prop() name: string = 'duration';\n /**\n * @standalone\n * The event duration in minutes as set in the configuration.\n */\n @Prop() eventDurationMinutes?: number;\n\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: LANGUAGE_CODE;\n\n /**\n * The selected event duration state. This defaults to the event duration from the configuration or 30 minutes.\n */\n @State() duration: number = this.eventDurationMinutes ? (this.eventDurationMinutes >= 60 ? this.eventDurationMinutes / 60 : this.eventDurationMinutes) : 30;\n /**\n * The duration in minutes. This defaults to the event duration from the configuration or 30 minutes.\n */\n @State() durationMinutes!: number;\n /**\n * The duration increment. This defaults to minute(s).\n */\n @State() durationIncrement!: number;\n /**\n * The error message for the duration.\n */\n @State() error: string = '';\n /**\n * The durationMinutesOptions for the dropdown.\n */\n @State() durationMinutesOptions = [\n { value: (15).toString(), label: '15' },\n { value: (30).toString(), label: '30' },\n { value: (45).toString(), label: '45' },\n { value: (60).toString(), label: '60' },\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-duration', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newVal: Configuration) {\n const configDuration = newVal?.availability?.duration_minutes;\n if (configDuration) {\n this.duration = configDuration >= 60 ? configDuration / 60 : configDuration;\n this.durationMinutes = configDuration ? configDuration : 30;\n this.durationIncrement = configDuration >= 60 ? 60 : 1;\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), 'duration');\n }\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChangedHandler(newVal: LANGUAGE_CODE, oldVal: LANGUAGE_CODE) {\n if (newVal === oldVal) return;\n i18next.changeLanguage(newVal);\n if (this.error) {\n this.validateDuration();\n }\n }\n\n /**\n * Event emitted when the event duration changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-event-duration', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-event-duration', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-event-duration', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n }\n this.duration = this.duration ? this.duration : this.eventDurationMinutes ? (this.eventDurationMinutes >= 60 ? this.eventDurationMinutes / 60 : this.eventDurationMinutes) : 30;\n this.durationMinutes = this.durationMinutes ? this.durationMinutes : this.duration ? this.duration : 30;\n this.durationIncrement = this.durationIncrement ? this.durationIncrement : this.duration >= 60 ? 60 : 1;\n this.setDurationMintueOptions();\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), 'duration');\n }\n\n disconnectedCallback() {\n debug('nylas-event-duration', 'disconnectedCallback');\n }\n\n get isInternalsAvailable() {\n return typeof this.internals !== 'undefined' && typeof this.internals.setFormValue === 'function';\n }\n\n setDurationMintueOptions() {\n if (this.durationIncrement === 1) {\n this.durationMinutesOptions = [\n { value: (15).toString(), label: '15' },\n { value: (30).toString(), label: '30' },\n { value: (45).toString(), label: '45' },\n { value: (60).toString(), label: '60' },\n ];\n } else {\n this.durationMinutesOptions = Array.from({ length: 23 }, (_, i) => ({ value: (i + 1).toString(), label: (i + 1).toString() }));\n }\n return this.durationMinutesOptions;\n }\n\n validateDuration() {\n if (this.durationMinutes % 5 !== 0) {\n this.error = i18next.t('nylasEventDuration.error.durationMustBeMultipleOf5');\n this.isInternalsAvailable && this.internals.setValidity({ customError: true }, this.error);\n } else if (this.durationMinutes <= 0) {\n this.error = i18next.t('nylasEventDuration.error.durationMustBeGreaterThan0');\n this.isInternalsAvailable && this.internals.setValidity({ customError: true }, this.error);\n } else {\n this.error = '';\n this.isInternalsAvailable && this.internals.setValidity({});\n }\n return this.error;\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-calendar-picker', 'nylasFormDropdownChangedHandler', event.detail);\n const { value } = event.detail;\n this.durationIncrement = parseInt(value.toString());\n if (this.durationIncrement === 1) {\n this.duration = 60;\n } else {\n this.duration = 1;\n }\n this.setDurationMintueOptions();\n this.durationMinutes = this.duration * this.durationIncrement;\n if (this.validateDuration() !== '') {\n return;\n }\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), this.name);\n this.valueChanged.emit({ value: this.durationMinutes.toString(), name: this.name });\n }\n\n @Listen('inputOptionChanged')\n inputOptionChangedHandler(event: CustomEvent<{ value: number; name: string }>) {\n debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);\n const { value } = event.detail;\n this.duration = parseFloat(value.toString());\n this.durationMinutes = this.duration * this.durationIncrement;\n if (this.validateDuration() !== '') {\n return;\n }\n this.isInternalsAvailable && this.internals.setFormValue(this.durationMinutes.toString(), this.name);\n this.valueChanged.emit({ value: this.durationMinutes.toString(), name: this.name });\n }\n\n @RegisterComponent<NylasEventDuration, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-event-duration',\n stateToProps: new Map([\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.selectedLanguage', 'selectedLanguage'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n const durationOptions = [\n { value: (1).toString(), label: i18next.t('timeDuration', { context: 'minute' }) },\n { value: (60).toString(), label: i18next.t('timeDuration', { context: 'hour' }) },\n ];\n\n return (\n <Host>\n <div class=\"nylas-event-duration\" part=\"ned\">\n <label htmlFor=\"duration\">\n {i18next.t('nylasEventDuration.headerTitle')}\n <span class=\"required\">*</span>\n </label>\n <div class=\"nylas-event-duration__wrapper\">\n <input-dropdown\n class={this.error ? 'error' : ''}\n name={'event-duration'}\n options={this.durationMinutesOptions}\n inputValue={this.duration.toString()}\n exportparts=\"id_dropdown: ned__input_dropdown, id_dropdown-input: ned__input_dropdown-input, id_dropdown-content: ned__input_dropdown-content\"\n defaultInputOption={this.durationMinutesOptions.find(i => i.value === this.duration.toString())}\n />\n {this.durationIncrement && (\n <select-dropdown\n name={'event-duration'}\n options={durationOptions}\n pluralizedLabel={\n this.duration > 1\n ? i18next.t(`time.${this.durationIncrement === 60 ? 'hours' : 'minutes'}`)\n : i18next.t(`time.${this.durationIncrement === 60 ? 'hour' : 'minute'}`)\n }\n exportparts=\"sd_dropdown: ned__dropdown, sd_dropdown-button: ned__dropdown-button, sd_dropdown-content: ned__dropdown-content\"\n defaultSelectedOption={durationOptions.find(i => i.value === this.durationIncrement.toString())}\n withSearch={false}\n />\n )}\n </div>\n <div class={`nylas-event-duration__error-container ${this.error ? 'visible' : ''}`} part=\"ned__error-container\">\n <div class=\"nylas-event-duration__error\" part=\"ned__error\">\n {this.error}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -1,32 +1,4 @@
1
- export var ErrorCategory;
2
- (function (ErrorCategory) {
3
- ErrorCategory["Component"] = "component";
4
- ErrorCategory["Api"] = "api";
5
- ErrorCategory["Auth"] = "auth";
6
- })(ErrorCategory || (ErrorCategory = {}));
7
- export var ComponentErrorType;
8
- (function (ComponentErrorType) {
9
- ComponentErrorType["endtime_not_in_future"] = "endtime_not_in_future";
10
- ComponentErrorType["no_booking_info"] = "no_booking_info";
11
- ComponentErrorType["no_timeslot_selected"] = "no_timeslot_selected";
12
- ComponentErrorType["no_timezone_selected"] = "no_timezone_selected";
13
- ComponentErrorType["no_booking_id"] = "no_booking_id";
14
- ComponentErrorType["no_salt"] = "no_salt";
15
- ComponentErrorType["invalid_start_time"] = "invalid_start_time";
16
- ComponentErrorType["invalid_end_time"] = "invalid_end_time";
17
- ComponentErrorType["invalid_timezone"] = "invalid_timezone";
18
- ComponentErrorType["no_config_id"] = "no_config_id";
19
- })(ComponentErrorType || (ComponentErrorType = {}));
20
- export var APIErrorType;
21
- (function (APIErrorType) {
22
- APIErrorType["invalid_session"] = "invalid_session";
23
- APIErrorType["general_error"] = "general_error";
24
- APIErrorType["internal_error"] = "internal_error";
25
- APIErrorType["invalid_request_error"] = "invalid_request_error";
26
- APIErrorType["timeslot_not_available"] = "timeslot_not_available";
27
- APIErrorType["provider_error"] = "provider_error";
28
- APIErrorType["not_found_error"] = "not_found_error";
29
- })(APIErrorType || (APIErrorType = {}));
1
+ import { ErrorCategory } from "../../../types/index";
30
2
  export class Errors {
31
3
  constructor() {
32
4
  this.component = (_title) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/connector/nylas-scheduler-connector/errors/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,4BAAW,CAAA;IACX,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAQD,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,qEAA+C,CAAA;IAC/C,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,mEAA6C,CAAA;IAC7C,qDAA+B,CAAA;IAC/B,yCAAmB,CAAA;IACnB,+DAAyC,CAAA;IACzC,2DAAqC,CAAA;IACrC,2DAAqC,CAAA;IACrC,mDAA6B,CAAA;AAC/B,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,CAAN,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,mDAAmC,CAAA;IACnC,+CAA+B,CAAA;IAC/B,iDAAiC,CAAA;IACjC,+DAA+C,CAAA;IAC/C,iEAAiD,CAAA;IACjD,iDAAiC,CAAA;IACjC,mDAAmC,CAAA;AACrC,CAAC,EARW,YAAY,KAAZ,YAAY,QAQvB;AAED,MAAM,OAAO,MAAM;IAAnB;QACE,cAAS,GAAG,CAAC,MAAc,EAAkE,EAAE;YAC7F,MAAM,QAAQ,GAAG,aAAa,CAAC,SAAS,CAAC;YACzC,MAAM,KAAK,GAAG,GAAG,MAAM,QAAQ,CAAC;YAChC,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AO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;QAEF,QAAG,GAAG,CAAC,MAAc,EAA2D,EAAE;YAChF,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC;YACnC,MAAM,KAAK,GAAG,GAAG,MAAM,QAAQ,CAAC;YAEhC,OAAO;gBACL,eAAe,EAAE,CAAC,OAAe,EAAE,EAAE;oBACnC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,aAAa,EAAE,CAAC,OAAe,EAAE,EAAE;oBACjC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;oBAClC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,qBAAqB,EAAE,CAAC,OAAe,EAAE,EAAE;oBACzC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,sBAAsB,EAAE,CAAC,OAAe,EAAE,EAAE;oBAC1C,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;oBAClC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,eAAe,EAAE,CAAC,OAAe,EAAE,EAAE;oBACnC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA","sourcesContent":["export enum ErrorCategory {\n Component = 'component',\n Api = 'api',\n Auth = 'auth',\n}\n\nexport interface ErrorDetails {\n title: string;\n message: string;\n category: ErrorCategory;\n}\n\nexport enum ComponentErrorType {\n endtime_not_in_future = 'endtime_not_in_future',\n no_booking_info = 'no_booking_info',\n no_timeslot_selected = 'no_timeslot_selected',\n no_timezone_selected = 'no_timezone_selected',\n no_booking_id = 'no_booking_id',\n no_salt = 'no_salt',\n invalid_start_time = 'invalid_start_time',\n invalid_end_time = 'invalid_end_time',\n invalid_timezone = 'invalid_timezone',\n no_config_id = 'no_config_id',\n}\n\nexport enum APIErrorType {\n invalid_session = 'invalid_session',\n general_error = 'general_error',\n internal_error = 'internal_error',\n invalid_request_error = 'invalid_request_error',\n timeslot_not_available = 'timeslot_not_available',\n provider_error = 'provider_error',\n not_found_error = 'not_found_error',\n}\n\nexport class Errors {\n component = (_title: string): Record<ComponentErrorType, (message?: string) => ErrorDetails> => {\n const category = ErrorCategory.Component;\n const title = `${_title} Error`;\n return {\n endtime_not_in_future: (message: string = '\"endtime\" can not be in the future') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_info: (message: string = 'No booking info provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timeslot_selected: (message: string = 'No timeslot selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timezone_selected: (message: string = 'No timezone selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_id: (message: string = 'No booking id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_salt: (message: string = 'No salt provided') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_start_time: (message: string = 'Invalid start time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_end_time: (message: string = 'Invalid end time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_timezone: (message: string = 'Invalid timezone') => {\n return {\n title,\n message,\n category,\n };\n },\n no_config_id: (message: string = 'No configuration id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n\n api = (_title: string): Record<APIErrorType, (message: string) => ErrorDetails> => {\n const category = ErrorCategory.Api;\n const title = `${_title} Error`;\n\n return {\n invalid_session: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n general_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n internal_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_request_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n timeslot_not_available: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n provider_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n not_found_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/connector/nylas-scheduler-connector/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,aAAa,EAAgB,MAAM,eAAe,CAAC;AAE9F,MAAM,OAAO,MAAM;IAAnB;QACE,cAAS,GAAG,CAAC,MAAc,EAAkE,EAAE;YAC7F,MAAM,QAAQ,GAAG,aAAa,CAAC,SAAS,CAAC;YACzC,MAAM,KAAK,GAAG,GAAG,MAAM,QAAQ,CAAC;YAChC,OAAO;gBACL,qBAAqB,EAAE,CAAC,UAAkB,oCAAoC,EAAE,EAAE;oBAChF,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,eAAe,EAAE,CAAC,UAAkB,0BAA0B,EAAE,EAAE;oBAChE,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,oBAAoB,EAAE,CAAC,UAAkB,sBAAsB,EAAE,EAAE;oBACjE,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,oBAAoB,EAAE,CAAC,UAAkB,sBAAsB,EAAE,EAAE;oBACjE,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,aAAa,EAAE,CAAC,UAAkB,wBAAwB,EAAE,EAAE;oBAC5D,OAAO;wBACL,KAAK;wBAC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BACD,qBAAqB,EAAE,CAAC,OAAe,EAAE,EAAE;oBACzC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,sBAAsB,EAAE,CAAC,OAAe,EAAE,EAAE;oBAC1C,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;oBAClC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;gBACD,eAAe,EAAE,CAAC,OAAe,EAAE,EAAE;oBACnC,OAAO;wBACL,KAAK;wBACL,OAAO;wBACP,QAAQ;qBACT,CAAC;gBACJ,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA","sourcesContent":["import { APIErrorType, ComponentErrorType, ErrorCategory, ErrorDetails } from '@/types/index';\n\nexport class Errors {\n component = (_title: string): Record<ComponentErrorType, (message?: string) => ErrorDetails> => {\n const category = ErrorCategory.Component;\n const title = `${_title} Error`;\n return {\n endtime_not_in_future: (message: string = '\"endtime\" can not be in the future') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_info: (message: string = 'No booking info provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timeslot_selected: (message: string = 'No timeslot selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timezone_selected: (message: string = 'No timezone selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_id: (message: string = 'No booking id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_salt: (message: string = 'No salt provided') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_start_time: (message: string = 'Invalid start time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_end_time: (message: string = 'Invalid end time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_timezone: (message: string = 'Invalid timezone') => {\n return {\n title,\n message,\n category,\n };\n },\n no_config_id: (message: string = 'No configuration id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n\n api = (_title: string): Record<APIErrorType, (message: string) => ErrorDetails> => {\n const category = ErrorCategory.Api;\n const title = `${_title} Error`;\n\n return {\n invalid_session: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n general_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n internal_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_request_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n timeslot_not_available: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n provider_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n not_found_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/connector/shared/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,MAAM,OAAO,kBAAkB;IAI7B,YAAY,SAAwB,EAAE,cAAkC;QACtE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAQM,KAAK,CAAC,eAAe;QAC1B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxD,IAAI,CAAC,eAAe,EAAE,CAAC;YAErB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;aAAM,CAAC;YAEN,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YACpD,IAAI,SAAS,EAAE,CAAC;gBAEd,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;gBACtC,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;gBAE3D,IAAI,SAAS,CA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AI,IAAI,EAAE,CAAC;YACT,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;YAC1E,IAAI,SAAS,EAAE,CAAC;gBACd,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;gBACjD,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { debug } from '@/utils/utils';\nimport { NylasAuthStoreType, NylasAuthType } from '../../..';\nimport { TokenInfo } from '@nylas/core/lib/auth';\nexport class NylasAuthConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n }\n\n /**\n * Validates the current session and updates the store with the token info\n * if the user is authenticated.\n * If the user is not authenticated, the store is reset.\n * @returns {Promise<void>}\n */\n public async validateSession(): Promise<void> {\n const isAuthenticated = await this.isAccessTokenValid();\n if (!isAuthenticated) {\n // Reset the store if the access token is not valid\n this.logout();\n } else {\n // If the user is authenticated, update the store with the token info\n let tokenInfo = await this.nylasAuth.getTokenInfo();\n if (tokenInfo) {\n // If token is expired or about to expire (in 5 minutes), refresh it\n const expireTimeCheck = 5 * 60 * 1000; // 5 minutes\n const currentTimeInSeconds = Math.floor(Date.now() / 1000);\n\n if (tokenInfo.expires_in && tokenInfo.expires_in - currentTimeInSeconds < expireTimeCheck) {\n debug('[NylasAuthConnectorMixin] Refreshing access token');\n tokenInfo = await this.nylasAuth.refreshAccessToken();\n if (!tokenInfo) {\n debug('[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out.');\n this.logout();\n return;\n }\n }\n\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n }\n }\n this.nylasAuthStore.state.isAuthenticated = isAuthenticated;\n }\n\n /**\n * Returns true if the user is authenticated.\n * @returns {Promise<boolean>}\n */\n public async isAuthenticated(): Promise<boolean> {\n return this.nylasAuth.isAuthenticated();\n }\n\n /**\n * Returns the token info if the user is authenticated.\n * @returns {Promise<TokenInfo>}\n */\n public async getTokenInfo(): Promise<TokenInfo | null> {\n return this.nylasAuth.getTokenInfo();\n }\n\n /**\n * Returns true if the access token is valid.\n * @returns {Promise<boolean>}\n */\n public async isAccessTokenValid(): Promise<boolean> {\n return this.nylasAuth.isAccessTokenValid();\n }\n\n /**\n * Removes the token info from the store and logs the user out.\n * @returns {Promise<void>}\n */\n public async logout(): Promise<void> {\n await this.nylasAuth.logout();\n }\n\n /**\n * Returns the URL to redirect the user to for authentication.\n * @param scopes An array of scopes to request from the user.\n * @param email The email address of the user to authenticate.\n * @param provider The provider to use for authentication.\n * @returns {Promise<string>}\n */\n public async getHostedAuthRedirectURL(scopes?: string[], email?: string, provider?: string): Promise<string> {\n return this.nylasAuth.getHostedAuthRedirectURL(scopes, email, provider);\n }\n\n /**\n * Exchanges the auth code for a token info and updates the store.\n * @param currentUrl The current URL of the page.\n * @returns {Promise<TokenInfo | null>}\n */\n public async manageHostedAuthCodeExchange(currentUrl: string): Promise<TokenInfo | null> {\n const url = new URL(currentUrl);\n const code = url.searchParams.get('code');\n\n if (code) {\n const tokenInfo = await this.nylasAuth.exchangeAuthCodeForTokenInfo(code);\n if (tokenInfo) {\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n this.nylasAuthStore.state.isAuthenticated = true;\n return tokenInfo;\n }\n }\n\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/connector/shared/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,MAAM,OAAO,kBAAkB;IAI7B,YAAY,SAAwB,EAAE,cAAkC;QACtE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AC;IACvC,CAAC;IAMM,KAAK,CAAC,kBAAkB;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC;IAC7C,CAAC;IAMM,KAAK,CAAC,MAAM;QACjB,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IASM,KAAK,CAAC,wBAAwB,CAAC,MAAiB,EAAE,KAAc,EAAE,QAAiB;QACxF,OAAO,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1E,CAAC;IAOM,KAAK,CAAC,4BAA4B,CAAC,UAAkB;QAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;YAC1E,IAAI,SAAS,EAAE,CAAC;gBACd,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;gBACjD,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { debug } from '@/utils/utils';\nimport { NylasAuthStoreType, NylasAuthType } from '../../..';\nimport { TokenInfo } from '@nylas/core/dist/auth';\nexport class NylasAuthConnector {\n private nylasAuth: NylasAuthType;\n private nylasAuthStore: NylasAuthStoreType;\n\n constructor(nylasAuth: NylasAuthType, nylasAuthStore: NylasAuthStoreType) {\n this.nylasAuth = nylasAuth;\n this.nylasAuthStore = nylasAuthStore;\n }\n\n /**\n * Validates the current session and updates the store with the token info\n * if the user is authenticated.\n * If the user is not authenticated, the store is reset.\n * @returns {Promise<void>}\n */\n public async validateSession(): Promise<void> {\n const isAuthenticated = await this.isAccessTokenValid();\n if (!isAuthenticated) {\n // Reset the store if the access token is not valid\n this.logout();\n } else {\n // If the user is authenticated, update the store with the token info\n let tokenInfo = await this.nylasAuth.getTokenInfo();\n if (tokenInfo) {\n // If token is expired or about to expire (in 5 minutes), refresh it\n const expireTimeCheck = 5 * 60 * 1000; // 5 minutes\n const currentTimeInSeconds = Math.floor(Date.now() / 1000);\n\n if (tokenInfo.expires_in && tokenInfo.expires_in - currentTimeInSeconds < expireTimeCheck) {\n debug('[NylasAuthConnectorMixin] Refreshing access token');\n tokenInfo = await this.nylasAuth.refreshAccessToken();\n if (!tokenInfo) {\n debug('[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out.');\n this.logout();\n return;\n }\n }\n\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n }\n }\n this.nylasAuthStore.state.isAuthenticated = isAuthenticated;\n }\n\n /**\n * Returns true if the user is authenticated.\n * @returns {Promise<boolean>}\n */\n public async isAuthenticated(): Promise<boolean> {\n return this.nylasAuth.isAuthenticated();\n }\n\n /**\n * Returns the token info if the user is authenticated.\n * @returns {Promise<TokenInfo>}\n */\n public async getTokenInfo(): Promise<TokenInfo | null> {\n return this.nylasAuth.getTokenInfo();\n }\n\n /**\n * Returns true if the access token is valid.\n * @returns {Promise<boolean>}\n */\n public async isAccessTokenValid(): Promise<boolean> {\n return this.nylasAuth.isAccessTokenValid();\n }\n\n /**\n * Removes the token info from the store and logs the user out.\n * @returns {Promise<void>}\n */\n public async logout(): Promise<void> {\n await this.nylasAuth.logout();\n }\n\n /**\n * Returns the URL to redirect the user to for authentication.\n * @param scopes An array of scopes to request from the user.\n * @param email The email address of the user to authenticate.\n * @param provider The provider to use for authentication.\n * @returns {Promise<string>}\n */\n public async getHostedAuthRedirectURL(scopes?: string[], email?: string, provider?: string): Promise<string> {\n return this.nylasAuth.getHostedAuthRedirectURL(scopes, email, provider);\n }\n\n /**\n * Exchanges the auth code for a token info and updates the store.\n * @param currentUrl The current URL of the page.\n * @returns {Promise<TokenInfo | null>}\n */\n public async manageHostedAuthCodeExchange(currentUrl: string): Promise<TokenInfo | null> {\n const url = new URL(currentUrl);\n const code = url.searchParams.get('code');\n\n if (code) {\n const tokenInfo = await this.nylasAuth.exchangeAuthCodeForTokenInfo(code);\n if (tokenInfo) {\n this.nylasAuthStore.state.tokenInfo = tokenInfo;\n this.nylasAuthStore.state.isAuthenticated = true;\n return tokenInfo;\n }\n }\n\n return null;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../../../src/connector/shared/api/scheduler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,MAAM,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,OAAO,MAAM,cAAc,CAAC;AAenC,MAAM,OAAO,yBAAyB;IASpC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAqC;QAF/G,WAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAG5B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,SAAS;YACnB,CAAC,CAAC;gBACE,aAAa,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE;aAC1C;YACH,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;IASM,KAAK,CAAC,cAAc,CAAI,IAAY,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AAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,EAAE,CAAC;gBACvF,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACjD,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,SAAyB,CAAC,CAAC,YAAY,CAAC,CAAC;YAC5G,CAAC;YACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QACtD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { AvailabilityResponse, NylasSchedulerBookingDataWithFlatFields, NylasEvent, UISettingsResponse } from '@/common/types';\nimport { NylasSchedulerStoreType } from '../../../components';\nimport type { NylasErrorResponse, NylasResponse, NylasSchedulerBookingData, NylasSchedulerResponse, Timeslot } from '@nylas/core';\nimport { APIErrorType, Errors } from '@/connector/nylas-scheduler-connector/errors';\nimport { addDaysToCurrentDate } from '@/utils/utils';\nimport i18next from '@/utils/i18n';\n\ntype NylasSchedulerAPIConnectorOptions = {\n schedulerAPIURL: string;\n schedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n\n/**\n * NylaSchedulerConnector\n * This class is used to make API requests to the scheduler.\n */\nexport class NylaSchedulerAPIConnector {\n private schedulerStore: NylasSchedulerStoreType;\n private schedulerAPIURL: string;\n private sessionId: string | undefined;\n private configId: string | undefined;\n private slug: string | undefined;\n private clientId: string | undefined;\n private errors = new Errors();\n\n constructor({ schedulerAPIURL, schedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerAPIConnectorOptions) {\n this.schedulerStore = schedulerStore;\n this.schedulerAPIURL = schedulerAPIURL;\n this.sessionId = sessionId;\n this.configId = configId;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n private getHeaders() {\n return this.sessionId\n ? {\n Authorization: `Bearer ${this.sessionId}`,\n }\n : {};\n }\n\n /**\n * Makes an API request to the scheduler.\n * @param path The path to the API endpoint.\n * @param method The HTTP method.\n * @param body The request body (if any).\n * @returns {Promise<T>}\n */\n public async makeAPIRequest<T>(path: string, method: string, body: string | undefined, headers = {}): Promise<NylasResponse<T>> {\n try {\n const schedulerURL = new URL(this.schedulerAPIURL);\n const version = process.env.PACKAGE_VERSION || 'latest';\n schedulerURL.pathname = path;\n const response = await fetch(decodeURIComponent(schedulerURL.toString()), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Origin': window.location.origin,\n 'X-Source': 'nylas-scheduling',\n 'X-Nylas-Web-Elements-Version': version,\n ...headers,\n },\n body,\n });\n // The server returns a json object for errors: eg.\n // {\n // \"request_id\": \"<request_id>\",\n // \"error\": {\n // \"type\": \"not_found_error\",\n // \"message\": \"Session not found\"\n // }\n // }\n const data = await response.json();\n return data as NylasResponse<T>;\n } catch (error: any) {\n // NOTE: current server implementation doesn't return a JSON object for errors on some endpoints\n // handle this case by returning the error response as a string to be handled downstream\n return {\n error: {\n message: error.message,\n title: 'API request failed',\n type: 'api',\n },\n } as NylasErrorResponse;\n }\n }\n\n private getErrorMessage(error: NylasErrorResponse['error']) {\n let errorMessage = error?.message || error?.title || 'Something went wrong';\n if (error?.type === 'provider_error') {\n errorMessage = error?.provider_error?.error?.message || error?.provider_error?.error?.title || 'Something went wrong';\n }\n return errorMessage;\n }\n\n public setConfigId(configId: string) {\n this.configId = configId;\n }\n\n /**\n * Selects a date in the scheduler.\n */\n public selectDate(date: Date) {\n this.schedulerStore.set('selectedDate', date);\n this.schedulerStore.set('selectedTimeslot', null);\n }\n\n /**\n * Selects a time in the scheduler.\n */\n public selectTime(time: Timeslot) {\n this.schedulerStore.set('selectedTimeslot', time);\n }\n\n /**\n * Sets the timezone in the scheduler.\n */\n public selectTimezone(timezone: string) {\n this.schedulerStore.set('selectedTimezone', timezone);\n }\n\n /**\n * Sets the language in the scheduler.\n */\n public selectLanguage(language: string) {\n this.schedulerStore.set('selectedLanguage', language);\n i18next.changeLanguage(language);\n }\n\n /**\n * Toggles showBookingForm\n * @param value boolean\n */\n public async toggleAdditionalData(value: boolean) {\n if (!value) {\n // Refetch availability\n await this.refetchAvailability();\n }\n this.schedulerStore.set('showBookingForm', value);\n }\n\n /**\n * Set/update the name of the participant booking the event.\n */\n public setParticipantName(name: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n name,\n },\n });\n }\n\n /**\n * Set/update the email of the participant booking the event.\n */\n public setParticipantEmail(email: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n email,\n },\n });\n }\n\n private async refetchAvailability() {\n const today = new Date();\n // Refetch availability\n const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n const endTime = new Date(today.getFullYear(), today.getMonth() + 1, 1).getTime() / 1000;\n const result = await this.getAvailability(startTimeWithOffset, endTime);\n return result;\n }\n\n private async resetStoreStateAndFetchAvailability() {\n const today = new Date();\n // Refetch availability\n const result = await this.refetchAvailability();\n // Set selected date to first available date\n const firstAvailableDate = this.schedulerStore.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n let _selectedDate = today;\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n this.schedulerStore.set('selectedDate', _selectedDate);\n // Reset store state\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\n this.schedulerStore.set('selectedTimeslot', null);\n\n return result;\n }\n\n /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n this.schedulerStore.set('isLoading', true);\n const eventInfo = this.schedulerStore.state.eventInfo;\n if (eventInfo) {\n this.schedulerStore.set('reschedulingEventInfo', eventInfo);\n }\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n await this.getUISettings();\n // Set reschedule booking id\n const result = await this.resetStoreStateAndFetchAvailability().finally(() => {\n this.schedulerStore.set('isLoading', false);\n });\n\n return result;\n }\n\n /**\n * Set cancel booking id\n */\n public async setCancel(bookingID: string) {\n this.schedulerStore.set('cancelBookingId', bookingID);\n }\n\n /**\n * Set reject booking id\n */\n public async setReject(bookingID: string) {\n this.schedulerStore.set('rejectBookingId', bookingID);\n }\n\n public async resetCancel() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('cancelBookingId', '');\n this.schedulerStore.set('rejectBookingId', '');\n this.schedulerStore.set('cancelledEventInfo', null);\n return result;\n }\n\n public async goBack() {\n this.schedulerStore.set('cancelBookingId', '');\n return;\n }\n\n public async resetConfirm() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('confirmedEventInfo', undefined);\n return result;\n }\n\n /**\n * Book the selected timeslot.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async bookTimeslot(data?: NylasSchedulerBookingDataWithFlatFields & { timeslot?: Timeslot }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { selectedTimeslot, selectedTimezone, bookingInfo, selectedLanguage } = this.schedulerStore.state;\n\n if (!data && !bookingInfo) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_booking_info() };\n }\n\n const timeslot = data?.timeslot || selectedTimeslot;\n if (!timeslot) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timeslot_selected() };\n }\n\n const timezone = data && data?.timezone ? data?.timezone : selectedTimezone;\n const language = selectedLanguage || 'en-US';\n\n if (!timezone) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timezone_selected() };\n }\n\n const order = [...this.schedulerStore.get('availabilityOrderEmails')];\n\n let participantToBookWith = '';\n const emails = timeslot?.emails || [];\n\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const headers = this.getHeaders();\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings${configIdParam}`;\n\n // If the order array is empty, make a single request without retries\n if (order.length === 0) {\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone,\n event_id: timeslot?.event_id || undefined,\n master_id: timeslot?.master_id || undefined,\n calendar_id: timeslot?.calendar_id || undefined,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n this.schedulerStore.set('isLoading', false);\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response.data);\n return response;\n }\n return { error: response.error };\n }\n\n while (order.length > 0) {\n participantToBookWith = order.shift()!;\n\n if (!emails.includes(participantToBookWith)) {\n continue; // Skip if the email is not part of the timeslot\n }\n\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone: timezone,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n if ('data' in response) {\n // Successful booking\n this.schedulerStore.set('isLoading', false);\n this.schedulerStore.set('eventInfo', response?.data);\n return response;\n } else if (response.error?.message?.startsWith('The selected timeslot is unavailable')) {\n // Retry with the next email in the order\n continue;\n } else {\n // Return other errors\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('createBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('createBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n }\n\n // If no emails in order succeed\n this.schedulerStore.set('isLoading', false);\n return {\n error: this.errors.api(i18next.t('createBookingErrorTitle')).timeslot_not_available('The selected timeslot is unavailable'),\n };\n }\n\n /**\n * Get UI settings for the scheduler.\n */\n public async getUISettings(): Promise<NylasSchedulerResponse<UISettingsResponse>> {\n this.schedulerStore.set('isLoading', true);\n const bookingId = this.schedulerStore.get('rescheduleBookingId');\n const headers = this.getHeaders();\n let configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n if (bookingId && !!configIdParam) {\n configIdParam += `&booking_id=${bookingId}`;\n } else if (bookingId) {\n configIdParam += `?booking_id=${bookingId}`;\n }\n\n const url = `/v3/scheduling/ui-settings${configIdParam}`;\n\n const response = await this.makeAPIRequest<UISettingsResponse>(url, 'GET', undefined, headers);\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getUISettingErrorTitle'))) {\n error = this.errors.api(i18next.t('getUISettingErrorTitle'))[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n if ('data' in response) {\n this.schedulerStore.set('configSettings', response.data);\n }\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n private getTwoLetterLanguageCode(language: string) {\n return language.split('-')[0];\n }\n\n private getStartTimeWithMinBookingNotice(startTime: number) {\n const scheduler = this.schedulerStore.get('configSettings')?.scheduler;\n const min_booking_notice = scheduler?.min_booking_notice;\n if (!min_booking_notice) {\n return startTime;\n }\n const today = new Date().getTime();\n\n if (startTime < (today + min_booking_notice * 60 * 1000) / 1000) {\n return Math.floor((today + min_booking_notice * 60 * 1000) / 1000);\n } else {\n return startTime;\n }\n }\n\n private getEndTimeForAvailableDaysInFuture(endTime: number) {\n const today = new Date();\n const availableDaysInFuture = this.schedulerStore.get('configSettings')?.scheduler?.available_days_in_future;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTimeWithOffset = Math.min(endTimeForAvailableDaysInFuture, endTime);\n return endTimeWithOffset;\n }\n\n /**\n * Gets the availability for a page.\n * @param startTime The start time.\n * @param endTime The end time.\n * @returns {Promise<AvailabilityResponse>}\n */\n public async getAvailability(startTime: number = 0, endTime: number = 0): Promise<NylasSchedulerResponse<AvailabilityResponse>> {\n this.schedulerStore.set('isLoading', true);\n const params = new URLSearchParams();\n const now = new Date();\n const nowTime = now.getTime();\n\n if (endTime && endTime < nowTime / 1000) {\n this.schedulerStore.set('isLoading', false);\n const error = this.errors.component(i18next.t('getAvailabilityErrorTitle')).endtime_not_in_future();\n return { error };\n }\n\n // Calculate the start of the current month if startTime is not provided\n if (!startTime) {\n const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);\n startTime = Math.floor(startOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n // Calculate the end of the current month if endTime is not provided\n if (!endTime) {\n const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0); // Setting day to 0 gets the last day of the previous month, so in this case, the last day of the current month\n endTime = Math.floor(endOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n endTime = this.getEndTimeForAvailableDaysInFuture(endTime);\n const startTimeWithMinBooking = this.getStartTimeWithMinBookingNotice(startTime);\n startTime = startTimeWithMinBooking;\n endTime = startTimeWithMinBooking > endTime ? startTimeWithMinBooking + 1 : endTime;\n\n params.append('start_time', encodeURIComponent(startTime.toString()));\n params.append('end_time', encodeURIComponent(endTime.toString()));\n if (this.configId && !this.sessionId) {\n params.append('configuration_id', encodeURIComponent(this.configId));\n } else if (this.slug && this.clientId && !this.sessionId) {\n params.append('slug', encodeURIComponent(this.slug));\n params.append('client_id', encodeURIComponent(this.clientId));\n }\n\n const rescheduleBookingId = this.schedulerStore.get('rescheduleBookingId');\n if (rescheduleBookingId) {\n params.append('booking_id', encodeURIComponent(rescheduleBookingId));\n }\n const queryString = params.toString();\n const url = `/v3/scheduling/availability${queryString ? `?${queryString}` : ''}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<AvailabilityResponse>(decodeURIComponent(url), 'GET', undefined, headers);\n\n if ('error' in response) {\n this.schedulerStore.set('availability', []);\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getAvailabilityErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('getAvailabilityErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response) {\n const availability =\n response.data?.time_slots?.map(timeslot => {\n return {\n ...timeslot,\n start_time: new Date(timeslot.start_time * 1000),\n end_time: new Date(timeslot.end_time * 1000),\n };\n }) || [];\n\n // Filter out timeslots that are in the past\n const availabilityTimeslotsFiltered = availability.filter(timeslot => timeslot.start_time.getTime() > nowTime);\n const availabilityTimeslotSorted = availabilityTimeslotsFiltered.sort((a, b) => a.start_time.getTime() - b.start_time.getTime());\n this.schedulerStore.set('availability', availabilityTimeslotSorted);\n const order = response.data?.order || [];\n this.schedulerStore.set('availabilityOrderEmails', order);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Cancels a booking.\n * @param bookingId The booking ID.\n */\n public async cancelBooking(bookingId: string, reason: string): Promise<NylasSchedulerResponse<Partial<NylasEvent>>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('cancelBookingErrorTitle')).no_booking_id() };\n }\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<Partial<NylasEvent>>(\n decodeURIComponent(url),\n 'DELETE',\n JSON.stringify({\n action: 'cancel',\n cancellation_reason: reason,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('cancelBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('cancelBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n this.schedulerStore.set('rescheduleBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Reschedules a booking.\n * @param bookingId The booking ID.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async rescheduleBooking(bookingId: string, data: NylasSchedulerBookingDataWithFlatFields): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('rescheduleBookingErrorTitle')).no_booking_id() };\n }\n const apiErrors = this.errors.api(i18next.t('rescheduleBookingErrorTitle'));\n const componentErrors = this.errors.component(i18next.t('rescheduleBookingErrorTitle'));\n const { bookingInfo, selectedTimeslot, selectedTimezone, selectedLanguage } = this.schedulerStore.state;\n // Validate data\n const { startTime, endTime, timezone } = data;\n const start_time = startTime || selectedTimeslot?.start_time;\n\n if (!start_time) {\n return { error: componentErrors.invalid_start_time('Please pass \"startTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n const end_time = endTime || selectedTimeslot?.end_time;\n if (!end_time) {\n return { error: componentErrors.invalid_end_time('Please pass \"endTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n\n const order = this.schedulerStore.get('availabilityOrderEmails');\n let participantToBookWith = '';\n if (order.length > 0) {\n // Get the emails in the timeslot\n const emails = selectedTimeslot?.emails || [];\n for (let i = 0; i < order.length; i++) {\n if (emails.includes(order[i])) {\n participantToBookWith = order[i];\n break;\n }\n }\n }\n\n const time_zone = timezone || selectedTimezone;\n if (!time_zone) {\n return { error: componentErrors.invalid_timezone('Please pass \"timezone\" in data or set \"selectedTimezone\" in the defaultSchedulerState.') };\n }\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PATCH',\n JSON.stringify({\n start_time: start_time.getTime() / 1000,\n end_time: end_time.getTime() / 1000,\n timezone: time_zone,\n additional_fields,\n guest: { ...primaryGuest },\n additional_guests: guests,\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n email_language: this.getTwoLetterLanguageCode(selectedLanguage),\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in apiErrors) {\n const errorMessage = this.getErrorMessage(error);\n error = apiErrors[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n const eventInfo = this.schedulerStore.get('reschedulingEventInfo');\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n } else if (eventInfo) {\n this.schedulerStore.set('eventInfo', eventInfo);\n } else {\n // We should technically never reach this point\n const event = {\n booking_id: bookingId,\n } as NylasEvent;\n this.schedulerStore.set('eventInfo', event);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Updates the booking.\n * @param bookingId The booking ID.\n */\n public async updateBooking(payload: { bookingId: string; status: 'confirmed' | 'cancelled'; reason?: string }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { bookingId, status, reason } = payload;\n const salt = this.schedulerStore.get('organizerConfirmationSalt');\n const errorTitle = status === 'confirmed' ? i18next.t('confirmBookingErrorTitle') : i18next.t('rejectBookingErrorTitle');\n\n if (!bookingId) {\n return { error: this.errors.component(errorTitle).no_booking_id() };\n }\n if (!salt) {\n return { error: this.errors.component(errorTitle).no_salt() };\n }\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PUT',\n JSON.stringify({\n status: status,\n cancellation_reason: reason,\n salt,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(errorTitle)) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(errorTitle)[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response && status === 'confirmed') {\n this.schedulerStore.set('confirmedEventInfo', response?.data);\n } else if ('request_id' in response && status === 'cancelled') {\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n }\n\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Validate timeslot for group event booking\n */\n public async validateGroupEventTimeslot(timeslot: Timeslot) {\n this.schedulerStore.set('isLoading', true);\n const configId = this.schedulerStore.get('configSettings')?.configuration_id;\n if (!configId) {\n return { error: this.errors.component(i18next.t('validateTimeslotErrorTitle')).no_config_id() };\n }\n\n const headers = this.getHeaders();\n const url = `/v3/scheduling/configurations/${configId}/group-events/validate-timeslot`;\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n ...timeslot,\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('validateTimeslotErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('validateTimeslotErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n this.refetchAvailability();\n return { error };\n }\n\n this.schedulerStore.set('selectedTimeslot', timeslot);\n this.schedulerStore.set('showBookingForm', true);\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n}\n"]}
1
+ {"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../../../src/connector/shared/api/scheduler.ts"],"names":[],"mappings":"AAGA,OAAO,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BAAiB,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { AvailabilityResponse, NylasSchedulerBookingDataWithFlatFields, NylasEvent, UISettingsResponse } from '@/common/types';\nimport { NylasSchedulerStoreType } from '../../../components';\nimport type { NylasErrorResponse, NylasResponse, NylasSchedulerBookingData, NylasSchedulerResponse, Timeslot } from '@nylas/core';\nimport { Errors } from '@/connector/nylas-scheduler-connector/errors';\nimport { addDaysToCurrentDate } from '@/utils/utils';\nimport i18next from '@/utils/i18n';\nimport { APIErrorType } from '@nylas/core';\n\ntype NylasSchedulerAPIConnectorOptions = {\n schedulerAPIURL: string;\n schedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n\n/**\n * NylaSchedulerConnector\n * This class is used to make API requests to the scheduler.\n */\nexport class NylaSchedulerAPIConnector {\n private schedulerStore: NylasSchedulerStoreType;\n private schedulerAPIURL: string;\n private sessionId: string | undefined;\n private configId: string | undefined;\n private slug: string | undefined;\n private clientId: string | undefined;\n private errors = new Errors();\n\n constructor({ schedulerAPIURL, schedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerAPIConnectorOptions) {\n this.schedulerStore = schedulerStore;\n this.schedulerAPIURL = schedulerAPIURL;\n this.sessionId = sessionId;\n this.configId = configId;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n private getHeaders() {\n return this.sessionId\n ? {\n Authorization: `Bearer ${this.sessionId}`,\n }\n : {};\n }\n\n /**\n * Makes an API request to the scheduler.\n * @param path The path to the API endpoint.\n * @param method The HTTP method.\n * @param body The request body (if any).\n * @returns {Promise<T>}\n */\n public async makeAPIRequest<T>(path: string, method: string, body: string | undefined, headers = {}): Promise<NylasResponse<T>> {\n try {\n const schedulerURL = new URL(this.schedulerAPIURL);\n const version = process.env.PACKAGE_VERSION || 'latest';\n schedulerURL.pathname = path;\n const response = await fetch(decodeURIComponent(schedulerURL.toString()), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Origin': window.location.origin,\n 'X-Source': 'nylas-scheduling',\n 'X-Nylas-Web-Elements-Version': version,\n ...headers,\n },\n body,\n });\n // The server returns a json object for errors: eg.\n // {\n // \"request_id\": \"<request_id>\",\n // \"error\": {\n // \"type\": \"not_found_error\",\n // \"message\": \"Session not found\"\n // }\n // }\n const data = await response.json();\n return data as NylasResponse<T>;\n } catch (error: any) {\n // NOTE: current server implementation doesn't return a JSON object for errors on some endpoints\n // handle this case by returning the error response as a string to be handled downstream\n return {\n error: {\n message: error.message,\n title: 'API request failed',\n type: 'api',\n },\n } as NylasErrorResponse;\n }\n }\n\n private getErrorMessage(error: NylasErrorResponse['error']) {\n let errorMessage = error?.message || error?.title || 'Something went wrong';\n if (error?.type === 'provider_error') {\n errorMessage = error?.provider_error?.error?.message || error?.provider_error?.error?.title || 'Something went wrong';\n }\n return errorMessage;\n }\n\n public setConfigId(configId: string) {\n this.configId = configId;\n }\n\n /**\n * Selects a date in the scheduler.\n */\n public selectDate(date: Date) {\n this.schedulerStore.set('selectedDate', date);\n this.schedulerStore.set('selectedTimeslot', null);\n }\n\n /**\n * Selects a time in the scheduler.\n */\n public selectTime(time: Timeslot) {\n this.schedulerStore.set('selectedTimeslot', time);\n }\n\n /**\n * Sets the timezone in the scheduler.\n */\n public selectTimezone(timezone: string) {\n this.schedulerStore.set('selectedTimezone', timezone);\n }\n\n /**\n * Sets the language in the scheduler.\n */\n public selectLanguage(language: string) {\n this.schedulerStore.set('selectedLanguage', language);\n i18next.changeLanguage(language);\n }\n\n /**\n * Toggles showBookingForm\n * @param value boolean\n */\n public async toggleAdditionalData(value: boolean) {\n if (!value) {\n // Refetch availability\n await this.refetchAvailability();\n }\n this.schedulerStore.set('showBookingForm', value);\n }\n\n /**\n * Set/update the name of the participant booking the event.\n */\n public setParticipantName(name: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n name,\n },\n });\n }\n\n /**\n * Set/update the email of the participant booking the event.\n */\n public setParticipantEmail(email: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n email,\n },\n });\n }\n\n private async refetchAvailability() {\n const today = new Date();\n // Refetch availability\n const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n const endTime = new Date(today.getFullYear(), today.getMonth() + 1, 1).getTime() / 1000;\n const result = await this.getAvailability(startTimeWithOffset, endTime);\n return result;\n }\n\n private async resetStoreStateAndFetchAvailability() {\n const today = new Date();\n // Refetch availability\n const result = await this.refetchAvailability();\n // Set selected date to first available date\n const firstAvailableDate = this.schedulerStore.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n let _selectedDate = today;\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n this.schedulerStore.set('selectedDate', _selectedDate);\n // Reset store state\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\n this.schedulerStore.set('selectedTimeslot', null);\n\n return result;\n }\n\n /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n this.schedulerStore.set('isLoading', true);\n const eventInfo = this.schedulerStore.state.eventInfo;\n if (eventInfo) {\n this.schedulerStore.set('reschedulingEventInfo', eventInfo);\n }\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n await this.getUISettings();\n // Set reschedule booking id\n const result = await this.resetStoreStateAndFetchAvailability().finally(() => {\n this.schedulerStore.set('isLoading', false);\n });\n\n return result;\n }\n\n /**\n * Set cancel booking id\n */\n public async setCancel(bookingID: string) {\n this.schedulerStore.set('cancelBookingId', bookingID);\n }\n\n /**\n * Set reject booking id\n */\n public async setReject(bookingID: string) {\n this.schedulerStore.set('rejectBookingId', bookingID);\n }\n\n public async resetCancel() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('cancelBookingId', '');\n this.schedulerStore.set('rejectBookingId', '');\n this.schedulerStore.set('cancelledEventInfo', null);\n return result;\n }\n\n public async goBack() {\n this.schedulerStore.set('cancelBookingId', '');\n return;\n }\n\n public async resetConfirm() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('confirmedEventInfo', undefined);\n return result;\n }\n\n /**\n * Book the selected timeslot.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async bookTimeslot(data?: NylasSchedulerBookingDataWithFlatFields & { timeslot?: Timeslot }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { selectedTimeslot, selectedTimezone, bookingInfo, selectedLanguage } = this.schedulerStore.state;\n\n if (!data && !bookingInfo) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_booking_info() };\n }\n\n const timeslot = data?.timeslot || selectedTimeslot;\n if (!timeslot) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timeslot_selected() };\n }\n\n const timezone = data && data?.timezone ? data?.timezone : selectedTimezone;\n const language = selectedLanguage || 'en-US';\n\n if (!timezone) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timezone_selected() };\n }\n\n const order = [...this.schedulerStore.get('availabilityOrderEmails')];\n\n let participantToBookWith = '';\n const emails = timeslot?.emails || [];\n\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const headers = this.getHeaders();\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings${configIdParam}`;\n\n // If the order array is empty, make a single request without retries\n if (order.length === 0) {\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone,\n event_id: timeslot?.event_id || undefined,\n master_id: timeslot?.master_id || undefined,\n calendar_id: timeslot?.calendar_id || undefined,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n this.schedulerStore.set('isLoading', false);\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response.data);\n return response;\n }\n return { error: response.error };\n }\n\n while (order.length > 0) {\n participantToBookWith = order.shift()!;\n\n if (!emails.includes(participantToBookWith)) {\n continue; // Skip if the email is not part of the timeslot\n }\n\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone: timezone,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n if ('data' in response) {\n // Successful booking\n this.schedulerStore.set('isLoading', false);\n this.schedulerStore.set('eventInfo', response?.data);\n return response;\n } else if (response.error?.message?.startsWith('The selected timeslot is unavailable')) {\n // Retry with the next email in the order\n continue;\n } else {\n // Return other errors\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('createBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('createBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n }\n\n // If no emails in order succeed\n this.schedulerStore.set('isLoading', false);\n return {\n error: this.errors.api(i18next.t('createBookingErrorTitle')).timeslot_not_available('The selected timeslot is unavailable'),\n };\n }\n\n /**\n * Get UI settings for the scheduler.\n */\n public async getUISettings(): Promise<NylasSchedulerResponse<UISettingsResponse>> {\n this.schedulerStore.set('isLoading', true);\n const bookingId = this.schedulerStore.get('rescheduleBookingId');\n const headers = this.getHeaders();\n let configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n if (bookingId && !!configIdParam) {\n configIdParam += `&booking_id=${bookingId}`;\n } else if (bookingId) {\n configIdParam += `?booking_id=${bookingId}`;\n }\n\n const url = `/v3/scheduling/ui-settings${configIdParam}`;\n\n const response = await this.makeAPIRequest<UISettingsResponse>(url, 'GET', undefined, headers);\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getUISettingErrorTitle'))) {\n error = this.errors.api(i18next.t('getUISettingErrorTitle'))[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n if ('data' in response) {\n this.schedulerStore.set('configSettings', response.data);\n }\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n private getTwoLetterLanguageCode(language: string) {\n return language.split('-')[0];\n }\n\n private getStartTimeWithMinBookingNotice(startTime: number) {\n const scheduler = this.schedulerStore.get('configSettings')?.scheduler;\n const min_booking_notice = scheduler?.min_booking_notice;\n if (!min_booking_notice) {\n return startTime;\n }\n const today = new Date().getTime();\n\n if (startTime < (today + min_booking_notice * 60 * 1000) / 1000) {\n return Math.floor((today + min_booking_notice * 60 * 1000) / 1000);\n } else {\n return startTime;\n }\n }\n\n private getEndTimeForAvailableDaysInFuture(endTime: number) {\n const today = new Date();\n const availableDaysInFuture = this.schedulerStore.get('configSettings')?.scheduler?.available_days_in_future;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTimeWithOffset = Math.min(endTimeForAvailableDaysInFuture, endTime);\n return endTimeWithOffset;\n }\n\n /**\n * Gets the availability for a page.\n * @param startTime The start time.\n * @param endTime The end time.\n * @returns {Promise<AvailabilityResponse>}\n */\n public async getAvailability(startTime: number = 0, endTime: number = 0): Promise<NylasSchedulerResponse<AvailabilityResponse>> {\n this.schedulerStore.set('isLoading', true);\n const params = new URLSearchParams();\n const now = new Date();\n const nowTime = now.getTime();\n\n if (endTime && endTime < nowTime / 1000) {\n this.schedulerStore.set('isLoading', false);\n const error = this.errors.component(i18next.t('getAvailabilityErrorTitle')).endtime_not_in_future();\n return { error };\n }\n\n // Calculate the start of the current month if startTime is not provided\n if (!startTime) {\n const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);\n startTime = Math.floor(startOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n // Calculate the end of the current month if endTime is not provided\n if (!endTime) {\n const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0); // Setting day to 0 gets the last day of the previous month, so in this case, the last day of the current month\n endTime = Math.floor(endOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n endTime = this.getEndTimeForAvailableDaysInFuture(endTime);\n const startTimeWithMinBooking = this.getStartTimeWithMinBookingNotice(startTime);\n startTime = startTimeWithMinBooking;\n endTime = startTimeWithMinBooking > endTime ? startTimeWithMinBooking + 1 : endTime;\n\n params.append('start_time', encodeURIComponent(startTime.toString()));\n params.append('end_time', encodeURIComponent(endTime.toString()));\n if (this.configId && !this.sessionId) {\n params.append('configuration_id', encodeURIComponent(this.configId));\n } else if (this.slug && this.clientId && !this.sessionId) {\n params.append('slug', encodeURIComponent(this.slug));\n params.append('client_id', encodeURIComponent(this.clientId));\n }\n\n const rescheduleBookingId = this.schedulerStore.get('rescheduleBookingId');\n if (rescheduleBookingId) {\n params.append('booking_id', encodeURIComponent(rescheduleBookingId));\n }\n const queryString = params.toString();\n const url = `/v3/scheduling/availability${queryString ? `?${queryString}` : ''}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<AvailabilityResponse>(decodeURIComponent(url), 'GET', undefined, headers);\n\n if ('error' in response) {\n this.schedulerStore.set('availability', []);\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getAvailabilityErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('getAvailabilityErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response) {\n const availability =\n response.data?.time_slots?.map(timeslot => {\n return {\n ...timeslot,\n start_time: new Date(timeslot.start_time * 1000),\n end_time: new Date(timeslot.end_time * 1000),\n };\n }) || [];\n\n // Filter out timeslots that are in the past\n const availabilityTimeslotsFiltered = availability.filter(timeslot => timeslot.start_time.getTime() > nowTime);\n const availabilityTimeslotSorted = availabilityTimeslotsFiltered.sort((a, b) => a.start_time.getTime() - b.start_time.getTime());\n this.schedulerStore.set('availability', availabilityTimeslotSorted);\n const order = response.data?.order || [];\n this.schedulerStore.set('availabilityOrderEmails', order);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Cancels a booking.\n * @param bookingId The booking ID.\n */\n public async cancelBooking(bookingId: string, reason: string): Promise<NylasSchedulerResponse<Partial<NylasEvent>>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('cancelBookingErrorTitle')).no_booking_id() };\n }\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<Partial<NylasEvent>>(\n decodeURIComponent(url),\n 'DELETE',\n JSON.stringify({\n action: 'cancel',\n cancellation_reason: reason,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('cancelBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('cancelBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n this.schedulerStore.set('rescheduleBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Reschedules a booking.\n * @param bookingId The booking ID.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async rescheduleBooking(bookingId: string, data: NylasSchedulerBookingDataWithFlatFields): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('rescheduleBookingErrorTitle')).no_booking_id() };\n }\n const apiErrors = this.errors.api(i18next.t('rescheduleBookingErrorTitle'));\n const componentErrors = this.errors.component(i18next.t('rescheduleBookingErrorTitle'));\n const { bookingInfo, selectedTimeslot, selectedTimezone, selectedLanguage } = this.schedulerStore.state;\n // Validate data\n const { startTime, endTime, timezone } = data;\n const start_time = startTime || selectedTimeslot?.start_time;\n\n if (!start_time) {\n return { error: componentErrors.invalid_start_time('Please pass \"startTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n const end_time = endTime || selectedTimeslot?.end_time;\n if (!end_time) {\n return { error: componentErrors.invalid_end_time('Please pass \"endTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n\n const order = this.schedulerStore.get('availabilityOrderEmails');\n let participantToBookWith = '';\n if (order.length > 0) {\n // Get the emails in the timeslot\n const emails = selectedTimeslot?.emails || [];\n for (let i = 0; i < order.length; i++) {\n if (emails.includes(order[i])) {\n participantToBookWith = order[i];\n break;\n }\n }\n }\n\n const time_zone = timezone || selectedTimezone;\n if (!time_zone) {\n return { error: componentErrors.invalid_timezone('Please pass \"timezone\" in data or set \"selectedTimezone\" in the defaultSchedulerState.') };\n }\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PATCH',\n JSON.stringify({\n start_time: start_time.getTime() / 1000,\n end_time: end_time.getTime() / 1000,\n timezone: time_zone,\n additional_fields,\n guest: { ...primaryGuest },\n additional_guests: guests,\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n email_language: this.getTwoLetterLanguageCode(selectedLanguage),\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in apiErrors) {\n const errorMessage = this.getErrorMessage(error);\n error = apiErrors[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n const eventInfo = this.schedulerStore.get('reschedulingEventInfo');\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n } else if (eventInfo) {\n this.schedulerStore.set('eventInfo', eventInfo);\n } else {\n // We should technically never reach this point\n const event = {\n booking_id: bookingId,\n } as NylasEvent;\n this.schedulerStore.set('eventInfo', event);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Updates the booking.\n * @param bookingId The booking ID.\n */\n public async updateBooking(payload: { bookingId: string; status: 'confirmed' | 'cancelled'; reason?: string }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { bookingId, status, reason } = payload;\n const salt = this.schedulerStore.get('organizerConfirmationSalt');\n const errorTitle = status === 'confirmed' ? i18next.t('confirmBookingErrorTitle') : i18next.t('rejectBookingErrorTitle');\n\n if (!bookingId) {\n return { error: this.errors.component(errorTitle).no_booking_id() };\n }\n if (!salt) {\n return { error: this.errors.component(errorTitle).no_salt() };\n }\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PUT',\n JSON.stringify({\n status: status,\n cancellation_reason: reason,\n salt,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(errorTitle)) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(errorTitle)[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response && status === 'confirmed') {\n this.schedulerStore.set('confirmedEventInfo', response?.data);\n } else if ('request_id' in response && status === 'cancelled') {\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n }\n\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Validate timeslot for group event booking\n */\n public async validateGroupEventTimeslot(timeslot: Timeslot) {\n this.schedulerStore.set('isLoading', true);\n const configId = this.schedulerStore.get('configSettings')?.configuration_id;\n if (!configId) {\n return { error: this.errors.component(i18next.t('validateTimeslotErrorTitle')).no_config_id() };\n }\n\n const headers = this.getHeaders();\n const url = `/v3/scheduling/configurations/${configId}/group-events/validate-timeslot`;\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n ...timeslot,\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('validateTimeslotErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('validateTimeslotErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n this.refetchAvailability();\n return { error };\n }\n\n this.schedulerStore.set('selectedTimeslot', timeslot);\n this.schedulerStore.set('showBookingForm', true);\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n}\n"]}
@@ -5,4 +5,33 @@ export var NotificationType;
5
5
  NotificationType["Info"] = "info";
6
6
  NotificationType["Success"] = "success";
7
7
  })(NotificationType || (NotificationType = {}));
8
+ export var ErrorCategory;
9
+ (function (ErrorCategory) {
10
+ ErrorCategory["Component"] = "component";
11
+ ErrorCategory["Api"] = "api";
12
+ ErrorCategory["Auth"] = "auth";
13
+ })(ErrorCategory || (ErrorCategory = {}));
14
+ export var ComponentErrorType;
15
+ (function (ComponentErrorType) {
16
+ ComponentErrorType["endtime_not_in_future"] = "endtime_not_in_future";
17
+ ComponentErrorType["no_booking_info"] = "no_booking_info";
18
+ ComponentErrorType["no_timeslot_selected"] = "no_timeslot_selected";
19
+ ComponentErrorType["no_timezone_selected"] = "no_timezone_selected";
20
+ ComponentErrorType["no_booking_id"] = "no_booking_id";
21
+ ComponentErrorType["no_salt"] = "no_salt";
22
+ ComponentErrorType["invalid_start_time"] = "invalid_start_time";
23
+ ComponentErrorType["invalid_end_time"] = "invalid_end_time";
24
+ ComponentErrorType["invalid_timezone"] = "invalid_timezone";
25
+ ComponentErrorType["no_config_id"] = "no_config_id";
26
+ })(ComponentErrorType || (ComponentErrorType = {}));
27
+ export var APIErrorType;
28
+ (function (APIErrorType) {
29
+ APIErrorType["invalid_session"] = "invalid_session";
30
+ APIErrorType["general_error"] = "general_error";
31
+ APIErrorType["internal_error"] = "internal_error";
32
+ APIErrorType["invalid_request_error"] = "invalid_request_error";
33
+ APIErrorType["timeslot_not_available"] = "timeslot_not_available";
34
+ APIErrorType["provider_error"] = "provider_error";
35
+ APIErrorType["not_found_error"] = "not_found_error";
36
+ })(APIErrorType || (APIErrorType = {}));
8
37
  //# sourceMappingURL=index.js.map