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