@nylas/react 1.4.4 → 2.0.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 (161) hide show
  1. package/README.md +7 -0
  2. package/dist/add-circle-icon_2.entry-8a1c55bc.cjs +1 -0
  3. package/dist/{add-circle-icon_2.entry-615fc101.js → add-circle-icon_2.entry-b4bbcfee.js} +3 -3
  4. package/dist/archive-icon.entry-a2492cf3.js +16 -0
  5. package/dist/archive-icon.entry-e48d2356.cjs +1 -0
  6. package/dist/{arrow-icon.entry-da152ec2.js → arrow-icon.entry-9414299f.js} +5 -5
  7. package/dist/arrow-icon.entry-b1ecb2aa.cjs +1 -0
  8. package/dist/{bold-icon.entry-61046c15.js → bold-icon.entry-b72aed9f.js} +4 -4
  9. package/dist/{bold-icon.entry-58679992.cjs → bold-icon.entry-c781e9c1.cjs} +1 -1
  10. package/dist/{button-component_2.entry-db53e00a.js → button-component_2.entry-36e49459.js} +9 -9
  11. package/dist/{button-component_2.entry-53bfdc19.cjs → button-component_2.entry-73f76545.cjs} +1 -1
  12. package/dist/calendar-agenda-fill-icon_36.entry-e9b92e0e.cjs +6 -0
  13. package/dist/{calendar-agenda-fill-icon_36.entry-76796ea7.js → calendar-agenda-fill-icon_36.entry-efa7ad26.js} +100 -100
  14. package/dist/{calendar-cancel-icon.entry-e5032d71.cjs → calendar-cancel-icon.entry-01c388eb.cjs} +1 -1
  15. package/dist/{calendar-cancel-icon.entry-f3b8ae99.js → calendar-cancel-icon.entry-0f739a8a.js} +4 -4
  16. package/dist/{calendar-check-icon_2.entry-7303362a.cjs → calendar-check-icon_2.entry-5febbadf.cjs} +1 -1
  17. package/dist/{calendar-check-icon_2.entry-27dc91f7.js → calendar-check-icon_2.entry-dfb0036d.js} +3 -3
  18. package/dist/{calendar-icon.entry-4f432baf.cjs → calendar-icon.entry-9743e0b7.cjs} +1 -1
  19. package/dist/{calendar-icon.entry-48fc45d6.js → calendar-icon.entry-f197396d.js} +2 -2
  20. package/dist/{checkbox-component.entry-8fad4faf.cjs → checkbox-component.entry-1aa5782f.cjs} +1 -1
  21. package/dist/{checkbox-component.entry-a15ffc4c.js → checkbox-component.entry-72a6aa72.js} +4 -4
  22. package/dist/checkmark-icon_15.entry-35dd97b7.cjs +5 -0
  23. package/dist/{checkmark-icon_15.entry-9f926a70.js → checkmark-icon_15.entry-5c09cff5.js} +225 -223
  24. package/dist/{chevron-icon_3.entry-5130fbba.js → chevron-icon_3.entry-4a72f211.js} +6 -6
  25. package/dist/chevron-icon_3.entry-e0608b7c.cjs +1 -0
  26. package/dist/{clock-icon_4.entry-40a393c9.js → clock-icon_4.entry-0afe79c2.js} +8 -8
  27. package/dist/{clock-icon_4.entry-ac65deae.cjs → clock-icon_4.entry-202ce025.cjs} +1 -1
  28. package/dist/constants-f51538ef-cd2a67c4.cjs +1 -0
  29. package/dist/{constants-3d8016e3-3c080f00.js → constants-f51538ef-e0a5f026.js} +27 -32
  30. package/dist/{customParseFormat-a4d9ea69-763f219e.cjs → customParseFormat-d1de5ed0-65a0bba3.cjs} +1 -1
  31. package/dist/{customParseFormat-a4d9ea69-7caebeb2.js → customParseFormat-d1de5ed0-c0ef002d.js} +1 -1
  32. package/dist/{delete-icon.entry-78e44eba.js → delete-icon.entry-580bfcc9.js} +4 -4
  33. package/dist/{delete-icon.entry-770dac8c.cjs → delete-icon.entry-762ac892.cjs} +1 -1
  34. package/dist/{document-refresh-icon.entry-d331f844.cjs → document-refresh-icon.entry-4e0f0c61.cjs} +1 -1
  35. package/dist/document-refresh-icon.entry-e500b4e3.js +16 -0
  36. package/dist/elements/index.d.ts +0 -8
  37. package/dist/{feedbackSync-57bb471a-ee800a95.js → feedbackSync-172f942c-42124493.js} +1 -1
  38. package/dist/{feedbackSync-57bb471a-5afb7715.cjs → feedbackSync-172f942c-62f72bd2.cjs} +1 -1
  39. package/dist/{folder-icon.entry-163e0aee.cjs → folder-icon.entry-2694e253.cjs} +1 -1
  40. package/dist/{folder-icon.entry-42650400.js → folder-icon.entry-54c3cc66.js} +2 -2
  41. package/dist/{forward-icon.entry-d60b6e31.js → forward-icon.entry-5e540f05.js} +5 -5
  42. package/dist/{forward-icon.entry-0a499b38.cjs → forward-icon.entry-f07102d8.cjs} +1 -1
  43. package/dist/{globe-icon_2.entry-19359092.cjs → globe-icon_2.entry-14a4c168.cjs} +1 -1
  44. package/dist/{globe-icon_2.entry-5afa8049.js → globe-icon_2.entry-aaceb196.js} +90 -80
  45. package/dist/{google-logo-icon_6.entry-d2febb78.js → google-logo-icon_6.entry-00d40db2.js} +473 -439
  46. package/dist/google-logo-icon_6.entry-fa76ffe3.cjs +2 -0
  47. package/dist/{google-meet-icon_5.entry-4a94137f.cjs → google-meet-icon_5.entry-6c20e149.cjs} +1 -1
  48. package/dist/{google-meet-icon_5.entry-7b1b36f2.js → google-meet-icon_5.entry-f1f05903.js} +12 -12
  49. package/dist/inbox-icon.entry-9a4628f2.cjs +1 -0
  50. package/dist/inbox-icon.entry-aa78ba8c.js +16 -0
  51. package/dist/index-1e75512f.cjs +57 -0
  52. package/dist/{index-9243e481.js → index-e8380973.js} +5687 -4802
  53. package/dist/{index.es-13ff6710-0f748bd2.cjs → index.es-fc8588de-034ead51.cjs} +6 -6
  54. package/dist/{index.es-13ff6710-73fa05e6.js → index.es-fc8588de-c943eef6.js} +827 -1065
  55. package/dist/{info-icon_2.entry-ba869bab.js → info-icon_2.entry-b3b313ab.js} +3 -3
  56. package/dist/{info-icon_2.entry-6667923a.cjs → info-icon_2.entry-bbcefb9a.cjs} +1 -1
  57. package/dist/{input-component.entry-7396acf1.js → input-component.entry-401b9ba5.js} +9 -9
  58. package/dist/{input-component.entry-db84f917.cjs → input-component.entry-ec8e8e7c.cjs} +1 -1
  59. package/dist/input-dropdown_2.entry-8cb11601.cjs +1 -0
  60. package/dist/{input-dropdown_2.entry-20f2031b.js → input-dropdown_2.entry-c37f392c.js} +6 -6
  61. package/dist/italic-icon.entry-0e85d0d9.js +16 -0
  62. package/dist/italic-icon.entry-6675558a.cjs +1 -0
  63. package/dist/{multi-select-dropdown_2.entry-81740b34.js → multi-select-dropdown_2.entry-3eecf18a.js} +22 -16
  64. package/dist/{multi-select-dropdown_2.entry-8e07b42b.cjs → multi-select-dropdown_2.entry-e37c501d.cjs} +1 -1
  65. package/dist/{nylas-booked-event-card_12.entry-e56c8e92.js → nylas-booked-event-card_12.entry-e7464ae7.js} +226 -224
  66. package/dist/nylas-booked-event-card_12.entry-fddc9ab8.cjs +1 -0
  67. package/dist/{nylas-event-calendar_3.entry-2504c7c0.js → nylas-event-calendar_3.entry-9abd46c2.js} +2360 -2238
  68. package/dist/nylas-event-calendar_3.entry-e6669bbf.cjs +11 -0
  69. package/dist/{nylas-form-card.entry-98903549.js → nylas-form-card.entry-a3186807.js} +3 -3
  70. package/dist/{nylas-form-card.entry-c406e3d3.cjs → nylas-form-card.entry-cbb00fba.cjs} +1 -1
  71. package/dist/nylas-scheduler-editor.entry-5c92901a.cjs +2 -0
  72. package/dist/{nylas-scheduler-editor.entry-670cc0b8.js → nylas-scheduler-editor.entry-7b188a38.js} +83 -50
  73. package/dist/nylas-scheduling.entry-970240f6.cjs +1 -0
  74. package/dist/nylas-scheduling.entry-e9929b03.js +968 -0
  75. package/dist/{person-icon.entry-bdaa899b.cjs → person-icon.entry-8998fdb8.cjs} +1 -1
  76. package/dist/{person-icon.entry-3bca6e51.js → person-icon.entry-d2856f08.js} +4 -4
  77. package/dist/{play-icon.entry-ecc86e85.cjs → play-icon.entry-99eb969b.cjs} +1 -1
  78. package/dist/play-icon.entry-f949a80f.js +16 -0
  79. package/dist/{radio-button-group.entry-9851076c.js → radio-button-group.entry-bc3b12fd.js} +2 -2
  80. package/dist/{radio-button-group.entry-6965ad34.cjs → radio-button-group.entry-d66edd04.cjs} +1 -1
  81. package/dist/react.cjs +1 -1
  82. package/dist/react.js +96 -104
  83. package/dist/{refresh-icon.entry-90d52ab3.cjs → refresh-icon.entry-99d1982d.cjs} +1 -1
  84. package/dist/{refresh-icon.entry-d776c4a7.js → refresh-icon.entry-d6df8b1c.js} +2 -2
  85. package/dist/{register-component-02a05665-2e992621.js → register-component-62d792d4-448b6a43.js} +1 -1
  86. package/dist/{register-component-02a05665-75652287.cjs → register-component-62d792d4-c6e7d129.cjs} +1 -1
  87. package/dist/{reply-all-icon.entry-24f7c0fe.js → reply-all-icon.entry-7ebf01a0.js} +2 -2
  88. package/dist/{reply-all-icon.entry-6e49eb03.cjs → reply-all-icon.entry-d7c44139.cjs} +1 -1
  89. package/dist/{reply-icon.entry-7fff25c9.cjs → reply-icon.entry-058c00e8.cjs} +1 -1
  90. package/dist/{reply-icon.entry-d5d26d65.js → reply-icon.entry-d1622d85.js} +5 -5
  91. package/dist/sent-icon.entry-6c604512.cjs +1 -0
  92. package/dist/sent-icon.entry-fe12bc2f.js +16 -0
  93. package/dist/spam-icon.entry-45e5292e.cjs +1 -0
  94. package/dist/spam-icon.entry-b97c7709.js +16 -0
  95. package/dist/{star-icon.entry-3c57a35c.cjs → star-icon.entry-4db13fdb.cjs} +1 -1
  96. package/dist/{star-icon.entry-c2e743a9.js → star-icon.entry-98b80645.js} +6 -6
  97. package/dist/{stop-icon.entry-0b9563d5.js → stop-icon.entry-0290fd30.js} +2 -2
  98. package/dist/{stop-icon.entry-cf4c4e63.cjs → stop-icon.entry-9d7b53fd.cjs} +1 -1
  99. package/dist/{textarea-component.entry-2eccc173.cjs → textarea-component.entry-9b474ab5.cjs} +1 -1
  100. package/dist/{textarea-component.entry-60e7a4d0.js → textarea-component.entry-a62c257b.js} +2 -2
  101. package/dist/{toggle-switch.entry-612744fd.cjs → toggle-switch.entry-5dbfcd48.cjs} +1 -1
  102. package/dist/{toggle-switch.entry-0a6b01e6.js → toggle-switch.entry-e423b793.js} +2 -2
  103. package/dist/{translate-icon.entry-ede5f77d.js → translate-icon.entry-60c55a2e.js} +4 -4
  104. package/dist/{translate-icon.entry-8adc4146.cjs → translate-icon.entry-f82fa6fc.cjs} +1 -1
  105. package/dist/trash-fill-icon.entry-095caae3.cjs +1 -0
  106. package/dist/trash-fill-icon.entry-825055fd.js +16 -0
  107. package/dist/{underline-icon.entry-d2fe2da6.cjs → underline-icon.entry-0807a43d.cjs} +1 -1
  108. package/dist/{underline-icon.entry-b2b43ba2.js → underline-icon.entry-40028bc6.js} +2 -2
  109. package/dist/{warning-icon.entry-0a5c7337.js → warning-icon.entry-24e37759.js} +2 -2
  110. package/dist/{warning-icon.entry-85822f4d.cjs → warning-icon.entry-fce7c14f.cjs} +1 -1
  111. package/package.json +2 -2
  112. package/dist/add-circle-icon_2.entry-e616ece6.cjs +0 -1
  113. package/dist/archive-icon.entry-41938a61.cjs +0 -1
  114. package/dist/archive-icon.entry-bd81d2d9.js +0 -16
  115. package/dist/arrow-icon.entry-4103be57.cjs +0 -1
  116. package/dist/calendar-agenda-fill-icon_36.entry-917e4a9d.cjs +0 -6
  117. package/dist/checkmark-icon_15.entry-08c8b107.cjs +0 -5
  118. package/dist/chevron-icon_3.entry-2f75c3c4.cjs +0 -1
  119. package/dist/constants-3d8016e3-fd6c3848.cjs +0 -1
  120. package/dist/document-refresh-icon.entry-f6dfe744.js +0 -16
  121. package/dist/google-logo-icon_6.entry-896a10a5.cjs +0 -2
  122. package/dist/inbox-icon.entry-24ec450f.cjs +0 -1
  123. package/dist/inbox-icon.entry-b71acde0.js +0 -16
  124. package/dist/index-efb6db79.cjs +0 -57
  125. package/dist/input-dropdown_2.entry-0c219620.cjs +0 -1
  126. package/dist/italic-icon.entry-a9324a8a.cjs +0 -1
  127. package/dist/italic-icon.entry-c42f8112.js +0 -16
  128. package/dist/notebook-store-b61693cd-5657061b.js +0 -14
  129. package/dist/notebook-store-b61693cd-6515d345.cjs +0 -5
  130. package/dist/nylas-booked-event-card_12.entry-7c7afae5.cjs +0 -1
  131. package/dist/nylas-call-summary.entry-4bf7284f.cjs +0 -1
  132. package/dist/nylas-call-summary.entry-ad6fb46a.js +0 -16
  133. package/dist/nylas-event-calendar_3.entry-f747f6a8.cjs +0 -6
  134. package/dist/nylas-if-state.entry-6b071705.cjs +0 -1
  135. package/dist/nylas-if-state.entry-7468854a.js +0 -95
  136. package/dist/nylas-key-points.entry-7af8da1a.cjs +0 -1
  137. package/dist/nylas-key-points.entry-c186445e.js +0 -29
  138. package/dist/nylas-login.entry-171bd025.cjs +0 -1
  139. package/dist/nylas-login.entry-d85c1473.js +0 -74
  140. package/dist/nylas-provider.entry-ab1f6886.js +0 -265
  141. package/dist/nylas-provider.entry-e4231b93.cjs +0 -1
  142. package/dist/nylas-scheduler-editor.entry-d522ca98.cjs +0 -2
  143. package/dist/nylas-scheduling.entry-9e81c6fc.js +0 -439
  144. package/dist/nylas-scheduling.entry-c52edb14.cjs +0 -1
  145. package/dist/nylas-transcript.entry-a1fa7e17.cjs +0 -6
  146. package/dist/nylas-transcript.entry-fb39b5af.js +0 -128
  147. package/dist/nylas-video-player.entry-25e8cd9a.js +0 -39
  148. package/dist/nylas-video-player.entry-89842545.cjs +0 -1
  149. package/dist/nylas-video-preview.entry-28a0bd60.cjs +0 -1
  150. package/dist/nylas-video-preview.entry-80171531.js +0 -16
  151. package/dist/play-icon.entry-d548464e.js +0 -16
  152. package/dist/scheduler-config-store-d6729d8d-50920e8c.js +0 -29
  153. package/dist/scheduler-config-store-d6729d8d-a0bdda83.cjs +0 -1
  154. package/dist/scheduler-store-fe9e85a4-1dcfddfa.js +0 -533
  155. package/dist/scheduler-store-fe9e85a4-baabf78a.cjs +0 -1
  156. package/dist/sent-icon.entry-42ce5bcb.cjs +0 -1
  157. package/dist/sent-icon.entry-858fe83e.js +0 -16
  158. package/dist/spam-icon.entry-0827144e.js +0 -16
  159. package/dist/spam-icon.entry-bf1a48b6.cjs +0 -1
  160. package/dist/trash-fill-icon.entry-b6456ec8.cjs +0 -1
  161. package/dist/trash-fill-icon.entry-d48f72c5.js +0 -16
@@ -0,0 +1,968 @@
1
+ import { i as c, r as V, a as F, b as O, k as U, l as K, m as ee, h as a, H as P, g as te, e as ie, F as ne } from "./index-e8380973.js";
2
+ import { n as j, N as se } from "./index.es-fc8588de-c943eef6.js";
3
+ import { L as oe } from "./constants-f51538ef-e0a5f026.js";
4
+ import { i as re, a as ae, c as le, b as de, f as ce } from "./feedbackSync-172f942c-42124493.js";
5
+ import "react";
6
+ import "react/jsx-runtime";
7
+ import "react-dom";
8
+ var J;
9
+ (function(i) {
10
+ i.Error = "error", i.Warning = "warning", i.Info = "info", i.Success = "success";
11
+ })(J || (J = {}));
12
+ var z;
13
+ (function(i) {
14
+ i.Component = "component", i.Api = "api", i.Auth = "auth";
15
+ })(z || (z = {}));
16
+ var Y;
17
+ (function(i) {
18
+ i.endtime_not_in_future = "endtime_not_in_future", i.no_booking_info = "no_booking_info", i.no_timeslot_selected = "no_timeslot_selected", i.no_timezone_selected = "no_timezone_selected", i.no_booking_id = "no_booking_id", i.no_salt = "no_salt", i.invalid_start_time = "invalid_start_time", i.invalid_end_time = "invalid_end_time", i.invalid_timezone = "invalid_timezone", i.no_config_id = "no_config_id";
19
+ })(Y || (Y = {}));
20
+ class he {
21
+ constructor() {
22
+ this.component = (e) => {
23
+ const t = z.Component, s = `${e} Error`;
24
+ return {
25
+ endtime_not_in_future: (n = '"endtime" can not be in the future') => ({
26
+ title: s,
27
+ message: n,
28
+ category: t
29
+ }),
30
+ no_booking_info: (n = "No booking info provided") => ({
31
+ title: s,
32
+ message: n,
33
+ category: t
34
+ }),
35
+ no_timeslot_selected: (n = "No timeslot selected") => ({
36
+ title: s,
37
+ message: n,
38
+ category: t
39
+ }),
40
+ no_timezone_selected: (n = "No timezone selected") => ({
41
+ title: s,
42
+ message: n,
43
+ category: t
44
+ }),
45
+ no_booking_id: (n = "No booking id provided") => ({
46
+ title: s,
47
+ message: n,
48
+ category: t
49
+ }),
50
+ no_salt: (n = "No salt provided") => ({
51
+ title: s,
52
+ message: n,
53
+ category: t
54
+ }),
55
+ invalid_start_time: (n = "Invalid start time") => ({
56
+ title: s,
57
+ message: n,
58
+ category: t
59
+ }),
60
+ invalid_end_time: (n = "Invalid end time") => ({
61
+ title: s,
62
+ message: n,
63
+ category: t
64
+ }),
65
+ invalid_timezone: (n = "Invalid timezone") => ({
66
+ title: s,
67
+ message: n,
68
+ category: t
69
+ }),
70
+ no_config_id: (n = "No configuration id provided") => ({
71
+ title: s,
72
+ message: n,
73
+ category: t
74
+ })
75
+ };
76
+ }, this.api = (e) => {
77
+ const t = z.Api, s = `${e} Error`;
78
+ return {
79
+ invalid_session: (n) => ({
80
+ title: s,
81
+ message: n,
82
+ category: t
83
+ }),
84
+ general_error: (n) => ({
85
+ title: s,
86
+ message: n,
87
+ category: t
88
+ }),
89
+ internal_error: (n) => ({
90
+ title: s,
91
+ message: n,
92
+ category: t
93
+ }),
94
+ invalid_request_error: (n) => ({
95
+ title: s,
96
+ message: n,
97
+ category: t
98
+ }),
99
+ timeslot_not_available: (n) => ({
100
+ title: s,
101
+ message: n,
102
+ category: t
103
+ }),
104
+ provider_error: (n) => ({
105
+ title: s,
106
+ message: n,
107
+ category: t
108
+ }),
109
+ not_found_error: (n) => ({
110
+ title: s,
111
+ message: n,
112
+ category: t
113
+ })
114
+ };
115
+ };
116
+ }
117
+ }
118
+ class ge {
119
+ constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: n, slug: r, clientId: o }) {
120
+ this.errors = new he(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = n, this.slug = r, this.clientId = o;
121
+ }
122
+ getHeaders() {
123
+ return this.sessionId ? {
124
+ Authorization: `Bearer ${this.sessionId}`
125
+ } : {};
126
+ }
127
+ async makeAPIRequest(e, t, s, n = {}) {
128
+ try {
129
+ const r = new URL(this.schedulerAPIURL), o = "2.0.0";
130
+ return r.pathname = e, await (await fetch(decodeURIComponent(r.toString()), {
131
+ method: t,
132
+ headers: {
133
+ "Content-Type": "application/json",
134
+ Origin: window.location.origin,
135
+ "X-Source": "nylas-scheduling",
136
+ "X-Nylas-Web-Elements-Version": o,
137
+ ...n
138
+ },
139
+ body: s
140
+ })).json();
141
+ } catch (r) {
142
+ return {
143
+ error: {
144
+ message: r.message,
145
+ title: "API request failed",
146
+ type: "api"
147
+ }
148
+ };
149
+ }
150
+ }
151
+ getErrorMessage(e) {
152
+ var s, n, r, o;
153
+ let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
154
+ return (e == null ? void 0 : e.type) === "provider_error" && (t = ((n = (s = e == null ? void 0 : e.provider_error) == null ? void 0 : s.error) == null ? void 0 : n.message) || ((o = (r = e == null ? void 0 : e.provider_error) == null ? void 0 : r.error) == null ? void 0 : o.title) || "Something went wrong"), t;
155
+ }
156
+ setConfigId(e) {
157
+ this.configId = e;
158
+ }
159
+ selectDate(e) {
160
+ this.schedulerStore.set("selectedDate", e), this.schedulerStore.set("selectedTimeslot", null);
161
+ }
162
+ selectTime(e) {
163
+ this.schedulerStore.set("selectedTimeslot", e);
164
+ }
165
+ selectTimezone(e) {
166
+ this.schedulerStore.set("selectedTimezone", e);
167
+ }
168
+ selectLanguage(e) {
169
+ this.schedulerStore.set("selectedLanguage", e), c.changeLanguage(e);
170
+ }
171
+ async toggleAdditionalData(e) {
172
+ e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
173
+ }
174
+ setParticipantName(e) {
175
+ const { bookingInfo: t } = this.schedulerStore.state;
176
+ this.schedulerStore.set("bookingInfo", {
177
+ ...t,
178
+ primaryParticipant: {
179
+ ...t == null ? void 0 : t.primaryParticipant,
180
+ name: e
181
+ }
182
+ });
183
+ }
184
+ setParticipantEmail(e) {
185
+ const { bookingInfo: t } = this.schedulerStore.state;
186
+ this.schedulerStore.set("bookingInfo", {
187
+ ...t,
188
+ primaryParticipant: {
189
+ ...t == null ? void 0 : t.primaryParticipant,
190
+ email: e
191
+ }
192
+ });
193
+ }
194
+ async refetchAvailability() {
195
+ 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, n = new Date(e.getFullYear(), e.getMonth() + 1, 1).getTime() / 1e3;
196
+ return await this.getAvailability(s, n);
197
+ }
198
+ async resetStoreStateAndFetchAvailability() {
199
+ const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((r) => new Date(r.start_time) > /* @__PURE__ */ new Date());
200
+ let n = e;
201
+ return s && (n = s.start_time), this.schedulerStore.set("selectedDate", n), this.schedulerStore.set("eventInfo", null), this.schedulerStore.set("showBookingForm", !1), this.schedulerStore.set("selectedTimeslot", null), t;
202
+ }
203
+ async setReschedule(e) {
204
+ this.schedulerStore.set("isLoading", !0);
205
+ const t = this.schedulerStore.state.eventInfo;
206
+ return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.getUISettings(), await this.resetStoreStateAndFetchAvailability().finally(() => {
207
+ this.schedulerStore.set("isLoading", !1);
208
+ });
209
+ }
210
+ async setCancel(e) {
211
+ this.schedulerStore.set("cancelBookingId", e);
212
+ }
213
+ async setReject(e) {
214
+ this.schedulerStore.set("rejectBookingId", e);
215
+ }
216
+ async resetCancel() {
217
+ const e = await this.resetStoreStateAndFetchAvailability();
218
+ return this.schedulerStore.set("cancelBookingId", ""), this.schedulerStore.set("rejectBookingId", ""), this.schedulerStore.set("cancelledEventInfo", null), e;
219
+ }
220
+ async goBack() {
221
+ this.schedulerStore.set("cancelBookingId", "");
222
+ }
223
+ async resetConfirm() {
224
+ const e = await this.resetStoreStateAndFetchAvailability();
225
+ return this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("confirmedEventInfo", void 0), e;
226
+ }
227
+ async bookTimeslot(e) {
228
+ var x, w, L;
229
+ this.schedulerStore.set("isLoading", !0);
230
+ const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: n, selectedLanguage: r } = this.schedulerStore.state;
231
+ if (!e && !n)
232
+ return { error: this.errors.component(c.t("createBookingErrorTitle")).no_booking_info() };
233
+ const o = (e == null ? void 0 : e.timeslot) || t;
234
+ if (!o)
235
+ return { error: this.errors.component(c.t("createBookingErrorTitle")).no_timeslot_selected() };
236
+ const l = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s, d = r || "en-US";
237
+ if (!l)
238
+ return { error: this.errors.component(c.t("createBookingErrorTitle")).no_timezone_selected() };
239
+ const f = [...this.schedulerStore.get("availabilityOrderEmails")];
240
+ let h = "";
241
+ const u = (o == null ? void 0 : o.emails) || [], g = {};
242
+ Object.entries((n == null ? void 0 : n.additionalFields) || {}).forEach(([y, B]) => {
243
+ g[y] = B.value;
244
+ });
245
+ const p = e ? e == null ? void 0 : e.primaryParticipant : n == null ? void 0 : n.primaryParticipant, b = e ? (e == null ? void 0 : e.guests) || [] : (n == null ? void 0 : n.guests) || [], S = e ? e == null ? void 0 : e.additionalFields : g, m = this.getHeaders(), I = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`;
246
+ if (f.length === 0) {
247
+ const y = await this.makeAPIRequest(decodeURIComponent(I), "POST", JSON.stringify({
248
+ additional_fields: S,
249
+ additional_guests: b,
250
+ guest: { ...p },
251
+ start_time: o.start_time.getTime() / 1e3,
252
+ end_time: o.end_time.getTime() / 1e3,
253
+ timezone: l,
254
+ event_id: (o == null ? void 0 : o.event_id) || void 0,
255
+ master_id: (o == null ? void 0 : o.master_id) || void 0,
256
+ calendar_id: (o == null ? void 0 : o.calendar_id) || void 0,
257
+ email_language: this.getTwoLetterLanguageCode(d)
258
+ }), m);
259
+ return this.schedulerStore.set("isLoading", !1), "data" in y ? (this.schedulerStore.set("eventInfo", y.data), y) : { error: y.error };
260
+ }
261
+ for (; f.length > 0; ) {
262
+ if (h = f.shift(), !u.includes(h))
263
+ continue;
264
+ const y = await this.makeAPIRequest(decodeURIComponent(I), "POST", JSON.stringify({
265
+ participants: h ? [{ email: h }] : void 0,
266
+ additional_fields: S,
267
+ additional_guests: b,
268
+ guest: { ...p },
269
+ start_time: o.start_time.getTime() / 1e3,
270
+ end_time: o.end_time.getTime() / 1e3,
271
+ timezone: l,
272
+ email_language: this.getTwoLetterLanguageCode(d)
273
+ }), m);
274
+ if ("data" in y)
275
+ return this.schedulerStore.set("isLoading", !1), this.schedulerStore.set("eventInfo", y == null ? void 0 : y.data), y;
276
+ if ((w = (x = y.error) == null ? void 0 : x.message) != null && w.startsWith("The selected timeslot is unavailable"))
277
+ continue;
278
+ {
279
+ this.schedulerStore.set("isLoading", !1);
280
+ const B = (L = y.error) == null ? void 0 : L.type;
281
+ let D = y.error;
282
+ if (B && B in this.errors.api(c.t("createBookingErrorTitle"))) {
283
+ const M = this.getErrorMessage(D);
284
+ D = this.errors.api(c.t("createBookingErrorTitle"))[B](M);
285
+ }
286
+ return { error: D };
287
+ }
288
+ }
289
+ return this.schedulerStore.set("isLoading", !1), {
290
+ error: this.errors.api(c.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")
291
+ };
292
+ }
293
+ async getUISettings() {
294
+ var o;
295
+ this.schedulerStore.set("isLoading", !0);
296
+ const e = this.schedulerStore.get("rescheduleBookingId"), t = this.getHeaders();
297
+ let s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "";
298
+ e && s ? s += `&booking_id=${e}` : e && (s += `?booking_id=${e}`);
299
+ const n = `/v3/scheduling/ui-settings${s}`, r = await this.makeAPIRequest(n, "GET", void 0, t);
300
+ if ("error" in r) {
301
+ this.schedulerStore.set("isLoading", !1);
302
+ const l = (o = r.error) == null ? void 0 : o.type;
303
+ let d = r.error;
304
+ return l && l in this.errors.api(c.t("getUISettingErrorTitle")) && (d = this.errors.api(c.t("getUISettingErrorTitle"))[l]((d == null ? void 0 : d.message) || (d == null ? void 0 : d.title) || "Something went wrong")), { error: d };
305
+ }
306
+ return "data" in r && this.schedulerStore.set("configSettings", r.data), this.schedulerStore.set("isLoading", !1), r;
307
+ }
308
+ getTwoLetterLanguageCode(e) {
309
+ return e.split("-")[0];
310
+ }
311
+ getStartTimeWithMinBookingNotice(e) {
312
+ var r;
313
+ const t = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.scheduler, s = t == null ? void 0 : t.min_booking_notice;
314
+ if (!s)
315
+ return e;
316
+ const n = (/* @__PURE__ */ new Date()).getTime();
317
+ return e < (n + s * 60 * 1e3) / 1e3 ? Math.floor((n + s * 60 * 1e3) / 1e3) : e;
318
+ }
319
+ getEndTimeForAvailableDaysInFuture(e) {
320
+ var o, l;
321
+ const t = /* @__PURE__ */ new Date(), s = (l = (o = this.schedulerStore.get("configSettings")) == null ? void 0 : o.scheduler) == null ? void 0 : l.available_days_in_future, n = Math.floor(K(t, s).getTime() / 1e3);
322
+ return Math.min(n, e);
323
+ }
324
+ async getAvailability(e = 0, t = 0) {
325
+ var g, p, b, S;
326
+ this.schedulerStore.set("isLoading", !0);
327
+ const s = new URLSearchParams(), n = /* @__PURE__ */ new Date(), r = n.getTime();
328
+ if (t && t < r / 1e3)
329
+ return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(c.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
330
+ if (!e) {
331
+ const m = new Date(n.getFullYear(), n.getMonth(), 1);
332
+ e = Math.floor(m.getTime() / 1e3);
333
+ }
334
+ if (!t) {
335
+ const m = new Date(n.getFullYear(), n.getMonth() + 1, 0);
336
+ t = Math.floor(m.getTime() / 1e3);
337
+ }
338
+ t = this.getEndTimeForAvailableDaysInFuture(t);
339
+ const o = this.getStartTimeWithMinBookingNotice(e);
340
+ e = o, t = o > t ? o + 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)));
341
+ const l = this.schedulerStore.get("rescheduleBookingId");
342
+ l && s.append("booking_id", encodeURIComponent(l));
343
+ const d = s.toString(), f = `/v3/scheduling/availability${d ? `?${d}` : ""}`, h = this.getHeaders(), u = await this.makeAPIRequest(decodeURIComponent(f), "GET", void 0, h);
344
+ if ("error" in u) {
345
+ this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
346
+ const m = (g = u.error) == null ? void 0 : g.type;
347
+ let k = u.error;
348
+ if (m && m in this.errors.api(c.t("getAvailabilityErrorTitle"))) {
349
+ const I = this.getErrorMessage(k);
350
+ k = this.errors.api(c.t("getAvailabilityErrorTitle"))[m](I);
351
+ }
352
+ return { error: k };
353
+ }
354
+ if ("data" in u) {
355
+ const I = (((b = (p = u.data) == null ? void 0 : p.time_slots) == null ? void 0 : b.map((w) => ({
356
+ ...w,
357
+ start_time: new Date(w.start_time * 1e3),
358
+ end_time: new Date(w.end_time * 1e3)
359
+ }))) || []).filter((w) => w.start_time.getTime() > r).sort((w, L) => w.start_time.getTime() - L.start_time.getTime());
360
+ this.schedulerStore.set("availability", I);
361
+ const x = ((S = u.data) == null ? void 0 : S.order) || [];
362
+ this.schedulerStore.set("availabilityOrderEmails", x);
363
+ }
364
+ return this.schedulerStore.set("isLoading", !1), u;
365
+ }
366
+ async cancelBooking(e, t) {
367
+ var l;
368
+ if (this.schedulerStore.set("isLoading", !0), !e)
369
+ return { error: this.errors.component(c.t("cancelBookingErrorTitle")).no_booking_id() };
370
+ const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", n = `/v3/scheduling/bookings/${e}${s}`, r = this.getHeaders(), o = await this.makeAPIRequest(decodeURIComponent(n), "DELETE", JSON.stringify({
371
+ action: "cancel",
372
+ cancellation_reason: t
373
+ }), r);
374
+ if ("error" in o) {
375
+ this.schedulerStore.set("isLoading", !1);
376
+ const d = (l = o.error) == null ? void 0 : l.type;
377
+ let f = o.error;
378
+ if (d && d in this.errors.api(c.t("cancelBookingErrorTitle"))) {
379
+ const h = this.getErrorMessage(f);
380
+ f = this.errors.api(c.t("cancelBookingErrorTitle"))[d](h);
381
+ }
382
+ return { error: f };
383
+ }
384
+ return this.schedulerStore.set("cancelledEventInfo", {
385
+ booking_id: e
386
+ }), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), o;
387
+ }
388
+ async rescheduleBooking(e, t) {
389
+ var R;
390
+ if (this.schedulerStore.set("isLoading", !0), !e)
391
+ return { error: this.errors.component(c.t("rescheduleBookingErrorTitle")).no_booking_id() };
392
+ const s = this.errors.api(c.t("rescheduleBookingErrorTitle")), n = this.errors.component(c.t("rescheduleBookingErrorTitle")), { bookingInfo: r, selectedTimeslot: o, selectedTimezone: l, selectedLanguage: d } = this.schedulerStore.state, { startTime: f, endTime: h, timezone: u } = t, g = f || (o == null ? void 0 : o.start_time);
393
+ if (!g)
394
+ return { error: n.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
395
+ const p = h || (o == null ? void 0 : o.end_time);
396
+ if (!p)
397
+ return { error: n.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
398
+ const b = this.schedulerStore.get("availabilityOrderEmails");
399
+ let S = "";
400
+ if (b.length > 0) {
401
+ const v = (o == null ? void 0 : o.emails) || [];
402
+ for (let E = 0; E < b.length; E++)
403
+ if (v.includes(b[E])) {
404
+ S = b[E];
405
+ break;
406
+ }
407
+ }
408
+ const m = u || l;
409
+ if (!m)
410
+ return { error: n.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
411
+ const k = (o == null ? void 0 : o.event_id) || void 0, I = (o == null ? void 0 : o.master_id) || void 0, x = (o == null ? void 0 : o.calendar_id) || void 0, w = {};
412
+ Object.entries((r == null ? void 0 : r.additionalFields) || {}).forEach(([v, E]) => {
413
+ w[v] = E.value;
414
+ });
415
+ const L = t ? t == null ? void 0 : t.primaryParticipant : r == null ? void 0 : r.primaryParticipant, y = t ? (t == null ? void 0 : t.guests) || [] : (r == null ? void 0 : r.guests) || [], B = t ? t == null ? void 0 : t.additionalFields : w, D = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", M = `/v3/scheduling/bookings/${e}${D}`, _ = this.getHeaders(), C = await this.makeAPIRequest(decodeURIComponent(M), "PATCH", JSON.stringify({
416
+ start_time: g.getTime() / 1e3,
417
+ end_time: p.getTime() / 1e3,
418
+ timezone: m,
419
+ additional_fields: B,
420
+ guest: { ...L },
421
+ additional_guests: y,
422
+ participants: S ? [{ email: S }] : void 0,
423
+ email_language: this.getTwoLetterLanguageCode(d),
424
+ event_id: k,
425
+ master_id: I,
426
+ calendar_id: x
427
+ }), _);
428
+ if ("error" in C) {
429
+ this.schedulerStore.set("isLoading", !1);
430
+ const v = (R = C.error) == null ? void 0 : R.type;
431
+ let E = C.error;
432
+ if (v && v in s) {
433
+ const H = this.getErrorMessage(E);
434
+ E = s[v](H);
435
+ }
436
+ return { error: E };
437
+ }
438
+ const N = this.schedulerStore.get("reschedulingEventInfo");
439
+ if ("data" in C)
440
+ this.schedulerStore.set("eventInfo", C == null ? void 0 : C.data);
441
+ else if (N)
442
+ this.schedulerStore.set("eventInfo", N);
443
+ else {
444
+ const v = {
445
+ booking_id: e
446
+ };
447
+ this.schedulerStore.set("eventInfo", v);
448
+ }
449
+ return this.schedulerStore.set("isLoading", !1), C;
450
+ }
451
+ async updateBooking(e) {
452
+ var u;
453
+ this.schedulerStore.set("isLoading", !0);
454
+ const { bookingId: t, status: s, reason: n } = e, r = this.schedulerStore.get("organizerConfirmationSalt"), o = s === "confirmed" ? c.t("confirmBookingErrorTitle") : c.t("rejectBookingErrorTitle");
455
+ if (!t)
456
+ return { error: this.errors.component(o).no_booking_id() };
457
+ if (!r)
458
+ return { error: this.errors.component(o).no_salt() };
459
+ const l = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", d = `/v3/scheduling/bookings/${t}${l}`, f = this.getHeaders(), h = await this.makeAPIRequest(decodeURIComponent(d), "PUT", JSON.stringify({
460
+ status: s,
461
+ cancellation_reason: n,
462
+ salt: r
463
+ }), f);
464
+ if ("error" in h) {
465
+ this.schedulerStore.set("isLoading", !1);
466
+ const g = (u = h.error) == null ? void 0 : u.type;
467
+ let p = h.error;
468
+ if (g && g in this.errors.api(o)) {
469
+ const b = this.getErrorMessage(p);
470
+ p = this.errors.api(o)[g](b);
471
+ }
472
+ return { error: p };
473
+ }
474
+ return "data" in h && s === "confirmed" ? this.schedulerStore.set("confirmedEventInfo", h == null ? void 0 : h.data) : "request_id" in h && s === "cancelled" && this.schedulerStore.set("cancelledEventInfo", {
475
+ booking_id: t
476
+ }), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), h;
477
+ }
478
+ async validateGroupEventTimeslot(e) {
479
+ var o, l;
480
+ this.schedulerStore.set("isLoading", !0);
481
+ const t = (o = this.schedulerStore.get("configSettings")) == null ? void 0 : o.configuration_id;
482
+ if (!t)
483
+ return { error: this.errors.component(c.t("validateTimeslotErrorTitle")).no_config_id() };
484
+ const s = this.getHeaders(), n = `/v3/scheduling/configurations/${t}/group-events/validate-timeslot`, r = await this.makeAPIRequest(decodeURIComponent(n), "POST", JSON.stringify({
485
+ ...e,
486
+ start_time: e.start_time.getTime() / 1e3,
487
+ end_time: e.end_time.getTime() / 1e3
488
+ }), s);
489
+ if ("error" in r) {
490
+ this.schedulerStore.set("isLoading", !1);
491
+ const d = (l = r.error) == null ? void 0 : l.type;
492
+ let f = r.error;
493
+ if (d && d in this.errors.api(c.t("validateTimeslotErrorTitle"))) {
494
+ const h = this.getErrorMessage(f);
495
+ f = this.errors.api(c.t("validateTimeslotErrorTitle"))[d](h);
496
+ }
497
+ return this.refetchAvailability(), { error: f };
498
+ }
499
+ return this.schedulerStore.set("selectedTimeslot", e), this.schedulerStore.set("showBookingForm", !0), this.schedulerStore.set("isLoading", !1), r;
500
+ }
501
+ }
502
+ class ue {
503
+ constructor({ schedulerAPIURL: e, nylasSchedulerStore: t, sessionId: s, configId: n, slug: r, clientId: o }) {
504
+ if (!e)
505
+ throw new Error("schedulerAPIURL is required");
506
+ if (!t)
507
+ throw new Error("nylasSchedulerStore is required");
508
+ if (!s && !n && !(r || o))
509
+ throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");
510
+ e === "/" && (e = new URL(window.location.href).origin), this.configId = n, this.sessionId = s, this.schedulerAPIURL = e, this.nylasSchedulerStore = t, this.slug = r, this.clientId = o;
511
+ }
512
+ init() {
513
+ O("NylasConnector init");
514
+ }
515
+ get schedulerStore() {
516
+ return this.nylasSchedulerStore;
517
+ }
518
+ get scheduler() {
519
+ return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new ge({
520
+ schedulerAPIURL: this.schedulerAPIURL,
521
+ schedulerStore: this.schedulerStore,
522
+ sessionId: this.sessionId,
523
+ configId: this.configId,
524
+ slug: this.slug,
525
+ clientId: this.clientId
526
+ }), this._schedulerAPIConnector);
527
+ }
528
+ resetStores() {
529
+ this.nylasSchedulerStore.reset();
530
+ }
531
+ }
532
+ function fe(i = {}) {
533
+ const e = {
534
+ selectedDate: null,
535
+ selectedLanguage: navigator.language,
536
+ selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
537
+ selectedTimeslot: null,
538
+ showBookingForm: !1,
539
+ availabilityOrderEmails: [],
540
+ selectableDates: null,
541
+ availability: [],
542
+ eventDuration: 0,
543
+ state: "ready",
544
+ eventInfo: null,
545
+ cancelledEventInfo: null,
546
+ isLoading: !1,
547
+ nylasBranding: !0,
548
+ ...i
549
+ };
550
+ O("[defaultNylasStoreState]: ", e);
551
+ const t = ie(e);
552
+ return t.onChange("availability", (s) => {
553
+ O("[availability]: ", s);
554
+ const n = s.map((l) => l.start_time);
555
+ O("[selectableDates]: ", n), t.set("selectableDates", n);
556
+ const r = s[0];
557
+ if (!r)
558
+ return;
559
+ const o = Math.floor((r.end_time.getTime() - r.start_time.getTime()) / 6e4);
560
+ O("[durationMinutes]: ", o), t.set("eventDuration", o);
561
+ }), t.reset = () => {
562
+ for (const s in e) {
563
+ const n = e[s];
564
+ t.set(s, n);
565
+ }
566
+ }, t;
567
+ }
568
+ const A = (i, e) => {
569
+ const t = i.isLoading, s = i.showNotification, n = i.nylasBranding;
570
+ return a(
571
+ ne,
572
+ null,
573
+ s && a("nylas-notification", null),
574
+ t && a(
575
+ "div",
576
+ { class: "loading" },
577
+ a(
578
+ "div",
579
+ { class: "left" },
580
+ a("div", { class: "skeleton" })
581
+ ),
582
+ a(
583
+ "div",
584
+ { class: "right" },
585
+ a("div", { class: "skeleton" }),
586
+ a("div", { class: "skeleton" }),
587
+ a("div", { class: "skeleton" }),
588
+ a("div", { class: "skeleton" }),
589
+ a("div", { class: "skeleton" })
590
+ )
591
+ ),
592
+ !t && e,
593
+ a("div", { class: "footer" }, n && a(
594
+ "a",
595
+ { href: "https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler", class: "powered-by-nylas", target: "_blank", rel: "noreferrer noopener" },
596
+ "Powered by ",
597
+ a("span", { class: "sr-only" }, "Nylas"),
598
+ a("nylas-logo", { "aria-hidden": !0 })
599
+ ))
600
+ );
601
+ }, X = (i, e) => a("div", { class: "message-banner" }, e), me = ':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--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-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto;border-left:none}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}', pe = me, Z = { title: c.t("genericErrorTitle"), type: j.Error, category: z.Component }, be = class {
602
+ constructor(i) {
603
+ V(this, i), this.init = F(this, "init", 7), this.schedulerWillLoad = F(this, "schedulerWillLoad", 7), this.schedulerDidLoad = F(this, "schedulerDidLoad", 7), this.nylasSchedulerError = F(this, "nylasSchedulerError", 7), this.nylasSchedulerInfo = F(this, "nylasSchedulerInfo", 7), this.configSettingsLoaded = F(this, "configSettingsLoaded", 7), this.bookingRefExtracted = F(this, "bookingRefExtracted", 7), this.bookedEventInfo = F(this, "bookedEventInfo", 7), this.mode = "app", this.defaultSchedulerState = void 0, this.sessionId = void 0, this.schedulerApiUrl = "https://api.us.nylas.com", this.bookingInfo = void 0, this.rescheduleBookingRef = void 0, this.cancelBookingRef = void 0, this.organizerConfirmationBookingRef = void 0, this.configurationId = void 0, this.slug = void 0, this.clientId = void 0, this.nylasBranding = !0, this.eventOverrides = {}, this.isLoading = void 0, this.themeConfig = void 0, this.localization = void 0, this.showNotification = !0, this.enableUserFeedback = !0, this.hour12 = void 0, this.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(navigator.language, { dateStyle: "full" }) || `${c.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language, this.showFeedbackModal = !1, this.bookingInfoConfirmed = null;
604
+ }
605
+ connectedCallback() {
606
+ O("[nylas-scheduler] connectedCallback");
607
+ }
608
+ async componentWillLoad() {
609
+ var n, r;
610
+ O("[nylas-scheduler] Component will load"), this.enableUserFeedback && !re() && ae({
611
+ dsn: "https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",
612
+ release: "2.0.0",
613
+ integrations: (o) => [
614
+ ...o.filter((l) => !1),
615
+ ce({
616
+ colorScheme: "system",
617
+ autoInject: !1
618
+ })
619
+ ],
620
+ autoSessionTracking: !1,
621
+ beforeSend: () => null
622
+ });
623
+ const i = this.schedulerWillLoad.emit(this.host);
624
+ if ("schedulerWillLoad" in this.eventOverrides && (await this.eventOverrides.schedulerWillLoad(i, this.nylasSchedulerConnector), i.defaultPrevented))
625
+ return;
626
+ this.stores = {
627
+ scheduler: fe({
628
+ bookingInfo: this.bookingInfo,
629
+ nylasBranding: this.nylasBranding,
630
+ themeConfig: this.themeConfig,
631
+ hour12: this.hour12,
632
+ ...this.defaultSchedulerState
633
+ })
634
+ }, this.baseProvider = new se(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
635
+ let e;
636
+ if (this.rescheduleBookingRef) {
637
+ const [o, l, d] = U(this.rescheduleBookingRef);
638
+ this.refConfigId = o, this.stores.scheduler.set("rescheduleBookingId", l), e = this.bookingRefExtracted.emit({ configurationId: o, bookingId: l });
639
+ } else if (this.cancelBookingRef) {
640
+ const [o, l, d] = U(this.cancelBookingRef);
641
+ this.refConfigId = o, this.stores.scheduler.set("cancelBookingId", l), e = this.bookingRefExtracted.emit({ configurationId: o, bookingId: l });
642
+ } else if (this.organizerConfirmationBookingRef) {
643
+ const [o, l, d] = U(this.organizerConfirmationBookingRef);
644
+ this.refConfigId = o, this.stores.scheduler.set("organizerConfirmationBookingId", l), this.stores.scheduler.set("organizerConfirmationSalt", d), e = this.bookingRefExtracted.emit({ configurationId: o, bookingId: l, salt: d });
645
+ }
646
+ if ("bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(e, this.nylasSchedulerConnector), e.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
647
+ return;
648
+ const t = (n = this.baseProvider) == null ? void 0 : n.getStore("scheduler");
649
+ this.nylasSchedulerConnector = new ue({
650
+ schedulerAPIURL: this.schedulerApiUrl,
651
+ sessionId: this.sessionId,
652
+ configId: this.refConfigId,
653
+ slug: this.slug,
654
+ clientId: this.clientId,
655
+ nylasSchedulerStore: t
656
+ });
657
+ const s = this.init.emit(this.host);
658
+ "init" in this.eventOverrides && (await this.eventOverrides.init(s, this.nylasSchedulerConnector), s.defaultPrevented) || ((r = this.baseProvider) == null || r.componentWillLoad(this.nylasSchedulerConnector), this.applyThemeConfig(this.themeConfig));
659
+ }
660
+ async componentDidLoad() {
661
+ var d, f, h, u, g, p, b, S;
662
+ (d = this.baseProvider) == null || d.componentDidLoad();
663
+ const i = this.schedulerDidLoad.emit(this.host);
664
+ if ("schedulerDidLoad" in this.eventOverrides && (await this.eventOverrides.schedulerDidLoad(i, this.nylasSchedulerConnector), i.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
665
+ return;
666
+ this.localizationChanged(this.localization);
667
+ const e = await ((f = this.nylasSchedulerConnector) == null ? void 0 : f.scheduler.getUISettings());
668
+ if (!e || "error" in e) {
669
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(e == null ? void 0 : e.error) }, host: this.host });
670
+ return;
671
+ } else {
672
+ "data" in e && ((h = e.data) != null && h.appearance) && console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.");
673
+ const m = this.configSettingsLoaded.emit({ settings: e });
674
+ if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(m, this.nylasSchedulerConnector), m.defaultPrevented))
675
+ return;
676
+ }
677
+ const t = (u = this.baseProvider) == null ? void 0 : u.getStore("scheduler"), s = (p = (g = t == null ? void 0 : t.get("configSettings")) == null ? void 0 : g.scheduler) == null ? void 0 : p.available_days_in_future, n = t == null ? void 0 : t.get("selectedTimeslot");
678
+ if (n && (n != null && n.start_time)) {
679
+ if (!this.isTimeslotValid(n))
680
+ return;
681
+ if (t != null && t.get("showBookingForm")) {
682
+ t == null || t.set("selectedDate", n.start_time);
683
+ return;
684
+ }
685
+ }
686
+ const r = t == null ? void 0 : t.get("selectedDate"), o = t == null ? void 0 : t.get("availability");
687
+ let l;
688
+ if (!(o && o.length > 0)) {
689
+ if (r) {
690
+ const { startTime: m, endTime: k, endTimeForAvailableDaysInFuture: I } = this.validateAvailableDaysInFuture(r, s || 30);
691
+ r.getTime() < I * 1e3 && (l = await ((S = this.nylasSchedulerConnector) == null ? void 0 : S.scheduler.getAvailability(m, k)));
692
+ } else {
693
+ const m = /* @__PURE__ */ new Date(), { startTime: k, endTime: I, endTimeForAvailableDaysInFuture: x } = this.validateAvailableDaysInFuture(m, s || 30);
694
+ m.getTime() < x * 1e3 && (l = await ((b = this.nylasSchedulerConnector) == null ? void 0 : b.scheduler.getAvailability(k, I)));
695
+ }
696
+ if ((!l || "error" in l) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(l == null ? void 0 : l.error) }, host: this.host }), !r) {
697
+ let m = /* @__PURE__ */ new Date();
698
+ const k = t == null ? void 0 : t.get("availability").find((I) => new Date(I.start_time) > /* @__PURE__ */ new Date());
699
+ k && (m = k.start_time), t == null || t.set("selectedDate", m);
700
+ }
701
+ }
702
+ }
703
+ componentDisconnected() {
704
+ var i;
705
+ (i = this.baseProvider) == null || i.componentDisconnected();
706
+ }
707
+ bookingInfoChanged(i) {
708
+ var e;
709
+ (e = this.stores) == null || e.scheduler.set("bookingInfo", i);
710
+ }
711
+ rescheduleBookingRefChanged(i) {
712
+ var e, t;
713
+ if (i) {
714
+ const [s, n] = U(i);
715
+ (e = this.stores) == null || e.scheduler.set("rescheduleBookingId", n), this.refConfigId = s, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(s);
716
+ }
717
+ }
718
+ cancelBookingRefChanged(i) {
719
+ var e, t;
720
+ if (i) {
721
+ const [s, n] = U(i);
722
+ (e = this.stores) == null || e.scheduler.set("cancelBookingId", n), this.refConfigId = s, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(s);
723
+ }
724
+ }
725
+ organizerConfirmationBookingRefChanged(i) {
726
+ var e, t;
727
+ if (i) {
728
+ const [s, n] = U(i);
729
+ (e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId", n), this.refConfigId = s, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(s);
730
+ }
731
+ }
732
+ localizationChanged(i) {
733
+ i && Object.keys(i).forEach((e) => {
734
+ e in oe && c.addResourceBundle(e, "translation", i[e], !1, !0);
735
+ });
736
+ }
737
+ themeConfigChanged(i) {
738
+ var e, t;
739
+ (t = (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler")) == null || t.set("themeConfig", i), this.applyThemeConfig(i);
740
+ }
741
+ languageChanged(i) {
742
+ const e = i.detail;
743
+ this.language = e, c.changeLanguage(e);
744
+ }
745
+ async registerComponentHandler(i) {
746
+ var e;
747
+ (e = this.baseProvider) == null || e.registerComponent(i.detail);
748
+ }
749
+ async unregisterComponentHandler(i) {
750
+ var e;
751
+ (e = this.baseProvider) == null || e.unregisterComponent(i.detail);
752
+ }
753
+ async monthChangedHandler(i) {
754
+ var o, l, d, f, h, u, g;
755
+ const e = i.detail, t = (f = (d = (l = (o = this.nylasSchedulerConnector) == null ? void 0 : o.schedulerStore) == null ? void 0 : l.get("configSettings")) == null ? void 0 : d.scheduler) == null ? void 0 : f.available_days_in_future, { startTime: s, endTime: n, endTimeForAvailableDaysInFuture: r } = this.validateAvailableDaysInFuture(e, t || 30);
756
+ if (!i.defaultPrevented && s < r && e.getTime() < r * 1e3) {
757
+ const p = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.getAvailability(s, n));
758
+ (!p || "error" in p) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(p == null ? void 0 : p.error) }, host: this.host });
759
+ const b = (u = this.stores) == null ? void 0 : u.scheduler.get("selectableDates");
760
+ b && b.length > 0 && ((g = this.stores) == null || g.scheduler.set("selectedDate", b[0]));
761
+ }
762
+ }
763
+ mapToBookingData(i) {
764
+ var o, l, d;
765
+ const e = (o = this.stores) == null ? void 0 : o.scheduler.get("selectedTimeslot"), t = (l = this.stores) == null ? void 0 : l.scheduler.get("selectedLanguage"), s = (d = this.stores) == null ? void 0 : d.scheduler.get("selectedTimezone"), n = e != null && e.start_time ? new Date(e == null ? void 0 : e.start_time).getTime() / 1e3 : "", r = e != null && e.end_time ? new Date(e == null ? void 0 : e.end_time).getTime() / 1e3 : "";
766
+ return {
767
+ additional_guests: i.guests,
768
+ guest: { ...i.primaryParticipant },
769
+ additional_fields: { ...i.additionalFields },
770
+ start_time: n,
771
+ end_time: r,
772
+ email_language: t,
773
+ timezone: s
774
+ };
775
+ }
776
+ async bookButtonClickedHandler(i) {
777
+ var d, f, h, u;
778
+ if (i.defaultPrevented)
779
+ return;
780
+ const e = i.detail, t = this.mapToBookingData(e);
781
+ this.bookingInfoConfirmed = e;
782
+ const n = (f = (d = this.nylasSchedulerConnector) == null ? void 0 : d.schedulerStore) == null ? void 0 : f.get("rescheduleBookingId");
783
+ if (n) {
784
+ const g = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.rescheduleBooking(n, e));
785
+ (!g || "error" in g) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(g == null ? void 0 : g.error) }, host: this.host });
786
+ const p = g == null ? void 0 : g.data, b = this.bookedEventInfo.emit({ ...g, data: { ...p, ...t } });
787
+ this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...p }, "bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(b, this.nylasSchedulerConnector);
788
+ return;
789
+ }
790
+ const r = await ((u = this.nylasSchedulerConnector) == null ? void 0 : u.scheduler.bookTimeslot(e));
791
+ (!r || "error" in r) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(r == null ? void 0 : r.error) }, host: this.host });
792
+ const o = r == null ? void 0 : r.data, l = this.bookedEventInfo.emit({ ...r, data: { ...o, ...t } });
793
+ this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...o }, "bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(l, this.nylasSchedulerConnector);
794
+ }
795
+ dateSelectedHandler(i) {
796
+ const e = i.detail;
797
+ this.selectedDateLabel = e ? e.toLocaleDateString(this.language, { dateStyle: "full" }) : `${c.t("noDateSelected")}`;
798
+ }
799
+ cancelBookedEventErrorHandler(i) {
800
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
801
+ }
802
+ cancelBookedEventValidationErrorHandler(i) {
803
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
804
+ }
805
+ rescheduleBookedEventErrorHandler(i) {
806
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
807
+ }
808
+ confirmBookingErrorHandler(i) {
809
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
810
+ }
811
+ feedbackModalClosedHandler() {
812
+ this.showFeedbackModal = !1;
813
+ }
814
+ eventIsFullHandler(i) {
815
+ const e = i.detail.error;
816
+ i.detail.type === "error" ? this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject({ message: e }) }, host: this.host }) : this.nylasSchedulerInfo.emit({
817
+ notification: {
818
+ title: "Event is full",
819
+ category: z.Component,
820
+ type: j.Info,
821
+ description: "The event you selected is full. Please try a different time.",
822
+ id: (/* @__PURE__ */ new Date()).getTime().toString(),
823
+ ttl: 3e3
824
+ },
825
+ host: this.host
826
+ });
827
+ }
828
+ feedbackSubmittedHandler(i) {
829
+ const t = {
830
+ eventId: le("Scheduling Page User Feedback", {
831
+ extra: {
832
+ configId: this.configurationId,
833
+ slug: this.slug
834
+ }
835
+ }),
836
+ message: i.detail.feedback
837
+ };
838
+ de(t, {
839
+ includeReplay: !0,
840
+ captureContext: {
841
+ tags: {
842
+ "nylas-web-element": "nylas-scheduling",
843
+ "nylas-web-element-version": "2.0.0",
844
+ "nylas-config-id": this.configurationId,
845
+ "nylas-slug": this.slug,
846
+ "host-url": window.location.href
847
+ },
848
+ extra: {
849
+ configId: this.configurationId,
850
+ slug: this.slug
851
+ }
852
+ }
853
+ }), this.showFeedbackModal = !1;
854
+ }
855
+ async getNylasSchedulerStore() {
856
+ var i;
857
+ return (i = this.baseProvider) == null ? void 0 : i.getStore("scheduler");
858
+ }
859
+ async getNylasSchedulerConnector() {
860
+ return this.nylasSchedulerConnector;
861
+ }
862
+ async getRef() {
863
+ return this.host;
864
+ }
865
+ getErrorObject(i) {
866
+ return {
867
+ title: (i == null ? void 0 : i.title) || Z.title,
868
+ category: (i == null ? void 0 : i.category) || Z.category,
869
+ type: j.Error,
870
+ description: (i == null ? void 0 : i.message) || "",
871
+ id: (/* @__PURE__ */ new Date()).getTime().toString(),
872
+ ttl: "none"
873
+ };
874
+ }
875
+ checkIfSessionIdOrConfigIdExists() {
876
+ if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {
877
+ let i = "";
878
+ return this.sessionId || (i += c.t("sessionIdRequiredErrorMessage")), !this.sessionId && !this.refConfigId && !(this.slug && this.clientId) && (i = c.t("sessionIdRequiredErrorMessage") + " " + c.t("publicConfigErrorMessage")), this.nylasSchedulerError.emit({
879
+ notification: {
880
+ title: c.t("schedulingComponentErrorTitle"),
881
+ category: z.Component,
882
+ type: j.Error,
883
+ description: i,
884
+ id: (/* @__PURE__ */ new Date()).getTime().toString(),
885
+ ttl: "none"
886
+ },
887
+ host: this.host
888
+ }), !1;
889
+ }
890
+ return !0;
891
+ }
892
+ isTimeslotValid(i) {
893
+ return new Date(i.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
894
+ notification: {
895
+ title: c.t("invalidTimeslotErrorTitle"),
896
+ category: z.Component,
897
+ type: j.Error,
898
+ description: c.t("invalidTimeslotErrorMessage"),
899
+ id: (/* @__PURE__ */ new Date()).getTime().toString(),
900
+ ttl: "none"
901
+ },
902
+ host: this.host
903
+ }), !1) : !0;
904
+ }
905
+ validateAvailableDaysInFuture(i, e) {
906
+ const t = /* @__PURE__ */ new Date(), s = new Date(i.getFullYear(), i.getMonth(), 1).getTime() / 1e3, n = new Date(i.getFullYear(), i.getMonth() + 1, 1).getTime() / 1e3, r = Math.floor(K(t, e).getTime() / 1e3), o = Math.min(r, n);
907
+ return { startTime: s < t.getTime() / 1e3 ? Math.floor(t.getTime() / 1e3) : s, endTime: o, endTimeForAvailableDaysInFuture: r };
908
+ }
909
+ applyThemeConfig(i) {
910
+ if (i)
911
+ for (const [e, t] of Object.entries(i))
912
+ this.host.style.setProperty(`${e}`, t);
913
+ }
914
+ onFeedbackClick(i) {
915
+ i.preventDefault(), this.showFeedbackModal = !0;
916
+ }
917
+ redirectToCustomUrl(i) {
918
+ window.location.assign(i);
919
+ }
920
+ render() {
921
+ var b, S, m, k, I, x, w, L, y, B, D, M;
922
+ const i = this.mode === "app", e = (b = this.baseProvider) == null ? void 0 : b.getStore("scheduler"), t = e == null ? void 0 : e.get("eventInfo"), s = e == null ? void 0 : e.get("showBookingForm"), n = e == null ? void 0 : e.get("cancelledEventInfo"), r = e == null ? void 0 : e.get("cancelBookingId"), o = e == null ? void 0 : e.get("selectedTimeslot"), l = e == null ? void 0 : e.get("rescheduleBookingId"), d = e == null ? void 0 : e.get("organizerConfirmationBookingId"), f = e == null ? void 0 : e.get("rejectBookingId"), h = e == null ? void 0 : e.get("confirmedEventInfo"), u = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, g = e == null ? void 0 : e.get("selectedDate"), p = (m = (S = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : S.scheduler) == null ? void 0 : m.confirmation_redirect_url;
923
+ if (this.selectedDateLabel = g && this.language ? ee(g.toLocaleDateString(this.language, { dateStyle: "full" })) : `${c.t("noDateSelected")}`, i && (r || f) && !n)
924
+ return a(P, null, a(A, { nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, a("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, a("nylas-cancel-booking-form", { selectedTimeslot: o, cancelBookingId: r, rejectBookingId: f, exportparts: "ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card" }))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (_) => this.onFeedbackClick(_) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
925
+ if (i && d)
926
+ return a(P, null, a(A, null, a("div", { class: "manual-confirmation-page", part: "manual-confirmation-page" }, a("nylas-organizer-confirmation-card", { organizerConfirmationBookingId: d, exportparts: "nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline" }))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (_) => this.onFeedbackClick(_) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
927
+ if (i && n)
928
+ return a(P, null, a(A, { nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, a("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, a("nylas-cancelled-event-card", { cancelledEventInfo: n, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (_) => this.onFeedbackClick(_) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
929
+ if (i && h)
930
+ return a(P, null, a(A, { nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, a("div", { class: "cancelled-event-page", part: "confirmed-event-page" }, a("nylas-confirmed-event-card", { confirmedEventInfo: h, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (_) => this.onFeedbackClick(_) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
931
+ if (i && t && p) {
932
+ const _ = (k = this.bookingInfoConfirmed) == null ? void 0 : k.primaryParticipant, C = (I = this.bookingInfoConfirmed) == null ? void 0 : I.location, N = (x = this.bookingInfoConfirmed) == null ? void 0 : x.booking_ref, R = ((w = this.bookingInfoConfirmed) == null ? void 0 : w.additionalFields) || {};
933
+ if (this.bookingInfo && typeof ((L = this.bookingInfo) == null ? void 0 : L.additionalFields) < "u") {
934
+ const $ = this.bookingInfo.additionalFields;
935
+ Object.keys($).forEach((W) => {
936
+ !R[W] && ($ != null && $[W]) && (R[W] = $[W].value);
937
+ });
938
+ }
939
+ const v = (y = this.stores) == null ? void 0 : y.scheduler.get("selectedTimeslot"), E = (B = this.stores) == null ? void 0 : B.scheduler.get("selectedTimezone"), H = (D = this.stores) == null ? void 0 : D.scheduler.get("selectedLanguage"), q = (M = this.stores) == null ? void 0 : M.scheduler.get("configSettings"), G = this.configurationId ? this.configurationId : q == null ? void 0 : q.configuration_id, Q = window.location.search, T = new URLSearchParams(Q);
940
+ T.set("booking_id", t.booking_id), _ != null && _.name && T.set("name", _.name), _ != null && _.email && T.set("email", _.email), v != null && v.start_time && T.set("start_time", (new Date(v.start_time).getTime() / 1e3).toString()), v != null && v.end_time && T.set("end_time", (new Date(v.end_time).getTime() / 1e3).toString()), E && T.set("tz", E), H && T.set("language", H), R && T.set("additional_values", JSON.stringify(R)), this.slug && T.set("page_slug", this.slug), G && T.set("config_id", G), C && T.set("location", C), N && T.set("booking_ref", N), this.redirectToCustomUrl(`${p}?${T.toString()}`);
941
+ return;
942
+ }
943
+ if (i && t)
944
+ return a(P, null, a(A, { nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, a("div", { class: "booked-event-page", part: "booked-event-page ns_booked-event-page" }, a("nylas-booked-event-card", { selectedTimeslot: o, eventInfo: t, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (_) => this.onFeedbackClick(_) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
945
+ if (i && (!t || l) && !s) {
946
+ const _ = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
947
+ return a(P, null, a(A, { nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, l && a(X, null, `${c.t("rescheduleTitle")}`), a("div", { class: "select-date-page", part: "select-date-page ns_select-date-page" }, a("div", { class: "left-panel", part: "ns_left-panel" }, a("nylas-date-picker", { exportparts: "ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month" }), a("nylas-locale-switch", { exportparts: "nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label" })), a("div", { class: `right-panel ${l ? "reschedule" : ""}`, part: `ns_right-panel ${l ? "ns_reschedule" : ""}` }, a("h2", { part: "ns_right-panel__title" }, a("calendar-icon", { part: "ns_right-panel__calendar-icon" }), a("span", { id: "selectedDate", part: "ns_right-panel__selected-date" }, this.selectedDateLabel)), a("nylas-timeslot-picker", { exportparts: "ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, _ && a("span", { slot: "timeslot-picker-cta-label" }, a("slot", { name: "timeslot-picker-cta-label" })))))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (C) => this.onFeedbackClick(C) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
948
+ }
949
+ return i && !t && s ? a(P, null, a(A, { nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, l && a(X, null, `${c.t("rescheduleTitle")}`), a("div", { class: "additional-data-page", part: "additional-data-page ns_additional-data-page" }, a("div", { class: "left-panel ns_left-panel", part: "ns_left-panel" }, a("div", { class: "wrapper", part: "ns_left-panel__wrapper" }, a("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone" }))), a("div", { class: `right-panel ${l ? "reschedule" : ""}`, part: `ns_right-panel ${l ? "ns_reschedule" : ""}` }, a("nylas-booking-form", { exportparts: "nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content" })))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (_) => this.onFeedbackClick(_) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null)) : a(P, null, a("slot", null));
950
+ }
951
+ get host() {
952
+ return te(this);
953
+ }
954
+ static get watchers() {
955
+ return {
956
+ bookingInfo: ["bookingInfoChanged"],
957
+ rescheduleBookingRef: ["rescheduleBookingRefChanged"],
958
+ cancelBookingRef: ["cancelBookingRefChanged"],
959
+ organizerConfirmationBookingRef: ["organizerConfirmationBookingRefChanged"],
960
+ localization: ["localizationChanged"],
961
+ themeConfig: ["themeConfigChanged"]
962
+ };
963
+ }
964
+ };
965
+ be.style = pe;
966
+ export {
967
+ be as nylas_scheduling
968
+ };