@nylas/react 1.1.0-canary.4 → 1.1.0-canary.7
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/elements/index.d.ts +1 -0
- package/dist/{elements-dc5b338e-fb5dbfb5.js → elements-dc5b338e-6078b875.js} +1 -1
- package/dist/{elements-dc5b338e-81a0319c.cjs → elements-dc5b338e-96e197ca.cjs} +1 -1
- package/dist/focus-visible-e8093c16-018ffd63.cjs +1 -0
- package/dist/{focus-visible-e8093c16-28fc08a0.js → focus-visible-e8093c16-ab01d60a.js} +5 -3
- package/dist/index-1fd24ccf.js +3582 -0
- package/dist/index-823fdc6f.cjs +36 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +53 -52
- package/package.json +3 -3
- package/dist/_commonjsHelpers-57e89916-4a3ae7d8.cjs +0 -1
- package/dist/_commonjsHelpers-57e89916-af061c86.js +0 -19
- package/dist/add-circle-icon_22.entry-077661c3.cjs +0 -1
- package/dist/add-circle-icon_22.entry-f699d91e.js +0 -1733
- package/dist/archive-icon_7.entry-40b7ef3b.js +0 -75
- package/dist/archive-icon_7.entry-e8630de9.cjs +0 -1
- package/dist/arrow-icon.entry-58246303.js +0 -15
- package/dist/arrow-icon.entry-ffa53114.cjs +0 -1
- package/dist/bold-icon_3.entry-106a4e77.cjs +0 -1
- package/dist/bold-icon_3.entry-f5f1643d.js +0 -35
- package/dist/calendar-cancel-icon.entry-6ae0fd0f.cjs +0 -1
- package/dist/calendar-cancel-icon.entry-75b15b19.js +0 -15
- package/dist/calendar-check-icon_2.entry-57339318.js +0 -25
- package/dist/calendar-check-icon_2.entry-c57f83f3.cjs +0 -1
- package/dist/calendar-icon.entry-2069fec6.js +0 -15
- package/dist/calendar-icon.entry-492c2630.cjs +0 -1
- package/dist/chevron-icon_3.entry-83df50c3.js +0 -117
- package/dist/chevron-icon_3.entry-878ff6df.cjs +0 -1
- package/dist/close-icon.entry-480c199d.js +0 -15
- package/dist/close-icon.entry-8015ca05.cjs +0 -1
- package/dist/constants-6ee60d6d-4cd16450.js +0 -3740
- package/dist/constants-6ee60d6d-6c0540db.cjs +0 -15
- package/dist/document-refresh-icon.entry-06f7972b.cjs +0 -1
- package/dist/document-refresh-icon.entry-09870b14.js +0 -15
- package/dist/focus-visible-e8093c16-f380b705.cjs +0 -1
- package/dist/forward-icon_6.entry-8bb201eb.js +0 -955
- package/dist/forward-icon_6.entry-eeecf2a2.cjs +0 -3
- package/dist/globe-icon.entry-a690028c.cjs +0 -1
- package/dist/globe-icon.entry-d515cbfa.js +0 -15
- package/dist/google-logo-icon_3.entry-2164cec1.js +0 -258
- package/dist/google-logo-icon_3.entry-b2b85284.cjs +0 -1
- package/dist/index-2b8437d6.cjs +0 -30
- package/dist/index-db0c5017.js +0 -1824
- package/dist/index.es-2578c6a5-098d48d0.cjs +0 -7
- package/dist/index.es-2578c6a5-71441142.js +0 -3133
- package/dist/info-icon_2.entry-300ef196.js +0 -34
- package/dist/info-icon_2.entry-e286aaa5.cjs +0 -1
- package/dist/loading-icon.entry-6d8adaa4.js +0 -15
- package/dist/loading-icon.entry-dc40e97d.cjs +0 -1
- package/dist/mailbox-store-bb21512c-649a374c.js +0 -381
- package/dist/mailbox-store-bb21512c-fc3c8c03.cjs +0 -1
- package/dist/nylas-additional-participants.entry-4afba192.js +0 -83
- package/dist/nylas-additional-participants.entry-db05e510.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-1ebbe0c0.js +0 -784
- package/dist/nylas-booked-event-card_10.entry-6b6fdfae.cjs +0 -1
- package/dist/nylas-form-card.entry-70b20571.cjs +0 -1
- package/dist/nylas-form-card.entry-7bc23695.js +0 -56
- package/dist/nylas-if-state.entry-3829cb3d.js +0 -96
- package/dist/nylas-if-state.entry-ebeffe22.cjs +0 -1
- package/dist/nylas-list-folders.entry-191688f2.cjs +0 -1
- package/dist/nylas-list-folders.entry-7347e78d.js +0 -122
- package/dist/nylas-list-threads.entry-432a8d8c.js +0 -72
- package/dist/nylas-list-threads.entry-44658578.cjs +0 -1
- package/dist/nylas-login.entry-5311f0a7.js +0 -75
- package/dist/nylas-login.entry-db17a3d2.cjs +0 -1
- package/dist/nylas-mailbox-pagination.entry-20150fb2.js +0 -103
- package/dist/nylas-mailbox-pagination.entry-9d3f5baa.cjs +0 -1
- package/dist/nylas-mailbox-toolbar-button.entry-6c0f7299.cjs +0 -1
- package/dist/nylas-mailbox-toolbar-button.entry-eec426d5.js +0 -84
- package/dist/nylas-mailbox.entry-b6c758b9.js +0 -136
- package/dist/nylas-mailbox.entry-d41401e0.cjs +0 -1
- package/dist/nylas-provider.entry-271cafd2.js +0 -147
- package/dist/nylas-provider.entry-6173b721.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-0c75d39e.cjs +0 -7
- package/dist/nylas-scheduler-editor.entry-b51ad4b1.js +0 -2192
- package/dist/nylas-scheduling.entry-081c8825.cjs +0 -1
- package/dist/nylas-scheduling.entry-0a8d1da8.js +0 -237
- package/dist/nylas-threads-refresh.entry-72dd854e.js +0 -76
- package/dist/nylas-threads-refresh.entry-c3509e6a.cjs +0 -1
- package/dist/nylas-threads-search.entry-16a59ef6.cjs +0 -1
- package/dist/nylas-threads-search.entry-4750a187.js +0 -71
- package/dist/nylas-view-thread.entry-27df3349.cjs +0 -1
- package/dist/nylas-view-thread.entry-c6adce43.js +0 -205
- package/dist/people-icon.entry-342be0c8.js +0 -15
- package/dist/people-icon.entry-35252ca9.cjs +0 -1
- package/dist/play-icon_2.entry-0787352c.js +0 -25
- package/dist/play-icon_2.entry-f83fa92a.cjs +0 -1
- package/dist/refresh-icon.entry-8fbabfe7.js +0 -15
- package/dist/refresh-icon.entry-ddbc5446.cjs +0 -1
- package/dist/register-component-dc659dc3-e43e8fae.js +0 -105
- package/dist/register-component-dc659dc3-fb85ee68.cjs +0 -1
- package/dist/scheduler-config-store-51ee4f42-66f8c2ac.js +0 -14
- package/dist/scheduler-config-store-51ee4f42-d7d9c25d.cjs +0 -1
- package/dist/scheduler-store-72116723-ce4c7a69.cjs +0 -1
- package/dist/scheduler-store-72116723-e5f87122.js +0 -294
- package/dist/time-period-selector.entry-333942a8.js +0 -78
- package/dist/time-period-selector.entry-78d5b3c2.cjs +0 -1
- package/dist/translate-icon.entry-87a62108.js +0 -15
- package/dist/translate-icon.entry-cb19864c.cjs +0 -1
- package/dist/utils-c00bdc3c-89ab163d.js +0 -2111
- package/dist/utils-c00bdc3c-94b9c3b6.cjs +0 -8
- package/dist/warning-icon.entry-50755d91.cjs +0 -1
- package/dist/warning-icon.entry-7a72e24a.js +0 -15
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { r as o, h as e, g as n } from "./index-db0c5017.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import "react-dom";
|
|
4
|
-
const a = ".sc-info-icon-h{display:flex}", i = a, s = class {
|
|
5
|
-
constructor(t) {
|
|
6
|
-
o(this, t), this.width = "14", this.height = "14";
|
|
7
|
-
}
|
|
8
|
-
render() {
|
|
9
|
-
return e("svg", { key: "e1d319caa7a1d93ea2a59f99f2044a4bc30a3409", width: this.width, height: this.height, fill: "none", xmlns: "http://www.w3.org/2000/svg" }, e("path", { key: "d8c9ca0f1a714a817bd1c83e1cab99c6d92e83bb", fill: "currentColor", d: "M6.5 5.5C6.77614 5.5 7 5.72386 7 6V9C7 9.27614 6.77614 9.5 6.5 9.5C6.22386 9.5 6 9.27614 6 9V6C6 5.72386 6.22386 5.5 6.5 5.5ZM6.50001 4.74907C6.91369 4.74907 7.24905 4.41371 7.24905 4.00003C7.24905 3.58635 6.91369 3.251 6.50001 3.251C6.08633 3.251 5.75098 3.58635 5.75098 4.00003C5.75098 4.41371 6.08633 4.74907 6.50001 4.74907ZM0.5 6.5C0.5 3.18629 3.18629 0.5 6.5 0.5C9.81371 0.5 12.5 3.18629 12.5 6.5C12.5 9.81371 9.81371 12.5 6.5 12.5C3.18629 12.5 0.5 9.81371 0.5 6.5ZM6.5 1.5C3.73858 1.5 1.5 3.73858 1.5 6.5C1.5 9.26142 3.73858 11.5 6.5 11.5C9.26142 11.5 11.5 9.26142 11.5 6.5C11.5 3.73858 9.26142 1.5 6.5 1.5Z" }));
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
s.style = i;
|
|
13
|
-
const r = '.tooltip-container{position:relative;display:flex;--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}.tooltip-content{visibility:hidden;background-color:var(--nylas-base-800);color:var(--nylas-base-0);text-align:left;border-radius:6px;padding:5px 0;position:absolute;z-index:1;opacity:0;transition:opacity 0.3s;padding:0.5rem 1rem;max-width:200px;width:max-content}.tooltip-content.top{bottom:0;left:0;margin-bottom:1.25rem;transform:translateX(-50%)}.tooltip-content.right{top:50%;left:0%;margin-left:1.25rem;transform:translateY(-50%)}.tooltip-content.bottom{top:0;left:0;margin-top:1.25rem;transform:translateX(-50%)}.tooltip-content.left{top:50%;right:0%;margin-right:1.25rem;transform:translateY(-50%)}.tooltip-container:hover .tooltip-content,.tooltip-container:focus-within .tooltip-content{visibility:visible;opacity:1}.tooltip-content::after{content:"";position:absolute;top:-0.75rem;left:50%;transform:rotate(180deg);border-width:6px;border-style:solid;border-color:black transparent transparent transparent}.tooltip-content.top::after{top:100%;left:50%;transform:rotate(0deg)}.tooltip-content.bottom::after{top:-0.75rem;left:50%;transform:rotate(180deg)}.tooltip-content.left::after{top:47.5%;left:100%;transform:rotate(270deg)}.tooltip-content.right::after{top:47.5%;left:-0.75rem;transform:rotate(90deg)}', l = r, c = class {
|
|
14
|
-
constructor(t) {
|
|
15
|
-
o(this, t), this.position = "bottom";
|
|
16
|
-
}
|
|
17
|
-
showTooltip(t) {
|
|
18
|
-
t.target.nextElementSibling.style.visibility = "visible", t.target.nextElementSibling.style.opacity = "1";
|
|
19
|
-
}
|
|
20
|
-
hideTooltip(t) {
|
|
21
|
-
t.target.nextElementSibling.style.visibility = "hidden", t.target.nextElementSibling.style.opacity = "0";
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
return e("div", { key: "1ba151bd1d0f2c80cc641832c986bab321accade", class: "tooltip-container" }, e("span", { key: "7d432bbaa90b5e9aee4f1d8cae36e97bad47bc9e", class: "info-icon", tabindex: "0", onFocus: this.showTooltip.bind(this), onBlur: this.hideTooltip.bind(this) }, e("slot", { key: "4f5014e68d07d5e70a873b389ef84b290017a8cd", name: "tooltip-icon" }, "i")), e("span", { key: "8c903af137f14d51297e1ba212d6343d1ba0f2e5", class: `tooltip-content ${this.position}` }, e("slot", { key: "aa87ef75acc364a667d3a5139e9683f404646e51", name: "tooltip-content" }, "This is a help text.")));
|
|
25
|
-
}
|
|
26
|
-
get el() {
|
|
27
|
-
return n(this);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
c.style = l;
|
|
31
|
-
export {
|
|
32
|
-
s as info_icon,
|
|
33
|
-
c as tooltip_component
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-2b8437d6.cjs");require("react");require("react-dom");const a=".sc-info-icon-h{display:flex}",i=a,o=class{constructor(e){t.registerInstance(this,e),this.width="14",this.height="14"}render(){return t.h("svg",{key:"e1d319caa7a1d93ea2a59f99f2044a4bc30a3409",width:this.width,height:this.height,fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"d8c9ca0f1a714a817bd1c83e1cab99c6d92e83bb",fill:"currentColor",d:"M6.5 5.5C6.77614 5.5 7 5.72386 7 6V9C7 9.27614 6.77614 9.5 6.5 9.5C6.22386 9.5 6 9.27614 6 9V6C6 5.72386 6.22386 5.5 6.5 5.5ZM6.50001 4.74907C6.91369 4.74907 7.24905 4.41371 7.24905 4.00003C7.24905 3.58635 6.91369 3.251 6.50001 3.251C6.08633 3.251 5.75098 3.58635 5.75098 4.00003C5.75098 4.41371 6.08633 4.74907 6.50001 4.74907ZM0.5 6.5C0.5 3.18629 3.18629 0.5 6.5 0.5C9.81371 0.5 12.5 3.18629 12.5 6.5C12.5 9.81371 9.81371 12.5 6.5 12.5C3.18629 12.5 0.5 9.81371 0.5 6.5ZM6.5 1.5C3.73858 1.5 1.5 3.73858 1.5 6.5C1.5 9.26142 3.73858 11.5 6.5 11.5C9.26142 11.5 11.5 9.26142 11.5 6.5C11.5 3.73858 9.26142 1.5 6.5 1.5Z"}))}};o.style=i;const s='.tooltip-container{position:relative;display:flex;--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}.tooltip-content{visibility:hidden;background-color:var(--nylas-base-800);color:var(--nylas-base-0);text-align:left;border-radius:6px;padding:5px 0;position:absolute;z-index:1;opacity:0;transition:opacity 0.3s;padding:0.5rem 1rem;max-width:200px;width:max-content}.tooltip-content.top{bottom:0;left:0;margin-bottom:1.25rem;transform:translateX(-50%)}.tooltip-content.right{top:50%;left:0%;margin-left:1.25rem;transform:translateY(-50%)}.tooltip-content.bottom{top:0;left:0;margin-top:1.25rem;transform:translateX(-50%)}.tooltip-content.left{top:50%;right:0%;margin-right:1.25rem;transform:translateY(-50%)}.tooltip-container:hover .tooltip-content,.tooltip-container:focus-within .tooltip-content{visibility:visible;opacity:1}.tooltip-content::after{content:"";position:absolute;top:-0.75rem;left:50%;transform:rotate(180deg);border-width:6px;border-style:solid;border-color:black transparent transparent transparent}.tooltip-content.top::after{top:100%;left:50%;transform:rotate(0deg)}.tooltip-content.bottom::after{top:-0.75rem;left:50%;transform:rotate(180deg)}.tooltip-content.left::after{top:47.5%;left:100%;transform:rotate(270deg)}.tooltip-content.right::after{top:47.5%;left:-0.75rem;transform:rotate(90deg)}',r=s,n=class{constructor(e){t.registerInstance(this,e),this.position="bottom"}showTooltip(e){e.target.nextElementSibling.style.visibility="visible",e.target.nextElementSibling.style.opacity="1"}hideTooltip(e){e.target.nextElementSibling.style.visibility="hidden",e.target.nextElementSibling.style.opacity="0"}render(){return t.h("div",{key:"1ba151bd1d0f2c80cc641832c986bab321accade",class:"tooltip-container"},t.h("span",{key:"7d432bbaa90b5e9aee4f1d8cae36e97bad47bc9e",class:"info-icon",tabindex:"0",onFocus:this.showTooltip.bind(this),onBlur:this.hideTooltip.bind(this)},t.h("slot",{key:"4f5014e68d07d5e70a873b389ef84b290017a8cd",name:"tooltip-icon"},"i")),t.h("span",{key:"8c903af137f14d51297e1ba212d6343d1ba0f2e5",class:`tooltip-content ${this.position}`},t.h("slot",{key:"aa87ef75acc364a667d3a5139e9683f404646e51",name:"tooltip-content"},"This is a help text.")))}get el(){return t.getElement(this)}};n.style=r;exports.info_icon=o;exports.tooltip_component=n;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { r as a, h as e } from "./index-db0c5017.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(t) {
|
|
6
|
-
a(this, t), this.width = "15", this.height = "15";
|
|
7
|
-
}
|
|
8
|
-
render() {
|
|
9
|
-
return e("div", { key: "527c232e2da580a89745cd8e3b51466eeeee2470", class: "wave" }, e("div", { key: "a0299e733c420254c9ad8de27f63d83ded38424b", class: "dot" }), e("div", { key: "7b2cb22812150eab1f41c53808e5c927b91dc918", class: "dot" }), e("div", { key: "e8b2baa7ab5c445bc6e91b06b0193727d797a343", 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-2b8437d6.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:"527c232e2da580a89745cd8e3b51466eeeee2470",class:"wave"},e.h("div",{key:"a0299e733c420254c9ad8de27f63d83ded38424b",class:"dot"}),e.h("div",{key:"7b2cb22812150eab1f41c53808e5c927b91dc918",class:"dot"}),e.h("div",{key:"e8b2baa7ab5c445bc6e91b06b0193727d797a343",class:"dot"}))}};t.style=n;exports.loading_icon=t;
|
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import { d as o } from "./utils-c00bdc3c-89ab163d.js";
|
|
2
|
-
import { X as u, Z as d } from "./index.es-2578c6a5-71441142.js";
|
|
3
|
-
import { a as f } from "./index-db0c5017.js";
|
|
4
|
-
class A {
|
|
5
|
-
constructor(t, e) {
|
|
6
|
-
this.nylasAuth = t, this.nylasAuthStore = e;
|
|
7
|
-
}
|
|
8
|
-
async validateSession() {
|
|
9
|
-
const t = await this.isAccessTokenValid();
|
|
10
|
-
if (!t)
|
|
11
|
-
this.logout();
|
|
12
|
-
else {
|
|
13
|
-
let e = await this.nylasAuth.getTokenInfo();
|
|
14
|
-
if (e) {
|
|
15
|
-
const a = Math.floor(Date.now() / 1e3);
|
|
16
|
-
if (e.expires_in && e.expires_in - a < 3e5 && (o("[NylasAuthConnectorMixin] Refreshing access token"), e = await this.nylasAuth.refreshAccessToken(), !e)) {
|
|
17
|
-
o("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out."), this.logout();
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
this.nylasAuthStore.state.tokenInfo = e;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
this.nylasAuthStore.state.isAuthenticated = t;
|
|
24
|
-
}
|
|
25
|
-
async isAuthenticated() {
|
|
26
|
-
return this.nylasAuth.isAuthenticated();
|
|
27
|
-
}
|
|
28
|
-
async getTokenInfo() {
|
|
29
|
-
return this.nylasAuth.getTokenInfo();
|
|
30
|
-
}
|
|
31
|
-
async isAccessTokenValid() {
|
|
32
|
-
return this.nylasAuth.isAccessTokenValid();
|
|
33
|
-
}
|
|
34
|
-
async logout() {
|
|
35
|
-
await this.nylasAuth.logout();
|
|
36
|
-
}
|
|
37
|
-
async getHostedAuthRedirectURL(t, e, s) {
|
|
38
|
-
return this.nylasAuth.getHostedAuthRedirectURL(t, e, s);
|
|
39
|
-
}
|
|
40
|
-
async manageHostedAuthCodeExchange(t) {
|
|
41
|
-
const s = new URL(t).searchParams.get("code");
|
|
42
|
-
if (s) {
|
|
43
|
-
const a = await this.nylasAuth.exchangeAuthCodeForTokenInfo(s);
|
|
44
|
-
if (a)
|
|
45
|
-
return this.nylasAuthStore.state.tokenInfo = a, this.nylasAuthStore.state.isAuthenticated = !0, a;
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
class T {
|
|
51
|
-
constructor(t, e, s) {
|
|
52
|
-
this.nylasAuth = t, this.nylasAuthStore = e, this.nylasMailboxStore = s;
|
|
53
|
-
}
|
|
54
|
-
async getMessages() {
|
|
55
|
-
var n;
|
|
56
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
57
|
-
throw new Error("Not authenticated");
|
|
58
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
59
|
-
throw new Error("Missing message:read-only scope");
|
|
60
|
-
this.nylasMailboxStore.state.state = "loading";
|
|
61
|
-
const t = this.nylasMailboxStore.state.messgeQueryParams, e = new URLSearchParams();
|
|
62
|
-
for (const i in t) {
|
|
63
|
-
const l = (n = t[i]) == null ? void 0 : n.toString();
|
|
64
|
-
l && e.append(i, l);
|
|
65
|
-
}
|
|
66
|
-
const s = `/v3/grants/me/messages?${e.toString()}`, a = await this.nylasAuth.nylasAPIRequest(s);
|
|
67
|
-
if (u(a))
|
|
68
|
-
throw new d(a.error);
|
|
69
|
-
const r = a.data;
|
|
70
|
-
return this.nylasMailboxStore.state.messages = r, this.nylasMailboxStore.state.state = "ready", r;
|
|
71
|
-
}
|
|
72
|
-
async getThreadMessages(t) {
|
|
73
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
74
|
-
throw new Error("Not authenticated");
|
|
75
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
76
|
-
throw new Error("Missing message:read-only scope");
|
|
77
|
-
const e = await this.nylasAuth.nylasAPIRequest(`/v3/grants/me/messages?thread_id=${t}&fields=include_headers`);
|
|
78
|
-
if (u(e))
|
|
79
|
-
throw new d(e.error);
|
|
80
|
-
const s = e.data;
|
|
81
|
-
return this.nylasMailboxStore.state.messages = s, s;
|
|
82
|
-
}
|
|
83
|
-
downloadMessageAttachments(t) {
|
|
84
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
85
|
-
throw new Error("Not authenticated");
|
|
86
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
87
|
-
throw new Error("Missing message:read-only scope");
|
|
88
|
-
const e = [], s = t.attachments || [];
|
|
89
|
-
for (const a of s) {
|
|
90
|
-
const r = this.nylasAuth.nylasDownloadFileRequest(`/v3/grants/me/attachments/${a.id}?message_id=${t.id}`);
|
|
91
|
-
e.push(r);
|
|
92
|
-
}
|
|
93
|
-
return e;
|
|
94
|
-
}
|
|
95
|
-
async summarizeText(t) {
|
|
96
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
97
|
-
throw new Error("Not authenticated");
|
|
98
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
99
|
-
throw new Error("Missing message:read-only scope");
|
|
100
|
-
const e = await this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/summarize", "POST", {
|
|
101
|
-
message: {
|
|
102
|
-
body: t
|
|
103
|
-
}
|
|
104
|
-
}, !0, this.nylasAuth.config.elementsApiUri);
|
|
105
|
-
if (u(e))
|
|
106
|
-
throw new d(e.error);
|
|
107
|
-
return e.data.summary;
|
|
108
|
-
}
|
|
109
|
-
async textToSpeech(t, e) {
|
|
110
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
111
|
-
throw new Error("Not authenticated");
|
|
112
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
113
|
-
throw new Error("Missing message:read-only scope");
|
|
114
|
-
return this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/tts", "POST", {
|
|
115
|
-
text: t
|
|
116
|
-
}, !1, this.nylasAuth.config.elementsApiUri, {
|
|
117
|
-
...e ? { signal: e == null ? void 0 : e.signal } : {}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
class x {
|
|
122
|
-
constructor(t, e, s, a) {
|
|
123
|
-
this.nylasAuth = t, this.nylasAuthStore = e, this.nylasMailboxStore = s, this.router = a;
|
|
124
|
-
}
|
|
125
|
-
async getThreads(t, e = "overwrite", s = !0) {
|
|
126
|
-
var y;
|
|
127
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
128
|
-
throw new Error("Not authenticated");
|
|
129
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
130
|
-
throw new Error("Missing thread:read-only scope");
|
|
131
|
-
s && (this.nylasMailboxStore.state.state = "loading");
|
|
132
|
-
const a = t || this.nylasMailboxStore.state.threadsQueryParams, r = new URLSearchParams();
|
|
133
|
-
for (const g in a) {
|
|
134
|
-
const c = (y = a[g]) == null ? void 0 : y.toString();
|
|
135
|
-
typeof c < "u" && c !== null && r.append(g, c);
|
|
136
|
-
}
|
|
137
|
-
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;
|
|
138
|
-
const n = `/v3/grants/me/threads?${r.toString()}`, i = await this.nylasAuth.nylasAPIRequest(n);
|
|
139
|
-
if (u(i))
|
|
140
|
-
throw new d(i.error);
|
|
141
|
-
const l = i.data;
|
|
142
|
-
switch (e) {
|
|
143
|
-
case "prepend":
|
|
144
|
-
this.nylasMailboxStore.state.threads = [...l, ...this.nylasMailboxStore.state.threads];
|
|
145
|
-
break;
|
|
146
|
-
case "append":
|
|
147
|
-
this.nylasMailboxStore.state.threads = [...this.nylasMailboxStore.state.threads, ...l];
|
|
148
|
-
break;
|
|
149
|
-
case "overwrite":
|
|
150
|
-
default:
|
|
151
|
-
this.nylasMailboxStore.state.threads = l;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
return i.next_cursor ? this.nylasMailboxStore.state.nextThreadPageToken = i.next_cursor : this.nylasMailboxStore.state.nextThreadPageToken = null, s && (this.nylasMailboxStore.state.state = "ready"), l;
|
|
155
|
-
}
|
|
156
|
-
async getThread(t) {
|
|
157
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
158
|
-
throw new Error("Not authenticated");
|
|
159
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
160
|
-
throw new Error("Missing thread:read-only scope");
|
|
161
|
-
const e = this.nylasMailboxStore.state.threads.find((n) => n.id === t);
|
|
162
|
-
if (e)
|
|
163
|
-
return e;
|
|
164
|
-
this.nylasMailboxStore.state.state = "loading";
|
|
165
|
-
const s = `/v3/grants/me/threads/${t}`, a = await this.nylasAuth.nylasAPIRequest(s);
|
|
166
|
-
if (u(a))
|
|
167
|
-
throw new d(a.error);
|
|
168
|
-
const r = a.data;
|
|
169
|
-
return this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map((n) => n.id === r.id ? r : n), this.nylasMailboxStore.state.state = "ready", r;
|
|
170
|
-
}
|
|
171
|
-
async nextThreadPage(t = "overwrite", e = !0) {
|
|
172
|
-
if (!this.nylasMailboxStore.state.nextThreadPageToken)
|
|
173
|
-
throw new Error("No next page token");
|
|
174
|
-
this.nylasMailboxStore.state.previousThreadPageTokens = Array.from(/* @__PURE__ */ new Set([...this.nylasMailboxStore.state.previousThreadPageTokens, this.nylasMailboxStore.state.threadsQueryParams.page_token ?? null]));
|
|
175
|
-
const s = this.nylasMailboxStore.state.nextThreadPageToken;
|
|
176
|
-
return this.getThreads({
|
|
177
|
-
...this.nylasMailboxStore.state.threadsQueryParams,
|
|
178
|
-
page_token: s
|
|
179
|
-
}, t, e);
|
|
180
|
-
}
|
|
181
|
-
async previousThreadPage(t = "overwrite", e = !0) {
|
|
182
|
-
if (!this.nylasMailboxStore.state.previousThreadPageTokens.length)
|
|
183
|
-
throw new Error("No previous page token");
|
|
184
|
-
const s = [...this.nylasMailboxStore.state.previousThreadPageTokens], a = s.pop();
|
|
185
|
-
return this.nylasMailboxStore.state.previousThreadPageTokens = s, this.getThreads({
|
|
186
|
-
...this.nylasMailboxStore.state.threadsQueryParams,
|
|
187
|
-
page_token: a ?? void 0
|
|
188
|
-
}, t, e);
|
|
189
|
-
}
|
|
190
|
-
updateThreadQueryParams(t) {
|
|
191
|
-
this.nylasMailboxStore.state.threadsQueryParams = {
|
|
192
|
-
...this.nylasMailboxStore.state.threadsQueryParams,
|
|
193
|
-
...t
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
back() {
|
|
197
|
-
this.router.navigate("/", !0), this.nylasMailboxStore.state.selectedThread = null;
|
|
198
|
-
}
|
|
199
|
-
unSelectThread() {
|
|
200
|
-
this.nylasMailboxStore.state.selectedThread = null;
|
|
201
|
-
}
|
|
202
|
-
async selectThread(t) {
|
|
203
|
-
this.router.navigate(`/thread/${t.id}`, !0), this.nylasMailboxStore.state.selectedThread = t, t.unread && this.markThreadAsRead(t).catch((e) => {
|
|
204
|
-
o("Error marking thread as read", e);
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
async markThreadAsRead(t) {
|
|
208
|
-
return this.updateThread(t, { unread: !1 });
|
|
209
|
-
}
|
|
210
|
-
async updateThread(t, e) {
|
|
211
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
212
|
-
throw new Error("Not authenticated");
|
|
213
|
-
if (!this.nylasAuth.hasScopeByType("email", "modify"))
|
|
214
|
-
throw new Error("Missing thread:modify scope");
|
|
215
|
-
const s = `/v3/grants/me/threads/${t.id}`, a = await this.nylasAuth.nylasAPIRequest(s, "PUT", e);
|
|
216
|
-
if (u(a))
|
|
217
|
-
throw new d(a.error);
|
|
218
|
-
const r = a.data;
|
|
219
|
-
return this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map((n) => n.id === r.id ? r : n), this.nylasMailboxStore.state.selectedThread = r, r;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
class P {
|
|
223
|
-
constructor(t, e, s) {
|
|
224
|
-
this.nylasAuth = t, this.nylasAuthStore = e, this.nylasMailboxStore = s;
|
|
225
|
-
}
|
|
226
|
-
async getFolders() {
|
|
227
|
-
if (!this.nylasAuthStore.state.isAuthenticated)
|
|
228
|
-
throw new Error("Not authenticated");
|
|
229
|
-
if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
|
|
230
|
-
throw new Error("Missing thread:read-only scope");
|
|
231
|
-
this.nylasMailboxStore.state.state = "loading";
|
|
232
|
-
const t = "/v3/grants/me/folders", e = await this.nylasAuth.nylasAPIRequest(t);
|
|
233
|
-
if (u(e))
|
|
234
|
-
throw new d(e.error);
|
|
235
|
-
const s = e.data;
|
|
236
|
-
return this.nylasMailboxStore.state.folders = s, this.nylasMailboxStore.state.state = "ready", s;
|
|
237
|
-
}
|
|
238
|
-
async selectFolder(t) {
|
|
239
|
-
this.nylasMailboxStore.state.threadsQueryParams = {
|
|
240
|
-
in: t.id,
|
|
241
|
-
...this.nylasMailboxStore.state.threadsQueryParams || {}
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
class m extends Event {
|
|
246
|
-
constructor(t, e) {
|
|
247
|
-
super(t, e), this.oldURL = e.oldURL, this.newURL = e.newURL;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
class b {
|
|
251
|
-
constructor() {
|
|
252
|
-
this.routeChangeListeners = [], o("HashRouter constructor");
|
|
253
|
-
}
|
|
254
|
-
destroy() {
|
|
255
|
-
o("HashRouter destroy"), window.removeEventListener("hashchange", this.onRouteChange.bind(this));
|
|
256
|
-
}
|
|
257
|
-
init() {
|
|
258
|
-
if (o("HashRouter init"), window.addEventListener("hashchange", this.onRouteChange.bind(this)), typeof HashChangeEvent < "u") {
|
|
259
|
-
const t = new HashChangeEvent("hashchange", { oldURL: "", newURL: window.location.href });
|
|
260
|
-
this.onRouteChange(t);
|
|
261
|
-
} else {
|
|
262
|
-
const t = new m("hashchange", { oldURL: "", newURL: window.location.href });
|
|
263
|
-
this.onRouteChange(t);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
addRouteChangeListener(t, e) {
|
|
267
|
-
o("HashRouter addRouteChangeListener"), this.routeChangeListeners.push([t, e]);
|
|
268
|
-
}
|
|
269
|
-
navigate(t, e) {
|
|
270
|
-
if (o("HashRouter navigate"), e)
|
|
271
|
-
return window.history.pushState(null, "", `#${t}`);
|
|
272
|
-
window.location.hash = t;
|
|
273
|
-
}
|
|
274
|
-
setRoute(t) {
|
|
275
|
-
o("HashRouter setRoute"), window.location.hash = t;
|
|
276
|
-
}
|
|
277
|
-
matchRoute(t, e) {
|
|
278
|
-
const s = t.split("/"), a = e.split("/");
|
|
279
|
-
if (o(`HashRouter matchRoute route=${t} path=${e}`, { routeParts: s, pathParts: a }), s[1] === "" && a[0] === "")
|
|
280
|
-
return !0;
|
|
281
|
-
if (s.length !== a.length)
|
|
282
|
-
return !1;
|
|
283
|
-
for (let r = 0; r < s.length; r++) {
|
|
284
|
-
const n = s[r], i = a[r];
|
|
285
|
-
if (!n.startsWith(":") && n !== i)
|
|
286
|
-
return !1;
|
|
287
|
-
}
|
|
288
|
-
return !0;
|
|
289
|
-
}
|
|
290
|
-
getRouteParams(t) {
|
|
291
|
-
o("HashRouter getRouteParams");
|
|
292
|
-
const e = {}, s = t.split("/"), a = window.location.hash.split("/");
|
|
293
|
-
return s.forEach((r, n) => {
|
|
294
|
-
if (r.startsWith(":")) {
|
|
295
|
-
const i = r.substring(1);
|
|
296
|
-
e[i] = a[n];
|
|
297
|
-
}
|
|
298
|
-
}), e;
|
|
299
|
-
}
|
|
300
|
-
getRouteWithParams(t, e) {
|
|
301
|
-
o("HashRouter getRouteWithParams");
|
|
302
|
-
let s = t;
|
|
303
|
-
return Object.keys(e).forEach((a) => {
|
|
304
|
-
s = s.replace(`:${a}`, e[a]);
|
|
305
|
-
}), s;
|
|
306
|
-
}
|
|
307
|
-
getRoute() {
|
|
308
|
-
return o("HashRouter getRoute"), window.location.hash;
|
|
309
|
-
}
|
|
310
|
-
onRouteChange(t) {
|
|
311
|
-
this.routeChangeListeners.forEach(async ([e, s]) => {
|
|
312
|
-
const a = t.newURL.indexOf("#") === -1 ? "" : t.newURL.substring(t.newURL.indexOf("#") + 1);
|
|
313
|
-
if (o(`HashRouter onRouteChange route=${e} path=${a}`, { event: t }), !this.matchRoute(e, a)) {
|
|
314
|
-
o(`HashRouter onRouteChange route=${e} path=${a} does not match`);
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
const r = this.getRouteParams(e);
|
|
318
|
-
await s(e, a, r);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
getBasePath() {
|
|
322
|
-
return o("HashRouter getBasePath"), "";
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
function M(h = {}) {
|
|
326
|
-
const t = {
|
|
327
|
-
isAuthenticated: !1,
|
|
328
|
-
tokenInfo: null,
|
|
329
|
-
state: "ready",
|
|
330
|
-
...h
|
|
331
|
-
}, e = f(t);
|
|
332
|
-
return e.reset = () => {
|
|
333
|
-
for (const s in t) {
|
|
334
|
-
const a = t[s];
|
|
335
|
-
e.set(s, a);
|
|
336
|
-
}
|
|
337
|
-
}, e;
|
|
338
|
-
}
|
|
339
|
-
function R(h = {}) {
|
|
340
|
-
const t = {
|
|
341
|
-
state: "ready",
|
|
342
|
-
messages: [],
|
|
343
|
-
threads: [],
|
|
344
|
-
folders: [],
|
|
345
|
-
selectedThread: null,
|
|
346
|
-
nextThreadPageToken: null,
|
|
347
|
-
previousThreadPageTokens: [],
|
|
348
|
-
searchQuery: "",
|
|
349
|
-
hasNextThreadPage: !1,
|
|
350
|
-
hasPreviousThreadPage: !1,
|
|
351
|
-
selectedFolder: "inbox",
|
|
352
|
-
threadsQueryParams: {
|
|
353
|
-
in: "inbox"
|
|
354
|
-
},
|
|
355
|
-
messgeQueryParams: {
|
|
356
|
-
fields: "include_headers"
|
|
357
|
-
},
|
|
358
|
-
...h
|
|
359
|
-
}, e = f({ ...t });
|
|
360
|
-
return e.onChange("nextThreadPageToken", (s) => {
|
|
361
|
-
e.set("hasNextThreadPage", s !== null);
|
|
362
|
-
}), e.onChange("previousThreadPageTokens", (s) => {
|
|
363
|
-
e.set("hasPreviousThreadPage", s.length > 0);
|
|
364
|
-
}), e.onChange("threadsQueryParams", (s) => {
|
|
365
|
-
e.set("selectedFolder", s.in || "inbox"), e.set("searchQuery", s.search_query_native || "");
|
|
366
|
-
}), e.reset = () => {
|
|
367
|
-
for (const s in t) {
|
|
368
|
-
const a = t[s];
|
|
369
|
-
e.set(s, a);
|
|
370
|
-
}
|
|
371
|
-
}, e;
|
|
372
|
-
}
|
|
373
|
-
export {
|
|
374
|
-
M as C,
|
|
375
|
-
b as H,
|
|
376
|
-
A as N,
|
|
377
|
-
R as a,
|
|
378
|
-
x as b,
|
|
379
|
-
T as c,
|
|
380
|
-
P as d
|
|
381
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./utils-c00bdc3c-94b9c3b6.cjs"),i=require("./index.es-2578c6a5-098d48d0.cjs"),g=require("./index-2b8437d6.cjs");class f{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 w{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 m{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 p{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 S extends Event{constructor(t,e){super(t,e),this.oldURL=e.oldURL,this.newURL=e.newURL}}class A{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 S("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 x(l={}){const t={isAuthenticated:!1,tokenInfo:null,state:"ready",...l},e=g.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=g.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=x;exports.CreateNylasMailboxStore=T;exports.HashRouter=A;exports.NylasAuthConnector=f;exports.NylasFoldersConnector=p;exports.NylasMessagesConnector=w;exports.NylasThreadsConnector=m;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { r as y, h as i, H as _, g as f } from "./index-db0c5017.js";
|
|
2
|
-
import { R as b } from "./register-component-dc659dc3-e43e8fae.js";
|
|
3
|
-
import { d as n } from "./utils-c00bdc3c-89ab163d.js";
|
|
4
|
-
import "react";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
import "./_commonjsHelpers-57e89916-af061c86.js";
|
|
7
|
-
const u = ':host{display:block;margin:1rem;--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}.nylas-additional-participants__title{color:var(--nylas-base-nylas-base-900-aaa, #101323);font-size:16px;font-style:normal;font-weight:600;line-height:20px;margin:0;text-align:left}.nylas-additional-participants__subtitle{color:var(--nylas-base-600);font-size:14px;font-style:normal;font-weight:400;line-height:20px;margin:0.25rem 0px 0px;text-align:left}.nylas-additional-participants__content{padding:1rem;display:flex;flex-direction:column;gap:1rem}.nylas-additional-participants__input_group{padding-top:8px;display:flex;flex-direction:column;gap:4px}.nylas-additional-participants__input_group label{display:flex;align-items:center;color:var(--nylas-base-800);font-size:14px;font-style:normal;font-weight:400;line-height:150%}.nylas-additional-participants__input_wrapper{display:flex;border-width:1;border-radius:8px;border:1px solid var(--nylas-base-300)}.nylas-additional-participants__input_wrapper button{padding:12px;border:none;background:none;cursor:pointer}.nylas-additional-participants__input_wrapper button:hover,.nylas-additional-participants__input_wrapper button:active{color:var(--nylas-primary)}.nylas-additional-participants__input_wrapper_organizer{background:var(--nylas-base-50)}.nylas-additional-participants__input{flex:1;padding:12px 16px;border-right:1px solid var(--nylas-base-300)}.nylas-additional-participants__input input{border:none;outline:none;background:none;width:100%}.nylas-additional-participants__add{padding:12px;display:flex;align-items:center;border:none;background:none;cursor:pointer}.nylas-additional-participants__add span{padding:0 8px;font-size:16px;font-style:normal;font-weight:500}.nylas-additional-participants__add:hover,.nylas-additional-participants__add:active{color:var(--nylas-primary)}', m = u;
|
|
8
|
-
var h = function(a, t, e, r) {
|
|
9
|
-
var l = arguments.length, s = l < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, e) : r, p;
|
|
10
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
11
|
-
s = Reflect.decorate(a, t, e, r);
|
|
12
|
-
else
|
|
13
|
-
for (var o = a.length - 1; o >= 0; o--)
|
|
14
|
-
(p = a[o]) && (s = (l < 3 ? p(s) : l > 3 ? p(t, e, s) : p(t, e)) || s);
|
|
15
|
-
return l > 3 && s && Object.defineProperty(t, e, s), s;
|
|
16
|
-
}, d = function(a, t) {
|
|
17
|
-
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
18
|
-
return Reflect.metadata(a, t);
|
|
19
|
-
};
|
|
20
|
-
const c = class {
|
|
21
|
-
constructor(a) {
|
|
22
|
-
y(this, a), a.$hostElement$["s-ei"] ? this.internals = a.$hostElement$["s-ei"] : (this.internals = a.$hostElement$.attachInternals(), a.$hostElement$["s-ei"] = this.internals), this.name = "participants", this.eventParticipants = void 0, this.participants = this.eventParticipants ?? [], this.participantsValid = !0;
|
|
23
|
-
}
|
|
24
|
-
elementNameChangedHandler(a) {
|
|
25
|
-
n("nylas-additional-participants", "elementNameChangedHandler", a), this.host.setAttribute("name", a);
|
|
26
|
-
}
|
|
27
|
-
connectedCallback() {
|
|
28
|
-
n("nylas-additional-participants", "connectedCallback");
|
|
29
|
-
}
|
|
30
|
-
componentWillLoad() {
|
|
31
|
-
n("nylas-additional-participants", "componentWillLoad"), this.host.setAttribute("name", this.name);
|
|
32
|
-
}
|
|
33
|
-
componentDidLoad() {
|
|
34
|
-
n("nylas-additional-participants", "componentDidLoad"), this.internals.setFormValue(JSON.stringify(this.participants), "participants");
|
|
35
|
-
}
|
|
36
|
-
disconnectedCallback() {
|
|
37
|
-
n("nylas-additional-participants", "disconnectedCallback");
|
|
38
|
-
}
|
|
39
|
-
onParticipantChange(a, t) {
|
|
40
|
-
n("nylas-additional-participants", "onParticipantChange"), this.participants[t].email = a.target.value, this.internals.setFormValue(JSON.stringify(this.participants), "participants");
|
|
41
|
-
}
|
|
42
|
-
addParticipant() {
|
|
43
|
-
n("nylas-additional-participants", "addParticipant"), this.participants = [...this.participants, { email: "", is_organizer: !1, availability: { calendar_ids: ["primary"] } }], this.internals.setFormValue(JSON.stringify(this.participants), "participants");
|
|
44
|
-
}
|
|
45
|
-
removeParticipant(a) {
|
|
46
|
-
n("nylas-additional-participants", "addParticipant"), this.participants = this.participants.filter((t) => t.email !== a), this.internals.setFormValue(JSON.stringify(this.participants), "participants");
|
|
47
|
-
}
|
|
48
|
-
validate(a, t) {
|
|
49
|
-
n("nylas-additional-participants", "validate");
|
|
50
|
-
const r = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(a).toLowerCase());
|
|
51
|
-
this.participants[t].is_valid = r, this.internals.setFormValue(JSON.stringify(this.participants), "participants");
|
|
52
|
-
}
|
|
53
|
-
render() {
|
|
54
|
-
return i(_, { key: "cc6d22c88c41ea406313ab95ec7f90a38704fc5b" }, i("nylas-form-card", { key: "033b0b3497b62ee3a17ee8f480a332d6103f143e" }, i("h3", { key: "e88c9a1e05adda093bb0b1a1a85f7c3f36d69684", slot: "header-title", class: "nylas-additional-participants__title", part: "nap__title" }, "Additional participants"), i("p", { key: "aab3da584eecd3437e7d93fc726d1e8718bd066c", slot: "header-subtitle", class: "nylas-additional-participants__subtitle", part: "nap__subtitle" }, "Add anyone else who would be joining for this event."), i("div", { key: "0a4d920d8ea788eca41e2fb46b532df4614925b6", slot: "content", class: "nylas-additional-participants__content" }, i("div", { key: "9aa1c1e851de4e73b97c022f7eed52c91b8c826f" }, this.participants.map((a, t) => i("div", { class: "nylas-additional-participants__input_group", part: "nap__input_group" }, i("label", null, a.is_organizer ? "Organizer" : `Participant ${t}`), i("div", { part: "nap__input_wrapper", class: `nylas-additional-participants__input_wrapper ${a.is_organizer && "nylas-additional-participants__input_wrapper_organizer"} ${a.is_valid === !1 && "nylas-additional-participants__input_wrapper_invalid"}` }, i("div", { class: "nylas-additional-participants__input", part: "nap__input" }, i("input", { type: "text", value: a.email, onInput: (e) => {
|
|
55
|
-
this.onParticipantChange(e, t);
|
|
56
|
-
}, readOnly: a.is_organizer, onBlur: () => this.validate(a.email, t) })), !a.is_organizer && i("button", { onClick: () => this.removeParticipant(a.email), part: "nap__remove-participant" }, i("close-icon", null)))))))));
|
|
57
|
-
}
|
|
58
|
-
static get formAssociated() {
|
|
59
|
-
return !0;
|
|
60
|
-
}
|
|
61
|
-
get host() {
|
|
62
|
-
return f(this);
|
|
63
|
-
}
|
|
64
|
-
static get watchers() {
|
|
65
|
-
return {
|
|
66
|
-
name: ["elementNameChangedHandler"]
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
h([
|
|
71
|
-
b({
|
|
72
|
-
name: "nylas-additional-participants",
|
|
73
|
-
eventToProps: {},
|
|
74
|
-
fireRegisterEvent: !0
|
|
75
|
-
}),
|
|
76
|
-
d("design:type", Function),
|
|
77
|
-
d("design:paramtypes", []),
|
|
78
|
-
d("design:returntype", void 0)
|
|
79
|
-
], c.prototype, "render", null);
|
|
80
|
-
c.style = m;
|
|
81
|
-
export {
|
|
82
|
-
c as nylas_additional_participants
|
|
83
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-2b8437d6.cjs"),y=require("./register-component-dc659dc3-fb85ee68.cjs"),n=require("./utils-c00bdc3c-94b9c3b6.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");const u=':host{display:block;margin:1rem;--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}.nylas-additional-participants__title{color:var(--nylas-base-nylas-base-900-aaa, #101323);font-size:16px;font-style:normal;font-weight:600;line-height:20px;margin:0;text-align:left}.nylas-additional-participants__subtitle{color:var(--nylas-base-600);font-size:14px;font-style:normal;font-weight:400;line-height:20px;margin:0.25rem 0px 0px;text-align:left}.nylas-additional-participants__content{padding:1rem;display:flex;flex-direction:column;gap:1rem}.nylas-additional-participants__input_group{padding-top:8px;display:flex;flex-direction:column;gap:4px}.nylas-additional-participants__input_group label{display:flex;align-items:center;color:var(--nylas-base-800);font-size:14px;font-style:normal;font-weight:400;line-height:150%}.nylas-additional-participants__input_wrapper{display:flex;border-width:1;border-radius:8px;border:1px solid var(--nylas-base-300)}.nylas-additional-participants__input_wrapper button{padding:12px;border:none;background:none;cursor:pointer}.nylas-additional-participants__input_wrapper button:hover,.nylas-additional-participants__input_wrapper button:active{color:var(--nylas-primary)}.nylas-additional-participants__input_wrapper_organizer{background:var(--nylas-base-50)}.nylas-additional-participants__input{flex:1;padding:12px 16px;border-right:1px solid var(--nylas-base-300)}.nylas-additional-participants__input input{border:none;outline:none;background:none;width:100%}.nylas-additional-participants__add{padding:12px;display:flex;align-items:center;border:none;background:none;cursor:pointer}.nylas-additional-participants__add span{padding:0 8px;font-size:16px;font-style:normal;font-weight:500}.nylas-additional-participants__add:hover,.nylas-additional-participants__add:active{color:var(--nylas-primary)}',b=u;var _=function(a,t,e,r){var l=arguments.length,s=l<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(a,t,e,r);else for(var d=a.length-1;d>=0;d--)(p=a[d])&&(s=(l<3?p(s):l>3?p(t,e,s):p(t,e))||s);return l>3&&s&&Object.defineProperty(t,e,s),s},o=function(a,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(a,t)};const c=class{constructor(a){i.registerInstance(this,a),a.$hostElement$["s-ei"]?this.internals=a.$hostElement$["s-ei"]:(this.internals=a.$hostElement$.attachInternals(),a.$hostElement$["s-ei"]=this.internals),this.name="participants",this.eventParticipants=void 0,this.participants=this.eventParticipants??[],this.participantsValid=!0}elementNameChangedHandler(a){n.debug("nylas-additional-participants","elementNameChangedHandler",a),this.host.setAttribute("name",a)}connectedCallback(){n.debug("nylas-additional-participants","connectedCallback")}componentWillLoad(){n.debug("nylas-additional-participants","componentWillLoad"),this.host.setAttribute("name",this.name)}componentDidLoad(){n.debug("nylas-additional-participants","componentDidLoad"),this.internals.setFormValue(JSON.stringify(this.participants),"participants")}disconnectedCallback(){n.debug("nylas-additional-participants","disconnectedCallback")}onParticipantChange(a,t){n.debug("nylas-additional-participants","onParticipantChange"),this.participants[t].email=a.target.value,this.internals.setFormValue(JSON.stringify(this.participants),"participants")}addParticipant(){n.debug("nylas-additional-participants","addParticipant"),this.participants=[...this.participants,{email:"",is_organizer:!1,availability:{calendar_ids:["primary"]}}],this.internals.setFormValue(JSON.stringify(this.participants),"participants")}removeParticipant(a){n.debug("nylas-additional-participants","addParticipant"),this.participants=this.participants.filter(t=>t.email!==a),this.internals.setFormValue(JSON.stringify(this.participants),"participants")}validate(a,t){n.debug("nylas-additional-participants","validate");const r=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(a).toLowerCase());this.participants[t].is_valid=r,this.internals.setFormValue(JSON.stringify(this.participants),"participants")}render(){return i.h(i.Host,{key:"cc6d22c88c41ea406313ab95ec7f90a38704fc5b"},i.h("nylas-form-card",{key:"033b0b3497b62ee3a17ee8f480a332d6103f143e"},i.h("h3",{key:"e88c9a1e05adda093bb0b1a1a85f7c3f36d69684",slot:"header-title",class:"nylas-additional-participants__title",part:"nap__title"},"Additional participants"),i.h("p",{key:"aab3da584eecd3437e7d93fc726d1e8718bd066c",slot:"header-subtitle",class:"nylas-additional-participants__subtitle",part:"nap__subtitle"},"Add anyone else who would be joining for this event."),i.h("div",{key:"0a4d920d8ea788eca41e2fb46b532df4614925b6",slot:"content",class:"nylas-additional-participants__content"},i.h("div",{key:"9aa1c1e851de4e73b97c022f7eed52c91b8c826f"},this.participants.map((a,t)=>i.h("div",{class:"nylas-additional-participants__input_group",part:"nap__input_group"},i.h("label",null,a.is_organizer?"Organizer":`Participant ${t}`),i.h("div",{part:"nap__input_wrapper",class:`nylas-additional-participants__input_wrapper ${a.is_organizer&&"nylas-additional-participants__input_wrapper_organizer"} ${a.is_valid===!1&&"nylas-additional-participants__input_wrapper_invalid"}`},i.h("div",{class:"nylas-additional-participants__input",part:"nap__input"},i.h("input",{type:"text",value:a.email,onInput:e=>{this.onParticipantChange(e,t)},readOnly:a.is_organizer,onBlur:()=>this.validate(a.email,t)})),!a.is_organizer&&i.h("button",{onClick:()=>this.removeParticipant(a.email),part:"nap__remove-participant"},i.h("close-icon",null)))))))))}static get formAssociated(){return!0}get host(){return i.getElement(this)}static get watchers(){return{name:["elementNameChangedHandler"]}}};_([y.RegisterComponent({name:"nylas-additional-participants",eventToProps:{},fireRegisterEvent:!0}),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",void 0)],c.prototype,"render",null);c.style=b;exports.nylas_additional_participants=c;
|