@nylas/react 1.0.0-prealpha1 → 1.0.2-canary.0
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_13.entry-6dccb5e5.cjs +1 -0
- package/dist/add-circle-icon_13.entry-ab84be80.js +1050 -0
- package/dist/{archive-icon_7.entry-8c90815a.cjs → archive-icon_7.entry-0deb31c2.cjs} +1 -1
- package/dist/{archive-icon_7.entry-53aede1b.js → archive-icon_7.entry-187a3484.js} +20 -20
- package/dist/arrow-icon.entry-b782e05a.js +15 -0
- package/dist/{arrow-icon.entry-a2f53919.cjs → arrow-icon.entry-fb0ebc89.cjs} +1 -1
- package/dist/auth-store-764d3768-3e9c24a0.js +66 -0
- package/dist/auth-store-764d3768-ce84fc6a.cjs +1 -0
- package/dist/{bold-icon_3.entry-e0bc6774.cjs → bold-icon_3.entry-49e5a1d0.cjs} +1 -1
- package/dist/{bold-icon_3.entry-ad806730.js → bold-icon_3.entry-8aebbbdb.js} +6 -6
- package/dist/{calendar-cancel-icon.entry-74051835.js → calendar-cancel-icon.entry-305c099c.js} +5 -5
- package/dist/{calendar-cancel-icon.entry-546b7bd4.cjs → calendar-cancel-icon.entry-3f4d6cf2.cjs} +1 -1
- package/dist/calendar-check-icon_2.entry-1bf4163c.js +25 -0
- package/dist/calendar-check-icon_2.entry-fa7c033a.cjs +1 -0
- package/dist/{calendar-icon.entry-25474b1e.cjs → calendar-icon.entry-78433555.cjs} +1 -1
- package/dist/{calendar-icon.entry-c751873f.js → calendar-icon.entry-b5678535.js} +4 -4
- package/dist/{chevron-icon.entry-97e4621e.cjs → chevron-icon.entry-49b0d3e7.cjs} +1 -1
- package/dist/chevron-icon.entry-f484c9a3.js +15 -0
- package/dist/close-icon.entry-24d5c268.js +15 -0
- package/dist/close-icon.entry-37965d55.cjs +1 -0
- package/dist/{nylas-booked-event-card_9.entry-d995d7cb.js → constants-d93cf397-dd67263d.js} +1381 -2230
- package/dist/{nylas-booked-event-card_9.entry-ea02f083.cjs → constants-d93cf397-e3587f5c.cjs} +6 -139
- package/dist/document-refresh-icon.entry-0e8935fa.cjs +1 -0
- package/dist/document-refresh-icon.entry-8791ab16.js +15 -0
- package/dist/elements/index.d.ts +20 -0
- package/dist/{elements-60ebdb01-24595598.cjs → elements-dc5b338e-81a0319c.cjs} +577 -555
- package/dist/{elements-60ebdb01-5d144002.js → elements-dc5b338e-fb5dbfb5.js} +3339 -2763
- package/dist/{forward-icon_6.entry-725d1be4.cjs → forward-icon_6.entry-903ccd33.cjs} +2 -2
- package/dist/{forward-icon_6.entry-dc8f7235.js → forward-icon_6.entry-cb605bfc.js} +63 -63
- package/dist/globe-icon_3.entry-71d83904.js +109 -0
- package/dist/globe-icon_3.entry-c6aefc52.cjs +1 -0
- package/dist/{index-2b85580a-f9211f23.js → index-10914bc1-1a809477.js} +5 -10
- package/dist/{index-2b85580a-bfc3ceac.cjs → index-10914bc1-93ff6f46.cjs} +1 -1
- package/dist/index-cee193d2.cjs +30 -0
- package/dist/index-e834697b.js +1562 -0
- package/dist/index.d.ts +1 -1
- package/dist/info-icon.entry-3774a4e3.js +15 -0
- package/dist/info-icon.entry-85bf3fbc.cjs +1 -0
- package/dist/loading-icon.entry-8941102c.js +15 -0
- package/dist/loading-icon.entry-ae6c7b74.cjs +1 -0
- package/dist/mailbox-store-6b9425dc-a0366cf2.cjs +1 -0
- package/dist/{mailbox-store-0019772c-06d31a90.js → mailbox-store-6b9425dc-c249fa99.js} +59 -121
- package/dist/nylas-booked-event-card_10.entry-a166d51d.js +739 -0
- package/dist/nylas-booked-event-card_10.entry-b181a874.cjs +1 -0
- package/dist/nylas-form-card.entry-7173dd4a.js +56 -0
- package/dist/nylas-form-card.entry-8fdbefa6.cjs +1 -0
- package/dist/nylas-if-state_3.entry-2093c593.cjs +1 -0
- package/dist/{nylas-if-state_3.entry-ce816adb.js → nylas-if-state_3.entry-e7b615a1.js} +12 -10
- package/dist/{nylas-list-folders.entry-8134344b.js → nylas-list-folders.entry-744293ae.js} +9 -8
- package/dist/nylas-list-folders.entry-dff7a835.cjs +1 -0
- package/dist/{nylas-list-threads.entry-1367fe30.js → nylas-list-threads.entry-85ad1b74.js} +5 -4
- package/dist/nylas-list-threads.entry-edb1d265.cjs +1 -0
- package/dist/{nylas-mailbox-pagination.entry-568ac217.js → nylas-mailbox-pagination.entry-55ef4b8c.js} +4 -3
- package/dist/nylas-mailbox-pagination.entry-5b888a0e.cjs +1 -0
- package/dist/nylas-mailbox-toolbar-button.entry-bb42156a.cjs +1 -0
- package/dist/{nylas-mailbox-toolbar-button.entry-9214b283.js → nylas-mailbox-toolbar-button.entry-bdcf7d17.js} +10 -9
- package/dist/nylas-open-hours-picker.entry-0f4f34f6.cjs +1 -0
- package/dist/{nylas-open-hours-picker.entry-109f13f5.js → nylas-open-hours-picker.entry-7e7060fe.js} +3 -2
- package/dist/nylas-provider.entry-1dc58829.js +155 -0
- package/dist/nylas-provider.entry-cb1ef04e.cjs +1 -0
- package/dist/nylas-scheduler-config.entry-2382ac1b.js +114 -0
- package/dist/nylas-scheduler-config.entry-477d2171.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-1a95d313.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-c0479087.js +140 -0
- package/dist/nylas-scheduler.entry-69ecc3ae.cjs +1 -0
- package/dist/nylas-scheduler.entry-7084c148.js +231 -0
- package/dist/nylas-threads-refresh.entry-b35f1b68.cjs +1 -0
- package/dist/{nylas-threads-refresh.entry-9111a403.js → nylas-threads-refresh.entry-ef5d6dfd.js} +13 -12
- package/dist/nylas-threads-search.entry-2dda7524.cjs +1 -0
- package/dist/{nylas-threads-search.entry-2124f663.js → nylas-threads-search.entry-e570bf8e.js} +6 -5
- package/dist/nylas-view-thread.entry-1ee0680f.cjs +1 -0
- package/dist/{nylas-view-thread.entry-fe51c1f6.js → nylas-view-thread.entry-3939c913.js} +5 -4
- package/dist/people-icon.entry-4a88822e.cjs +1 -0
- package/dist/people-icon.entry-69465395.js +15 -0
- package/dist/play-icon_2.entry-bc24fda7.js +25 -0
- package/dist/play-icon_2.entry-bd9f650e.cjs +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +77 -57
- package/dist/{refresh-icon.entry-9f24e833.cjs → refresh-icon.entry-678f92e7.cjs} +1 -1
- package/dist/{refresh-icon.entry-4ddd53b0.js → refresh-icon.entry-bd2bf7ce.js} +2 -2
- package/dist/{register-component-55376f31-5eaf8954.js → register-component-486ea571-1f151779.js} +2 -2
- package/dist/{register-component-55376f31-8d6ddee4.cjs → register-component-486ea571-cdfe1ef9.cjs} +1 -1
- package/dist/scheduler-config-store-a059f30b-06c1aa21.cjs +1 -0
- package/dist/scheduler-config-store-a059f30b-ff3efc00.js +33 -0
- package/dist/scheduler-store-81058220-263a5f44.js +297 -0
- package/dist/scheduler-store-81058220-a20698af.cjs +1 -0
- package/dist/{translate-icon.entry-0cd24de4.cjs → translate-icon.entry-0c0dbba6.cjs} +1 -1
- package/dist/{translate-icon.entry-db2cdf1d.js → translate-icon.entry-c1fcd2f8.js} +4 -4
- package/dist/utils-df5c1963-1c47e21c.cjs +8 -0
- package/dist/utils-df5c1963-d9833bcb.js +2114 -0
- package/dist/warning-icon.entry-9631cd2e.js +15 -0
- package/dist/warning-icon.entry-dbd44cdb.cjs +1 -0
- package/package.json +6 -3
- package/dist/arrow-icon.entry-2867f4fb.js +0 -15
- package/dist/calendar-check-icon_3.entry-42bab0b4.js +0 -35
- package/dist/calendar-check-icon_3.entry-f5846fee.cjs +0 -1
- package/dist/chevron-icon.entry-60842fb6.js +0 -15
- package/dist/close-icon_2.entry-aa015993.cjs +0 -1
- package/dist/close-icon_2.entry-ef03bd27.js +0 -25
- package/dist/document-refresh-icon.entry-b27207eb.js +0 -15
- package/dist/document-refresh-icon.entry-ca2ef29e.cjs +0 -1
- package/dist/globe-icon.entry-796d3f48.js +0 -15
- package/dist/globe-icon.entry-918cfd35.cjs +0 -1
- package/dist/index-29d0e781.cjs +0 -30
- package/dist/index-4f65b6f9.js +0 -1489
- package/dist/loading-icon.entry-8e49fab0.js +0 -15
- package/dist/loading-icon.entry-b2534e3e.cjs +0 -1
- package/dist/mailbox-store-0019772c-d1254c5c.cjs +0 -1
- package/dist/nylas-if-state_3.entry-e8c831b7.cjs +0 -1
- package/dist/nylas-list-folders.entry-de8cca60.cjs +0 -1
- package/dist/nylas-list-threads.entry-93b70a1a.cjs +0 -1
- package/dist/nylas-mailbox-pagination.entry-6bb0ee37.cjs +0 -1
- package/dist/nylas-mailbox-toolbar-button.entry-d4ad5c15.cjs +0 -1
- package/dist/nylas-open-hours-picker.entry-2c19643f.cjs +0 -1
- package/dist/nylas-provider.entry-2cfe5f0e.js +0 -134
- package/dist/nylas-provider.entry-87fa9276.cjs +0 -1
- package/dist/nylas-scheduler.entry-6ec8e574.js +0 -195
- package/dist/nylas-scheduler.entry-b41cbf99.cjs +0 -1
- package/dist/nylas-threads-refresh.entry-6d61a689.cjs +0 -1
- package/dist/nylas-threads-search.entry-03073490.cjs +0 -1
- package/dist/nylas-view-thread.entry-4ecbcd78.cjs +0 -1
- package/dist/play-icon_2.entry-8e156535.js +0 -25
- package/dist/play-icon_2.entry-cf1cbc8d.cjs +0 -1
- package/dist/property-0065dde7-83dc9cc4.cjs +0 -23
- package/dist/property-0065dde7-c57b8fa3.js +0 -589
- package/dist/scheduler-store-5a39585a-117668e3.js +0 -173
- package/dist/scheduler-store-5a39585a-2c848bec.cjs +0 -1
- package/dist/utils-5074a070-ce33ee6b.js +0 -119
- package/dist/utils-5074a070-d5ba6add.cjs +0 -2
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { r as C, c as h, h as g, H as S, g as f } from "./index-e834697b.js";
|
|
2
|
+
import { N as m, e as A } from "./index-10914bc1-1a809477.js";
|
|
3
|
+
import { d as a } from "./utils-df5c1963-d9833bcb.js";
|
|
4
|
+
import { C as b, N as p } from "./auth-store-764d3768-3e9c24a0.js";
|
|
5
|
+
import { C as v, H as P, N as _, a as N, b as w } from "./mailbox-store-6b9425dc-c249fa99.js";
|
|
6
|
+
import { C as I, N as x } from "./scheduler-store-81058220-263a5f44.js";
|
|
7
|
+
import { C as M, N as E } from "./scheduler-config-store-a059f30b-ff3efc00.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import "react-dom";
|
|
10
|
+
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
11
|
+
class L {
|
|
12
|
+
constructor(t, s, r, o, l, n, i = "https://api.us.nylas.com") {
|
|
13
|
+
this.router = t, this.schedulerAPIURL = i, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = o, this.nylasSchedulerStore = l, this.nylasSchedulerConfigStore = n;
|
|
14
|
+
}
|
|
15
|
+
init() {
|
|
16
|
+
a("NylasConnector init");
|
|
17
|
+
}
|
|
18
|
+
get authStore() {
|
|
19
|
+
return this.nylasAuthStore;
|
|
20
|
+
}
|
|
21
|
+
get mailboxStore() {
|
|
22
|
+
return this.nylasMailboxStore;
|
|
23
|
+
}
|
|
24
|
+
get schedulerStore() {
|
|
25
|
+
return this.nylasSchedulerStore;
|
|
26
|
+
}
|
|
27
|
+
get schedulerConfigStore() {
|
|
28
|
+
return this.nylasSchedulerConfigStore;
|
|
29
|
+
}
|
|
30
|
+
get auth() {
|
|
31
|
+
return this._authConnector ? this._authConnector : (this._authConnector = new p(this.nylasAuth, this.nylasAuthStore), this._authConnector);
|
|
32
|
+
}
|
|
33
|
+
get threads() {
|
|
34
|
+
return this._threadConnector ? this._threadConnector : (this._threadConnector = new _(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
|
|
35
|
+
}
|
|
36
|
+
get messages() {
|
|
37
|
+
return this._messageConnector ? this._messageConnector : (this._messageConnector = new N(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
|
|
38
|
+
}
|
|
39
|
+
get folders() {
|
|
40
|
+
return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new w(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
|
|
41
|
+
}
|
|
42
|
+
get scheduler() {
|
|
43
|
+
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new x({
|
|
44
|
+
schedulerAPIURL: this.schedulerAPIURL,
|
|
45
|
+
schedulerStore: this.schedulerStore
|
|
46
|
+
}), this._schedulerAPIConnector);
|
|
47
|
+
}
|
|
48
|
+
get schedulerConfig() {
|
|
49
|
+
return this._schedulerConfigConnector ? this._schedulerConfigConnector : (this._schedulerConfigConnector = new E({
|
|
50
|
+
nylasAuth: this.nylasAuth,
|
|
51
|
+
nylasAuthStore: this.nylasAuthStore,
|
|
52
|
+
nylasSchedulerConfigStore: this.nylasSchedulerConfigStore
|
|
53
|
+
}), this._schedulerConfigConnector);
|
|
54
|
+
}
|
|
55
|
+
getAuth() {
|
|
56
|
+
return this.nylasAuth;
|
|
57
|
+
}
|
|
58
|
+
resetStores() {
|
|
59
|
+
this.nylasAuthStore.reset(), this.nylasMailboxStore.reset();
|
|
60
|
+
}
|
|
61
|
+
async logout() {
|
|
62
|
+
await this.nylasAuth.logout(), this.resetStores();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const R = ":host{display:contents}", T = R, U = class {
|
|
66
|
+
constructor(e) {
|
|
67
|
+
C(this, e), this.init = h(this, "init", 7), this.loggedIn = h(this, "loggedIn", 7), this.loggedOut = h(this, "loggedOut", 7), this.handleAuthChange = async (t) => {
|
|
68
|
+
t ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host);
|
|
69
|
+
}, this.authConfig = void 0, this.eventOverrides = {}, this.automaticComponentRegistration = !0;
|
|
70
|
+
}
|
|
71
|
+
connectedCallback() {
|
|
72
|
+
a("[nylas-provider] connectedCallback");
|
|
73
|
+
}
|
|
74
|
+
async componentWillLoad() {
|
|
75
|
+
var n, i, c, u, d, y;
|
|
76
|
+
a("[nylas-provider] componentWillLoad"), this.stores = {
|
|
77
|
+
auth: b(),
|
|
78
|
+
mailbox: v(),
|
|
79
|
+
scheduler: I(),
|
|
80
|
+
schedulerConfig: M()
|
|
81
|
+
}, this.baseProvider = new m(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
|
|
82
|
+
const e = new P();
|
|
83
|
+
this.nylasAuth = A({
|
|
84
|
+
apiUri: "https://api.us.nylas.com",
|
|
85
|
+
elementsApiUri: "https://elements.us.nylas.com",
|
|
86
|
+
storageType: "indexeddb",
|
|
87
|
+
clientId: "YOUR_CLIENT_ID",
|
|
88
|
+
defaultScopes: [],
|
|
89
|
+
redirectURI: "/",
|
|
90
|
+
...this.authConfig
|
|
91
|
+
});
|
|
92
|
+
const t = (n = this.baseProvider) == null ? void 0 : n.getStore("mailbox");
|
|
93
|
+
if (!t)
|
|
94
|
+
throw new Error("The mailbox store is not set");
|
|
95
|
+
const s = (i = this.baseProvider) == null ? void 0 : i.getStore("auth");
|
|
96
|
+
if (!s)
|
|
97
|
+
throw new Error("The auth store is not set");
|
|
98
|
+
const r = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler");
|
|
99
|
+
if (!r)
|
|
100
|
+
throw new Error("The scheduler store is not set");
|
|
101
|
+
const o = (u = this.baseProvider) == null ? void 0 : u.getStore("schedulerConfig");
|
|
102
|
+
if (!o)
|
|
103
|
+
throw new Error("The scheduler config store is not set");
|
|
104
|
+
this.nylasConnector = new L(e, this.nylasAuth, s, t, r, o), this.init.emit(this.host).defaultPrevented || await ((d = this.nylasConnector) == null ? void 0 : d.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (y = this.baseProvider) == null || y.componentWillLoad(this.nylasConnector);
|
|
105
|
+
}
|
|
106
|
+
componentDidLoad() {
|
|
107
|
+
var t, s;
|
|
108
|
+
const e = (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
|
|
109
|
+
e == null || e.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
|
|
110
|
+
}
|
|
111
|
+
componentDisconnected() {
|
|
112
|
+
var e;
|
|
113
|
+
(e = this.baseProvider) == null || e.componentDisconnected();
|
|
114
|
+
}
|
|
115
|
+
async registerComponentHandler(e) {
|
|
116
|
+
var t;
|
|
117
|
+
(t = this.baseProvider) == null || t.registerComponent(e.detail);
|
|
118
|
+
}
|
|
119
|
+
async unregisterComponentHandler(e) {
|
|
120
|
+
var t;
|
|
121
|
+
(t = this.baseProvider) == null || t.unregisterComponent(e.detail);
|
|
122
|
+
}
|
|
123
|
+
async getNylasAuth() {
|
|
124
|
+
return this.nylasAuth;
|
|
125
|
+
}
|
|
126
|
+
async getNylasConnector() {
|
|
127
|
+
return this.nylasConnector;
|
|
128
|
+
}
|
|
129
|
+
async getMailboxStore() {
|
|
130
|
+
var e;
|
|
131
|
+
return (e = this.baseProvider) == null ? void 0 : e.getStore("mailbox");
|
|
132
|
+
}
|
|
133
|
+
async getAuthStore() {
|
|
134
|
+
var e;
|
|
135
|
+
return (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
|
|
136
|
+
}
|
|
137
|
+
async getNylasSchedulerStore() {
|
|
138
|
+
var e;
|
|
139
|
+
return (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler");
|
|
140
|
+
}
|
|
141
|
+
async getNylasSchedulerConfigStore() {
|
|
142
|
+
var e;
|
|
143
|
+
return (e = this.baseProvider) == null ? void 0 : e.getStore("schedulerConfig");
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
return g(S, { key: "1994d94960cafdb4c1dc7b54f155a2a65190a3d9" }, g("slot", { key: "d2a28ba4a86d0df9bd1ceeaf450f376c80ad2ea6" }));
|
|
147
|
+
}
|
|
148
|
+
get host() {
|
|
149
|
+
return f(this);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
U.style = T;
|
|
153
|
+
export {
|
|
154
|
+
U as nylas_provider
|
|
155
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-cee193d2.cjs"),C=require("./index-10914bc1-93ff6f46.cjs"),l=require("./utils-df5c1963-1c47e21c.cjs"),S=require("./auth-store-764d3768-ce84fc6a.cjs"),o=require("./mailbox-store-6b9425dc-a0366cf2.cjs"),f=require("./scheduler-store-81058220-a20698af.cjs"),b=require("./scheduler-config-store-a059f30b-06c1aa21.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class m{constructor(t,s,n,i,c,h,a="https://api.us.nylas.com"){this.router=t,this.schedulerAPIURL=a,this.nylasAuth=s,this.nylasAuthStore=n,this.nylasMailboxStore=i,this.nylasSchedulerStore=c,this.nylasSchedulerConfigStore=h}init(){l.debug("NylasConnector init")}get authStore(){return this.nylasAuthStore}get mailboxStore(){return this.nylasMailboxStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new S.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get threads(){return this._threadConnector?this._threadConnector:(this._threadConnector=new o.NylasThreadsConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore,this.router),this._threadConnector)}get messages(){return this._messageConnector?this._messageConnector:(this._messageConnector=new o.NylasMessagesConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._messageConnector)}get folders(){return this._foldersConnector?this._foldersConnector:(this._foldersConnector=new o.NylasFoldersConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._foldersConnector)}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new f.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore}),this._schedulerAPIConnector)}get schedulerConfig(){return this._schedulerConfigConnector?this._schedulerConfigConnector:(this._schedulerConfigConnector=new b.NylasSchedulerConfigAPIConnector({nylasAuth:this.nylasAuth,nylasAuthStore:this.nylasAuthStore,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore}),this._schedulerConfigConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset(),this.nylasMailboxStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const v=":host{display:contents}",P=v,A=class{constructor(e){r.registerInstance(this,e),this.init=r.createEvent(this,"init",7),this.loggedIn=r.createEvent(this,"loggedIn",7),this.loggedOut=r.createEvent(this,"loggedOut",7),this.handleAuthChange=async t=>{t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host)},this.authConfig=void 0,this.eventOverrides={},this.automaticComponentRegistration=!0}connectedCallback(){l.debug("[nylas-provider] connectedCallback")}async componentWillLoad(){var h,a,u,d,g,y;l.debug("[nylas-provider] componentWillLoad"),this.stores={auth:S.CreateNylasAuthStore(),mailbox:o.CreateNylasMailboxStore(),scheduler:f.CreateNylasSchedulerStore(),schedulerConfig:b.CreateNylasSchedulerConfigStore()},this.baseProvider=new C.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=new o.HashRouter;this.nylasAuth=C.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const t=(h=this.baseProvider)==null?void 0:h.getStore("mailbox");if(!t)throw new Error("The mailbox store is not set");const s=(a=this.baseProvider)==null?void 0:a.getStore("auth");if(!s)throw new Error("The auth store is not set");const n=(u=this.baseProvider)==null?void 0:u.getStore("scheduler");if(!n)throw new Error("The scheduler store is not set");const i=(d=this.baseProvider)==null?void 0:d.getStore("schedulerConfig");if(!i)throw new Error("The scheduler config store is not set");this.nylasConnector=new m(e,this.nylasAuth,s,t,n,i),this.init.emit(this.host).defaultPrevented||await((g=this.nylasConnector)==null?void 0:g.auth.validateSession()),this.handleAuthChange(s.state.isAuthenticated),(y=this.baseProvider)==null||y.componentWillLoad(this.nylasConnector)}componentDidLoad(){var t,s;const e=(t=this.baseProvider)==null?void 0:t.getStore("auth");e==null||e.onChange("isAuthenticated",this.handleAuthChange),(s=this.baseProvider)==null||s.componentDidLoad()}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}async registerComponentHandler(e){var t;(t=this.baseProvider)==null||t.registerComponent(e.detail)}async unregisterComponentHandler(e){var t;(t=this.baseProvider)==null||t.unregisterComponent(e.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getMailboxStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("mailbox")}async getAuthStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("auth")}async getNylasSchedulerStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("scheduler")}async getNylasSchedulerConfigStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("schedulerConfig")}render(){return r.h(r.Host,{key:"1994d94960cafdb4c1dc7b54f155a2a65190a3d9"},r.h("slot",{key:"d2a28ba4a86d0df9bd1ceeaf450f376c80ad2ea6"}))}get host(){return r.getElement(this)}};A.style=P;exports.nylas_provider=A;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { r as u, c as r, h as s, H as c, g } from "./index-e834697b.js";
|
|
2
|
+
import { N as f, e as y } from "./index-10914bc1-1a809477.js";
|
|
3
|
+
import { C, N as p } from "./auth-store-764d3768-3e9c24a0.js";
|
|
4
|
+
import { d as o } from "./utils-df5c1963-d9833bcb.js";
|
|
5
|
+
import { C as S, N as m } from "./scheduler-config-store-a059f30b-ff3efc00.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
9
|
+
class b {
|
|
10
|
+
constructor({ nylasAuth: t, nylasAuthStore: n, nylasSchedulerConfigStore: i }) {
|
|
11
|
+
this.nylasAuth = t, this.nylasAuthStore = n, this.nylasSchedulerConfigStore = i;
|
|
12
|
+
}
|
|
13
|
+
init() {
|
|
14
|
+
o("NylasSchedulerConfigConnector init");
|
|
15
|
+
}
|
|
16
|
+
get authStore() {
|
|
17
|
+
return this.nylasAuthStore;
|
|
18
|
+
}
|
|
19
|
+
get auth() {
|
|
20
|
+
return this._authConnector ? this._authConnector : (this._authConnector = new p(this.nylasAuth, this.nylasAuthStore), this._authConnector);
|
|
21
|
+
}
|
|
22
|
+
get schedulerConfigStore() {
|
|
23
|
+
return this.nylasSchedulerConfigStore;
|
|
24
|
+
}
|
|
25
|
+
get schedulerConfig() {
|
|
26
|
+
return this._schedulerConfigConnector ? this._schedulerConfigConnector : (this._schedulerConfigConnector = new m({
|
|
27
|
+
nylasAuth: this.nylasAuth,
|
|
28
|
+
nylasAuthStore: this.nylasAuthStore,
|
|
29
|
+
nylasSchedulerConfigStore: this.nylasSchedulerConfigStore
|
|
30
|
+
}), this._schedulerConfigConnector);
|
|
31
|
+
}
|
|
32
|
+
getAuth() {
|
|
33
|
+
return this.nylasAuth;
|
|
34
|
+
}
|
|
35
|
+
getTokenInfo() {
|
|
36
|
+
return this.nylasAuth.getTokenInfo();
|
|
37
|
+
}
|
|
38
|
+
resetStores() {
|
|
39
|
+
o("NylasSchedulerConfigConnector resetStores"), this.nylasAuthStore.reset(), this.nylasSchedulerConfigStore.reset();
|
|
40
|
+
}
|
|
41
|
+
async logout() {
|
|
42
|
+
o("NylasSchedulerConfigConnector logout"), await this.auth.logout(), this.resetStores();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const 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}}div.scheduler-editor-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900)}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;width:858px;margin:0;font-size:18px;line-height:24px;font-weight:600}@media screen and (max-width: 768px){div.scheduler-editor-header h1.scheduler-editor-title{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}nylas-scheduler-editor{width:100%}", x = v, w = class {
|
|
46
|
+
constructor(e) {
|
|
47
|
+
u(this, e), this.init = r(this, "init", 7), this.loggedIn = r(this, "loggedIn", 7), this.loggedOut = r(this, "loggedOut", 7), this.schedulerConfigCloseClicked = r(this, "schedulerConfigCloseClicked", 7), this.handleAuthChange = async (t) => {
|
|
48
|
+
var n;
|
|
49
|
+
t ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host).defaultPrevented || await ((n = this.nylasSchedulerConfigConnector) == null ? void 0 : n.logout());
|
|
50
|
+
}, this.handleSchedulerConfigCloseClicked = (t) => {
|
|
51
|
+
this.schedulerConfigCloseClicked.emit(this.host);
|
|
52
|
+
}, this.authConfig = void 0, this.eventOverrides = {}, this.defaultAuthStoreState = void 0, this.defaultSchedulerConfigStoreState = void 0, this.mode = "app", this.automaticComponentRegistration = !0, this.loggedInUser = "";
|
|
53
|
+
}
|
|
54
|
+
connectedCallback() {
|
|
55
|
+
o("[nylas-scheduler-config] connectedCallback");
|
|
56
|
+
}
|
|
57
|
+
async componentWillLoad() {
|
|
58
|
+
var i, a, l, h;
|
|
59
|
+
o("[nylas-scheduler-config] componentWillLoad"), this.stores = {
|
|
60
|
+
auth: C(this.defaultAuthStoreState),
|
|
61
|
+
schedulerConfig: S({
|
|
62
|
+
...this.defaultSchedulerConfigStoreState
|
|
63
|
+
})
|
|
64
|
+
}, this.baseProvider = new f(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.nylasAuth = y({
|
|
65
|
+
apiUri: "https://api.us.nylas.com",
|
|
66
|
+
elementsApiUri: "https://elements.us.nylas.com",
|
|
67
|
+
storageType: "indexeddb",
|
|
68
|
+
clientId: "YOUR_CLIENT_ID",
|
|
69
|
+
defaultScopes: [],
|
|
70
|
+
redirectURI: "/",
|
|
71
|
+
...this.authConfig
|
|
72
|
+
});
|
|
73
|
+
const e = (i = this.baseProvider) == null ? void 0 : i.getStore("auth"), t = this.baseProvider.getStore("schedulerConfig");
|
|
74
|
+
if (this.nylasSchedulerConfigConnector = new b({
|
|
75
|
+
nylasAuth: this.nylasAuth,
|
|
76
|
+
nylasAuthStore: this.stores.auth,
|
|
77
|
+
nylasSchedulerConfigStore: t
|
|
78
|
+
}), !this.init.emit(this.host).defaultPrevented) {
|
|
79
|
+
await ((a = this.nylasSchedulerConfigConnector) == null ? void 0 : a.auth.validateSession());
|
|
80
|
+
const d = await ((l = this.nylasSchedulerConfigConnector) == null ? void 0 : l.auth.getTokenInfo());
|
|
81
|
+
d && (this.loggedInUser = d.email);
|
|
82
|
+
}
|
|
83
|
+
this.handleAuthChange(e.state.isAuthenticated), (h = this.baseProvider) == null || h.componentWillLoad(this.nylasSchedulerConfigConnector);
|
|
84
|
+
}
|
|
85
|
+
async componentDidLoad() {
|
|
86
|
+
var e, t, n;
|
|
87
|
+
o("[nylas-scheduler-config] componentDidLoad"), (e = this.baseProvider) == null || e.componentDidLoad(), await ((n = (t = this.nylasSchedulerConfigConnector) == null ? void 0 : t.schedulerConfig) == null ? void 0 : n.getCalendars());
|
|
88
|
+
}
|
|
89
|
+
componentDisconnected() {
|
|
90
|
+
var e;
|
|
91
|
+
(e = this.baseProvider) == null || e.componentDisconnected();
|
|
92
|
+
}
|
|
93
|
+
async registerComponentHandler(e) {
|
|
94
|
+
var t;
|
|
95
|
+
(t = this.baseProvider) == null || t.registerComponent(e.detail);
|
|
96
|
+
}
|
|
97
|
+
async unregisterComponentHandler(e) {
|
|
98
|
+
var t;
|
|
99
|
+
(t = this.baseProvider) == null || t.unregisterComponent(e.detail);
|
|
100
|
+
}
|
|
101
|
+
async schedulerConfigChangedHandler(e) {
|
|
102
|
+
console.log("schedulerConfigChanged", e.detail);
|
|
103
|
+
}
|
|
104
|
+
render() {
|
|
105
|
+
return this.mode === "app" ? s(c, null, s("div", { class: "scheduler-editor-header" }, s("h1", { class: "scheduler-editor-title" }, s("calendar-icon", { width: "18", height: "18" }), "Schedule editor"), s("button", { class: "scheduler-editor-close", onClick: (t) => this.handleSchedulerConfigCloseClicked(t), part: "nsc-close-button" }, s("close-icon", { width: "18", height: "18" }))), s("nylas-scheduler-editor", null)) : s(c, null, s("slot", null));
|
|
106
|
+
}
|
|
107
|
+
get host() {
|
|
108
|
+
return g(this);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
w.style = x;
|
|
112
|
+
export {
|
|
113
|
+
w as nylas_scheduler_config
|
|
114
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-cee193d2.cjs"),d=require("./index-10914bc1-93ff6f46.cjs"),c=require("./auth-store-764d3768-ce84fc6a.cjs"),o=require("./utils-df5c1963-1c47e21c.cjs"),u=require("./scheduler-config-store-a059f30b-06c1aa21.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class f{constructor({nylasAuth:t,nylasAuthStore:n,nylasSchedulerConfigStore:r}){this.nylasAuth=t,this.nylasAuthStore=n,this.nylasSchedulerConfigStore=r}init(){o.debug("NylasSchedulerConfigConnector init")}get authStore(){return this.nylasAuthStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new c.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){return this._schedulerConfigConnector?this._schedulerConfigConnector:(this._schedulerConfigConnector=new u.NylasSchedulerConfigAPIConnector({nylasAuth:this.nylasAuth,nylasAuthStore:this.nylasAuthStore,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore}),this._schedulerConfigConnector)}getAuth(){return this.nylasAuth}getTokenInfo(){return this.nylasAuth.getTokenInfo()}resetStores(){o.debug("NylasSchedulerConfigConnector resetStores"),this.nylasAuthStore.reset(),this.nylasSchedulerConfigStore.reset()}async logout(){o.debug("NylasSchedulerConfigConnector logout"),await this.auth.logout(),this.resetStores()}}const y=":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}}div.scheduler-editor-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900)}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;width:858px;margin:0;font-size:18px;line-height:24px;font-weight:600}@media screen and (max-width: 768px){div.scheduler-editor-header h1.scheduler-editor-title{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}nylas-scheduler-editor{width:100%}",C=y,g=class{constructor(e){s.registerInstance(this,e),this.init=s.createEvent(this,"init",7),this.loggedIn=s.createEvent(this,"loggedIn",7),this.loggedOut=s.createEvent(this,"loggedOut",7),this.schedulerConfigCloseClicked=s.createEvent(this,"schedulerConfigCloseClicked",7),this.handleAuthChange=async t=>{var n;t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host).defaultPrevented||await((n=this.nylasSchedulerConfigConnector)==null?void 0:n.logout())},this.handleSchedulerConfigCloseClicked=t=>{this.schedulerConfigCloseClicked.emit(this.host)},this.authConfig=void 0,this.eventOverrides={},this.defaultAuthStoreState=void 0,this.defaultSchedulerConfigStoreState=void 0,this.mode="app",this.automaticComponentRegistration=!0,this.loggedInUser=""}connectedCallback(){o.debug("[nylas-scheduler-config] connectedCallback")}async componentWillLoad(){var r,i,a,l;o.debug("[nylas-scheduler-config] componentWillLoad"),this.stores={auth:c.CreateNylasAuthStore(this.defaultAuthStoreState),schedulerConfig:u.CreateNylasSchedulerConfigStore({...this.defaultSchedulerConfigStoreState})},this.baseProvider=new d.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.nylasAuth=d.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const e=(r=this.baseProvider)==null?void 0:r.getStore("auth"),t=this.baseProvider.getStore("schedulerConfig");if(this.nylasSchedulerConfigConnector=new f({nylasAuth:this.nylasAuth,nylasAuthStore:this.stores.auth,nylasSchedulerConfigStore:t}),!this.init.emit(this.host).defaultPrevented){await((i=this.nylasSchedulerConfigConnector)==null?void 0:i.auth.validateSession());const h=await((a=this.nylasSchedulerConfigConnector)==null?void 0:a.auth.getTokenInfo());h&&(this.loggedInUser=h.email)}this.handleAuthChange(e.state.isAuthenticated),(l=this.baseProvider)==null||l.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){var e,t,n;o.debug("[nylas-scheduler-config] componentDidLoad"),(e=this.baseProvider)==null||e.componentDidLoad(),await((n=(t=this.nylasSchedulerConfigConnector)==null?void 0:t.schedulerConfig)==null?void 0:n.getCalendars())}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}async registerComponentHandler(e){var t;(t=this.baseProvider)==null||t.registerComponent(e.detail)}async unregisterComponentHandler(e){var t;(t=this.baseProvider)==null||t.unregisterComponent(e.detail)}async schedulerConfigChangedHandler(e){console.log("schedulerConfigChanged",e.detail)}render(){return this.mode==="app"?s.h(s.Host,null,s.h("div",{class:"scheduler-editor-header"},s.h("h1",{class:"scheduler-editor-title"},s.h("calendar-icon",{width:"18",height:"18"}),"Schedule editor"),s.h("button",{class:"scheduler-editor-close",onClick:t=>this.handleSchedulerConfigCloseClicked(t),part:"nsc-close-button"},s.h("close-icon",{width:"18",height:"18"}))),s.h("nylas-scheduler-editor",null)):s.h(s.Host,null,s.h("slot",null))}get host(){return s.getElement(this)}};g.style=C;exports.nylas_scheduler_config=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-cee193d2.cjs"),g=require("./register-component-486ea571-cdfe1ef9.cjs"),h=require("./utils-df5c1963-1c47e21c.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");const v=":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}",x=v;var S=function(e,t,n,r){var l=arguments.length,i=l<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(l<3?s(i):l>3?s(t,n,i):s(t,n))||i);return l>3&&i&&Object.defineProperty(t,n,i),i},p=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};const y=class{constructor(e){a.registerInstance(this,e),this.schedulerConfigChanged=a.createEvent(this,"schedulerConfigChanged",7),this.formSubmissionHandler=async t=>{var d,f;t.preventDefault(),this.updateFormState();const{title:n,description:r,duration:l,availability:i,calendarIds:s,participants:o}=this.formState;console.log("participants: ",o);const c=(f=(d=this.config)==null?void 0:d.participants)==null?void 0:f.find(u=>u.is_organizer),b={availability:{duration_minutes:parseInt(l)},participants:[{name:(c==null?void 0:c.name)??"",email:(c==null?void 0:c.email)??"",is_organizer:!0,availability:{calendar_ids:s.length?s:["primary"],open_hours:i??[]}}],event_booking:{title:(n==null?void 0:n.toString())??"",description:(r==null?void 0:r.toString())??""}};this.schedulerConfigChanged.emit(b)},this.calendars=void 0,this.config=void 0,this.activeTab="eventInfo",this.formState=this.getFormStateFromConfig()}configChangedHandler(e){h.debug("nylas-scheduler-editor","configChangedHandler",e),this.formState=this.getFormStateFromConfig()}connectedCallback(){h.debug("nylas-scheduler-editor","connectedCallback")}componentWillLoad(){h.debug("nylas-scheduler-editor","componentWillLoad")}componentDidLoad(){h.debug("nylas-scheduler-editor","componentDidLoad")}disconnectedCallback(){h.debug("nylas-scheduler-editor","disconnectedCallback")}getFormStateFromConfig(){var t,n,r,l,i,s,o,c,b,d,f,u;const e=(n=(t=this.config)==null?void 0:t.participants)==null?void 0:n.find(m=>m.is_organizer);return{title:((l=(r=this.config)==null?void 0:r.event_booking)==null?void 0:l.title)??"",description:((s=(i=this.config)==null?void 0:i.event_booking)==null?void 0:s.description)??"",duration:((b=(c=(o=this.config)==null?void 0:o.availability)==null?void 0:c.duration_minutes)==null?void 0:b.toString())??"10",availability:((d=e==null?void 0:e.availability)==null?void 0:d.open_hours)??void 0,calendarIds:((f=e==null?void 0:e.availability)==null?void 0:f.calendar_ids)??[],participants:((u=this.config)==null?void 0:u.participants)??[]}}updateFormState(){new FormData(this.formRef).forEach((t,n)=>{switch(n){case"title":this.formState.title=t.toString();break;case"description":this.formState.description=t.toString();break;case"duration":this.formState.duration=t.toString();break;case"availability":this.formState.availability=JSON.parse(t.toString());break;case"participants":this.formState.participants=JSON.parse(t.toString());break;case"calendars":this.formState.calendarIds=t.toString().split(",");break}}),this.formState={...this.formState}}setActiveTab(e,t){e.preventDefault(),this.updateFormState(),this.activeTab=t}renderTabContent(e){var t;switch(this.activeTab){case"eventInfo":const n=e.title,r=e.description,l=parseInt(e.duration),i=e.participants;return a.h("div",null,a.h("nylas-event-info",null,a.h("div",{slot:"inputs"},a.h("nylas-event-title",{name:"title",eventTitle:n}),a.h("nylas-event-duration",{name:"duration",eventDurationMinutes:l}),a.h("nylas-event-description",{name:"description",eventDescription:r}))),a.h("nylas-additional-participants",{name:"participants",eventParticipants:i}));case"availability":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",b=e.calendarIds.length>0?e.calendarIds:[c];return a.h("div",null,a.h("nylas-calendar-picker",{name:"calendars",calendars:this.calendars??[],defaultSelectedCalendars:b,organizerEmail:c}),a.h("nylas-availability-picker",{name:"availability",openHours:s}))}}render(){return a.h(a.Host,{key:"5041540c34973d7e3e4ea881f9ae0312d116910d"},a.h("form",{key:"e97d08f968108913f8313fc7c155646abc40f9b0",onSubmit:this.formSubmissionHandler,class:"scheduler-editor",ref:e=>this.formRef=e},a.h("div",{key:"10b20fef8c742f4ef50a4d41baccff514b661a9f",class:"form-contents"},a.h("div",{key:"abaef8139309661b1398aea8e0c7ff8378b3bec5",class:"tabs"},a.h("button",{key:"6d40952899d50e48ffe8531e4d7bfe70dedb5882",class:{tab:!0,active:this.activeTab=="eventInfo"},onClick:e=>this.setActiveTab(e,"eventInfo")},a.h("calendar-info-icon",{key:"fe8510f782a12d6e755d1656fe9af67b86314bf0",width:"16",height:"16"}),"Event Info"),a.h("button",{key:"4d821f8550f8e36e6a421a783034c0500fd178c6",class:{tab:!0,active:this.activeTab=="availability"},onClick:e=>this.setActiveTab(e,"availability")},a.h("calendar-patterns-icon",{key:"93c0b506aeac709c6e39c6a514fc46bec052dcc7",width:"16",height:"16"}),"Availability")),a.h("div",{key:"843934d16b0208234e400be7f1c92b5f67c36884",class:"tab-content"},this.renderTabContent(this.formState))),a.h("div",{key:"0a5b6a63138970cc1cc876894d7ec2340f5ab107",class:"footer"},a.h("button",{key:"ed49e3934719b08b08a81f095565249f109d64fb",type:"submit"},"Save changes"))))}static get watchers(){return{config:["configChangedHandler"]}}};S([g.RegisterComponent({name:"nylas-scheduler-editor",stateToProps:new Map([["schedulerConfig.calendars","calendars"],["schedulerConfig.config","config"]]),fireRegisterEvent:!0}),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",void 0)],y.prototype,"render",null);y.style=x;exports.nylas_scheduler_editor=y;
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|