@nylas/react 1.3.5 → 1.4.0

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 (221) hide show
  1. package/dist/add-circle-icon_2.entry-6e8e4e1e.cjs +1 -0
  2. package/dist/add-circle-icon_2.entry-dbad9a3b.js +26 -0
  3. package/dist/archive-icon.entry-21f532af.cjs +1 -0
  4. package/dist/archive-icon.entry-802f7877.js +16 -0
  5. package/dist/{arrow-icon.entry-fa9584cf.js → arrow-icon.entry-e3dec626.js} +3 -2
  6. package/dist/arrow-icon.entry-e9af732a.cjs +1 -0
  7. package/dist/{bold-icon.entry-ac6a4956.js → bold-icon.entry-0492ff02.js} +3 -2
  8. package/dist/bold-icon.entry-1a2be28a.cjs +1 -0
  9. package/dist/button-component_2.entry-f0c7f894.cjs +1 -0
  10. package/dist/{button-component_2.entry-caf33abf.js → button-component_2.entry-fea9bd3d.js} +10 -9
  11. package/dist/calendar-agenda-fill-icon_36.entry-70681da2.cjs +6 -0
  12. package/dist/calendar-agenda-fill-icon_36.entry-c85d6a79.js +4642 -0
  13. package/dist/calendar-cancel-icon.entry-237b8c9e.cjs +1 -0
  14. package/dist/{calendar-cancel-icon.entry-02015d74.js → calendar-cancel-icon.entry-e7dd5b8f.js} +6 -5
  15. package/dist/calendar-check-icon_2.entry-a868e0bc.cjs +1 -0
  16. package/dist/{calendar-check-icon_2.entry-2f7dc236.js → calendar-check-icon_2.entry-c7f47fc8.js} +10 -9
  17. package/dist/calendar-icon.entry-071eb30d.cjs +1 -0
  18. package/dist/{calendar-icon.entry-70ac9bd6.js → calendar-icon.entry-324de624.js} +6 -5
  19. package/dist/checkbox-component.entry-0f9970cc.js +43 -0
  20. package/dist/checkbox-component.entry-5bcf4b08.cjs +1 -0
  21. package/dist/checkmark-icon_15.entry-7776e533.cjs +5 -0
  22. package/dist/checkmark-icon_15.entry-98377585.js +1337 -0
  23. package/dist/chevron-icon_3.entry-526b4b85.cjs +1 -0
  24. package/dist/chevron-icon_3.entry-ec66260c.js +148 -0
  25. package/dist/{clock-icon_4.entry-af5301d7.js → clock-icon_4.entry-4fa47996.js} +19 -18
  26. package/dist/clock-icon_4.entry-66d15f7c.cjs +1 -0
  27. package/dist/{constants-f6e79ab7-24392f9e.js → constants-f5ba52b9-40ab2ded.js} +121 -30
  28. package/dist/constants-f5ba52b9-a0866d2f.cjs +1 -0
  29. package/dist/customParseFormat-39eacb44-45ade322.cjs +1 -0
  30. package/dist/customParseFormat-39eacb44-eeffe2bb.js +135 -0
  31. package/dist/delete-icon.entry-540aa2bb.cjs +1 -0
  32. package/dist/{delete-icon.entry-00cb3ee8.js → delete-icon.entry-95d01eb8.js} +7 -6
  33. package/dist/document-refresh-icon.entry-b82d5da8.js +16 -0
  34. package/dist/document-refresh-icon.entry-c467f082.cjs +1 -0
  35. package/dist/elements/index.d.ts +11 -0
  36. package/dist/{feedbackSync-547e51ee-bcaf691c.js → feedbackSync-47d13bb0-5608d680.js} +1 -1
  37. package/dist/{feedbackSync-547e51ee-9b572309.cjs → feedbackSync-47d13bb0-9f249f33.cjs} +1 -1
  38. package/dist/folder-icon.entry-4d48c2ee.cjs +1 -0
  39. package/dist/{folder-icon.entry-60b3eda5.js → folder-icon.entry-cb0dc63d.js} +5 -4
  40. package/dist/forward-icon.entry-5aa01f53.js +16 -0
  41. package/dist/forward-icon.entry-d04aaf6d.cjs +1 -0
  42. package/dist/globe-icon_2.entry-87e29cdf.cjs +1 -0
  43. package/dist/globe-icon_2.entry-c7ae78cc.js +200 -0
  44. package/dist/google-logo-icon_6.entry-80a6bfa3.js +1457 -0
  45. package/dist/google-logo-icon_6.entry-a8b6efc0.cjs +2 -0
  46. package/dist/google-meet-icon_5.entry-26d667b6.cjs +1 -0
  47. package/dist/google-meet-icon_5.entry-4e71c83b.js +56 -0
  48. package/dist/inbox-icon.entry-60a82bfc.cjs +1 -0
  49. package/dist/inbox-icon.entry-77e4e17b.js +16 -0
  50. package/dist/index-04630615.js +17580 -0
  51. package/dist/index-3d1f13d6.cjs +57 -0
  52. package/dist/index.d.ts +1 -3
  53. package/dist/{index.es-2d849a15-2d84f7a5.cjs → index.es-1fdb1e36-830a422f.cjs} +6 -6
  54. package/dist/{index.es-2d849a15-4eb8e180.js → index.es-1fdb1e36-fbdb04fa.js} +818 -804
  55. package/dist/info-icon_2.entry-34800b66.cjs +1 -0
  56. package/dist/info-icon_2.entry-3c483f61.js +35 -0
  57. package/dist/input-component.entry-ea4016fe.js +84 -0
  58. package/dist/input-component.entry-f7ccf3d6.cjs +1 -0
  59. package/dist/input-dropdown_2.entry-c7730cf8.js +231 -0
  60. package/dist/input-dropdown_2.entry-d4024d2f.cjs +1 -0
  61. package/dist/italic-icon.entry-6e0805ab.js +16 -0
  62. package/dist/italic-icon.entry-8127c2ee.cjs +1 -0
  63. package/dist/multi-select-dropdown_2.entry-49d6f0e7.cjs +1 -0
  64. package/dist/multi-select-dropdown_2.entry-d749999d.js +187 -0
  65. package/dist/notebook-store-b61693cd-7a5576e7.js +14 -0
  66. package/dist/notebook-store-b61693cd-84de36d2.cjs +5 -0
  67. package/dist/nylas-booked-event-card_12.entry-29337b10.cjs +1 -0
  68. package/dist/nylas-booked-event-card_12.entry-3fcfd6f9.js +1418 -0
  69. package/dist/nylas-call-summary.entry-38aed89a.js +16 -0
  70. package/dist/nylas-call-summary.entry-e9adcb93.cjs +1 -0
  71. package/dist/nylas-event-calendar_3.entry-48f656e5.cjs +6 -0
  72. package/dist/nylas-event-calendar_3.entry-62d1f1f5.js +9693 -0
  73. package/dist/nylas-form-card.entry-3828ccb1.js +58 -0
  74. package/dist/nylas-form-card.entry-b900b46e.cjs +1 -0
  75. package/dist/{nylas-if-state.entry-beef8af6.js → nylas-if-state.entry-2810dcf5.js} +4 -3
  76. package/dist/nylas-if-state.entry-92af0a51.cjs +1 -0
  77. package/dist/nylas-key-points.entry-977a6fae.js +29 -0
  78. package/dist/nylas-key-points.entry-de658637.cjs +1 -0
  79. package/dist/nylas-login.entry-4a6c11e6.cjs +1 -0
  80. package/dist/{nylas-login.entry-1661cbd4.js → nylas-login.entry-8101d3d0.js} +4 -3
  81. package/dist/nylas-provider.entry-b7ac25f5.cjs +1 -0
  82. package/dist/{nylas-provider.entry-1f140378.js → nylas-provider.entry-c054d68a.js} +6 -5
  83. package/dist/nylas-scheduler-editor.entry-1538950d.cjs +2 -0
  84. package/dist/{nylas-scheduler-editor.entry-f184f72e.js → nylas-scheduler-editor.entry-e35fad5c.js} +530 -272
  85. package/dist/nylas-scheduling.entry-360b978c.js +439 -0
  86. package/dist/nylas-scheduling.entry-92351cd2.cjs +1 -0
  87. package/dist/nylas-transcript.entry-4d973027.cjs +6 -0
  88. package/dist/nylas-transcript.entry-81e2c821.js +128 -0
  89. package/dist/nylas-video-player.entry-60268c07.js +39 -0
  90. package/dist/nylas-video-player.entry-f3c2b073.cjs +1 -0
  91. package/dist/nylas-video-preview.entry-12e05e4d.cjs +1 -0
  92. package/dist/nylas-video-preview.entry-320421b6.js +16 -0
  93. package/dist/{person-icon.entry-f9ca9147.js → person-icon.entry-8533209c.js} +8 -7
  94. package/dist/person-icon.entry-967ad730.cjs +1 -0
  95. package/dist/play-icon.entry-15ee8568.js +16 -0
  96. package/dist/play-icon.entry-7b1fd79d.cjs +1 -0
  97. package/dist/radio-button-group.entry-24cb342f.cjs +1 -0
  98. package/dist/radio-button-group.entry-53dcf16c.js +47 -0
  99. package/dist/react.cjs +1 -1
  100. package/dist/react.js +133 -123
  101. package/dist/refresh-icon.entry-0486ae54.cjs +1 -0
  102. package/dist/{refresh-icon.entry-7886041f.js → refresh-icon.entry-f3320971.js} +7 -6
  103. package/dist/{register-component-677d8d2b-0113766e.js → register-component-504a1cbb-5f986d7f.js} +1 -1
  104. package/dist/{register-component-677d8d2b-4738af1d.cjs → register-component-504a1cbb-89124fd8.cjs} +1 -1
  105. package/dist/{reply-all-icon.entry-fdd0058e.js → reply-all-icon.entry-006fd1fb.js} +6 -5
  106. package/dist/reply-all-icon.entry-2cea1a40.cjs +1 -0
  107. package/dist/reply-icon.entry-bd252aed.cjs +1 -0
  108. package/dist/reply-icon.entry-d27166a1.js +16 -0
  109. package/dist/scheduler-config-store-d6729d8d-4a2defea.cjs +1 -0
  110. package/dist/{scheduler-config-store-ed4a8dfd-012dcf85.js → scheduler-config-store-d6729d8d-63e34849.js} +4 -1
  111. package/dist/scheduler-store-baf100ed-5c5d3aa5.cjs +1 -0
  112. package/dist/scheduler-store-baf100ed-81b183dc.js +533 -0
  113. package/dist/sent-icon.entry-bf101068.js +16 -0
  114. package/dist/sent-icon.entry-ee434395.cjs +1 -0
  115. package/dist/spam-icon.entry-11016b63.cjs +1 -0
  116. package/dist/spam-icon.entry-5193f9c6.js +16 -0
  117. package/dist/star-icon.entry-0e269252.cjs +1 -0
  118. package/dist/{star-icon.entry-501083c1.js → star-icon.entry-9c7449f3.js} +6 -5
  119. package/dist/stop-icon.entry-2ac11166.js +16 -0
  120. package/dist/stop-icon.entry-86412c9f.cjs +1 -0
  121. package/dist/textarea-component.entry-27717409.cjs +1 -0
  122. package/dist/textarea-component.entry-9df3fa96.js +39 -0
  123. package/dist/toggle-switch.entry-9623e2b2.cjs +1 -0
  124. package/dist/toggle-switch.entry-a5ddfad9.js +34 -0
  125. package/dist/translate-icon.entry-e0617680.cjs +1 -0
  126. package/dist/{translate-icon.entry-676a4150.js → translate-icon.entry-f22293e6.js} +5 -4
  127. package/dist/trash-fill-icon.entry-0275f657.cjs +1 -0
  128. package/dist/trash-fill-icon.entry-2616c5df.js +16 -0
  129. package/dist/{underline-icon.entry-3513c5ef.js → underline-icon.entry-1110dcb1.js} +5 -4
  130. package/dist/underline-icon.entry-d54b06ab.cjs +1 -0
  131. package/dist/warning-icon.entry-6d390ab7.cjs +1 -0
  132. package/dist/{warning-icon.entry-6e723597.js → warning-icon.entry-9a6e7913.js} +8 -7
  133. package/package.json +11 -3
  134. package/dist/add-circle-icon.entry-00c87903.js +0 -15
  135. package/dist/add-circle-icon.entry-640d2b46.cjs +0 -1
  136. package/dist/archive-icon.entry-5b209336.cjs +0 -1
  137. package/dist/archive-icon.entry-e8a39eda.js +0 -15
  138. package/dist/arrow-icon.entry-a25b7b7e.cjs +0 -1
  139. package/dist/bold-icon.entry-d837c73d.cjs +0 -1
  140. package/dist/button-component_2.entry-1471422a.cjs +0 -1
  141. package/dist/calendar-agenda-fill-icon_53.entry-094bd4b9.cjs +0 -6
  142. package/dist/calendar-agenda-fill-icon_53.entry-6d7f9c79.js +0 -5757
  143. package/dist/calendar-cancel-icon.entry-42d3d226.cjs +0 -1
  144. package/dist/calendar-check-icon_2.entry-45aacd91.cjs +0 -1
  145. package/dist/calendar-icon.entry-90d67b03.cjs +0 -1
  146. package/dist/checkbox-component_3.entry-231b2254.cjs +0 -1
  147. package/dist/checkbox-component_3.entry-7270533c.js +0 -153
  148. package/dist/chevron-icon_3.entry-3c95cc88.js +0 -147
  149. package/dist/chevron-icon_3.entry-ead3d4c8.cjs +0 -1
  150. package/dist/clock-icon_4.entry-b50cce70.cjs +0 -1
  151. package/dist/close-icon.entry-04008446.cjs +0 -1
  152. package/dist/close-icon.entry-0a4105c9.js +0 -15
  153. package/dist/constants-f6e79ab7-23d7236b.cjs +0 -1
  154. package/dist/copy-icon.entry-312ff230.js +0 -15
  155. package/dist/copy-icon.entry-74f8ebcd.cjs +0 -1
  156. package/dist/core-js-38e53e34.cjs +0 -4
  157. package/dist/core-js-a9d3b6e1.js +0 -3297
  158. package/dist/delete-icon.entry-b61a6706.cjs +0 -1
  159. package/dist/document-refresh-icon.entry-1c985b1e.js +0 -15
  160. package/dist/document-refresh-icon.entry-27ff5cb2.cjs +0 -1
  161. package/dist/dom-68f08be9.cjs +0 -15
  162. package/dist/dom-86e17616.js +0 -664
  163. package/dist/folder-icon.entry-c32a6e15.cjs +0 -1
  164. package/dist/forward-icon.entry-5f9a7639.js +0 -15
  165. package/dist/forward-icon.entry-8cd805dc.cjs +0 -1
  166. package/dist/globe-icon.entry-21a80591.cjs +0 -1
  167. package/dist/globe-icon.entry-397727e1.js +0 -15
  168. package/dist/google-logo-icon_4.entry-42e87368.cjs +0 -1
  169. package/dist/google-logo-icon_4.entry-6ccf8379.js +0 -778
  170. package/dist/inbox-icon.entry-1e448b4b.js +0 -15
  171. package/dist/inbox-icon.entry-50605b1d.cjs +0 -1
  172. package/dist/index-594c8e7b.js +0 -16763
  173. package/dist/index-cfb93df6.cjs +0 -81
  174. package/dist/info-icon_2.entry-65e0023f.js +0 -34
  175. package/dist/info-icon_2.entry-e7b86847.cjs +0 -1
  176. package/dist/input-color-picker.entry-37d2fb66.js +0 -48
  177. package/dist/input-color-picker.entry-aabfe638.cjs +0 -1
  178. package/dist/input-component.entry-51f6da14.cjs +0 -1
  179. package/dist/input-component.entry-c07d92b1.js +0 -70
  180. package/dist/input-dropdown_2.entry-20fb0552.cjs +0 -1
  181. package/dist/input-dropdown_2.entry-90c08f10.js +0 -228
  182. package/dist/italic-icon.entry-8e5599ff.js +0 -15
  183. package/dist/italic-icon.entry-ee10a040.cjs +0 -1
  184. package/dist/multi-select-dropdown.entry-656d2791.cjs +0 -1
  185. package/dist/multi-select-dropdown.entry-c143becc.js +0 -116
  186. package/dist/nylas-booked-event-card_12.entry-4974ffe6.js +0 -1332
  187. package/dist/nylas-booked-event-card_12.entry-669bb872.cjs +0 -1
  188. package/dist/nylas-form-card.entry-42e718e2.js +0 -57
  189. package/dist/nylas-form-card.entry-55d3909c.cjs +0 -1
  190. package/dist/nylas-if-state.entry-4de782b7.cjs +0 -1
  191. package/dist/nylas-login.entry-d6b80abe.cjs +0 -1
  192. package/dist/nylas-provider.entry-d5495e1a.cjs +0 -1
  193. package/dist/nylas-scheduler-editor.entry-bebe4e7d.cjs +0 -2
  194. package/dist/nylas-scheduling.entry-21c04831.cjs +0 -1
  195. package/dist/nylas-scheduling.entry-c335ad21.js +0 -415
  196. package/dist/nylas-time-window-picker_2.entry-9e0dd470.js +0 -336
  197. package/dist/nylas-time-window-picker_2.entry-a2651ee7.cjs +0 -1
  198. package/dist/person-icon.entry-21946944.cjs +0 -1
  199. package/dist/play-icon.entry-b27fcb18.cjs +0 -1
  200. package/dist/play-icon.entry-dbfed5e8.js +0 -15
  201. package/dist/refresh-icon.entry-9d94a60b.cjs +0 -1
  202. package/dist/reply-all-icon.entry-f0e0a5c4.cjs +0 -1
  203. package/dist/reply-icon.entry-0a42fb2c.cjs +0 -1
  204. package/dist/reply-icon.entry-a8d2b0f8.js +0 -15
  205. package/dist/scheduler-config-store-ed4a8dfd-a16d5c62.cjs +0 -1
  206. package/dist/scheduler-store-92eb8804-bc68a43a.js +0 -487
  207. package/dist/scheduler-store-92eb8804-c3deee73.cjs +0 -1
  208. package/dist/sent-icon.entry-c3f84a59.cjs +0 -1
  209. package/dist/sent-icon.entry-e047f087.js +0 -15
  210. package/dist/spam-icon.entry-55d01416.js +0 -15
  211. package/dist/spam-icon.entry-671eb165.cjs +0 -1
  212. package/dist/star-icon.entry-4dcae472.cjs +0 -1
  213. package/dist/stop-icon.entry-130a28b2.js +0 -15
  214. package/dist/stop-icon.entry-ed949255.cjs +0 -1
  215. package/dist/textarea-component.entry-65dd740a.cjs +0 -1
  216. package/dist/textarea-component.entry-efae9031.js +0 -37
  217. package/dist/translate-icon.entry-2591baf8.cjs +0 -1
  218. package/dist/trash-fill-icon.entry-5b373be7.js +0 -15
  219. package/dist/trash-fill-icon.entry-c411d0e0.cjs +0 -1
  220. package/dist/underline-icon.entry-6bf14476.cjs +0 -1
  221. package/dist/warning-icon.entry-719a094d.cjs +0 -1
@@ -1,487 +0,0 @@
1
- import { d as L, a as F, i as d, j as R } from "./index-594c8e7b.js";
2
- var B;
3
- (function(o) {
4
- o.Component = "component", o.Api = "api", o.Auth = "auth";
5
- })(B || (B = {}));
6
- var M;
7
- (function(o) {
8
- o.endtime_not_in_future = "endtime_not_in_future", o.no_booking_info = "no_booking_info", o.no_timeslot_selected = "no_timeslot_selected", o.no_timezone_selected = "no_timezone_selected", o.no_booking_id = "no_booking_id", o.no_salt = "no_salt", o.invalid_start_time = "invalid_start_time", o.invalid_end_time = "invalid_end_time", o.invalid_timezone = "invalid_timezone";
9
- })(M || (M = {}));
10
- var $;
11
- (function(o) {
12
- o.invalid_session = "invalid_session", o.general_error = "general_error", o.internal_error = "internal_error", o.invalid_request_error = "invalid_request_error", o.timeslot_not_available = "timeslot_not_available", o.provider_error = "provider_error", o.not_found_error = "not_found_error";
13
- })($ || ($ = {}));
14
- class C {
15
- constructor() {
16
- this.component = (e) => {
17
- const t = B.Component, s = `${e} Error`;
18
- return {
19
- endtime_not_in_future: (i = '"endtime" can not be in the future') => ({
20
- title: s,
21
- message: i,
22
- category: t
23
- }),
24
- no_booking_info: (i = "No booking info provided") => ({
25
- title: s,
26
- message: i,
27
- category: t
28
- }),
29
- no_timeslot_selected: (i = "No timeslot selected") => ({
30
- title: s,
31
- message: i,
32
- category: t
33
- }),
34
- no_timezone_selected: (i = "No timezone selected") => ({
35
- title: s,
36
- message: i,
37
- category: t
38
- }),
39
- no_booking_id: (i = "No booking id provided") => ({
40
- title: s,
41
- message: i,
42
- category: t
43
- }),
44
- no_salt: (i = "No salt provided") => ({
45
- title: s,
46
- message: i,
47
- category: t
48
- }),
49
- invalid_start_time: (i = "Invalid start time") => ({
50
- title: s,
51
- message: i,
52
- category: t
53
- }),
54
- invalid_end_time: (i = "Invalid end time") => ({
55
- title: s,
56
- message: i,
57
- category: t
58
- }),
59
- invalid_timezone: (i = "Invalid timezone") => ({
60
- title: s,
61
- message: i,
62
- category: t
63
- })
64
- };
65
- }, this.api = (e) => {
66
- const t = B.Api, s = `${e} Error`;
67
- return {
68
- invalid_session: (i) => ({
69
- title: s,
70
- message: i,
71
- category: t
72
- }),
73
- general_error: (i) => ({
74
- title: s,
75
- message: i,
76
- category: t
77
- }),
78
- internal_error: (i) => ({
79
- title: s,
80
- message: i,
81
- category: t
82
- }),
83
- invalid_request_error: (i) => ({
84
- title: s,
85
- message: i,
86
- category: t
87
- }),
88
- timeslot_not_available: (i) => ({
89
- title: s,
90
- message: i,
91
- category: t
92
- }),
93
- provider_error: (i) => ({
94
- title: s,
95
- message: i,
96
- category: t
97
- }),
98
- not_found_error: (i) => ({
99
- title: s,
100
- message: i,
101
- category: t
102
- })
103
- };
104
- };
105
- }
106
- }
107
- class N {
108
- constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i, slug: r, clientId: n }) {
109
- this.errors = new C(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = i, this.slug = r, this.clientId = n;
110
- }
111
- getHeaders() {
112
- return this.sessionId ? {
113
- Authorization: `Bearer ${this.sessionId}`
114
- } : {};
115
- }
116
- async makeAPIRequest(e, t, s, i = {}) {
117
- try {
118
- const r = new URL(this.schedulerAPIURL), n = "1.3.5";
119
- return r.pathname = e, await (await fetch(decodeURIComponent(r.toString()), {
120
- method: t,
121
- headers: {
122
- "Content-Type": "application/json",
123
- Origin: window.location.origin,
124
- "X-Source": "nylas-scheduling",
125
- "X-Nylas-Web-Elements-Version": n,
126
- ...i
127
- },
128
- body: s
129
- })).json();
130
- } catch (r) {
131
- return {
132
- error: {
133
- message: r.message,
134
- title: "API request failed",
135
- type: "api"
136
- }
137
- };
138
- }
139
- }
140
- getErrorMessage(e) {
141
- var s, i, r, n;
142
- let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
143
- return (e == null ? void 0 : e.type) === "provider_error" && (t = ((i = (s = e == null ? void 0 : e.provider_error) == null ? void 0 : s.error) == null ? void 0 : i.message) || ((n = (r = e == null ? void 0 : e.provider_error) == null ? void 0 : r.error) == null ? void 0 : n.title) || "Something went wrong"), t;
144
- }
145
- setConfigId(e) {
146
- this.configId = e;
147
- }
148
- selectDate(e) {
149
- this.schedulerStore.set("selectedDate", e), this.schedulerStore.set("selectedTimeslot", null);
150
- }
151
- selectTime(e) {
152
- this.schedulerStore.set("selectedTimeslot", e);
153
- }
154
- selectTimezone(e) {
155
- this.schedulerStore.set("selectedTimezone", e);
156
- }
157
- selectLanguage(e) {
158
- this.schedulerStore.set("selectedLanguage", e), d.changeLanguage(e);
159
- }
160
- async toggleAdditionalData(e) {
161
- e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
162
- }
163
- setParticipantName(e) {
164
- const { bookingInfo: t } = this.schedulerStore.state;
165
- this.schedulerStore.set("bookingInfo", {
166
- ...t,
167
- primaryParticipant: {
168
- ...t == null ? void 0 : t.primaryParticipant,
169
- name: e
170
- }
171
- });
172
- }
173
- setParticipantEmail(e) {
174
- const { bookingInfo: t } = this.schedulerStore.state;
175
- this.schedulerStore.set("bookingInfo", {
176
- ...t,
177
- primaryParticipant: {
178
- ...t == null ? void 0 : t.primaryParticipant,
179
- email: e
180
- }
181
- });
182
- }
183
- async refetchAvailability() {
184
- const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1).getTime() / 1e3, s = t < e.getTime() / 1e3 ? Math.floor(e.getTime() / 1e3) : t, i = new Date(e.getFullYear(), e.getMonth() + 1, 1).getTime() / 1e3;
185
- return await this.getAvailability(s, i);
186
- }
187
- async resetStoreStateAndFetchAvailability() {
188
- const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((r) => new Date(r.start_time) > /* @__PURE__ */ new Date());
189
- let i = e;
190
- return s && (i = s.start_time), this.schedulerStore.set("selectedDate", i), this.schedulerStore.set("eventInfo", null), this.schedulerStore.set("showBookingForm", !1), this.schedulerStore.set("selectedTimeslot", null), t;
191
- }
192
- async setReschedule(e) {
193
- this.schedulerStore.set("isLoading", !0);
194
- const t = this.schedulerStore.state.eventInfo;
195
- return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.getUISettings(), await this.resetStoreStateAndFetchAvailability().finally(() => {
196
- this.schedulerStore.set("isLoading", !1);
197
- });
198
- }
199
- async setCancel(e) {
200
- this.schedulerStore.set("cancelBookingId", e);
201
- }
202
- async setReject(e) {
203
- this.schedulerStore.set("rejectBookingId", e);
204
- }
205
- async resetCancel() {
206
- const e = await this.resetStoreStateAndFetchAvailability();
207
- return this.schedulerStore.set("cancelBookingId", ""), this.schedulerStore.set("rejectBookingId", ""), this.schedulerStore.set("cancelledEventInfo", null), e;
208
- }
209
- async goBack() {
210
- this.schedulerStore.set("cancelBookingId", "");
211
- }
212
- async resetConfirm() {
213
- const e = await this.resetStoreStateAndFetchAvailability();
214
- return this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("confirmedEventInfo", void 0), e;
215
- }
216
- async bookTimeslot(e) {
217
- var I;
218
- this.schedulerStore.set("isLoading", !0);
219
- const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage: r } = this.schedulerStore.state;
220
- if (!e && !i)
221
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_booking_info() };
222
- const n = (e == null ? void 0 : e.timeslot) || t;
223
- if (!n)
224
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timeslot_selected() };
225
- const a = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s, l = r || "en-US";
226
- if (!a)
227
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timezone_selected() };
228
- const u = this.schedulerStore.get("availabilityOrderEmails");
229
- let c = "";
230
- if (u.length > 0) {
231
- const k = (n == null ? void 0 : n.emails) || [];
232
- for (let f = 0; f < u.length; f++)
233
- if (k.includes(u[f])) {
234
- c = u[f];
235
- break;
236
- }
237
- }
238
- const h = {};
239
- Object.entries((i == null ? void 0 : i.additionalFields) || {}).forEach(([k, f]) => {
240
- h[k] = f.value;
241
- });
242
- const _ = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, S = e ? (e == null ? void 0 : e.guests) || [] : (i == null ? void 0 : i.guests) || [], p = e ? e == null ? void 0 : e.additionalFields : h, T = this.getHeaders(), v = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, g = await this.makeAPIRequest(decodeURIComponent(v), "POST", JSON.stringify({
243
- participants: c ? [{ email: c }] : void 0,
244
- additional_fields: p,
245
- additional_guests: S,
246
- guest: { ..._ },
247
- start_time: n.start_time.getTime() / 1e3,
248
- end_time: n.end_time.getTime() / 1e3,
249
- timezone: a,
250
- email_language: this.getTwoLetterLanguageCode(l)
251
- }), T);
252
- if ("error" in g) {
253
- this.schedulerStore.set("isLoading", !1);
254
- const k = (I = g.error) == null ? void 0 : I.type;
255
- let f = g.error;
256
- if (k && k in this.errors.api("Create Booking")) {
257
- const E = this.getErrorMessage(f);
258
- f = this.errors.api("Create Booking")[k](E);
259
- }
260
- return { error: f };
261
- }
262
- return "data" in g && this.schedulerStore.set("eventInfo", g == null ? void 0 : g.data), this.schedulerStore.set("isLoading", !1), g;
263
- }
264
- async getUISettings() {
265
- var n;
266
- this.schedulerStore.set("isLoading", !0);
267
- const e = this.schedulerStore.get("rescheduleBookingId"), t = this.getHeaders();
268
- let s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "";
269
- e && s ? s += `&booking_id=${e}` : e && (s += `?booking_id=${e}`);
270
- const i = `/v3/scheduling/ui-settings${s}`, r = await this.makeAPIRequest(i, "GET", void 0, t);
271
- if ("error" in r) {
272
- this.schedulerStore.set("isLoading", !1);
273
- const a = (n = r.error) == null ? void 0 : n.type;
274
- let l = r.error;
275
- return a && a in this.errors.api(d.t("getUISettingErrorTitle")) && (l = this.errors.api(d.t("getUISettingErrorTitle"))[a]((l == null ? void 0 : l.message) || (l == null ? void 0 : l.title) || "Something went wrong")), { error: l };
276
- }
277
- return "data" in r && this.schedulerStore.set("configSettings", r.data), this.schedulerStore.set("isLoading", !1), r;
278
- }
279
- getTwoLetterLanguageCode(e) {
280
- return e.split("-")[0];
281
- }
282
- getStartTimeWithMinBookingNotice(e) {
283
- var r;
284
- const t = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.scheduler, s = t == null ? void 0 : t.min_booking_notice;
285
- if (!s)
286
- return e;
287
- const i = (/* @__PURE__ */ new Date()).getTime();
288
- return e < (i + s * 60 * 1e3) / 1e3 ? Math.floor((i + s * 60 * 1e3) / 1e3) : e;
289
- }
290
- getEndTimeForAvailableDaysInFuture(e) {
291
- var n, a;
292
- const t = /* @__PURE__ */ new Date(), s = (a = (n = this.schedulerStore.get("configSettings")) == null ? void 0 : n.scheduler) == null ? void 0 : a.available_days_in_future, i = Math.floor(R(t, s).getTime() / 1e3);
293
- return Math.min(i, e);
294
- }
295
- async getAvailability(e = 0, t = 0) {
296
- var _, S, p, T;
297
- this.schedulerStore.set("isLoading", !0);
298
- const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), r = i.getTime();
299
- if (t && t < r / 1e3)
300
- return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(d.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
301
- if (!e) {
302
- const m = new Date(i.getFullYear(), i.getMonth(), 1);
303
- e = Math.floor(m.getTime() / 1e3);
304
- }
305
- if (!t) {
306
- const m = new Date(i.getFullYear(), i.getMonth() + 1, 0);
307
- t = Math.floor(m.getTime() / 1e3);
308
- }
309
- t = this.getEndTimeForAvailableDaysInFuture(t);
310
- const n = this.getStartTimeWithMinBookingNotice(e);
311
- e = n, t = n > t ? n + 1 : t, s.append("start_time", encodeURIComponent(e.toString())), s.append("end_time", encodeURIComponent(t.toString())), this.configId && !this.sessionId ? s.append("configuration_id", encodeURIComponent(this.configId)) : this.slug && this.clientId && !this.sessionId && (s.append("slug", encodeURIComponent(this.slug)), s.append("client_id", encodeURIComponent(this.clientId)));
312
- const a = this.schedulerStore.get("rescheduleBookingId");
313
- a && s.append("booking_id", encodeURIComponent(a));
314
- const l = s.toString(), u = `/v3/scheduling/availability${l ? `?${l}` : ""}`, c = this.getHeaders(), h = await this.makeAPIRequest(decodeURIComponent(u), "GET", void 0, c);
315
- if ("error" in h) {
316
- this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
317
- const m = (_ = h.error) == null ? void 0 : _.type;
318
- let v = h.error;
319
- if (m && m in this.errors.api(d.t("getAvailabilityErrorTitle"))) {
320
- const g = this.getErrorMessage(v);
321
- v = this.errors.api(d.t("getAvailabilityErrorTitle"))[m](g);
322
- }
323
- return { error: v };
324
- }
325
- if ("data" in h) {
326
- const v = (((p = (S = h.data) == null ? void 0 : S.time_slots) == null ? void 0 : p.map((I) => ({
327
- ...I,
328
- start_time: new Date(I.start_time * 1e3),
329
- end_time: new Date(I.end_time * 1e3)
330
- }))) || []).filter((I) => I.start_time.getTime() > r);
331
- this.schedulerStore.set("availability", v);
332
- const g = ((T = h.data) == null ? void 0 : T.order) || [];
333
- this.schedulerStore.set("availabilityOrderEmails", g);
334
- }
335
- return this.schedulerStore.set("isLoading", !1), h;
336
- }
337
- async cancelBooking(e, t) {
338
- var a;
339
- if (this.schedulerStore.set("isLoading", !0), !e)
340
- return { error: this.errors.component(d.t("cancelBookingErrorTitle")).no_booking_id() };
341
- const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", i = `/v3/scheduling/bookings/${e}${s}`, r = this.getHeaders(), n = await this.makeAPIRequest(decodeURIComponent(i), "DELETE", JSON.stringify({
342
- action: "cancel",
343
- cancellation_reason: t
344
- }), r);
345
- if ("error" in n) {
346
- this.schedulerStore.set("isLoading", !1);
347
- const l = (a = n.error) == null ? void 0 : a.type;
348
- let u = n.error;
349
- if (l && l in this.errors.api(d.t("cancelBookingErrorTitle"))) {
350
- const c = this.getErrorMessage(u);
351
- u = this.errors.api(d.t("cancelBookingErrorTitle"))[l](c);
352
- }
353
- return { error: u };
354
- }
355
- return this.schedulerStore.set("cancelledEventInfo", {
356
- booking_id: e
357
- }), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), n;
358
- }
359
- async rescheduleBooking(e, t) {
360
- var A;
361
- if (this.schedulerStore.set("isLoading", !0), !e)
362
- return { error: this.errors.component(d.t("rescheduleBookingErrorTitle")).no_booking_id() };
363
- const s = this.errors.api(d.t("rescheduleBookingErrorTitle")), i = this.errors.component(d.t("rescheduleBookingErrorTitle")), { bookingInfo: r, selectedTimeslot: n, selectedTimezone: a, selectedLanguage: l } = this.schedulerStore.state, { startTime: u, endTime: c, timezone: h } = t, _ = u || (n == null ? void 0 : n.start_time);
364
- if (!_)
365
- return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
366
- const S = c || (n == null ? void 0 : n.end_time);
367
- if (!S)
368
- return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
369
- const p = this.schedulerStore.get("availabilityOrderEmails");
370
- let T = "";
371
- if (p.length > 0) {
372
- const b = (n == null ? void 0 : n.emails) || [];
373
- for (let y = 0; y < p.length; y++)
374
- if (b.includes(p[y])) {
375
- T = p[y];
376
- break;
377
- }
378
- }
379
- const m = h || a;
380
- if (!m)
381
- return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
382
- const v = {};
383
- Object.entries((r == null ? void 0 : r.additionalFields) || {}).forEach(([b, y]) => {
384
- v[b] = y.value;
385
- });
386
- const g = t ? t == null ? void 0 : t.primaryParticipant : r == null ? void 0 : r.primaryParticipant, I = t ? (t == null ? void 0 : t.guests) || [] : (r == null ? void 0 : r.guests) || [], k = t ? t == null ? void 0 : t.additionalFields : v, f = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", E = `/v3/scheduling/bookings/${e}${f}`, P = this.getHeaders(), w = await this.makeAPIRequest(decodeURIComponent(E), "PATCH", JSON.stringify({
387
- start_time: _.getTime() / 1e3,
388
- end_time: S.getTime() / 1e3,
389
- timezone: m,
390
- additional_fields: k,
391
- guest: { ...g },
392
- additional_guests: I,
393
- participants: T ? [{ email: T }] : void 0,
394
- email_language: this.getTwoLetterLanguageCode(l)
395
- }), P);
396
- if ("error" in w) {
397
- this.schedulerStore.set("isLoading", !1);
398
- const b = (A = w.error) == null ? void 0 : A.type;
399
- let y = w.error;
400
- if (b && b in s) {
401
- const z = this.getErrorMessage(y);
402
- y = s[b](z);
403
- }
404
- return { error: y };
405
- }
406
- const D = this.schedulerStore.get("reschedulingEventInfo");
407
- if ("data" in w)
408
- this.schedulerStore.set("eventInfo", w == null ? void 0 : w.data);
409
- else if (D)
410
- this.schedulerStore.set("eventInfo", D);
411
- else {
412
- const b = {
413
- booking_id: e
414
- };
415
- this.schedulerStore.set("eventInfo", b);
416
- }
417
- return this.schedulerStore.set("isLoading", !1), w;
418
- }
419
- async updateBooking(e) {
420
- var h;
421
- this.schedulerStore.set("isLoading", !0);
422
- const { bookingId: t, status: s, reason: i } = e, r = this.schedulerStore.get("organizerConfirmationSalt"), n = s === "confirmed" ? d.t("confirmBookingErrorTitle") : d.t("rejectBookingErrorTitle");
423
- if (!t)
424
- return { error: this.errors.component(n).no_booking_id() };
425
- if (!r)
426
- return { error: this.errors.component(n).no_salt() };
427
- const a = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", l = `/v3/scheduling/bookings/${t}${a}`, u = this.getHeaders(), c = await this.makeAPIRequest(decodeURIComponent(l), "PUT", JSON.stringify({
428
- status: s,
429
- cancellation_reason: i,
430
- salt: r
431
- }), u);
432
- if ("error" in c) {
433
- this.schedulerStore.set("isLoading", !1);
434
- const _ = (h = c.error) == null ? void 0 : h.type;
435
- let S = c.error;
436
- if (_ && _ in this.errors.api(n)) {
437
- const p = this.getErrorMessage(S);
438
- S = this.errors.api(n)[_](p);
439
- }
440
- return { error: S };
441
- }
442
- return "data" in c && s === "confirmed" ? this.schedulerStore.set("confirmedEventInfo", c == null ? void 0 : c.data) : "request_id" in c && s === "cancelled" && this.schedulerStore.set("cancelledEventInfo", {
443
- booking_id: t
444
- }), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), c;
445
- }
446
- }
447
- function O(o = {}) {
448
- const e = {
449
- selectedDate: null,
450
- selectedLanguage: navigator.language,
451
- selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
452
- selectedTimeslot: null,
453
- showBookingForm: !1,
454
- availabilityOrderEmails: [],
455
- selectableDates: null,
456
- availability: [],
457
- eventDuration: 0,
458
- state: "ready",
459
- eventInfo: null,
460
- cancelledEventInfo: null,
461
- isLoading: !1,
462
- nylasBranding: !0,
463
- ...o
464
- };
465
- L("[defaultNylasStoreState]: ", e);
466
- const t = F(e);
467
- return t.onChange("availability", (s) => {
468
- L("[availability]: ", s);
469
- const i = s.map((a) => a.start_time);
470
- L("[selectableDates]: ", i), t.set("selectableDates", i);
471
- const r = s[0];
472
- if (!r)
473
- return;
474
- const n = Math.floor((r.end_time.getTime() - r.start_time.getTime()) / 6e4);
475
- L("[durationMinutes]: ", n), t.set("eventDuration", n);
476
- }), t.reset = () => {
477
- for (const s in e) {
478
- const i = e[s];
479
- t.set(s, i);
480
- }
481
- }, t;
482
- }
483
- export {
484
- O as C,
485
- B as E,
486
- N
487
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("./index-cfb93df6.cjs");exports.ErrorCategory=void 0;(function(o){o.Component="component",o.Api="api",o.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var D;(function(o){o.endtime_not_in_future="endtime_not_in_future",o.no_booking_info="no_booking_info",o.no_timeslot_selected="no_timeslot_selected",o.no_timezone_selected="no_timezone_selected",o.no_booking_id="no_booking_id",o.no_salt="no_salt",o.invalid_start_time="invalid_start_time",o.invalid_end_time="invalid_end_time",o.invalid_timezone="invalid_timezone"})(D||(D={}));var A;(function(o){o.invalid_session="invalid_session",o.general_error="general_error",o.internal_error="internal_error",o.invalid_request_error="invalid_request_error",o.timeslot_not_available="timeslot_not_available",o.provider_error="provider_error",o.not_found_error="not_found_error"})(A||(A={}));class P{constructor(){this.component=e=>{const t=exports.ErrorCategory.Component,s=`${e} Error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:t}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:t}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:t}),no_timezone_selected:(i="No timezone selected")=>({title:s,message:i,category:t}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:t}),no_salt:(i="No salt provided")=>({title:s,message:i,category:t}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:t}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:t}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:t})}},this.api=e=>{const t=exports.ErrorCategory.Api,s=`${e} Error`;return{invalid_session:i=>({title:s,message:i,category:t}),general_error:i=>({title:s,message:i,category:t}),internal_error:i=>({title:s,message:i,category:t}),invalid_request_error:i=>({title:s,message:i,category:t}),timeslot_not_available:i=>({title:s,message:i,category:t}),provider_error:i=>({title:s,message:i,category:t}),not_found_error:i=>({title:s,message:i,category:t})}}}}class ${constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:s,configId:i,slug:r,clientId:n}){this.errors=new P,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=s,this.configId=i,this.slug=r,this.clientId=n}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,s,i={}){try{const r=new URL(this.schedulerAPIURL),n="1.3.5";return r.pathname=e,await(await fetch(decodeURIComponent(r.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":n,...i},body:s})).json()}catch(r){return{error:{message:r.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var s,i,r,n;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";return(e==null?void 0:e.type)==="provider_error"&&(t=((i=(s=e==null?void 0:e.provider_error)==null?void 0:s.error)==null?void 0:i.message)||((n=(r=e==null?void 0:e.provider_error)==null?void 0:r.error)==null?void 0:n.title)||"Something went wrong"),t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e),a.instance.changeLanguage(e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,s=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;return await this.getAvailability(s,i)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),s=this.schedulerStore.get("availability").find(r=>new Date(r.start_time)>new Date);let i=e;return s&&(i=s.start_time),this.schedulerStore.set("selectedDate",i),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1),this.schedulerStore.set("selectedTimeslot",null),t}async setReschedule(e){this.schedulerStore.set("isLoading",!0);const t=this.schedulerStore.state.eventInfo;return t&&this.schedulerStore.set("reschedulingEventInfo",t),this.schedulerStore.set("rescheduleBookingId",e),await this.getUISettings(),await this.resetStoreStateAndFetchAvailability().finally(()=>{this.schedulerStore.set("isLoading",!1)})}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("rejectBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async goBack(){this.schedulerStore.set("cancelBookingId","")}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("confirmedEventInfo",void 0),e}async bookTimeslot(e){var I;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:s,bookingInfo:i,selectedLanguage:r}=this.schedulerStore.state;if(!e&&!i)return{error:this.errors.component(a.instance.t("createBookingErrorTitle")).no_booking_info()};const n=(e==null?void 0:e.timeslot)||t;if(!n)return{error:this.errors.component(a.instance.t("createBookingErrorTitle")).no_timeslot_selected()};const l=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:s,c=r||"en-US";if(!l)return{error:this.errors.component(a.instance.t("createBookingErrorTitle")).no_timezone_selected()};const u=this.schedulerStore.get("availabilityOrderEmails");let d="";if(u.length>0){const b=(n==null?void 0:n.emails)||[];for(let f=0;f<u.length;f++)if(b.includes(u[f])){d=u[f];break}}const h={};Object.entries((i==null?void 0:i.additionalFields)||{}).forEach(([b,f])=>{h[b]=f.value});const _=e?e==null?void 0:e.primaryParticipant:i==null?void 0:i.primaryParticipant,S=e?(e==null?void 0:e.guests)||[]:(i==null?void 0:i.guests)||[],p=e?e==null?void 0:e.additionalFields:h,T=this.getHeaders(),v=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:""}`,g=await this.makeAPIRequest(decodeURIComponent(v),"POST",JSON.stringify({participants:d?[{email:d}]:void 0,additional_fields:p,additional_guests:S,guest:{..._},start_time:n.start_time.getTime()/1e3,end_time:n.end_time.getTime()/1e3,timezone:l,email_language:this.getTwoLetterLanguageCode(c)}),T);if("error"in g){this.schedulerStore.set("isLoading",!1);const b=(I=g.error)==null?void 0:I.type;let f=g.error;if(b&&b in this.errors.api("Create Booking")){const E=this.getErrorMessage(f);f=this.errors.api("Create Booking")[b](E)}return{error:f}}return"data"in g&&this.schedulerStore.set("eventInfo",g==null?void 0:g.data),this.schedulerStore.set("isLoading",!1),g}async getUISettings(){var n;this.schedulerStore.set("isLoading",!0);const e=this.schedulerStore.get("rescheduleBookingId"),t=this.getHeaders();let s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";e&&s?s+=`&booking_id=${e}`:e&&(s+=`?booking_id=${e}`);const i=`/v3/scheduling/ui-settings${s}`,r=await this.makeAPIRequest(i,"GET",void 0,t);if("error"in r){this.schedulerStore.set("isLoading",!1);const l=(n=r.error)==null?void 0:n.type;let c=r.error;return l&&l in this.errors.api(a.instance.t("getUISettingErrorTitle"))&&(c=this.errors.api(a.instance.t("getUISettingErrorTitle"))[l]((c==null?void 0:c.message)||(c==null?void 0:c.title)||"Something went wrong")),{error:c}}return"data"in r&&this.schedulerStore.set("configSettings",r.data),this.schedulerStore.set("isLoading",!1),r}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){var r;const t=(r=this.schedulerStore.get("configSettings"))==null?void 0:r.scheduler,s=t==null?void 0:t.min_booking_notice;if(!s)return e;const i=new Date().getTime();return e<(i+s*60*1e3)/1e3?Math.floor((i+s*60*1e3)/1e3):e}getEndTimeForAvailableDaysInFuture(e){var n,l;const t=new Date,s=(l=(n=this.schedulerStore.get("configSettings"))==null?void 0:n.scheduler)==null?void 0:l.available_days_in_future,i=Math.floor(a.addDaysToCurrentDate(t,s).getTime()/1e3);return Math.min(i,e)}async getAvailability(e=0,t=0){var _,S,p,T;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,r=i.getTime();if(t&&t<r/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component(a.instance.t("getAvailabilityErrorTitle")).endtime_not_in_future()};if(!e){const m=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(m.getTime()/1e3)}if(!t){const m=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(m.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const n=this.getStartTimeWithMinBookingNotice(e);e=n,t=n>t?n+1:t,s.append("start_time",encodeURIComponent(e.toString())),s.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId?s.append("configuration_id",encodeURIComponent(this.configId)):this.slug&&this.clientId&&!this.sessionId&&(s.append("slug",encodeURIComponent(this.slug)),s.append("client_id",encodeURIComponent(this.clientId)));const l=this.schedulerStore.get("rescheduleBookingId");l&&s.append("booking_id",encodeURIComponent(l));const c=s.toString(),u=`/v3/scheduling/availability${c?`?${c}`:""}`,d=this.getHeaders(),h=await this.makeAPIRequest(decodeURIComponent(u),"GET",void 0,d);if("error"in h){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const m=(_=h.error)==null?void 0:_.type;let v=h.error;if(m&&m in this.errors.api(a.instance.t("getAvailabilityErrorTitle"))){const g=this.getErrorMessage(v);v=this.errors.api(a.instance.t("getAvailabilityErrorTitle"))[m](g)}return{error:v}}if("data"in h){const v=(((p=(S=h.data)==null?void 0:S.time_slots)==null?void 0:p.map(I=>({...I,start_time:new Date(I.start_time*1e3),end_time:new Date(I.end_time*1e3)})))||[]).filter(I=>I.start_time.getTime()>r);this.schedulerStore.set("availability",v);const g=((T=h.data)==null?void 0:T.order)||[];this.schedulerStore.set("availabilityOrderEmails",g)}return this.schedulerStore.set("isLoading",!1),h}async cancelBooking(e,t){var l;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(a.instance.t("cancelBookingErrorTitle")).no_booking_id()};const s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",i=`/v3/scheduling/bookings/${e}${s}`,r=this.getHeaders(),n=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),r);if("error"in n){this.schedulerStore.set("isLoading",!1);const c=(l=n.error)==null?void 0:l.type;let u=n.error;if(c&&c in this.errors.api(a.instance.t("cancelBookingErrorTitle"))){const d=this.getErrorMessage(u);u=this.errors.api(a.instance.t("cancelBookingErrorTitle"))[c](d)}return{error:u}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("rescheduleBookingId",""),this.schedulerStore.set("isLoading",!1),n}async rescheduleBooking(e,t){var B;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(a.instance.t("rescheduleBookingErrorTitle")).no_booking_id()};const s=this.errors.api(a.instance.t("rescheduleBookingErrorTitle")),i=this.errors.component(a.instance.t("rescheduleBookingErrorTitle")),{bookingInfo:r,selectedTimeslot:n,selectedTimezone:l,selectedLanguage:c}=this.schedulerStore.state,{startTime:u,endTime:d,timezone:h}=t,_=u||(n==null?void 0:n.start_time);if(!_)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const S=d||(n==null?void 0:n.end_time);if(!S)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const p=this.schedulerStore.get("availabilityOrderEmails");let T="";if(p.length>0){const k=(n==null?void 0:n.emails)||[];for(let y=0;y<p.length;y++)if(k.includes(p[y])){T=p[y];break}}const m=h||l;if(!m)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const v={};Object.entries((r==null?void 0:r.additionalFields)||{}).forEach(([k,y])=>{v[k]=y.value});const g=t?t==null?void 0:t.primaryParticipant:r==null?void 0:r.primaryParticipant,I=t?(t==null?void 0:t.guests)||[]:(r==null?void 0:r.guests)||[],b=t?t==null?void 0:t.additionalFields:v,f=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",E=`/v3/scheduling/bookings/${e}${f}`,C=this.getHeaders(),w=await this.makeAPIRequest(decodeURIComponent(E),"PATCH",JSON.stringify({start_time:_.getTime()/1e3,end_time:S.getTime()/1e3,timezone:m,additional_fields:b,guest:{...g},additional_guests:I,participants:T?[{email:T}]:void 0,email_language:this.getTwoLetterLanguageCode(c)}),C);if("error"in w){this.schedulerStore.set("isLoading",!1);const k=(B=w.error)==null?void 0:B.type;let y=w.error;if(k&&k in s){const M=this.getErrorMessage(y);y=s[k](M)}return{error:y}}const L=this.schedulerStore.get("reschedulingEventInfo");if("data"in w)this.schedulerStore.set("eventInfo",w==null?void 0:w.data);else if(L)this.schedulerStore.set("eventInfo",L);else{const k={booking_id:e};this.schedulerStore.set("eventInfo",k)}return this.schedulerStore.set("isLoading",!1),w}async updateBooking(e){var h;this.schedulerStore.set("isLoading",!0);const{bookingId:t,status:s,reason:i}=e,r=this.schedulerStore.get("organizerConfirmationSalt"),n=s==="confirmed"?a.instance.t("confirmBookingErrorTitle"):a.instance.t("rejectBookingErrorTitle");if(!t)return{error:this.errors.component(n).no_booking_id()};if(!r)return{error:this.errors.component(n).no_salt()};const l=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",c=`/v3/scheduling/bookings/${t}${l}`,u=this.getHeaders(),d=await this.makeAPIRequest(decodeURIComponent(c),"PUT",JSON.stringify({status:s,cancellation_reason:i,salt:r}),u);if("error"in d){this.schedulerStore.set("isLoading",!1);const _=(h=d.error)==null?void 0:h.type;let S=d.error;if(_&&_ in this.errors.api(n)){const p=this.getErrorMessage(S);S=this.errors.api(n)[_](p)}return{error:S}}return"data"in d&&s==="confirmed"?this.schedulerStore.set("confirmedEventInfo",d==null?void 0:d.data):"request_id"in d&&s==="cancelled"&&this.schedulerStore.set("cancelledEventInfo",{booking_id:t}),this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("isLoading",!1),d}}function z(o={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...o};a.debug("[defaultNylasStoreState]: ",e);const t=a.createStore(e);return t.onChange("availability",s=>{a.debug("[availability]: ",s);const i=s.map(l=>l.start_time);a.debug("[selectableDates]: ",i),t.set("selectableDates",i);const r=s[0];if(!r)return;const n=Math.floor((r.end_time.getTime()-r.start_time.getTime())/6e4);a.debug("[durationMinutes]: ",n),t.set("eventDuration",n)}),t.reset=()=>{for(const s in e){const i=e[s];t.set(s,i)}},t}exports.CreateNylasSchedulerStore=z;exports.NylaSchedulerAPIConnector=$;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-cfb93df6.cjs");require("react");require("react-dom");const c=".sc-sent-icon-h{display:flex}",a=c,e=class{constructor(s){t.registerInstance(this,s),this.width="15",this.height="15"}render(){return t.h("svg",{key:"0ad41e7b85d22b3be57d03090dfb7e39bcc46c40",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"d941ffc63a46e3fa2ccdca64b66c6faf2f5f3a4c",d:"M21.5 12L3.5 3.5L3.5 20.5L21.5 12Z",stroke:"auto","stroke-width":"1.5"}),t.h("path",{key:"0098af5d7a9432a2782cd06ad25614f97d766869",d:"M3.5 3.5L12 10.5",stroke:"auto","stroke-width":"1.5"}),t.h("path",{key:"1aaba59cbef1f759f899cecd2a24349a10061dba",d:"M3.5 20.5L12 13.5",stroke:"auto","stroke-width":"1.5"}))}};e.style=a;exports.sent_icon=e;
@@ -1,15 +0,0 @@
1
- import { r as s, h as t } from "./index-594c8e7b.js";
2
- import "react";
3
- import "react-dom";
4
- const a = ".sc-sent-icon-h{display:flex}", o = a, c = class {
5
- constructor(e) {
6
- s(this, e), this.width = "15", this.height = "15";
7
- }
8
- render() {
9
- return t("svg", { key: "0ad41e7b85d22b3be57d03090dfb7e39bcc46c40", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "d941ffc63a46e3fa2ccdca64b66c6faf2f5f3a4c", d: "M21.5 12L3.5 3.5L3.5 20.5L21.5 12Z", stroke: "auto", "stroke-width": "1.5" }), t("path", { key: "0098af5d7a9432a2782cd06ad25614f97d766869", d: "M3.5 3.5L12 10.5", stroke: "auto", "stroke-width": "1.5" }), t("path", { key: "1aaba59cbef1f759f899cecd2a24349a10061dba", d: "M3.5 20.5L12 13.5", stroke: "auto", "stroke-width": "1.5" }));
10
- }
11
- };
12
- c.style = o;
13
- export {
14
- c as sent_icon
15
- };
@@ -1,15 +0,0 @@
1
- import { r as e, h as t } from "./index-594c8e7b.js";
2
- import "react";
3
- import "react-dom";
4
- const o = ".sc-spam-icon-h{display:flex}", i = o, a = class {
5
- constructor(s) {
6
- e(this, s), this.width = "15", this.height = "15";
7
- }
8
- render() {
9
- return t("svg", { key: "2cf09db799baa037808e0e147267e6e521581656", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "f53e6026a77ef28e49938206d4ad39645a364078", d: "M20 3H4C2.89543 3 2 3.89543 2 5V19C2 20.1046 2.89543 21 4 21H20C21.1046 21 22 20.1046 22 19V5C22 3.89543 21.1046 3 20 3Z", stroke: "auto", "stroke-width": "1.5" }), t("path", { key: "bf941f342528605433f231734cba30b329dab16c", d: "M2 5L12 12.5L22 5", stroke: "auto", "stroke-width": "1.5" }));
10
- }
11
- };
12
- a.style = i;
13
- export {
14
- a as spam_icon
15
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-cfb93df6.cjs");require("react");require("react-dom");const i=".sc-spam-icon-h{display:flex}",o=i,t=class{constructor(s){e.registerInstance(this,s),this.width="15",this.height="15"}render(){return e.h("svg",{key:"2cf09db799baa037808e0e147267e6e521581656",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},e.h("path",{key:"f53e6026a77ef28e49938206d4ad39645a364078",d:"M20 3H4C2.89543 3 2 3.89543 2 5V19C2 20.1046 2.89543 21 4 21H20C21.1046 21 22 20.1046 22 19V5C22 3.89543 21.1046 3 20 3Z",stroke:"auto","stroke-width":"1.5"}),e.h("path",{key:"bf941f342528605433f231734cba30b329dab16c",d:"M2 5L12 12.5L22 5",stroke:"auto","stroke-width":"1.5"}))}};t.style=o;exports.spam_icon=t;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-cfb93df6.cjs");require("react");require("react-dom");const i=".sc-star-icon-h{display:flex}",r=i,e=class{constructor(s){t.registerInstance(this,s),this.width="15",this.height="15"}render(){return t.h("svg",{key:"0b63c8921b792299288eededbfbbaa36e9223fc0",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"460c1c080ff1127ba78c8962a904cb2456a5667e",d:"M9.15316 5.40838C10.4198 3.13613 11.0531 2 12 2C12.9469 2 13.5802 3.13612 14.8468 5.40837L15.1745 5.99623C15.5345 6.64193 15.7144 6.96479 15.9951 7.17781C16.2757 7.39083 16.6251 7.4699 17.3241 7.62805L17.9605 7.77203C20.4201 8.32856 21.65 8.60682 21.9426 9.54773C22.2352 10.4886 21.3968 11.4691 19.7199 13.4299L19.2861 13.9372C18.8096 14.4944 18.5713 14.773 18.4641 15.1177C18.357 15.4624 18.393 15.8341 18.465 16.5776L18.5306 17.2544C18.7841 19.8706 18.9109 21.1787 18.1449 21.7602C17.3788 22.3417 16.2273 21.8115 13.9243 20.7512L13.3285 20.4768C12.6741 20.1755 12.3469 20.0248 12 20.0248C11.6531 20.0248 11.3259 20.1755 10.6715 20.4768L10.0757 20.7512C7.77268 21.8115 6.62118 22.3417 5.85515 21.7602C5.08912 21.1787 5.21588 19.8706 5.4694 17.2544L5.53498 16.5776C5.60703 15.8341 5.64305 15.4624 5.53586 15.1177C5.42868 14.773 5.19043 14.4944 4.71392 13.9372L4.2801 13.4299C2.60325 11.4691 1.76482 10.4886 2.05742 9.54773C2.35002 8.60682 3.57986 8.32856 6.03954 7.77203L6.67589 7.62805C7.37485 7.4699 7.72433 7.39083 8.00494 7.17781C8.28555 6.96479 8.46553 6.64194 8.82547 5.99623L9.15316 5.40838Z",stroke:"auto","stroke-width":"1.5"}))}};e.style=r;exports.star_icon=e;
@@ -1,15 +0,0 @@
1
- import { r as s, h as t } from "./index-594c8e7b.js";
2
- import "react";
3
- import "react-dom";
4
- const e = ".sc-stop-icon-h{display:flex}", i = e, c = class {
5
- constructor(o) {
6
- s(this, o), this.width = "15", this.height = "15";
7
- }
8
- render() {
9
- return t("svg", { key: "df7eec4c007960f83155487d96452a10ffcbcd7e", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "1cd0f4af8c05959b3be310a29864967382e732c0", d: "M4 4H20V20H4V4Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
10
- }
11
- };
12
- c.style = i;
13
- export {
14
- c as stop_icon
15
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-cfb93df6.cjs");require("react");require("react-dom");const s=".sc-stop-icon-h{display:flex}",i=s,e=class{constructor(o){t.registerInstance(this,o),this.width="15",this.height="15"}render(){return t.h("svg",{key:"df7eec4c007960f83155487d96452a10ffcbcd7e",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"1cd0f4af8c05959b3be310a29864967382e732c0",d:"M4 4H20V20H4V4Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};e.style=i;exports.stop_icon=e;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-cfb93df6.cjs");require("react");require("react-dom");const s=':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0;display:flex;gap:4px;align-items:center}label .error{color:var(--nylas-error)}textarea{display:flex;height:48px;padding-left:16px;align-items:center;gap:8px;align-self:stretch;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background:var(--nylas-base-0);width:-webkit-fill-available;color:var(--nylas-base-900);font-size:16px;font-style:normal;font-weight:400;line-height:150%;padding:12px 16px;border-width:1;resize:vertical;border-radius:8px;font-family:var(--nylas-font-family);font-size:16px;line-height:24px}textarea:focus{outline-color:var(--nylas-primary)}textarea.error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}textarea.error::placeholder{font-weight:400}textarea::placeholder{color:var(--nylas-base-300)}textarea::-webkit-resizer{display:none}',l=s,r=class{constructor(a){e.registerInstance(this,a),this.nylasFormInputChanged=e.createEvent(this,"nylasFormInputChanged",7),this.name="textarea",this.defaultValue=void 0,this.label="",this.placeholder="",this.required=!1,this.readOnly=!1,this.autoFocus=!1,this.maxLength=255,this.type="multi_line_text",this.tooltip="",this.value="",this.error=""}componentDidLoad(){this.value=e.sanitize(this.defaultValue||"")}handleBookingFormSubmitted(a){this.validate(this.value),this.error&&a.preventDefault()}handletriggerValidation(a){this.validate(this.value),this.error&&a.preventDefault()}handleInput(a){const t=a.target;this.value=e.sanitize(t.value),this.nylasFormInputChanged.emit({value:this.value,name:this.name,error:this.error,label:this.label,type:this.type})}validate(a){this.required&&!a?this.error=`${this.label} is required.`:a.length>this.maxLength?this.error=`${this.label} cannot exceed ${this.maxLength} characters.`:this.error=""}render(){return e.h("label",{key:"18b05c7318527e7cf7215bf3825e2e65674527d9",part:"tc__label",class:{error:!!this.error}},e.h("p",{key:"ab8167c6d7f695c75ecf00f3719783fdb92b92f5"},e.h("span",{key:"f0669daea951f39a0f47929cf84fe2c573c7ab48",class:"label"},this.label),this.required&&e.h("span",{class:"required"},"*"),this.tooltip&&e.h("tooltip-component",null,e.h("info-icon",{slot:"tooltip-icon"}),e.h("span",{slot:"tooltip-content"},this.tooltip))),e.h("textarea",{key:"c0960b3e0662e02cd5e26586853cd1550b0fc4e5",name:this.name,placeholder:this.placeholder,readOnly:this.readOnly,autoFocus:this.autoFocus,value:this.value,maxLength:this.maxLength,onInput:a=>this.handleInput(a),class:{error:!!this.error},part:"tc__textarea"}),this.error&&e.h("span",{class:"error help-text"},this.error))}};r.style=l;exports.textarea_component=r;
@@ -1,37 +0,0 @@
1
- import { r as s, c as l, t as r, h as a } from "./index-594c8e7b.js";
2
- import "react";
3
- import "react-dom";
4
- const i = ':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0;display:flex;gap:4px;align-items:center}label .error{color:var(--nylas-error)}textarea{display:flex;height:48px;padding-left:16px;align-items:center;gap:8px;align-self:stretch;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background:var(--nylas-base-0);width:-webkit-fill-available;color:var(--nylas-base-900);font-size:16px;font-style:normal;font-weight:400;line-height:150%;padding:12px 16px;border-width:1;resize:vertical;border-radius:8px;font-family:var(--nylas-font-family);font-size:16px;line-height:24px}textarea:focus{outline-color:var(--nylas-primary)}textarea.error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}textarea.error::placeholder{font-weight:400}textarea::placeholder{color:var(--nylas-base-300)}textarea::-webkit-resizer{display:none}', n = i, o = class {
5
- constructor(e) {
6
- s(this, e), this.nylasFormInputChanged = l(this, "nylasFormInputChanged", 7), this.name = "textarea", this.defaultValue = void 0, this.label = "", this.placeholder = "", this.required = !1, this.readOnly = !1, this.autoFocus = !1, this.maxLength = 255, this.type = "multi_line_text", this.tooltip = "", this.value = "", this.error = "";
7
- }
8
- componentDidLoad() {
9
- this.value = r(this.defaultValue || "");
10
- }
11
- handleBookingFormSubmitted(e) {
12
- this.validate(this.value), this.error && e.preventDefault();
13
- }
14
- handletriggerValidation(e) {
15
- this.validate(this.value), this.error && e.preventDefault();
16
- }
17
- handleInput(e) {
18
- const t = e.target;
19
- this.value = r(t.value), this.nylasFormInputChanged.emit({
20
- value: this.value,
21
- name: this.name,
22
- error: this.error,
23
- label: this.label,
24
- type: this.type
25
- });
26
- }
27
- validate(e) {
28
- this.required && !e ? this.error = `${this.label} is required.` : e.length > this.maxLength ? this.error = `${this.label} cannot exceed ${this.maxLength} characters.` : this.error = "";
29
- }
30
- render() {
31
- return a("label", { key: "18b05c7318527e7cf7215bf3825e2e65674527d9", part: "tc__label", class: { error: !!this.error } }, a("p", { key: "ab8167c6d7f695c75ecf00f3719783fdb92b92f5" }, a("span", { key: "f0669daea951f39a0f47929cf84fe2c573c7ab48", class: "label" }, this.label), this.required && a("span", { class: "required" }, "*"), this.tooltip && a("tooltip-component", null, a("info-icon", { slot: "tooltip-icon" }), a("span", { slot: "tooltip-content" }, this.tooltip))), a("textarea", { key: "c0960b3e0662e02cd5e26586853cd1550b0fc4e5", name: this.name, placeholder: this.placeholder, readOnly: this.readOnly, autoFocus: this.autoFocus, value: this.value, maxLength: this.maxLength, onInput: (e) => this.handleInput(e), class: { error: !!this.error }, part: "tc__textarea" }), this.error && a("span", { class: "error help-text" }, this.error));
32
- }
33
- };
34
- o.style = n;
35
- export {
36
- o as textarea_component
37
- };