@nylas/react 1.0.1-prealpha1 → 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-baecb43c.cjs → archive-icon_7.entry-052ac074.cjs} +1 -1
- package/dist/{archive-icon_7.entry-9f3eca2c.js → archive-icon_7.entry-0e34d6e7.js} +15 -15
- package/dist/{arrow-icon.entry-a3b36218.js → arrow-icon.entry-2afd9ea9.js} +2 -2
- package/dist/{arrow-icon.entry-9ab0c414.cjs → arrow-icon.entry-93f21385.cjs} +1 -1
- package/dist/auth-store-69ac49c7-5a0bbb90.cjs +1 -0
- package/dist/auth-store-69ac49c7-cbfda055.js +66 -0
- package/dist/{bold-icon_3.entry-b0d81839.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-8f498984.cjs → calendar-cancel-icon.entry-574c8aa4.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-0d07e33c.js → calendar-cancel-icon.entry-e9c692fa.js} +5 -5
- package/dist/calendar-check-icon_2.entry-b0476bca.cjs +1 -0
- package/dist/calendar-check-icon_2.entry-d461c713.js +25 -0
- package/dist/{calendar-icon.entry-e5f20598.js → calendar-icon.entry-1ca202a4.js} +5 -5
- package/dist/{calendar-icon.entry-219efd7a.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/{nylas-booked-event-card_10.entry-27efa654.cjs → constants-b6bf6671-27e2557d.cjs} +6 -6
- package/dist/{nylas-booked-event-card_10.entry-f2481a57.js → constants-b6bf6671-49a0f1f2.js} +1656 -2374
- package/dist/{document-refresh-icon.entry-89ad42fa.js → document-refresh-icon.entry-faea08ce.js} +5 -5
- package/dist/document-refresh-icon.entry-fcb33921.cjs +1 -0
- package/dist/elements/index.d.ts +24 -2
- package/dist/{forward-icon_6.entry-0a6dff18.js → forward-icon_6.entry-8da1f65d.js} +82 -82
- package/dist/{forward-icon_6.entry-ce725f05.cjs → forward-icon_6.entry-c4b37cb1.cjs} +3 -3
- package/dist/{globe-icon.entry-71414bc6.js → globe-icon.entry-4720304b.js} +4 -4
- package/dist/{globe-icon.entry-a0c9599a.cjs → globe-icon.entry-90a0b9c9.cjs} +1 -1
- package/dist/{index-b30d446a-e0eaccad.js → index-10914bc1-346f04fa.js} +3 -3
- package/dist/{index-b30d446a-3d69a3cc.cjs → index-10914bc1-c8c3a2f3.cjs} +1 -1
- package/dist/index-457dcf0b.cjs +30 -0
- package/dist/index-ce40ad47.js +1570 -0
- package/dist/index.d.ts +1 -1
- 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-e721b17c-4e97e07d.cjs +1 -0
- package/dist/{mailbox-store-19f0c6c9-23a4e72f.js → mailbox-store-e721b17c-cf9a43dd.js} +59 -121
- 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-d805d4c6.js → nylas-if-state_3.entry-2eb3f385.js} +12 -10
- package/dist/nylas-if-state_3.entry-5baf6d6f.cjs +1 -0
- package/dist/nylas-list-folders.entry-3b24d92d.cjs +1 -0
- package/dist/{nylas-list-folders.entry-472bd255.js → nylas-list-folders.entry-995fa819.js} +9 -8
- package/dist/{nylas-list-threads.entry-f3266bf7.js → nylas-list-threads.entry-21466eb3.js} +7 -6
- package/dist/nylas-list-threads.entry-fda42ded.cjs +1 -0
- package/dist/{nylas-mailbox-pagination.entry-bd0d3bda.js → nylas-mailbox-pagination.entry-02d40186.js} +4 -3
- package/dist/nylas-mailbox-pagination.entry-9dcd4901.cjs +1 -0
- package/dist/nylas-mailbox-toolbar-button.entry-d1099fab.cjs +1 -0
- package/dist/{nylas-mailbox-toolbar-button.entry-9641b5cd.js → nylas-mailbox-toolbar-button.entry-dbad44b4.js} +10 -9
- package/dist/nylas-provider.entry-78e2fa30.cjs +1 -0
- package/dist/nylas-provider.entry-bbee8c99.js +155 -0
- package/dist/nylas-scheduler-editor.entry-550d3c59.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-8f7ecf3b.js +111 -0
- package/dist/nylas-scheduling.entry-22b5ad07.js +236 -0
- package/dist/nylas-scheduling.entry-30a63738.cjs +1 -0
- package/dist/nylas-threads-refresh.entry-05258b36.cjs +1 -0
- package/dist/{nylas-threads-refresh.entry-7d567ed1.js → nylas-threads-refresh.entry-414d8740.js} +6 -5
- package/dist/{nylas-threads-search.entry-c881d54b.js → nylas-threads-search.entry-a19dc90f.js} +14 -13
- package/dist/nylas-threads-search.entry-ff21fc65.cjs +1 -0
- package/dist/{nylas-view-thread.entry-d8de6c83.js → nylas-view-thread.entry-38149162.js} +5 -4
- package/dist/nylas-view-thread.entry-5da81e99.cjs +1 -0
- package/dist/people-icon.entry-4b682757.cjs +1 -0
- package/dist/people-icon.entry-5c244c8d.js +15 -0
- 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 +79 -57
- package/dist/{refresh-icon.entry-3e0aef26.cjs → refresh-icon.entry-59fff3d4.cjs} +1 -1
- package/dist/{refresh-icon.entry-9563850b.js → refresh-icon.entry-63456c9a.js} +2 -2
- package/dist/{register-component-152c6ad2-b0d34c36.cjs → register-component-d056a880-2be11c56.cjs} +1 -1
- package/dist/{register-component-152c6ad2-418db864.js → register-component-d056a880-f3003d6c.js} +2 -2
- package/dist/scheduler-config-store-4d035001-0256b40c.cjs +1 -0
- package/dist/scheduler-config-store-4d035001-db9dc78a.js +33 -0
- package/dist/{scheduler-store-7d48e682-39104219.js → scheduler-store-0fbe642c-14466305.js} +99 -95
- package/dist/scheduler-store-0fbe642c-410fdbf4.cjs +1 -0
- package/dist/translate-icon.entry-1784c18e.cjs +1 -0
- package/dist/translate-icon.entry-35999e70.js +15 -0
- package/dist/utils-0cd66d04-89ab163d.js +2111 -0
- package/dist/utils-0cd66d04-94b9c3b6.cjs +8 -0
- package/dist/warning-icon.entry-3a702d1d.cjs +1 -0
- package/dist/warning-icon.entry-73de08c3.js +15 -0
- package/package.json +7 -4
- package/dist/add-circle-icon.entry-4b8debfa.js +0 -15
- package/dist/add-circle-icon.entry-c5fdaa6f.cjs +0 -1
- package/dist/bold-icon_3.entry-50406bc7.cjs +0 -1
- package/dist/calendar-check-icon_3.entry-5415e916.cjs +0 -1
- package/dist/calendar-check-icon_3.entry-cfb612c6.js +0 -35
- package/dist/chevron-icon.entry-3c709061.cjs +0 -1
- package/dist/chevron-icon.entry-f5d5d1b1.js +0 -15
- package/dist/close-icon_2.entry-eca351c4.js +0 -25
- package/dist/close-icon_2.entry-fa4f6d3e.cjs +0 -1
- package/dist/document-refresh-icon.entry-3a29a6e6.cjs +0 -1
- package/dist/duration-bddc4a13-05d3e3e2.cjs +0 -1
- package/dist/duration-bddc4a13-179ce826.js +0 -41
- package/dist/index-586a4206.cjs +0 -30
- package/dist/index-98d3a4da.js +0 -1498
- package/dist/loading-icon.entry-15debb7d.js +0 -15
- package/dist/loading-icon.entry-d2680046.cjs +0 -1
- package/dist/mailbox-store-19f0c6c9-9a3ef58a.cjs +0 -1
- package/dist/nylas-if-state_3.entry-6c0bf8eb.cjs +0 -1
- package/dist/nylas-list-folders.entry-cc04a07e.cjs +0 -1
- package/dist/nylas-list-threads.entry-795c5a2b.cjs +0 -1
- package/dist/nylas-mailbox-pagination.entry-f701fd83.cjs +0 -1
- package/dist/nylas-mailbox-toolbar-button.entry-b9d6a3c8.cjs +0 -1
- package/dist/nylas-open-hours-picker.entry-42942946.js +0 -186
- package/dist/nylas-open-hours-picker.entry-aa103daf.cjs +0 -1
- package/dist/nylas-provider.entry-5bb55b2d.cjs +0 -1
- package/dist/nylas-provider.entry-b94198a1.js +0 -134
- package/dist/nylas-scheduler.entry-3b7cb841.js +0 -230
- package/dist/nylas-scheduler.entry-ea6fb146.cjs +0 -1
- package/dist/nylas-threads-refresh.entry-4002608b.cjs +0 -1
- package/dist/nylas-threads-search.entry-556f1219.cjs +0 -1
- package/dist/nylas-view-thread.entry-6faf1b51.cjs +0 -1
- package/dist/play-icon_2.entry-2e21b8b9.cjs +0 -1
- package/dist/play-icon_2.entry-cae94826.js +0 -25
- package/dist/scheduler-store-7d48e682-449277d4.cjs +0 -1
- package/dist/search-icon_3.entry-9b027cfc.cjs +0 -1
- package/dist/search-icon_3.entry-e36548ec.js +0 -101
- package/dist/utils-5074a070-ce33ee6b.js +0 -119
- package/dist/utils-5074a070-d5ba6add.cjs +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-457dcf0b.cjs"),C=require("./index-10914bc1-c8c3a2f3.cjs"),l=require("./utils-0cd66d04-94b9c3b6.cjs"),S=require("./auth-store-69ac49c7-5a0bbb90.cjs"),o=require("./mailbox-store-e721b17c-4e97e07d.cjs"),f=require("./scheduler-store-0fbe642c-410fdbf4.cjs"),b=require("./scheduler-config-store-4d035001-0256b40c.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:"c70dbacf5502b79a6306f27b969dd9a9f841f5a0"},r.h("slot",{key:"031e85b2e755d2e4b7f925982a47e32daa5f8200"}))}get host(){return r.getElement(this)}};A.style=P;exports.nylas_provider=A;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { r as C, c as h, h as g, H as S, g as f } from "./index-ce40ad47.js";
|
|
2
|
+
import { N as m, e as A } from "./index-10914bc1-346f04fa.js";
|
|
3
|
+
import { d as a } from "./utils-0cd66d04-89ab163d.js";
|
|
4
|
+
import { C as b, N as p } from "./auth-store-69ac49c7-cbfda055.js";
|
|
5
|
+
import { C as v, H as P, N as _, a as N, b as w } from "./mailbox-store-e721b17c-cf9a43dd.js";
|
|
6
|
+
import { C as I, N as x } from "./scheduler-store-0fbe642c-14466305.js";
|
|
7
|
+
import { C as M, N as E } from "./scheduler-config-store-4d035001-db9dc78a.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: "c70dbacf5502b79a6306f27b969dd9a9f841f5a0" }, g("slot", { key: "031e85b2e755d2e4b7f925982a47e32daa5f8200" }));
|
|
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 t=require("./index-457dcf0b.cjs"),d=require("./index-10914bc1-c8c3a2f3.cjs"),c=require("./auth-store-69ac49c7-5a0bbb90.cjs"),r=require("./utils-0cd66d04-94b9c3b6.cjs"),u=require("./scheduler-config-store-4d035001-0256b40c.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class y{constructor({nylasAuth:e,nylasAuthStore:n,nylasSchedulerConfigStore:o}){this.nylasAuth=e,this.nylasAuthStore=n,this.nylasSchedulerConfigStore=o}init(){r.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(){r.debug("NylasSchedulerConfigConnector resetStores"),this.nylasAuthStore.reset(),this.nylasSchedulerConfigStore.reset()}async logout(){r.debug("NylasSchedulerConfigConnector logout"),await this.auth.logout(),this.resetStores()}}const f=':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;--nylas-font-family:"Inter", sans-serif}@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-editor-tabs{width:100%}',C=f,g=class{constructor(s){t.registerInstance(this,s),this.init=t.createEvent(this,"init",7),this.loggedIn=t.createEvent(this,"loggedIn",7),this.loggedOut=t.createEvent(this,"loggedOut",7),this.schedulerConfigCloseClicked=t.createEvent(this,"schedulerConfigCloseClicked",7),this.handleAuthChange=async e=>{var n;e?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host).defaultPrevented||await((n=this.nylasSchedulerConfigConnector)==null?void 0:n.logout())},this.handleSchedulerConfigCloseClicked=e=>{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(){r.debug("[nylas-scheduler-editor] connectedCallback")}async componentWillLoad(){var o,i,a,l;r.debug("[nylas-scheduler-editor] 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 s=(o=this.baseProvider)==null?void 0:o.getStore("auth"),e=this.baseProvider.getStore("schedulerConfig");if(this.nylasSchedulerConfigConnector=new y({nylasAuth:this.nylasAuth,nylasAuthStore:this.stores.auth,nylasSchedulerConfigStore:e}),!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(s.state.isAuthenticated),(l=this.baseProvider)==null||l.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){var s,e,n;r.debug("[nylas-scheduler-editor] componentDidLoad"),(s=this.baseProvider)==null||s.componentDidLoad(),await((n=(e=this.nylasSchedulerConfigConnector)==null?void 0:e.schedulerConfig)==null?void 0:n.getCalendars())}componentDisconnected(){var s;(s=this.baseProvider)==null||s.componentDisconnected()}async registerComponentHandler(s){var e;(e=this.baseProvider)==null||e.registerComponent(s.detail)}async unregisterComponentHandler(s){var e;(e=this.baseProvider)==null||e.unregisterComponent(s.detail)}render(){return this.mode==="app"?t.h(t.Host,null,t.h("div",{class:"scheduler-editor-header"},t.h("h1",{class:"scheduler-editor-title"},t.h("calendar-icon",{width:"18",height:"18"}),"Schedule editor"),t.h("button",{class:"scheduler-editor-close",onClick:e=>this.handleSchedulerConfigCloseClicked(e),part:"nsc-close-button"},t.h("close-icon",{width:"18",height:"18"}))),t.h("nylas-editor-tabs",null)):t.h(t.Host,null,t.h("slot",null))}get host(){return t.getElement(this)}};g.style=C;exports.nylas_scheduler_editor=g;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { r as u, c as i, h as s, H as c, g } from "./index-ce40ad47.js";
|
|
2
|
+
import { N as f, e as y } from "./index-10914bc1-346f04fa.js";
|
|
3
|
+
import { C, N as p } from "./auth-store-69ac49c7-cbfda055.js";
|
|
4
|
+
import { d as o } from "./utils-0cd66d04-89ab163d.js";
|
|
5
|
+
import { C as S, N as b } from "./scheduler-config-store-4d035001-db9dc78a.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
9
|
+
class m {
|
|
10
|
+
constructor({ nylasAuth: e, nylasAuthStore: n, nylasSchedulerConfigStore: r }) {
|
|
11
|
+
this.nylasAuth = e, this.nylasAuthStore = n, this.nylasSchedulerConfigStore = r;
|
|
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 b({
|
|
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;--nylas-font-family:"Inter", sans-serif}@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-editor-tabs{width:100%}', x = v, w = class {
|
|
46
|
+
constructor(t) {
|
|
47
|
+
u(this, t), this.init = i(this, "init", 7), this.loggedIn = i(this, "loggedIn", 7), this.loggedOut = i(this, "loggedOut", 7), this.schedulerConfigCloseClicked = i(this, "schedulerConfigCloseClicked", 7), this.handleAuthChange = async (e) => {
|
|
48
|
+
var n;
|
|
49
|
+
e ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host).defaultPrevented || await ((n = this.nylasSchedulerConfigConnector) == null ? void 0 : n.logout());
|
|
50
|
+
}, this.handleSchedulerConfigCloseClicked = (e) => {
|
|
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-editor] connectedCallback");
|
|
56
|
+
}
|
|
57
|
+
async componentWillLoad() {
|
|
58
|
+
var r, a, l, h;
|
|
59
|
+
o("[nylas-scheduler-editor] 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 t = (r = this.baseProvider) == null ? void 0 : r.getStore("auth"), e = this.baseProvider.getStore("schedulerConfig");
|
|
74
|
+
if (this.nylasSchedulerConfigConnector = new m({
|
|
75
|
+
nylasAuth: this.nylasAuth,
|
|
76
|
+
nylasAuthStore: this.stores.auth,
|
|
77
|
+
nylasSchedulerConfigStore: e
|
|
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(t.state.isAuthenticated), (h = this.baseProvider) == null || h.componentWillLoad(this.nylasSchedulerConfigConnector);
|
|
84
|
+
}
|
|
85
|
+
async componentDidLoad() {
|
|
86
|
+
var t, e, n;
|
|
87
|
+
o("[nylas-scheduler-editor] componentDidLoad"), (t = this.baseProvider) == null || t.componentDidLoad(), await ((n = (e = this.nylasSchedulerConfigConnector) == null ? void 0 : e.schedulerConfig) == null ? void 0 : n.getCalendars());
|
|
88
|
+
}
|
|
89
|
+
componentDisconnected() {
|
|
90
|
+
var t;
|
|
91
|
+
(t = this.baseProvider) == null || t.componentDisconnected();
|
|
92
|
+
}
|
|
93
|
+
async registerComponentHandler(t) {
|
|
94
|
+
var e;
|
|
95
|
+
(e = this.baseProvider) == null || e.registerComponent(t.detail);
|
|
96
|
+
}
|
|
97
|
+
async unregisterComponentHandler(t) {
|
|
98
|
+
var e;
|
|
99
|
+
(e = this.baseProvider) == null || e.unregisterComponent(t.detail);
|
|
100
|
+
}
|
|
101
|
+
render() {
|
|
102
|
+
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: (e) => this.handleSchedulerConfigCloseClicked(e), part: "nsc-close-button" }, s("close-icon", { width: "18", height: "18" }))), s("nylas-editor-tabs", null)) : s(c, null, s("slot", null));
|
|
103
|
+
}
|
|
104
|
+
get host() {
|
|
105
|
+
return g(this);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
w.style = x;
|
|
109
|
+
export {
|
|
110
|
+
w as nylas_scheduler_editor
|
|
111
|
+
};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { r as x, c as u, h as n, H as d, g as _, F as k } from "./index-ce40ad47.js";
|
|
2
|
+
import { n as f, N as I } from "./index-10914bc1-346f04fa.js";
|
|
3
|
+
import { d as m } from "./utils-0cd66d04-89ab163d.js";
|
|
4
|
+
import { E as b, C, N as E } from "./scheduler-store-0fbe642c-14466305.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "react-dom";
|
|
7
|
+
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
8
|
+
class D {
|
|
9
|
+
constructor({ schedulerAPIURL: t, nylasSchedulerStore: s, sessionId: a, configId: i }) {
|
|
10
|
+
if (!t)
|
|
11
|
+
throw new Error("schedulerAPIURL is required");
|
|
12
|
+
if (!s)
|
|
13
|
+
throw new Error("nylasSchedulerStore is required");
|
|
14
|
+
if (!a && !i)
|
|
15
|
+
throw new Error("sessionId is required for private configs, if not config id is required for public configs");
|
|
16
|
+
t === "/" && (t = new URL(window.location.href).origin), this.configId = i, this.sessionId = a, 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 E({
|
|
26
|
+
schedulerAPIURL: this.schedulerAPIURL,
|
|
27
|
+
schedulerStore: this.schedulerStore,
|
|
28
|
+
sessionId: this.sessionId,
|
|
29
|
+
configId: this.configId
|
|
30
|
+
}), this._schedulerAPIConnector);
|
|
31
|
+
}
|
|
32
|
+
resetStores() {
|
|
33
|
+
this.nylasSchedulerStore.reset();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const h = (e, t) => {
|
|
37
|
+
const s = e.isLoading, a = e.showNotification;
|
|
38
|
+
return n(
|
|
39
|
+
k,
|
|
40
|
+
null,
|
|
41
|
+
a && n("nylas-notification", null),
|
|
42
|
+
s && n(
|
|
43
|
+
"div",
|
|
44
|
+
{ class: "loading" },
|
|
45
|
+
n(
|
|
46
|
+
"div",
|
|
47
|
+
{ class: "left" },
|
|
48
|
+
n("div", { class: "skeleton" })
|
|
49
|
+
),
|
|
50
|
+
n(
|
|
51
|
+
"div",
|
|
52
|
+
{ class: "right" },
|
|
53
|
+
n("div", { class: "skeleton" }),
|
|
54
|
+
n("div", { class: "skeleton" }),
|
|
55
|
+
n("div", { class: "skeleton" }),
|
|
56
|
+
n("div", { class: "skeleton" }),
|
|
57
|
+
n("div", { class: "skeleton" })
|
|
58
|
+
)
|
|
59
|
+
),
|
|
60
|
+
!s && t,
|
|
61
|
+
n(
|
|
62
|
+
"div",
|
|
63
|
+
{ class: "footer" },
|
|
64
|
+
"Powered by ",
|
|
65
|
+
n("nylas-logo", null)
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
}, y = (e, t) => n("div", { class: "message-banner" }, t), L = ':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;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin-top:1rem}.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-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:-20px;margin-right:-20px;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:16px;border-left: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:0;height:48px;gap:0.25rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height: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-200)}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}', N = L, v = { title: "Something went wrong...", type: f.Error, category: b.Component }, P = class {
|
|
69
|
+
constructor(e) {
|
|
70
|
+
x(this, e), this.init = u(this, "init", 7), this.schedulerWillLoad = u(this, "schedulerWillLoad", 7), this.schedulerDidLoad = u(this, "schedulerDidLoad", 7), this.nylasSchedulerError = u(this, "nylasSchedulerError", 7), this.mode = "app", this.defaultSchedulerState = 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.configId = 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";
|
|
71
|
+
}
|
|
72
|
+
connectedCallback() {
|
|
73
|
+
m("[nylas-scheduler] connectedCallback");
|
|
74
|
+
}
|
|
75
|
+
async componentWillLoad() {
|
|
76
|
+
var s, a;
|
|
77
|
+
if (m("[nylas-scheduler] Component will load"), this.schedulerWillLoad.emit(this.host).defaultPrevented || !this.checkIfSessionIdOrConfigIdExists())
|
|
78
|
+
return;
|
|
79
|
+
this.stores = {
|
|
80
|
+
scheduler: C({
|
|
81
|
+
bookingInfo: this.bookingInfo,
|
|
82
|
+
...this.defaultSchedulerState
|
|
83
|
+
})
|
|
84
|
+
}, this.baseProvider = new I(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
|
|
85
|
+
const t = (s = this.baseProvider) == null ? void 0 : s.getStore("scheduler");
|
|
86
|
+
if (this.nylasSchedulerConnector = new D({
|
|
87
|
+
schedulerAPIURL: this.schedulerApiUrl,
|
|
88
|
+
sessionId: this.sessionId,
|
|
89
|
+
configId: this.configId,
|
|
90
|
+
nylasSchedulerStore: t
|
|
91
|
+
}), this.init.emit(this.host), (a = this.baseProvider) == null || a.componentWillLoad(this.nylasSchedulerConnector), this.themeConfig)
|
|
92
|
+
for (const [i, o] of Object.entries(this.themeConfig))
|
|
93
|
+
this.host.style.setProperty(`${i}`, o);
|
|
94
|
+
}
|
|
95
|
+
async componentDidLoad() {
|
|
96
|
+
var o, g, l, c;
|
|
97
|
+
if ((o = this.baseProvider) == null || o.componentDidLoad(), !this.checkIfSessionIdOrConfigIdExists())
|
|
98
|
+
return;
|
|
99
|
+
const e = (g = this.baseProvider) == null ? void 0 : g.getStore("scheduler"), t = e == null ? void 0 : e.get("selectedTimeslot");
|
|
100
|
+
if (t && (t != null && t.start_time)) {
|
|
101
|
+
if (!this.isTimeslotValid(t))
|
|
102
|
+
return;
|
|
103
|
+
if (e != null && e.get("showBookingForm")) {
|
|
104
|
+
e == null || e.set("selectedDate", t.start_time);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const s = e == null ? void 0 : e.get("selectedDate"), a = e == null ? void 0 : e.get("availability");
|
|
109
|
+
let i;
|
|
110
|
+
if (!(a && a.length > 0)) {
|
|
111
|
+
if (!s)
|
|
112
|
+
i = await ((l = this.nylasSchedulerConnector) == null ? void 0 : l.scheduler.getAvailability());
|
|
113
|
+
else {
|
|
114
|
+
const r = new Date(s.getFullYear(), s.getMonth(), 1).getTime() / 1e3, p = new Date(s.getFullYear(), s.getMonth() + 1, 1).getTime() / 1e3;
|
|
115
|
+
i = await ((c = this.nylasSchedulerConnector) == null ? void 0 : c.scheduler.getAvailability(r, p));
|
|
116
|
+
}
|
|
117
|
+
if ((!i || "error" in i) && this.nylasSchedulerError.emit({ ...this.getErrorObject(i == null ? void 0 : i.error) }), !s) {
|
|
118
|
+
let r = /* @__PURE__ */ new Date();
|
|
119
|
+
const p = e == null ? void 0 : e.get("availability").find((w) => new Date(w.start_time) > /* @__PURE__ */ new Date());
|
|
120
|
+
p && (r = p.start_time), e == null || e.set("selectedDate", r);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
componentDisconnected() {
|
|
125
|
+
var e;
|
|
126
|
+
(e = this.baseProvider) == null || e.componentDisconnected();
|
|
127
|
+
}
|
|
128
|
+
bookingInfoChanged(e) {
|
|
129
|
+
var t;
|
|
130
|
+
(t = this.stores) == null || t.scheduler.set("bookingInfo", e);
|
|
131
|
+
}
|
|
132
|
+
async registerComponentHandler(e) {
|
|
133
|
+
var t;
|
|
134
|
+
(t = this.baseProvider) == null || t.registerComponent(e.detail);
|
|
135
|
+
}
|
|
136
|
+
async unregisterComponentHandler(e) {
|
|
137
|
+
var t;
|
|
138
|
+
(t = this.baseProvider) == null || t.unregisterComponent(e.detail);
|
|
139
|
+
}
|
|
140
|
+
async monthChangedHandler(e) {
|
|
141
|
+
var o;
|
|
142
|
+
const t = e.detail, s = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, a = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, i = await ((o = this.nylasSchedulerConnector) == null ? void 0 : o.scheduler.getAvailability(s, a));
|
|
143
|
+
(!i || "error" in i) && this.nylasSchedulerError.emit({ ...this.getErrorObject(i == null ? void 0 : i.error) });
|
|
144
|
+
}
|
|
145
|
+
async bookButtonClickedHandler(e) {
|
|
146
|
+
var s, a;
|
|
147
|
+
if (this.rescheduleBookingId) {
|
|
148
|
+
const i = await ((s = this.nylasSchedulerConnector) == null ? void 0 : s.scheduler.rescheduleBooking(this.rescheduleBookingId, e.detail));
|
|
149
|
+
(!i || "error" in i) && this.nylasSchedulerError.emit({ ...this.getErrorObject(i == null ? void 0 : i.error) });
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const t = await ((a = this.nylasSchedulerConnector) == null ? void 0 : a.scheduler.bookTimeslot(e.detail));
|
|
153
|
+
(!t || "error" in t) && this.nylasSchedulerError.emit({ ...this.getErrorObject(t == null ? void 0 : t.error) });
|
|
154
|
+
}
|
|
155
|
+
dateSelectedHandler(e) {
|
|
156
|
+
const t = e.detail;
|
|
157
|
+
this.selectedDateLabel = t ? t.toLocaleDateString(void 0, { dateStyle: "full" }) : "No date selected";
|
|
158
|
+
}
|
|
159
|
+
cancelBookedEventErrorHandler(e) {
|
|
160
|
+
this.nylasSchedulerError.emit({ ...this.getErrorObject(e.detail.error) });
|
|
161
|
+
}
|
|
162
|
+
rescheduleBookedEventErrorHandler(e) {
|
|
163
|
+
this.nylasSchedulerError.emit({ ...this.getErrorObject(e.detail.error) });
|
|
164
|
+
}
|
|
165
|
+
async getNylasSchedulerStore() {
|
|
166
|
+
var e;
|
|
167
|
+
return (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler");
|
|
168
|
+
}
|
|
169
|
+
async getNylasSchedulerConnector() {
|
|
170
|
+
return this.nylasSchedulerConnector;
|
|
171
|
+
}
|
|
172
|
+
async getRef() {
|
|
173
|
+
return this.host;
|
|
174
|
+
}
|
|
175
|
+
getErrorObject(e) {
|
|
176
|
+
return {
|
|
177
|
+
title: (e == null ? void 0 : e.title) || v.title,
|
|
178
|
+
category: (e == null ? void 0 : e.category) || v.category,
|
|
179
|
+
type: f.Error,
|
|
180
|
+
description: (e == null ? void 0 : e.message) || "",
|
|
181
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
182
|
+
ttl: "none"
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
checkIfSessionIdOrConfigIdExists() {
|
|
186
|
+
return !this.sessionId && !this.configId ? (this.nylasSchedulerError.emit({
|
|
187
|
+
title: "No sessionId!",
|
|
188
|
+
category: b.Component,
|
|
189
|
+
type: f.Error,
|
|
190
|
+
description: "Session ID is required",
|
|
191
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
192
|
+
ttl: "none"
|
|
193
|
+
}), !1) : !0;
|
|
194
|
+
}
|
|
195
|
+
isTimeslotValid(e) {
|
|
196
|
+
return new Date(e.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
|
|
197
|
+
title: "Invalid tiemslot!",
|
|
198
|
+
category: b.Component,
|
|
199
|
+
type: f.Error,
|
|
200
|
+
description: "The selected timeslot is invalid.",
|
|
201
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
202
|
+
ttl: "none"
|
|
203
|
+
}), !1) : !0;
|
|
204
|
+
}
|
|
205
|
+
render() {
|
|
206
|
+
var c;
|
|
207
|
+
const e = this.mode === "app", t = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler"), s = t == null ? void 0 : t.get("eventInfo"), a = t == null ? void 0 : t.get("showBookingForm"), i = t == null ? void 0 : t.get("cancelledEventInfo"), o = (t == null ? void 0 : t.get("cancelBookingId")) || this.cancelBookingId, g = t == null ? void 0 : t.get("selectedTimeslot"), l = (t == null ? void 0 : t.get("rescheduleBookingId")) || this.rescheduleBookingId;
|
|
208
|
+
if (e && o && !i)
|
|
209
|
+
return n(d, 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: o, exportparts: "ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label" }))));
|
|
210
|
+
if (e && i)
|
|
211
|
+
return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, n("nylas-cancelled-event-card", { cancelledEventInfo: i, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
|
|
212
|
+
if (e && s)
|
|
213
|
+
return n(d, 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" }))));
|
|
214
|
+
if (e && (!s || l) && !a) {
|
|
215
|
+
const r = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
|
|
216
|
+
return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, l && n(y, null, "Choose another time slot to reschedule your meeting"), 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" }, r && n("span", { slot: "timeslot-picker-cta-label" }, n("slot", { name: "timeslot-picker-cta-label" })))))));
|
|
217
|
+
}
|
|
218
|
+
if (e && !s && a) {
|
|
219
|
+
const r = this.host.querySelector('[slot="custom-booking-form"]');
|
|
220
|
+
return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, l && n(y, null, "Choose another time slot to reschedule your meeting"), 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" }, r && n("div", { slot: "custom-booking-form" }, n("slot", { name: "custom-booking-form" })))))));
|
|
221
|
+
}
|
|
222
|
+
return n(d, null, n("slot", null));
|
|
223
|
+
}
|
|
224
|
+
get host() {
|
|
225
|
+
return _(this);
|
|
226
|
+
}
|
|
227
|
+
static get watchers() {
|
|
228
|
+
return {
|
|
229
|
+
bookingInfo: ["bookingInfoChanged"]
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
P.style = N;
|
|
234
|
+
export {
|
|
235
|
+
P as nylas_scheduling
|
|
236
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-457dcf0b.cjs"),h=require("./index-10914bc1-c8c3a2f3.cjs"),f=require("./utils-0cd66d04-94b9c3b6.cjs"),g=require("./scheduler-store-0fbe642c-410fdbf4.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class w{constructor({schedulerAPIURL:n,nylasSchedulerStore:s,sessionId:o,configId:i}){if(!n)throw new Error("schedulerAPIURL is required");if(!s)throw new Error("nylasSchedulerStore is required");if(!o&&!i)throw new Error("sessionId is required for private configs, if not config id is required for public configs");n==="/"&&(n=new URL(window.location.href).origin),this.configId=i,this.sessionId=o,this.schedulerAPIURL=n,this.nylasSchedulerStore=s}init(){f.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,configId:this.configId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const c=(e,n)=>{const s=e.isLoading,o=e.showNotification;return t.h(t.Fragment,null,o&&t.h("nylas-notification",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,t.h("div",{class:"footer"},"Powered by ",t.h("nylas-logo",null)))},m=(e,n)=>t.h("div",{class:"message-banner"},n),x=':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;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin-top:1rem}.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-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:-20px;margin-right:-20px;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:16px;border-left: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:0;height:48px;gap:0.25rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height: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-200)}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}',_=x,b={title:"Something went wrong...",type:h.nr.Error,category:g.ErrorCategory.Component},y=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.defaultSchedulerState=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.configId=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(){f.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var s,o;if(f.debug("[nylas-scheduler] Component will load"),this.schedulerWillLoad.emit(this.host).defaultPrevented||!this.checkIfSessionIdOrConfigIdExists())return;this.stores={scheduler:g.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,...this.defaultSchedulerState})},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 w({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.configId,nylasSchedulerStore:n}),this.init.emit(this.host),(o=this.baseProvider)==null||o.componentWillLoad(this.nylasSchedulerConnector),this.themeConfig)for(const[i,a]of Object.entries(this.themeConfig))this.host.style.setProperty(`${i}`,a)}async componentDidLoad(){var a,u,l,d;if((a=this.baseProvider)==null||a.componentDidLoad(),!this.checkIfSessionIdOrConfigIdExists())return;const e=(u=this.baseProvider)==null?void 0:u.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"),o=e==null?void 0:e.get("availability");let i;if(!(o&&o.length>0)){if(!s)i=await((l=this.nylasSchedulerConnector)==null?void 0:l.scheduler.getAvailability());else{const r=new Date(s.getFullYear(),s.getMonth(),1).getTime()/1e3,p=new Date(s.getFullYear(),s.getMonth()+1,1).getTime()/1e3;i=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.getAvailability(r,p))}if((!i||"error"in i)&&this.nylasSchedulerError.emit({...this.getErrorObject(i==null?void 0:i.error)}),!s){let r=new Date;const p=e==null?void 0:e.get("availability").find(v=>new Date(v.start_time)>new Date);p&&(r=p.start_time),e==null||e.set("selectedDate",r)}}}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 a;const n=e.detail,s=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,o=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,i=await((a=this.nylasSchedulerConnector)==null?void 0:a.scheduler.getAvailability(s,o));(!i||"error"in i)&&this.nylasSchedulerError.emit({...this.getErrorObject(i==null?void 0:i.error)})}async bookButtonClickedHandler(e){var s,o;if(this.rescheduleBookingId){const i=await((s=this.nylasSchedulerConnector)==null?void 0:s.scheduler.rescheduleBooking(this.rescheduleBookingId,e.detail));(!i||"error"in i)&&this.nylasSchedulerError.emit({...this.getErrorObject(i==null?void 0:i.error)});return}const n=await((o=this.nylasSchedulerConnector)==null?void 0:o.scheduler.bookTimeslot(e.detail));(!n||"error"in n)&&this.nylasSchedulerError.emit({...this.getErrorObject(n==null?void 0:n.error)})}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(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){return!this.sessionId&&!this.configId?(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):!0}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"),o=n==null?void 0:n.get("showBookingForm"),i=n==null?void 0:n.get("cancelledEventInfo"),a=(n==null?void 0:n.get("cancelBookingId"))||this.cancelBookingId,u=n==null?void 0:n.get("selectedTimeslot"),l=(n==null?void 0:n.get("rescheduleBookingId"))||this.rescheduleBookingId;if(e&&a&&!i)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:a,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))));if(e&&i)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",{cancelledEventInfo:i,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))));if(e&&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&&(!s||l)&&!o){const r=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},l&&t.h(m,null,"Choose another time slot to reschedule your meeting"),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"},r&&t.h("span",{slot:"timeslot-picker-cta-label"},t.h("slot",{name:"timeslot-picker-cta-label"})))))))}if(e&&!s&&o){const r=this.host.querySelector('[slot="custom-booking-form"]');return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},l&&t.h(m,null,"Choose another time slot to reschedule your meeting"),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"},r&&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"]}}};y.style=_;exports.nylas_scheduling=y;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-457dcf0b.cjs"),f=require("./register-component-d056a880-2be11c56.cjs"),o=require("./utils-0cd66d04-94b9c3b6.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");const u=":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}",p=u;var g=function(t,e,n,a){var i=arguments.length,s=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,n,a);else for(var l=t.length-1;l>=0;l--)(h=t[l])&&(s=(i<3?h(s):i>3?h(e,n,s):h(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},c=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const d=class{constructor(t){r.registerInstance(this,t),this.refresh=r.createEvent(this,"refresh",7),this.threshold=100,this.onTouchStart=e=>{var n,a,i,s;o.debug("[nylas-threads-refresh] Touch start",e.touches[0].pageY,(n=this.containerElement)==null?void 0:n.scrollTop,(a=this.containerElement)==null?void 0:a.offsetHeight,(i=this.contentElement)==null?void 0:i.scrollTop),((s=this.containerElement)==null?void 0:s.scrollTop)===0?this.start=e.touches[0].pageY:this.start=0},this.onTouchMove=e=>{this.start&&(e.touches[0].pageY-this.start>this.threshold?this.pulling=!0:this.pulling=!1)},this.onTouchEnd=e=>{this.start&&(e.changedTouches[0].pageY-this.start>this.threshold&&(this.pulling=!1,this.refresh.emit({updateState:this.updateState})),this.start=0)},this.start=0,this.state="ready",this.pulling=!1,o.debug("[nylas-threads-refresh] Constructor"),this.updateState=this.updateState.bind(this)}connectedCallback(){}async componentWillLoad(){o.debug("[nylas-threads-refresh] Component will load")}componentDidLoad(){var t,e,n;o.debug("[nylas-threads-refresh] Component did load"),(t=this.containerElement)==null||t.addEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.addEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.addEventListener("touchend",this.onTouchEnd)}disconnectedCallback(){var t,e,n;o.debug("[nylas-threads-refresh] Component disconnected"),(t=this.containerElement)==null||t.removeEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.removeEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.removeEventListener("touchend",this.onTouchEnd)}async updateState(t){this.state=t}render(){return r.h(r.Host,{key:"9027360ae546f7cb1cf5c1e8f977d2e8f85eb3fd"},r.h("div",{key:"7bf8bf464971f8669d6cb1fc31c478ed29fbda63",class:"container",ref:t=>this.containerElement=t},r.h("button",{key:"af4dc6f3ec1e45554f13f0dbee2945a7b60acc6c",class:{"pull-to-refresh":!0,pulling:this.pulling,refreshing:this.state==="loading"},"aria-label":"Refreshing..."},this.state==="loading"&&r.h("refresh-icon",{slot:"icon"}),this.state!=="loading"&&r.h("arrow-icon",{slot:"icon"})),r.h("div",{key:"d2bceb3b11369e03a9eefa80f983f341bae71239",class:"content",ref:t=>this.contentElement=t},r.h("slot",{key:"c88b393187aa10285fd940d11bf7b792ac4dbf14"}))))}};g([f.RegisterComponent({name:"nylas-threads-refresh",eventToProps:{refresh:async(t,e)=>{o.debug("[nylas-threads-refresh] Refreshing threads");const{updateState:n}=t.detail;await n("loading"),await e.threads.getThreads(void 0,"overwrite",!1),await n("ready")}},fireRegisterEvent:!0}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],d.prototype,"render",null);d.style=p;exports.nylas_threads_refresh=d;
|
package/dist/{nylas-threads-refresh.entry-7d567ed1.js → nylas-threads-refresh.entry-414d8740.js}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { r as f, c as p, h as o, H as u } from "./index-
|
|
2
|
-
import { R as m } from "./register-component-
|
|
3
|
-
import { d as i } from "./utils-
|
|
1
|
+
import { r as f, c as p, h as o, H as u } from "./index-ce40ad47.js";
|
|
2
|
+
import { R as m } from "./register-component-d056a880-f3003d6c.js";
|
|
3
|
+
import { d as i } from "./utils-0cd66d04-89ab163d.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-dom";
|
|
6
|
+
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
6
7
|
const g = ":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}", y = g;
|
|
7
8
|
var v = function(t, e, s, r) {
|
|
8
9
|
var a = arguments.length, n = a < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, s) : r, h;
|
|
@@ -46,11 +47,11 @@ const d = class {
|
|
|
46
47
|
this.state = t;
|
|
47
48
|
}
|
|
48
49
|
render() {
|
|
49
|
-
return o(u, { key: "
|
|
50
|
+
return o(u, { key: "9027360ae546f7cb1cf5c1e8f977d2e8f85eb3fd" }, o("div", { key: "7bf8bf464971f8669d6cb1fc31c478ed29fbda63", class: "container", ref: (t) => this.containerElement = t }, o("button", { key: "af4dc6f3ec1e45554f13f0dbee2945a7b60acc6c", class: {
|
|
50
51
|
"pull-to-refresh": !0,
|
|
51
52
|
pulling: this.pulling,
|
|
52
53
|
refreshing: this.state === "loading"
|
|
53
|
-
}, "aria-label": "Refreshing..." }, this.state === "loading" && o("refresh-icon", { slot: "icon" }), this.state !== "loading" && o("arrow-icon", { slot: "icon" })), o("div", { key: "
|
|
54
|
+
}, "aria-label": "Refreshing..." }, this.state === "loading" && o("refresh-icon", { slot: "icon" }), this.state !== "loading" && o("arrow-icon", { slot: "icon" })), o("div", { key: "d2bceb3b11369e03a9eefa80f983f341bae71239", class: "content", ref: (t) => this.contentElement = t }, o("slot", { key: "c88b393187aa10285fd940d11bf7b792ac4dbf14" }))));
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
v([
|