@nylas/react 2.1.0 → 2.2.1

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 (148) hide show
  1. package/dist/cjs/connect.js +1 -0
  2. package/dist/cjs/elements.js +1 -0
  3. package/dist/cjs/index.js +1 -0
  4. package/dist/cjs/notetaker.js +62 -0
  5. package/dist/cjs/utils.js +11 -0
  6. package/dist/connect.d.ts +1 -0
  7. package/dist/elements.d.ts +1 -0
  8. package/dist/es/connect.js +279 -0
  9. package/dist/es/elements.js +1319 -0
  10. package/dist/es/index.js +281 -0
  11. package/dist/es/notetaker.js +5784 -0
  12. package/dist/es/utils.js +12396 -0
  13. package/dist/lib/connect/types.d.ts +1 -1
  14. package/dist/lib/connect/useNylasConnect.d.ts +2 -2
  15. package/dist/lib/connect.d.ts +1 -0
  16. package/dist/lib/elements/components.d.ts +975 -0
  17. package/dist/lib/elements.d.ts +1 -0
  18. package/dist/lib/index.d.ts +3 -6
  19. package/dist/lib/notetaker.d.ts +1 -0
  20. package/dist/lib/utils.d.ts +2 -0
  21. package/dist/notetaker.d.ts +1 -0
  22. package/dist/utils.d.ts +1 -0
  23. package/package.json +36 -16
  24. package/dist/add-circle-icon_2.entry-8c3bb0bb.cjs +0 -1
  25. package/dist/add-circle-icon_2.entry-a3daf6c4.js +0 -28
  26. package/dist/archive-icon.entry-46ad0ff3.cjs +0 -1
  27. package/dist/archive-icon.entry-d5141486.js +0 -18
  28. package/dist/arrow-icon.entry-1b89ce78.js +0 -18
  29. package/dist/arrow-icon.entry-f696de4f.cjs +0 -1
  30. package/dist/bold-icon.entry-7827cd4e.cjs +0 -1
  31. package/dist/bold-icon.entry-c117b4cf.js +0 -18
  32. package/dist/button-component_2.entry-8cd4c5f3.cjs +0 -1
  33. package/dist/button-component_2.entry-e68caa9b.js +0 -29
  34. package/dist/calendar-agenda-fill-icon_37.entry-52bdc8b3.js +0 -5234
  35. package/dist/calendar-agenda-fill-icon_37.entry-8c592cfa.cjs +0 -6
  36. package/dist/calendar-cancel-icon.entry-7facfa05.cjs +0 -1
  37. package/dist/calendar-cancel-icon.entry-f5f1d499.js +0 -18
  38. package/dist/calendar-check-icon.entry-55320137.js +0 -18
  39. package/dist/calendar-check-icon.entry-72108702.cjs +0 -1
  40. package/dist/calendar-icon.entry-afea361e.js +0 -18
  41. package/dist/calendar-icon.entry-f5c6730f.cjs +0 -1
  42. package/dist/checkbox-component.entry-5722d263.cjs +0 -1
  43. package/dist/checkbox-component.entry-89fa6edd.js +0 -54
  44. package/dist/checkbox-group_4.entry-30e8af17.cjs +0 -28
  45. package/dist/checkbox-group_4.entry-51f03009.js +0 -10014
  46. package/dist/checkmark-circle-icon.entry-ae11049d.cjs +0 -1
  47. package/dist/checkmark-circle-icon.entry-dfe67e22.js +0 -18
  48. package/dist/checkmark-icon_15.entry-4c3979db.js +0 -1415
  49. package/dist/checkmark-icon_15.entry-e59c0f53.cjs +0 -5
  50. package/dist/chevron-icon_3.entry-1f3c3ca6.js +0 -159
  51. package/dist/chevron-icon_3.entry-ea791750.cjs +0 -1
  52. package/dist/clock-icon_4.entry-172fed74.cjs +0 -1
  53. package/dist/clock-icon_4.entry-78878cb8.js +0 -48
  54. package/dist/constants-f51538ef-cd2a67c4.cjs +0 -1
  55. package/dist/constants-f51538ef-e0a5f026.js +0 -876
  56. package/dist/customParseFormat-b5d95b34-a6b6fcba.cjs +0 -1
  57. package/dist/customParseFormat-b5d95b34-ce80820c.js +0 -135
  58. package/dist/delete-icon.entry-a8c0bf03.cjs +0 -1
  59. package/dist/delete-icon.entry-cebdc90f.js +0 -18
  60. package/dist/document-refresh-icon.entry-2d9a529d.cjs +0 -1
  61. package/dist/document-refresh-icon.entry-8780a2b8.js +0 -18
  62. package/dist/feedbackSync-92220b42-fbebe1f9.cjs +0 -448
  63. package/dist/feedbackSync-92220b42-fd5f5610.js +0 -6048
  64. package/dist/folder-icon.entry-3e61ccca.cjs +0 -1
  65. package/dist/folder-icon.entry-6ffd5191.js +0 -18
  66. package/dist/forward-icon.entry-c7d88db8.cjs +0 -1
  67. package/dist/forward-icon.entry-c9c4bf5b.js +0 -18
  68. package/dist/globe-icon.entry-0b93cab8.cjs +0 -1
  69. package/dist/globe-icon.entry-7c0dca7b.js +0 -18
  70. package/dist/google-logo-icon_6.entry-deef91ee.js +0 -1765
  71. package/dist/google-logo-icon_6.entry-e25ce3e7.cjs +0 -2
  72. package/dist/google-meet-icon_5.entry-214347f0.cjs +0 -1
  73. package/dist/google-meet-icon_5.entry-f8b5a92a.js +0 -58
  74. package/dist/inbox-icon.entry-873062c3.js +0 -18
  75. package/dist/inbox-icon.entry-f08f2fd5.cjs +0 -1
  76. package/dist/index-025be398.js +0 -7187
  77. package/dist/index-c510313d-1318f67a.js +0 -289
  78. package/dist/index-c510313d-b0508eee.cjs +0 -1
  79. package/dist/index-f42fe591.cjs +0 -65
  80. package/dist/index.es-488bc919-d02dd50a.cjs +0 -7
  81. package/dist/index.es-488bc919-ea63a7e9.js +0 -2724
  82. package/dist/info-icon_2.entry-442b9097.cjs +0 -1
  83. package/dist/info-icon_2.entry-60fb8648.js +0 -37
  84. package/dist/input-component.entry-5898a52e.js +0 -96
  85. package/dist/input-component.entry-7274fd28.cjs +0 -1
  86. package/dist/input-dropdown_2.entry-4534436c.js +0 -255
  87. package/dist/input-dropdown_2.entry-9b72f637.cjs +0 -1
  88. package/dist/italic-icon.entry-62052cd8.js +0 -18
  89. package/dist/italic-icon.entry-9bdbbd37.cjs +0 -1
  90. package/dist/lib/elements/index.d.ts +0 -133
  91. package/dist/lib/elements/react-component-lib/createComponent.d.ts +0 -10
  92. package/dist/lib/elements/react-component-lib/createOverlayComponent.d.ts +0 -21
  93. package/dist/lib/elements/react-component-lib/index.d.ts +0 -2
  94. package/dist/lib/elements/react-component-lib/interfaces.d.ts +0 -29
  95. package/dist/lib/elements/react-component-lib/utils/attachProps.d.ts +0 -9
  96. package/dist/lib/elements/react-component-lib/utils/case.d.ts +0 -2
  97. package/dist/lib/elements/react-component-lib/utils/dev.d.ts +0 -2
  98. package/dist/lib/elements/react-component-lib/utils/index.d.ts +0 -10
  99. package/dist/multi-select-dropdown.entry-77752d46.cjs +0 -1
  100. package/dist/multi-select-dropdown.entry-9c9d05c1.js +0 -133
  101. package/dist/nylas-booked-event-card_11.entry-32b2e9f1.js +0 -1410
  102. package/dist/nylas-booked-event-card_11.entry-4aba5146.cjs +0 -1
  103. package/dist/nylas-date-component_2.entry-6b058796.cjs +0 -1
  104. package/dist/nylas-date-component_2.entry-a869519f.js +0 -310
  105. package/dist/nylas-form-card.entry-5390459f.js +0 -75
  106. package/dist/nylas-form-card.entry-c2f34d73.cjs +0 -1
  107. package/dist/nylas-notification_2.entry-054392cf.cjs +0 -1
  108. package/dist/nylas-notification_2.entry-f46e88e5.js +0 -88
  109. package/dist/nylas-scheduler-editor.entry-40a48f47.js +0 -1854
  110. package/dist/nylas-scheduler-editor.entry-e29fdf07.cjs +0 -2
  111. package/dist/nylas-scheduling.entry-115b1752.js +0 -1002
  112. package/dist/nylas-scheduling.entry-79cb1d9c.cjs +0 -1
  113. package/dist/person-icon.entry-2cae306c.cjs +0 -1
  114. package/dist/person-icon.entry-fd668b89.js +0 -18
  115. package/dist/play-icon.entry-7fc3c0fd.js +0 -18
  116. package/dist/play-icon.entry-9989a520.cjs +0 -1
  117. package/dist/radio-button-group.entry-03385b5f.cjs +0 -1
  118. package/dist/radio-button-group.entry-9df82cd0.js +0 -58
  119. package/dist/react.cjs +0 -1
  120. package/dist/react.js +0 -164
  121. package/dist/refresh-icon.entry-310954ba.cjs +0 -1
  122. package/dist/refresh-icon.entry-c56e5623.js +0 -18
  123. package/dist/register-component-3acd57e7-5a79a90a.cjs +0 -1
  124. package/dist/register-component-3acd57e7-cb09c05e.js +0 -110
  125. package/dist/reply-all-icon.entry-32e0e000.js +0 -18
  126. package/dist/reply-all-icon.entry-68388f97.cjs +0 -1
  127. package/dist/reply-icon.entry-3ac2e736.js +0 -18
  128. package/dist/reply-icon.entry-e616a9a4.cjs +0 -1
  129. package/dist/sent-icon.entry-0622ed04.js +0 -18
  130. package/dist/sent-icon.entry-543eb3c4.cjs +0 -1
  131. package/dist/spam-icon.entry-74bcfd4f.js +0 -18
  132. package/dist/spam-icon.entry-e341ee3e.cjs +0 -1
  133. package/dist/star-icon.entry-864d2bf9.js +0 -18
  134. package/dist/star-icon.entry-c90d40f6.cjs +0 -1
  135. package/dist/stop-icon.entry-835908c5.js +0 -18
  136. package/dist/stop-icon.entry-ffc46b42.cjs +0 -1
  137. package/dist/textarea-component.entry-6adcf6a6.js +0 -58
  138. package/dist/textarea-component.entry-dae8eb5c.cjs +0 -1
  139. package/dist/toggle-switch.entry-5ee29867.cjs +0 -1
  140. package/dist/toggle-switch.entry-ff2ccb75.js +0 -51
  141. package/dist/translate-icon.entry-372dd808.js +0 -18
  142. package/dist/translate-icon.entry-5606067d.cjs +0 -1
  143. package/dist/trash-fill-icon.entry-01b4379e.js +0 -18
  144. package/dist/trash-fill-icon.entry-daed6c0a.cjs +0 -1
  145. package/dist/underline-icon.entry-2020ee64.cjs +0 -1
  146. package/dist/underline-icon.entry-464b900d.js +0 -18
  147. package/dist/utils-31933f5d-15041585.js +0 -17878
  148. package/dist/utils-31933f5d-1d4c81ab.cjs +0 -54
@@ -1,1002 +0,0 @@
1
- import { r as te, c as P, h as s, H as R, g as ne, F as ie } from "./index-025be398.js";
2
- import { N as se, c as oe } from "./index-c510313d-1318f67a.js";
3
- import { i as d, b as A, e as N, f as V, h as re } from "./utils-31933f5d-15041585.js";
4
- import { E as M, i as ae, a as le, f as de, c as ce, b as he } from "./feedbackSync-92220b42-fd5f5610.js";
5
- import { n as H } from "./index.es-488bc919-ea63a7e9.js";
6
- import { L as j, a as Z } from "./constants-f51538ef-e0a5f026.js";
7
- import "@nylas/web-elements";
8
- import "react";
9
- import "@nylas/connect";
10
- import "react/jsx-runtime";
11
- import "react-dom";
12
- class ge {
13
- constructor() {
14
- this.component = (e) => {
15
- const t = M.Component, o = `${e} Error`;
16
- return {
17
- endtime_not_in_future: (n = '"endtime" can not be in the future') => ({
18
- title: o,
19
- message: n,
20
- category: t
21
- }),
22
- no_booking_info: (n = "No booking info provided") => ({
23
- title: o,
24
- message: n,
25
- category: t
26
- }),
27
- no_timeslot_selected: (n = "No timeslot selected") => ({
28
- title: o,
29
- message: n,
30
- category: t
31
- }),
32
- no_timezone_selected: (n = "No timezone selected") => ({
33
- title: o,
34
- message: n,
35
- category: t
36
- }),
37
- no_booking_id: (n = "No booking id provided") => ({
38
- title: o,
39
- message: n,
40
- category: t
41
- }),
42
- no_salt: (n = "No salt provided") => ({
43
- title: o,
44
- message: n,
45
- category: t
46
- }),
47
- invalid_start_time: (n = "Invalid start time") => ({
48
- title: o,
49
- message: n,
50
- category: t
51
- }),
52
- invalid_end_time: (n = "Invalid end time") => ({
53
- title: o,
54
- message: n,
55
- category: t
56
- }),
57
- invalid_timezone: (n = "Invalid timezone") => ({
58
- title: o,
59
- message: n,
60
- category: t
61
- }),
62
- no_config_id: (n = "No configuration id provided") => ({
63
- title: o,
64
- message: n,
65
- category: t
66
- })
67
- };
68
- }, this.api = (e) => {
69
- const t = M.Api, o = `${e} Error`;
70
- return {
71
- invalid_session: (n) => ({
72
- title: o,
73
- message: n,
74
- category: t
75
- }),
76
- general_error: (n) => ({
77
- title: o,
78
- message: n,
79
- category: t
80
- }),
81
- internal_error: (n) => ({
82
- title: o,
83
- message: n,
84
- category: t
85
- }),
86
- invalid_request_error: (n) => ({
87
- title: o,
88
- message: n,
89
- category: t
90
- }),
91
- timeslot_not_available: (n) => ({
92
- title: o,
93
- message: n,
94
- category: t
95
- }),
96
- provider_error: (n) => ({
97
- title: o,
98
- message: n,
99
- category: t
100
- }),
101
- not_found_error: (n) => ({
102
- title: o,
103
- message: n,
104
- category: t
105
- })
106
- };
107
- };
108
- }
109
- }
110
- class ue {
111
- constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: o, configId: n, slug: a, clientId: r }) {
112
- this.errors = new ge(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = o, this.configId = n, this.slug = a, this.clientId = r;
113
- }
114
- getHeaders() {
115
- return this.sessionId ? {
116
- Authorization: `Bearer ${this.sessionId}`
117
- } : {};
118
- }
119
- async makeAPIRequest(e, t, o, n = {}) {
120
- try {
121
- const a = new URL(this.schedulerAPIURL), r = "2.1.0";
122
- return a.pathname = e, await (await fetch(decodeURIComponent(a.toString()), {
123
- method: t,
124
- headers: {
125
- "Content-Type": "application/json",
126
- Origin: window.location.origin,
127
- "X-Source": "nylas-scheduling",
128
- "X-Nylas-Web-Elements-Version": r,
129
- ...this.clientId && { "X-Nylas-Application-Public-Id": this.clientId },
130
- ...n
131
- },
132
- body: o
133
- })).json();
134
- } catch (a) {
135
- return {
136
- error: {
137
- message: a.message,
138
- title: "API request failed",
139
- type: "api"
140
- }
141
- };
142
- }
143
- }
144
- getErrorMessage(e) {
145
- var o, n, a, r;
146
- let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
147
- return (e == null ? void 0 : e.type) === "provider_error" && (t = ((n = (o = e == null ? void 0 : e.provider_error) == null ? void 0 : o.error) == null ? void 0 : n.message) || ((r = (a = e == null ? void 0 : e.provider_error) == null ? void 0 : a.error) == null ? void 0 : r.title) || "Something went wrong"), t;
148
- }
149
- setConfigId(e) {
150
- this.configId = e;
151
- }
152
- selectDate(e) {
153
- this.schedulerStore.set("selectedDate", e), this.schedulerStore.set("selectedTimeslot", null);
154
- }
155
- selectTime(e) {
156
- this.schedulerStore.set("selectedTimeslot", e);
157
- }
158
- selectTimezone(e) {
159
- this.schedulerStore.set("selectedTimezone", e);
160
- }
161
- selectLanguage(e) {
162
- this.schedulerStore.set("selectedLanguage", e), d.changeLanguage(e);
163
- }
164
- async toggleAdditionalData(e) {
165
- e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
166
- }
167
- setParticipantName(e) {
168
- const { bookingInfo: t } = this.schedulerStore.state;
169
- this.schedulerStore.set("bookingInfo", {
170
- ...t,
171
- primaryParticipant: {
172
- ...t == null ? void 0 : t.primaryParticipant,
173
- name: e
174
- }
175
- });
176
- }
177
- setParticipantEmail(e) {
178
- const { bookingInfo: t } = this.schedulerStore.state;
179
- this.schedulerStore.set("bookingInfo", {
180
- ...t,
181
- primaryParticipant: {
182
- ...t == null ? void 0 : t.primaryParticipant,
183
- email: e
184
- }
185
- });
186
- }
187
- async refetchAvailability() {
188
- const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1).getTime() / 1e3, o = t < e.getTime() / 1e3 ? Math.floor(e.getTime() / 1e3) : t, n = new Date(e.getFullYear(), e.getMonth() + 1, 1).getTime() / 1e3;
189
- return await this.getAvailability(o, n);
190
- }
191
- async resetStoreStateAndFetchAvailability() {
192
- const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), o = this.schedulerStore.get("availability").find((a) => new Date(a.start_time) > /* @__PURE__ */ new Date());
193
- let n = e;
194
- return o && (n = o.start_time), this.schedulerStore.set("selectedDate", n), this.schedulerStore.set("eventInfo", null), this.schedulerStore.set("showBookingForm", !1), this.schedulerStore.set("selectedTimeslot", null), t;
195
- }
196
- async setReschedule(e) {
197
- this.schedulerStore.set("isLoading", !0);
198
- const t = this.schedulerStore.state.eventInfo;
199
- return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.getUISettings(), await this.resetStoreStateAndFetchAvailability().finally(() => {
200
- this.schedulerStore.set("isLoading", !1);
201
- });
202
- }
203
- async setCancel(e) {
204
- this.schedulerStore.set("cancelBookingId", e);
205
- }
206
- async setReject(e) {
207
- this.schedulerStore.set("rejectBookingId", e);
208
- }
209
- async resetCancel() {
210
- const e = await this.resetStoreStateAndFetchAvailability();
211
- return this.schedulerStore.set("cancelBookingId", ""), this.schedulerStore.set("rejectBookingId", ""), this.schedulerStore.set("cancelledEventInfo", null), e;
212
- }
213
- async goBack() {
214
- this.schedulerStore.set("cancelBookingId", "");
215
- }
216
- async resetConfirm() {
217
- const e = await this.resetStoreStateAndFetchAvailability();
218
- return this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("confirmedEventInfo", void 0), e;
219
- }
220
- async bookTimeslot(e) {
221
- var w, L, C;
222
- this.schedulerStore.set("isLoading", !0);
223
- const { selectedTimeslot: t, selectedTimezone: o, bookingInfo: n, selectedLanguage: a } = this.schedulerStore.state;
224
- if (!e && !n)
225
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_booking_info() };
226
- const r = (e == null ? void 0 : e.timeslot) || t;
227
- if (!r)
228
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timeslot_selected() };
229
- const l = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : o, c = a || "en-US";
230
- if (!l)
231
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timezone_selected() };
232
- const m = [...this.schedulerStore.get("availabilityOrderEmails")];
233
- let h = "";
234
- const g = (r == null ? void 0 : r.emails) || [], f = {};
235
- Object.entries((n == null ? void 0 : n.additionalFields) || {}).forEach(([v, B]) => {
236
- f[v] = B.value;
237
- });
238
- const b = e ? e == null ? void 0 : e.primaryParticipant : n == null ? void 0 : n.primaryParticipant, p = e ? (e == null ? void 0 : e.guests) || [] : (n == null ? void 0 : n.guests) || [], I = e ? e == null ? void 0 : e.additionalFields : f, _ = this.getHeaders(), k = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`;
239
- if (m.length === 0) {
240
- const v = await this.makeAPIRequest(decodeURIComponent(k), "POST", JSON.stringify({
241
- additional_fields: I,
242
- additional_guests: p,
243
- guest: { ...b },
244
- start_time: r.start_time.getTime() / 1e3,
245
- end_time: r.end_time.getTime() / 1e3,
246
- timezone: l,
247
- event_id: (r == null ? void 0 : r.event_id) || void 0,
248
- master_id: (r == null ? void 0 : r.master_id) || void 0,
249
- calendar_id: (r == null ? void 0 : r.calendar_id) || void 0,
250
- email_language: this.getTwoLetterLanguageCode(c)
251
- }), _);
252
- return this.schedulerStore.set("isLoading", !1), "data" in v ? (this.schedulerStore.set("eventInfo", v.data), v) : { error: v.error };
253
- }
254
- for (; m.length > 0; ) {
255
- if (h = m.shift(), !g.includes(h))
256
- continue;
257
- const v = await this.makeAPIRequest(decodeURIComponent(k), "POST", JSON.stringify({
258
- participants: h ? [{ email: h }] : void 0,
259
- additional_fields: I,
260
- additional_guests: p,
261
- guest: { ...b },
262
- start_time: r.start_time.getTime() / 1e3,
263
- end_time: r.end_time.getTime() / 1e3,
264
- timezone: l,
265
- email_language: this.getTwoLetterLanguageCode(c)
266
- }), _);
267
- if ("data" in v)
268
- return this.schedulerStore.set("isLoading", !1), this.schedulerStore.set("eventInfo", v == null ? void 0 : v.data), v;
269
- if ((L = (w = v.error) == null ? void 0 : w.message) != null && L.startsWith("The selected timeslot is unavailable"))
270
- continue;
271
- {
272
- this.schedulerStore.set("isLoading", !1);
273
- const B = (C = v.error) == null ? void 0 : C.type;
274
- let F = v.error;
275
- if (B && B in this.errors.api(d.t("createBookingErrorTitle"))) {
276
- const U = this.getErrorMessage(F);
277
- F = this.errors.api(d.t("createBookingErrorTitle"))[B](U);
278
- }
279
- return { error: F };
280
- }
281
- }
282
- return this.schedulerStore.set("isLoading", !1), {
283
- error: this.errors.api(d.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")
284
- };
285
- }
286
- async getUISettings() {
287
- var r;
288
- this.schedulerStore.set("isLoading", !0);
289
- const e = this.schedulerStore.get("rescheduleBookingId"), t = this.getHeaders();
290
- let o = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "";
291
- e && o ? o += `&booking_id=${e}` : e && (o += `?booking_id=${e}`);
292
- const n = `/v3/scheduling/ui-settings${o}`, a = await this.makeAPIRequest(n, "GET", void 0, t);
293
- if ("error" in a) {
294
- this.schedulerStore.set("isLoading", !1);
295
- const l = (r = a.error) == null ? void 0 : r.type;
296
- let c = a.error;
297
- return l && l in this.errors.api(d.t("getUISettingErrorTitle")) && (c = this.errors.api(d.t("getUISettingErrorTitle"))[l]((c == null ? void 0 : c.message) || (c == null ? void 0 : c.title) || "Something went wrong")), { error: c };
298
- }
299
- return "data" in a && (this.schedulerStore.set("configSettings", a.data), this.clientId = a.data.app_client_id || this.clientId), this.schedulerStore.set("isLoading", !1), a;
300
- }
301
- getTwoLetterLanguageCode(e) {
302
- return e.split("-")[0];
303
- }
304
- getStartTimeWithMinBookingNotice(e) {
305
- var a;
306
- const t = (a = this.schedulerStore.get("configSettings")) == null ? void 0 : a.scheduler, o = t == null ? void 0 : t.min_booking_notice;
307
- if (!o)
308
- return e;
309
- const n = (/* @__PURE__ */ new Date()).getTime();
310
- return e < (n + o * 60 * 1e3) / 1e3 ? Math.floor((n + o * 60 * 1e3) / 1e3) : e;
311
- }
312
- getEndTimeForAvailableDaysInFuture(e) {
313
- var r, l;
314
- const t = /* @__PURE__ */ new Date(), o = (l = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.scheduler) == null ? void 0 : l.available_days_in_future, n = Math.floor(V(t, o).getTime() / 1e3);
315
- return Math.min(n, e);
316
- }
317
- async getAvailability(e = 0, t = 0) {
318
- var f, b, p, I, _;
319
- this.schedulerStore.set("isLoading", !0);
320
- const o = new URLSearchParams(), n = /* @__PURE__ */ new Date(), a = n.getTime();
321
- if (t && t < a / 1e3)
322
- return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(d.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
323
- if (!e) {
324
- const y = new Date(n.getFullYear(), n.getMonth(), 1);
325
- e = Math.floor(y.getTime() / 1e3);
326
- }
327
- if (!t) {
328
- const y = new Date(n.getFullYear(), n.getMonth() + 1, 0);
329
- t = Math.floor(y.getTime() / 1e3);
330
- }
331
- t = this.getEndTimeForAvailableDaysInFuture(t);
332
- const r = this.getStartTimeWithMinBookingNotice(e);
333
- e = r, t = r > t ? r + 1 : t, o.append("start_time", encodeURIComponent(e.toString())), o.append("end_time", encodeURIComponent(t.toString())), this.configId && !this.sessionId ? o.append("configuration_id", encodeURIComponent(this.configId)) : this.slug && this.clientId && !this.sessionId && (o.append("slug", encodeURIComponent(this.slug)), o.append("client_id", encodeURIComponent(this.clientId)));
334
- const l = this.schedulerStore.get("rescheduleBookingId");
335
- l && o.append("booking_id", encodeURIComponent(l));
336
- const c = o.toString(), m = `/v3/scheduling/availability${c ? `?${c}` : ""}`, h = this.getHeaders(), g = await this.makeAPIRequest(decodeURIComponent(m), "GET", void 0, h);
337
- if ("error" in g) {
338
- this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
339
- const y = (f = g.error) == null ? void 0 : f.type;
340
- let k = g.error;
341
- if ((b = k == null ? void 0 : k.message) != null && b.toLowerCase().includes("Failed to find a valid Grant")) {
342
- const w = d.t("invalidGrantError");
343
- return {
344
- error: {
345
- title: d.t("invalidGrantErrorTitle"),
346
- message: w,
347
- category: M.Api
348
- }
349
- };
350
- }
351
- if (y && y in this.errors.api(d.t("getAvailabilityErrorTitle"))) {
352
- const w = this.getErrorMessage(k);
353
- k = this.errors.api(d.t("getAvailabilityErrorTitle"))[y](w);
354
- }
355
- return { error: k };
356
- }
357
- if ("data" in g) {
358
- const w = (((I = (p = g.data) == null ? void 0 : p.time_slots) == null ? void 0 : I.map((C) => ({
359
- ...C,
360
- start_time: new Date(C.start_time * 1e3),
361
- end_time: new Date(C.end_time * 1e3)
362
- }))) || []).filter((C) => C.start_time.getTime() > a).sort((C, v) => C.start_time.getTime() - v.start_time.getTime());
363
- this.schedulerStore.set("availability", w);
364
- const L = ((_ = g.data) == null ? void 0 : _.order) || [];
365
- this.schedulerStore.set("availabilityOrderEmails", L);
366
- }
367
- return this.schedulerStore.set("isLoading", !1), g;
368
- }
369
- async cancelBooking(e, t) {
370
- var l;
371
- if (this.schedulerStore.set("isLoading", !0), !e)
372
- return { error: this.errors.component(d.t("cancelBookingErrorTitle")).no_booking_id() };
373
- const o = !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}${o}`, a = this.getHeaders(), r = await this.makeAPIRequest(decodeURIComponent(n), "DELETE", JSON.stringify({
374
- action: "cancel",
375
- cancellation_reason: t
376
- }), a);
377
- if ("error" in r) {
378
- this.schedulerStore.set("isLoading", !1);
379
- const c = (l = r.error) == null ? void 0 : l.type;
380
- let m = r.error;
381
- if (c && c in this.errors.api(d.t("cancelBookingErrorTitle"))) {
382
- const h = this.getErrorMessage(m);
383
- m = this.errors.api(d.t("cancelBookingErrorTitle"))[c](h);
384
- }
385
- return { error: m };
386
- }
387
- return this.schedulerStore.set("cancelledEventInfo", {
388
- booking_id: e
389
- }), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), r;
390
- }
391
- async rescheduleBooking(e, t) {
392
- var O;
393
- if (this.schedulerStore.set("isLoading", !0), !e)
394
- return { error: this.errors.component(d.t("rescheduleBookingErrorTitle")).no_booking_id() };
395
- const o = this.errors.api(d.t("rescheduleBookingErrorTitle")), n = this.errors.component(d.t("rescheduleBookingErrorTitle")), { bookingInfo: a, selectedTimeslot: r, selectedTimezone: l, selectedLanguage: c } = this.schedulerStore.state, { startTime: m, endTime: h, timezone: g } = t, f = m || (r == null ? void 0 : r.start_time);
396
- if (!f)
397
- return { error: n.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
398
- const b = h || (r == null ? void 0 : r.end_time);
399
- if (!b)
400
- return { error: n.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
401
- const p = this.schedulerStore.get("availabilityOrderEmails");
402
- let I = "";
403
- if (p.length > 0) {
404
- const T = (r == null ? void 0 : r.emails) || [];
405
- for (let S = 0; S < p.length; S++)
406
- if (T.includes(p[S])) {
407
- I = p[S];
408
- break;
409
- }
410
- }
411
- const _ = g || l;
412
- if (!_)
413
- return { error: n.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
414
- const y = (r == null ? void 0 : r.event_id) || void 0, k = (r == null ? void 0 : r.master_id) || void 0, w = (r == null ? void 0 : r.calendar_id) || void 0, L = {};
415
- Object.entries((a == null ? void 0 : a.additionalFields) || {}).forEach(([T, S]) => {
416
- L[T] = S.value;
417
- });
418
- const C = t ? t == null ? void 0 : t.primaryParticipant : a == null ? void 0 : a.primaryParticipant, v = t ? (t == null ? void 0 : t.guests) || [] : (a == null ? void 0 : a.guests) || [], B = t ? t == null ? void 0 : t.additionalFields : L, F = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", U = `/v3/scheduling/bookings/${e}${F}`, q = this.getHeaders(), x = await this.makeAPIRequest(decodeURIComponent(U), "PATCH", JSON.stringify({
419
- start_time: f.getTime() / 1e3,
420
- end_time: b.getTime() / 1e3,
421
- timezone: _,
422
- additional_fields: B,
423
- guest: { ...C },
424
- additional_guests: v,
425
- participants: I ? [{ email: I }] : void 0,
426
- email_language: this.getTwoLetterLanguageCode(c),
427
- event_id: y,
428
- master_id: k,
429
- calendar_id: w
430
- }), q);
431
- if ("error" in x) {
432
- this.schedulerStore.set("isLoading", !1);
433
- const T = (O = x.error) == null ? void 0 : O.type;
434
- let S = x.error;
435
- if (T && T in o) {
436
- const D = this.getErrorMessage(S);
437
- S = o[T](D);
438
- }
439
- return { error: S };
440
- }
441
- const u = this.schedulerStore.get("reschedulingEventInfo");
442
- if ("data" in x)
443
- this.schedulerStore.set("eventInfo", x == null ? void 0 : x.data);
444
- else if (u)
445
- this.schedulerStore.set("eventInfo", u);
446
- else {
447
- const T = {
448
- booking_id: e
449
- };
450
- this.schedulerStore.set("eventInfo", T);
451
- }
452
- return this.schedulerStore.set("isLoading", !1), x;
453
- }
454
- async updateBooking(e) {
455
- var g;
456
- this.schedulerStore.set("isLoading", !0);
457
- const { bookingId: t, status: o, reason: n } = e, a = this.schedulerStore.get("organizerConfirmationSalt"), r = o === "confirmed" ? d.t("confirmBookingErrorTitle") : d.t("rejectBookingErrorTitle");
458
- if (!t)
459
- return { error: this.errors.component(r).no_booking_id() };
460
- if (!a)
461
- return { error: this.errors.component(r).no_salt() };
462
- 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}`, m = this.getHeaders(), h = await this.makeAPIRequest(decodeURIComponent(c), "PUT", JSON.stringify({
463
- status: o,
464
- cancellation_reason: n,
465
- salt: a
466
- }), m);
467
- if ("error" in h) {
468
- this.schedulerStore.set("isLoading", !1);
469
- const f = (g = h.error) == null ? void 0 : g.type;
470
- let b = h.error;
471
- if (f && f in this.errors.api(r)) {
472
- const p = this.getErrorMessage(b);
473
- b = this.errors.api(r)[f](p);
474
- }
475
- return { error: b };
476
- }
477
- return "data" in h && o === "confirmed" ? this.schedulerStore.set("confirmedEventInfo", h == null ? void 0 : h.data) : "request_id" in h && o === "cancelled" && this.schedulerStore.set("cancelledEventInfo", {
478
- booking_id: t
479
- }), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), h;
480
- }
481
- async validateGroupEventTimeslot(e) {
482
- var r, l;
483
- this.schedulerStore.set("isLoading", !0);
484
- const t = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.configuration_id;
485
- if (!t)
486
- return { error: this.errors.component(d.t("validateTimeslotErrorTitle")).no_config_id() };
487
- const o = this.getHeaders(), n = `/v3/scheduling/configurations/${t}/group-events/validate-timeslot`, a = await this.makeAPIRequest(decodeURIComponent(n), "POST", JSON.stringify({
488
- ...e,
489
- start_time: e.start_time.getTime() / 1e3,
490
- end_time: e.end_time.getTime() / 1e3
491
- }), o);
492
- if ("error" in a) {
493
- this.schedulerStore.set("isLoading", !1);
494
- const c = (l = a.error) == null ? void 0 : l.type;
495
- let m = a.error;
496
- if (c && c in this.errors.api(d.t("validateTimeslotErrorTitle"))) {
497
- const h = this.getErrorMessage(m);
498
- m = this.errors.api(d.t("validateTimeslotErrorTitle"))[c](h);
499
- }
500
- return this.refetchAvailability(), { error: m };
501
- }
502
- return this.schedulerStore.set("selectedTimeslot", e), this.schedulerStore.set("showBookingForm", !0), this.schedulerStore.set("isLoading", !1), a;
503
- }
504
- }
505
- class fe {
506
- constructor({ schedulerAPIURL: e, nylasSchedulerStore: t, sessionId: o, configId: n, slug: a, clientId: r }) {
507
- if (!e)
508
- throw new Error("schedulerAPIURL is required");
509
- if (!t)
510
- throw new Error("nylasSchedulerStore is required");
511
- if (!o && !n && !(a || r))
512
- throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");
513
- e === "/" && (e = new URL(window.location.href).origin), this.configId = n, this.sessionId = o, this.schedulerAPIURL = e, this.nylasSchedulerStore = t, this.slug = a, this.clientId = r;
514
- }
515
- init() {
516
- A("NylasConnector init");
517
- }
518
- get schedulerStore() {
519
- return this.nylasSchedulerStore;
520
- }
521
- get scheduler() {
522
- return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new ue({
523
- schedulerAPIURL: this.schedulerAPIURL,
524
- schedulerStore: this.schedulerStore,
525
- sessionId: this.sessionId,
526
- configId: this.configId,
527
- slug: this.slug,
528
- clientId: this.clientId
529
- }), this._schedulerAPIConnector);
530
- }
531
- resetStores() {
532
- this.nylasSchedulerStore.reset();
533
- }
534
- }
535
- function pe(i = {}) {
536
- const e = {
537
- selectedDate: null,
538
- selectedLanguage: navigator.language,
539
- selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
540
- selectedTimeslot: null,
541
- showBookingForm: !1,
542
- availabilityOrderEmails: [],
543
- selectableDates: null,
544
- availability: [],
545
- eventDuration: 0,
546
- state: "ready",
547
- eventInfo: null,
548
- cancelledEventInfo: null,
549
- isLoading: !1,
550
- nylasBranding: !0,
551
- ...i
552
- };
553
- A("[defaultNylasStoreState]: ", e);
554
- const t = oe(e);
555
- return t.onChange("availability", (o) => {
556
- A("[availability]: ", o);
557
- const n = o.map((l) => l.start_time);
558
- A("[selectableDates]: ", n), t.set("selectableDates", n);
559
- const a = o[0];
560
- if (!a)
561
- return;
562
- const r = Math.floor((a.end_time.getTime() - a.start_time.getTime()) / 6e4);
563
- A("[durationMinutes]: ", r), t.set("eventDuration", r);
564
- }), t.reset = () => {
565
- for (const o in e) {
566
- const n = e[o];
567
- t.set(o, n);
568
- }
569
- }, t;
570
- }
571
- const z = (i, e) => {
572
- const t = i.isLoading, o = i.showNotification, n = i.nylasBranding, a = i.version;
573
- return s(
574
- ie,
575
- null,
576
- o && s("nylas-notification", null),
577
- t && s(
578
- "div",
579
- { class: "loading" },
580
- s(
581
- "div",
582
- { class: "left" },
583
- s("div", { class: "skeleton" })
584
- ),
585
- s(
586
- "div",
587
- { class: "right" },
588
- s("div", { class: "skeleton" }),
589
- s("div", { class: "skeleton" }),
590
- s("div", { class: "skeleton" }),
591
- s("div", { class: "skeleton" }),
592
- s("div", { class: "skeleton" })
593
- )
594
- ),
595
- !t && e,
596
- s(
597
- "div",
598
- { class: "footer" },
599
- n && s(
600
- "a",
601
- { 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" },
602
- "Powered by ",
603
- s("span", { class: "sr-only" }, "Nylas"),
604
- s("nylas-logo", { "aria-hidden": !0 })
605
- ),
606
- s(
607
- "tooltip-component",
608
- null,
609
- s("info-icon", { slot: "tooltip-icon" }),
610
- s("span", { slot: "tooltip-content" }, a)
611
- )
612
- )
613
- );
614
- }, K = (i, e) => s("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-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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;gap:8px;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}.language-feedback-container{width:auto;position:absolute;bottom:4px;left:16px;display:flex;gap:8px;align-items:center}.language-feedback-container button-component#report-issue{position:initial}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}', be = me, Q = { title: d.t("genericErrorTitle"), type: H.Error, category: M.Component }, _e = class {
615
- constructor(i) {
616
- te(this, i), this.init = P(this, "init", 7), this.schedulerWillLoad = P(this, "schedulerWillLoad", 7), this.schedulerDidLoad = P(this, "schedulerDidLoad", 7), this.nylasSchedulerError = P(this, "nylasSchedulerError", 7), this.nylasSchedulerInfo = P(this, "nylasSchedulerInfo", 7), this.configSettingsLoaded = P(this, "configSettingsLoaded", 7), this.bookingRefExtracted = P(this, "bookingRefExtracted", 7), this.bookedEventInfo = P(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.defaultLanguage = 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" }) || `${d.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language, this.showFeedbackModal = !1, this.bookingInfoConfirmed = null, this.version = "2.1.0";
617
- }
618
- connectedCallback() {
619
- A("[nylas-scheduler] connectedCallback");
620
- }
621
- async componentWillLoad() {
622
- var l, c, m;
623
- A("[nylas-scheduler] Component will load"), this.version = "2.1.0", this.enableUserFeedback && !ae() && le({
624
- dsn: "https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",
625
- release: this.version,
626
- integrations: (h) => [
627
- ...h.filter((g) => !1),
628
- de({
629
- colorScheme: "system",
630
- autoInject: !1
631
- })
632
- ],
633
- autoSessionTracking: !1,
634
- beforeSend: () => null
635
- });
636
- const i = this.schedulerWillLoad.emit(this.host);
637
- if ("schedulerWillLoad" in this.eventOverrides && (await this.eventOverrides.schedulerWillLoad(i, this.nylasSchedulerConnector), i.defaultPrevented))
638
- return;
639
- const t = new URLSearchParams(window.location.search).get("lang"), o = t && Object.values(j).includes(t) ? t : null;
640
- this.stores = {
641
- scheduler: pe({
642
- bookingInfo: this.bookingInfo,
643
- nylasBranding: this.nylasBranding,
644
- themeConfig: this.themeConfig,
645
- hour12: this.hour12,
646
- selectedLanguage: o || this.defaultLanguage || ((l = this.bookingInfo) == null ? void 0 : l.language) || j.en,
647
- ...this.defaultSchedulerState
648
- })
649
- }, this.baseProvider = new se(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
650
- let n;
651
- if (this.rescheduleBookingRef) {
652
- const [h, g, f] = N(this.rescheduleBookingRef);
653
- this.refConfigId = h, this.stores.scheduler.set("rescheduleBookingId", g), n = this.bookingRefExtracted.emit({ configurationId: h, bookingId: g });
654
- } else if (this.cancelBookingRef) {
655
- const [h, g, f] = N(this.cancelBookingRef);
656
- this.refConfigId = h, this.stores.scheduler.set("cancelBookingId", g), n = this.bookingRefExtracted.emit({ configurationId: h, bookingId: g });
657
- } else if (this.organizerConfirmationBookingRef) {
658
- const [h, g, f] = N(this.organizerConfirmationBookingRef);
659
- this.refConfigId = h, this.stores.scheduler.set("organizerConfirmationBookingId", g), this.stores.scheduler.set("organizerConfirmationSalt", f), n = this.bookingRefExtracted.emit({ configurationId: h, bookingId: g, salt: f });
660
- }
661
- if (this.applyThemeConfig(this.themeConfig), "bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(n, this.nylasSchedulerConnector), n.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
662
- return;
663
- const a = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler");
664
- this.nylasSchedulerConnector = new fe({
665
- schedulerAPIURL: this.schedulerApiUrl,
666
- sessionId: this.sessionId,
667
- configId: this.refConfigId,
668
- slug: this.slug,
669
- clientId: this.clientId,
670
- nylasSchedulerStore: a
671
- });
672
- const r = this.init.emit(this.host);
673
- "init" in this.eventOverrides && (await this.eventOverrides.init(r, this.nylasSchedulerConnector), r.defaultPrevented) || (m = this.baseProvider) == null || m.componentWillLoad(this.nylasSchedulerConnector);
674
- }
675
- async componentDidLoad() {
676
- var c, m, h, g, f, b, p, I;
677
- (c = this.baseProvider) == null || c.componentDidLoad();
678
- const i = this.schedulerDidLoad.emit(this.host);
679
- if ("schedulerDidLoad" in this.eventOverrides && (await this.eventOverrides.schedulerDidLoad(i, this.nylasSchedulerConnector), i.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
680
- return;
681
- this.localizationChanged(this.localization);
682
- const e = await ((m = this.nylasSchedulerConnector) == null ? void 0 : m.scheduler.getUISettings());
683
- if (!e || "error" in e) {
684
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(e == null ? void 0 : e.error) }, host: this.host });
685
- return;
686
- } else {
687
- "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.");
688
- const _ = this.configSettingsLoaded.emit({ settings: e });
689
- if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(_, this.nylasSchedulerConnector), _.defaultPrevented))
690
- return;
691
- }
692
- const t = (g = this.baseProvider) == null ? void 0 : g.getStore("scheduler"), o = (b = (f = t == null ? void 0 : t.get("configSettings")) == null ? void 0 : f.scheduler) == null ? void 0 : b.available_days_in_future, n = t == null ? void 0 : t.get("selectedTimeslot");
693
- if (n && (n != null && n.start_time)) {
694
- if (!this.isTimeslotValid(n))
695
- return;
696
- if (t != null && t.get("showBookingForm")) {
697
- t == null || t.set("selectedDate", n.start_time);
698
- return;
699
- }
700
- }
701
- const a = t == null ? void 0 : t.get("selectedDate"), r = t == null ? void 0 : t.get("availability");
702
- let l;
703
- if (!(r && r.length > 0)) {
704
- if (a) {
705
- const { startTime: _, endTime: y, endTimeForAvailableDaysInFuture: k } = this.validateAvailableDaysInFuture(a, o || 30);
706
- a.getTime() < k * 1e3 && (l = await ((I = this.nylasSchedulerConnector) == null ? void 0 : I.scheduler.getAvailability(_, y)));
707
- } else {
708
- const _ = /* @__PURE__ */ new Date(), { startTime: y, endTime: k, endTimeForAvailableDaysInFuture: w } = this.validateAvailableDaysInFuture(_, o || 30);
709
- _.getTime() < w * 1e3 && (l = await ((p = this.nylasSchedulerConnector) == null ? void 0 : p.scheduler.getAvailability(y, k)));
710
- }
711
- if ((!l || "error" in l) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(l == null ? void 0 : l.error) }, host: this.host }), !a) {
712
- let _ = /* @__PURE__ */ new Date();
713
- const y = t == null ? void 0 : t.get("availability").find((k) => new Date(k.start_time) > /* @__PURE__ */ new Date());
714
- y && (_ = y.start_time), t == null || t.set("selectedDate", _);
715
- }
716
- }
717
- }
718
- componentDisconnected() {
719
- var i;
720
- (i = this.baseProvider) == null || i.componentDisconnected();
721
- }
722
- bookingInfoChanged(i) {
723
- var e, t;
724
- (e = this.stores) == null || e.scheduler.set("bookingInfo", i), i != null && i.language && !this.defaultLanguage && ((t = this.stores) == null || t.scheduler.set("selectedLanguage", i.language));
725
- }
726
- rescheduleBookingRefChanged(i) {
727
- var e, t;
728
- if (i) {
729
- const [o, n] = N(i);
730
- (e = this.stores) == null || e.scheduler.set("rescheduleBookingId", n), this.refConfigId = o, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(o);
731
- }
732
- }
733
- cancelBookingRefChanged(i) {
734
- var e, t;
735
- if (i) {
736
- const [o, n] = N(i);
737
- (e = this.stores) == null || e.scheduler.set("cancelBookingId", n), this.refConfigId = o, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(o);
738
- }
739
- }
740
- organizerConfirmationBookingRefChanged(i) {
741
- var e, t;
742
- if (i) {
743
- const [o, n] = N(i);
744
- (e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId", n), this.refConfigId = o, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(o);
745
- }
746
- }
747
- localizationChanged(i) {
748
- i && Object.keys(i).forEach((e) => {
749
- e in j && d.addResourceBundle(e, "translation", i[e], !1, !0);
750
- });
751
- }
752
- defaultLanguageChanged(i) {
753
- var e;
754
- i && ((e = this.stores) == null || e.scheduler.set("selectedLanguage", i), d.changeLanguage(i));
755
- }
756
- themeConfigChanged(i) {
757
- var e, t;
758
- (t = (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler")) == null || t.set("themeConfig", i), this.applyThemeConfig(i);
759
- }
760
- languageChanged(i) {
761
- const e = i.detail;
762
- this.language = e, d.changeLanguage(e);
763
- }
764
- async registerComponentHandler(i) {
765
- var e;
766
- (e = this.baseProvider) == null || e.registerComponent(i.detail);
767
- }
768
- async unregisterComponentHandler(i) {
769
- var e;
770
- (e = this.baseProvider) == null || e.unregisterComponent(i.detail);
771
- }
772
- async monthChangedHandler(i) {
773
- var r, l, c, m, h, g, f;
774
- const e = i.detail, t = (m = (c = (l = (r = this.nylasSchedulerConnector) == null ? void 0 : r.schedulerStore) == null ? void 0 : l.get("configSettings")) == null ? void 0 : c.scheduler) == null ? void 0 : m.available_days_in_future, { startTime: o, endTime: n, endTimeForAvailableDaysInFuture: a } = this.validateAvailableDaysInFuture(e, t || 30);
775
- if (!i.defaultPrevented && o < a && e.getTime() < a * 1e3) {
776
- const b = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.getAvailability(o, n));
777
- (!b || "error" in b) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(b == null ? void 0 : b.error) }, host: this.host });
778
- const p = (g = this.stores) == null ? void 0 : g.scheduler.get("selectableDates");
779
- p && p.length > 0 && ((f = this.stores) == null || f.scheduler.set("selectedDate", p[0]));
780
- }
781
- }
782
- mapToBookingData(i) {
783
- var r, l, c;
784
- const e = (r = this.stores) == null ? void 0 : r.scheduler.get("selectedTimeslot"), t = (l = this.stores) == null ? void 0 : l.scheduler.get("selectedLanguage"), o = (c = this.stores) == null ? void 0 : c.scheduler.get("selectedTimezone"), n = e != null && e.start_time ? new Date(e == null ? void 0 : e.start_time).getTime() / 1e3 : "", a = e != null && e.end_time ? new Date(e == null ? void 0 : e.end_time).getTime() / 1e3 : "";
785
- return {
786
- additional_guests: i.guests,
787
- guest: { ...i.primaryParticipant },
788
- additional_fields: { ...i.additionalFields },
789
- start_time: n,
790
- end_time: a,
791
- email_language: t,
792
- timezone: o
793
- };
794
- }
795
- async bookButtonClickedHandler(i) {
796
- var c, m, h, g;
797
- if (i.defaultPrevented)
798
- return;
799
- const e = i.detail, t = this.mapToBookingData(e);
800
- this.bookingInfoConfirmed = e;
801
- const n = (m = (c = this.nylasSchedulerConnector) == null ? void 0 : c.schedulerStore) == null ? void 0 : m.get("rescheduleBookingId");
802
- if (n) {
803
- const f = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.rescheduleBooking(n, e));
804
- (!f || "error" in f) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(f == null ? void 0 : f.error) }, host: this.host });
805
- const b = f == null ? void 0 : f.data, p = this.bookedEventInfo.emit({ ...f, data: { ...b, ...t } });
806
- this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...b }, "bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(p, this.nylasSchedulerConnector);
807
- return;
808
- }
809
- const a = await ((g = this.nylasSchedulerConnector) == null ? void 0 : g.scheduler.bookTimeslot(e));
810
- (!a || "error" in a) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(a == null ? void 0 : a.error) }, host: this.host });
811
- const r = a == null ? void 0 : a.data, l = this.bookedEventInfo.emit({ ...a, data: { ...r, ...t } });
812
- this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...r }, "bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(l, this.nylasSchedulerConnector);
813
- }
814
- dateSelectedHandler(i) {
815
- const e = i.detail;
816
- this.selectedDateLabel = e ? e.toLocaleDateString(this.language, { dateStyle: "full" }) : `${d.t("noDateSelected")}`;
817
- }
818
- cancelBookedEventErrorHandler(i) {
819
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
820
- }
821
- cancelBookedEventValidationErrorHandler(i) {
822
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
823
- }
824
- rescheduleBookedEventErrorHandler(i) {
825
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
826
- }
827
- confirmBookingErrorHandler(i) {
828
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(i.detail.error) }, host: this.host });
829
- }
830
- feedbackModalClosedHandler() {
831
- this.showFeedbackModal = !1;
832
- }
833
- eventIsFullHandler(i) {
834
- const e = i.detail.error;
835
- i.detail.type === "error" ? this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject({ message: e }) }, host: this.host }) : this.nylasSchedulerInfo.emit({
836
- notification: {
837
- title: "Event is full",
838
- category: M.Component,
839
- type: H.Info,
840
- description: "The event you selected is full. Please try a different time.",
841
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
842
- ttl: 3e3
843
- },
844
- host: this.host
845
- });
846
- }
847
- feedbackSubmittedHandler(i) {
848
- const t = {
849
- eventId: ce("Scheduling Page User Feedback", {
850
- extra: {
851
- configId: this.configurationId,
852
- slug: this.slug
853
- }
854
- }),
855
- message: i.detail.feedback
856
- };
857
- he(t, {
858
- includeReplay: !0,
859
- captureContext: {
860
- tags: {
861
- "nylas-web-element": "nylas-scheduling",
862
- "nylas-web-element-version": this.version,
863
- "nylas-config-id": this.configurationId,
864
- "nylas-slug": this.slug,
865
- "host-url": window.location.href
866
- },
867
- extra: {
868
- configId: this.configurationId,
869
- slug: this.slug,
870
- version: this.version
871
- }
872
- }
873
- }), this.showFeedbackModal = !1;
874
- }
875
- async getNylasSchedulerStore() {
876
- var i;
877
- return (i = this.baseProvider) == null ? void 0 : i.getStore("scheduler");
878
- }
879
- async getNylasSchedulerConnector() {
880
- return this.nylasSchedulerConnector;
881
- }
882
- async getRef() {
883
- return this.host;
884
- }
885
- getErrorObject(i) {
886
- return {
887
- title: (i == null ? void 0 : i.title) || Q.title,
888
- category: (i == null ? void 0 : i.category) || Q.category,
889
- type: H.Error,
890
- description: (i == null ? void 0 : i.message) || "",
891
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
892
- ttl: "none"
893
- };
894
- }
895
- checkIfSessionIdOrConfigIdExists() {
896
- if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {
897
- let i = "";
898
- return this.sessionId || (i += d.t("sessionIdRequiredErrorMessage")), !this.sessionId && !this.refConfigId && !(this.slug && this.clientId) && (i = d.t("sessionIdRequiredErrorMessage") + " " + d.t("publicConfigErrorMessage")), this.nylasSchedulerError.emit({
899
- notification: {
900
- title: d.t("schedulingComponentErrorTitle"),
901
- category: M.Component,
902
- type: H.Error,
903
- description: i,
904
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
905
- ttl: "none"
906
- },
907
- host: this.host
908
- }), !1;
909
- }
910
- return !0;
911
- }
912
- isTimeslotValid(i) {
913
- return new Date(i.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
914
- notification: {
915
- title: d.t("invalidTimeslotErrorTitle"),
916
- category: M.Component,
917
- type: H.Error,
918
- description: d.t("invalidTimeslotErrorMessage"),
919
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
920
- ttl: "none"
921
- },
922
- host: this.host
923
- }), !1) : !0;
924
- }
925
- validateAvailableDaysInFuture(i, e) {
926
- const t = /* @__PURE__ */ new Date(), o = new Date(i.getFullYear(), i.getMonth(), 1).getTime() / 1e3, n = new Date(i.getFullYear(), i.getMonth() + 1, 1).getTime() / 1e3, a = Math.floor(V(t, e).getTime() / 1e3), r = Math.min(a, n);
927
- return { startTime: o < t.getTime() / 1e3 ? Math.floor(t.getTime() / 1e3) : o, endTime: r, endTimeForAvailableDaysInFuture: a };
928
- }
929
- applyThemeConfig(i) {
930
- if (i)
931
- for (const [e, t] of Object.entries(i))
932
- this.host.style.setProperty(`${e}`, t);
933
- }
934
- onFeedbackClick(i) {
935
- i.preventDefault(), this.showFeedbackModal = !0;
936
- }
937
- redirectToCustomUrl(i) {
938
- window.location.assign(i);
939
- }
940
- nylasFormDropdownChangedHandler(i) {
941
- var o, n;
942
- const { name: e, value: t } = i.detail;
943
- if (e === "language") {
944
- const a = j[t];
945
- d.changeLanguage(a), (n = (o = this.stores) == null ? void 0 : o.scheduler) == null || n.set("selectedLanguage", a);
946
- }
947
- }
948
- render() {
949
- var _, y, k, w, L, C, v, B, F, U, q, x;
950
- const i = this.mode === "app", e = (_ = this.baseProvider) == null ? void 0 : _.getStore("scheduler"), t = e == null ? void 0 : e.get("eventInfo"), o = e == null ? void 0 : e.get("showBookingForm"), n = e == null ? void 0 : e.get("cancelledEventInfo"), a = e == null ? void 0 : e.get("cancelBookingId"), r = e == null ? void 0 : e.get("selectedTimeslot"), l = e == null ? void 0 : e.get("rescheduleBookingId"), c = e == null ? void 0 : e.get("organizerConfirmationBookingId"), m = e == null ? void 0 : e.get("rejectBookingId"), h = e == null ? void 0 : e.get("confirmedEventInfo"), g = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, f = e == null ? void 0 : e.get("selectedDate"), b = (k = (y = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : y.scheduler) == null ? void 0 : k.confirmation_redirect_url;
951
- this.selectedDateLabel = f && this.language ? re(f.toLocaleDateString(this.language, { dateStyle: "full" })) : `${d.t("noDateSelected")}`;
952
- const p = Object.keys(Z).map((u) => ({
953
- label: Z[u],
954
- value: u
955
- })), I = (e == null ? void 0 : e.get("selectedLanguage")) || this.defaultLanguage || navigator.language || j.en;
956
- if (i && (a || m) && !n)
957
- return s(R, null, s(z, { version: this.version, nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, s("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, s("nylas-cancel-booking-form", { selectedTimeslot: r, cancelBookingId: a, rejectBookingId: m, exportparts: "ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card" }))), s("div", { class: "language-feedback-container" }, this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (u) => this.onFeedbackClick(u) }, s("feedback-icon", null)), s("select-dropdown", { name: "language", searchPlaceholder: d.t("search"), options: p, withChevron: !1, themeConfig: this.themeConfig, defaultSelectedOption: p.find((u) => u.value == I), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, s("span", { slot: "select-icon" }, s("translate-icon", { width: "20", height: "20" })))), this.showFeedbackModal && s("nylas-feedback-form", null));
958
- if (i && c)
959
- return s(R, null, s(z, null, s("div", { class: "manual-confirmation-page", part: "manual-confirmation-page" }, s("nylas-organizer-confirmation-card", { organizerConfirmationBookingId: c, exportparts: "nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline" }))), s("div", { class: "language-feedback-container" }, this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (u) => this.onFeedbackClick(u) }, s("feedback-icon", null)), s("select-dropdown", { name: "language", searchPlaceholder: d.t("search"), options: p, withChevron: !1, themeConfig: this.themeConfig, defaultSelectedOption: p.find((u) => u.value == I), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, s("span", { slot: "select-icon" }, s("translate-icon", { width: "20", height: "20" })))), this.showFeedbackModal && s("nylas-feedback-form", null));
960
- if (i && n)
961
- return s(R, null, s(z, { version: this.version, nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, s("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, s("nylas-cancelled-event-card", { cancelledEventInfo: n, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), s("div", { class: "language-feedback-container" }, this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (u) => this.onFeedbackClick(u) }, s("feedback-icon", null)), s("select-dropdown", { name: "language", searchPlaceholder: d.t("search"), options: p, withChevron: !1, themeConfig: this.themeConfig, defaultSelectedOption: p.find((u) => u.value == I), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, s("span", { slot: "select-icon" }, s("translate-icon", { width: "20", height: "20" })))), this.showFeedbackModal && s("nylas-feedback-form", null));
962
- if (i && h)
963
- return s(R, null, s(z, { version: this.version, nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, s("div", { class: "cancelled-event-page", part: "confirmed-event-page" }, s("nylas-confirmed-event-card", { confirmedEventInfo: h, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), s("div", { class: "language-feedback-container" }, this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (u) => this.onFeedbackClick(u) }, s("feedback-icon", null)), s("select-dropdown", { name: "language", searchPlaceholder: d.t("search"), options: p, withChevron: !1, themeConfig: this.themeConfig, defaultSelectedOption: p.find((u) => u.value == I), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, s("span", { slot: "select-icon" }, s("translate-icon", { width: "20", height: "20" })))), this.showFeedbackModal && s("nylas-feedback-form", null));
964
- if (i && t && b) {
965
- const u = (w = this.bookingInfoConfirmed) == null ? void 0 : w.primaryParticipant, O = (L = this.bookingInfoConfirmed) == null ? void 0 : L.location, T = (C = this.bookingInfoConfirmed) == null ? void 0 : C.booking_ref, S = ((v = this.bookingInfoConfirmed) == null ? void 0 : v.additionalFields) || {};
966
- if (this.bookingInfo && typeof ((B = this.bookingInfo) == null ? void 0 : B.additionalFields) < "u") {
967
- const $ = this.bookingInfo.additionalFields;
968
- Object.keys($).forEach((W) => {
969
- !S[W] && ($ != null && $[W]) && (S[W] = $[W].value);
970
- });
971
- }
972
- const D = (F = this.stores) == null ? void 0 : F.scheduler.get("selectedTimeslot"), J = (U = this.stores) == null ? void 0 : U.scheduler.get("selectedTimezone"), Y = (q = this.stores) == null ? void 0 : q.scheduler.get("selectedLanguage"), G = (x = this.stores) == null ? void 0 : x.scheduler.get("configSettings"), X = this.configurationId ? this.configurationId : G == null ? void 0 : G.configuration_id, ee = window.location.search, E = new URLSearchParams(ee);
973
- E.set("booking_id", t.booking_id), u != null && u.name && E.set("name", u.name), u != null && u.email && E.set("email", u.email), D != null && D.start_time && E.set("start_time", (new Date(D.start_time).getTime() / 1e3).toString()), D != null && D.end_time && E.set("end_time", (new Date(D.end_time).getTime() / 1e3).toString()), J && E.set("tz", J), Y && E.set("language", Y), S && E.set("additional_values", JSON.stringify(S)), this.slug && E.set("page_slug", this.slug), X && E.set("config_id", X), O && E.set("location", O), T && E.set("booking_ref", T), this.redirectToCustomUrl(`${b}?${E.toString()}`);
974
- return;
975
- }
976
- if (i && t)
977
- return s(R, null, s(z, { version: this.version, nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, s("div", { class: "booked-event-page", part: "booked-event-page ns_booked-event-page" }, s("nylas-booked-event-card", { selectedTimeslot: r, eventInfo: t, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))), s("div", { class: "language-feedback-container" }, this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (u) => this.onFeedbackClick(u) }, s("feedback-icon", null)), s("select-dropdown", { name: "language", searchPlaceholder: d.t("search"), options: p, withChevron: !1, themeConfig: this.themeConfig, defaultSelectedOption: p.find((u) => u.value == I), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, s("span", { slot: "select-icon" }, s("translate-icon", { width: "20", height: "20" })))), this.showFeedbackModal && s("nylas-feedback-form", null));
978
- if (i && (!t || l) && !o) {
979
- const u = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
980
- return s(R, null, s(z, { version: this.version, nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, l && s(K, null, `${d.t("rescheduleTitle")}`), s("div", { class: "select-date-page", part: "select-date-page ns_select-date-page" }, s("div", { class: "left-panel", part: "ns_left-panel" }, s("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" }), s("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" })), s("div", { class: `right-panel ${l ? "reschedule" : ""}`, part: `ns_right-panel ${l ? "ns_reschedule" : ""}` }, s("h2", { part: "ns_right-panel__title" }, s("calendar-icon", { part: "ns_right-panel__calendar-icon" }), s("span", { id: "selectedDate", part: "ns_right-panel__selected-date" }, this.selectedDateLabel)), s("nylas-timeslot-picker", { exportparts: "ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, u && s("span", { slot: "timeslot-picker-cta-label" }, s("slot", { name: "timeslot-picker-cta-label" })))))), this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (O) => this.onFeedbackClick(O) }, s("feedback-icon", null)), this.showFeedbackModal && s("nylas-feedback-form", null));
981
- }
982
- return i && !t && o ? s(R, null, s(z, { version: this.version, nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, l && s(K, null, `${d.t("rescheduleTitle")}`), s("div", { class: "additional-data-page", part: "additional-data-page ns_additional-data-page" }, s("div", { class: "left-panel ns_left-panel", part: "ns_left-panel" }, s("div", { class: "wrapper", part: "ns_left-panel__wrapper" }, s("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone" }))), s("div", { class: `right-panel ${l ? "reschedule" : ""}`, part: `ns_right-panel ${l ? "ns_reschedule" : ""}` }, s("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" })))), s("div", { class: "language-feedback-container" }, this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (u) => this.onFeedbackClick(u) }, s("feedback-icon", null)), s("select-dropdown", { name: "language", searchPlaceholder: d.t("search"), options: p, withChevron: !1, themeConfig: this.themeConfig, defaultSelectedOption: p.find((u) => u.value == I), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, s("span", { slot: "select-icon" }, s("translate-icon", { width: "20", height: "20" })))), this.showFeedbackModal && s("nylas-feedback-form", null)) : s(R, null, s("slot", null));
983
- }
984
- get host() {
985
- return ne(this);
986
- }
987
- static get watchers() {
988
- return {
989
- bookingInfo: ["bookingInfoChanged"],
990
- rescheduleBookingRef: ["rescheduleBookingRefChanged"],
991
- cancelBookingRef: ["cancelBookingRefChanged"],
992
- organizerConfirmationBookingRef: ["organizerConfirmationBookingRefChanged"],
993
- localization: ["localizationChanged"],
994
- defaultLanguage: ["defaultLanguageChanged"],
995
- themeConfig: ["themeConfigChanged"]
996
- };
997
- }
998
- };
999
- _e.style = be;
1000
- export {
1001
- _e as nylas_scheduling
1002
- };