@nylas/react 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/{abstract-provider-efe136bd-b4663c02.cjs → abstract-provider-bdb7d9b4-12a95387.cjs} +1 -1
  2. package/dist/{abstract-provider-efe136bd-2041bdce.js → abstract-provider-bdb7d9b4-22cf4a74.js} +1 -1
  3. package/dist/{add-circle-icon_2.entry-ea1692a4.js → add-circle-icon_2.entry-0ff79148.js} +1 -1
  4. package/dist/{add-circle-icon_2.entry-5204c48a.cjs → add-circle-icon_2.entry-d56f519c.cjs} +1 -1
  5. package/dist/{archive-icon.entry-c2c66bca.cjs → archive-icon.entry-6ab120ff.cjs} +1 -1
  6. package/dist/{archive-icon.entry-0b585dff.js → archive-icon.entry-aaff46ec.js} +1 -1
  7. package/dist/{arrow-icon.entry-9d471162.cjs → arrow-icon.entry-d57cf44f.cjs} +1 -1
  8. package/dist/{arrow-icon.entry-2e61394e.js → arrow-icon.entry-d8fcbc1f.js} +1 -1
  9. package/dist/{bold-icon.entry-5c37622f.cjs → bold-icon.entry-0f23543d.cjs} +1 -1
  10. package/dist/{bold-icon.entry-8ef1b653.js → bold-icon.entry-e48075a4.js} +1 -1
  11. package/dist/{button-component_2.entry-8335ee1e.cjs → button-component_2.entry-3d622397.cjs} +1 -1
  12. package/dist/{button-component_2.entry-c906230f.js → button-component_2.entry-5db80bec.js} +1 -1
  13. package/dist/calendar-agenda-fill-icon_36.entry-75d7cd5b.cjs +6 -0
  14. package/dist/{calendar-agenda-fill-icon_36.entry-5f184433.js → calendar-agenda-fill-icon_36.entry-78fc2e0d.js} +835 -835
  15. package/dist/{calendar-cancel-icon.entry-dd6ac4db.js → calendar-cancel-icon.entry-8b43441c.js} +1 -1
  16. package/dist/{calendar-cancel-icon.entry-65a4a34e.cjs → calendar-cancel-icon.entry-9546c7c3.cjs} +1 -1
  17. package/dist/calendar-check-icon.entry-4e6abda7.js +16 -0
  18. package/dist/{calendar-check-icon_2.entry-ded15038.cjs → calendar-check-icon.entry-a03b249a.cjs} +1 -1
  19. package/dist/{calendar-icon.entry-a2a1ddbc.js → calendar-icon.entry-5b622c12.js} +1 -1
  20. package/dist/{calendar-icon.entry-ca512dd6.cjs → calendar-icon.entry-cd4b0ec4.cjs} +1 -1
  21. package/dist/{checkbox-component_2.entry-d6128246.js → checkbox-component_2.entry-82f4b1f2.js} +1 -1
  22. package/dist/{checkbox-component_2.entry-d79b5d1d.cjs → checkbox-component_2.entry-c9c8a87d.cjs} +1 -1
  23. package/dist/{checkbox-group_4.entry-2946c7ef.cjs → checkbox-group_4.entry-5a4f0ed2.cjs} +1 -1
  24. package/dist/{checkbox-group_4.entry-e5145451.js → checkbox-group_4.entry-b2a5b2b2.js} +3 -3
  25. package/dist/checkmark-circle-icon.entry-30582af4.js +16 -0
  26. package/dist/checkmark-circle-icon.entry-9617301c.cjs +1 -0
  27. package/dist/{checkmark-icon_15.entry-6e92e93e.js → checkmark-icon_15.entry-01536ed2.js} +33 -33
  28. package/dist/{checkmark-icon_15.entry-a75a1825.cjs → checkmark-icon_15.entry-c5eaad9b.cjs} +2 -2
  29. package/dist/{chevron-icon_3.entry-9193a885.cjs → chevron-icon_3.entry-26f14744.cjs} +1 -1
  30. package/dist/{chevron-icon_3.entry-6eaa3513.js → chevron-icon_3.entry-517447a6.js} +1 -1
  31. package/dist/{clock-icon_4.entry-ae2272f4.cjs → clock-icon_4.entry-5351318c.cjs} +1 -1
  32. package/dist/{clock-icon_4.entry-2c93270e.js → clock-icon_4.entry-7ea1274d.js} +1 -1
  33. package/dist/{customParseFormat-edc38d83-fa9c77d9.cjs → customParseFormat-f0d21eb3-769d6bf2.cjs} +1 -1
  34. package/dist/{customParseFormat-edc38d83-b3722499.js → customParseFormat-f0d21eb3-904f1e57.js} +1 -1
  35. package/dist/{delete-icon.entry-6684eba6.js → delete-icon.entry-02e44ba1.js} +1 -1
  36. package/dist/{delete-icon.entry-b9e4f2c7.cjs → delete-icon.entry-64b61f5c.cjs} +1 -1
  37. package/dist/{document-refresh-icon.entry-7afe6163.cjs → document-refresh-icon.entry-2f599a22.cjs} +1 -1
  38. package/dist/{document-refresh-icon.entry-fba9f60b.js → document-refresh-icon.entry-fcaa84ad.js} +1 -1
  39. package/dist/{feedbackSync-e4378c0b-23289195.js → feedbackSync-b9c9e719-b54b3268.js} +1 -1
  40. package/dist/{feedbackSync-e4378c0b-7876d067.cjs → feedbackSync-b9c9e719-bee3fea1.cjs} +1 -1
  41. package/dist/{folder-icon.entry-b1632bf3.cjs → folder-icon.entry-55c123dc.cjs} +1 -1
  42. package/dist/{folder-icon.entry-430c6b47.js → folder-icon.entry-f4862c1b.js} +1 -1
  43. package/dist/{forward-icon.entry-5e53da76.js → forward-icon.entry-4a41e94f.js} +1 -1
  44. package/dist/{forward-icon.entry-7626dcca.cjs → forward-icon.entry-82719382.cjs} +1 -1
  45. package/dist/{globe-icon_2.entry-bbb0a6ce.cjs → globe-icon_2.entry-3f0e408e.cjs} +1 -1
  46. package/dist/{globe-icon_2.entry-646eae41.js → globe-icon_2.entry-8f5c79b2.js} +2 -2
  47. package/dist/{google-logo-icon_6.entry-e39dd9cb.cjs → google-logo-icon_6.entry-9c91c3d4.cjs} +1 -1
  48. package/dist/{google-logo-icon_6.entry-5951a546.js → google-logo-icon_6.entry-b331ab60.js} +8 -8
  49. package/dist/{google-meet-icon_5.entry-c13e0738.cjs → google-meet-icon_5.entry-e3d44d56.cjs} +1 -1
  50. package/dist/{google-meet-icon_5.entry-a54c83da.js → google-meet-icon_5.entry-eb9f7d93.js} +1 -1
  51. package/dist/{inbox-icon.entry-7bee82b3.js → inbox-icon.entry-a385095d.js} +1 -1
  52. package/dist/{inbox-icon.entry-911b047a.cjs → inbox-icon.entry-fa9085cd.cjs} +1 -1
  53. package/dist/{index-71f61ea9.js → index-ad781fbc.js} +5585 -5490
  54. package/dist/index-dc6efb5e.cjs +118 -0
  55. package/dist/{index.es-6a9d55cf-458ba0e0.cjs → index.es-ccb2a286-9a2c0934.cjs} +1 -1
  56. package/dist/{index.es-6a9d55cf-122c27e0.js → index.es-ccb2a286-dfa2bfbe.js} +1 -1
  57. package/dist/{info-icon_2.entry-471b836b.cjs → info-icon_2.entry-9f32753b.cjs} +1 -1
  58. package/dist/{info-icon_2.entry-6ff2f004.js → info-icon_2.entry-c18a111e.js} +1 -1
  59. package/dist/{input-component.entry-781b584c.js → input-component.entry-eae64f46.js} +1 -1
  60. package/dist/{input-component.entry-b6a9b4cb.cjs → input-component.entry-ff9e04c9.cjs} +1 -1
  61. package/dist/{input-dropdown_2.entry-1feebcba.js → input-dropdown_2.entry-1b55ef0c.js} +1 -1
  62. package/dist/{input-dropdown_2.entry-c71d14ff.cjs → input-dropdown_2.entry-67d6d292.cjs} +1 -1
  63. package/dist/{italic-icon.entry-9ef7f4a2.js → italic-icon.entry-4266a817.js} +1 -1
  64. package/dist/{italic-icon.entry-16debde5.cjs → italic-icon.entry-843feb2b.cjs} +1 -1
  65. package/dist/{multi-select-dropdown.entry-1b27c746.js → multi-select-dropdown.entry-854265ef.js} +1 -1
  66. package/dist/{multi-select-dropdown.entry-0a6f9417.cjs → multi-select-dropdown.entry-ca9acf75.cjs} +1 -1
  67. package/dist/nylas-booked-event-card_11.entry-8d3e2019.cjs +1 -0
  68. package/dist/{nylas-booked-event-card_11.entry-802671ee.js → nylas-booked-event-card_11.entry-ccf30d91.js} +138 -107
  69. package/dist/{nylas-form-card.entry-7da9a312.js → nylas-form-card.entry-481ede48.js} +2 -2
  70. package/dist/{nylas-form-card.entry-59a837c9.cjs → nylas-form-card.entry-58162c72.cjs} +1 -1
  71. package/dist/{nylas-notification_2.entry-b16bb805.js → nylas-notification_2.entry-7d3ed3b0.js} +1 -1
  72. package/dist/{nylas-notification_2.entry-8f8bad34.cjs → nylas-notification_2.entry-dffa3ff6.cjs} +1 -1
  73. package/dist/{nylas-scheduler-editor.entry-e33e11fb.cjs → nylas-scheduler-editor.entry-9744694a.cjs} +2 -2
  74. package/dist/{nylas-scheduler-editor.entry-cbe3e1e3.js → nylas-scheduler-editor.entry-aa079dff.js} +5 -5
  75. package/dist/nylas-scheduling.entry-7441979c.js +988 -0
  76. package/dist/nylas-scheduling.entry-b1fcb48f.cjs +1 -0
  77. package/dist/{person-icon.entry-6232e6fd.js → person-icon.entry-23a69633.js} +1 -1
  78. package/dist/{person-icon.entry-beb26b48.cjs → person-icon.entry-acf4d22b.cjs} +1 -1
  79. package/dist/{play-icon.entry-16a1c1ac.js → play-icon.entry-4e7884d4.js} +1 -1
  80. package/dist/{play-icon.entry-9060d0d8.cjs → play-icon.entry-aa088180.cjs} +1 -1
  81. package/dist/{radio-button-group.entry-5a3728cd.js → radio-button-group.entry-243d7988.js} +1 -1
  82. package/dist/{radio-button-group.entry-6935c39d.cjs → radio-button-group.entry-cea225c8.cjs} +1 -1
  83. package/dist/react.cjs +1 -1
  84. package/dist/react.js +1 -1
  85. package/dist/{refresh-icon.entry-2411b2e1.cjs → refresh-icon.entry-96cb008f.cjs} +1 -1
  86. package/dist/{refresh-icon.entry-4f56e72b.js → refresh-icon.entry-d1603555.js} +1 -1
  87. package/dist/{register-component-a1c3d7b4-774feacc.js → register-component-9d4ceee5-46f58baf.js} +1 -1
  88. package/dist/{register-component-a1c3d7b4-97d7a6f5.cjs → register-component-9d4ceee5-6fabc42c.cjs} +1 -1
  89. package/dist/{reply-all-icon.entry-b4b6926b.cjs → reply-all-icon.entry-537f7718.cjs} +1 -1
  90. package/dist/{reply-all-icon.entry-b4b917ec.js → reply-all-icon.entry-6fae7288.js} +1 -1
  91. package/dist/{reply-icon.entry-454545ed.cjs → reply-icon.entry-72fa6e4c.cjs} +1 -1
  92. package/dist/{reply-icon.entry-24f6f4c6.js → reply-icon.entry-ae114e35.js} +1 -1
  93. package/dist/{sent-icon.entry-d9a79336.cjs → sent-icon.entry-30a6ac17.cjs} +1 -1
  94. package/dist/{sent-icon.entry-fa59ce85.js → sent-icon.entry-b10d5e26.js} +1 -1
  95. package/dist/{spam-icon.entry-da39987e.cjs → spam-icon.entry-357aa525.cjs} +1 -1
  96. package/dist/{spam-icon.entry-fb18a08b.js → spam-icon.entry-bed45849.js} +1 -1
  97. package/dist/{star-icon.entry-406472c1.js → star-icon.entry-010349a5.js} +1 -1
  98. package/dist/{star-icon.entry-833f35a7.cjs → star-icon.entry-53c85ebb.cjs} +1 -1
  99. package/dist/{stop-icon.entry-1b6ae838.js → stop-icon.entry-18f650bf.js} +1 -1
  100. package/dist/{stop-icon.entry-3258db59.cjs → stop-icon.entry-20af3bf5.cjs} +1 -1
  101. package/dist/style.css +1 -1
  102. package/dist/{textarea-component.entry-0ae18897.cjs → textarea-component.entry-b19642f1.cjs} +1 -1
  103. package/dist/{textarea-component.entry-569a281e.js → textarea-component.entry-e6120440.js} +1 -1
  104. package/dist/{toggle-switch.entry-dc3f796b.js → toggle-switch.entry-32b0e964.js} +1 -1
  105. package/dist/{toggle-switch.entry-60d75f16.cjs → toggle-switch.entry-becdda2c.cjs} +1 -1
  106. package/dist/{translate-icon.entry-297cf20f.js → translate-icon.entry-2308a8e4.js} +1 -1
  107. package/dist/{translate-icon.entry-c183ecb5.cjs → translate-icon.entry-7cb7a479.cjs} +1 -1
  108. package/dist/{trash-fill-icon.entry-3d8a2e5e.js → trash-fill-icon.entry-7f410c82.js} +1 -1
  109. package/dist/{trash-fill-icon.entry-94d4f66c.cjs → trash-fill-icon.entry-c70b9326.cjs} +1 -1
  110. package/dist/{underline-icon.entry-50d1e766.cjs → underline-icon.entry-23f478f3.cjs} +1 -1
  111. package/dist/{underline-icon.entry-4a9105c7.js → underline-icon.entry-58ef1a9f.js} +1 -1
  112. package/package.json +2 -2
  113. package/dist/calendar-agenda-fill-icon_36.entry-59c0a997.cjs +0 -6
  114. package/dist/calendar-check-icon_2.entry-f9b50bb8.js +0 -26
  115. package/dist/index-f769bc2a.cjs +0 -118
  116. package/dist/nylas-booked-event-card_11.entry-74fba802.cjs +0 -1
  117. package/dist/nylas-scheduling.entry-4223e50b.cjs +0 -1
  118. package/dist/nylas-scheduling.entry-6fb094a8.js +0 -968
@@ -1,968 +0,0 @@
1
- import { i as d, r as K, a as F, b as A, k as M, l as X, m as Q, h as a, H as P, g as V, e as ee, F as te } from "./index-71f61ea9.js";
2
- import { N as ie } from "./abstract-provider-efe136bd-2041bdce.js";
3
- import { E as U, i as ne, a as se, f as oe, c as re, b as ae } from "./feedbackSync-e4378c0b-23289195.js";
4
- import { n as j } from "./index.es-6a9d55cf-122c27e0.js";
5
- import { L as le } from "./constants-f51538ef-e0a5f026.js";
6
- import "react";
7
- import "react/jsx-runtime";
8
- import "react-dom";
9
- class ce {
10
- constructor() {
11
- this.component = (e) => {
12
- const t = U.Component, s = `${e} Error`;
13
- return {
14
- endtime_not_in_future: (i = '"endtime" can not be in the future') => ({
15
- title: s,
16
- message: i,
17
- category: t
18
- }),
19
- no_booking_info: (i = "No booking info provided") => ({
20
- title: s,
21
- message: i,
22
- category: t
23
- }),
24
- no_timeslot_selected: (i = "No timeslot selected") => ({
25
- title: s,
26
- message: i,
27
- category: t
28
- }),
29
- no_timezone_selected: (i = "No timezone selected") => ({
30
- title: s,
31
- message: i,
32
- category: t
33
- }),
34
- no_booking_id: (i = "No booking id provided") => ({
35
- title: s,
36
- message: i,
37
- category: t
38
- }),
39
- no_salt: (i = "No salt provided") => ({
40
- title: s,
41
- message: i,
42
- category: t
43
- }),
44
- invalid_start_time: (i = "Invalid start time") => ({
45
- title: s,
46
- message: i,
47
- category: t
48
- }),
49
- invalid_end_time: (i = "Invalid end time") => ({
50
- title: s,
51
- message: i,
52
- category: t
53
- }),
54
- invalid_timezone: (i = "Invalid timezone") => ({
55
- title: s,
56
- message: i,
57
- category: t
58
- }),
59
- no_config_id: (i = "No configuration id provided") => ({
60
- title: s,
61
- message: i,
62
- category: t
63
- })
64
- };
65
- }, this.api = (e) => {
66
- const t = U.Api, s = `${e} Error`;
67
- return {
68
- invalid_session: (i) => ({
69
- title: s,
70
- message: i,
71
- category: t
72
- }),
73
- general_error: (i) => ({
74
- title: s,
75
- message: i,
76
- category: t
77
- }),
78
- internal_error: (i) => ({
79
- title: s,
80
- message: i,
81
- category: t
82
- }),
83
- invalid_request_error: (i) => ({
84
- title: s,
85
- message: i,
86
- category: t
87
- }),
88
- timeslot_not_available: (i) => ({
89
- title: s,
90
- message: i,
91
- category: t
92
- }),
93
- provider_error: (i) => ({
94
- title: s,
95
- message: i,
96
- category: t
97
- }),
98
- not_found_error: (i) => ({
99
- title: s,
100
- message: i,
101
- category: t
102
- })
103
- };
104
- };
105
- }
106
- }
107
- class de {
108
- constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i, slug: r, clientId: o }) {
109
- this.errors = new ce(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = i, this.slug = r, this.clientId = o;
110
- }
111
- getHeaders() {
112
- return this.sessionId ? {
113
- Authorization: `Bearer ${this.sessionId}`
114
- } : {};
115
- }
116
- async makeAPIRequest(e, t, s, i = {}) {
117
- try {
118
- const r = new URL(this.schedulerAPIURL), o = "2.0.1";
119
- return r.pathname = e, await (await fetch(decodeURIComponent(r.toString()), {
120
- method: t,
121
- headers: {
122
- "Content-Type": "application/json",
123
- Origin: window.location.origin,
124
- "X-Source": "nylas-scheduling",
125
- "X-Nylas-Web-Elements-Version": o,
126
- ...i
127
- },
128
- body: s
129
- })).json();
130
- } catch (r) {
131
- return {
132
- error: {
133
- message: r.message,
134
- title: "API request failed",
135
- type: "api"
136
- }
137
- };
138
- }
139
- }
140
- getErrorMessage(e) {
141
- var s, i, r, o;
142
- let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
143
- return (e == null ? void 0 : e.type) === "provider_error" && (t = ((i = (s = e == null ? void 0 : e.provider_error) == null ? void 0 : s.error) == null ? void 0 : i.message) || ((o = (r = e == null ? void 0 : e.provider_error) == null ? void 0 : r.error) == null ? void 0 : o.title) || "Something went wrong"), t;
144
- }
145
- setConfigId(e) {
146
- this.configId = e;
147
- }
148
- selectDate(e) {
149
- this.schedulerStore.set("selectedDate", e), this.schedulerStore.set("selectedTimeslot", null);
150
- }
151
- selectTime(e) {
152
- this.schedulerStore.set("selectedTimeslot", e);
153
- }
154
- selectTimezone(e) {
155
- this.schedulerStore.set("selectedTimezone", e);
156
- }
157
- selectLanguage(e) {
158
- this.schedulerStore.set("selectedLanguage", e), d.changeLanguage(e);
159
- }
160
- async toggleAdditionalData(e) {
161
- e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
162
- }
163
- setParticipantName(e) {
164
- const { bookingInfo: t } = this.schedulerStore.state;
165
- this.schedulerStore.set("bookingInfo", {
166
- ...t,
167
- primaryParticipant: {
168
- ...t == null ? void 0 : t.primaryParticipant,
169
- name: e
170
- }
171
- });
172
- }
173
- setParticipantEmail(e) {
174
- const { bookingInfo: t } = this.schedulerStore.state;
175
- this.schedulerStore.set("bookingInfo", {
176
- ...t,
177
- primaryParticipant: {
178
- ...t == null ? void 0 : t.primaryParticipant,
179
- email: e
180
- }
181
- });
182
- }
183
- async refetchAvailability() {
184
- const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1).getTime() / 1e3, s = t < e.getTime() / 1e3 ? Math.floor(e.getTime() / 1e3) : t, i = new Date(e.getFullYear(), e.getMonth() + 1, 1).getTime() / 1e3;
185
- return await this.getAvailability(s, i);
186
- }
187
- async resetStoreStateAndFetchAvailability() {
188
- const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((r) => new Date(r.start_time) > /* @__PURE__ */ new Date());
189
- let i = e;
190
- return s && (i = s.start_time), this.schedulerStore.set("selectedDate", i), this.schedulerStore.set("eventInfo", null), this.schedulerStore.set("showBookingForm", !1), this.schedulerStore.set("selectedTimeslot", null), t;
191
- }
192
- async setReschedule(e) {
193
- this.schedulerStore.set("isLoading", !0);
194
- const t = this.schedulerStore.state.eventInfo;
195
- return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.getUISettings(), await this.resetStoreStateAndFetchAvailability().finally(() => {
196
- this.schedulerStore.set("isLoading", !1);
197
- });
198
- }
199
- async setCancel(e) {
200
- this.schedulerStore.set("cancelBookingId", e);
201
- }
202
- async setReject(e) {
203
- this.schedulerStore.set("rejectBookingId", e);
204
- }
205
- async resetCancel() {
206
- const e = await this.resetStoreStateAndFetchAvailability();
207
- return this.schedulerStore.set("cancelBookingId", ""), this.schedulerStore.set("rejectBookingId", ""), this.schedulerStore.set("cancelledEventInfo", null), e;
208
- }
209
- async goBack() {
210
- this.schedulerStore.set("cancelBookingId", "");
211
- }
212
- async resetConfirm() {
213
- const e = await this.resetStoreStateAndFetchAvailability();
214
- return this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("confirmedEventInfo", void 0), e;
215
- }
216
- async bookTimeslot(e) {
217
- var x, w, L;
218
- this.schedulerStore.set("isLoading", !0);
219
- const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage: r } = this.schedulerStore.state;
220
- if (!e && !i)
221
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_booking_info() };
222
- const o = (e == null ? void 0 : e.timeslot) || t;
223
- if (!o)
224
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timeslot_selected() };
225
- const l = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s, c = r || "en-US";
226
- if (!l)
227
- return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timezone_selected() };
228
- const f = [...this.schedulerStore.get("availabilityOrderEmails")];
229
- let h = "";
230
- const u = (o == null ? void 0 : o.emails) || [], g = {};
231
- Object.entries((i == null ? void 0 : i.additionalFields) || {}).forEach(([_, B]) => {
232
- g[_] = B.value;
233
- });
234
- const p = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, b = e ? (e == null ? void 0 : e.guests) || [] : (i == null ? void 0 : i.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}` : ""}`;
235
- if (f.length === 0) {
236
- const _ = await this.makeAPIRequest(decodeURIComponent(I), "POST", JSON.stringify({
237
- additional_fields: S,
238
- additional_guests: b,
239
- guest: { ...p },
240
- start_time: o.start_time.getTime() / 1e3,
241
- end_time: o.end_time.getTime() / 1e3,
242
- timezone: l,
243
- event_id: (o == null ? void 0 : o.event_id) || void 0,
244
- master_id: (o == null ? void 0 : o.master_id) || void 0,
245
- calendar_id: (o == null ? void 0 : o.calendar_id) || void 0,
246
- email_language: this.getTwoLetterLanguageCode(c)
247
- }), m);
248
- return this.schedulerStore.set("isLoading", !1), "data" in _ ? (this.schedulerStore.set("eventInfo", _.data), _) : { error: _.error };
249
- }
250
- for (; f.length > 0; ) {
251
- if (h = f.shift(), !u.includes(h))
252
- continue;
253
- const _ = await this.makeAPIRequest(decodeURIComponent(I), "POST", JSON.stringify({
254
- participants: h ? [{ email: h }] : void 0,
255
- additional_fields: S,
256
- additional_guests: b,
257
- guest: { ...p },
258
- start_time: o.start_time.getTime() / 1e3,
259
- end_time: o.end_time.getTime() / 1e3,
260
- timezone: l,
261
- email_language: this.getTwoLetterLanguageCode(c)
262
- }), m);
263
- if ("data" in _)
264
- return this.schedulerStore.set("isLoading", !1), this.schedulerStore.set("eventInfo", _ == null ? void 0 : _.data), _;
265
- if ((w = (x = _.error) == null ? void 0 : x.message) != null && w.startsWith("The selected timeslot is unavailable"))
266
- continue;
267
- {
268
- this.schedulerStore.set("isLoading", !1);
269
- const B = (L = _.error) == null ? void 0 : L.type;
270
- let D = _.error;
271
- if (B && B in this.errors.api(d.t("createBookingErrorTitle"))) {
272
- const O = this.getErrorMessage(D);
273
- D = this.errors.api(d.t("createBookingErrorTitle"))[B](O);
274
- }
275
- return { error: D };
276
- }
277
- }
278
- return this.schedulerStore.set("isLoading", !1), {
279
- error: this.errors.api(d.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")
280
- };
281
- }
282
- async getUISettings() {
283
- var o;
284
- this.schedulerStore.set("isLoading", !0);
285
- const e = this.schedulerStore.get("rescheduleBookingId"), t = this.getHeaders();
286
- let s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "";
287
- e && s ? s += `&booking_id=${e}` : e && (s += `?booking_id=${e}`);
288
- const i = `/v3/scheduling/ui-settings${s}`, r = await this.makeAPIRequest(i, "GET", void 0, t);
289
- if ("error" in r) {
290
- this.schedulerStore.set("isLoading", !1);
291
- const l = (o = r.error) == null ? void 0 : o.type;
292
- let c = r.error;
293
- 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 };
294
- }
295
- return "data" in r && this.schedulerStore.set("configSettings", r.data), this.schedulerStore.set("isLoading", !1), r;
296
- }
297
- getTwoLetterLanguageCode(e) {
298
- return e.split("-")[0];
299
- }
300
- getStartTimeWithMinBookingNotice(e) {
301
- var r;
302
- const t = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.scheduler, s = t == null ? void 0 : t.min_booking_notice;
303
- if (!s)
304
- return e;
305
- const i = (/* @__PURE__ */ new Date()).getTime();
306
- return e < (i + s * 60 * 1e3) / 1e3 ? Math.floor((i + s * 60 * 1e3) / 1e3) : e;
307
- }
308
- getEndTimeForAvailableDaysInFuture(e) {
309
- var o, l;
310
- 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, i = Math.floor(X(t, s).getTime() / 1e3);
311
- return Math.min(i, e);
312
- }
313
- async getAvailability(e = 0, t = 0) {
314
- var g, p, b, S;
315
- this.schedulerStore.set("isLoading", !0);
316
- const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), r = i.getTime();
317
- if (t && t < r / 1e3)
318
- return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(d.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
319
- if (!e) {
320
- const m = new Date(i.getFullYear(), i.getMonth(), 1);
321
- e = Math.floor(m.getTime() / 1e3);
322
- }
323
- if (!t) {
324
- const m = new Date(i.getFullYear(), i.getMonth() + 1, 0);
325
- t = Math.floor(m.getTime() / 1e3);
326
- }
327
- t = this.getEndTimeForAvailableDaysInFuture(t);
328
- const o = this.getStartTimeWithMinBookingNotice(e);
329
- 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)));
330
- const l = this.schedulerStore.get("rescheduleBookingId");
331
- l && s.append("booking_id", encodeURIComponent(l));
332
- const c = s.toString(), f = `/v3/scheduling/availability${c ? `?${c}` : ""}`, h = this.getHeaders(), u = await this.makeAPIRequest(decodeURIComponent(f), "GET", void 0, h);
333
- if ("error" in u) {
334
- this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
335
- const m = (g = u.error) == null ? void 0 : g.type;
336
- let k = u.error;
337
- if (m && m in this.errors.api(d.t("getAvailabilityErrorTitle"))) {
338
- const I = this.getErrorMessage(k);
339
- k = this.errors.api(d.t("getAvailabilityErrorTitle"))[m](I);
340
- }
341
- return { error: k };
342
- }
343
- if ("data" in u) {
344
- const I = (((b = (p = u.data) == null ? void 0 : p.time_slots) == null ? void 0 : b.map((w) => ({
345
- ...w,
346
- start_time: new Date(w.start_time * 1e3),
347
- end_time: new Date(w.end_time * 1e3)
348
- }))) || []).filter((w) => w.start_time.getTime() > r).sort((w, L) => w.start_time.getTime() - L.start_time.getTime());
349
- this.schedulerStore.set("availability", I);
350
- const x = ((S = u.data) == null ? void 0 : S.order) || [];
351
- this.schedulerStore.set("availabilityOrderEmails", x);
352
- }
353
- return this.schedulerStore.set("isLoading", !1), u;
354
- }
355
- async cancelBooking(e, t) {
356
- var l;
357
- if (this.schedulerStore.set("isLoading", !0), !e)
358
- return { error: this.errors.component(d.t("cancelBookingErrorTitle")).no_booking_id() };
359
- const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", i = `/v3/scheduling/bookings/${e}${s}`, r = this.getHeaders(), o = await this.makeAPIRequest(decodeURIComponent(i), "DELETE", JSON.stringify({
360
- action: "cancel",
361
- cancellation_reason: t
362
- }), r);
363
- if ("error" in o) {
364
- this.schedulerStore.set("isLoading", !1);
365
- const c = (l = o.error) == null ? void 0 : l.type;
366
- let f = o.error;
367
- if (c && c in this.errors.api(d.t("cancelBookingErrorTitle"))) {
368
- const h = this.getErrorMessage(f);
369
- f = this.errors.api(d.t("cancelBookingErrorTitle"))[c](h);
370
- }
371
- return { error: f };
372
- }
373
- return this.schedulerStore.set("cancelledEventInfo", {
374
- booking_id: e
375
- }), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), o;
376
- }
377
- async rescheduleBooking(e, t) {
378
- var R;
379
- if (this.schedulerStore.set("isLoading", !0), !e)
380
- return { error: this.errors.component(d.t("rescheduleBookingErrorTitle")).no_booking_id() };
381
- const s = this.errors.api(d.t("rescheduleBookingErrorTitle")), i = this.errors.component(d.t("rescheduleBookingErrorTitle")), { bookingInfo: r, selectedTimeslot: o, selectedTimezone: l, selectedLanguage: c } = this.schedulerStore.state, { startTime: f, endTime: h, timezone: u } = t, g = f || (o == null ? void 0 : o.start_time);
382
- if (!g)
383
- return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
384
- const p = h || (o == null ? void 0 : o.end_time);
385
- if (!p)
386
- return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
387
- const b = this.schedulerStore.get("availabilityOrderEmails");
388
- let S = "";
389
- if (b.length > 0) {
390
- const v = (o == null ? void 0 : o.emails) || [];
391
- for (let E = 0; E < b.length; E++)
392
- if (v.includes(b[E])) {
393
- S = b[E];
394
- break;
395
- }
396
- }
397
- const m = u || l;
398
- if (!m)
399
- return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
400
- 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 = {};
401
- Object.entries((r == null ? void 0 : r.additionalFields) || {}).forEach(([v, E]) => {
402
- w[v] = E.value;
403
- });
404
- const L = t ? t == null ? void 0 : t.primaryParticipant : r == null ? void 0 : r.primaryParticipant, _ = 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}` : "", O = `/v3/scheduling/bookings/${e}${D}`, y = this.getHeaders(), C = await this.makeAPIRequest(decodeURIComponent(O), "PATCH", JSON.stringify({
405
- start_time: g.getTime() / 1e3,
406
- end_time: p.getTime() / 1e3,
407
- timezone: m,
408
- additional_fields: B,
409
- guest: { ...L },
410
- additional_guests: _,
411
- participants: S ? [{ email: S }] : void 0,
412
- email_language: this.getTwoLetterLanguageCode(c),
413
- event_id: k,
414
- master_id: I,
415
- calendar_id: x
416
- }), y);
417
- if ("error" in C) {
418
- this.schedulerStore.set("isLoading", !1);
419
- const v = (R = C.error) == null ? void 0 : R.type;
420
- let E = C.error;
421
- if (v && v in s) {
422
- const H = this.getErrorMessage(E);
423
- E = s[v](H);
424
- }
425
- return { error: E };
426
- }
427
- const N = this.schedulerStore.get("reschedulingEventInfo");
428
- if ("data" in C)
429
- this.schedulerStore.set("eventInfo", C == null ? void 0 : C.data);
430
- else if (N)
431
- this.schedulerStore.set("eventInfo", N);
432
- else {
433
- const v = {
434
- booking_id: e
435
- };
436
- this.schedulerStore.set("eventInfo", v);
437
- }
438
- return this.schedulerStore.set("isLoading", !1), C;
439
- }
440
- async updateBooking(e) {
441
- var u;
442
- this.schedulerStore.set("isLoading", !0);
443
- const { bookingId: t, status: s, reason: i } = e, r = this.schedulerStore.get("organizerConfirmationSalt"), o = s === "confirmed" ? d.t("confirmBookingErrorTitle") : d.t("rejectBookingErrorTitle");
444
- if (!t)
445
- return { error: this.errors.component(o).no_booking_id() };
446
- if (!r)
447
- return { error: this.errors.component(o).no_salt() };
448
- 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}`, f = this.getHeaders(), h = await this.makeAPIRequest(decodeURIComponent(c), "PUT", JSON.stringify({
449
- status: s,
450
- cancellation_reason: i,
451
- salt: r
452
- }), f);
453
- if ("error" in h) {
454
- this.schedulerStore.set("isLoading", !1);
455
- const g = (u = h.error) == null ? void 0 : u.type;
456
- let p = h.error;
457
- if (g && g in this.errors.api(o)) {
458
- const b = this.getErrorMessage(p);
459
- p = this.errors.api(o)[g](b);
460
- }
461
- return { error: p };
462
- }
463
- 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", {
464
- booking_id: t
465
- }), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), h;
466
- }
467
- async validateGroupEventTimeslot(e) {
468
- var o, l;
469
- this.schedulerStore.set("isLoading", !0);
470
- const t = (o = this.schedulerStore.get("configSettings")) == null ? void 0 : o.configuration_id;
471
- if (!t)
472
- return { error: this.errors.component(d.t("validateTimeslotErrorTitle")).no_config_id() };
473
- const s = this.getHeaders(), i = `/v3/scheduling/configurations/${t}/group-events/validate-timeslot`, r = await this.makeAPIRequest(decodeURIComponent(i), "POST", JSON.stringify({
474
- ...e,
475
- start_time: e.start_time.getTime() / 1e3,
476
- end_time: e.end_time.getTime() / 1e3
477
- }), s);
478
- if ("error" in r) {
479
- this.schedulerStore.set("isLoading", !1);
480
- const c = (l = r.error) == null ? void 0 : l.type;
481
- let f = r.error;
482
- if (c && c in this.errors.api(d.t("validateTimeslotErrorTitle"))) {
483
- const h = this.getErrorMessage(f);
484
- f = this.errors.api(d.t("validateTimeslotErrorTitle"))[c](h);
485
- }
486
- return this.refetchAvailability(), { error: f };
487
- }
488
- return this.schedulerStore.set("selectedTimeslot", e), this.schedulerStore.set("showBookingForm", !0), this.schedulerStore.set("isLoading", !1), r;
489
- }
490
- }
491
- class he {
492
- constructor({ schedulerAPIURL: e, nylasSchedulerStore: t, sessionId: s, configId: i, slug: r, clientId: o }) {
493
- if (!e)
494
- throw new Error("schedulerAPIURL is required");
495
- if (!t)
496
- throw new Error("nylasSchedulerStore is required");
497
- if (!s && !i && !(r || o))
498
- throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");
499
- e === "/" && (e = new URL(window.location.href).origin), this.configId = i, this.sessionId = s, this.schedulerAPIURL = e, this.nylasSchedulerStore = t, this.slug = r, this.clientId = o;
500
- }
501
- init() {
502
- A("NylasConnector init");
503
- }
504
- get schedulerStore() {
505
- return this.nylasSchedulerStore;
506
- }
507
- get scheduler() {
508
- return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new de({
509
- schedulerAPIURL: this.schedulerAPIURL,
510
- schedulerStore: this.schedulerStore,
511
- sessionId: this.sessionId,
512
- configId: this.configId,
513
- slug: this.slug,
514
- clientId: this.clientId
515
- }), this._schedulerAPIConnector);
516
- }
517
- resetStores() {
518
- this.nylasSchedulerStore.reset();
519
- }
520
- }
521
- function ge(n = {}) {
522
- const e = {
523
- selectedDate: null,
524
- selectedLanguage: navigator.language,
525
- selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
526
- selectedTimeslot: null,
527
- showBookingForm: !1,
528
- availabilityOrderEmails: [],
529
- selectableDates: null,
530
- availability: [],
531
- eventDuration: 0,
532
- state: "ready",
533
- eventInfo: null,
534
- cancelledEventInfo: null,
535
- isLoading: !1,
536
- nylasBranding: !0,
537
- ...n
538
- };
539
- A("[defaultNylasStoreState]: ", e);
540
- const t = ee(e);
541
- return t.onChange("availability", (s) => {
542
- A("[availability]: ", s);
543
- const i = s.map((l) => l.start_time);
544
- A("[selectableDates]: ", i), t.set("selectableDates", i);
545
- const r = s[0];
546
- if (!r)
547
- return;
548
- const o = Math.floor((r.end_time.getTime() - r.start_time.getTime()) / 6e4);
549
- A("[durationMinutes]: ", o), t.set("eventDuration", o);
550
- }), t.reset = () => {
551
- for (const s in e) {
552
- const i = e[s];
553
- t.set(s, i);
554
- }
555
- }, t;
556
- }
557
- const z = (n, e) => {
558
- const t = n.isLoading, s = n.showNotification, i = n.nylasBranding, r = n.version;
559
- return a(
560
- te,
561
- null,
562
- s && a("nylas-notification", null),
563
- t && a(
564
- "div",
565
- { class: "loading" },
566
- a(
567
- "div",
568
- { class: "left" },
569
- a("div", { class: "skeleton" })
570
- ),
571
- a(
572
- "div",
573
- { class: "right" },
574
- a("div", { class: "skeleton" }),
575
- a("div", { class: "skeleton" }),
576
- a("div", { class: "skeleton" }),
577
- a("div", { class: "skeleton" }),
578
- a("div", { class: "skeleton" })
579
- )
580
- ),
581
- !t && e,
582
- a(
583
- "div",
584
- { class: "footer" },
585
- i && a(
586
- "a",
587
- { 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" },
588
- "Powered by ",
589
- a("span", { class: "sr-only" }, "Nylas"),
590
- a("nylas-logo", { "aria-hidden": !0 })
591
- ),
592
- a(
593
- "tooltip-component",
594
- null,
595
- a("info-icon", { slot: "tooltip-icon" }),
596
- a("span", { slot: "tooltip-content" }, r)
597
- )
598
- )
599
- );
600
- }, J = (n, e) => a("div", { class: "message-banner" }, e), ue = ':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;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}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}', fe = ue, Y = { title: d.t("genericErrorTitle"), type: j.Error, category: U.Component }, me = class {
601
- constructor(n) {
602
- K(this, n), 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" }) || `${d.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language, this.showFeedbackModal = !1, this.bookingInfoConfirmed = null, this.version = "2.0.1";
603
- }
604
- connectedCallback() {
605
- A("[nylas-scheduler] connectedCallback");
606
- }
607
- async componentWillLoad() {
608
- var i, r;
609
- A("[nylas-scheduler] Component will load"), this.version = "2.0.1", this.enableUserFeedback && !ne() && se({
610
- dsn: "https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",
611
- release: this.version,
612
- integrations: (o) => [
613
- ...o.filter((l) => !1),
614
- oe({
615
- colorScheme: "system",
616
- autoInject: !1
617
- })
618
- ],
619
- autoSessionTracking: !1,
620
- beforeSend: () => null
621
- });
622
- const n = this.schedulerWillLoad.emit(this.host);
623
- if ("schedulerWillLoad" in this.eventOverrides && (await this.eventOverrides.schedulerWillLoad(n, this.nylasSchedulerConnector), n.defaultPrevented))
624
- return;
625
- this.stores = {
626
- scheduler: ge({
627
- bookingInfo: this.bookingInfo,
628
- nylasBranding: this.nylasBranding,
629
- themeConfig: this.themeConfig,
630
- hour12: this.hour12,
631
- ...this.defaultSchedulerState
632
- })
633
- }, this.baseProvider = new ie(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
634
- let e;
635
- if (this.rescheduleBookingRef) {
636
- const [o, l, c] = M(this.rescheduleBookingRef);
637
- this.refConfigId = o, this.stores.scheduler.set("rescheduleBookingId", l), e = this.bookingRefExtracted.emit({ configurationId: o, bookingId: l });
638
- } else if (this.cancelBookingRef) {
639
- const [o, l, c] = M(this.cancelBookingRef);
640
- this.refConfigId = o, this.stores.scheduler.set("cancelBookingId", l), e = this.bookingRefExtracted.emit({ configurationId: o, bookingId: l });
641
- } else if (this.organizerConfirmationBookingRef) {
642
- const [o, l, c] = M(this.organizerConfirmationBookingRef);
643
- this.refConfigId = o, this.stores.scheduler.set("organizerConfirmationBookingId", l), this.stores.scheduler.set("organizerConfirmationSalt", c), e = this.bookingRefExtracted.emit({ configurationId: o, bookingId: l, salt: c });
644
- }
645
- if ("bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(e, this.nylasSchedulerConnector), e.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
646
- return;
647
- const t = (i = this.baseProvider) == null ? void 0 : i.getStore("scheduler");
648
- this.nylasSchedulerConnector = new he({
649
- schedulerAPIURL: this.schedulerApiUrl,
650
- sessionId: this.sessionId,
651
- configId: this.refConfigId,
652
- slug: this.slug,
653
- clientId: this.clientId,
654
- nylasSchedulerStore: t
655
- });
656
- const s = this.init.emit(this.host);
657
- "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));
658
- }
659
- async componentDidLoad() {
660
- var c, f, h, u, g, p, b, S;
661
- (c = this.baseProvider) == null || c.componentDidLoad();
662
- const n = this.schedulerDidLoad.emit(this.host);
663
- if ("schedulerDidLoad" in this.eventOverrides && (await this.eventOverrides.schedulerDidLoad(n, this.nylasSchedulerConnector), n.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
664
- return;
665
- this.localizationChanged(this.localization);
666
- const e = await ((f = this.nylasSchedulerConnector) == null ? void 0 : f.scheduler.getUISettings());
667
- if (!e || "error" in e) {
668
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(e == null ? void 0 : e.error) }, host: this.host });
669
- return;
670
- } else {
671
- "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.");
672
- const m = this.configSettingsLoaded.emit({ settings: e });
673
- if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(m, this.nylasSchedulerConnector), m.defaultPrevented))
674
- return;
675
- }
676
- 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, i = t == null ? void 0 : t.get("selectedTimeslot");
677
- if (i && (i != null && i.start_time)) {
678
- if (!this.isTimeslotValid(i))
679
- return;
680
- if (t != null && t.get("showBookingForm")) {
681
- t == null || t.set("selectedDate", i.start_time);
682
- return;
683
- }
684
- }
685
- const r = t == null ? void 0 : t.get("selectedDate"), o = t == null ? void 0 : t.get("availability");
686
- let l;
687
- if (!(o && o.length > 0)) {
688
- if (r) {
689
- const { startTime: m, endTime: k, endTimeForAvailableDaysInFuture: I } = this.validateAvailableDaysInFuture(r, s || 30);
690
- r.getTime() < I * 1e3 && (l = await ((S = this.nylasSchedulerConnector) == null ? void 0 : S.scheduler.getAvailability(m, k)));
691
- } else {
692
- const m = /* @__PURE__ */ new Date(), { startTime: k, endTime: I, endTimeForAvailableDaysInFuture: x } = this.validateAvailableDaysInFuture(m, s || 30);
693
- m.getTime() < x * 1e3 && (l = await ((b = this.nylasSchedulerConnector) == null ? void 0 : b.scheduler.getAvailability(k, I)));
694
- }
695
- if ((!l || "error" in l) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(l == null ? void 0 : l.error) }, host: this.host }), !r) {
696
- let m = /* @__PURE__ */ new Date();
697
- const k = t == null ? void 0 : t.get("availability").find((I) => new Date(I.start_time) > /* @__PURE__ */ new Date());
698
- k && (m = k.start_time), t == null || t.set("selectedDate", m);
699
- }
700
- }
701
- }
702
- componentDisconnected() {
703
- var n;
704
- (n = this.baseProvider) == null || n.componentDisconnected();
705
- }
706
- bookingInfoChanged(n) {
707
- var e;
708
- (e = this.stores) == null || e.scheduler.set("bookingInfo", n);
709
- }
710
- rescheduleBookingRefChanged(n) {
711
- var e, t;
712
- if (n) {
713
- const [s, i] = M(n);
714
- (e = this.stores) == null || e.scheduler.set("rescheduleBookingId", i), this.refConfigId = s, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(s);
715
- }
716
- }
717
- cancelBookingRefChanged(n) {
718
- var e, t;
719
- if (n) {
720
- const [s, i] = M(n);
721
- (e = this.stores) == null || e.scheduler.set("cancelBookingId", i), this.refConfigId = s, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(s);
722
- }
723
- }
724
- organizerConfirmationBookingRefChanged(n) {
725
- var e, t;
726
- if (n) {
727
- const [s, i] = M(n);
728
- (e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId", i), this.refConfigId = s, (t = this.nylasSchedulerConnector) == null || t.scheduler.setConfigId(s);
729
- }
730
- }
731
- localizationChanged(n) {
732
- n && Object.keys(n).forEach((e) => {
733
- e in le && d.addResourceBundle(e, "translation", n[e], !1, !0);
734
- });
735
- }
736
- themeConfigChanged(n) {
737
- var e, t;
738
- (t = (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler")) == null || t.set("themeConfig", n), this.applyThemeConfig(n);
739
- }
740
- languageChanged(n) {
741
- const e = n.detail;
742
- this.language = e, d.changeLanguage(e);
743
- }
744
- async registerComponentHandler(n) {
745
- var e;
746
- (e = this.baseProvider) == null || e.registerComponent(n.detail);
747
- }
748
- async unregisterComponentHandler(n) {
749
- var e;
750
- (e = this.baseProvider) == null || e.unregisterComponent(n.detail);
751
- }
752
- async monthChangedHandler(n) {
753
- var o, l, c, f, h, u, g;
754
- const e = n.detail, t = (f = (c = (l = (o = this.nylasSchedulerConnector) == null ? void 0 : o.schedulerStore) == null ? void 0 : l.get("configSettings")) == null ? void 0 : c.scheduler) == null ? void 0 : f.available_days_in_future, { startTime: s, endTime: i, endTimeForAvailableDaysInFuture: r } = this.validateAvailableDaysInFuture(e, t || 30);
755
- if (!n.defaultPrevented && s < r && e.getTime() < r * 1e3) {
756
- const p = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.getAvailability(s, i));
757
- (!p || "error" in p) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(p == null ? void 0 : p.error) }, host: this.host });
758
- const b = (u = this.stores) == null ? void 0 : u.scheduler.get("selectableDates");
759
- b && b.length > 0 && ((g = this.stores) == null || g.scheduler.set("selectedDate", b[0]));
760
- }
761
- }
762
- mapToBookingData(n) {
763
- var o, l, c;
764
- const e = (o = this.stores) == null ? void 0 : o.scheduler.get("selectedTimeslot"), t = (l = this.stores) == null ? void 0 : l.scheduler.get("selectedLanguage"), s = (c = this.stores) == null ? void 0 : c.scheduler.get("selectedTimezone"), i = 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 : "";
765
- return {
766
- additional_guests: n.guests,
767
- guest: { ...n.primaryParticipant },
768
- additional_fields: { ...n.additionalFields },
769
- start_time: i,
770
- end_time: r,
771
- email_language: t,
772
- timezone: s
773
- };
774
- }
775
- async bookButtonClickedHandler(n) {
776
- var c, f, h, u;
777
- if (n.defaultPrevented)
778
- return;
779
- const e = n.detail, t = this.mapToBookingData(e);
780
- this.bookingInfoConfirmed = e;
781
- const i = (f = (c = this.nylasSchedulerConnector) == null ? void 0 : c.schedulerStore) == null ? void 0 : f.get("rescheduleBookingId");
782
- if (i) {
783
- const g = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.rescheduleBooking(i, e));
784
- (!g || "error" in g) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(g == null ? void 0 : g.error) }, host: this.host });
785
- const p = g == null ? void 0 : g.data, b = this.bookedEventInfo.emit({ ...g, data: { ...p, ...t } });
786
- this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...p }, "bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(b, this.nylasSchedulerConnector);
787
- return;
788
- }
789
- const r = await ((u = this.nylasSchedulerConnector) == null ? void 0 : u.scheduler.bookTimeslot(e));
790
- (!r || "error" in r) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(r == null ? void 0 : r.error) }, host: this.host });
791
- const o = r == null ? void 0 : r.data, l = this.bookedEventInfo.emit({ ...r, data: { ...o, ...t } });
792
- this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...o }, "bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(l, this.nylasSchedulerConnector);
793
- }
794
- dateSelectedHandler(n) {
795
- const e = n.detail;
796
- this.selectedDateLabel = e ? e.toLocaleDateString(this.language, { dateStyle: "full" }) : `${d.t("noDateSelected")}`;
797
- }
798
- cancelBookedEventErrorHandler(n) {
799
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(n.detail.error) }, host: this.host });
800
- }
801
- cancelBookedEventValidationErrorHandler(n) {
802
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(n.detail.error) }, host: this.host });
803
- }
804
- rescheduleBookedEventErrorHandler(n) {
805
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(n.detail.error) }, host: this.host });
806
- }
807
- confirmBookingErrorHandler(n) {
808
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(n.detail.error) }, host: this.host });
809
- }
810
- feedbackModalClosedHandler() {
811
- this.showFeedbackModal = !1;
812
- }
813
- eventIsFullHandler(n) {
814
- const e = n.detail.error;
815
- n.detail.type === "error" ? this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject({ message: e }) }, host: this.host }) : this.nylasSchedulerInfo.emit({
816
- notification: {
817
- title: "Event is full",
818
- category: U.Component,
819
- type: j.Info,
820
- description: "The event you selected is full. Please try a different time.",
821
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
822
- ttl: 3e3
823
- },
824
- host: this.host
825
- });
826
- }
827
- feedbackSubmittedHandler(n) {
828
- const t = {
829
- eventId: re("Scheduling Page User Feedback", {
830
- extra: {
831
- configId: this.configurationId,
832
- slug: this.slug
833
- }
834
- }),
835
- message: n.detail.feedback
836
- };
837
- ae(t, {
838
- includeReplay: !0,
839
- captureContext: {
840
- tags: {
841
- "nylas-web-element": "nylas-scheduling",
842
- "nylas-web-element-version": this.version,
843
- "nylas-config-id": this.configurationId,
844
- "nylas-slug": this.slug,
845
- "host-url": window.location.href
846
- },
847
- extra: {
848
- configId: this.configurationId,
849
- slug: this.slug,
850
- version: this.version
851
- }
852
- }
853
- }), this.showFeedbackModal = !1;
854
- }
855
- async getNylasSchedulerStore() {
856
- var n;
857
- return (n = this.baseProvider) == null ? void 0 : n.getStore("scheduler");
858
- }
859
- async getNylasSchedulerConnector() {
860
- return this.nylasSchedulerConnector;
861
- }
862
- async getRef() {
863
- return this.host;
864
- }
865
- getErrorObject(n) {
866
- return {
867
- title: (n == null ? void 0 : n.title) || Y.title,
868
- category: (n == null ? void 0 : n.category) || Y.category,
869
- type: j.Error,
870
- description: (n == null ? void 0 : n.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 n = "";
878
- return this.sessionId || (n += d.t("sessionIdRequiredErrorMessage")), !this.sessionId && !this.refConfigId && !(this.slug && this.clientId) && (n = d.t("sessionIdRequiredErrorMessage") + " " + d.t("publicConfigErrorMessage")), this.nylasSchedulerError.emit({
879
- notification: {
880
- title: d.t("schedulingComponentErrorTitle"),
881
- category: U.Component,
882
- type: j.Error,
883
- description: n,
884
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
885
- ttl: "none"
886
- },
887
- host: this.host
888
- }), !1;
889
- }
890
- return !0;
891
- }
892
- isTimeslotValid(n) {
893
- return new Date(n.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
894
- notification: {
895
- title: d.t("invalidTimeslotErrorTitle"),
896
- category: U.Component,
897
- type: j.Error,
898
- description: d.t("invalidTimeslotErrorMessage"),
899
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
900
- ttl: "none"
901
- },
902
- host: this.host
903
- }), !1) : !0;
904
- }
905
- validateAvailableDaysInFuture(n, e) {
906
- const t = /* @__PURE__ */ new Date(), s = new Date(n.getFullYear(), n.getMonth(), 1).getTime() / 1e3, i = new Date(n.getFullYear(), n.getMonth() + 1, 1).getTime() / 1e3, r = Math.floor(X(t, e).getTime() / 1e3), o = Math.min(r, i);
907
- return { startTime: s < t.getTime() / 1e3 ? Math.floor(t.getTime() / 1e3) : s, endTime: o, endTimeForAvailableDaysInFuture: r };
908
- }
909
- applyThemeConfig(n) {
910
- if (n)
911
- for (const [e, t] of Object.entries(n))
912
- this.host.style.setProperty(`${e}`, t);
913
- }
914
- onFeedbackClick(n) {
915
- n.preventDefault(), this.showFeedbackModal = !0;
916
- }
917
- redirectToCustomUrl(n) {
918
- window.location.assign(n);
919
- }
920
- render() {
921
- var b, S, m, k, I, x, w, L, _, B, D, O;
922
- const n = 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"), i = 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"), c = 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 ? Q(g.toLocaleDateString(this.language, { dateStyle: "full" })) : `${d.t("noDateSelected")}`, n && (r || f) && !i)
924
- return a(P, null, a(z, { version: this.version, 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: (y) => this.onFeedbackClick(y) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
925
- if (n && c)
926
- return a(P, null, a(z, null, a("div", { class: "manual-confirmation-page", part: "manual-confirmation-page" }, a("nylas-organizer-confirmation-card", { organizerConfirmationBookingId: c, exportparts: "nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline" }))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (y) => this.onFeedbackClick(y) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
927
- if (n && i)
928
- return a(P, null, a(z, { version: this.version, nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, a("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, a("nylas-cancelled-event-card", { cancelledEventInfo: i, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), this.enableUserFeedback && a("button-component", { id: "report-issue", variant: "basic", onClick: (y) => this.onFeedbackClick(y) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
929
- if (n && h)
930
- return a(P, null, a(z, { version: this.version, 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: (y) => this.onFeedbackClick(y) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
931
- if (n && t && p) {
932
- const y = (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((q) => {
936
- !R[q] && ($ != null && $[q]) && (R[q] = $[q].value);
937
- });
938
- }
939
- const v = (_ = this.stores) == null ? void 0 : _.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"), W = (O = this.stores) == null ? void 0 : O.scheduler.get("configSettings"), G = this.configurationId ? this.configurationId : W == null ? void 0 : W.configuration_id, Z = window.location.search, T = new URLSearchParams(Z);
940
- T.set("booking_id", t.booking_id), y != null && y.name && T.set("name", y.name), y != null && y.email && T.set("email", y.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 (n && t)
944
- return a(P, null, a(z, { version: this.version, 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: (y) => this.onFeedbackClick(y) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null));
945
- if (n && (!t || l) && !s) {
946
- const y = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
947
- return a(P, null, a(z, { version: this.version, nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, l && a(J, null, `${d.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" }, y && 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 n && !t && s ? a(P, null, a(z, { version: this.version, nylasBranding: u, isLoading: this.isLoading, showNotification: this.showNotification }, l && a(J, null, `${d.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: (y) => this.onFeedbackClick(y) }, a("feedback-icon", null)), this.showFeedbackModal && a("nylas-feedback-form", null)) : a(P, null, a("slot", null));
950
- }
951
- get host() {
952
- return V(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
- me.style = fe;
966
- export {
967
- me as nylas_scheduling
968
- };