@nylas/react 1.1.1 → 1.1.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/{add-circle-icon_2.entry-c6211866.cjs → add-circle-icon_2.entry-b77120e5.cjs} +1 -1
- package/dist/{add-circle-icon_2.entry-b14ecb5c.js → add-circle-icon_2.entry-fbc1e82b.js} +1 -1
- package/dist/{archive-icon_7.entry-3fe7721a.js → archive-icon_7.entry-30962e70.js} +13 -13
- package/dist/{archive-icon_7.entry-54fc1f03.cjs → archive-icon_7.entry-dd8c7642.cjs} +1 -1
- package/dist/{arrow-icon.entry-1dfee3bc.cjs → arrow-icon.entry-2dfd8319.cjs} +1 -1
- package/dist/{arrow-icon.entry-cc936041.js → arrow-icon.entry-5b436054.js} +1 -1
- package/dist/{bold-icon_3.entry-e2a1d434.js → bold-icon_3.entry-5120a9c8.js} +3 -3
- package/dist/{bold-icon_3.entry-4b9de887.cjs → bold-icon_3.entry-da2d1270.cjs} +1 -1
- package/dist/{button-component_2.entry-5666fdfa.cjs → button-component_2.entry-27a504d9.cjs} +1 -1
- package/dist/{button-component_2.entry-3639ade6.js → button-component_2.entry-697bf5ac.js} +7 -7
- package/dist/{calendar-agenda-fill-icon_48.entry-56e364cd.js → calendar-agenda-fill-icon_51.entry-52b5bf31.js} +993 -913
- package/dist/calendar-agenda-fill-icon_51.entry-a25262b3.cjs +7 -0
- package/dist/{calendar-cancel-icon.entry-ac1cb5dd.cjs → calendar-cancel-icon.entry-c6e2eed6.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-dcd777cd.js → calendar-cancel-icon.entry-e6a433a2.js} +1 -1
- package/dist/{calendar-check-icon_2.entry-7ad1b2a0.cjs → calendar-check-icon_2.entry-45cad6f1.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-6330bd2d.js → calendar-check-icon_2.entry-d88307d6.js} +1 -1
- package/dist/{calendar-icon.entry-8559fa0d.js → calendar-icon.entry-2badc962.js} +1 -1
- package/dist/{calendar-icon.entry-5849a547.cjs → calendar-icon.entry-b2fffd21.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-6cf5da6b.cjs → checkbox-component_2.entry-3926b644.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-1474c465.js → checkbox-component_2.entry-5ab55050.js} +3 -3
- package/dist/chevron-icon_3.entry-1fe5d097.cjs +1 -0
- package/dist/{chevron-icon_3.entry-cb757aa3.js → chevron-icon_3.entry-664fae5d.js} +19 -8
- package/dist/{clock-icon_4.entry-36a33de5.cjs → clock-icon_4.entry-efec2c08.cjs} +1 -1
- package/dist/{clock-icon_4.entry-642f4dc6.js → clock-icon_4.entry-f11f9dad.js} +13 -13
- package/dist/{constants-50c3e067-83f1d865.js → constants-50c3e067-33cf0ffe.js} +1 -1
- package/dist/{constants-50c3e067-4e027da4.cjs → constants-50c3e067-5ec3f879.cjs} +1 -1
- package/dist/{copy-icon.entry-fb63cf53.cjs → copy-icon.entry-3965f206.cjs} +1 -1
- package/dist/{copy-icon.entry-60740516.js → copy-icon.entry-70131e8e.js} +1 -1
- package/dist/{delete-icon_2.entry-d1af0606.cjs → delete-icon.entry-5d067fef.cjs} +1 -1
- package/dist/{delete-icon_2.entry-45851bc5.js → delete-icon.entry-e003695d.js} +4 -14
- package/dist/{document-refresh-icon.entry-1731d4d9.cjs → document-refresh-icon.entry-30c974df.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-5db0830a.js → document-refresh-icon.entry-b4e01cd4.js} +1 -1
- package/dist/elements/index.d.ts +2 -0
- package/dist/{elements-dc5b338e-3099ee02.js → elements-dc5b338e-55823d00.js} +1 -1
- package/dist/{elements-dc5b338e-ab9afb63.cjs → elements-dc5b338e-6883a39e.cjs} +1 -1
- package/dist/feedbackSync-81d4c4d8-dd4d2e32.js +11735 -0
- package/dist/feedbackSync-81d4c4d8-f4e78902.cjs +455 -0
- package/dist/{focus-visible-e8093c16-811f50fa.cjs → focus-visible-e8093c16-431bbe59.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-067a8f23.js → focus-visible-e8093c16-f403fee8.js} +1 -1
- package/dist/{forward-icon_6.entry-e7c5fa46.js → forward-icon_6.entry-3bb91d58.js} +7 -7
- package/dist/{forward-icon_6.entry-4e9c9686.cjs → forward-icon_6.entry-ceec2371.cjs} +3 -3
- package/dist/{globe-icon.entry-aa3f3ea3.js → globe-icon.entry-6fc456c7.js} +5 -5
- package/dist/{globe-icon.entry-74f79652.cjs → globe-icon.entry-8c3c9e48.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-4eb16cd2.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-3fe41d69.js → google-logo-icon_4.entry-d6e0c4c0.js} +331 -289
- package/dist/index-11f33e47.cjs +82 -0
- package/dist/{index-a134f625.js → index-a282e817.js} +2890 -2792
- package/dist/{index.es-79f5b771-64a1baf0.cjs → index.es-ab9affcc-18263b66.cjs} +1 -1
- package/dist/{index.es-79f5b771-ce07d6fc.js → index.es-ab9affcc-30461b18.js} +1 -1
- package/dist/{info-icon_2.entry-fed731f4.js → info-icon_2.entry-d20b975c.js} +5 -5
- package/dist/{info-icon_2.entry-a3f40027.cjs → info-icon_2.entry-e582ac10.cjs} +1 -1
- package/dist/{input-color-picker.entry-37826630.js → input-color-picker.entry-27f4288f.js} +3 -3
- package/dist/{input-color-picker.entry-cbdce7a1.cjs → input-color-picker.entry-c6a28671.cjs} +1 -1
- package/dist/{input-component.entry-e71b7062.cjs → input-component.entry-744fcec1.cjs} +1 -1
- package/dist/{input-component.entry-b83b7103.js → input-component.entry-b6f1c417.js} +2 -2
- package/dist/{input-dropdown.entry-db0dae5f.js → input-dropdown.entry-18744def.js} +2 -2
- package/dist/{input-dropdown.entry-150819cd.cjs → input-dropdown.entry-f13234d7.cjs} +1 -1
- package/dist/{mailbox-store-9c52a3fa-04f22f60.cjs → mailbox-store-affca6de-9451094e.cjs} +1 -1
- package/dist/{mailbox-store-9c52a3fa-80fe343c.js → mailbox-store-affca6de-d601dc6b.js} +2 -2
- package/dist/{multi-select-dropdown.entry-6b429b39.js → multi-select-dropdown.entry-924809e1.js} +5 -5
- package/dist/{multi-select-dropdown.entry-629329d7.cjs → multi-select-dropdown.entry-dde671d7.cjs} +1 -1
- package/dist/{nylas-booked-event-card_12.entry-c22c02b4.js → nylas-booked-event-card_12.entry-52c3111d.js} +203 -198
- package/dist/nylas-booked-event-card_12.entry-d89c1f9d.cjs +1 -0
- package/dist/{nylas-form-card.entry-2ced5eef.cjs → nylas-form-card.entry-ab61fdc5.cjs} +1 -1
- package/dist/{nylas-form-card.entry-f3d6a1e4.js → nylas-form-card.entry-b0a2403f.js} +8 -8
- package/dist/{nylas-if-state.entry-862ad978.js → nylas-if-state.entry-523fdc6b.js} +2 -2
- package/dist/{nylas-if-state.entry-55c32c0c.cjs → nylas-if-state.entry-53883c36.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-77e936f7.cjs → nylas-list-folders.entry-4ef6cb3d.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-544fd38d.js → nylas-list-folders.entry-e37d069f.js} +8 -8
- package/dist/{nylas-list-threads.entry-82e04782.cjs → nylas-list-threads.entry-3be623e9.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-71411da7.js → nylas-list-threads.entry-8ba62db8.js} +3 -3
- package/dist/{nylas-login.entry-3ccc2bef.cjs → nylas-login.entry-05e1df3e.cjs} +1 -1
- package/dist/{nylas-login.entry-48179c01.js → nylas-login.entry-d9bf3974.js} +5 -5
- package/dist/{nylas-mailbox-pagination.entry-d31f9aa4.cjs → nylas-mailbox-pagination.entry-3dd05cf4.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-77cf03b5.js → nylas-mailbox-pagination.entry-50d9d9e3.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-40e3c373.js → nylas-mailbox-toolbar-button.entry-9a77d137.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-33aad610.cjs → nylas-mailbox-toolbar-button.entry-d87b55de.cjs} +1 -1
- package/dist/{nylas-mailbox.entry-f4066fb2.js → nylas-mailbox.entry-cb7d1031.js} +3 -3
- package/dist/{nylas-mailbox.entry-963de1c3.cjs → nylas-mailbox.entry-f7db9aa8.cjs} +1 -1
- package/dist/{nylas-provider.entry-08767da3.cjs → nylas-provider.entry-1716bf48.cjs} +1 -1
- package/dist/{nylas-provider.entry-c61428b1.js → nylas-provider.entry-7aa46ea2.js} +37 -37
- package/dist/{nylas-reminder-emails.entry-d42a7f1d.cjs → nylas-reminder-emails.entry-88a862cd.cjs} +2 -2
- package/dist/{nylas-reminder-emails.entry-cd8e1d2e.js → nylas-reminder-emails.entry-a86231b7.js} +5 -5
- package/dist/{nylas-reminder-time_2.entry-d7115393.js → nylas-reminder-time_2.entry-9589d5f2.js} +4 -4
- package/dist/{nylas-reminder-time_2.entry-e5540fdd.cjs → nylas-reminder-time_2.entry-bc76d4ab.cjs} +1 -1
- package/dist/{nylas-scheduler-editor.entry-67904653.cjs → nylas-scheduler-editor.entry-1a2f3ee0.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-65eb4938.js → nylas-scheduler-editor.entry-b434b526.js} +10 -10
- package/dist/nylas-scheduling.entry-59e5e8c1.cjs +1 -0
- package/dist/nylas-scheduling.entry-b71080c8.js +400 -0
- package/dist/{nylas-threads-refresh.entry-d025575a.js → nylas-threads-refresh.entry-544ca90a.js} +2 -2
- package/dist/{nylas-threads-refresh.entry-1b8befab.cjs → nylas-threads-refresh.entry-7ada7b2d.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-a254c36e.js → nylas-threads-search.entry-181ba46a.js} +17 -17
- package/dist/{nylas-threads-search.entry-78c06183.cjs → nylas-threads-search.entry-f1cb19e4.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-30baeb50.cjs → nylas-time-window-picker.entry-a6d1c648.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-89c15823.js → nylas-time-window-picker.entry-c1ee860a.js} +2 -2
- package/dist/{nylas-view-thread.entry-939a4561.cjs → nylas-view-thread.entry-6ae8dd64.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-c8d56573.js → nylas-view-thread.entry-c066f522.js} +6 -6
- package/dist/{person-icon.entry-5ab75598.cjs → person-icon.entry-80c9022e.cjs} +1 -1
- package/dist/{person-icon.entry-8aef4041.js → person-icon.entry-8833e3cc.js} +4 -4
- package/dist/{play-icon_2.entry-392ad303.cjs → play-icon_2.entry-801c85bc.cjs} +1 -1
- package/dist/{play-icon_2.entry-4b068c1b.js → play-icon_2.entry-efca8f00.js} +3 -3
- package/dist/react.cjs +1 -1
- package/dist/react.js +118 -116
- package/dist/{refresh-icon.entry-a754a2b5.js → refresh-icon.entry-4d6791bd.js} +4 -4
- package/dist/{refresh-icon.entry-9ea254c9.cjs → refresh-icon.entry-d4cc16b7.cjs} +1 -1
- package/dist/{register-component-ea95564d-ab3d630f.cjs → register-component-a7ea27ad-2343f3df.cjs} +1 -1
- package/dist/{register-component-ea95564d-e19ec159.js → register-component-a7ea27ad-fa2c4b17.js} +1 -1
- package/dist/{scheduler-config-store-2a3b403d-4e10b542.cjs → scheduler-config-store-2a3b403d-2263f999.cjs} +1 -1
- package/dist/{scheduler-config-store-2a3b403d-581c70cf.js → scheduler-config-store-2a3b403d-5176cd45.js} +1 -1
- package/dist/{scheduler-store-9ff4914b-b71a0aca.js → scheduler-store-33ab8dea-9801357a.js} +2 -2
- package/dist/scheduler-store-33ab8dea-a0b39d36.cjs +1 -0
- package/dist/{textarea-component.entry-70bb02bf.cjs → textarea-component.entry-019e75d0.cjs} +1 -1
- package/dist/{textarea-component.entry-a5daab6c.js → textarea-component.entry-174089bc.js} +2 -2
- package/dist/{time-period-selector.entry-25348de7.js → time-period-selector.entry-62c854d1.js} +4 -4
- package/dist/{time-period-selector.entry-6306e456.cjs → time-period-selector.entry-8466d0f2.cjs} +1 -1
- package/dist/{translate-icon.entry-b6094ecc.js → translate-icon.entry-73f7127b.js} +4 -4
- package/dist/{translate-icon.entry-785fa109.cjs → translate-icon.entry-7d5cf4b8.cjs} +1 -1
- package/dist/{warning-icon.entry-94e34c58.cjs → warning-icon.entry-92638eeb.cjs} +1 -1
- package/dist/{warning-icon.entry-4b400ee2.js → warning-icon.entry-abf896c3.js} +5 -5
- package/package.json +2 -2
- package/dist/calendar-agenda-fill-icon_48.entry-bf278e34.cjs +0 -7
- package/dist/chevron-icon_3.entry-41170718.cjs +0 -1
- package/dist/google-logo-icon_4.entry-0332a181.cjs +0 -1
- package/dist/index-2a53b6a8.cjs +0 -82
- package/dist/nylas-booked-event-card_12.entry-660af56a.cjs +0 -1
- package/dist/nylas-scheduling.entry-50e41d85.cjs +0 -1
- package/dist/nylas-scheduling.entry-7aad4f63.js +0 -345
- package/dist/scheduler-store-9ff4914b-6e28240e.cjs +0 -1
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { k as h, r as z, c as _, d as E, l as I, m as O, n as N, h as n, H as y, g as A, F as D } from "./index-a134f625.js";
|
|
2
|
-
import { n as x, N as P } from "./index.es-79f5b771-ce07d6fc.js";
|
|
3
|
-
import { E as B, C as F, N as S } from "./scheduler-store-9ff4914b-b71a0aca.js";
|
|
4
|
-
import { L as j, a as M } from "./constants-50c3e067-83f1d865.js";
|
|
5
|
-
import "react";
|
|
6
|
-
import "react-dom";
|
|
7
|
-
class H {
|
|
8
|
-
constructor({ schedulerAPIURL: e, nylasSchedulerStore: i, sessionId: o, configId: s, slug: d, clientId: r }) {
|
|
9
|
-
if (!e)
|
|
10
|
-
throw new Error("schedulerAPIURL is required");
|
|
11
|
-
if (!i)
|
|
12
|
-
throw new Error("nylasSchedulerStore is required");
|
|
13
|
-
if (!o && !s && !(d || r))
|
|
14
|
-
throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");
|
|
15
|
-
e === "/" && (e = new URL(window.location.href).origin), this.configId = s, this.sessionId = o, this.schedulerAPIURL = e, this.nylasSchedulerStore = i, this.slug = d, this.clientId = r;
|
|
16
|
-
}
|
|
17
|
-
init() {
|
|
18
|
-
E("NylasConnector init");
|
|
19
|
-
}
|
|
20
|
-
get schedulerStore() {
|
|
21
|
-
return this.nylasSchedulerStore;
|
|
22
|
-
}
|
|
23
|
-
get scheduler() {
|
|
24
|
-
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new S({
|
|
25
|
-
schedulerAPIURL: this.schedulerAPIURL,
|
|
26
|
-
schedulerStore: this.schedulerStore,
|
|
27
|
-
sessionId: this.sessionId,
|
|
28
|
-
configId: this.configId,
|
|
29
|
-
slug: this.slug,
|
|
30
|
-
clientId: this.clientId
|
|
31
|
-
}), this._schedulerAPIConnector);
|
|
32
|
-
}
|
|
33
|
-
resetStores() {
|
|
34
|
-
this.nylasSchedulerStore.reset();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const k = (t, e) => {
|
|
38
|
-
const i = t.isLoading, o = t.showNotification, s = t.nylasBranding;
|
|
39
|
-
return n(
|
|
40
|
-
D,
|
|
41
|
-
null,
|
|
42
|
-
o && n("nylas-notification", null),
|
|
43
|
-
i && n(
|
|
44
|
-
"div",
|
|
45
|
-
{ class: "loading" },
|
|
46
|
-
n(
|
|
47
|
-
"div",
|
|
48
|
-
{ class: "left" },
|
|
49
|
-
n("div", { class: "skeleton" })
|
|
50
|
-
),
|
|
51
|
-
n(
|
|
52
|
-
"div",
|
|
53
|
-
{ class: "right" },
|
|
54
|
-
n("div", { class: "skeleton" }),
|
|
55
|
-
n("div", { class: "skeleton" }),
|
|
56
|
-
n("div", { class: "skeleton" }),
|
|
57
|
-
n("div", { class: "skeleton" }),
|
|
58
|
-
n("div", { class: "skeleton" })
|
|
59
|
-
)
|
|
60
|
-
),
|
|
61
|
-
!i && e,
|
|
62
|
-
n("div", { class: "footer" }, s && n(
|
|
63
|
-
D,
|
|
64
|
-
null,
|
|
65
|
-
"Powered by ",
|
|
66
|
-
n("nylas-logo", null)
|
|
67
|
-
))
|
|
68
|
-
);
|
|
69
|
-
}, L = (t, e) => n("div", { class: "message-banner" }, e), U = ':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}', W = U, T = { title: h.t("genericErrorTitle"), type: x.Error, category: B.Component }, $ = class {
|
|
70
|
-
constructor(t) {
|
|
71
|
-
z(this, t), this.init = _(this, "init", 7), this.schedulerWillLoad = _(this, "schedulerWillLoad", 7), this.schedulerDidLoad = _(this, "schedulerDidLoad", 7), this.nylasSchedulerError = _(this, "nylasSchedulerError", 7), this.configSettingsLoaded = _(this, "configSettingsLoaded", 7), this.bookingRefExtracted = _(this, "bookingRefExtracted", 7), this.bookedEventInfo = _(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.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || `${h.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language;
|
|
72
|
-
}
|
|
73
|
-
connectedCallback() {
|
|
74
|
-
E("[nylas-scheduler] connectedCallback");
|
|
75
|
-
}
|
|
76
|
-
async componentWillLoad() {
|
|
77
|
-
var s, d;
|
|
78
|
-
E("[nylas-scheduler] Component will load");
|
|
79
|
-
const t = this.schedulerWillLoad.emit(this.host);
|
|
80
|
-
if ("schedulerWillLoad" in this.eventOverrides && (await this.eventOverrides.schedulerWillLoad(t, this.nylasSchedulerConnector), t.defaultPrevented))
|
|
81
|
-
return;
|
|
82
|
-
this.stores = {
|
|
83
|
-
scheduler: F({
|
|
84
|
-
bookingInfo: this.bookingInfo,
|
|
85
|
-
nylasBranding: this.nylasBranding,
|
|
86
|
-
...this.defaultSchedulerState
|
|
87
|
-
})
|
|
88
|
-
}, this.baseProvider = new P(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
|
|
89
|
-
let e;
|
|
90
|
-
if (this.rescheduleBookingRef) {
|
|
91
|
-
const [r, a, l] = I(this.rescheduleBookingRef);
|
|
92
|
-
this.refConfigId = r, this.stores.scheduler.set("rescheduleBookingId", a), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: a });
|
|
93
|
-
} else if (this.cancelBookingRef) {
|
|
94
|
-
const [r, a, l] = I(this.cancelBookingRef);
|
|
95
|
-
this.refConfigId = r, this.stores.scheduler.set("cancelBookingId", a), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: a });
|
|
96
|
-
} else if (this.organizerConfirmationBookingRef) {
|
|
97
|
-
const [r, a, l] = I(this.organizerConfirmationBookingRef);
|
|
98
|
-
this.refConfigId = r, this.stores.scheduler.set("organizerConfirmationBookingId", a), this.stores.scheduler.set("organizerConfirmationSalt", l), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: a, salt: l });
|
|
99
|
-
}
|
|
100
|
-
if ("bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(e, this.nylasSchedulerConnector), e.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
101
|
-
return;
|
|
102
|
-
const i = (s = this.baseProvider) == null ? void 0 : s.getStore("scheduler");
|
|
103
|
-
this.nylasSchedulerConnector = new H({
|
|
104
|
-
schedulerAPIURL: this.schedulerApiUrl,
|
|
105
|
-
sessionId: this.sessionId,
|
|
106
|
-
configId: this.refConfigId,
|
|
107
|
-
slug: this.slug,
|
|
108
|
-
clientId: this.clientId,
|
|
109
|
-
nylasSchedulerStore: i
|
|
110
|
-
});
|
|
111
|
-
const o = this.init.emit(this.host);
|
|
112
|
-
"init" in this.eventOverrides && (await this.eventOverrides.init(o, this.nylasSchedulerConnector), o.defaultPrevented) || ((d = this.baseProvider) == null || d.componentWillLoad(this.nylasSchedulerConnector), this.applyThemeConfig(this.themeConfig));
|
|
113
|
-
}
|
|
114
|
-
async componentDidLoad() {
|
|
115
|
-
var l, c, p, g, b, u, m, w;
|
|
116
|
-
(l = this.baseProvider) == null || l.componentDidLoad();
|
|
117
|
-
const t = this.schedulerDidLoad.emit(this.host);
|
|
118
|
-
if ("schedulerDidLoad" in this.eventOverrides && (await this.eventOverrides.schedulerDidLoad(t, this.nylasSchedulerConnector), t.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
119
|
-
return;
|
|
120
|
-
this.localizationChanged(this.localization);
|
|
121
|
-
const e = await ((c = this.nylasSchedulerConnector) == null ? void 0 : c.scheduler.getUISettings());
|
|
122
|
-
if (!e || "error" in e)
|
|
123
|
-
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(e == null ? void 0 : e.error) }, host: this.host });
|
|
124
|
-
else {
|
|
125
|
-
"data" in e && ((p = e.data) != null && p.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.");
|
|
126
|
-
const f = this.configSettingsLoaded.emit({ settings: e });
|
|
127
|
-
if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(f, this.nylasSchedulerConnector), f.defaultPrevented))
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const i = (g = this.baseProvider) == null ? void 0 : g.getStore("scheduler"), o = (u = (b = i == null ? void 0 : i.get("configSettings")) == null ? void 0 : b.scheduler) == null ? void 0 : u.available_days_in_future, s = i == null ? void 0 : i.get("selectedTimeslot");
|
|
131
|
-
if (s && (s != null && s.start_time)) {
|
|
132
|
-
if (!this.isTimeslotValid(s))
|
|
133
|
-
return;
|
|
134
|
-
if (i != null && i.get("showBookingForm")) {
|
|
135
|
-
i == null || i.set("selectedDate", s.start_time);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
const d = i == null ? void 0 : i.get("selectedDate"), r = i == null ? void 0 : i.get("availability");
|
|
140
|
-
let a;
|
|
141
|
-
if (!(r && r.length > 0)) {
|
|
142
|
-
if (d) {
|
|
143
|
-
const { startTime: f, endTime: v, endTimeForAvailableDaysInFuture: C } = this.validateAvailableDaysInFuture(d, o || 30);
|
|
144
|
-
d.getTime() < C * 1e3 && (a = await ((w = this.nylasSchedulerConnector) == null ? void 0 : w.scheduler.getAvailability(f, v)));
|
|
145
|
-
} else {
|
|
146
|
-
const f = /* @__PURE__ */ new Date(), { startTime: v, endTime: C, endTimeForAvailableDaysInFuture: R } = this.validateAvailableDaysInFuture(f, o || 30);
|
|
147
|
-
f.getTime() < R * 1e3 && (a = await ((m = this.nylasSchedulerConnector) == null ? void 0 : m.scheduler.getAvailability(v, C)));
|
|
148
|
-
}
|
|
149
|
-
if ((!a || "error" in a) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(a == null ? void 0 : a.error) }, host: this.host }), !d) {
|
|
150
|
-
let f = /* @__PURE__ */ new Date();
|
|
151
|
-
const v = i == null ? void 0 : i.get("availability").find((C) => new Date(C.start_time) > /* @__PURE__ */ new Date());
|
|
152
|
-
v && (f = v.start_time), i == null || i.set("selectedDate", f);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
componentDisconnected() {
|
|
157
|
-
var t;
|
|
158
|
-
(t = this.baseProvider) == null || t.componentDisconnected();
|
|
159
|
-
}
|
|
160
|
-
bookingInfoChanged(t) {
|
|
161
|
-
var e;
|
|
162
|
-
(e = this.stores) == null || e.scheduler.set("bookingInfo", t);
|
|
163
|
-
}
|
|
164
|
-
rescheduleBookingRefChanged(t) {
|
|
165
|
-
var e, i;
|
|
166
|
-
if (t) {
|
|
167
|
-
const [o, s] = I(t);
|
|
168
|
-
(e = this.stores) == null || e.scheduler.set("rescheduleBookingId", s), this.refConfigId = o, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(o);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
cancelBookingRefChanged(t) {
|
|
172
|
-
var e, i;
|
|
173
|
-
if (t) {
|
|
174
|
-
const [o, s] = I(t);
|
|
175
|
-
(e = this.stores) == null || e.scheduler.set("cancelBookingId", s), this.refConfigId = o, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(o);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
organizerConfirmationBookingRefChanged(t) {
|
|
179
|
-
var e, i;
|
|
180
|
-
if (t) {
|
|
181
|
-
const [o, s] = I(t);
|
|
182
|
-
(e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId", s), this.refConfigId = o, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(o);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
localizationChanged(t) {
|
|
186
|
-
t && Object.keys(t).forEach((e) => {
|
|
187
|
-
e in j && (h.addResourceBundle(e, "translation", t[e], !1, !0), this.language = this.language);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
themeConfigChanged(t) {
|
|
191
|
-
this.applyThemeConfig(t);
|
|
192
|
-
}
|
|
193
|
-
languageChanged(t) {
|
|
194
|
-
const e = t.detail;
|
|
195
|
-
this.language = e, h.changeLanguage(e);
|
|
196
|
-
}
|
|
197
|
-
async registerComponentHandler(t) {
|
|
198
|
-
var e;
|
|
199
|
-
(e = this.baseProvider) == null || e.registerComponent(t.detail);
|
|
200
|
-
}
|
|
201
|
-
async unregisterComponentHandler(t) {
|
|
202
|
-
var e;
|
|
203
|
-
(e = this.baseProvider) == null || e.unregisterComponent(t.detail);
|
|
204
|
-
}
|
|
205
|
-
async monthChangedHandler(t) {
|
|
206
|
-
var r, a, l, c, p, g, b;
|
|
207
|
-
const e = t.detail, i = (c = (l = (a = (r = this.nylasSchedulerConnector) == null ? void 0 : r.schedulerStore) == null ? void 0 : a.get("configSettings")) == null ? void 0 : l.scheduler) == null ? void 0 : c.available_days_in_future, { startTime: o, endTime: s, endTimeForAvailableDaysInFuture: d } = this.validateAvailableDaysInFuture(e, i || 30);
|
|
208
|
-
if (o < d && e.getTime() < d * 1e3) {
|
|
209
|
-
const u = await ((p = this.nylasSchedulerConnector) == null ? void 0 : p.scheduler.getAvailability(o, s));
|
|
210
|
-
(!u || "error" in u) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(u == null ? void 0 : u.error) }, host: this.host });
|
|
211
|
-
const m = (g = this.stores) == null ? void 0 : g.scheduler.get("selectableDates");
|
|
212
|
-
m && m.length > 0 && ((b = this.stores) == null || b.scheduler.set("selectedDate", m[0]));
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
async bookButtonClickedHandler(t) {
|
|
216
|
-
var d, r, a, l;
|
|
217
|
-
const i = (r = (d = this.nylasSchedulerConnector) == null ? void 0 : d.schedulerStore) == null ? void 0 : r.get("rescheduleBookingId");
|
|
218
|
-
if (i) {
|
|
219
|
-
const c = await ((a = this.nylasSchedulerConnector) == null ? void 0 : a.scheduler.rescheduleBooking(i, t.detail));
|
|
220
|
-
(!c || "error" in c) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(c == null ? void 0 : c.error) }, host: this.host });
|
|
221
|
-
const p = this.bookedEventInfo.emit({ ...c });
|
|
222
|
-
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(p, this.nylasSchedulerConnector);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const o = await ((l = this.nylasSchedulerConnector) == null ? void 0 : l.scheduler.bookTimeslot(t.detail));
|
|
226
|
-
(!o || "error" in o) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(o == null ? void 0 : o.error) }, host: this.host });
|
|
227
|
-
const s = this.bookedEventInfo.emit({ ...o });
|
|
228
|
-
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(s, this.nylasSchedulerConnector);
|
|
229
|
-
}
|
|
230
|
-
dateSelectedHandler(t) {
|
|
231
|
-
const e = t.detail;
|
|
232
|
-
this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : `${h.t("noDateSelected")}`;
|
|
233
|
-
}
|
|
234
|
-
cancelBookedEventErrorHandler(t) {
|
|
235
|
-
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
236
|
-
}
|
|
237
|
-
cancelBookedEventValidationErrorHandler(t) {
|
|
238
|
-
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
239
|
-
}
|
|
240
|
-
rescheduleBookedEventErrorHandler(t) {
|
|
241
|
-
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
242
|
-
}
|
|
243
|
-
confirmBookingErrorHandler(t) {
|
|
244
|
-
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
245
|
-
}
|
|
246
|
-
async getNylasSchedulerStore() {
|
|
247
|
-
var t;
|
|
248
|
-
return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
|
|
249
|
-
}
|
|
250
|
-
async getNylasSchedulerConnector() {
|
|
251
|
-
return this.nylasSchedulerConnector;
|
|
252
|
-
}
|
|
253
|
-
async getRef() {
|
|
254
|
-
return this.host;
|
|
255
|
-
}
|
|
256
|
-
getErrorObject(t) {
|
|
257
|
-
return {
|
|
258
|
-
title: (t == null ? void 0 : t.title) || T.title,
|
|
259
|
-
category: (t == null ? void 0 : t.category) || T.category,
|
|
260
|
-
type: x.Error,
|
|
261
|
-
description: (t == null ? void 0 : t.message) || "",
|
|
262
|
-
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
263
|
-
ttl: "none"
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
checkIfSessionIdOrConfigIdExists() {
|
|
267
|
-
if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {
|
|
268
|
-
let t = "";
|
|
269
|
-
return this.sessionId || (t += h.t("sessionIdRequiredErrorMessage")), !this.sessionId && !this.refConfigId && !(this.slug && this.clientId) && (t = h.t("sessionIdRequiredErrorMessage") + " " + h.t("publicConfigErrorMessage")), this.nylasSchedulerError.emit({
|
|
270
|
-
notification: {
|
|
271
|
-
title: h.t("schedulingComponentErrorTitle"),
|
|
272
|
-
category: B.Component,
|
|
273
|
-
type: x.Error,
|
|
274
|
-
description: t,
|
|
275
|
-
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
276
|
-
ttl: "none"
|
|
277
|
-
},
|
|
278
|
-
host: this.host
|
|
279
|
-
}), !1;
|
|
280
|
-
}
|
|
281
|
-
return !0;
|
|
282
|
-
}
|
|
283
|
-
isTimeslotValid(t) {
|
|
284
|
-
return new Date(t.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
|
|
285
|
-
notification: {
|
|
286
|
-
title: h.t("invalidTimeslotErrorTitle"),
|
|
287
|
-
category: B.Component,
|
|
288
|
-
type: x.Error,
|
|
289
|
-
description: h.t("invalidTimeslotErrorMessage"),
|
|
290
|
-
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
291
|
-
ttl: "none"
|
|
292
|
-
},
|
|
293
|
-
host: this.host
|
|
294
|
-
}), !1) : !0;
|
|
295
|
-
}
|
|
296
|
-
validateAvailableDaysInFuture(t, e) {
|
|
297
|
-
const i = /* @__PURE__ */ new Date(), o = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, s = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, d = Math.floor(O(i, e).getTime() / 1e3), r = Math.min(d, s);
|
|
298
|
-
return { startTime: o < i.getTime() / 1e3 ? Math.floor(i.getTime() / 1e3) : o, endTime: r, endTimeForAvailableDaysInFuture: d };
|
|
299
|
-
}
|
|
300
|
-
applyThemeConfig(t) {
|
|
301
|
-
if (t)
|
|
302
|
-
for (const [e, i] of Object.entries(t))
|
|
303
|
-
this.host.style.setProperty(`${e}`, i);
|
|
304
|
-
}
|
|
305
|
-
render() {
|
|
306
|
-
var m, w, f;
|
|
307
|
-
const t = this.mode === "app", e = (m = this.baseProvider) == null ? void 0 : m.getStore("scheduler"), i = e == null ? void 0 : e.get("eventInfo"), o = e == null ? void 0 : e.get("showBookingForm"), s = e == null ? void 0 : e.get("cancelledEventInfo"), d = e == null ? void 0 : e.get("cancelBookingId"), r = e == null ? void 0 : e.get("selectedTimeslot"), a = e == null ? void 0 : e.get("rescheduleBookingId"), l = e == null ? void 0 : e.get("organizerConfirmationBookingId"), c = e == null ? void 0 : e.get("rejectBookingId"), p = e == null ? void 0 : e.get("confirmedEventInfo"), g = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, b = e == null ? void 0 : e.get("selectedDate"), u = (f = (w = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : w.scheduler) == null ? void 0 : f.confirmation_redirect_url;
|
|
308
|
-
if (this.selectedDateLabel = b && this.language ? N(b.toLocaleDateString(M[this.language], { dateStyle: "full" })) : `${h.t("noDateSelected")}`, t && (d || c) && !s)
|
|
309
|
-
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, n("nylas-cancel-booking-form", { selectedTimeslot: r, cancelBookingId: d, rejectBookingId: c, exportparts: "ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card" }))));
|
|
310
|
-
if (t && l)
|
|
311
|
-
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, 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" }))));
|
|
312
|
-
if (t && s)
|
|
313
|
-
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, n("nylas-cancelled-event-card", { cancelledEventInfo: s, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
|
|
314
|
-
if (t && p)
|
|
315
|
-
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "confirmed-event-page" }, n("nylas-confirmed-event-card", { confirmedEventInfo: p, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
|
|
316
|
-
if (t && i && u) {
|
|
317
|
-
window.location.assign(u);
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
if (t && i)
|
|
321
|
-
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "booked-event-page", part: "booked-event-page" }, n("nylas-booked-event-card", { selectedTimeslot: r, eventInfo: i, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))));
|
|
322
|
-
if (t && (!i || a) && !o) {
|
|
323
|
-
const v = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
|
|
324
|
-
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, a && n(L, null, `${h.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 ${a ? "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" })))))));
|
|
325
|
-
}
|
|
326
|
-
return t && !i && o ? n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, a && n(L, null, `${h.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 ${a ? "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" }))))) : n(y, null, n("slot", null));
|
|
327
|
-
}
|
|
328
|
-
get host() {
|
|
329
|
-
return A(this);
|
|
330
|
-
}
|
|
331
|
-
static get watchers() {
|
|
332
|
-
return {
|
|
333
|
-
bookingInfo: ["bookingInfoChanged"],
|
|
334
|
-
rescheduleBookingRef: ["rescheduleBookingRefChanged"],
|
|
335
|
-
cancelBookingRef: ["cancelBookingRefChanged"],
|
|
336
|
-
organizerConfirmationBookingRef: ["organizerConfirmationBookingRefChanged"],
|
|
337
|
-
localization: ["localizationChanged"],
|
|
338
|
-
themeConfig: ["themeConfigChanged"]
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
$.style = W;
|
|
343
|
-
export {
|
|
344
|
-
$ as nylas_scheduling
|
|
345
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("./index-2a53b6a8.cjs");exports.ErrorCategory=void 0;(function(a){a.Component="component",a.Api="api",a.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var B;(function(a){a.endtime_not_in_future="endtime_not_in_future",a.no_booking_info="no_booking_info",a.no_timeslot_selected="no_timeslot_selected",a.no_timezone_selected="no_timezone_selected",a.no_booking_id="no_booking_id",a.no_salt="no_salt",a.invalid_start_time="invalid_start_time",a.invalid_end_time="invalid_end_time",a.invalid_timezone="invalid_timezone"})(B||(B={}));var E;(function(a){a.invalid_session="invalid_session",a.general_error="general_error",a.internal_error="internal_error",a.invalid_request_error="invalid_request_error",a.timeslot_not_available="timeslot_not_available",a.provider_error="provider_error",a.not_found_error="not_found_error"})(E||(E={}));class C{constructor(){this.component=e=>{const t=exports.ErrorCategory.Component,s=`${e} Error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:t}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:t}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:t}),no_timezone_selected:(i="No timezone selected")=>({title:s,message:i,category:t}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:t}),no_salt:(i="No salt provided")=>({title:s,message:i,category:t}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:t}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:t}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:t})}},this.api=e=>{const t=exports.ErrorCategory.Api,s=`${e} Error`;return{invalid_session:i=>({title:s,message:i,category:t}),general_error:i=>({title:s,message:i,category:t}),internal_error:i=>({title:s,message:i,category:t}),invalid_request_error:i=>({title:s,message:i,category:t}),timeslot_not_available:i=>({title:s,message:i,category:t}),provider_error:i=>({title:s,message:i,category:t}),not_found_error:i=>({title:s,message:i,category:t})}}}}class M{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:s,configId:i,slug:n,clientId:r}){this.errors=new C,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=s,this.configId=i,this.slug=n,this.clientId=r}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,s,i={}){try{const n=new URL(this.schedulerAPIURL);return n.pathname=e,await(await fetch(decodeURIComponent(n.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,...i},body:s})).json()}catch(n){return{error:{message:n.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var s,i,n,r;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";return(e==null?void 0:e.type)==="provider_error"&&(t=((i=(s=e==null?void 0:e.provider_error)==null?void 0:s.error)==null?void 0:i.message)||((r=(n=e==null?void 0:e.provider_error)==null?void 0:n.error)==null?void 0:r.title)||"Something went wrong"),t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e),l.instance.changeLanguage(e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,s=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;return await this.getAvailability(s,i)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),s=this.schedulerStore.get("availability").find(n=>new Date(n.start_time)>new Date);let i=e;return s&&(i=s.start_time),this.schedulerStore.set("selectedDate",i),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1),this.schedulerStore.set("selectedTimeslot",null),t}async setReschedule(e){this.schedulerStore.set("isLoading",!0);const t=this.schedulerStore.state.eventInfo;return t&&this.schedulerStore.set("reschedulingEventInfo",t),this.schedulerStore.set("rescheduleBookingId",e),await this.resetStoreStateAndFetchAvailability().finally(()=>{this.schedulerStore.set("isLoading",!1)})}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("rejectBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async goBack(){this.schedulerStore.set("cancelBookingId","")}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("confirmedEventInfo",void 0),e}async bookTimeslot(e){var I;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:s,bookingInfo:i,selectedLanguage:n}=this.schedulerStore.state;if(!e&&!i)return{error:this.errors.component(l.instance.t("createBookingErrorTitle")).no_booking_info()};const r=(e==null?void 0:e.timeslot)||t;if(!r)return{error:this.errors.component(l.instance.t("createBookingErrorTitle")).no_timeslot_selected()};const o=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:s;if(!o)return{error:this.errors.component(l.instance.t("createBookingErrorTitle")).no_timezone_selected()};const u=this.schedulerStore.get("availabilityOrderEmails");let m="";if(u.length>0){const S=r.emails;for(let h=0;h<u.length;h++)if(S.includes(u[h])){m=u[h];break}}const d=e?e==null?void 0:e.primaryParticipant:i==null?void 0:i.primaryParticipant,g=e?(e==null?void 0:e.guests)||[]:(i==null?void 0:i.guests)||[],f=e?e==null?void 0:e.additionalFields:i==null?void 0:i.additionalFields,_=this.getHeaders(),v=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:""}`,c=await this.makeAPIRequest(decodeURIComponent(v),"POST",JSON.stringify({participants:m?[{email:m}]:void 0,additional_fields:f,additional_guests:g,guest:{...d},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:o,email_language:this.getTwoLetterLanguageCode(n)}),_);if("error"in c){this.schedulerStore.set("isLoading",!1);const S=(I=c.error)==null?void 0:I.type;let h=c.error;if(S&&S in this.errors.api("Create Booking")){const T=this.getErrorMessage(h);h=this.errors.api("Create Booking")[S](T)}return{error:h}}return"data"in c&&this.schedulerStore.set("eventInfo",c==null?void 0:c.data),this.schedulerStore.set("isLoading",!1),c}async getUISettings(){var n;this.schedulerStore.set("isLoading",!0);const e=this.getHeaders(),s=`/v3/scheduling/ui-settings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:""}`,i=await this.makeAPIRequest(s,"GET",void 0,e);if("error"in i){this.schedulerStore.set("isLoading",!1);const r=(n=i.error)==null?void 0:n.type;let o=i.error;return r&&r in this.errors.api(l.instance.t("getUISettingErrorTitle"))&&(o=this.errors.api(l.instance.t("getUISettingErrorTitle"))[r]((o==null?void 0:o.message)||(o==null?void 0:o.title)||"Something went wrong")),{error:o}}return"data"in i&&this.schedulerStore.set("configSettings",i.data),this.schedulerStore.set("isLoading",!1),i}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){var n;const t=(n=this.schedulerStore.get("configSettings"))==null?void 0:n.scheduler,s=t==null?void 0:t.min_booking_notice;if(!s)return e;const i=new Date().getTime();return e<(i+s*60*1e3)/1e3?Math.floor((i+s*60*1e3)/1e3):e}getEndTimeForAvailableDaysInFuture(e){var r,o;const t=new Date,s=(o=(r=this.schedulerStore.get("configSettings"))==null?void 0:r.scheduler)==null?void 0:o.available_days_in_future,i=Math.floor(l.addDaysToCurrentDate(t,s).getTime()/1e3);return Math.min(i,e)}async getAvailability(e=0,t=0){var f,_,p,v;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,n=i.getTime();if(t&&t<n/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component(l.instance.t("getAvailabilityErrorTitle")).endtime_not_in_future()};if(!e){const c=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(c.getTime()/1e3)}if(!t){const c=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(c.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const r=this.getStartTimeWithMinBookingNotice(e);e=r,t=r>t?r+1:t,s.append("start_time",encodeURIComponent(e.toString())),s.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId?s.append("configuration_id",encodeURIComponent(this.configId)):this.slug&&this.clientId&&!this.sessionId&&(s.append("slug",encodeURIComponent(this.slug)),s.append("client_id",encodeURIComponent(this.clientId)));const o=this.schedulerStore.get("rescheduleBookingId");o&&s.append("booking_id",encodeURIComponent(o));const u=s.toString(),m=`/v3/scheduling/availability${u?`?${u}`:""}`,d=this.getHeaders(),g=await this.makeAPIRequest(decodeURIComponent(m),"GET",void 0,d);if("error"in g){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const c=(f=g.error)==null?void 0:f.type;let I=g.error;if(c&&c in this.errors.api(l.instance.t("getAvailabilityErrorTitle"))){const S=this.getErrorMessage(I);I=this.errors.api(l.instance.t("getAvailabilityErrorTitle"))[c](S)}return{error:I}}if("data"in g){const I=(((p=(_=g.data)==null?void 0:_.time_slots)==null?void 0:p.map(h=>({...h,start_time:new Date(h.start_time*1e3),end_time:new Date(h.end_time*1e3)})))||[]).filter(h=>h.start_time.getTime()>n);this.schedulerStore.set("availability",I);const S=((v=g.data)==null?void 0:v.order)||[];this.schedulerStore.set("availabilityOrderEmails",S)}return this.schedulerStore.set("isLoading",!1),g}async cancelBooking(e,t){var o;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(l.instance.t("cancelBookingErrorTitle")).no_booking_id()};const s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",i=`/v3/scheduling/bookings/${e}${s}`,n=this.getHeaders(),r=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),n);if("error"in r){this.schedulerStore.set("isLoading",!1);const u=(o=r.error)==null?void 0:o.type;let m=r.error;if(u&&u in this.errors.api(l.instance.t("cancelBookingErrorTitle"))){const d=this.getErrorMessage(m);m=this.errors.api(l.instance.t("cancelBookingErrorTitle"))[u](d)}return{error:m}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("rescheduleBookingId",""),this.schedulerStore.set("isLoading",!1),r}async rescheduleBooking(e,t){var L;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(l.instance.t("rescheduleBookingErrorTitle")).no_booking_id()};const s=this.errors.api(l.instance.t("rescheduleBookingErrorTitle")),i=this.errors.component(l.instance.t("rescheduleBookingErrorTitle")),{bookingInfo:n,selectedTimeslot:r,selectedTimezone:o,selectedLanguage:u}=this.schedulerStore.state,{startTime:m,endTime:d,timezone:g}=t,f=m||(r==null?void 0:r.start_time);if(!f)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const _=d||(r==null?void 0:r.end_time);if(!_)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const p=this.schedulerStore.get("availabilityOrderEmails");let v="";if(p.length>0){const b=(r==null?void 0:r.emails)||[];for(let k=0;k<p.length;k++)if(b.includes(p[k])){v=p[k];break}}const c=g||o;if(!c)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const I=t?t==null?void 0:t.primaryParticipant:n==null?void 0:n.primaryParticipant,S=t?(t==null?void 0:t.guests)||[]:(n==null?void 0:n.guests)||[],h=t?t==null?void 0:t.additionalFields:n==null?void 0:n.additionalFields,T=!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/${e}${T}`,A=this.getHeaders(),y=await this.makeAPIRequest(decodeURIComponent(D),"PATCH",JSON.stringify({start_time:f.getTime()/1e3,end_time:_.getTime()/1e3,timezone:c,additional_fields:h,guest:{...I},additional_guests:S,participants:v?[{email:v}]:void 0,email_language:this.getTwoLetterLanguageCode(u)}),A);if("error"in y){this.schedulerStore.set("isLoading",!1);const b=(L=y.error)==null?void 0:L.type;let k=y.error;if(b&&b in s){const P=this.getErrorMessage(k);k=s[b](P)}return{error:k}}const w=this.schedulerStore.get("reschedulingEventInfo");if("data"in y)this.schedulerStore.set("eventInfo",y==null?void 0:y.data);else if(w)this.schedulerStore.set("eventInfo",w);else{const b={booking_id:e};this.schedulerStore.set("eventInfo",b)}return this.schedulerStore.set("isLoading",!1),y}async updateBooking(e){var g;this.schedulerStore.set("isLoading",!0);const{bookingId:t,status:s,reason:i}=e,n=this.schedulerStore.get("organizerConfirmationSalt"),r=s==="confirmed"?l.instance.t("confirmBookingErrorTitle"):l.instance.t("rejectBookingErrorTitle");if(!t)return{error:this.errors.component(r).no_booking_id()};if(!n)return{error:this.errors.component(r).no_salt()};const o=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",u=`/v3/scheduling/bookings/${t}${o}`,m=this.getHeaders(),d=await this.makeAPIRequest(decodeURIComponent(u),"PUT",JSON.stringify({status:s,cancellation_reason:i,salt:n}),m);if("error"in d){this.schedulerStore.set("isLoading",!1);const f=(g=d.error)==null?void 0:g.type;let _=d.error;if(f&&f in this.errors.api(r)){const p=this.getErrorMessage(_);_=this.errors.api(r)[f](p)}return{error:_}}return"data"in d&&s==="confirmed"?this.schedulerStore.set("confirmedEventInfo",d==null?void 0:d.data):"request_id"in d&&s==="cancelled"&&this.schedulerStore.set("cancelledEventInfo",{booking_id:t}),this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("isLoading",!1),d}}function z(a={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...a};l.debug("[defaultNylasStoreState]: ",e);const t=l.createStore(e);return t.onChange("availability",s=>{l.debug("[availability]: ",s);const i=s.map(o=>o.start_time);l.debug("[selectableDates]: ",i),t.set("selectableDates",i);const n=s[0];if(!n)return;const r=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);l.debug("[durationMinutes]: ",r),t.set("eventDuration",r)}),t.reset=()=>{for(const s in e){const i=e[s];t.set(s,i)}},t}exports.CreateNylasSchedulerStore=z;exports.NylaSchedulerAPIConnector=M;
|