@nylas/react 1.1.4 → 1.1.5
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/add-circle-icon_2.entry-1e899552.js +25 -0
- package/dist/add-circle-icon_2.entry-31acee1d.cjs +1 -0
- package/dist/archive-icon.entry-b5f307e8.js +15 -0
- package/dist/archive-icon.entry-e932c9e6.cjs +1 -0
- package/dist/{arrow-icon.entry-20b50784.js → arrow-icon.entry-aae2e22d.js} +2 -2
- package/dist/{arrow-icon.entry-83c3105b.cjs → arrow-icon.entry-e35a6cad.cjs} +1 -1
- package/dist/{bold-icon.entry-0e3d84e1.cjs → bold-icon.entry-1e3c9b1f.cjs} +1 -1
- package/dist/{bold-icon.entry-34b18d0d.js → bold-icon.entry-d5d86b3f.js} +2 -2
- package/dist/{button-component_2.entry-8a5e99da.js → button-component_2.entry-5284316e.js} +6 -6
- package/dist/{button-component_2.entry-54101987.cjs → button-component_2.entry-a86f8dca.cjs} +1 -1
- package/dist/{calendar-agenda-fill-icon_51.entry-a351dca5.js → calendar-agenda-fill-icon_54.entry-5672c589.js} +1943 -1638
- package/dist/calendar-agenda-fill-icon_54.entry-702b29cc.cjs +10 -0
- package/dist/{calendar-cancel-icon.entry-f83e9b41.js → calendar-cancel-icon.entry-7f81de9d.js} +4 -4
- package/dist/{calendar-cancel-icon.entry-00756264.cjs → calendar-cancel-icon.entry-e9792eaa.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-1817540c.js → calendar-check-icon_2.entry-84db1700.js} +7 -7
- package/dist/{calendar-check-icon_2.entry-6ac948fc.cjs → calendar-check-icon_2.entry-ad055b37.cjs} +1 -1
- package/dist/{calendar-icon.entry-68e53f52.cjs → calendar-icon.entry-019f7feb.cjs} +1 -1
- package/dist/{calendar-icon.entry-362428bf.js → calendar-icon.entry-45db1630.js} +2 -2
- package/dist/{checkbox-component_2.entry-5ce9807d.cjs → checkbox-component_2.entry-8325ff88.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-0d7c1916.js → checkbox-component_2.entry-84a053ff.js} +3 -3
- package/dist/{chevron-icon_3.entry-89c52603.cjs → chevron-icon_3.entry-0edde2a6.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-37c087a7.js → chevron-icon_3.entry-ec894a13.js} +6 -6
- package/dist/{clock-icon_4.entry-2e78febe.js → clock-icon_4.entry-8ec9c29b.js} +8 -8
- package/dist/{clock-icon_4.entry-496058ef.cjs → clock-icon_4.entry-935fe48d.cjs} +1 -1
- package/dist/constants-c549b12b-7ea4c7f5.js +763 -0
- package/dist/constants-c549b12b-c85413b1.cjs +1 -0
- package/dist/copy-icon.entry-5a2030da.cjs +1 -0
- package/dist/{copy-icon.entry-6d4e05b0.js → copy-icon.entry-d9405510.js} +7 -7
- package/dist/{delete-icon.entry-ea06b42a.js → delete-icon.entry-1b0a3ba4.js} +7 -7
- package/dist/{delete-icon.entry-e98b336e.cjs → delete-icon.entry-3f3d1ffb.cjs} +1 -1
- package/dist/document-refresh-icon.entry-59a18097.cjs +1 -0
- package/dist/document-refresh-icon.entry-fab58d33.js +15 -0
- package/dist/{feedbackSync-ab657d65-e8b7c001.js → feedbackSync-b56b29ed-7a1f1f75.js} +1 -1
- package/dist/{feedbackSync-ab657d65-e650e46d.cjs → feedbackSync-b56b29ed-b6f352f3.cjs} +1 -1
- package/dist/{folder-icon.entry-6096fbf4.js → folder-icon.entry-b5a123d0.js} +2 -2
- package/dist/{folder-icon.entry-5c3f4e8f.cjs → folder-icon.entry-e85383b6.cjs} +1 -1
- package/dist/{forward-icon.entry-4089e3bb.cjs → forward-icon.entry-7c8ed4c3.cjs} +1 -1
- package/dist/forward-icon.entry-88ab1a85.js +15 -0
- package/dist/{globe-icon.entry-59f4c2f9.js → globe-icon.entry-6fb414ca.js} +4 -4
- package/dist/{globe-icon.entry-e8ca972e.cjs → globe-icon.entry-b1253516.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-ae09d065.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-d4b8926f.js → google-logo-icon_4.entry-fe627741.js} +213 -199
- package/dist/inbox-icon.entry-7dce836e.cjs +1 -0
- package/dist/{inbox-icon.entry-70dae5ec.js → inbox-icon.entry-cec35da1.js} +2 -2
- package/dist/{index-e475e0c0.js → index-3fd31877.js} +3236 -3090
- package/dist/index-bd6fdc8c.cjs +81 -0
- package/dist/{index.es-b475d61f-68a74a28.cjs → index.es-c7ca1bad-0a324dca.cjs} +1 -1
- package/dist/{index.es-b475d61f-bfa2cba2.js → index.es-c7ca1bad-b895d84b.js} +1 -1
- package/dist/{info-icon_2.entry-f1b1dfba.cjs → info-icon_2.entry-1dab6311.cjs} +1 -1
- package/dist/{info-icon_2.entry-2bb60213.js → info-icon_2.entry-f7e6b4aa.js} +5 -5
- package/dist/{input-color-picker.entry-5ae45a9e.js → input-color-picker.entry-30cda4e2.js} +3 -3
- package/dist/{input-color-picker.entry-b669f7fb.cjs → input-color-picker.entry-b6e53c29.cjs} +1 -1
- package/dist/{input-component.entry-eeb95361.cjs → input-component.entry-1f1f8e00.cjs} +1 -1
- package/dist/{input-component.entry-cb958501.js → input-component.entry-7a04bc8b.js} +3 -3
- package/dist/{input-dropdown.entry-0b458f68.cjs → input-dropdown.entry-5e5b67be.cjs} +1 -1
- package/dist/{input-dropdown.entry-962605f8.js → input-dropdown.entry-abf134a8.js} +4 -4
- package/dist/italic-icon.entry-4631c594.js +15 -0
- package/dist/italic-icon.entry-c793243b.cjs +1 -0
- package/dist/{multi-select-dropdown.entry-a66408a2.cjs → multi-select-dropdown.entry-2b8728d5.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-3084e1fc.js → multi-select-dropdown.entry-9a93da56.js} +2 -2
- package/dist/nylas-booked-event-card_12.entry-8d502a3c.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-29e2a4b1.js → nylas-booked-event-card_12.entry-f13f3f54.js} +299 -294
- package/dist/{nylas-form-card.entry-33b4c295.js → nylas-form-card.entry-862519b4.js} +16 -16
- package/dist/{nylas-form-card.entry-8465eccf.cjs → nylas-form-card.entry-af179b96.cjs} +1 -1
- package/dist/{nylas-if-state.entry-9d96fc87.js → nylas-if-state.entry-8803a762.js} +3 -3
- package/dist/{nylas-if-state.entry-adb6103a.cjs → nylas-if-state.entry-c1c1282d.cjs} +1 -1
- package/dist/{nylas-login.entry-3f7c195e.js → nylas-login.entry-3e12f747.js} +7 -7
- package/dist/{nylas-login.entry-78b968d1.cjs → nylas-login.entry-65f8f046.cjs} +1 -1
- package/dist/{nylas-provider.entry-b918d0f6.cjs → nylas-provider.entry-9626b113.cjs} +1 -1
- package/dist/{nylas-provider.entry-19635620.js → nylas-provider.entry-e3501bd1.js} +5 -5
- package/dist/{nylas-scheduler-editor.entry-cfed7ae2.cjs → nylas-scheduler-editor.entry-17cd1514.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-e848771f.js → nylas-scheduler-editor.entry-6df45b05.js} +25 -25
- package/dist/{nylas-scheduling.entry-da987c02.js → nylas-scheduling.entry-08051ba3.js} +138 -126
- package/dist/nylas-scheduling.entry-b1fafd91.cjs +1 -0
- package/dist/{nylas-time-window-picker.entry-1f76b577.cjs → nylas-time-window-picker.entry-4989d421.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-3c6b29d9.js → nylas-time-window-picker.entry-bdc8c6ea.js} +13 -13
- package/dist/{person-icon.entry-79fcd9fb.js → person-icon.entry-d62a16b4.js} +2 -2
- package/dist/{person-icon.entry-82bbb87c.cjs → person-icon.entry-fb7efa8f.cjs} +1 -1
- package/dist/play-icon.entry-01b95392.js +15 -0
- package/dist/{play-icon.entry-3f357ea4.cjs → play-icon.entry-f485a2c8.cjs} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +9 -9
- package/dist/{refresh-icon.entry-1427a5e6.js → refresh-icon.entry-1ff4b39f.js} +2 -2
- package/dist/{refresh-icon.entry-7ce5ec90.cjs → refresh-icon.entry-5f997e86.cjs} +1 -1
- package/dist/{register-component-679c1308-de697ecb.js → register-component-3444af44-854971ad.js} +1 -1
- package/dist/{register-component-679c1308-b5a96acf.cjs → register-component-3444af44-9053e8c3.cjs} +1 -1
- package/dist/{reply-all-icon.entry-cf8114db.cjs → reply-all-icon.entry-1dad6514.cjs} +1 -1
- package/dist/{reply-all-icon.entry-f1165660.js → reply-all-icon.entry-cbafb8a0.js} +2 -2
- package/dist/reply-icon.entry-162d9945.cjs +1 -0
- package/dist/reply-icon.entry-a43bc252.js +15 -0
- package/dist/{scheduler-config-store-2a3b403d-e5210f72.js → scheduler-config-store-ed4a8dfd-22db9285.js} +1 -2
- package/dist/scheduler-config-store-ed4a8dfd-eeaeaa50.cjs +1 -0
- package/dist/{scheduler-store-908886c8-b0f43cb9.js → scheduler-store-d4784b24-9a5f5734.js} +134 -126
- package/dist/scheduler-store-d4784b24-aed474e8.cjs +1 -0
- package/dist/sent-icon.entry-a05486d5.js +15 -0
- package/dist/sent-icon.entry-a1aec7e9.cjs +1 -0
- package/dist/spam-icon.entry-473f11af.js +15 -0
- package/dist/spam-icon.entry-b481a04b.cjs +1 -0
- package/dist/{star-icon.entry-b15601ca.js → star-icon.entry-12fdc345.js} +5 -5
- package/dist/{star-icon.entry-88501c8b.cjs → star-icon.entry-6b1fe3cf.cjs} +1 -1
- package/dist/stop-icon.entry-4bd609f7.js +15 -0
- package/dist/{stop-icon.entry-3475e257.cjs → stop-icon.entry-72481153.cjs} +1 -1
- package/dist/{textarea-component.entry-d1f4dd9a.js → textarea-component.entry-47e1b2e6.js} +2 -2
- package/dist/{textarea-component.entry-683c2959.cjs → textarea-component.entry-f330a755.cjs} +1 -1
- package/dist/{time-period-selector.entry-e97f86fd.js → time-period-selector.entry-a4899368.js} +2 -2
- package/dist/{time-period-selector.entry-8cfdf750.cjs → time-period-selector.entry-c7611563.cjs} +1 -1
- package/dist/{translate-icon.entry-5757c37c.cjs → translate-icon.entry-40dfa8c9.cjs} +1 -1
- package/dist/{translate-icon.entry-09c5574f.js → translate-icon.entry-4517838d.js} +4 -4
- package/dist/trash-fill-icon.entry-86ca3055.cjs +1 -0
- package/dist/{trash-fill-icon.entry-470ec1ff.js → trash-fill-icon.entry-d7e960eb.js} +3 -3
- package/dist/{underline-icon.entry-9fe74ba7.js → underline-icon.entry-352970f5.js} +2 -2
- package/dist/{underline-icon.entry-6d729068.cjs → underline-icon.entry-f16d4943.cjs} +1 -1
- package/dist/{warning-icon.entry-d924f8f9.js → warning-icon.entry-63987dad.js} +5 -5
- package/dist/{warning-icon.entry-c1d48318.cjs → warning-icon.entry-79ef75b2.cjs} +1 -1
- package/package.json +3 -3
- package/dist/add-circle-icon_2.entry-6753bd65.js +0 -25
- package/dist/add-circle-icon_2.entry-cd9a7f37.cjs +0 -1
- package/dist/archive-icon.entry-434d1696.js +0 -15
- package/dist/archive-icon.entry-7cb1c265.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_51.entry-1920adc2.cjs +0 -7
- package/dist/constants-c31dccfe-04b9cd8a.js +0 -3883
- package/dist/constants-c31dccfe-1a739653.cjs +0 -15
- package/dist/copy-icon.entry-a1baee33.cjs +0 -1
- package/dist/document-refresh-icon.entry-09750b52.cjs +0 -1
- package/dist/document-refresh-icon.entry-afae6621.js +0 -15
- package/dist/forward-icon.entry-da319c05.js +0 -15
- package/dist/google-logo-icon_4.entry-e2001f83.cjs +0 -1
- package/dist/inbox-icon.entry-80ee9082.cjs +0 -1
- package/dist/index-6b9d4b01.cjs +0 -81
- package/dist/italic-icon.entry-4a89e289.cjs +0 -1
- package/dist/italic-icon.entry-5be07509.js +0 -15
- package/dist/nylas-booked-event-card_12.entry-227ccf31.cjs +0 -1
- package/dist/nylas-reminder-emails.entry-ec79b757.js +0 -168
- package/dist/nylas-reminder-emails.entry-ee76db24.cjs +0 -4
- package/dist/nylas-reminder-time_2.entry-105de2d0.js +0 -108
- package/dist/nylas-reminder-time_2.entry-83ecc1d4.cjs +0 -1
- package/dist/nylas-scheduling.entry-e989cf9e.cjs +0 -1
- package/dist/play-icon.entry-97b40470.js +0 -15
- package/dist/reply-icon.entry-3a601cff.js +0 -15
- package/dist/reply-icon.entry-3db337c9.cjs +0 -1
- package/dist/scheduler-config-store-2a3b403d-e6f5bcab.cjs +0 -1
- package/dist/scheduler-store-908886c8-62d14677.cjs +0 -1
- package/dist/sent-icon.entry-2c7bd48e.js +0 -15
- package/dist/sent-icon.entry-708b9a2b.cjs +0 -1
- package/dist/spam-icon.entry-3106ed3d.js +0 -15
- package/dist/spam-icon.entry-fa8b80c6.cjs +0 -1
- package/dist/stop-icon.entry-f926a8db.js +0 -15
- package/dist/trash-fill-icon.entry-4bbfabcc.cjs +0 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import { n as
|
|
3
|
-
import { E as
|
|
4
|
-
import { L as
|
|
5
|
-
import { i as
|
|
1
|
+
import { i as g, r as Y, c as C, d as O, f as E, j as J, k as K, h as n, H as w, g as Q, F as W } from "./index-3fd31877.js";
|
|
2
|
+
import { n as z, N as X } from "./index.es-c7ca1bad-b895d84b.js";
|
|
3
|
+
import { E as S, C as Z, N as V } from "./scheduler-store-d4784b24-9a5f5734.js";
|
|
4
|
+
import { L as ee, a as te } from "./constants-c549b12b-7ea4c7f5.js";
|
|
5
|
+
import { i as ne, a as ie, c as oe, b as se, f as ae } from "./feedbackSync-b56b29ed-7a1f1f75.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "react-dom";
|
|
8
|
-
class
|
|
9
|
-
constructor({ schedulerAPIURL: e, nylasSchedulerStore: i, sessionId: a, configId:
|
|
8
|
+
class re {
|
|
9
|
+
constructor({ schedulerAPIURL: e, nylasSchedulerStore: i, sessionId: a, configId: o, slug: r, clientId: d }) {
|
|
10
10
|
if (!e)
|
|
11
11
|
throw new Error("schedulerAPIURL is required");
|
|
12
12
|
if (!i)
|
|
13
13
|
throw new Error("nylasSchedulerStore is required");
|
|
14
|
-
if (!a && !
|
|
14
|
+
if (!a && !o && !(r || d))
|
|
15
15
|
throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");
|
|
16
|
-
e === "/" && (e = new URL(window.location.href).origin), this.configId =
|
|
16
|
+
e === "/" && (e = new URL(window.location.href).origin), this.configId = o, this.sessionId = a, this.schedulerAPIURL = e, this.nylasSchedulerStore = i, this.slug = r, this.clientId = d;
|
|
17
17
|
}
|
|
18
18
|
init() {
|
|
19
|
-
|
|
19
|
+
O("NylasConnector init");
|
|
20
20
|
}
|
|
21
21
|
get schedulerStore() {
|
|
22
22
|
return this.nylasSchedulerStore;
|
|
23
23
|
}
|
|
24
24
|
get scheduler() {
|
|
25
|
-
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new
|
|
25
|
+
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new V({
|
|
26
26
|
schedulerAPIURL: this.schedulerAPIURL,
|
|
27
27
|
schedulerStore: this.schedulerStore,
|
|
28
28
|
sessionId: this.sessionId,
|
|
@@ -35,10 +35,10 @@ class ae {
|
|
|
35
35
|
this.nylasSchedulerStore.reset();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const i = t.isLoading, a = t.showNotification,
|
|
38
|
+
const x = (t, e) => {
|
|
39
|
+
const i = t.isLoading, a = t.showNotification, o = t.nylasBranding;
|
|
40
40
|
return n(
|
|
41
|
-
|
|
41
|
+
W,
|
|
42
42
|
null,
|
|
43
43
|
a && n("nylas-notification", null),
|
|
44
44
|
i && n(
|
|
@@ -60,28 +60,28 @@ const E = (t, e) => {
|
|
|
60
60
|
)
|
|
61
61
|
),
|
|
62
62
|
!i && e,
|
|
63
|
-
n("div", { class: "footer" },
|
|
64
|
-
|
|
63
|
+
n("div", { class: "footer" }, o && n(
|
|
64
|
+
W,
|
|
65
65
|
null,
|
|
66
66
|
"Powered by ",
|
|
67
67
|
n("nylas-logo", null)
|
|
68
68
|
))
|
|
69
69
|
);
|
|
70
|
-
},
|
|
70
|
+
}, $ = (t, e) => n("div", { class: "message-banner" }, e), de = ':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-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;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{padding:0.5rem 4px 0;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}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.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}', le = de, q = { title: g.t("genericErrorTitle"), type: z.Error, category: S.Component }, ce = class {
|
|
71
71
|
constructor(t) {
|
|
72
|
-
|
|
72
|
+
Y(this, t), this.init = C(this, "init", 7), this.schedulerWillLoad = C(this, "schedulerWillLoad", 7), this.schedulerDidLoad = C(this, "schedulerDidLoad", 7), this.nylasSchedulerError = C(this, "nylasSchedulerError", 7), this.configSettingsLoaded = C(this, "configSettingsLoaded", 7), this.bookingRefExtracted = C(this, "bookingRefExtracted", 7), this.bookedEventInfo = C(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.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || `${g.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language, this.showFeedbackModal = !1, this.bookingInfoConfirmed = null;
|
|
73
73
|
}
|
|
74
74
|
connectedCallback() {
|
|
75
|
-
|
|
75
|
+
O("[nylas-scheduler] connectedCallback");
|
|
76
76
|
}
|
|
77
77
|
async componentWillLoad() {
|
|
78
|
-
var
|
|
79
|
-
|
|
78
|
+
var o, r;
|
|
79
|
+
O("[nylas-scheduler] Component will load"), this.enableUserFeedback && !ne() && ie({
|
|
80
80
|
dsn: "https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",
|
|
81
|
-
release: "1.1.
|
|
82
|
-
integrations: (
|
|
83
|
-
...
|
|
84
|
-
|
|
81
|
+
release: "1.1.5",
|
|
82
|
+
integrations: (d) => [
|
|
83
|
+
...d.filter((s) => !1),
|
|
84
|
+
ae({
|
|
85
85
|
colorScheme: "system",
|
|
86
86
|
autoInject: !1
|
|
87
87
|
})
|
|
@@ -93,27 +93,27 @@ const E = (t, e) => {
|
|
|
93
93
|
if ("schedulerWillLoad" in this.eventOverrides && (await this.eventOverrides.schedulerWillLoad(t, this.nylasSchedulerConnector), t.defaultPrevented))
|
|
94
94
|
return;
|
|
95
95
|
this.stores = {
|
|
96
|
-
scheduler:
|
|
96
|
+
scheduler: Z({
|
|
97
97
|
bookingInfo: this.bookingInfo,
|
|
98
98
|
nylasBranding: this.nylasBranding,
|
|
99
99
|
...this.defaultSchedulerState
|
|
100
100
|
})
|
|
101
|
-
}, this.baseProvider = new
|
|
101
|
+
}, this.baseProvider = new X(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
|
|
102
102
|
let e;
|
|
103
103
|
if (this.rescheduleBookingRef) {
|
|
104
|
-
const [
|
|
105
|
-
this.refConfigId =
|
|
104
|
+
const [d, s, l] = E(this.rescheduleBookingRef);
|
|
105
|
+
this.refConfigId = d, this.stores.scheduler.set("rescheduleBookingId", s), e = this.bookingRefExtracted.emit({ configurationId: d, bookingId: s });
|
|
106
106
|
} else if (this.cancelBookingRef) {
|
|
107
|
-
const [
|
|
108
|
-
this.refConfigId =
|
|
107
|
+
const [d, s, l] = E(this.cancelBookingRef);
|
|
108
|
+
this.refConfigId = d, this.stores.scheduler.set("cancelBookingId", s), e = this.bookingRefExtracted.emit({ configurationId: d, bookingId: s });
|
|
109
109
|
} else if (this.organizerConfirmationBookingRef) {
|
|
110
|
-
const [
|
|
111
|
-
this.refConfigId =
|
|
110
|
+
const [d, s, l] = E(this.organizerConfirmationBookingRef);
|
|
111
|
+
this.refConfigId = d, this.stores.scheduler.set("organizerConfirmationBookingId", s), this.stores.scheduler.set("organizerConfirmationSalt", l), e = this.bookingRefExtracted.emit({ configurationId: d, bookingId: s, salt: l });
|
|
112
112
|
}
|
|
113
113
|
if ("bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(e, this.nylasSchedulerConnector), e.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
114
114
|
return;
|
|
115
|
-
const i = (
|
|
116
|
-
this.nylasSchedulerConnector = new
|
|
115
|
+
const i = (o = this.baseProvider) == null ? void 0 : o.getStore("scheduler");
|
|
116
|
+
this.nylasSchedulerConnector = new re({
|
|
117
117
|
schedulerAPIURL: this.schedulerApiUrl,
|
|
118
118
|
sessionId: this.sessionId,
|
|
119
119
|
configId: this.refConfigId,
|
|
@@ -122,48 +122,48 @@ const E = (t, e) => {
|
|
|
122
122
|
nylasSchedulerStore: i
|
|
123
123
|
});
|
|
124
124
|
const a = this.init.emit(this.host);
|
|
125
|
-
"init" in this.eventOverrides && (await this.eventOverrides.init(a, this.nylasSchedulerConnector), a.defaultPrevented) || ((
|
|
125
|
+
"init" in this.eventOverrides && (await this.eventOverrides.init(a, this.nylasSchedulerConnector), a.defaultPrevented) || ((r = this.baseProvider) == null || r.componentWillLoad(this.nylasSchedulerConnector), this.applyThemeConfig(this.themeConfig));
|
|
126
126
|
}
|
|
127
127
|
async componentDidLoad() {
|
|
128
|
-
var
|
|
129
|
-
(
|
|
128
|
+
var l, b, m, h, c, f, p, D;
|
|
129
|
+
(l = this.baseProvider) == null || l.componentDidLoad();
|
|
130
130
|
const t = this.schedulerDidLoad.emit(this.host);
|
|
131
131
|
if ("schedulerDidLoad" in this.eventOverrides && (await this.eventOverrides.schedulerDidLoad(t, this.nylasSchedulerConnector), t.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
132
132
|
return;
|
|
133
133
|
this.localizationChanged(this.localization);
|
|
134
|
-
const e = await ((
|
|
134
|
+
const e = await ((b = this.nylasSchedulerConnector) == null ? void 0 : b.scheduler.getUISettings());
|
|
135
135
|
if (!e || "error" in e) {
|
|
136
136
|
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(e == null ? void 0 : e.error) }, host: this.host });
|
|
137
137
|
return;
|
|
138
138
|
} else {
|
|
139
139
|
"data" in e && ((m = e.data) != null && m.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.");
|
|
140
|
-
const
|
|
141
|
-
if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(
|
|
140
|
+
const u = this.configSettingsLoaded.emit({ settings: e });
|
|
141
|
+
if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(u, this.nylasSchedulerConnector), u.defaultPrevented))
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
const i = (
|
|
145
|
-
if (
|
|
146
|
-
if (!this.isTimeslotValid(
|
|
144
|
+
const i = (h = this.baseProvider) == null ? void 0 : h.getStore("scheduler"), a = (f = (c = i == null ? void 0 : i.get("configSettings")) == null ? void 0 : c.scheduler) == null ? void 0 : f.available_days_in_future, o = i == null ? void 0 : i.get("selectedTimeslot");
|
|
145
|
+
if (o && (o != null && o.start_time)) {
|
|
146
|
+
if (!this.isTimeslotValid(o))
|
|
147
147
|
return;
|
|
148
148
|
if (i != null && i.get("showBookingForm")) {
|
|
149
|
-
i == null || i.set("selectedDate",
|
|
149
|
+
i == null || i.set("selectedDate", o.start_time);
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
let
|
|
155
|
-
if (!(
|
|
156
|
-
if (
|
|
157
|
-
const { startTime:
|
|
158
|
-
|
|
153
|
+
const r = i == null ? void 0 : i.get("selectedDate"), d = i == null ? void 0 : i.get("availability");
|
|
154
|
+
let s;
|
|
155
|
+
if (!(d && d.length > 0)) {
|
|
156
|
+
if (r) {
|
|
157
|
+
const { startTime: u, endTime: y, endTimeForAvailableDaysInFuture: _ } = this.validateAvailableDaysInFuture(r, a || 30);
|
|
158
|
+
r.getTime() < _ * 1e3 && (s = await ((D = this.nylasSchedulerConnector) == null ? void 0 : D.scheduler.getAvailability(u, y)));
|
|
159
159
|
} else {
|
|
160
|
-
const
|
|
161
|
-
|
|
160
|
+
const u = /* @__PURE__ */ new Date(), { startTime: y, endTime: _, endTimeForAvailableDaysInFuture: T } = this.validateAvailableDaysInFuture(u, a || 30);
|
|
161
|
+
u.getTime() < T * 1e3 && (s = await ((p = this.nylasSchedulerConnector) == null ? void 0 : p.scheduler.getAvailability(y, _)));
|
|
162
162
|
}
|
|
163
|
-
if ((!
|
|
164
|
-
let
|
|
165
|
-
const
|
|
166
|
-
|
|
163
|
+
if ((!s || "error" in s) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(s == null ? void 0 : s.error) }, host: this.host }), !r) {
|
|
164
|
+
let u = /* @__PURE__ */ new Date();
|
|
165
|
+
const y = i == null ? void 0 : i.get("availability").find((_) => new Date(_.start_time) > /* @__PURE__ */ new Date());
|
|
166
|
+
y && (u = y.start_time), i == null || i.set("selectedDate", u);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -178,27 +178,27 @@ const E = (t, e) => {
|
|
|
178
178
|
rescheduleBookingRefChanged(t) {
|
|
179
179
|
var e, i;
|
|
180
180
|
if (t) {
|
|
181
|
-
const [a,
|
|
182
|
-
(e = this.stores) == null || e.scheduler.set("rescheduleBookingId",
|
|
181
|
+
const [a, o] = E(t);
|
|
182
|
+
(e = this.stores) == null || e.scheduler.set("rescheduleBookingId", o), this.refConfigId = a, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(a);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
cancelBookingRefChanged(t) {
|
|
186
186
|
var e, i;
|
|
187
187
|
if (t) {
|
|
188
|
-
const [a,
|
|
189
|
-
(e = this.stores) == null || e.scheduler.set("cancelBookingId",
|
|
188
|
+
const [a, o] = E(t);
|
|
189
|
+
(e = this.stores) == null || e.scheduler.set("cancelBookingId", o), this.refConfigId = a, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(a);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
organizerConfirmationBookingRefChanged(t) {
|
|
193
193
|
var e, i;
|
|
194
194
|
if (t) {
|
|
195
|
-
const [a,
|
|
196
|
-
(e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId",
|
|
195
|
+
const [a, o] = E(t);
|
|
196
|
+
(e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId", o), this.refConfigId = a, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(a);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
localizationChanged(t) {
|
|
200
200
|
t && Object.keys(t).forEach((e) => {
|
|
201
|
-
e in
|
|
201
|
+
e in ee && (g.addResourceBundle(e, "translation", t[e], !1, !0), this.language = this.language);
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
themeConfigChanged(t) {
|
|
@@ -206,7 +206,7 @@ const E = (t, e) => {
|
|
|
206
206
|
}
|
|
207
207
|
languageChanged(t) {
|
|
208
208
|
const e = t.detail;
|
|
209
|
-
this.language = e,
|
|
209
|
+
this.language = e, g.changeLanguage(e);
|
|
210
210
|
}
|
|
211
211
|
async registerComponentHandler(t) {
|
|
212
212
|
var e;
|
|
@@ -217,48 +217,50 @@ const E = (t, e) => {
|
|
|
217
217
|
(e = this.baseProvider) == null || e.unregisterComponent(t.detail);
|
|
218
218
|
}
|
|
219
219
|
async monthChangedHandler(t) {
|
|
220
|
-
var
|
|
221
|
-
const e = t.detail, i = (
|
|
222
|
-
if (a <
|
|
223
|
-
const f = await ((m = this.nylasSchedulerConnector) == null ? void 0 : m.scheduler.getAvailability(a,
|
|
220
|
+
var d, s, l, b, m, h, c;
|
|
221
|
+
const e = t.detail, i = (b = (l = (s = (d = this.nylasSchedulerConnector) == null ? void 0 : d.schedulerStore) == null ? void 0 : s.get("configSettings")) == null ? void 0 : l.scheduler) == null ? void 0 : b.available_days_in_future, { startTime: a, endTime: o, endTimeForAvailableDaysInFuture: r } = this.validateAvailableDaysInFuture(e, i || 30);
|
|
222
|
+
if (a < r && e.getTime() < r * 1e3) {
|
|
223
|
+
const f = await ((m = this.nylasSchedulerConnector) == null ? void 0 : m.scheduler.getAvailability(a, o));
|
|
224
224
|
(!f || "error" in f) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(f == null ? void 0 : f.error) }, host: this.host });
|
|
225
|
-
const
|
|
226
|
-
|
|
225
|
+
const p = (h = this.stores) == null ? void 0 : h.scheduler.get("selectableDates");
|
|
226
|
+
p && p.length > 0 && ((c = this.stores) == null || c.scheduler.set("selectedDate", p[0]));
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
mapToBookingData(t) {
|
|
230
|
-
var
|
|
231
|
-
const e = (
|
|
230
|
+
var d, s, l;
|
|
231
|
+
const e = (d = this.stores) == null ? void 0 : d.scheduler.get("selectedTimeslot"), i = (s = this.stores) == null ? void 0 : s.scheduler.get("selectedLanguage"), a = (l = this.stores) == null ? void 0 : l.scheduler.get("selectedTimezone"), o = 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 : "";
|
|
232
232
|
return {
|
|
233
233
|
additional_guests: t.guests,
|
|
234
|
-
guest: t.primaryParticipant,
|
|
235
|
-
additional_fields: t.additionalFields,
|
|
236
|
-
start_time:
|
|
237
|
-
end_time:
|
|
234
|
+
guest: { ...t.primaryParticipant },
|
|
235
|
+
additional_fields: { ...t.additionalFields },
|
|
236
|
+
start_time: o,
|
|
237
|
+
end_time: r,
|
|
238
238
|
email_language: i,
|
|
239
239
|
timezone: a
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
async bookButtonClickedHandler(t) {
|
|
243
|
-
var
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
"
|
|
243
|
+
var l, b, m, h;
|
|
244
|
+
if (t.defaultPrevented)
|
|
245
|
+
return;
|
|
246
|
+
const e = t.detail, i = this.mapToBookingData(e);
|
|
247
|
+
this.bookingInfoConfirmed = e;
|
|
248
|
+
const o = (b = (l = this.nylasSchedulerConnector) == null ? void 0 : l.schedulerStore) == null ? void 0 : b.get("rescheduleBookingId");
|
|
249
|
+
if (o) {
|
|
250
|
+
const c = await ((m = this.nylasSchedulerConnector) == null ? void 0 : m.scheduler.rescheduleBooking(o, e));
|
|
251
|
+
(!c || "error" in c) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(c == null ? void 0 : c.error) }, host: this.host });
|
|
252
|
+
const f = c == null ? void 0 : c.data, p = this.bookedEventInfo.emit({ ...c, data: { ...f, ...i } });
|
|
253
|
+
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(p, this.nylasSchedulerConnector);
|
|
252
254
|
return;
|
|
253
255
|
}
|
|
254
|
-
const
|
|
255
|
-
(!
|
|
256
|
-
const
|
|
257
|
-
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(
|
|
256
|
+
const r = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.bookTimeslot(e));
|
|
257
|
+
(!r || "error" in r) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(r == null ? void 0 : r.error) }, host: this.host });
|
|
258
|
+
const d = r == null ? void 0 : r.data, s = this.bookedEventInfo.emit({ ...r, data: { ...d, ...i } });
|
|
259
|
+
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(s, this.nylasSchedulerConnector);
|
|
258
260
|
}
|
|
259
261
|
dateSelectedHandler(t) {
|
|
260
262
|
const e = t.detail;
|
|
261
|
-
this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : `${
|
|
263
|
+
this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : `${g.t("noDateSelected")}`;
|
|
262
264
|
}
|
|
263
265
|
cancelBookedEventErrorHandler(t) {
|
|
264
266
|
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
@@ -277,15 +279,15 @@ const E = (t, e) => {
|
|
|
277
279
|
}
|
|
278
280
|
feedbackSubmittedHandler(t) {
|
|
279
281
|
const i = {
|
|
280
|
-
eventId:
|
|
282
|
+
eventId: oe("Scheduling Page User Feedback"),
|
|
281
283
|
message: t.detail.feedback
|
|
282
284
|
};
|
|
283
|
-
|
|
285
|
+
se(i, {
|
|
284
286
|
includeReplay: !0,
|
|
285
287
|
captureContext: {
|
|
286
288
|
tags: {
|
|
287
289
|
"nylas-web-element": "nylas-schduling",
|
|
288
|
-
"nylas-web-element-version": "1.1.
|
|
290
|
+
"nylas-web-element-version": "1.1.5"
|
|
289
291
|
},
|
|
290
292
|
extra: {
|
|
291
293
|
configId: this.configurationId,
|
|
@@ -306,9 +308,9 @@ const E = (t, e) => {
|
|
|
306
308
|
}
|
|
307
309
|
getErrorObject(t) {
|
|
308
310
|
return {
|
|
309
|
-
title: (t == null ? void 0 : t.title) ||
|
|
310
|
-
category: (t == null ? void 0 : t.category) ||
|
|
311
|
-
type:
|
|
311
|
+
title: (t == null ? void 0 : t.title) || q.title,
|
|
312
|
+
category: (t == null ? void 0 : t.category) || q.category,
|
|
313
|
+
type: z.Error,
|
|
312
314
|
description: (t == null ? void 0 : t.message) || "",
|
|
313
315
|
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
314
316
|
ttl: "none"
|
|
@@ -317,11 +319,11 @@ const E = (t, e) => {
|
|
|
317
319
|
checkIfSessionIdOrConfigIdExists() {
|
|
318
320
|
if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {
|
|
319
321
|
let t = "";
|
|
320
|
-
return this.sessionId || (t +=
|
|
322
|
+
return this.sessionId || (t += g.t("sessionIdRequiredErrorMessage")), !this.sessionId && !this.refConfigId && !(this.slug && this.clientId) && (t = g.t("sessionIdRequiredErrorMessage") + " " + g.t("publicConfigErrorMessage")), this.nylasSchedulerError.emit({
|
|
321
323
|
notification: {
|
|
322
|
-
title:
|
|
323
|
-
category:
|
|
324
|
-
type:
|
|
324
|
+
title: g.t("schedulingComponentErrorTitle"),
|
|
325
|
+
category: S.Component,
|
|
326
|
+
type: z.Error,
|
|
325
327
|
description: t,
|
|
326
328
|
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
327
329
|
ttl: "none"
|
|
@@ -334,10 +336,10 @@ const E = (t, e) => {
|
|
|
334
336
|
isTimeslotValid(t) {
|
|
335
337
|
return new Date(t.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
|
|
336
338
|
notification: {
|
|
337
|
-
title:
|
|
338
|
-
category:
|
|
339
|
-
type:
|
|
340
|
-
description:
|
|
339
|
+
title: g.t("invalidTimeslotErrorTitle"),
|
|
340
|
+
category: S.Component,
|
|
341
|
+
type: z.Error,
|
|
342
|
+
description: g.t("invalidTimeslotErrorMessage"),
|
|
341
343
|
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
342
344
|
ttl: "none"
|
|
343
345
|
},
|
|
@@ -345,8 +347,8 @@ const E = (t, e) => {
|
|
|
345
347
|
}), !1) : !0;
|
|
346
348
|
}
|
|
347
349
|
validateAvailableDaysInFuture(t, e) {
|
|
348
|
-
const i = /* @__PURE__ */ new Date(), a = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3,
|
|
349
|
-
return { startTime: a < i.getTime() / 1e3 ? Math.floor(i.getTime() / 1e3) : a, endTime:
|
|
350
|
+
const i = /* @__PURE__ */ new Date(), a = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, o = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, r = Math.floor(J(i, e).getTime() / 1e3), d = Math.min(r, o);
|
|
351
|
+
return { startTime: a < i.getTime() / 1e3 ? Math.floor(i.getTime() / 1e3) : a, endTime: d, endTimeForAvailableDaysInFuture: r };
|
|
350
352
|
}
|
|
351
353
|
applyThemeConfig(t) {
|
|
352
354
|
if (t)
|
|
@@ -356,32 +358,42 @@ const E = (t, e) => {
|
|
|
356
358
|
onFeedbackClick() {
|
|
357
359
|
this.showFeedbackModal = !0;
|
|
358
360
|
}
|
|
361
|
+
redirectToCustomUrl(t) {
|
|
362
|
+
window.location.assign(t);
|
|
363
|
+
}
|
|
359
364
|
render() {
|
|
360
|
-
var
|
|
361
|
-
const t = this.mode === "app", e = (
|
|
362
|
-
if (this.selectedDateLabel =
|
|
363
|
-
return n(
|
|
364
|
-
if (t &&
|
|
365
|
-
return n(
|
|
366
|
-
if (t &&
|
|
367
|
-
return n(
|
|
365
|
+
var p, D, u, y, _, T, P, N, A, M;
|
|
366
|
+
const t = this.mode === "app", e = (p = this.baseProvider) == null ? void 0 : p.getStore("scheduler"), i = e == null ? void 0 : e.get("eventInfo"), a = e == null ? void 0 : e.get("showBookingForm"), o = e == null ? void 0 : e.get("cancelledEventInfo"), r = e == null ? void 0 : e.get("cancelBookingId"), d = e == null ? void 0 : e.get("selectedTimeslot"), s = e == null ? void 0 : e.get("rescheduleBookingId"), l = e == null ? void 0 : e.get("organizerConfirmationBookingId"), b = e == null ? void 0 : e.get("rejectBookingId"), m = e == null ? void 0 : e.get("confirmedEventInfo"), h = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, c = e == null ? void 0 : e.get("selectedDate"), f = (u = (D = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : D.scheduler) == null ? void 0 : u.confirmation_redirect_url;
|
|
367
|
+
if (this.selectedDateLabel = c && this.language ? K(c.toLocaleDateString(te[this.language], { dateStyle: "full" })) : `${g.t("noDateSelected")}`, t && (r || b) && !o)
|
|
368
|
+
return n(w, null, n(x, { nylasBranding: h, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, n("nylas-cancel-booking-form", { selectedTimeslot: d, cancelBookingId: r, rejectBookingId: b, exportparts: "ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
369
|
+
if (t && l)
|
|
370
|
+
return n(w, null, n(x, null, n("div", { class: "manual-confirmation-page", part: "manual-confirmation-page" }, n("nylas-organizer-confirmation-card", { organizerConfirmationBookingId: l, exportparts: "nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
371
|
+
if (t && o)
|
|
372
|
+
return n(w, null, n(x, { nylasBranding: h, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, n("nylas-cancelled-event-card", { cancelledEventInfo: o, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
368
373
|
if (t && m)
|
|
369
|
-
return n(
|
|
374
|
+
return n(w, null, n(x, { nylasBranding: h, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "confirmed-event-page" }, n("nylas-confirmed-event-card", { confirmedEventInfo: m, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
370
375
|
if (t && i && f) {
|
|
371
|
-
const
|
|
372
|
-
|
|
376
|
+
const v = (y = this.bookingInfoConfirmed) == null ? void 0 : y.primaryParticipant, L = ((_ = this.bookingInfoConfirmed) == null ? void 0 : _.additionalFields) || {};
|
|
377
|
+
if (this.bookingInfo && typeof ((T = this.bookingInfo) == null ? void 0 : T.additionalFields) < "u") {
|
|
378
|
+
const B = this.bookingInfo.additionalFields;
|
|
379
|
+
Object.keys(B).forEach((F) => {
|
|
380
|
+
!L[F] && (B != null && B[F]) && (L[F] = B[F].value);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
const I = (P = this.stores) == null ? void 0 : P.scheduler.get("selectedTimeslot"), U = (N = this.stores) == null ? void 0 : N.scheduler.get("selectedTimezone"), j = (A = this.stores) == null ? void 0 : A.scheduler.get("selectedLanguage"), R = (M = this.stores) == null ? void 0 : M.scheduler.get("configSettings"), H = this.configurationId ? this.configurationId : R == null ? void 0 : R.configuration_id, G = window.location.search, k = new URLSearchParams(G);
|
|
384
|
+
k.set("booking_id", i.booking_id), v != null && v.name && k.set("name", v.name), v != null && v.email && k.set("email", v.email), I != null && I.start_time && k.set("start_time", (new Date(I.start_time).getTime() / 1e3).toString()), I != null && I.end_time && k.set("end_time", (new Date(I.end_time).getTime() / 1e3).toString()), U && k.set("tz", U), j && k.set("language", j), L && k.set("additional_values", JSON.stringify(L)), this.slug && k.set("page_slug", this.slug), H && k.set("config_id", H), this.redirectToCustomUrl(`${f}?${k.toString()}`);
|
|
373
385
|
return;
|
|
374
386
|
}
|
|
375
387
|
if (t && i)
|
|
376
|
-
return n(
|
|
377
|
-
if (t && (!i ||
|
|
378
|
-
const
|
|
379
|
-
return n(
|
|
388
|
+
return n(w, null, n(x, { nylasBranding: h, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "booked-event-page", part: "booked-event-page" }, n("nylas-booked-event-card", { selectedTimeslot: d, eventInfo: i, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
389
|
+
if (t && (!i || s) && !a) {
|
|
390
|
+
const v = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
|
|
391
|
+
return n(w, null, n(x, { nylasBranding: h, isLoading: this.isLoading, showNotification: this.showNotification }, s && n($, null, `${g.t("rescheduleTitle")}`), n("div", { class: "select-date-page", part: "select-date-page" }, n("div", { class: "left-panel" }, n("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" }), n("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" })), n("div", { class: `right-panel ${s ? "reschedule" : ""}` }, n("h2", null, n("calendar-icon", null), n("span", { id: "selectedDate" }, this.selectedDateLabel)), n("nylas-timeslot-picker", { exportparts: "ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, v && n("span", { slot: "timeslot-picker-cta-label" }, n("slot", { name: "timeslot-picker-cta-label" })))))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
380
392
|
}
|
|
381
|
-
return t && !i && a ? n(
|
|
393
|
+
return t && !i && a ? n(w, null, n(x, { nylasBranding: h, isLoading: this.isLoading, showNotification: this.showNotification }, s && n($, null, `${g.t("rescheduleTitle")}`), n("div", { class: "additional-data-page", part: "additional-data-page" }, n("div", { class: "left-panel" }, n("div", { class: "wrapper" }, n("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone" }))), n("div", { class: `right-panel ${s ? "reschedule" : ""}` }, n("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 && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null)) : n(w, null, n("slot", null));
|
|
382
394
|
}
|
|
383
395
|
get host() {
|
|
384
|
-
return
|
|
396
|
+
return Q(this);
|
|
385
397
|
}
|
|
386
398
|
static get watchers() {
|
|
387
399
|
return {
|
|
@@ -394,7 +406,7 @@ const E = (t, e) => {
|
|
|
394
406
|
};
|
|
395
407
|
}
|
|
396
408
|
};
|
|
397
|
-
|
|
409
|
+
ce.style = le;
|
|
398
410
|
export {
|
|
399
|
-
|
|
411
|
+
ce as nylas_scheduling
|
|
400
412
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-bd6fdc8c.cjs"),E=require("./index.es-c7ca1bad-0a324dca.cjs"),D=require("./scheduler-store-d4784b24-aed474e8.cjs"),N=require("./constants-c549b12b-c85413b1.cjs"),x=require("./feedbackSync-b56b29ed-b6f352f3.cjs");require("react");require("react-dom");class W{constructor({schedulerAPIURL:t,nylasSchedulerStore:i,sessionId:a,configId:o,slug:r,clientId:d}){if(!t)throw new Error("schedulerAPIURL is required");if(!i)throw new Error("nylasSchedulerStore is required");if(!a&&!o&&!(r||d))throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");t==="/"&&(t=new URL(window.location.href).origin),this.configId=o,this.sessionId=a,this.schedulerAPIURL=t,this.nylasSchedulerStore=i,this.slug=r,this.clientId=d}init(){e.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new D.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const I=(n,t)=>{const i=n.isLoading,a=n.showNotification,o=n.nylasBranding;return e.h(e.Fragment,null,a&&e.h("nylas-notification",null),i&&e.h("div",{class:"loading"},e.h("div",{class:"left"},e.h("div",{class:"skeleton"})),e.h("div",{class:"right"},e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}))),!i&&t,e.h("div",{class:"footer"},o&&e.h(e.Fragment,null,"Powered by ",e.h("nylas-logo",null))))},M=(n,t)=>e.h("div",{class:"message-banner"},t),$=':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-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;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{padding:0.5rem 4px 0;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}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.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}',G=$,j={title:e.instance.t("genericErrorTitle"),type:E.nr.Error,category:D.ErrorCategory.Component},H=class{constructor(n){e.registerInstance(this,n),this.init=e.createEvent(this,"init",7),this.schedulerWillLoad=e.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=e.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=e.createEvent(this,"nylasSchedulerError",7),this.configSettingsLoaded=e.createEvent(this,"configSettingsLoaded",7),this.bookingRefExtracted=e.createEvent(this,"bookingRefExtracted",7),this.bookedEventInfo=e.createEvent(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.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||`${e.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language,this.showFeedbackModal=!1,this.bookingInfoConfirmed=null}connectedCallback(){e.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var o,r;e.debug("[nylas-scheduler] Component will load"),this.enableUserFeedback&&!x.isInitialized()&&x.init({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.1.5",integrations:d=>[...d.filter(s=>!1),x.feedbackSyncIntegration({colorScheme:"system",autoInject:!1})],autoSessionTracking:!1,beforeSend:()=>null});const n=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerWillLoad(n,this.nylasSchedulerConnector),n.defaultPrevented))return;this.stores={scheduler:D.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,...this.defaultSchedulerState})},this.baseProvider=new E.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId;let t;if(this.rescheduleBookingRef){const[d,s,l]=e.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=d,this.stores.scheduler.set("rescheduleBookingId",s),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s})}else if(this.cancelBookingRef){const[d,s,l]=e.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=d,this.stores.scheduler.set("cancelBookingId",s),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s})}else if(this.organizerConfirmationBookingRef){const[d,s,l]=e.compactStringToUUIDs(this.organizerConfirmationBookingRef);this.refConfigId=d,this.stores.scheduler.set("organizerConfirmationBookingId",s),this.stores.scheduler.set("organizerConfirmationSalt",l),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s,salt:l})}if("bookingRefExtracted"in this.eventOverrides&&(await this.eventOverrides.bookingRefExtracted(t,this.nylasSchedulerConnector),t.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;const i=(o=this.baseProvider)==null?void 0:o.getStore("scheduler");this.nylasSchedulerConnector=new W({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:i});const a=this.init.emit(this.host);"init"in this.eventOverrides&&(await this.eventOverrides.init(a,this.nylasSchedulerConnector),a.defaultPrevented)||((r=this.baseProvider)==null||r.componentWillLoad(this.nylasSchedulerConnector),this.applyThemeConfig(this.themeConfig))}async componentDidLoad(){var l,u,b,h,c,g,m,C;(l=this.baseProvider)==null||l.componentDidLoad();const n=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerDidLoad(n,this.nylasSchedulerConnector),n.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;this.localizationChanged(this.localization);const t=await((u=this.nylasSchedulerConnector)==null?void 0:u.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t==null?void 0:t.error)},host:this.host});return}else{"data"in t&&((b=t.data)!=null&&b.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.");const f=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides&&(await this.eventOverrides.configSettingsLoaded(f,this.nylasSchedulerConnector),f.defaultPrevented))return}const i=(h=this.baseProvider)==null?void 0:h.getStore("scheduler"),a=(g=(c=i==null?void 0:i.get("configSettings"))==null?void 0:c.scheduler)==null?void 0:g.available_days_in_future,o=i==null?void 0:i.get("selectedTimeslot");if(o&&(o!=null&&o.start_time)){if(!this.isTimeslotValid(o))return;if(i!=null&&i.get("showBookingForm")){i==null||i.set("selectedDate",o.start_time);return}}const r=i==null?void 0:i.get("selectedDate"),d=i==null?void 0:i.get("availability");let s;if(!(d&&d.length>0)){if(r){const{startTime:f,endTime:v,endTimeForAvailableDaysInFuture:y}=this.validateAvailableDaysInFuture(r,a||30);r.getTime()<y*1e3&&(s=await((C=this.nylasSchedulerConnector)==null?void 0:C.scheduler.getAvailability(f,v)))}else{const f=new Date,{startTime:v,endTime:y,endTimeForAvailableDaysInFuture:B}=this.validateAvailableDaysInFuture(f,a||30);f.getTime()<B*1e3&&(s=await((m=this.nylasSchedulerConnector)==null?void 0:m.scheduler.getAvailability(v,y)))}if((!s||"error"in s)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(s==null?void 0:s.error)},host:this.host}),!r){let f=new Date;const v=i==null?void 0:i.get("availability").find(y=>new Date(y.start_time)>new Date);v&&(f=v.start_time),i==null||i.set("selectedDate",f)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var t;(t=this.stores)==null||t.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("rescheduleBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}cancelBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("cancelBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}organizerConfirmationBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("organizerConfirmationBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}localizationChanged(n){n&&Object.keys(n).forEach(t=>{t in N.LANGUAGE_CODE&&(e.instance.addResourceBundle(t,"translation",n[t],!1,!0),this.language=this.language)})}themeConfigChanged(n){this.applyThemeConfig(n)}languageChanged(n){const t=n.detail;this.language=t,e.instance.changeLanguage(t)}async registerComponentHandler(n){var t;(t=this.baseProvider)==null||t.registerComponent(n.detail)}async unregisterComponentHandler(n){var t;(t=this.baseProvider)==null||t.unregisterComponent(n.detail)}async monthChangedHandler(n){var d,s,l,u,b,h,c;const t=n.detail,i=(u=(l=(s=(d=this.nylasSchedulerConnector)==null?void 0:d.schedulerStore)==null?void 0:s.get("configSettings"))==null?void 0:l.scheduler)==null?void 0:u.available_days_in_future,{startTime:a,endTime:o,endTimeForAvailableDaysInFuture:r}=this.validateAvailableDaysInFuture(t,i||30);if(a<r&&t.getTime()<r*1e3){const g=await((b=this.nylasSchedulerConnector)==null?void 0:b.scheduler.getAvailability(a,o));(!g||"error"in g)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(g==null?void 0:g.error)},host:this.host});const m=(h=this.stores)==null?void 0:h.scheduler.get("selectableDates");m&&m.length>0&&((c=this.stores)==null||c.scheduler.set("selectedDate",m[0]))}}mapToBookingData(n){var d,s,l;const t=(d=this.stores)==null?void 0:d.scheduler.get("selectedTimeslot"),i=(s=this.stores)==null?void 0:s.scheduler.get("selectedLanguage"),a=(l=this.stores)==null?void 0:l.scheduler.get("selectedTimezone"),o=t!=null&&t.start_time?new Date(t==null?void 0:t.start_time).getTime()/1e3:"",r=t!=null&&t.end_time?new Date(t==null?void 0:t.end_time).getTime()/1e3:"";return{additional_guests:n.guests,guest:{...n.primaryParticipant},additional_fields:{...n.additionalFields},start_time:o,end_time:r,email_language:i,timezone:a}}async bookButtonClickedHandler(n){var l,u,b,h;if(n.defaultPrevented)return;const t=n.detail,i=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const o=(u=(l=this.nylasSchedulerConnector)==null?void 0:l.schedulerStore)==null?void 0:u.get("rescheduleBookingId");if(o){const c=await((b=this.nylasSchedulerConnector)==null?void 0:b.scheduler.rescheduleBooking(o,t));(!c||"error"in c)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(c==null?void 0:c.error)},host:this.host});const g=c==null?void 0:c.data,m=this.bookedEventInfo.emit({...c,data:{...g,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(m,this.nylasSchedulerConnector);return}const r=await((h=this.nylasSchedulerConnector)==null?void 0:h.scheduler.bookTimeslot(t));(!r||"error"in r)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r==null?void 0:r.error)},host:this.host});const d=r==null?void 0:r.data,s=this.bookedEventInfo.emit({...r,data:{...d,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(s,this.nylasSchedulerConnector)}dateSelectedHandler(n){const t=n.detail;this.selectedDateLabel=t?t.toLocaleDateString(void 0,{dateStyle:"full"}):`${e.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}confirmBookingErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=!1}feedbackSubmittedHandler(n){const i={eventId:x.captureMessage("Scheduling Page User Feedback"),message:n.detail.feedback};x.captureFeedback(i,{includeReplay:!0,captureContext:{tags:{"nylas-web-element":"nylas-schduling","nylas-web-element-version":"1.1.5"},extra:{configId:this.configurationId,slug:this.slug}}}),this.showFeedbackModal=!1}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||j.title,category:(n==null?void 0:n.category)||j.category,type:E.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let n="";return this.sessionId||(n+=e.instance.t("sessionIdRequiredErrorMessage")),!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)&&(n=e.instance.t("sessionIdRequiredErrorMessage")+" "+e.instance.t("publicConfigErrorMessage")),this.nylasSchedulerError.emit({notification:{title:e.instance.t("schedulingComponentErrorTitle"),category:D.ErrorCategory.Component,type:E.nr.Error,description:n,id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1}return!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:e.instance.t("invalidTimeslotErrorTitle"),category:D.ErrorCategory.Component,type:E.nr.Error,description:e.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,t){const i=new Date,a=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,o=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,r=Math.floor(e.addDaysToCurrentDate(i,t).getTime()/1e3),d=Math.min(r,o);return{startTime:a<i.getTime()/1e3?Math.floor(i.getTime()/1e3):a,endTime:d,endTimeForAvailableDaysInFuture:r}}applyThemeConfig(n){if(n)for(const[t,i]of Object.entries(n))this.host.style.setProperty(`${t}`,i)}onFeedbackClick(){this.showFeedbackModal=!0}redirectToCustomUrl(n){window.location.assign(n)}render(){var m,C,f,v,y,B,S,z,O,R;const n=this.mode==="app",t=(m=this.baseProvider)==null?void 0:m.getStore("scheduler"),i=t==null?void 0:t.get("eventInfo"),a=t==null?void 0:t.get("showBookingForm"),o=t==null?void 0:t.get("cancelledEventInfo"),r=t==null?void 0:t.get("cancelBookingId"),d=t==null?void 0:t.get("selectedTimeslot"),s=t==null?void 0:t.get("rescheduleBookingId"),l=t==null?void 0:t.get("organizerConfirmationBookingId"),u=t==null?void 0:t.get("rejectBookingId"),b=t==null?void 0:t.get("confirmedEventInfo"),h=(t==null?void 0:t.get("nylasBranding"))||this.nylasBranding,c=t==null?void 0:t.get("selectedDate"),g=(f=(C=t==null?void 0:t.get("configSettings"))==null?void 0:C.scheduler)==null?void 0:f.confirmation_redirect_url;if(this.selectedDateLabel=c&&this.language?e.capitalizeFirstLetter(c.toLocaleDateString(N.LANGUAGE_CODE_MAP[this.language],{dateStyle:"full"})):`${e.instance.t("noDateSelected")}`,n&&(r||u)&&!o)return e.h(e.Host,null,e.h(I,{nylasBranding:h,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e.h("nylas-cancel-booking-form",{selectedTimeslot:d,cancelBookingId:r,rejectBookingId:u,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&l)return e.h(e.Host,null,e.h(I,null,e.h("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e.h("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:l,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&o)return e.h(e.Host,null,e.h(I,{nylasBranding:h,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e.h("nylas-cancelled-event-card",{cancelledEventInfo:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&b)return e.h(e.Host,null,e.h(I,{nylasBranding:h,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e.h("nylas-confirmed-event-card",{confirmedEventInfo:b,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&i&&g){const k=(v=this.bookingInfoConfirmed)==null?void 0:v.primaryParticipant,T=((y=this.bookingInfoConfirmed)==null?void 0:y.additionalFields)||{};if(this.bookingInfo&&typeof((B=this.bookingInfo)==null?void 0:B.additionalFields)<"u"){const w=this.bookingInfo.additionalFields;Object.keys(w).forEach(L=>{!T[L]&&(w!=null&&w[L])&&(T[L]=w[L].value)})}const _=(S=this.stores)==null?void 0:S.scheduler.get("selectedTimeslot"),P=(z=this.stores)==null?void 0:z.scheduler.get("selectedTimezone"),U=(O=this.stores)==null?void 0:O.scheduler.get("selectedLanguage"),F=(R=this.stores)==null?void 0:R.scheduler.get("configSettings"),A=this.configurationId?this.configurationId:F==null?void 0:F.configuration_id,q=window.location.search,p=new URLSearchParams(q);p.set("booking_id",i.booking_id),k!=null&&k.name&&p.set("name",k.name),k!=null&&k.email&&p.set("email",k.email),_!=null&&_.start_time&&p.set("start_time",(new Date(_.start_time).getTime()/1e3).toString()),_!=null&&_.end_time&&p.set("end_time",(new Date(_.end_time).getTime()/1e3).toString()),P&&p.set("tz",P),U&&p.set("language",U),T&&p.set("additional_values",JSON.stringify(T)),this.slug&&p.set("page_slug",this.slug),A&&p.set("config_id",A),this.redirectToCustomUrl(`${g}?${p.toString()}`);return}if(n&&i)return e.h(e.Host,null,e.h(I,{nylasBranding:h,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"booked-event-page",part:"booked-event-page"},e.h("nylas-booked-event-card",{selectedTimeslot:d,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&(!i||s)&&!a){const k=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e.h(e.Host,null,e.h(I,{nylasBranding:h,isLoading:this.isLoading,showNotification:this.showNotification},s&&e.h(M,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"select-date-page",part:"select-date-page"},e.h("div",{class:"left-panel"},e.h("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"}),e.h("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"})),e.h("div",{class:`right-panel ${s?"reschedule":""}`},e.h("h2",null,e.h("calendar-icon",null),e.h("span",{id:"selectedDate"},this.selectedDateLabel)),e.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},k&&e.h("span",{slot:"timeslot-picker-cta-label"},e.h("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null))}return n&&!i&&a?e.h(e.Host,null,e.h(I,{nylasBranding:h,isLoading:this.isLoading,showNotification:this.showNotification},s&&e.h(M,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"additional-data-page",part:"additional-data-page"},e.h("div",{class:"left-panel"},e.h("div",{class:"wrapper"},e.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e.h("div",{class:`right-panel ${s?"reschedule":""}`},e.h("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&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null)):e.h(e.Host,null,e.h("slot",null))}get host(){return e.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};H.style=G;exports.nylas_scheduling=H;
|