@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
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { r as t, h as e } from "./index-98d3a4da.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import "react-dom";
|
|
4
|
-
const i = ".wave{display:flex;align-items:center;justify-content:center}.dot{width:4px;height:4px;background-color:var(--dot-color, white);border-radius:50%;margin:0 2px;animation:wave 1.5s infinite ease-in-out}.dot:nth-child(2){animation-delay:0.2s}.dot:nth-child(3){animation-delay:0.4s}@keyframes wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-4px)}}", n = i, o = class {
|
|
5
|
-
constructor(a) {
|
|
6
|
-
t(this, a), this.width = "15", this.height = "15";
|
|
7
|
-
}
|
|
8
|
-
render() {
|
|
9
|
-
return e("div", { key: "bf96616e119f5ffef943b4bee1c45cbf9919bba7", class: "wave" }, e("div", { key: "cb1a652eae22004ac8f265f68a8dbf56adeaf0e1", class: "dot" }), e("div", { key: "5f608e19d592c0fb0fd81b43702c391af2667f41", class: "dot" }), e("div", { key: "1b2d7ab591ec6e8fe0c1502a8e290281ce140e52", class: "dot" }));
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
o.style = n;
|
|
13
|
-
export {
|
|
14
|
-
o as loading_icon
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-586a4206.cjs");require("react");require("react-dom");const i=".wave{display:flex;align-items:center;justify-content:center}.dot{width:4px;height:4px;background-color:var(--dot-color, white);border-radius:50%;margin:0 2px;animation:wave 1.5s infinite ease-in-out}.dot:nth-child(2){animation-delay:0.2s}.dot:nth-child(3){animation-delay:0.4s}@keyframes wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-4px)}}",n=i,t=class{constructor(a){e.registerInstance(this,a),this.width="15",this.height="15"}render(){return e.h("div",{key:"bf96616e119f5ffef943b4bee1c45cbf9919bba7",class:"wave"},e.h("div",{key:"cb1a652eae22004ac8f265f68a8dbf56adeaf0e1",class:"dot"}),e.h("div",{key:"5f608e19d592c0fb0fd81b43702c391af2667f41",class:"dot"}),e.h("div",{key:"1b2d7ab591ec6e8fe0c1502a8e290281ce140e52",class:"dot"}))}};t.style=n;exports.loading_icon=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./utils-5074a070-d5ba6add.cjs"),i=require("./index-b30d446a-3d69a3cc.cjs");class g{constructor(t,e){this.nylasAuth=t,this.nylasAuthStore=e}async validateSession(){const t=await this.isAccessTokenValid();if(!t)this.logout();else{let e=await this.nylasAuth.getTokenInfo();if(e){const a=Math.floor(Date.now()/1e3);if(e.expires_in&&e.expires_in-a<3e5&&(o.debug("[NylasAuthConnectorMixin] Refreshing access token"),e=await this.nylasAuth.refreshAccessToken(),!e)){o.debug("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out."),this.logout();return}this.nylasAuthStore.state.tokenInfo=e}}this.nylasAuthStore.state.isAuthenticated=t}async isAuthenticated(){return this.nylasAuth.isAuthenticated()}async getTokenInfo(){return this.nylasAuth.getTokenInfo()}async isAccessTokenValid(){return this.nylasAuth.isAccessTokenValid()}async logout(){await this.nylasAuth.logout()}async getHostedAuthRedirectURL(t,e,s){return this.nylasAuth.getHostedAuthRedirectURL(t,e,s)}async manageHostedAuthCodeExchange(t){const s=new URL(t).searchParams.get("code");if(s){const a=await this.nylasAuth.exchangeAuthCodeForTokenInfo(s);if(a)return this.nylasAuthStore.state.tokenInfo=a,this.nylasAuthStore.state.isAuthenticated=!0,a}return null}}class f{constructor(t,e,s){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s}async getMessages(){var n;if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");this.nylasMailboxStore.state.state="loading";const t=this.nylasMailboxStore.state.messgeQueryParams,e=new URLSearchParams;for(const h in t){const u=(n=t[h])==null?void 0:n.toString();u&&e.append(h,u)}const s=`/v3/grants/me/messages?${e.toString()}`,a=await this.nylasAuth.nylasAPIRequest(s);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.messages=r,this.nylasMailboxStore.state.state="ready",r}async getThreadMessages(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=await this.nylasAuth.nylasAPIRequest(`/v3/grants/me/messages?thread_id=${t}&fields=include_headers`);if(i.Xr(e))throw new i.Zr(e.error);const s=e.data;return this.nylasMailboxStore.state.messages=s,s}downloadMessageAttachments(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=[],s=t.attachments||[];for(const a of s){const r=this.nylasAuth.nylasDownloadFileRequest(`/v3/grants/me/attachments/${a.id}?message_id=${t.id}`);e.push(r)}return e}async summarizeText(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=await this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/summarize","POST",{message:{body:t}},!0,this.nylasAuth.config.elementsApiUri);if(i.Xr(e))throw new i.Zr(e.error);return e.data.summary}async textToSpeech(t,e){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");return this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/tts","POST",{text:t},!1,this.nylasAuth.config.elementsApiUri,{...e?{signal:e==null?void 0:e.signal}:{}})}}class w{constructor(t,e,s,a){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s,this.router=a}async getThreads(t,e="overwrite",s=!0){var c;if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");s&&(this.nylasMailboxStore.state.state="loading");const a=t||this.nylasMailboxStore.state.threadsQueryParams,r=new URLSearchParams;for(const y in a){const d=(c=a[y])==null?void 0:c.toString();typeof d<"u"&&d!==null&&r.append(y,d)}a.search_query_native?this.router.navigate(`/?query=${a.search_query_native}`,!0):this.nylasMailboxStore.state.threadsQueryParams.search_query_native&&!a.search_query_native&&this.router.navigate("/",!0),a.page_token||(this.nylasMailboxStore.state.previousThreadPageTokens=[]),this.nylasMailboxStore.state.threadsQueryParams=a;const n=`/v3/grants/me/threads?${r.toString()}`,h=await this.nylasAuth.nylasAPIRequest(n);if(i.Xr(h))throw new i.Zr(h.error);const u=h.data;switch(e){case"prepend":this.nylasMailboxStore.state.threads=[...u,...this.nylasMailboxStore.state.threads];break;case"append":this.nylasMailboxStore.state.threads=[...this.nylasMailboxStore.state.threads,...u];break;case"overwrite":default:this.nylasMailboxStore.state.threads=u;break}return h.next_cursor?this.nylasMailboxStore.state.nextThreadPageToken=h.next_cursor:this.nylasMailboxStore.state.nextThreadPageToken=null,s&&(this.nylasMailboxStore.state.state="ready"),u}async getThread(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");const e=this.nylasMailboxStore.state.threads.find(n=>n.id===t);if(e)return e;this.nylasMailboxStore.state.state="loading";const s=`/v3/grants/me/threads/${t}`,a=await this.nylasAuth.nylasAPIRequest(s);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.threads=this.nylasMailboxStore.state.threads.map(n=>n.id===r.id?r:n),this.nylasMailboxStore.state.state="ready",r}async nextThreadPage(t="overwrite",e=!0){if(!this.nylasMailboxStore.state.nextThreadPageToken)throw new Error("No next page token");this.nylasMailboxStore.state.previousThreadPageTokens=Array.from(new Set([...this.nylasMailboxStore.state.previousThreadPageTokens,this.nylasMailboxStore.state.threadsQueryParams.page_token??null]));const s=this.nylasMailboxStore.state.nextThreadPageToken;return this.getThreads({...this.nylasMailboxStore.state.threadsQueryParams,page_token:s},t,e)}async previousThreadPage(t="overwrite",e=!0){if(!this.nylasMailboxStore.state.previousThreadPageTokens.length)throw new Error("No previous page token");const s=[...this.nylasMailboxStore.state.previousThreadPageTokens],a=s.pop();return this.nylasMailboxStore.state.previousThreadPageTokens=s,this.getThreads({...this.nylasMailboxStore.state.threadsQueryParams,page_token:a??void 0},t,e)}updateThreadQueryParams(t){this.nylasMailboxStore.state.threadsQueryParams={...this.nylasMailboxStore.state.threadsQueryParams,...t}}back(){this.router.navigate("/",!0),this.nylasMailboxStore.state.selectedThread=null}unSelectThread(){this.nylasMailboxStore.state.selectedThread=null}async selectThread(t){this.router.navigate(`/thread/${t.id}`,!0),this.nylasMailboxStore.state.selectedThread=t,t.unread&&this.markThreadAsRead(t).catch(e=>{o.debug("Error marking thread as read",e)})}async markThreadAsRead(t){return this.updateThread(t,{unread:!1})}async updateThread(t,e){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email","modify"))throw new Error("Missing thread:modify scope");const s=`/v3/grants/me/threads/${t.id}`,a=await this.nylasAuth.nylasAPIRequest(s,"PUT",e);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.threads=this.nylasMailboxStore.state.threads.map(n=>n.id===r.id?r:n),this.nylasMailboxStore.state.selectedThread=r,r}}class m{constructor(t,e,s){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s}async getFolders(){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");this.nylasMailboxStore.state.state="loading";const t="/v3/grants/me/folders",e=await this.nylasAuth.nylasAPIRequest(t);if(i.Xr(e))throw new i.Zr(e.error);const s=e.data;return this.nylasMailboxStore.state.folders=s,this.nylasMailboxStore.state.state="ready",s}async selectFolder(t){this.nylasMailboxStore.state.threadsQueryParams={in:t.id,...this.nylasMailboxStore.state.threadsQueryParams||{}}}}class p extends Event{constructor(t,e){super(t,e),this.oldURL=e.oldURL,this.newURL=e.newURL}}class S{constructor(){this.routeChangeListeners=[],o.debug("HashRouter constructor")}destroy(){o.debug("HashRouter destroy"),window.removeEventListener("hashchange",this.onRouteChange.bind(this))}init(){if(o.debug("HashRouter init"),window.addEventListener("hashchange",this.onRouteChange.bind(this)),typeof HashChangeEvent<"u"){const t=new HashChangeEvent("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}else{const t=new p("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}}addRouteChangeListener(t,e){o.debug("HashRouter addRouteChangeListener"),this.routeChangeListeners.push([t,e])}navigate(t,e){if(o.debug("HashRouter navigate"),e)return window.history.pushState(null,"",`#${t}`);window.location.hash=t}setRoute(t){o.debug("HashRouter setRoute"),window.location.hash=t}matchRoute(t,e){const s=t.split("/"),a=e.split("/");if(o.debug(`HashRouter matchRoute route=${t} path=${e}`,{routeParts:s,pathParts:a}),s[1]===""&&a[0]==="")return!0;if(s.length!==a.length)return!1;for(let r=0;r<s.length;r++){const n=s[r],h=a[r];if(!n.startsWith(":")&&n!==h)return!1}return!0}getRouteParams(t){o.debug("HashRouter getRouteParams");const e={},s=t.split("/"),a=window.location.hash.split("/");return s.forEach((r,n)=>{if(r.startsWith(":")){const h=r.substring(1);e[h]=a[n]}}),e}getRouteWithParams(t,e){o.debug("HashRouter getRouteWithParams");let s=t;return Object.keys(e).forEach(a=>{s=s.replace(`:${a}`,e[a])}),s}getRoute(){return o.debug("HashRouter getRoute"),window.location.hash}onRouteChange(t){this.routeChangeListeners.forEach(async([e,s])=>{const a=t.newURL.indexOf("#")===-1?"":t.newURL.substring(t.newURL.indexOf("#")+1);if(o.debug(`HashRouter onRouteChange route=${e} path=${a}`,{event:t}),!this.matchRoute(e,a)){o.debug(`HashRouter onRouteChange route=${e} path=${a} does not match`);return}const r=this.getRouteParams(e);await s(e,a,r)})}getBasePath(){return o.debug("HashRouter getBasePath"),""}}function A(l={}){const t={isAuthenticated:!1,tokenInfo:null,state:"ready",...l},e=i.createStore(t);return e.reset=()=>{for(const s in t){const a=t[s];e.set(s,a)}},e}function T(l={}){const t={state:"ready",messages:[],threads:[],folders:[],selectedThread:null,nextThreadPageToken:null,previousThreadPageTokens:[],searchQuery:"",hasNextThreadPage:!1,hasPreviousThreadPage:!1,selectedFolder:"inbox",threadsQueryParams:{in:"inbox"},messgeQueryParams:{fields:"include_headers"},...l},e=i.createStore({...t});return e.onChange("nextThreadPageToken",s=>{e.set("hasNextThreadPage",s!==null)}),e.onChange("previousThreadPageTokens",s=>{e.set("hasPreviousThreadPage",s.length>0)}),e.onChange("threadsQueryParams",s=>{e.set("selectedFolder",s.in||"inbox"),e.set("searchQuery",s.search_query_native||"")}),e.reset=()=>{for(const s in t){const a=t[s];e.set(s,a)}},e}exports.CreateNylasAuthStore=A;exports.CreateNylasMailboxStore=T;exports.HashRouter=S;exports.NylasAuthConnector=g;exports.NylasFoldersConnector=m;exports.NylasMessagesConnector=f;exports.NylasThreadsConnector=w;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-586a4206.cjs"),M=require("./register-component-152c6ad2-b0d34c36.cjs"),h=require("./utils-5074a070-d5ba6add.cjs"),A=require("./index-b30d446a-3d69a3cc.cjs"),c=require("./mailbox-store-19f0c6c9-9a3ef58a.cjs");require("react");require("react-dom");const P=":host{display:block}div{height:inherit}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.fade-in{animation:fadeIn 1.5s}.fade-out{animation:fadeOut 1.5s}@keyframes slideIn{0%{transform:translateY(100%)}100%{transform:translateY(0)}}@keyframes slideOut{0%{transform:translateY(0)}100%{transform:translateY(100%)}}.slide-in{animation:slideIn 1.5s}.slide-out{animation:slideOut 1.5s}@keyframes swipeIn{0%{transform:translateX(100%)}100%{transform:translateX(0)}}@keyframes swipeOut{0%{transform:translateX(0)}100%{transform:translateX(100%)}}.swipe-in{animation:swipeIn 1.5s}.swipe-out{animation:swipeOut 1.5s}",N=P;var L=function(e,t,n,s){var i=arguments.length,a=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,n,s);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},y=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};const p=class{constructor(e){o.registerInstance(this,e),this.state=void 0,this.isStateSet=void 0,this.isBoolean=void 0,this.getStore=void 0,this.transition="none",this.show=!1,this.classes={},this.initTransition=this.initTransition.bind(this)}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){h.debug("[nylas-if-state] Component will load"),this.watchStore(!0)}async componentDidLoad(){h.debug("[nylas-if-state] Component did load")}shouldRender(){const[e,t]=this.state?this.state.split("."):["",""],n=this.getStore;if(typeof n>"u")return h.debug(`[nylas-if-state] Store name: ${e} | State name: ${t}`,{getStore:n}),!1;const s=n(e);if(typeof s>"u")return h.debug(`[nylas-if-state] Store name: ${e} | State name: ${t}`,{store:s}),!1;const i=s.state[t];return typeof this.isStateSet=="boolean"?this.isStateSet===!1&&(typeof i>"u"||i===null||i.length===0)||this.isStateSet===!0&&typeof i<"u"&&i!==null:typeof this.isBoolean=="boolean"?this.isBoolean===!0&&typeof i<"u"&&i===!0||this.isBoolean===!1&&typeof i<"u"&&i===!1:!1}onGetStoreChange(){this.watchStore(!0)}watchStore(e=!1){const[t,n]=this.state?this.state.split("."):["",""],s=this.getStore;if(typeof s>"u")return h.debug(`[nylas-if-state] Store name: ${t} | State name: ${n}`,{getStore:s}),null;const i=s(t);if(typeof i>"u")return h.debug(`[nylas-if-state] Store name: ${t} | State name: ${n}`,{store:i}),null;e===!0&&this.initTransition(),i.onChange(n,this.initTransition)}initTransition(){const e=this.shouldRender();switch(this.transition){case"fade":case"slide":case"swipe":this.classes={[`${this.transition}-in`]:e,[`${this.transition}-out`]:!e},setTimeout(()=>{this.show=e},150);break;default:this.show=this.shouldRender();break}}render(){return o.h(o.Host,{key:"91d17bc89a09742106ef3bd9365c5ce48cf14e86"},o.h("div",{key:"9d0070be4bf5d9a5f405fc4a0733e6d832fa669a",class:this.classes},this.show&&o.h("slot",null)))}static get watchers(){return{getStore:["onGetStoreChange"]}}};L([M.RegisterComponent({name:"nylas-if-state",getStoresToProp:"getStore",fireRegisterEvent:!0}),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",void 0)],p.prototype,"render",null);p.style=N;const T=":host{font-family:'Arial', sans-serif;background:var(--nylas-color-primary-50);color:var(--nylas-color-primary-800);margin:0;display:contents}input{box-sizing:border-box}.login-container{display:flex;justify-content:center;align-items:center;height:100%}.login-box{width:300px;padding:20px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border-radius:var(--nylas-border-radius-2x);background:var(--nylas-color-primary-50);text-align:center}.login-box h1{margin-top:0;margin-bottom:0.5em}.login-box p{margin-bottom:1em}.login-methods button{display:block;width:100%;padding:10px 10px 10px 50px;margin-bottom:10px;border:none;border-radius:var(--nylas-border-radius);border:1px solid var(--nylas-color-primary-300);background:var(--nylas-color-primary-100);color:var(--nylas-color-primary-600);cursor:pointer;transition:background 0.3s ease;position:relative;text-align:left}.login-methods button svg{position:absolute;left:16px;top:50%;transform:translateY(-50%)}.login-methods button:hover{background:var(--nylas-color-primary-200);}.login-form label{display:block;margin-bottom:5px;text-align:left}.login-form input{width:100%;padding:10px;margin-bottom:10px;border:1px solid var(--nylas-color-primary-200);border-radius:var(--nylas-border-radius);background:var(--nylas-color-primary-100);color:var(--nylas-color-primary-800);}.login-form button{width:100%;padding:10px;border:none;border-radius:var(--nylas-border-radius);background:var(--nylas-color-primary-500);color:var(--nylas-color-primary-50);cursor:pointer;transition:background 0.3s ease}.login-form button:hover{background:var(--nylas-color-primary-600);}",I=T;var O=function(e,t,n,s){var i=arguments.length,a=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,n,s);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},m=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};const b=class{constructor(e){o.registerInstance(this,e),this.buttonClick=o.createEvent(this,"buttonClick",7),this._handleLoginRedirect=async()=>{var s;const t=await((s=this.nylasConnector)==null?void 0:s.auth.getHostedAuthRedirectURL(this.scopes));this.buttonClick.emit({url:t}).defaultPrevented||t&&(window.location.href=t)},this._onGoogleButtonClick=async t=>{var s;t.preventDefault();const n=await((s=this.nylasConnector)==null?void 0:s.auth.getHostedAuthRedirectURL(this.scopes,void 0,"google"));n&&(window.location.href=n)},this._onMicrosoftButtonClick=async t=>{var s;t.preventDefault();const n=await((s=this.nylasConnector)==null?void 0:s.auth.getHostedAuthRedirectURL(this.scopes,void 0,"microsoft"));n&&(window.location.href=n)},this._onFormSubmit=async t=>{var s;t.preventDefault();const n=await((s=this.nylasConnector)==null?void 0:s.auth.getHostedAuthRedirectURL(this.scopes,this.email));n&&(window.location.href=n)},this.isAuthenticated=!1,this.nylasConnector=void 0,this.scopes=void 0,this.loginMethod="redirect",this.companyName="Nylas",this.logoUrl="https://www.nylas.com/wp-content/uploads/main-logo.svg",this.logoWidth="min-content",this.providers="google,microsoft",this.buttonText="Login",this.email=""}connectedCallback(){}disconnectedCallback(){}componentWillLoad(){}async componentDidLoad(){var t;await((t=this.nylasConnector)==null?void 0:t.auth.manageHostedAuthCodeExchange(window.location.href))&&window.history.replaceState({},document.title,window.location.pathname)}render(){var t;const e=((t=this.providers)==null?void 0:t.split(","))||[];return o.h(o.Host,{key:"a0b36443906ea5244070e6d0eece3794b1d1d3d5"},this.loginMethod==="redirect"&&o.h("div",{class:"redirect-container"},!this.isAuthenticated&&o.h("sp-button",{part:"button",onClick:this._handleLoginRedirect},this.buttonText)),this.loginMethod==="emebded"&&o.h("main",{class:"login-container"},o.h("section",{class:"login-box"},o.h("header",null,o.h("img",{src:this.logoUrl,alt:`${this.companyName} logo`,width:"100%",style:{minWidth:this.logoWidth}}),o.h("h1",null,"Welcome")),o.h("p",null,"Log in to your account to continue to ",this.companyName),o.h("div",{class:"login-methods"},e.includes("google")&&o.h("button",{class:"login-google",onClick:this._onGoogleButtonClick},o.h("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 256 262"},o.h("path",{fill:"#4285F4",d:"M255.6 131.6c0-8.2-.8-16.2-2.2-23.9H130v45.3h70.3c-3 16.1-12.4 29.7-26.3 38.9v32.4h42.6c25-23 39.4-56.7 39.4-97.7z"}),o.h("path",{fill:"#34A853",d:"M130 262c35.3 0 64.9-11.7 86.5-31.7l-42.6-32.4c-11.7 7.9-26.7 12.6-43.9 12.6-33.7 0-62.3-22.7-72.5-53.4H14.5v33.3A130.3 130.3 0 00130 262z"}),o.h("path",{fill:"#FBBC05",d:"M57.5 158.1a72.7 72.7 0 010-54.2V70.6H14.5a130.4 130.4 0 000 120.8l43-33.3z"}),o.h("path",{fill:"#EA4335",d:"M130 51.6c19 0 36 6.5 49.4 19.2l37-36C195 13.1 165.2 0 130 0A130.3 130.3 0 0014.5 70.6l43 33.3c10.2-30.7 38.8-53.3 72.5-53.3z"})),"Continue with Google"),e.includes("microsoft")&&o.h("button",{class:"login-microsoft",onClick:this._onMicrosoftButtonClick},o.h("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 448 512"},o.h("path",{fill:"#F3F3F3",d:"M0 32v192h192V32H0zm256 0v192h192V32H256zm192 256v192h-192V288h192zM0 224v192h192V224H0z"})),"Continue with Microsoft")),o.h("form",{class:"login-form",method:"POST",onSubmit:this._onFormSubmit},o.h("label",{htmlFor:"email"},"Email"),o.h("input",{type:"email",id:"email",name:"email",required:!0,value:this.email}),o.h("button",{type:"submit"},"Next")))))}};O([M.RegisterComponent({name:"nylas-login",connectorToProp:"nylasConnector",stateToProps:new Map([["auth.isAuthenticated","isAuthenticated"]]),fireRegisterEvent:!0}),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"render",null);b.style=I;class E{constructor(t,n,s,i){this.router=t,this.nylasAuth=n,this.nylasAuthStore=s,this.nylasMailboxStore=i}init(){h.debug("NylasMailboxConnector init")}get mailboxStore(){return this.nylasMailboxStore}get authStore(){return this.nylasAuthStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new c.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get threads(){return this._threadConnector?this._threadConnector:(this._threadConnector=new c.NylasThreadsConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore,this.router),this._threadConnector)}get messages(){return this._messageConnector?this._messageConnector:(this._messageConnector=new c.NylasMessagesConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._messageConnector)}get folders(){return this._foldersConnector?this._foldersConnector:(this._foldersConnector=new c.NylasFoldersConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._foldersConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasMailboxStore.reset(),this.nylasAuthStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const H=":host{display:contents}",B=H,_=class{constructor(e){o.registerInstance(this,e),this.init=o.createEvent(this,"init",7),this.loggedIn=o.createEvent(this,"loggedIn",7),this.loggedOut=o.createEvent(this,"loggedOut",7),this.handleAuthChange=async t=>{var n;t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host).defaultPrevented||await((n=this.nylasMailboxConnector)==null?void 0:n.logout())},this.automaticComponentRegistration=!0,this.eventOverrides={},this.authConfig=void 0,this.defaultAuthStoreState=void 0,this.defaultMailboxStoreState=void 0}connectedCallback(){h.debug("[nylas-mailbox] connectedCallback")}async componentWillLoad(){var s,i,a,r,l,v,C;this.stores={auth:c.CreateNylasAuthStore(this.defaultAuthStoreState),mailbox:c.CreateNylasMailboxStore(this.defaultMailboxStoreState)},this.baseProvider=new A.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.router=new c.HashRouter,this.nylasAuth=A.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=(s=this.baseProvider)==null?void 0:s.getStore("auth");if(!e)throw new Error("Auth store is not defined");const t=(i=this.baseProvider)==null?void 0:i.getStore("mailbox");if(!t)throw new Error("Mailbox store is not defined");this.nylasMailboxConnector=new E(this.router,this.nylasAuth,e,t),this.init.emit(this.host).defaultPrevented||await((a=this.nylasMailboxConnector)==null?void 0:a.auth.validateSession()),(r=this.router)==null||r.addRouteChangeListener("/thread/:threadId",async(R,k,w)=>{var u,f;const g=w.threadId,d=await((u=this.nylasMailboxConnector)==null?void 0:u.threads.getThread(g));d&&((f=this.nylasMailboxConnector)==null||f.mailboxStore.set("selectedThread",d))}),(l=this.router)==null||l.addRouteChangeListener("/",async(R,k,w)=>{var d,u,f,S;if(!e.state.isAuthenticated)return;(d=this.nylasMailboxConnector)==null||d.threads.unSelectThread(),(u=this.nylasMailboxConnector)==null||u.folders.getFolders();const g=window.location.hash.split("?")[1];if(g){const x=new URLSearchParams(g).get("query");x&&await((f=this.nylasMailboxConnector)==null?void 0:f.threads.getThreads({search_query_native:x,page_token:void 0}))}else(S=this.nylasMailboxConnector)==null||S.threads.getThreads()}),(v=this.router)==null||v.init(),this.handleAuthChange(e.state.isAuthenticated),(C=this.baseProvider)==null||C.componentWillLoad(this.nylasMailboxConnector)}async componentDidLoad(){var t,n;const e=(t=this.baseProvider)==null?void 0:t.getStore("auth");if(!e)throw new Error("Auth store is not defined");e.onChange("isAuthenticated",this.handleAuthChange),(n=this.baseProvider)==null||n.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 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 getNylasAuth(){return this.nylasAuth}async getNylasMailboxConnector(){return this.nylasMailboxConnector}render(){return o.h(o.Host,{key:"a3c855c441914ccb60f6ad72cf166fe888508a6c"},o.h("slot",{key:"09bb1cbaf72e4beb90dcb723b1dc398b63072dd7"}))}get host(){return o.getElement(this)}};_.style=B;exports.nylas_if_state=p;exports.nylas_login=b;exports.nylas_mailbox=_;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-586a4206.cjs"),u=require("./register-component-152c6ad2-b0d34c36.cjs"),a=require("./utils-5074a070-d5ba6add.cjs");require("react");require("react-dom");const h=":host{display:block}.folders{display:flex;flex-direction:column;align-items:self-start}.folders .folder{border:1px solid var(--nylas-color-primary-100);padding:0.5rem 0.75rem;margin-bottom:0.5rem;justify-content:left;width:100%;min-width:200px;border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-50)}.folders .folder:last-child{margin-bottom:0}.folders .folder.selected{background-color:var(--nylas-color-primary-100)}.folders .folder .icon{margin-right:0.5rem;stroke:var(--nylas-color-primary-900);fill:none}hr{width:100%;margin:1rem 0;border:0;border-top:1px solid var(--nylas-color-primary-100)}",m=h;var p=function(t,r,e,o){var s=arguments.length,n=s<3?r:o===null?o=Object.getOwnPropertyDescriptor(r,e):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,r,e,o);else for(var i=t.length-1;i>=0;i--)(d=t[i])&&(n=(s<3?d(n):s>3?d(r,e,n):d(r,e))||n);return s>3&&n&&Object.defineProperty(r,e,n),n},c=function(t,r){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,r)};const f=class{constructor(t){l.registerInstance(this,t),this.folderSelected=l.createEvent(this,"folderSelected",7),this.folderSelectedHandler=r=>{var e;(e=this.folderSelected)==null||e.emit(r)},this.folders=void 0,this.selectedFolder=void 0,this.defaultFolders=void 0,this.otherFolders=void 0}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){a.debug("[nylas-list-folders] Component will load")}async componentDidLoad(){a.debug("[nylas-list-folders] Component did load")}watchFolders(t){a.debug("[nylas-list-folders] watchFolders",{newFolders:t});const r=["inbox","drafts","sent","starred","spam","archive","trash"];this.defaultFolders=r.filter(e=>t.find(o=>{var s;return((s=o.name)==null?void 0:s.toLowerCase())===e.toLowerCase()})).map(e=>t.find(o=>{var s;return((s=o.name)==null?void 0:s.toLowerCase())===e.toLowerCase()})).filter(e=>typeof e<"u").sort((e,o)=>r.indexOf((e==null?void 0:e.name)??"")-r.indexOf((o==null?void 0:o.name)??"")),this.otherFolders=t.filter(e=>!r.find(o=>{var s;return((s=e.name)==null?void 0:s.toLowerCase())===o.toLowerCase()})).sort((e,o)=>(e.name??"").localeCompare(o.name??""))}formatFolderName(t){var r;return a.toTitleCase(((r=t.name)==null?void 0:r.replace("CATEGORY_",""))??"Unknown")}getFolderIcon(t){var r;switch((r=t.name)==null?void 0:r.toLowerCase()){case"inbox":return l.h("inbox-icon",null);case"drafts":return l.h("drafts-icon",null);case"sent":return l.h("sent-icon",null);case"starred":return l.h("star-icon",null);case"spam":return l.h("spam-icon",null);case"archive":return l.h("archive-icon",null);case"trash":return l.h("trash-icon",null);default:return l.h("folder-icon",null)}}render(){var t,r;return l.h(l.Host,{key:"7cccf397860653266b6f2635762fa76a2910c6b3"},l.h("div",{key:"390e0d26d5c5568487a937ff49f2931da00f26b1",class:"folders"},(t=this.defaultFolders)==null?void 0:t.map(e=>{var o;return l.h("sp-button",{onClick:()=>this.folderSelectedHandler(e),class:{folder:!0,selected:a.formatFolderName(e.name??"inbox").toLowerCase()===((o=this.selectedFolder)==null?void 0:o.toLowerCase())}},l.h("div",{slot:"icon",class:"icon"},this.getFolderIcon(e)),this.formatFolderName(e))})),this.otherFolders&&l.h(l.Fragment,null,l.h("hr",null),l.h("div",{class:"folders"},(r=this.otherFolders)==null?void 0:r.map(e=>{var o;return l.h("sp-button",{onClick:()=>this.folderSelectedHandler(e),class:{folder:!0,selected:a.formatFolderName(e.name??"inbox").toLowerCase()===((o=this.selectedFolder)==null?void 0:o.toLowerCase())}},l.h("div",{slot:"icon",class:"icon"},this.getFolderIcon(e)),this.formatFolderName(e))}))))}static get watchers(){return{folders:["watchFolders"]}}};p([u.RegisterComponent({name:"nylas-pagination",stateToProps:new Map([["mailbox.folders","folders"],["mailbox.selectedFolder","selectedFolder"]]),eventToProps:{folderSelected:async(t,r)=>{a.debug("[nylas-list-folders] folderSelected event",{_event:t}),await r.threads.getThreads({page_token:void 0,in:a.formatFolderName(t.detail.id??"inbox")})}},fireRegisterEvent:!0}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],f.prototype,"render",null);f.style=m;exports.nylas_list_folders=f;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-586a4206.cjs"),u=require("./register-component-152c6ad2-b0d34c36.cjs"),i=require("./utils-5074a070-d5ba6add.cjs");require("react");require("react-dom");const h=':host{display:block;font-size:var(--nylas-font-size, inherit);font-family:var(--nylas-font-family, inherit)}.list-thread{display:grid;grid-auto-flow:row;color:var(--nylas-color-primary-800);width:100%}.thread{position:relative;width:100%;display:grid;padding:0.5rem 1rem;column-gap:0.25rem;grid-template-areas:"........ from count ....... date actions" "checkbox subject subject subject subject actions" "........ snippet snippet snippet snippet actions";grid-template-columns:auto auto auto auto auto auto;margin-bottom:0.75rem;border-radius:var(--nylas-border-radius-2x);color:var(--nylas-color-primary-00);background-color:var(--nylas-color-primary-50);border:0;box-sizing:border-box;text-align:left;cursor:pointer;box-shadow:1px 1px 3px 0px rgba(0, 0, 0, 0.3);font-size:inherit;font-family:inherit}.thread.loading{animation:pulsate 1.5s infinite ease-in-out;width:100%;height:90px}.thread:last-of-type{margin-bottom:0}.thread.selected{box-shadow:0 2px 0 0 var(--nylas-color-primary-200);background-color:var(--nylas-color-primary-100)}.thread:hover{box-shadow:0 2px 0 0 var(--nylas-color-primary-200);background-color:var(--nylas-color-primary-100)}.thread>div{align-self:center;pointer-events:all !important}.thread .actions{grid-area:actions}.thread .actions sp-action-menu{pointer-events:initial !important}.thread .actions sp-action-button{pointer-events:initial !important}.thread .actions sp-menu-item{pointer-events:initial !important}.thread .checkbox{grid-area:checkbox;margin-right:0.5rem;pointer-events:initial !important}.thread .checkbox sp-checkbox{pointer-events:initial !important}.thread .star{grid-area:star;justify-self:end}.thread .from{grid-area:from;color:var(--nylas-color-primary-600)}.thread .count{grid-area:count;color:var(--nylas-color-primary-600)}.thread .subject{grid-area:subject;color:var(--nylas-color-primary-600)}.thread .snippet{grid-area:snippet;color:var(--nylas-color-primary-500)}.thread .date{grid-area:date;align-self:center;color:var(--nylas-color-primary-500)}.thread.unread .from,.thread.unread .count,.thread.unread .subject,.thread.unread .date{font-weight:600;color:var(--nylas-color-primary-800)}.thread.unread .snippet{color:var(--nylas-color-primary-700)}.thread .from{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.thread .snippet{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.thread .subject{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media only screen and (min-width: 768px){.thread{column-gap:1rem;grid-template-areas:"checkbox from count subject snippet date actions";grid-template-columns:auto minmax(auto, 200px) auto auto 1fr auto auto;margin-bottom:0.5rem;border:1px solid var(--nylas-color-primary-100)}.thread.no-checkbox{grid-template-areas:"from count subject snippet date actions";grid-template-columns:minmax(auto, 200px) auto auto 1fr auto auto}.thread .checkbox{margin-right:0}}@keyframes pulsate{0%{background-color:var(--nylas-color-primary-50)}50%{background-color:var(--nylas-color-primary-100)}100%{background-color:var(--nylas-color-primary-50)}}',m=h;var y=function(e,t,r,s){var n=arguments.length,o=n<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,r):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,s);else for(var c=e.length-1;c>=0;c--)(l=e[c])&&(o=(n<3?l(o):n>3?l(t,r,o):l(t,r))||o);return n>3&&o&&Object.defineProperty(t,r,o),o},d=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};const p=class{constructor(e){a.registerInstance(this,e),this.threadSelected=a.createEvent(this,"threadSelected",7),this.handleThreadSelected=async t=>{i.debug("[nylas-list-threads] Thread selected",{thread:t}),this.threadSelected.emit(t).defaultPrevented||i.debug("[nylas-list-threads] Default event not prevented, selecting thread")},this.handleCheckboxClick=async t=>{i.debug("[nylas-list-threads] Checkbox clicked",{event:t}),t.stopPropagation()},this.threads=[],this.isAuthenticated=!1,this.tokenInfo=void 0,this.state="ready",this.showCheckbox=!1}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){i.debug("[nylas-list-threads] Component will load")}async componentDidLoad(){i.debug("[nylas-list-threads] Component did load",{isAuthenticated:this.isAuthenticated})}render(){return a.h(a.Host,{key:"162954a4241d7ddb5a7957686dc63b805972645c"},a.h("div",{key:"4912c92ca812790c2fede6220494da1c8ce7959e",class:"list-thread",part:"list-thread"},this.state==="loading"&&new Array(10).fill(0).map((e,t)=>a.h("div",{class:"thread loading",style:{animationDelay:`${t*20}ms`}})),this.state==="ready"&&this.threads.map(e=>{var t,r,s,n;return a.h("button",{key:e==null?void 0:e.id,class:{thread:!0,unread:(e==null?void 0:e.unread)===!0,"no-checkbox":this.showCheckbox===!1},part:"thread","aria-label":`Thread with subject ${e==null?void 0:e.subject}`,onClick:()=>this.handleThreadSelected(e)},this.showCheckbox&&a.h("div",{class:"checkbox",part:"checkbox"},a.h("sp-checkbox",{size:"s",value:e==null?void 0:e.id,onClick:this.handleCheckboxClick})),a.h("div",{class:"from",part:"from"},i.formatParticipants(e.participants??[],(t=this.tokenInfo)==null?void 0:t.email,((r=e==null?void 0:e.message_ids)==null?void 0:r.length)||1,1)),a.h("div",{class:"subject",part:"subject"},e==null?void 0:e.subject),a.h("div",{class:"count",part:"count"},((s=e==null?void 0:e.message_ids)==null?void 0:s.length)||1),a.h("div",{class:"snippet",part:"snippet"},(n=e==null?void 0:e.snippet)==null?void 0:n.trim()),e.latest_message_received_date&&a.h("div",{class:"date","aria-label":`${Intl.DateTimeFormat(void 0,{dateStyle:"full"}).format(new Date(e.latest_message_received_date*1e3))}`,part:"date"},i.formatDateTime(e.latest_message_received_date)))})))}};y([u.RegisterComponent({name:"nylas-list-threads",stateToProps:new Map([["auth.isAuthenticated","isAuthenticated"],["auth.tokenInfo","tokenInfo"],["mailbox.threads","threads"],["mailbox.state","state"]]),eventToProps:{threadSelected:async(e,t)=>{i.debug("[nylas-list-threads] Thread selected",{event:e}),await t.threads.selectThread(e.detail)}},fireRegisterEvent:!0}),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],p.prototype,"render",null);p.style=m;exports.nylas_list_threads=p;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-586a4206.cjs"),g=require("./register-component-152c6ad2-b0d34c36.cjs"),a=require("./utils-5074a070-d5ba6add.cjs");require("react");require("react-dom");const p=":host{display:contents}.container{height:var(--container-height, 100dvh);overflow-y:var(--container-overflow-y, auto)}.pagination{display:flex;justify-content:center;align-items:center;margin:0 auto;padding:0;list-style:none;font-size:0.875rem;font-weight:600;color:var(--nylas-color-primary-600)}.pagination sp-button svg{animation:rotate 1s linear infinite}sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}sp-button:hover{background-color:var(--nylas-color-primary-500)}sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}sp-button chevron-icon svg{width:15px;height:15px}.next chevron-icon{transform:rotate(180deg)}@keyframes rotate{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",u=p;var m=function(t,n,i,r){var s=arguments.length,o=s<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,i):r,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,n,i,r);else for(var h=t.length-1;h>=0;h--)(l=t[h])&&(o=(s<3?l(o):s>3?l(n,i,o):l(n,i))||o);return s>3&&o&&Object.defineProperty(n,i,o),o},c=function(t,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,n)};const d=class{constructor(t){e.registerInstance(this,t),this.next=e.createEvent(this,"next",7),this.previous=e.createEvent(this,"previous",7),this.state="ready",this.hasNextPage=!1,this.hasPreviousPage=!1,this.scrollTarget="container",this.mobileOnlyInfiniteScroll=!0,this.mobileViewPortWidth=768,a.debug("[nylas-pagination] Constructed"),this.isScrollAtContainerBottom=this.isScrollAtContainerBottom.bind(this),this.isScrollAtPageBottom=this.isScrollAtPageBottom.bind(this),this.nextPage=this.nextPage.bind(this),this.previousPage=this.previousPage.bind(this),this.handlePageScroll=this.handlePageScroll.bind(this),this.handleContainerScroll=this.handleContainerScroll.bind(this)}connectedCallback(){a.debug("[nylas-pagination] Component connected")}async componentWillLoad(){a.debug("[nylas-pagination] Component will load")}async componentDidLoad(){a.debug("[nylas-pagination] Component did load"),this.containerElement&&this.containerElement.addEventListener("scroll",this.handleContainerScroll)}async componentWillRender(){a.debug("[nylas-pagination] Component will render")}disconnectedCallback(){a.debug("[nylas-pagination] Component disconnected"),this.containerElement&&this.containerElement.removeEventListener("scroll",this.handleContainerScroll)}handlePageScroll(t){this.isScrollAtPageBottom()&&this.canScroll&&this.scrollTarget==="page"&&this.nextPage()}async nextPage(){const t=this.host.children.length>0;this.next.emit({hasChildren:t})}async previousPage(){const t=this.host.children.length>0;this.previous.emit({hasChildren:t})}handleContainerScroll(t){this.isScrollAtContainerBottom()&&this.canScroll&&this.scrollTarget==="container"&&this.nextPage()}isScrollAtContainerBottom(){return this.containerElement?this.containerElement&&this.containerElement.scrollTop+this.containerElement.clientHeight>=this.containerElement.scrollHeight:!1}isScrollAtPageBottom(){return window.innerHeight+window.scrollY>=document.body.offsetHeight}get canScroll(){const t=this.host.children.length>0;return this.state==="ready"&&t&&(!this.mobileOnlyInfiniteScroll||window.innerWidth<this.mobileViewPortWidth)}render(){return this.host.children.length>0?e.h(e.Host,null,e.h("div",{class:"container",ref:n=>this.containerElement=n},e.h("slot",null),this.canScroll&&e.h("div",{class:"pagination"},e.h("sp-theme",{scale:"medium",color:"dark"},this.state==="ready"&&this.hasNextPage&&e.h("sp-button",{onClick:this.nextPage},e.h("div",{slot:"icon"},e.h("refresh-icon",{class:"refres-icon"}))," ","Load more..."))))):e.h(e.Host,null,e.h("sp-theme",{scale:"medium",color:"dark"},this.hasPreviousPage&&e.h("sp-button",{class:"previous",parr:"previous",onClick:this.previousPage},e.h("div",{slot:"icon"},e.h("chevron-icon",{class:"previous-icon"}))," ","Previous"),this.hasPreviousPage&&this.hasNextPage&&" ",this.hasNextPage&&e.h("sp-button",{class:"next",parr:"next",onClick:this.nextPage},e.h("div",{slot:"icon"},e.h("chevron-icon",{class:"next-icon"}))," ","Next")))}get host(){return e.getElement(this)}};m([g.RegisterComponent({name:"nylas-pagination",stateToProps:new Map([["mailbox.hasNextThreadPage","hasNextPage"],["mailbox.hasPreviousThreadPage","hasPreviousPage"],["mailbox.state","state"]]),eventToProps:{next:async(t,n)=>{a.debug("[nylas-pagination] Next page event fired");const{hasChildren:i}=t.detail;await n.threads.nextThreadPage(i?"append":"overwrite",!i)},previous:async(t,n)=>{a.debug("[nylas-pagination] Previous page event fired");const{hasChildren:i}=t.detail;await n.threads.previousThreadPage(i?"append":"overwrite",!i)}},fireRegisterEvent:!0}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],d.prototype,"render",null);d.style=u;exports.nylas_mailbox_pagination=d;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-586a4206.cjs"),b=require("./register-component-152c6ad2-b0d34c36.cjs"),c=require("./utils-5074a070-d5ba6add.cjs");require("react");require("react-dom");const y=":host{display:block}sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}sp-button:hover{background-color:var(--nylas-color-primary-500)}sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}",f=y;var h=function(t,o,e,n){var l=arguments.length,a=l<3?o:n===null?n=Object.getOwnPropertyDescriptor(o,e):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,o,e,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(l<3?i(a):l>3?i(o,e,a):i(o,e))||a);return l>3&&a&&Object.defineProperty(o,e,a),a},d=function(t,o){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,o)};const u=class{constructor(t){r.registerInstance(this,t),this.onClick=async()=>{const o=this.method;if(c.debug("[nylas-mailbox-toolbar-button] onClick",{method:o,mailboxConnector:this.mailboxConnector}),this.mailboxConnector&&o){const e=this.callMethod(this.mailboxConnector,o);e&&await e()}},this.method=void 0,this.dataState=void 0,this.iconOnly=!1,this.mailboxConnector=void 0}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){c.debug("[nylas-if-state] Component will load")}async componentDidLoad(){c.debug("[nylas-if-state] Component did load")}callMethod(t,o){const e=o.split(".");let n=t;for(const i of e.slice(0,-1))if(n=n[i],!n)return;const l=e[e.length-1],a=n[l];if(typeof a=="function")return a.bind(n)}renderByState(t){return t?r.h("slot",{name:"loading"},"Loading..."):r.h("slot",null,"Click")}hasSlot(t){return!!this.host.querySelector(`[slot="${t}"]`)}render(){var n;let t=!1;const o=(n=this.mailboxConnector)==null?void 0:n.nylasMailboxStore;if(typeof o<"u"){const l=String(this.dataState);t=this.dataState?o.get(l)==="loading":!1}const e=t?"state-loading":"state-ready";return r.h(r.Host,{key:"a54c99a0881643686516cecb59f8f945ba8e3ef1"},r.h("sp-theme",{key:"075773f3a5e9c354bae00d01c70d3b458cc40961",scale:"medium",color:"dark"},r.h("sp-button",{onClick:this.onClick,disabled:t,key:e,"icon-only":this.iconOnly,label:this.renderByState(t)},this.hasSlot("icon")&&r.h("div",{slot:"icon",class:"slot"},r.h("slot",{name:"icon"})),!this.iconOnly&&this.renderByState(t))))}get host(){return r.getElement(this)}};h([b.RegisterComponent({name:"nylas-mailbox-toolbar-button",connectorToProp:"mailboxConnector",fireRegisterEvent:!0}),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],u.prototype,"render",null);u.style=f;exports.nylas_mailbox_toolbar_button=u;
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { r as y, c as D, h, H as M, g as H } from "./index-98d3a4da.js";
|
|
2
|
-
import { d as f, g as b, c as w } from "./utils-5074a070-ce33ee6b.js";
|
|
3
|
-
import { t as p, d as c, a as T, b as m } from "./duration-bddc4a13-179ce826.js";
|
|
4
|
-
import "react";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
const S = p((t) => {
|
|
7
|
-
t.setTime(t - t.getMilliseconds() - t.getSeconds() * T);
|
|
8
|
-
}, (t, e) => {
|
|
9
|
-
t.setTime(+t + e * c);
|
|
10
|
-
}, (t, e) => (e - t) / c, (t) => t.getMinutes()), k = S.range;
|
|
11
|
-
p((t) => {
|
|
12
|
-
t.setUTCSeconds(0, 0);
|
|
13
|
-
}, (t, e) => {
|
|
14
|
-
t.setTime(+t + e * c);
|
|
15
|
-
}, (t, e) => (e - t) / c, (t) => t.getUTCMinutes());
|
|
16
|
-
const x = p((t) => {
|
|
17
|
-
t.setTime(t - t.getMilliseconds() - t.getSeconds() * T - t.getMinutes() * c);
|
|
18
|
-
}, (t, e) => {
|
|
19
|
-
t.setTime(+t + e * m);
|
|
20
|
-
}, (t, e) => (e - t) / m, (t) => t.getHours()), v = x.range;
|
|
21
|
-
p((t) => {
|
|
22
|
-
t.setUTCMinutes(0, 0, 0);
|
|
23
|
-
}, (t, e) => {
|
|
24
|
-
t.setTime(+t + e * m);
|
|
25
|
-
}, (t, e) => (e - t) / m, (t) => t.getUTCHours());
|
|
26
|
-
const C = ':host{display:block;font-size:inherit;font-family:inherit;--nylas-grid-border-color:var(--nylas-base-100);--nylas-available-color:var(--nylas-base-500);--nylas-available-hover-color:var(--nylas-base-100);--nylas-unavailable-color:inherit}.legend{display:grid;grid-template-columns:1fr 1fr;gap:1rem;align-items:center;font-size:inherit;font-family:inherit;max-width:fit-content;margin:0 auto;margin-top:1rem}.legend .available{display:grid;grid-template-columns:auto 1fr;gap:0.5rem;align-items:center;font-size:inherit;font-family:inherit}.legend .available .box{width:2rem;height:2rem;background-color:var(--nylas-available-color);border:1px dashed var(--nylas-grid-border-color)}.legend .unavailable{display:grid;grid-template-columns:auto 1fr;gap:0.5rem;align-items:center;font-size:inherit;font-family:inherit}.legend .unavailable .box{width:2rem;height:2rem;background-color:var(--nylas-unavailable-color);border:1px dashed var(--nylas-grid-border-color)}.open-hours{display:grid;gap:1rem;grid-template:".... days days" "hours selected-hours selected-hours" 1fr/auto 1fr}.open-hours .days{grid-area:days;display:grid;grid-auto-flow:column;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;text-align:center;justify-items:center;font-size:inherit;font-family:inherit}.open-hours .hours{display:grid;grid-auto-flow:row;grid-area:hours;text-align:right;align-items:start;font-size:inherit;font-family:inherit}.open-hours .hours span{top:-0.6rem;display:block;position:relative}.open-hours .selected-hours{display:grid;grid-area:selected-hours;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.open-hours .selected-hours .hour{display:grid;border:1px dashed var(--nylas-grid-border-color);height:40px;background-color:var(--nylas-unavailable-color)}.open-hours .selected-hours .hour.selected{background-color:var(--nylas-available-color)}.open-hours .selected-hours .hour.hovered{background-color:var(--nylas-available-hover-color)}.open-hours .selected-hours.inverse .hour{background-color:var(--nylas-available-color)}.open-hours .selected-hours.inverse .hour.selected{background-color:var(--nylas-unavailable-color)}.open-hours .selected-hours.inverse .hour.hovered{background-color:var(--nylas-available-hover-color)}', O = C, E = class {
|
|
27
|
-
constructor(t) {
|
|
28
|
-
y(this, t), this.openHoursChanged = D(this, "openHoursChanged", 7), this.dragStartTime = 0, this.onSelectedHoursWeel = (e) => {
|
|
29
|
-
e.preventDefault(), e.stopPropagation();
|
|
30
|
-
const { deltaY: s } = e, a = s > 0 ? -1 : 1;
|
|
31
|
-
if (this.intervalMinutes === this.stepMinutes && a === -1 || this.intervalMinutes === 60 && a === 1)
|
|
32
|
-
return;
|
|
33
|
-
this.intervalMinutes = this.intervalMinutes + a * this.stepMinutes;
|
|
34
|
-
const i = new Date(this.startTime);
|
|
35
|
-
i.setHours(this.endTime.getHours(), 0, 0, 0), this.intervalMinutes < 60 ? this.times = k(this.startTime, i, this.intervalMinutes) : this.times = v(this.startTime, i, this.intervalMinutes / 60);
|
|
36
|
-
}, this.onContextMenu = (e) => {
|
|
37
|
-
e.preventDefault(), e.stopPropagation(), this.inverse = !this.inverse;
|
|
38
|
-
}, this.onMouseDown = (e, s) => {
|
|
39
|
-
this.draggingStartDate = s, this.dragStartTime = (/* @__PURE__ */ new Date()).getTime(), e.preventDefault(), e.stopPropagation();
|
|
40
|
-
}, this.onMouseOver = (e, s) => {
|
|
41
|
-
this.isDragging() && (this.draggingEndDate = s);
|
|
42
|
-
}, this.onMouseUp = (e, s) => {
|
|
43
|
-
if (this.host.querySelectorAll(".hovered").forEach((i) => {
|
|
44
|
-
i.classList.remove("hovered");
|
|
45
|
-
}), this.isDragging() && this.draggingStartDate && this.draggingEndDate) {
|
|
46
|
-
const i = [];
|
|
47
|
-
let r = this.draggingStartDate, o = this.draggingEndDate;
|
|
48
|
-
o.setMinutes(o.getMinutes() + this.intervalMinutes);
|
|
49
|
-
const n = r.getDay(), u = o.getDay();
|
|
50
|
-
if (n === u)
|
|
51
|
-
i.push({ start: r, end: o });
|
|
52
|
-
else if (u > n)
|
|
53
|
-
for (let l = 0; l <= u - n; l++) {
|
|
54
|
-
const d = new Date(r), g = new Date(r);
|
|
55
|
-
d.setDate(r.getDate() + l), g.setDate(r.getDate() + l), g.setHours(o.getHours()), i.push({ start: d, end: g });
|
|
56
|
-
}
|
|
57
|
-
for (let l of i)
|
|
58
|
-
this.updateAvailableTimes(l.start, l.end);
|
|
59
|
-
}
|
|
60
|
-
this.draggingStartDate = null, this.draggingEndDate = null, e.preventDefault(), e.stopPropagation();
|
|
61
|
-
}, this.onTimeClick = (e) => {
|
|
62
|
-
if (this.isDragging()) {
|
|
63
|
-
f("dragging for more than threshold, skipping click event");
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
this.draggingStartDate = null;
|
|
67
|
-
const s = new Date(e), a = new Date(e);
|
|
68
|
-
a.setMinutes(a.getMinutes() + this.intervalMinutes), this.updateAvailableTimes(s, a);
|
|
69
|
-
}, this.isDragging = () => {
|
|
70
|
-
const e = (/* @__PURE__ */ new Date()).getTime();
|
|
71
|
-
return this.draggingStartDate && e - this.dragStartTime > this.dragThreshold;
|
|
72
|
-
}, this.updateAvailableTimes = (e, s) => {
|
|
73
|
-
const { availableTimes: a } = this, i = a.findIndex((n) => e.getTime() >= n.start.getTime() && s.getTime() <= n.end.getTime());
|
|
74
|
-
if (i !== -1) {
|
|
75
|
-
a.splice(i, 1), this.availableTimes = [...a];
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const r = a.findIndex((n) => e.getTime() === n.end.getTime());
|
|
79
|
-
if (r !== -1) {
|
|
80
|
-
a[r].end = s, this.availableTimes = [...a];
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const o = a.findIndex((n) => s.getTime() === n.start.getTime());
|
|
84
|
-
if (o !== -1) {
|
|
85
|
-
a[o].start = e, this.availableTimes = [...a];
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
this.availableTimes = [...a, { start: e, end: s }];
|
|
89
|
-
}, this.isAvailableTime = (e) => this.availableTimes.some((s) => s.start.getTime() <= e.getTime() && s.end.getTime() > e.getTime()), this.getSelectedDate = (e) => {
|
|
90
|
-
const s = new Date(this.startTime);
|
|
91
|
-
s.setDate(e % 7 + 1);
|
|
92
|
-
const a = Math.floor(e / 7);
|
|
93
|
-
return s.setHours(this.times[a].getHours()), s.setMinutes(this.times[a].getMinutes()), s;
|
|
94
|
-
}, this.isHovering = (e) => !this.draggingStartDate || !this.draggingEndDate ? !1 : e.getDay() >= this.draggingStartDate.getDay() && e.getHours() >= this.draggingStartDate.getHours() && e.getHours() <= this.draggingEndDate.getHours() && e.getDay() <= this.draggingEndDate.getDay(), this.calculateAvailableTimes = (e) => {
|
|
95
|
-
const s = [];
|
|
96
|
-
for (const a of e)
|
|
97
|
-
for (const i of a.days) {
|
|
98
|
-
if (a.start === a.end)
|
|
99
|
-
continue;
|
|
100
|
-
const [r, o] = a.start.split(":").map((g) => parseInt(g, 10)), [n, u] = a.end.split(":").map((g) => parseInt(g, 10)), l = new Date(this.startTime);
|
|
101
|
-
l.setDate(l.getDate() + i), l.setHours(r), l.setMinutes(o);
|
|
102
|
-
const d = new Date(this.startTime);
|
|
103
|
-
d.setDate(d.getDate() + i), d.setHours(n), d.setMinutes(u), s.push({ start: l, end: d });
|
|
104
|
-
}
|
|
105
|
-
return s.sort((a, i) => a.start.getTime() - i.start.getTime()), f("availableTimes", s), s;
|
|
106
|
-
}, this.calculateOpenHours = () => {
|
|
107
|
-
const e = {}, s = [];
|
|
108
|
-
let a = [...this.availableTimes];
|
|
109
|
-
if (a.sort((i, r) => i.start.getTime() - r.start.getTime()), this.inverse) {
|
|
110
|
-
const i = [...a];
|
|
111
|
-
a = [];
|
|
112
|
-
let r = this.startTime;
|
|
113
|
-
for (const o of i) {
|
|
114
|
-
const n = o.start;
|
|
115
|
-
a.push({ start: r, end: n }), r = o.end;
|
|
116
|
-
}
|
|
117
|
-
a.push({ start: r, end: this.endTime });
|
|
118
|
-
}
|
|
119
|
-
a.sort((i, r) => i.start.getTime() - r.start.getTime());
|
|
120
|
-
for (const i of a) {
|
|
121
|
-
const r = i.start.getDay(), o = i.end.getDay(), n = new Date(i.start);
|
|
122
|
-
n.setDate(n.getDate() + 1), n.setHours(0, 0, 0, 0), (r > o || o > r) && (a.push({ start: n, end: i.end }), i.end = new Date(i.start), i.end.setHours(23, 0, 0, 0));
|
|
123
|
-
const u = b(i.start), l = b(i.end), d = `${u}-${l}`;
|
|
124
|
-
e[d] ? e[d].push(r) : e[d] = [r];
|
|
125
|
-
}
|
|
126
|
-
for (const i in e) {
|
|
127
|
-
const [r, o] = i.split("-"), u = {
|
|
128
|
-
days: e[i],
|
|
129
|
-
start: r,
|
|
130
|
-
end: o,
|
|
131
|
-
timezone: w()
|
|
132
|
-
};
|
|
133
|
-
s.push(u);
|
|
134
|
-
}
|
|
135
|
-
this.openHoursChanged.emit(s);
|
|
136
|
-
}, this.getNumberOfDatesBetween = (e, s) => {
|
|
137
|
-
const a = Math.abs(s.getTime() - e.getTime());
|
|
138
|
-
return Math.ceil(a / (1e3 * 60 * 60 * 24));
|
|
139
|
-
}, this.openHours = [], this.startTime = new Date(2024, 8, 1, 8, 0, 0, 0), this.endTime = new Date(2024, 8, 7, 18, 0, 0, 0), this.stepMinutes = 15, this.dragThreshold = 150, this.mobileViewPortWidth = 768, this.intervalMinutes = 60, this.times = [], this.availableTimes = [], this.draggingStartDate = null, this.draggingEndDate = null, this.inverse = !1, this.isMobile = !1;
|
|
140
|
-
}
|
|
141
|
-
componentWillLoad() {
|
|
142
|
-
this.onResize();
|
|
143
|
-
const t = new Date(this.startTime);
|
|
144
|
-
t.setHours(this.endTime.getHours(), 0, 0, 0), this.times = v(this.startTime, t, this.intervalMinutes / 60), this.availableTimes = this.calculateAvailableTimes(this.openHours);
|
|
145
|
-
}
|
|
146
|
-
whenOpenHoursChanged(t, e) {
|
|
147
|
-
JSON.stringify(t) !== JSON.stringify(e) && (this.availableTimes = this.calculateAvailableTimes(t));
|
|
148
|
-
}
|
|
149
|
-
availableTimesChanged() {
|
|
150
|
-
this.calculateOpenHours();
|
|
151
|
-
}
|
|
152
|
-
inverseChanged() {
|
|
153
|
-
this.calculateOpenHours();
|
|
154
|
-
}
|
|
155
|
-
onResize() {
|
|
156
|
-
const t = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
|
|
157
|
-
this.isMobile = t <= this.mobileViewPortWidth;
|
|
158
|
-
}
|
|
159
|
-
render() {
|
|
160
|
-
return h(M, { key: "d5bbd9de6ab37f3f65d15b3dc5707b01a851956d" }, h("div", { key: "5ff3bdae2037ba3899332c0aca490c2b4cc80196", class: "open-hours", part: "open-hours" }, h("div", { key: "c8de6bcc08a63326182fad04ea4e1808c628c609", class: "days", part: "days" }, Array.from({ length: this.getNumberOfDatesBetween(this.startTime, this.endTime) }).map((t, e) => {
|
|
161
|
-
const s = new Date(this.startTime);
|
|
162
|
-
return s.setDate(s.getDate() + e), h("span", null, s.toLocaleDateString(void 0, { weekday: this.isMobile ? "short" : "long" }));
|
|
163
|
-
})), h("div", { key: "3592ca8e4b4de1302cca7fdca24cfb6ed09c7d41", class: "hours", part: "hours" }, this.times.map((t) => h("span", null, t.toLocaleTimeString(void 0, { timeStyle: "short" })))), h("div", { key: "48ead6932850e177cfbd43a6227720c8c86145ea", class: {
|
|
164
|
-
"selected-hours": !0,
|
|
165
|
-
inverse: this.inverse
|
|
166
|
-
}, part: "selected-hours", onWheel: this.onSelectedHoursWeel, onContextMenu: this.onContextMenu }, Array.from({ length: this.getNumberOfDatesBetween(this.startTime, this.endTime) * this.times.length }).map((t, e) => h("div", { part: "hour", class: {
|
|
167
|
-
hour: !0,
|
|
168
|
-
selected: this.isAvailableTime(this.getSelectedDate(e)),
|
|
169
|
-
hovered: this.isHovering(this.getSelectedDate(e))
|
|
170
|
-
}, onMouseDown: (s) => this.onMouseDown(s, this.getSelectedDate(e)), onMouseUp: (s) => this.onMouseUp(s, this.getSelectedDate(e)), onMouseOver: (s) => this.onMouseOver(s, this.getSelectedDate(e)), onClick: () => this.onTimeClick(this.getSelectedDate(e)) }, " ")))), h("div", { key: "ca2aa5bef7a0e31b29b4a1a759fcefcabc6f0785", class: "legend", part: "legend" }, h("div", { key: "a7b3b3a0a02c8dfbac69f8cad10c392e3a2e3e84", class: "available", part: "available" }, h("span", { key: "dcfcd5d5fd2934672fb0069825ab98e50c886682", class: "box", part: "box" }), h("span", { key: "37cc29e78d063c1087d46a1cc5de6dbe46677031", class: "label", part: "label" }, "Available")), h("div", { key: "9db85b0c8c208aa764f2ea0c6e3371dcea0594e0", class: "unavailable", part: "unavailable" }, h("span", { key: "c0a3ef91cc2a8f418329d2c6d91feb7d90e4658f", class: "box", part: "box" }), h("span", { key: "0f21587a4222836b2273e19094b8c0c35b88de20", class: "label", part: "label" }, "Unavailable"))));
|
|
171
|
-
}
|
|
172
|
-
get host() {
|
|
173
|
-
return H(this);
|
|
174
|
-
}
|
|
175
|
-
static get watchers() {
|
|
176
|
-
return {
|
|
177
|
-
openHours: ["whenOpenHoursChanged"],
|
|
178
|
-
availableTimes: ["availableTimesChanged"],
|
|
179
|
-
inverse: ["inverseChanged"]
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
E.style = O;
|
|
184
|
-
export {
|
|
185
|
-
E as nylas_open_hours_picker
|
|
186
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-586a4206.cjs"),m=require("./utils-5074a070-d5ba6add.cjs"),u=require("./duration-bddc4a13-05d3e3e2.cjs");require("react");require("react-dom");const f=u.timeInterval(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*u.durationSecond)},(t,e)=>{t.setTime(+t+e*u.durationMinute)},(t,e)=>(e-t)/u.durationMinute,t=>t.getMinutes()),v=f.range;u.timeInterval(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*u.durationMinute)},(t,e)=>(e-t)/u.durationMinute,t=>t.getUTCMinutes());const T=u.timeInterval(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*u.durationSecond-t.getMinutes()*u.durationMinute)},(t,e)=>{t.setTime(+t+e*u.durationHour)},(t,e)=>(e-t)/u.durationHour,t=>t.getHours()),p=T.range;u.timeInterval(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*u.durationHour)},(t,e)=>(e-t)/u.durationHour,t=>t.getUTCHours());const y=':host{display:block;font-size:inherit;font-family:inherit;--nylas-grid-border-color:var(--nylas-base-100);--nylas-available-color:var(--nylas-base-500);--nylas-available-hover-color:var(--nylas-base-100);--nylas-unavailable-color:inherit}.legend{display:grid;grid-template-columns:1fr 1fr;gap:1rem;align-items:center;font-size:inherit;font-family:inherit;max-width:fit-content;margin:0 auto;margin-top:1rem}.legend .available{display:grid;grid-template-columns:auto 1fr;gap:0.5rem;align-items:center;font-size:inherit;font-family:inherit}.legend .available .box{width:2rem;height:2rem;background-color:var(--nylas-available-color);border:1px dashed var(--nylas-grid-border-color)}.legend .unavailable{display:grid;grid-template-columns:auto 1fr;gap:0.5rem;align-items:center;font-size:inherit;font-family:inherit}.legend .unavailable .box{width:2rem;height:2rem;background-color:var(--nylas-unavailable-color);border:1px dashed var(--nylas-grid-border-color)}.open-hours{display:grid;gap:1rem;grid-template:".... days days" "hours selected-hours selected-hours" 1fr/auto 1fr}.open-hours .days{grid-area:days;display:grid;grid-auto-flow:column;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;text-align:center;justify-items:center;font-size:inherit;font-family:inherit}.open-hours .hours{display:grid;grid-auto-flow:row;grid-area:hours;text-align:right;align-items:start;font-size:inherit;font-family:inherit}.open-hours .hours span{top:-0.6rem;display:block;position:relative}.open-hours .selected-hours{display:grid;grid-area:selected-hours;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.open-hours .selected-hours .hour{display:grid;border:1px dashed var(--nylas-grid-border-color);height:40px;background-color:var(--nylas-unavailable-color)}.open-hours .selected-hours .hour.selected{background-color:var(--nylas-available-color)}.open-hours .selected-hours .hour.hovered{background-color:var(--nylas-available-hover-color)}.open-hours .selected-hours.inverse .hour{background-color:var(--nylas-available-color)}.open-hours .selected-hours.inverse .hour.selected{background-color:var(--nylas-unavailable-color)}.open-hours .selected-hours.inverse .hour.hovered{background-color:var(--nylas-available-hover-color)}',D=y,b=class{constructor(t){o.registerInstance(this,t),this.openHoursChanged=o.createEvent(this,"openHoursChanged",7),this.dragStartTime=0,this.onSelectedHoursWeel=e=>{e.preventDefault(),e.stopPropagation();const{deltaY:s}=e,i=s>0?-1:1;if(this.intervalMinutes===this.stepMinutes&&i===-1||this.intervalMinutes===60&&i===1)return;this.intervalMinutes=this.intervalMinutes+i*this.stepMinutes;const a=new Date(this.startTime);a.setHours(this.endTime.getHours(),0,0,0),this.intervalMinutes<60?this.times=v(this.startTime,a,this.intervalMinutes):this.times=p(this.startTime,a,this.intervalMinutes/60)},this.onContextMenu=e=>{e.preventDefault(),e.stopPropagation(),this.inverse=!this.inverse},this.onMouseDown=(e,s)=>{this.draggingStartDate=s,this.dragStartTime=new Date().getTime(),e.preventDefault(),e.stopPropagation()},this.onMouseOver=(e,s)=>{this.isDragging()&&(this.draggingEndDate=s)},this.onMouseUp=(e,s)=>{if(this.host.querySelectorAll(".hovered").forEach(a=>{a.classList.remove("hovered")}),this.isDragging()&&this.draggingStartDate&&this.draggingEndDate){const a=[];let r=this.draggingStartDate,l=this.draggingEndDate;l.setMinutes(l.getMinutes()+this.intervalMinutes);const n=r.getDay(),c=l.getDay();if(n===c)a.push({start:r,end:l});else if(c>n)for(let h=0;h<=c-n;h++){const d=new Date(r),g=new Date(r);d.setDate(r.getDate()+h),g.setDate(r.getDate()+h),g.setHours(l.getHours()),a.push({start:d,end:g})}for(let h of a)this.updateAvailableTimes(h.start,h.end)}this.draggingStartDate=null,this.draggingEndDate=null,e.preventDefault(),e.stopPropagation()},this.onTimeClick=e=>{if(this.isDragging()){m.debug("dragging for more than threshold, skipping click event");return}this.draggingStartDate=null;const s=new Date(e),i=new Date(e);i.setMinutes(i.getMinutes()+this.intervalMinutes),this.updateAvailableTimes(s,i)},this.isDragging=()=>{const e=new Date().getTime();return this.draggingStartDate&&e-this.dragStartTime>this.dragThreshold},this.updateAvailableTimes=(e,s)=>{const{availableTimes:i}=this,a=i.findIndex(n=>e.getTime()>=n.start.getTime()&&s.getTime()<=n.end.getTime());if(a!==-1){i.splice(a,1),this.availableTimes=[...i];return}const r=i.findIndex(n=>e.getTime()===n.end.getTime());if(r!==-1){i[r].end=s,this.availableTimes=[...i];return}const l=i.findIndex(n=>s.getTime()===n.start.getTime());if(l!==-1){i[l].start=e,this.availableTimes=[...i];return}this.availableTimes=[...i,{start:e,end:s}]},this.isAvailableTime=e=>this.availableTimes.some(s=>s.start.getTime()<=e.getTime()&&s.end.getTime()>e.getTime()),this.getSelectedDate=e=>{const s=new Date(this.startTime);s.setDate(e%7+1);const i=Math.floor(e/7);return s.setHours(this.times[i].getHours()),s.setMinutes(this.times[i].getMinutes()),s},this.isHovering=e=>!this.draggingStartDate||!this.draggingEndDate?!1:e.getDay()>=this.draggingStartDate.getDay()&&e.getHours()>=this.draggingStartDate.getHours()&&e.getHours()<=this.draggingEndDate.getHours()&&e.getDay()<=this.draggingEndDate.getDay(),this.calculateAvailableTimes=e=>{const s=[];for(const i of e)for(const a of i.days){if(i.start===i.end)continue;const[r,l]=i.start.split(":").map(g=>parseInt(g,10)),[n,c]=i.end.split(":").map(g=>parseInt(g,10)),h=new Date(this.startTime);h.setDate(h.getDate()+a),h.setHours(r),h.setMinutes(l);const d=new Date(this.startTime);d.setDate(d.getDate()+a),d.setHours(n),d.setMinutes(c),s.push({start:h,end:d})}return s.sort((i,a)=>i.start.getTime()-a.start.getTime()),m.debug("availableTimes",s),s},this.calculateOpenHours=()=>{const e={},s=[];let i=[...this.availableTimes];if(i.sort((a,r)=>a.start.getTime()-r.start.getTime()),this.inverse){const a=[...i];i=[];let r=this.startTime;for(const l of a){const n=l.start;i.push({start:r,end:n}),r=l.end}i.push({start:r,end:this.endTime})}i.sort((a,r)=>a.start.getTime()-r.start.getTime());for(const a of i){const r=a.start.getDay(),l=a.end.getDay(),n=new Date(a.start);n.setDate(n.getDate()+1),n.setHours(0,0,0,0),(r>l||l>r)&&(i.push({start:n,end:a.end}),a.end=new Date(a.start),a.end.setHours(23,0,0,0));const c=m.get24HourTime(a.start),h=m.get24HourTime(a.end),d=`${c}-${h}`;e[d]?e[d].push(r):e[d]=[r]}for(const a in e){const[r,l]=a.split("-"),c={days:e[a],start:r,end:l,timezone:m.getUserTimezone()};s.push(c)}this.openHoursChanged.emit(s)},this.getNumberOfDatesBetween=(e,s)=>{const i=Math.abs(s.getTime()-e.getTime());return Math.ceil(i/(1e3*60*60*24))},this.openHours=[],this.startTime=new Date(2024,8,1,8,0,0,0),this.endTime=new Date(2024,8,7,18,0,0,0),this.stepMinutes=15,this.dragThreshold=150,this.mobileViewPortWidth=768,this.intervalMinutes=60,this.times=[],this.availableTimes=[],this.draggingStartDate=null,this.draggingEndDate=null,this.inverse=!1,this.isMobile=!1}componentWillLoad(){this.onResize();const t=new Date(this.startTime);t.setHours(this.endTime.getHours(),0,0,0),this.times=p(this.startTime,t,this.intervalMinutes/60),this.availableTimes=this.calculateAvailableTimes(this.openHours)}whenOpenHoursChanged(t,e){JSON.stringify(t)!==JSON.stringify(e)&&(this.availableTimes=this.calculateAvailableTimes(t))}availableTimesChanged(){this.calculateOpenHours()}inverseChanged(){this.calculateOpenHours()}onResize(){const t=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);this.isMobile=t<=this.mobileViewPortWidth}render(){return o.h(o.Host,{key:"d5bbd9de6ab37f3f65d15b3dc5707b01a851956d"},o.h("div",{key:"5ff3bdae2037ba3899332c0aca490c2b4cc80196",class:"open-hours",part:"open-hours"},o.h("div",{key:"c8de6bcc08a63326182fad04ea4e1808c628c609",class:"days",part:"days"},Array.from({length:this.getNumberOfDatesBetween(this.startTime,this.endTime)}).map((t,e)=>{const s=new Date(this.startTime);return s.setDate(s.getDate()+e),o.h("span",null,s.toLocaleDateString(void 0,{weekday:this.isMobile?"short":"long"}))})),o.h("div",{key:"3592ca8e4b4de1302cca7fdca24cfb6ed09c7d41",class:"hours",part:"hours"},this.times.map(t=>o.h("span",null,t.toLocaleTimeString(void 0,{timeStyle:"short"})))),o.h("div",{key:"48ead6932850e177cfbd43a6227720c8c86145ea",class:{"selected-hours":!0,inverse:this.inverse},part:"selected-hours",onWheel:this.onSelectedHoursWeel,onContextMenu:this.onContextMenu},Array.from({length:this.getNumberOfDatesBetween(this.startTime,this.endTime)*this.times.length}).map((t,e)=>o.h("div",{part:"hour",class:{hour:!0,selected:this.isAvailableTime(this.getSelectedDate(e)),hovered:this.isHovering(this.getSelectedDate(e))},onMouseDown:s=>this.onMouseDown(s,this.getSelectedDate(e)),onMouseUp:s=>this.onMouseUp(s,this.getSelectedDate(e)),onMouseOver:s=>this.onMouseOver(s,this.getSelectedDate(e)),onClick:()=>this.onTimeClick(this.getSelectedDate(e))}," ")))),o.h("div",{key:"ca2aa5bef7a0e31b29b4a1a759fcefcabc6f0785",class:"legend",part:"legend"},o.h("div",{key:"a7b3b3a0a02c8dfbac69f8cad10c392e3a2e3e84",class:"available",part:"available"},o.h("span",{key:"dcfcd5d5fd2934672fb0069825ab98e50c886682",class:"box",part:"box"}),o.h("span",{key:"37cc29e78d063c1087d46a1cc5de6dbe46677031",class:"label",part:"label"},"Available")),o.h("div",{key:"9db85b0c8c208aa764f2ea0c6e3371dcea0594e0",class:"unavailable",part:"unavailable"},o.h("span",{key:"c0a3ef91cc2a8f418329d2c6d91feb7d90e4658f",class:"box",part:"box"}),o.h("span",{key:"0f21587a4222836b2273e19094b8c0c35b88de20",class:"label",part:"label"},"Unavailable"))))}get host(){return o.getElement(this)}static get watchers(){return{openHours:["whenOpenHoursChanged"],availableTimes:["availableTimesChanged"],inverse:["inverseChanged"]}}};b.style=D;exports.nylas_open_hours_picker=b;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-586a4206.cjs"),y=require("./index-b30d446a-3d69a3cc.cjs"),a=require("./utils-5074a070-d5ba6add.cjs"),o=require("./mailbox-store-19f0c6c9-9a3ef58a.cjs"),g=require("./scheduler-store-7d48e682-449277d4.cjs");require("react");require("react-dom");class S{constructor(t,s,n,l,i,h="https://scheduler.nylas.com"){this.router=t,this.schedulerAPIURL=h,this.nylasAuth=s,this.nylasAuthStore=n,this.nylasMailboxStore=l,this.nylasSchedulerStore=i}init(){a.debug("NylasConnector init")}get authStore(){return this.nylasAuthStore}get mailboxStore(){return this.nylasMailboxStore}get schedulerStore(){return this.nylasSchedulerStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new o.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 g.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore}),this._schedulerAPIConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset(),this.nylasMailboxStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const b=":host{display:contents}",m=b,C=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(){a.debug("[nylas-provider] connectedCallback")}async componentWillLoad(){var i,h,c,u,d;a.debug("[nylas-provider] componentWillLoad"),this.stores={auth:o.CreateNylasAuthStore(),mailbox:o.CreateNylasMailboxStore(),scheduler:g.CreateNylasSchedulerStore()},this.baseProvider=new y.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=new o.HashRouter;this.nylasAuth=y.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=(i=this.baseProvider)==null?void 0:i.getStore("mailbox");if(!t)throw new Error("The mailbox store is not set");const s=(h=this.baseProvider)==null?void 0:h.getStore("auth");if(!s)throw new Error("The auth store is not set");const n=(c=this.baseProvider)==null?void 0:c.getStore("scheduler");if(!n)throw new Error("The scheduler store is not set");this.nylasConnector=new S(e,this.nylasAuth,s,t,n),this.init.emit(this.host).defaultPrevented||await((u=this.nylasConnector)==null?void 0:u.auth.validateSession()),this.handleAuthChange(s.state.isAuthenticated),(d=this.baseProvider)==null||d.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")}render(){return r.h(r.Host,{key:"5428aca07aa5a047a2912685b1d4475a19ac7783"},r.h("slot",{key:"6e15b9b39a557f02de8c1ea07973d27fdf0451f7"}))}get host(){return r.getElement(this)}};C.style=m;exports.nylas_provider=C;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { r as y, c as i, h as d, H as g, g as C } from "./index-98d3a4da.js";
|
|
2
|
-
import { N as m, e as S } from "./index-b30d446a-e0eaccad.js";
|
|
3
|
-
import { d as a } from "./utils-5074a070-ce33ee6b.js";
|
|
4
|
-
import { C as A, a as b, H as p, N as f, b as v, c as P, d as _ } from "./mailbox-store-19f0c6c9-23a4e72f.js";
|
|
5
|
-
import { C as N, N as w } from "./scheduler-store-7d48e682-39104219.js";
|
|
6
|
-
import "react";
|
|
7
|
-
import "react-dom";
|
|
8
|
-
class x {
|
|
9
|
-
constructor(e, s, r, h, o, n = "https://scheduler.nylas.com") {
|
|
10
|
-
this.router = e, this.schedulerAPIURL = n, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = h, this.nylasSchedulerStore = o;
|
|
11
|
-
}
|
|
12
|
-
init() {
|
|
13
|
-
a("NylasConnector init");
|
|
14
|
-
}
|
|
15
|
-
get authStore() {
|
|
16
|
-
return this.nylasAuthStore;
|
|
17
|
-
}
|
|
18
|
-
get mailboxStore() {
|
|
19
|
-
return this.nylasMailboxStore;
|
|
20
|
-
}
|
|
21
|
-
get schedulerStore() {
|
|
22
|
-
return this.nylasSchedulerStore;
|
|
23
|
-
}
|
|
24
|
-
get auth() {
|
|
25
|
-
return this._authConnector ? this._authConnector : (this._authConnector = new f(this.nylasAuth, this.nylasAuthStore), this._authConnector);
|
|
26
|
-
}
|
|
27
|
-
get threads() {
|
|
28
|
-
return this._threadConnector ? this._threadConnector : (this._threadConnector = new v(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
|
|
29
|
-
}
|
|
30
|
-
get messages() {
|
|
31
|
-
return this._messageConnector ? this._messageConnector : (this._messageConnector = new P(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
|
|
32
|
-
}
|
|
33
|
-
get folders() {
|
|
34
|
-
return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new _(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
|
|
35
|
-
}
|
|
36
|
-
get scheduler() {
|
|
37
|
-
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new w({
|
|
38
|
-
schedulerAPIURL: this.schedulerAPIURL,
|
|
39
|
-
schedulerStore: this.schedulerStore
|
|
40
|
-
}), this._schedulerAPIConnector);
|
|
41
|
-
}
|
|
42
|
-
getAuth() {
|
|
43
|
-
return this.nylasAuth;
|
|
44
|
-
}
|
|
45
|
-
resetStores() {
|
|
46
|
-
this.nylasAuthStore.reset(), this.nylasMailboxStore.reset();
|
|
47
|
-
}
|
|
48
|
-
async logout() {
|
|
49
|
-
await this.nylasAuth.logout(), this.resetStores();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const I = ":host{display:contents}", M = I, L = class {
|
|
53
|
-
constructor(t) {
|
|
54
|
-
y(this, t), this.init = i(this, "init", 7), this.loggedIn = i(this, "loggedIn", 7), this.loggedOut = i(this, "loggedOut", 7), this.handleAuthChange = async (e) => {
|
|
55
|
-
e ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host);
|
|
56
|
-
}, this.authConfig = void 0, this.eventOverrides = {}, this.automaticComponentRegistration = !0;
|
|
57
|
-
}
|
|
58
|
-
connectedCallback() {
|
|
59
|
-
a("[nylas-provider] connectedCallback");
|
|
60
|
-
}
|
|
61
|
-
async componentWillLoad() {
|
|
62
|
-
var o, n, l, c, u;
|
|
63
|
-
a("[nylas-provider] componentWillLoad"), this.stores = {
|
|
64
|
-
auth: A(),
|
|
65
|
-
mailbox: b(),
|
|
66
|
-
scheduler: N()
|
|
67
|
-
}, this.baseProvider = new m(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
|
|
68
|
-
const t = new p();
|
|
69
|
-
this.nylasAuth = S({
|
|
70
|
-
apiUri: "https://api.us.nylas.com",
|
|
71
|
-
elementsApiUri: "https://elements.us.nylas.com",
|
|
72
|
-
storageType: "indexeddb",
|
|
73
|
-
clientId: "YOUR_CLIENT_ID",
|
|
74
|
-
defaultScopes: [],
|
|
75
|
-
redirectURI: "/",
|
|
76
|
-
...this.authConfig
|
|
77
|
-
});
|
|
78
|
-
const e = (o = this.baseProvider) == null ? void 0 : o.getStore("mailbox");
|
|
79
|
-
if (!e)
|
|
80
|
-
throw new Error("The mailbox store is not set");
|
|
81
|
-
const s = (n = this.baseProvider) == null ? void 0 : n.getStore("auth");
|
|
82
|
-
if (!s)
|
|
83
|
-
throw new Error("The auth store is not set");
|
|
84
|
-
const r = (l = this.baseProvider) == null ? void 0 : l.getStore("scheduler");
|
|
85
|
-
if (!r)
|
|
86
|
-
throw new Error("The scheduler store is not set");
|
|
87
|
-
this.nylasConnector = new x(t, this.nylasAuth, s, e, r), this.init.emit(this.host).defaultPrevented || await ((c = this.nylasConnector) == null ? void 0 : c.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (u = this.baseProvider) == null || u.componentWillLoad(this.nylasConnector);
|
|
88
|
-
}
|
|
89
|
-
componentDidLoad() {
|
|
90
|
-
var e, s;
|
|
91
|
-
const t = (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
|
|
92
|
-
t == null || t.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
|
|
93
|
-
}
|
|
94
|
-
componentDisconnected() {
|
|
95
|
-
var t;
|
|
96
|
-
(t = this.baseProvider) == null || t.componentDisconnected();
|
|
97
|
-
}
|
|
98
|
-
async registerComponentHandler(t) {
|
|
99
|
-
var e;
|
|
100
|
-
(e = this.baseProvider) == null || e.registerComponent(t.detail);
|
|
101
|
-
}
|
|
102
|
-
async unregisterComponentHandler(t) {
|
|
103
|
-
var e;
|
|
104
|
-
(e = this.baseProvider) == null || e.unregisterComponent(t.detail);
|
|
105
|
-
}
|
|
106
|
-
async getNylasAuth() {
|
|
107
|
-
return this.nylasAuth;
|
|
108
|
-
}
|
|
109
|
-
async getNylasConnector() {
|
|
110
|
-
return this.nylasConnector;
|
|
111
|
-
}
|
|
112
|
-
async getMailboxStore() {
|
|
113
|
-
var t;
|
|
114
|
-
return (t = this.baseProvider) == null ? void 0 : t.getStore("mailbox");
|
|
115
|
-
}
|
|
116
|
-
async getAuthStore() {
|
|
117
|
-
var t;
|
|
118
|
-
return (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
|
|
119
|
-
}
|
|
120
|
-
async getNylasSchedulerStore() {
|
|
121
|
-
var t;
|
|
122
|
-
return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
|
|
123
|
-
}
|
|
124
|
-
render() {
|
|
125
|
-
return d(g, { key: "5428aca07aa5a047a2912685b1d4475a19ac7783" }, d("slot", { key: "6e15b9b39a557f02de8c1ea07973d27fdf0451f7" }));
|
|
126
|
-
}
|
|
127
|
-
get host() {
|
|
128
|
-
return C(this);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
L.style = M;
|
|
132
|
-
export {
|
|
133
|
-
L as nylas_provider
|
|
134
|
-
};
|