@nylas/react 1.0.2-canary.0 → 1.0.2-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-circle-icon_18.entry-b66b6343.cjs +1 -0
- package/dist/add-circle-icon_18.entry-f86ae88d.js +1527 -0
- package/dist/{archive-icon_7.entry-0deb31c2.cjs → archive-icon_7.entry-052ac074.cjs} +1 -1
- package/dist/{archive-icon_7.entry-187a3484.js → archive-icon_7.entry-0e34d6e7.js} +17 -17
- package/dist/arrow-icon.entry-2afd9ea9.js +15 -0
- package/dist/{arrow-icon.entry-fb0ebc89.cjs → arrow-icon.entry-93f21385.cjs} +1 -1
- package/dist/{auth-store-764d3768-ce84fc6a.cjs → auth-store-69ac49c7-5a0bbb90.cjs} +1 -1
- package/dist/{auth-store-764d3768-3e9c24a0.js → auth-store-69ac49c7-cbfda055.js} +2 -2
- package/dist/{bold-icon_3.entry-8aebbbdb.js → bold-icon_3.entry-88ce1d25.js} +8 -8
- package/dist/bold-icon_3.entry-8f55a9e7.cjs +1 -0
- package/dist/{calendar-cancel-icon.entry-3f4d6cf2.cjs → calendar-cancel-icon.entry-574c8aa4.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-305c099c.js → calendar-cancel-icon.entry-e9c692fa.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-fa7c033a.cjs → calendar-check-icon_2.entry-b0476bca.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-1bf4163c.js → calendar-check-icon_2.entry-d461c713.js} +7 -7
- package/dist/{calendar-icon.entry-b5678535.js → calendar-icon.entry-1ca202a4.js} +4 -4
- package/dist/{calendar-icon.entry-78433555.cjs → calendar-icon.entry-98936e6d.cjs} +1 -1
- package/dist/chevron-icon_3.entry-830f52c2.js +105 -0
- package/dist/chevron-icon_3.entry-f7801467.cjs +1 -0
- package/dist/close-icon.entry-37e8361f.js +15 -0
- package/dist/close-icon.entry-8d6e9816.cjs +1 -0
- package/dist/{constants-d93cf397-e3587f5c.cjs → constants-b6bf6671-27e2557d.cjs} +4 -4
- package/dist/{constants-d93cf397-dd67263d.js → constants-b6bf6671-49a0f1f2.js} +464 -442
- package/dist/{document-refresh-icon.entry-8791ab16.js → document-refresh-icon.entry-faea08ce.js} +2 -2
- package/dist/document-refresh-icon.entry-fcb33921.cjs +1 -0
- package/dist/elements/index.d.ts +9 -3
- package/dist/{forward-icon_6.entry-cb605bfc.js → forward-icon_6.entry-8da1f65d.js} +10 -10
- package/dist/{forward-icon_6.entry-903ccd33.cjs → forward-icon_6.entry-c4b37cb1.cjs} +2 -2
- package/dist/globe-icon.entry-4720304b.js +15 -0
- package/dist/globe-icon.entry-90a0b9c9.cjs +1 -0
- package/dist/{index-10914bc1-1a809477.js → index-10914bc1-346f04fa.js} +3 -3
- package/dist/{index-10914bc1-93ff6f46.cjs → index-10914bc1-c8c3a2f3.cjs} +1 -1
- package/dist/index-457dcf0b.cjs +30 -0
- package/dist/index-ce40ad47.js +1570 -0
- package/dist/info-icon_2.entry-81e95048.cjs +1 -0
- package/dist/info-icon_2.entry-9307db18.js +34 -0
- package/dist/loading-icon.entry-06d37ef0.cjs +1 -0
- package/dist/loading-icon.entry-dc518df4.js +15 -0
- package/dist/{mailbox-store-6b9425dc-a0366cf2.cjs → mailbox-store-e721b17c-4e97e07d.cjs} +1 -1
- package/dist/{mailbox-store-6b9425dc-c249fa99.js → mailbox-store-e721b17c-cf9a43dd.js} +2 -2
- package/dist/nylas-additional-participants.entry-1653dec7.js +83 -0
- package/dist/nylas-additional-participants.entry-ff8bf378.cjs +1 -0
- package/dist/nylas-booked-event-card_10.entry-06bc3c51.cjs +1 -0
- package/dist/nylas-booked-event-card_10.entry-aa971e8a.js +784 -0
- package/dist/nylas-editor-tabs.entry-49b5a3ab.cjs +1 -0
- package/dist/nylas-editor-tabs.entry-9d0959bf.js +181 -0
- package/dist/nylas-form-card.entry-69d2095b.cjs +1 -0
- package/dist/nylas-form-card.entry-c4e78f88.js +56 -0
- package/dist/{nylas-if-state_3.entry-e7b615a1.js → nylas-if-state_3.entry-2eb3f385.js} +8 -8
- package/dist/{nylas-if-state_3.entry-2093c593.cjs → nylas-if-state_3.entry-5baf6d6f.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-dff7a835.cjs → nylas-list-folders.entry-3b24d92d.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-744293ae.js → nylas-list-folders.entry-995fa819.js} +4 -4
- package/dist/{nylas-list-threads.entry-85ad1b74.js → nylas-list-threads.entry-21466eb3.js} +6 -6
- package/dist/{nylas-list-threads.entry-edb1d265.cjs → nylas-list-threads.entry-fda42ded.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-55ef4b8c.js → nylas-mailbox-pagination.entry-02d40186.js} +3 -3
- package/dist/{nylas-mailbox-pagination.entry-5b888a0e.cjs → nylas-mailbox-pagination.entry-9dcd4901.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-bb42156a.cjs → nylas-mailbox-toolbar-button.entry-d1099fab.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-bdcf7d17.js → nylas-mailbox-toolbar-button.entry-dbad44b4.js} +9 -9
- package/dist/{nylas-provider.entry-cb1ef04e.cjs → nylas-provider.entry-78e2fa30.cjs} +1 -1
- package/dist/{nylas-provider.entry-1dc58829.js → nylas-provider.entry-bbee8c99.js} +8 -8
- package/dist/nylas-scheduler-editor.entry-550d3c59.cjs +1 -0
- package/dist/{nylas-scheduler-config.entry-2382ac1b.js → nylas-scheduler-editor.entry-8f7ecf3b.js} +32 -35
- package/dist/nylas-scheduling.entry-22b5ad07.js +236 -0
- package/dist/nylas-scheduling.entry-30a63738.cjs +1 -0
- package/dist/{nylas-threads-refresh.entry-b35f1b68.cjs → nylas-threads-refresh.entry-05258b36.cjs} +1 -1
- package/dist/{nylas-threads-refresh.entry-ef5d6dfd.js → nylas-threads-refresh.entry-414d8740.js} +12 -12
- package/dist/{nylas-threads-search.entry-e570bf8e.js → nylas-threads-search.entry-a19dc90f.js} +8 -8
- package/dist/{nylas-threads-search.entry-2dda7524.cjs → nylas-threads-search.entry-ff21fc65.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-3939c913.js → nylas-view-thread.entry-38149162.js} +4 -4
- package/dist/{nylas-view-thread.entry-1ee0680f.cjs → nylas-view-thread.entry-5da81e99.cjs} +1 -1
- package/dist/{people-icon.entry-4a88822e.cjs → people-icon.entry-4b682757.cjs} +1 -1
- package/dist/{people-icon.entry-69465395.js → people-icon.entry-5c244c8d.js} +6 -6
- package/dist/play-icon_2.entry-ccdc6b9c.cjs +1 -0
- package/dist/play-icon_2.entry-f36d6d55.js +25 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +70 -64
- package/dist/{refresh-icon.entry-678f92e7.cjs → refresh-icon.entry-59fff3d4.cjs} +1 -1
- package/dist/{refresh-icon.entry-bd2bf7ce.js → refresh-icon.entry-63456c9a.js} +4 -4
- package/dist/{register-component-486ea571-cdfe1ef9.cjs → register-component-d056a880-2be11c56.cjs} +1 -1
- package/dist/{register-component-486ea571-1f151779.js → register-component-d056a880-f3003d6c.js} +2 -2
- package/dist/{scheduler-config-store-a059f30b-06c1aa21.cjs → scheduler-config-store-4d035001-0256b40c.cjs} +1 -1
- package/dist/{scheduler-config-store-a059f30b-ff3efc00.js → scheduler-config-store-4d035001-db9dc78a.js} +1 -1
- package/dist/{scheduler-store-81058220-263a5f44.js → scheduler-store-0fbe642c-14466305.js} +85 -89
- package/dist/scheduler-store-0fbe642c-410fdbf4.cjs +1 -0
- package/dist/{translate-icon.entry-0c0dbba6.cjs → translate-icon.entry-1784c18e.cjs} +1 -1
- package/dist/{translate-icon.entry-c1fcd2f8.js → translate-icon.entry-35999e70.js} +2 -2
- package/dist/{utils-df5c1963-d9833bcb.js → utils-0cd66d04-89ab163d.js} +98 -101
- package/dist/{utils-df5c1963-1c47e21c.cjs → utils-0cd66d04-94b9c3b6.cjs} +5 -5
- package/dist/{warning-icon.entry-dbd44cdb.cjs → warning-icon.entry-3a702d1d.cjs} +1 -1
- package/dist/warning-icon.entry-73de08c3.js +15 -0
- package/package.json +4 -4
- package/dist/add-circle-icon_13.entry-6dccb5e5.cjs +0 -1
- package/dist/add-circle-icon_13.entry-ab84be80.js +0 -1050
- package/dist/arrow-icon.entry-b782e05a.js +0 -15
- package/dist/bold-icon_3.entry-49e5a1d0.cjs +0 -1
- package/dist/chevron-icon.entry-49b0d3e7.cjs +0 -1
- package/dist/chevron-icon.entry-f484c9a3.js +0 -15
- package/dist/close-icon.entry-24d5c268.js +0 -15
- package/dist/close-icon.entry-37965d55.cjs +0 -1
- package/dist/document-refresh-icon.entry-0e8935fa.cjs +0 -1
- package/dist/duration-bddc4a13-05d3e3e2.cjs +0 -1
- package/dist/duration-bddc4a13-179ce826.js +0 -41
- package/dist/globe-icon_3.entry-71d83904.js +0 -109
- package/dist/globe-icon_3.entry-c6aefc52.cjs +0 -1
- package/dist/index-cee193d2.cjs +0 -30
- package/dist/index-e834697b.js +0 -1562
- package/dist/info-icon.entry-3774a4e3.js +0 -15
- package/dist/info-icon.entry-85bf3fbc.cjs +0 -1
- package/dist/loading-icon.entry-8941102c.js +0 -15
- package/dist/loading-icon.entry-ae6c7b74.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-a166d51d.js +0 -739
- package/dist/nylas-booked-event-card_10.entry-b181a874.cjs +0 -1
- package/dist/nylas-form-card.entry-7173dd4a.js +0 -56
- package/dist/nylas-form-card.entry-8fdbefa6.cjs +0 -1
- package/dist/nylas-open-hours-picker.entry-0f4f34f6.cjs +0 -1
- package/dist/nylas-open-hours-picker.entry-7e7060fe.js +0 -187
- package/dist/nylas-scheduler-config.entry-477d2171.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-1a95d313.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-c0479087.js +0 -140
- package/dist/nylas-scheduler.entry-69ecc3ae.cjs +0 -1
- package/dist/nylas-scheduler.entry-7084c148.js +0 -231
- package/dist/play-icon_2.entry-bc24fda7.js +0 -25
- package/dist/play-icon_2.entry-bd9f650e.cjs +0 -1
- package/dist/scheduler-store-81058220-a20698af.cjs +0 -1
- package/dist/warning-icon.entry-9631cd2e.js +0 -15
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { r as g, c as v, h as a, H as x } from "./index-e834697b.js";
|
|
2
|
-
import { R as k } from "./register-component-486ea571-1f151779.js";
|
|
3
|
-
import { d as p } from "./utils-df5c1963-d9833bcb.js";
|
|
4
|
-
import "react";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
7
|
-
const S = ":host{display:block;--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;width:inherit}.scheduler-editor{display:flex;flex-direction:column}.scheduler-editor .form-contents{display:grid;grid-template-columns:minmax(224px, 25%) 1fr}@media screen and (max-width: 768px){.scheduler-editor .form-contents{display:table-column-group}}.scheduler-editor .form-contents .tabs{display:flex;flex-direction:column;border-right:1px solid var(--nylas-base-200);background-color:var(--nylas-base-25)}.scheduler-editor .form-contents .tabs .tab{display:flex;align-items:center;gap:0.5rem;padding:0.5rem 1rem;color:var(--nylas-base-900);background:var(--nylas-base-0);border:none;height:56px;cursor:pointer}.scheduler-editor .form-contents .tabs .tab:not(:first-of-type){margin-top:0.25rem}.scheduler-editor .form-contents .tabs .tab.active{background:var(--nylas-base-0);color:var(--nylas-primary);border-left:4px solid var(--nylas-primary);box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.0588235294);box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843)}.scheduler-editor .form-contents .tab-content{max-width:692px}.footer{display:flex;justify-content:flex-end;align-items:center;height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}.footer button{background:var(--nylas-primary);color:var(--nylas-base-0);height:48px;border:none;border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;cursor:pointer}.footer button:hover{background:var(--nylas-base-600)}.footer button:active{background:var(--nylas-base-800)}.footer button:disabled{background:var(--nylas-base-300);cursor:not-allowed}", C = S;
|
|
8
|
-
var _ = function(e, t, n, r) {
|
|
9
|
-
var l = arguments.length, i = l < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, s;
|
|
10
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
11
|
-
i = Reflect.decorate(e, t, n, r);
|
|
12
|
-
else
|
|
13
|
-
for (var o = e.length - 1; o >= 0; o--)
|
|
14
|
-
(s = e[o]) && (i = (l < 3 ? s(i) : l > 3 ? s(t, n, i) : s(t, n)) || i);
|
|
15
|
-
return l > 3 && i && Object.defineProperty(t, n, i), i;
|
|
16
|
-
}, u = function(e, t) {
|
|
17
|
-
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
18
|
-
return Reflect.metadata(e, t);
|
|
19
|
-
};
|
|
20
|
-
const y = class {
|
|
21
|
-
constructor(e) {
|
|
22
|
-
g(this, e), this.schedulerConfigChanged = v(this, "schedulerConfigChanged", 7), this.formSubmissionHandler = async (t) => {
|
|
23
|
-
var d, b;
|
|
24
|
-
t.preventDefault(), this.updateFormState();
|
|
25
|
-
const { title: n, description: r, duration: l, availability: i, calendarIds: s, participants: o } = this.formState;
|
|
26
|
-
console.log("participants: ", o);
|
|
27
|
-
const c = (b = (d = this.config) == null ? void 0 : d.participants) == null ? void 0 : b.find((h) => h.is_organizer), f = {
|
|
28
|
-
availability: {
|
|
29
|
-
duration_minutes: parseInt(l)
|
|
30
|
-
},
|
|
31
|
-
participants: [
|
|
32
|
-
{
|
|
33
|
-
name: (c == null ? void 0 : c.name) ?? "",
|
|
34
|
-
email: (c == null ? void 0 : c.email) ?? "",
|
|
35
|
-
is_organizer: !0,
|
|
36
|
-
availability: {
|
|
37
|
-
calendar_ids: s.length ? s : ["primary"],
|
|
38
|
-
open_hours: i ?? []
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
event_booking: {
|
|
43
|
-
title: (n == null ? void 0 : n.toString()) ?? "",
|
|
44
|
-
description: (r == null ? void 0 : r.toString()) ?? ""
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
this.schedulerConfigChanged.emit(f);
|
|
48
|
-
}, this.calendars = void 0, this.config = void 0, this.activeTab = "eventInfo", this.formState = this.getFormStateFromConfig();
|
|
49
|
-
}
|
|
50
|
-
configChangedHandler(e) {
|
|
51
|
-
p("nylas-scheduler-editor", "configChangedHandler", e), this.formState = this.getFormStateFromConfig();
|
|
52
|
-
}
|
|
53
|
-
connectedCallback() {
|
|
54
|
-
p("nylas-scheduler-editor", "connectedCallback");
|
|
55
|
-
}
|
|
56
|
-
componentWillLoad() {
|
|
57
|
-
p("nylas-scheduler-editor", "componentWillLoad");
|
|
58
|
-
}
|
|
59
|
-
componentDidLoad() {
|
|
60
|
-
p("nylas-scheduler-editor", "componentDidLoad");
|
|
61
|
-
}
|
|
62
|
-
disconnectedCallback() {
|
|
63
|
-
p("nylas-scheduler-editor", "disconnectedCallback");
|
|
64
|
-
}
|
|
65
|
-
getFormStateFromConfig() {
|
|
66
|
-
var t, n, r, l, i, s, o, c, f, d, b, h;
|
|
67
|
-
const e = (n = (t = this.config) == null ? void 0 : t.participants) == null ? void 0 : n.find((m) => m.is_organizer);
|
|
68
|
-
return {
|
|
69
|
-
title: ((l = (r = this.config) == null ? void 0 : r.event_booking) == null ? void 0 : l.title) ?? "",
|
|
70
|
-
description: ((s = (i = this.config) == null ? void 0 : i.event_booking) == null ? void 0 : s.description) ?? "",
|
|
71
|
-
duration: ((f = (c = (o = this.config) == null ? void 0 : o.availability) == null ? void 0 : c.duration_minutes) == null ? void 0 : f.toString()) ?? "10",
|
|
72
|
-
availability: ((d = e == null ? void 0 : e.availability) == null ? void 0 : d.open_hours) ?? void 0,
|
|
73
|
-
calendarIds: ((b = e == null ? void 0 : e.availability) == null ? void 0 : b.calendar_ids) ?? [],
|
|
74
|
-
participants: ((h = this.config) == null ? void 0 : h.participants) ?? []
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
updateFormState() {
|
|
78
|
-
new FormData(this.formRef).forEach((t, n) => {
|
|
79
|
-
switch (n) {
|
|
80
|
-
case "title":
|
|
81
|
-
this.formState.title = t.toString();
|
|
82
|
-
break;
|
|
83
|
-
case "description":
|
|
84
|
-
this.formState.description = t.toString();
|
|
85
|
-
break;
|
|
86
|
-
case "duration":
|
|
87
|
-
this.formState.duration = t.toString();
|
|
88
|
-
break;
|
|
89
|
-
case "availability":
|
|
90
|
-
this.formState.availability = JSON.parse(t.toString());
|
|
91
|
-
break;
|
|
92
|
-
case "participants":
|
|
93
|
-
this.formState.participants = JSON.parse(t.toString());
|
|
94
|
-
break;
|
|
95
|
-
case "calendars":
|
|
96
|
-
this.formState.calendarIds = t.toString().split(",");
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}), this.formState = { ...this.formState };
|
|
100
|
-
}
|
|
101
|
-
setActiveTab(e, t) {
|
|
102
|
-
e.preventDefault(), this.updateFormState(), this.activeTab = t;
|
|
103
|
-
}
|
|
104
|
-
renderTabContent(e) {
|
|
105
|
-
var t;
|
|
106
|
-
switch (this.activeTab) {
|
|
107
|
-
case "eventInfo":
|
|
108
|
-
const n = e.title, r = e.description, l = parseInt(e.duration), i = e.participants;
|
|
109
|
-
return a("div", null, a("nylas-event-info", null, a("div", { slot: "inputs" }, a("nylas-event-title", { name: "title", eventTitle: n }), a("nylas-event-duration", { name: "duration", eventDurationMinutes: l }), a("nylas-event-description", { name: "description", eventDescription: r }))), a("nylas-additional-participants", { name: "participants", eventParticipants: i }));
|
|
110
|
-
case "availability":
|
|
111
|
-
const s = e.availability, o = (t = e.participants) == null ? void 0 : t.find((d) => d.is_organizer), c = (o == null ? void 0 : o.email) ?? "primary", f = e.calendarIds.length > 0 ? e.calendarIds : [c];
|
|
112
|
-
return a("div", null, a("nylas-calendar-picker", { name: "calendars", calendars: this.calendars ?? [], defaultSelectedCalendars: f, organizerEmail: c }), a("nylas-availability-picker", { name: "availability", openHours: s }));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
render() {
|
|
116
|
-
return a(x, { key: "5041540c34973d7e3e4ea881f9ae0312d116910d" }, a("form", { key: "e97d08f968108913f8313fc7c155646abc40f9b0", onSubmit: this.formSubmissionHandler, class: "scheduler-editor", ref: (e) => this.formRef = e }, a("div", { key: "10b20fef8c742f4ef50a4d41baccff514b661a9f", class: "form-contents" }, a("div", { key: "abaef8139309661b1398aea8e0c7ff8378b3bec5", class: "tabs" }, a("button", { key: "6d40952899d50e48ffe8531e4d7bfe70dedb5882", class: { tab: !0, active: this.activeTab == "eventInfo" }, onClick: (e) => this.setActiveTab(e, "eventInfo") }, a("calendar-info-icon", { key: "fe8510f782a12d6e755d1656fe9af67b86314bf0", width: "16", height: "16" }), "Event Info"), a("button", { key: "4d821f8550f8e36e6a421a783034c0500fd178c6", class: { tab: !0, active: this.activeTab == "availability" }, onClick: (e) => this.setActiveTab(e, "availability") }, a("calendar-patterns-icon", { key: "93c0b506aeac709c6e39c6a514fc46bec052dcc7", width: "16", height: "16" }), "Availability")), a("div", { key: "843934d16b0208234e400be7f1c92b5f67c36884", class: "tab-content" }, this.renderTabContent(this.formState))), a("div", { key: "0a5b6a63138970cc1cc876894d7ec2340f5ab107", class: "footer" }, a("button", { key: "ed49e3934719b08b08a81f095565249f109d64fb", type: "submit" }, "Save changes"))));
|
|
117
|
-
}
|
|
118
|
-
static get watchers() {
|
|
119
|
-
return {
|
|
120
|
-
config: ["configChangedHandler"]
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
_([
|
|
125
|
-
k({
|
|
126
|
-
name: "nylas-scheduler-editor",
|
|
127
|
-
stateToProps: /* @__PURE__ */ new Map([
|
|
128
|
-
["schedulerConfig.calendars", "calendars"],
|
|
129
|
-
["schedulerConfig.config", "config"]
|
|
130
|
-
]),
|
|
131
|
-
fireRegisterEvent: !0
|
|
132
|
-
}),
|
|
133
|
-
u("design:type", Function),
|
|
134
|
-
u("design:paramtypes", []),
|
|
135
|
-
u("design:returntype", void 0)
|
|
136
|
-
], y.prototype, "render", null);
|
|
137
|
-
y.style = C;
|
|
138
|
-
export {
|
|
139
|
-
y as nylas_scheduler_editor
|
|
140
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-cee193d2.cjs"),h=require("./index-10914bc1-93ff6f46.cjs"),p=require("./utils-df5c1963-1c47e21c.cjs"),g=require("./scheduler-store-81058220-a20698af.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class y{constructor({schedulerAPIURL:n,nylasSchedulerStore:s,sessionId:i}){if(!n)throw new Error("schedulerAPIURL is required");if(!s)throw new Error("nylasSchedulerStore is required");if(!i)throw new Error("sessionId is required");n==="/"&&(n=new URL(window.location.href).origin),this.sessionId=i,this.schedulerAPIURL=n,this.nylasSchedulerStore=s}init(){p.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new g.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const c=(e,n)=>{const s=e.isLoading,i=e.showNotification;return t.h(t.Fragment,null,s&&t.h("div",{class:"loading"},t.h("div",{class:"left"},t.h("div",{class:"skeleton"})),t.h("div",{class:"right"},t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}))),!s&&n,i&&t.h("nylas-notification",null),t.h("div",{class:"footer"},"Powered by ",t.h("nylas-logo",null)))},v=":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 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px 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}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.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,.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{background-color:var(--nylas-base-50)}.cancelled-event-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:784px}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{padding:1rem 20px 0;gap:1rem;height:512px;min-width:384px;border:1px solid var(--nylas-base-200);border-top-left-radius:inherit}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset}}@media screen and (max-width: 768px){.additional-data-page .left-panel{height:325px}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0}}.border{margin-left:-1.25rem;margin-right:-1.25rem;border-top-width:1px;height:1px;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:512px;padding-top:1rem;border:1px solid var(--nylas-base-200);border-top-right-radius:inherit}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset}}.right-panel h2{display:flex;margin:1.5rem 1rem 1rem;gap:0.25rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.75rem;font-weight:600;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:496px}@media screen and (max-width: 768px){nylas-selected-event-card{height:325px}}.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-100)}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}",w=v,b={title:"Something went wrong...",type:h.nr.Error,category:g.ErrorCategory.Component},m=class{constructor(e){t.registerInstance(this,e),this.init=t.createEvent(this,"init",7),this.schedulerWillLoad=t.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=t.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=t.createEvent(this,"nylasSchedulerError",7),this.mode="app",this.defaultSchedulerStoreState=void 0,this.sessionId=void 0,this.schedulerApiUrl="https://api.us.nylas.com",this.bookingInfo=void 0,this.rescheduleBookingId=void 0,this.cancelBookingId=void 0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.showNotification=!0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||"No date selected"}connectedCallback(){p.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var s,i;if(p.debug("[nylas-scheduler] Component will load"),this.schedulerWillLoad.emit(this.host).defaultPrevented||!this.checkIfSessionIdExists())return;this.stores={scheduler:g.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,...this.defaultSchedulerStoreState})},this.baseProvider=new h.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const n=(s=this.baseProvider)==null?void 0:s.getStore("scheduler");if(this.nylasSchedulerConnector=new y({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,nylasSchedulerStore:n}),this.init.emit(this.host),(i=this.baseProvider)==null||i.componentWillLoad(this.nylasSchedulerConnector),this.themeConfig)for(const[a,o]of Object.entries(this.themeConfig))this.host.style.setProperty(`${a}`,o)}async componentDidLoad(){var a,o,r,u;if((a=this.baseProvider)==null||a.componentDidLoad(),!this.checkIfSessionIdExists())return;const e=(o=this.baseProvider)==null?void 0:o.getStore("scheduler"),n=e==null?void 0:e.get("selectedTimeslot");if(n&&(n!=null&&n.start_time)){if(!this.isTimeslotValid(n))return;if(e!=null&&e.get("showBookingForm")){e==null||e.set("selectedDate",n.start_time);return}}const s=e==null?void 0:e.get("selectedDate");let i;if(!s)i=await((r=this.nylasSchedulerConnector)==null?void 0:r.scheduler.getAvailability());else{const d=new Date(s.getFullYear(),s.getMonth(),1).getTime()/1e3,l=new Date(s.getFullYear(),s.getMonth()+1,1).getTime()/1e3;i=await((u=this.nylasSchedulerConnector)==null?void 0:u.scheduler.getAvailability(d,l))}if((!i||"error"in i)&&this.nylasSchedulerError.emit({...this.getErrorObject(i==null?void 0:i.error)}),!s){let d=new Date;const l=e==null?void 0:e.get("availability").find(f=>new Date(f.start_time)>new Date);l&&(d=l.start_time),e==null||e.set("selectedDate",d)}}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}bookingInfoChanged(e){var n;(n=this.stores)==null||n.scheduler.set("bookingInfo",e)}async registerComponentHandler(e){var n;(n=this.baseProvider)==null||n.registerComponent(e.detail)}async unregisterComponentHandler(e){var n;(n=this.baseProvider)==null||n.unregisterComponent(e.detail)}async monthChangedHandler(e){var o;const n=e.detail,s=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,i=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,a=await((o=this.nylasSchedulerConnector)==null?void 0:o.scheduler.getAvailability(s,i));(!a||"error"in a)&&this.nylasSchedulerError.emit({...this.getErrorObject(a==null?void 0:a.error)})}async bookButtonClickedHandler(e){var s,i,a,o;if(this.rescheduleBookingId){const r=await((s=this.nylasSchedulerConnector)==null?void 0:s.scheduler.rescheduleBooking(this.rescheduleBookingId,e.detail));!r||"error"in r?this.nylasSchedulerError.emit({...this.getErrorObject(r==null?void 0:r.error)}):(i=this.baseProvider)==null||i.getStore("scheduler").set("showThankYouMessage",!0);return}const n=await((a=this.nylasSchedulerConnector)==null?void 0:a.scheduler.bookTimeslot(e.detail));!n||"error"in n?this.nylasSchedulerError.emit({...this.getErrorObject(n==null?void 0:n.error)}):(o=this.baseProvider)==null||o.getStore("scheduler").set("showThankYouMessage",!0)}dateSelectedHandler(e){const n=e.detail;this.selectedDateLabel=n?n.toLocaleDateString(void 0,{dateStyle:"full"}):"No date selected"}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({...this.getErrorObject(e.detail.error)})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({...this.getErrorObject(e.detail.error)})}async getNylasSchedulerStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:(e==null?void 0:e.title)||b.title,category:(e==null?void 0:e.category)||b.category,type:h.nr.Error,description:(e==null?void 0:e.message)||"",id:new Date().getTime().toString()}}checkIfSessionIdExists(){return this.sessionId?!0:(this.nylasSchedulerError.emit({title:"No sessionId!",category:g.ErrorCategory.Component,type:h.nr.Error,description:"Session ID is required",id:new Date().getTime().toString(),ttl:"none"}),!1)}isTimeslotValid(e){return new Date(e.start_time)<new Date?(this.nylasSchedulerError.emit({title:"Invalid tiemslot!",category:g.ErrorCategory.Component,type:h.nr.Error,description:"The selected timeslot is invalid.",id:new Date().getTime().toString(),ttl:"none"}),!1):!0}render(){var d;const e=this.mode==="app",n=(d=this.baseProvider)==null?void 0:d.getStore("scheduler"),s=n==null?void 0:n.get("eventInfo"),i=n==null?void 0:n.get("showThankYouMessage"),a=n==null?void 0:n.get("showBookingForm"),o=n==null?void 0:n.get("cancelledEvent"),r=(n==null?void 0:n.get("cancelBookingId"))||this.cancelBookingId,u=n==null?void 0:n.get("selectedTimeslot");if(e&&r&&!o)return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},t.h("nylas-cancel-booking-form",{cancelBookingId:r,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))));if(e&&o)return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},t.h("nylas-cancelled-event-card",{cancelledEvent:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))));if(e&&i&&s)return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"booked-event-page",part:"booked-event-page"},t.h("nylas-booked-event-card",{selectedTimeslot:u,eventInfo:s,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))));if(e&&!i&&!a){const l=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"select-date-page",part:"select-date-page"},t.h("div",{class:"left-panel"},t.h("nylas-date-picker",{exportparts:"ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),t.h("div",{class:"border"}),t.h("nylas-locale-switch",null)),t.h("div",{class:"right-panel"},t.h("h2",null,t.h("calendar-icon",null),t.h("span",{id:"selectedDate"},this.selectedDateLabel)),t.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},l&&t.h("span",{slot:"timeslot-picker-cta-label"},t.h("slot",{name:"timeslot-picker-cta-label"})))))))}if(e&&!i&&a){const l=this.host.querySelector('[slot="custom-booking-form"]');return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"additional-data-page",part:"additional-data-page"},t.h("div",{class:"left-panel"},t.h("div",{class:"wrapper"},t.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time"}))),t.h("div",{class:"right-panel"},t.h("nylas-booking-form",{exportparts:"nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline"},l&&t.h("div",{slot:"custom-booking-form"},t.h("slot",{name:"custom-booking-form"})))))))}return t.h(t.Host,null,t.h("slot",null))}get host(){return t.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"]}}};m.style=w;exports.nylas_scheduler=m;
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { r as v, c as p, h as n, H as c, g as w, F as x } from "./index-e834697b.js";
|
|
2
|
-
import { n as u, N as _ } from "./index-10914bc1-1a809477.js";
|
|
3
|
-
import { d as m } from "./utils-df5c1963-d9833bcb.js";
|
|
4
|
-
import { E as b, C as k, N as I } from "./scheduler-store-81058220-263a5f44.js";
|
|
5
|
-
import "react";
|
|
6
|
-
import "react-dom";
|
|
7
|
-
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
8
|
-
class E {
|
|
9
|
-
constructor({ schedulerAPIURL: t, nylasSchedulerStore: s, sessionId: i }) {
|
|
10
|
-
if (!t)
|
|
11
|
-
throw new Error("schedulerAPIURL is required");
|
|
12
|
-
if (!s)
|
|
13
|
-
throw new Error("nylasSchedulerStore is required");
|
|
14
|
-
if (!i)
|
|
15
|
-
throw new Error("sessionId is required");
|
|
16
|
-
t === "/" && (t = new URL(window.location.href).origin), this.sessionId = i, this.schedulerAPIURL = t, this.nylasSchedulerStore = s;
|
|
17
|
-
}
|
|
18
|
-
init() {
|
|
19
|
-
m("NylasConnector init");
|
|
20
|
-
}
|
|
21
|
-
get schedulerStore() {
|
|
22
|
-
return this.nylasSchedulerStore;
|
|
23
|
-
}
|
|
24
|
-
get scheduler() {
|
|
25
|
-
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new I({
|
|
26
|
-
schedulerAPIURL: this.schedulerAPIURL,
|
|
27
|
-
schedulerStore: this.schedulerStore,
|
|
28
|
-
sessionId: this.sessionId
|
|
29
|
-
}), this._schedulerAPIConnector);
|
|
30
|
-
}
|
|
31
|
-
resetStores() {
|
|
32
|
-
this.nylasSchedulerStore.reset();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const h = (e, t) => {
|
|
36
|
-
const s = e.isLoading, i = e.showNotification;
|
|
37
|
-
return n(
|
|
38
|
-
x,
|
|
39
|
-
null,
|
|
40
|
-
s && n(
|
|
41
|
-
"div",
|
|
42
|
-
{ class: "loading" },
|
|
43
|
-
n(
|
|
44
|
-
"div",
|
|
45
|
-
{ class: "left" },
|
|
46
|
-
n("div", { class: "skeleton" })
|
|
47
|
-
),
|
|
48
|
-
n(
|
|
49
|
-
"div",
|
|
50
|
-
{ class: "right" },
|
|
51
|
-
n("div", { class: "skeleton" }),
|
|
52
|
-
n("div", { class: "skeleton" }),
|
|
53
|
-
n("div", { class: "skeleton" }),
|
|
54
|
-
n("div", { class: "skeleton" }),
|
|
55
|
-
n("div", { class: "skeleton" })
|
|
56
|
-
)
|
|
57
|
-
),
|
|
58
|
-
!s && t,
|
|
59
|
-
i && n("nylas-notification", null),
|
|
60
|
-
n(
|
|
61
|
-
"div",
|
|
62
|
-
{ class: "footer" },
|
|
63
|
-
"Powered by ",
|
|
64
|
-
n("nylas-logo", null)
|
|
65
|
-
)
|
|
66
|
-
);
|
|
67
|
-
}, C = ":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 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px 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}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.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,.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{background-color:var(--nylas-base-50)}.cancelled-event-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:784px}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{padding:1rem 20px 0;gap:1rem;height:512px;min-width:384px;border:1px solid var(--nylas-base-200);border-top-left-radius:inherit}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset}}@media screen and (max-width: 768px){.additional-data-page .left-panel{height:325px}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0}}.border{margin-left:-1.25rem;margin-right:-1.25rem;border-top-width:1px;height:1px;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:512px;padding-top:1rem;border:1px solid var(--nylas-base-200);border-top-right-radius:inherit}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset}}.right-panel h2{display:flex;margin:1.5rem 1rem 1rem;gap:0.25rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.75rem;font-weight:600;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:496px}@media screen and (max-width: 768px){nylas-selected-event-card{height:325px}}.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-100)}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}", D = C, f = { title: "Something went wrong...", type: u.Error, category: b.Component }, L = class {
|
|
68
|
-
constructor(e) {
|
|
69
|
-
v(this, e), this.init = p(this, "init", 7), this.schedulerWillLoad = p(this, "schedulerWillLoad", 7), this.schedulerDidLoad = p(this, "schedulerDidLoad", 7), this.nylasSchedulerError = p(this, "nylasSchedulerError", 7), this.mode = "app", this.defaultSchedulerStoreState = void 0, this.sessionId = void 0, this.schedulerApiUrl = "https://api.us.nylas.com", this.bookingInfo = void 0, this.rescheduleBookingId = void 0, this.cancelBookingId = void 0, this.eventOverrides = {}, this.isLoading = void 0, this.themeConfig = void 0, this.showNotification = !0, this.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || "No date selected";
|
|
70
|
-
}
|
|
71
|
-
connectedCallback() {
|
|
72
|
-
m("[nylas-scheduler] connectedCallback");
|
|
73
|
-
}
|
|
74
|
-
async componentWillLoad() {
|
|
75
|
-
var s, i;
|
|
76
|
-
if (m("[nylas-scheduler] Component will load"), this.schedulerWillLoad.emit(this.host).defaultPrevented || !this.checkIfSessionIdExists())
|
|
77
|
-
return;
|
|
78
|
-
this.stores = {
|
|
79
|
-
scheduler: k({
|
|
80
|
-
bookingInfo: this.bookingInfo,
|
|
81
|
-
...this.defaultSchedulerStoreState
|
|
82
|
-
})
|
|
83
|
-
}, this.baseProvider = new _(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
|
|
84
|
-
const t = (s = this.baseProvider) == null ? void 0 : s.getStore("scheduler");
|
|
85
|
-
if (this.nylasSchedulerConnector = new E({
|
|
86
|
-
schedulerAPIURL: this.schedulerApiUrl,
|
|
87
|
-
sessionId: this.sessionId,
|
|
88
|
-
nylasSchedulerStore: t
|
|
89
|
-
}), this.init.emit(this.host), (i = this.baseProvider) == null || i.componentWillLoad(this.nylasSchedulerConnector), this.themeConfig)
|
|
90
|
-
for (const [a, o] of Object.entries(this.themeConfig))
|
|
91
|
-
this.host.style.setProperty(`${a}`, o);
|
|
92
|
-
}
|
|
93
|
-
async componentDidLoad() {
|
|
94
|
-
var a, o, r, g;
|
|
95
|
-
if ((a = this.baseProvider) == null || a.componentDidLoad(), !this.checkIfSessionIdExists())
|
|
96
|
-
return;
|
|
97
|
-
const e = (o = this.baseProvider) == null ? void 0 : o.getStore("scheduler"), t = e == null ? void 0 : e.get("selectedTimeslot");
|
|
98
|
-
if (t && (t != null && t.start_time)) {
|
|
99
|
-
if (!this.isTimeslotValid(t))
|
|
100
|
-
return;
|
|
101
|
-
if (e != null && e.get("showBookingForm")) {
|
|
102
|
-
e == null || e.set("selectedDate", t.start_time);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const s = e == null ? void 0 : e.get("selectedDate");
|
|
107
|
-
let i;
|
|
108
|
-
if (!s)
|
|
109
|
-
i = await ((r = this.nylasSchedulerConnector) == null ? void 0 : r.scheduler.getAvailability());
|
|
110
|
-
else {
|
|
111
|
-
const d = new Date(s.getFullYear(), s.getMonth(), 1).getTime() / 1e3, l = new Date(s.getFullYear(), s.getMonth() + 1, 1).getTime() / 1e3;
|
|
112
|
-
i = await ((g = this.nylasSchedulerConnector) == null ? void 0 : g.scheduler.getAvailability(d, l));
|
|
113
|
-
}
|
|
114
|
-
if ((!i || "error" in i) && this.nylasSchedulerError.emit({ ...this.getErrorObject(i == null ? void 0 : i.error) }), !s) {
|
|
115
|
-
let d = /* @__PURE__ */ new Date();
|
|
116
|
-
const l = e == null ? void 0 : e.get("availability").find((y) => new Date(y.start_time) > /* @__PURE__ */ new Date());
|
|
117
|
-
l && (d = l.start_time), e == null || e.set("selectedDate", d);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
componentDisconnected() {
|
|
121
|
-
var e;
|
|
122
|
-
(e = this.baseProvider) == null || e.componentDisconnected();
|
|
123
|
-
}
|
|
124
|
-
bookingInfoChanged(e) {
|
|
125
|
-
var t;
|
|
126
|
-
(t = this.stores) == null || t.scheduler.set("bookingInfo", e);
|
|
127
|
-
}
|
|
128
|
-
async registerComponentHandler(e) {
|
|
129
|
-
var t;
|
|
130
|
-
(t = this.baseProvider) == null || t.registerComponent(e.detail);
|
|
131
|
-
}
|
|
132
|
-
async unregisterComponentHandler(e) {
|
|
133
|
-
var t;
|
|
134
|
-
(t = this.baseProvider) == null || t.unregisterComponent(e.detail);
|
|
135
|
-
}
|
|
136
|
-
async monthChangedHandler(e) {
|
|
137
|
-
var o;
|
|
138
|
-
const t = e.detail, s = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, i = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, a = await ((o = this.nylasSchedulerConnector) == null ? void 0 : o.scheduler.getAvailability(s, i));
|
|
139
|
-
(!a || "error" in a) && this.nylasSchedulerError.emit({ ...this.getErrorObject(a == null ? void 0 : a.error) });
|
|
140
|
-
}
|
|
141
|
-
async bookButtonClickedHandler(e) {
|
|
142
|
-
var s, i, a, o;
|
|
143
|
-
if (this.rescheduleBookingId) {
|
|
144
|
-
const r = await ((s = this.nylasSchedulerConnector) == null ? void 0 : s.scheduler.rescheduleBooking(this.rescheduleBookingId, e.detail));
|
|
145
|
-
!r || "error" in r ? this.nylasSchedulerError.emit({ ...this.getErrorObject(r == null ? void 0 : r.error) }) : (i = this.baseProvider) == null || i.getStore("scheduler").set("showThankYouMessage", !0);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const t = await ((a = this.nylasSchedulerConnector) == null ? void 0 : a.scheduler.bookTimeslot(e.detail));
|
|
149
|
-
!t || "error" in t ? this.nylasSchedulerError.emit({ ...this.getErrorObject(t == null ? void 0 : t.error) }) : (o = this.baseProvider) == null || o.getStore("scheduler").set("showThankYouMessage", !0);
|
|
150
|
-
}
|
|
151
|
-
dateSelectedHandler(e) {
|
|
152
|
-
const t = e.detail;
|
|
153
|
-
this.selectedDateLabel = t ? t.toLocaleDateString(void 0, { dateStyle: "full" }) : "No date selected";
|
|
154
|
-
}
|
|
155
|
-
cancelBookedEventErrorHandler(e) {
|
|
156
|
-
this.nylasSchedulerError.emit({ ...this.getErrorObject(e.detail.error) });
|
|
157
|
-
}
|
|
158
|
-
rescheduleBookedEventErrorHandler(e) {
|
|
159
|
-
this.nylasSchedulerError.emit({ ...this.getErrorObject(e.detail.error) });
|
|
160
|
-
}
|
|
161
|
-
async getNylasSchedulerStore() {
|
|
162
|
-
var e;
|
|
163
|
-
return (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler");
|
|
164
|
-
}
|
|
165
|
-
async getNylasSchedulerConnector() {
|
|
166
|
-
return this.nylasSchedulerConnector;
|
|
167
|
-
}
|
|
168
|
-
async getRef() {
|
|
169
|
-
return this.host;
|
|
170
|
-
}
|
|
171
|
-
getErrorObject(e) {
|
|
172
|
-
return {
|
|
173
|
-
title: (e == null ? void 0 : e.title) || f.title,
|
|
174
|
-
category: (e == null ? void 0 : e.category) || f.category,
|
|
175
|
-
type: u.Error,
|
|
176
|
-
description: (e == null ? void 0 : e.message) || "",
|
|
177
|
-
id: (/* @__PURE__ */ new Date()).getTime().toString()
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
checkIfSessionIdExists() {
|
|
181
|
-
return this.sessionId ? !0 : (this.nylasSchedulerError.emit({
|
|
182
|
-
title: "No sessionId!",
|
|
183
|
-
category: b.Component,
|
|
184
|
-
type: u.Error,
|
|
185
|
-
description: "Session ID is required",
|
|
186
|
-
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
187
|
-
ttl: "none"
|
|
188
|
-
}), !1);
|
|
189
|
-
}
|
|
190
|
-
isTimeslotValid(e) {
|
|
191
|
-
return new Date(e.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
|
|
192
|
-
title: "Invalid tiemslot!",
|
|
193
|
-
category: b.Component,
|
|
194
|
-
type: u.Error,
|
|
195
|
-
description: "The selected timeslot is invalid.",
|
|
196
|
-
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
197
|
-
ttl: "none"
|
|
198
|
-
}), !1) : !0;
|
|
199
|
-
}
|
|
200
|
-
render() {
|
|
201
|
-
var d;
|
|
202
|
-
const e = this.mode === "app", t = (d = this.baseProvider) == null ? void 0 : d.getStore("scheduler"), s = t == null ? void 0 : t.get("eventInfo"), i = t == null ? void 0 : t.get("showThankYouMessage"), a = t == null ? void 0 : t.get("showBookingForm"), o = t == null ? void 0 : t.get("cancelledEvent"), r = (t == null ? void 0 : t.get("cancelBookingId")) || this.cancelBookingId, g = t == null ? void 0 : t.get("selectedTimeslot");
|
|
203
|
-
if (e && r && !o)
|
|
204
|
-
return n(c, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, n("nylas-cancel-booking-form", { cancelBookingId: r, exportparts: "ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label" }))));
|
|
205
|
-
if (e && o)
|
|
206
|
-
return n(c, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, n("nylas-cancelled-event-card", { cancelledEvent: o, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
|
|
207
|
-
if (e && i && s)
|
|
208
|
-
return n(c, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "booked-event-page", part: "booked-event-page" }, n("nylas-booked-event-card", { selectedTimeslot: g, eventInfo: s, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))));
|
|
209
|
-
if (e && !i && !a) {
|
|
210
|
-
const l = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
|
|
211
|
-
return n(c, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "select-date-page", part: "select-date-page" }, n("div", { class: "left-panel" }, n("nylas-date-picker", { exportparts: "ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month" }), n("div", { class: "border" }), n("nylas-locale-switch", null)), n("div", { class: "right-panel" }, 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" }, l && n("span", { slot: "timeslot-picker-cta-label" }, n("slot", { name: "timeslot-picker-cta-label" })))))));
|
|
212
|
-
}
|
|
213
|
-
if (e && !i && a) {
|
|
214
|
-
const l = this.host.querySelector('[slot="custom-booking-form"]');
|
|
215
|
-
return n(c, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, 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" }))), n("div", { class: "right-panel" }, n("nylas-booking-form", { exportparts: "nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline" }, l && n("div", { slot: "custom-booking-form" }, n("slot", { name: "custom-booking-form" })))))));
|
|
216
|
-
}
|
|
217
|
-
return n(c, null, n("slot", null));
|
|
218
|
-
}
|
|
219
|
-
get host() {
|
|
220
|
-
return w(this);
|
|
221
|
-
}
|
|
222
|
-
static get watchers() {
|
|
223
|
-
return {
|
|
224
|
-
bookingInfo: ["bookingInfoChanged"]
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
L.style = D;
|
|
229
|
-
export {
|
|
230
|
-
L as nylas_scheduler
|
|
231
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { r as e, h as t } from "./index-e834697b.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import "react-dom";
|
|
4
|
-
const o = ".sc-play-icon-h{display:flex}", i = o, c = class {
|
|
5
|
-
constructor(s) {
|
|
6
|
-
e(this, s), this.width = "15", this.height = "15";
|
|
7
|
-
}
|
|
8
|
-
render() {
|
|
9
|
-
return t("svg", { key: "3a03fb2d0b30c1a159d05fa60e8176d3b4e15431", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "2f66d598b27c77ce7101d6e9f380cf19d9e487de", d: "M21 12L3 21V3L21 12Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
c.style = i;
|
|
13
|
-
const h = ".sc-stop-icon-h{display:flex}", n = h, r = class {
|
|
14
|
-
constructor(s) {
|
|
15
|
-
e(this, s), this.width = "15", this.height = "15";
|
|
16
|
-
}
|
|
17
|
-
render() {
|
|
18
|
-
return t("svg", { key: "f4cb75beb2c6192750827633257beacafac2f9e4", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "8933319b41b675c3fd43c35e02f743eb58bf1cd6", d: "M4 4H20V20H4V4Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
r.style = n;
|
|
22
|
-
export {
|
|
23
|
-
c as play_icon,
|
|
24
|
-
r as stop_icon
|
|
25
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-cee193d2.cjs");require("react");require("react-dom");const o=".sc-play-icon-h{display:flex}",c=o,s=class{constructor(e){t.registerInstance(this,e),this.width="15",this.height="15"}render(){return t.h("svg",{key:"3a03fb2d0b30c1a159d05fa60e8176d3b4e15431",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"2f66d598b27c77ce7101d6e9f380cf19d9e487de",d:"M21 12L3 21V3L21 12Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};s.style=c;const n=".sc-stop-icon-h{display:flex}",h=n,i=class{constructor(e){t.registerInstance(this,e),this.width="15",this.height="15"}render(){return t.h("svg",{key:"f4cb75beb2c6192750827633257beacafac2f9e4",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"8933319b41b675c3fd43c35e02f743eb58bf1cd6",d:"M4 4H20V20H4V4Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};i.style=h;exports.play_icon=s;exports.stop_icon=i;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const v=require("./utils-df5c1963-1c47e21c.cjs"),D=require("./index-10914bc1-93ff6f46.cjs");exports.ErrorCategory=void 0;(function(n){n.Component="component",n.Api="api",n.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var w;(function(n){n.endtime_not_in_future="endtime_not_in_future",n.no_booking_info="no_booking_info",n.no_timeslot_selected="no_timeslot_selected",n.no_booking_id="no_booking_id",n.invalid_start_time="invalid_start_time",n.invalid_end_time="invalid_end_time",n.invalid_timezone="invalid_timezone"})(w||(w={}));var b;(function(n){n.invalid_session="invalid_session",n.general_error="general_error",n.internal_error="internal_error",n.invalid_request_error="invalid_request_error",n.timeslot_not_available="timeslot_not_available"})(b||(b={}));class A{constructor(){this.component=t=>{const e=exports.ErrorCategory.Component,s=`${t} error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:e}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:e}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:e}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:e}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:e}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:e}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:e})}},this.api=t=>{const e=exports.ErrorCategory.Api,s=`${t} error`;return{invalid_session:i=>({title:s,message:i,category:e}),general_error:i=>({title:s,message:i,category:e}),internal_error:i=>({title:s,message:i,category:e}),invalid_request_error:i=>({title:s,message:i,category:e}),timeslot_not_available:i=>({title:s,message:i,category:e})}}}}class B{constructor({schedulerAPIURL:t,schedulerStore:e,sessionId:s}){this.errors=new A,this.schedulerStore=e,this.schedulerAPIURL=t,this.sessionId=s}async makeAPIRequest(t,e,s,i={}){try{const r=new URL(this.schedulerAPIURL);return r.pathname=t,await(await fetch(decodeURIComponent(r.toString()),{method:e,headers:{"Content-Type":"application/json",...i},body:s})).json()}catch(r){return{error:{message:r.message,title:"API request failed",type:"api"}}}}selectDate(t){this.schedulerStore.set("selectedDate",t),this.schedulerStore.set("selectedTimeslot",null)}selectTime(t){this.schedulerStore.set("selectedTimeslot",t)}selectTimezone(t){this.schedulerStore.set("selectedTimezone",t)}toggleAdditionalData(t){this.schedulerStore.set("showBookingForm",t)}setParticipantName(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e==null?void 0:e.primaryParticipant,name:t}})}setParticipantEmail(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e==null?void 0:e.primaryParticipant,email:t}})}async setReschedule(t){const e=new Date;this.schedulerStore.set("rescheduleBookingId",t),this.schedulerStore.set("selectedTimeslot",null),this.schedulerStore.set("showThankYouMessage",!1),this.schedulerStore.set("showBookingForm",!1);const s=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3,r=await this.getAvailability(s,i),a=this.schedulerStore.get("availability").find(S=>new Date(S.start_time)>new Date);let l=e;return a&&(l=a.start_time),this.schedulerStore.set("selectedDate",l),r}async setCancel(t){this.schedulerStore.set("cancelBookingId",t)}async bookTimeslot(t){var m;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:e,bookingInfo:s}=this.schedulerStore.state;if(!t&&!s)return{error:this.errors.component("Booking").no_booking_info()};const i=(t==null?void 0:t.timeslot)||e;if(!i)return{error:this.errors.component("Create Booking").no_timeslot_selected()};const r=t?t==null?void 0:t.primaryParticipant:s==null?void 0:s.primaryParticipant,a=t?(t==null?void 0:t.guests)||[]:(s==null?void 0:s.guests)||[],l=t?{...t==null?void 0:t.additionalFields,guests:a}:{...s==null?void 0:s.additionalFields,guests:a},S={Authorization:`Bearer ${this.sessionId}`},u="/v3/scheduling/bookings",c=await this.makeAPIRequest(decodeURIComponent(u),"POST",JSON.stringify({additional_fields:l,guest:{...r},start_time:i.start_time.getTime()/1e3,end_time:i.end_time.getTime()/1e3}),S);if("error"in c){this.schedulerStore.set("isLoading",!1);const h=(m=c.error)==null?void 0:m.type;let o=c.error;return h&&h in this.errors.api("Create Booking")&&(o=this.errors.api("Create Booking")[h]((o==null?void 0:o.message)||(o==null?void 0:o.title)||"Something went wrong")),{error:o}}return"data"in c&&this.schedulerStore.set("eventInfo",c==null?void 0:c.data),this.schedulerStore.set("isLoading",!1),c}async getAvailability(t=0,e=0){var c,m,h;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,r=i.getTime();if(e&&e<r/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component("Get Availability").endtime_not_in_future()};if(!t){const o=new Date(i.getFullYear(),i.getMonth(),1);t=Math.floor(o.getTime()/1e3)}if(!e){const o=new Date(i.getFullYear(),i.getMonth()+1,0);e=Math.floor(o.getTime()/1e3)}s.append("start_time",encodeURIComponent(t.toString())),s.append("end_time",encodeURIComponent(e.toString()));const a=s.toString(),l=`/v3/scheduling/availability${a?`?${a}`:""}`,S={Authorization:`Bearer ${this.sessionId}`},u=await this.makeAPIRequest(decodeURIComponent(l),"GET",void 0,S);if("error"in u){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const o=(c=u.error)==null?void 0:c.type;let d=u.error;return o&&o in this.errors.api("Get Availability")&&(d=this.errors.api("Get Availability")[o]((d==null?void 0:d.message)||(d==null?void 0:d.title)||"Something went wrong")),{error:d}}if("data"in u){const d=(((h=(m=u.data)==null?void 0:m.time_slots)==null?void 0:h.map(g=>({...g,start_time:new Date(g.start_time*1e3),end_time:new Date(g.end_time*1e3)})))||[]).filter(g=>g.start_time.getTime()>r);this.schedulerStore.set("availability",d)}return this.schedulerStore.set("isLoading",!1),u}async cancelBooking(t){var r;if(this.schedulerStore.set("isLoading",!0),!t)return{error:this.errors.component("Cancel Booking").no_booking_id()};const e=`/v3/scheduling/bookings/${t}`,s={Authorization:`Bearer ${this.sessionId}`},i=await this.makeAPIRequest(decodeURIComponent(e),"PUT",JSON.stringify({action:"cancel"}),s);if("error"in i){this.schedulerStore.set("isLoading",!1);const a=(r=i.error)==null?void 0:r.type;let l=i.error;return a&&a in this.errors.api("Cancel Booking")&&(l=this.errors.api("Cancel Booking")[a]((l==null?void 0:l.message)||(l==null?void 0:l.title)||"Something went wrong")),{error:l}}return"data"in i&&this.schedulerStore.set("cancelledEvent",i==null?void 0:i.data),this.schedulerStore.set("isLoading",!1),i}async rescheduleBooking(t,e){var y;if(this.schedulerStore.set("isLoading",!0),!t)return{error:this.errors.component("Reschedule Booking").no_booking_id()};const s=this.errors.api("Reschedule Booking"),i=this.errors.component("Reschedule Booking"),{bookingInfo:r,selectedTimeslot:a,selectedTimezone:l}=this.schedulerStore.state,{startTime:S,endTime:u,timezone:c}=e,m=S||(a==null?void 0:a.start_time);if(!m)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerStoreState.')};const h=u||(a==null?void 0:a.end_time);if(!h)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerStoreState.')};const o=c||l;if(!o)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerStoreState.')};const d=e?e==null?void 0:e.primaryParticipant:r==null?void 0:r.primaryParticipant,g=e?(e==null?void 0:e.guests)||[]:(r==null?void 0:r.guests)||[],k=e?{...e==null?void 0:e.additionalFields,guests:g}:{...r==null?void 0:r.additionalFields,guests:g},T=`/v3/scheduling/bookings/${t}`,P={Authorization:`Bearer ${this.sessionId}`},_=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:m.getTime()/1e3,end_time:h.getTime()/1e3,time_zone:o,additional_fields:k,guest:{...d}}),P);if("error"in _){this.schedulerStore.set("isLoading",!1);const p=(y=_.error)==null?void 0:y.type;let f=_.error;p&&p in s&&(f=s[p]((f==null?void 0:f.message)||(f==null?void 0:f.title)||"Something went wrong"))}return"data"in _&&this.schedulerStore.set("eventInfo",_==null?void 0:_.data),this.schedulerStore.set("isLoading",!1),_}}function C(n={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,showThankYouMessage:!1,selectableDates:null,availability:[],state:"ready",eventInfo:null,cancelledEvent:null,isLoading:!1,...n};v.debug("[defaultNylasStoreState]: ",t);const e=D.createStore(t);return e.onChange("availability",s=>{v.debug("[availability]: ",s);const i=s.map(r=>r.start_time);v.debug("[selectableDates]: ",i),e.set("selectableDates",i)}),e.onChange("rescheduleBookingId",s=>{s?e.set("bookingFlow","rescheduling"):e.set("bookingFlow","booking")}),e.reset=()=>{for(const s in t){const i=t[s];e.set(s,i)}},e}exports.CreateNylasSchedulerStore=C;exports.NylaSchedulerAPIConnector=B;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { r as a, h as n } from "./index-e834697b.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import "react-dom";
|
|
4
|
-
const e = ".sc-warning-icon-h{display:flex}", r = e, c = class {
|
|
5
|
-
constructor(t) {
|
|
6
|
-
a(this, t), this.width = "16", this.height = "16";
|
|
7
|
-
}
|
|
8
|
-
render() {
|
|
9
|
-
return n("svg", { key: "4ecc01f0f2e9342fc00493720c51fea65e85fc17", width: "21", height: "21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, n("path", { key: "432ca7415d9e54797b602b44293e5bc3774801a4", d: "M10.149 7.054a.5.5 0 0 1 .5.5v4a.5.5 0 1 1-1 0v-4a.5.5 0 0 1 .5-.5Zm0 7.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM8.834 2.906a1.5 1.5 0 0 1 2.63 0l6.558 11.925a1.5 1.5 0 0 1-1.314 2.223H3.59a1.5 1.5 0 0 1-1.314-2.223L8.834 2.906Zm1.753.482a.5.5 0 0 0-.876 0L3.15 15.313a.5.5 0 0 0 .439.741h13.117a.5.5 0 0 0 .439-.741l-6.56-11.925Z", fill: "currentColor" }));
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
c.style = r;
|
|
13
|
-
export {
|
|
14
|
-
c as warning_icon
|
|
15
|
-
};
|