@nylas/react 1.1.0-canary.7 → 1.1.0-canary.8

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.
Files changed (96) hide show
  1. package/dist/add-circle-icon_22.entry-080abc71.cjs +1 -0
  2. package/dist/add-circle-icon_22.entry-bda9be31.js +1818 -0
  3. package/dist/archive-icon_7.entry-ca20da59.cjs +1 -0
  4. package/dist/archive-icon_7.entry-e2954750.js +75 -0
  5. package/dist/arrow-icon.entry-03a85113.js +15 -0
  6. package/dist/arrow-icon.entry-548b027e.cjs +1 -0
  7. package/dist/bold-icon_3.entry-70ffa7f0.js +35 -0
  8. package/dist/bold-icon_3.entry-9a7b1869.cjs +1 -0
  9. package/dist/calendar-cancel-icon.entry-45388fdc.cjs +1 -0
  10. package/dist/calendar-cancel-icon.entry-6bbc119f.js +15 -0
  11. package/dist/calendar-check-icon_2.entry-6628456c.cjs +1 -0
  12. package/dist/calendar-check-icon_2.entry-f633f7a6.js +25 -0
  13. package/dist/calendar-icon.entry-379b1fa1.cjs +1 -0
  14. package/dist/calendar-icon.entry-62b82c27.js +15 -0
  15. package/dist/chevron-icon_3.entry-74425e1f.js +117 -0
  16. package/dist/chevron-icon_3.entry-7ff803ad.cjs +1 -0
  17. package/dist/close-icon.entry-18e140ed.cjs +1 -0
  18. package/dist/close-icon.entry-6a8ea4a7.js +15 -0
  19. package/dist/constants-f34b9c6e-95a17764.js +3749 -0
  20. package/dist/constants-f34b9c6e-e7137e51.cjs +15 -0
  21. package/dist/document-refresh-icon.entry-32c75418.js +15 -0
  22. package/dist/document-refresh-icon.entry-f15f795a.cjs +1 -0
  23. package/dist/{elements-dc5b338e-96e197ca.cjs → elements-dc5b338e-1f23530f.cjs} +1 -1
  24. package/dist/{elements-dc5b338e-6078b875.js → elements-dc5b338e-62fe1cf3.js} +1 -1
  25. package/dist/{focus-visible-e8093c16-ab01d60a.js → focus-visible-e8093c16-1f664070.js} +1 -1
  26. package/dist/{focus-visible-e8093c16-018ffd63.cjs → focus-visible-e8093c16-f0f05815.cjs} +1 -1
  27. package/dist/forward-icon_6.entry-7fab04d7.js +953 -0
  28. package/dist/forward-icon_6.entry-ef5e2e0f.cjs +3 -0
  29. package/dist/globe-icon.entry-398a9826.cjs +1 -0
  30. package/dist/globe-icon.entry-b8e1efae.js +15 -0
  31. package/dist/google-logo-icon_4.entry-38d5c2f2.cjs +1 -0
  32. package/dist/google-logo-icon_4.entry-5eca9538.js +381 -0
  33. package/dist/index-93c50de4.cjs +37 -0
  34. package/dist/{index-1fd24ccf.js → index-f93f6948.js} +1586 -1162
  35. package/dist/index.es-df564f87-b773d34f.js +3137 -0
  36. package/dist/index.es-df564f87-e4a4092a.cjs +7 -0
  37. package/dist/info-icon_2.entry-2eb70f49.cjs +1 -0
  38. package/dist/info-icon_2.entry-6bbfa6dc.js +34 -0
  39. package/dist/loading-icon.entry-b563b2e6.js +15 -0
  40. package/dist/loading-icon.entry-fb04b893.cjs +1 -0
  41. package/dist/mailbox-store-69c5c5f6-631eddb5.cjs +1 -0
  42. package/dist/mailbox-store-69c5c5f6-8ab4670b.js +380 -0
  43. package/dist/nylas-additional-participants.entry-33a45477.cjs +1 -0
  44. package/dist/nylas-additional-participants.entry-4b214308.js +81 -0
  45. package/dist/nylas-booked-event-card_10.entry-3e225025.cjs +1 -0
  46. package/dist/nylas-booked-event-card_10.entry-e93bc290.js +782 -0
  47. package/dist/nylas-form-card.entry-0748fdd5.js +54 -0
  48. package/dist/nylas-form-card.entry-eb3607bc.cjs +1 -0
  49. package/dist/nylas-if-state.entry-276d61ad.cjs +1 -0
  50. package/dist/nylas-if-state.entry-f8abd025.js +94 -0
  51. package/dist/nylas-list-folders.entry-78cc680e.js +120 -0
  52. package/dist/nylas-list-folders.entry-afe02f0e.cjs +1 -0
  53. package/dist/nylas-list-threads.entry-217088de.js +70 -0
  54. package/dist/nylas-list-threads.entry-6395c12f.cjs +1 -0
  55. package/dist/nylas-login.entry-e4d57589.js +73 -0
  56. package/dist/nylas-login.entry-ec81e21b.cjs +1 -0
  57. package/dist/nylas-mailbox-pagination.entry-069673aa.js +101 -0
  58. package/dist/nylas-mailbox-pagination.entry-d4d929f1.cjs +1 -0
  59. package/dist/nylas-mailbox-toolbar-button.entry-03c5f5c8.js +82 -0
  60. package/dist/nylas-mailbox-toolbar-button.entry-2b9e4431.cjs +1 -0
  61. package/dist/nylas-mailbox.entry-1342178d.cjs +1 -0
  62. package/dist/nylas-mailbox.entry-7e6b4791.js +134 -0
  63. package/dist/nylas-provider.entry-0ae8e70a.cjs +1 -0
  64. package/dist/nylas-provider.entry-498a7be9.js +145 -0
  65. package/dist/nylas-scheduler-editor.entry-4de2bb97.js +2275 -0
  66. package/dist/nylas-scheduler-editor.entry-72c91b7d.cjs +7 -0
  67. package/dist/nylas-scheduling.entry-1a004916.cjs +1 -0
  68. package/dist/nylas-scheduling.entry-4e18ab43.js +235 -0
  69. package/dist/nylas-threads-refresh.entry-d020c89e.cjs +1 -0
  70. package/dist/nylas-threads-refresh.entry-fc2d8028.js +74 -0
  71. package/dist/nylas-threads-search.entry-0abcbc10.cjs +1 -0
  72. package/dist/nylas-threads-search.entry-f92f7e30.js +69 -0
  73. package/dist/nylas-view-thread.entry-2f1474cf.js +203 -0
  74. package/dist/nylas-view-thread.entry-56080c89.cjs +1 -0
  75. package/dist/people-icon.entry-431e5044.cjs +1 -0
  76. package/dist/people-icon.entry-b4778e15.js +15 -0
  77. package/dist/play-icon_2.entry-24ffa01f.js +25 -0
  78. package/dist/play-icon_2.entry-f97db395.cjs +1 -0
  79. package/dist/react.cjs +1 -1
  80. package/dist/react.js +54 -54
  81. package/dist/refresh-icon.entry-8395104b.js +15 -0
  82. package/dist/refresh-icon.entry-cf4416b8.cjs +1 -0
  83. package/dist/register-component-b9cfcbaf-c0147194.js +109 -0
  84. package/dist/register-component-b9cfcbaf-d40e1f3c.cjs +1 -0
  85. package/dist/scheduler-config-store-07d98279-0610e42f.cjs +1 -0
  86. package/dist/scheduler-config-store-07d98279-3b70606c.js +24 -0
  87. package/dist/scheduler-store-24fd0e91-2dba20c2.cjs +1 -0
  88. package/dist/scheduler-store-24fd0e91-47098841.js +302 -0
  89. package/dist/time-period-selector.entry-1e849c2e.js +76 -0
  90. package/dist/time-period-selector.entry-d8f3462f.cjs +1 -0
  91. package/dist/translate-icon.entry-66533238.cjs +1 -0
  92. package/dist/translate-icon.entry-d847f706.js +15 -0
  93. package/dist/warning-icon.entry-1f0f00ed.cjs +1 -0
  94. package/dist/warning-icon.entry-b5db0151.js +15 -0
  95. package/package.json +2 -2
  96. package/dist/index-823fdc6f.cjs +0 -36
@@ -0,0 +1,380 @@
1
+ import { d as o, e as f } from "./index-f93f6948.js";
2
+ import { X as u, Z as d } from "./index.es-df564f87-b773d34f.js";
3
+ class S {
4
+ constructor(t, e) {
5
+ this.nylasAuth = t, this.nylasAuthStore = e;
6
+ }
7
+ async validateSession() {
8
+ const t = await this.isAccessTokenValid();
9
+ if (!t)
10
+ this.logout();
11
+ else {
12
+ let e = await this.nylasAuth.getTokenInfo();
13
+ if (e) {
14
+ const a = Math.floor(Date.now() / 1e3);
15
+ if (e.expires_in && e.expires_in - a < 3e5 && (o("[NylasAuthConnectorMixin] Refreshing access token"), e = await this.nylasAuth.refreshAccessToken(), !e)) {
16
+ o("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out."), this.logout();
17
+ return;
18
+ }
19
+ this.nylasAuthStore.state.tokenInfo = e;
20
+ }
21
+ }
22
+ this.nylasAuthStore.state.isAuthenticated = t;
23
+ }
24
+ async isAuthenticated() {
25
+ return this.nylasAuth.isAuthenticated();
26
+ }
27
+ async getTokenInfo() {
28
+ return this.nylasAuth.getTokenInfo();
29
+ }
30
+ async isAccessTokenValid() {
31
+ return this.nylasAuth.isAccessTokenValid();
32
+ }
33
+ async logout() {
34
+ await this.nylasAuth.logout();
35
+ }
36
+ async getHostedAuthRedirectURL(t, e, s) {
37
+ return this.nylasAuth.getHostedAuthRedirectURL(t, e, s);
38
+ }
39
+ async manageHostedAuthCodeExchange(t) {
40
+ const s = new URL(t).searchParams.get("code");
41
+ if (s) {
42
+ const a = await this.nylasAuth.exchangeAuthCodeForTokenInfo(s);
43
+ if (a)
44
+ return this.nylasAuthStore.state.tokenInfo = a, this.nylasAuthStore.state.isAuthenticated = !0, a;
45
+ }
46
+ return null;
47
+ }
48
+ }
49
+ class A {
50
+ constructor(t, e, s) {
51
+ this.nylasAuth = t, this.nylasAuthStore = e, this.nylasMailboxStore = s;
52
+ }
53
+ async getMessages() {
54
+ var n;
55
+ if (!this.nylasAuthStore.state.isAuthenticated)
56
+ throw new Error("Not authenticated");
57
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
58
+ throw new Error("Missing message:read-only scope");
59
+ this.nylasMailboxStore.state.state = "loading";
60
+ const t = this.nylasMailboxStore.state.messgeQueryParams, e = new URLSearchParams();
61
+ for (const i in t) {
62
+ const l = (n = t[i]) == null ? void 0 : n.toString();
63
+ l && e.append(i, l);
64
+ }
65
+ const s = `/v3/grants/me/messages?${e.toString()}`, a = await this.nylasAuth.nylasAPIRequest(s);
66
+ if (u(a))
67
+ throw new d(a.error);
68
+ const r = a.data;
69
+ return this.nylasMailboxStore.state.messages = r, this.nylasMailboxStore.state.state = "ready", r;
70
+ }
71
+ async getThreadMessages(t) {
72
+ if (!this.nylasAuthStore.state.isAuthenticated)
73
+ throw new Error("Not authenticated");
74
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
75
+ throw new Error("Missing message:read-only scope");
76
+ const e = await this.nylasAuth.nylasAPIRequest(`/v3/grants/me/messages?thread_id=${t}&fields=include_headers`);
77
+ if (u(e))
78
+ throw new d(e.error);
79
+ const s = e.data;
80
+ return this.nylasMailboxStore.state.messages = s, s;
81
+ }
82
+ downloadMessageAttachments(t) {
83
+ if (!this.nylasAuthStore.state.isAuthenticated)
84
+ throw new Error("Not authenticated");
85
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
86
+ throw new Error("Missing message:read-only scope");
87
+ const e = [], s = t.attachments || [];
88
+ for (const a of s) {
89
+ const r = this.nylasAuth.nylasDownloadFileRequest(`/v3/grants/me/attachments/${a.id}?message_id=${t.id}`);
90
+ e.push(r);
91
+ }
92
+ return e;
93
+ }
94
+ async summarizeText(t) {
95
+ if (!this.nylasAuthStore.state.isAuthenticated)
96
+ throw new Error("Not authenticated");
97
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
98
+ throw new Error("Missing message:read-only scope");
99
+ const e = await this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/summarize", "POST", {
100
+ message: {
101
+ body: t
102
+ }
103
+ }, !0, this.nylasAuth.config.elementsApiUri);
104
+ if (u(e))
105
+ throw new d(e.error);
106
+ return e.data.summary;
107
+ }
108
+ async textToSpeech(t, e) {
109
+ if (!this.nylasAuthStore.state.isAuthenticated)
110
+ throw new Error("Not authenticated");
111
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
112
+ throw new Error("Missing message:read-only scope");
113
+ return this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/tts", "POST", {
114
+ text: t
115
+ }, !1, this.nylasAuth.config.elementsApiUri, {
116
+ ...e ? { signal: e == null ? void 0 : e.signal } : {}
117
+ });
118
+ }
119
+ }
120
+ class T {
121
+ constructor(t, e, s, a) {
122
+ this.nylasAuth = t, this.nylasAuthStore = e, this.nylasMailboxStore = s, this.router = a;
123
+ }
124
+ async getThreads(t, e = "overwrite", s = !0) {
125
+ var y;
126
+ if (!this.nylasAuthStore.state.isAuthenticated)
127
+ throw new Error("Not authenticated");
128
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
129
+ throw new Error("Missing thread:read-only scope");
130
+ s && (this.nylasMailboxStore.state.state = "loading");
131
+ const a = t || this.nylasMailboxStore.state.threadsQueryParams, r = new URLSearchParams();
132
+ for (const g in a) {
133
+ const c = (y = a[g]) == null ? void 0 : y.toString();
134
+ typeof c < "u" && c !== null && r.append(g, c);
135
+ }
136
+ 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;
137
+ const n = `/v3/grants/me/threads?${r.toString()}`, i = await this.nylasAuth.nylasAPIRequest(n);
138
+ if (u(i))
139
+ throw new d(i.error);
140
+ const l = i.data;
141
+ switch (e) {
142
+ case "prepend":
143
+ this.nylasMailboxStore.state.threads = [...l, ...this.nylasMailboxStore.state.threads];
144
+ break;
145
+ case "append":
146
+ this.nylasMailboxStore.state.threads = [...this.nylasMailboxStore.state.threads, ...l];
147
+ break;
148
+ case "overwrite":
149
+ default:
150
+ this.nylasMailboxStore.state.threads = l;
151
+ break;
152
+ }
153
+ return i.next_cursor ? this.nylasMailboxStore.state.nextThreadPageToken = i.next_cursor : this.nylasMailboxStore.state.nextThreadPageToken = null, s && (this.nylasMailboxStore.state.state = "ready"), l;
154
+ }
155
+ async getThread(t) {
156
+ if (!this.nylasAuthStore.state.isAuthenticated)
157
+ throw new Error("Not authenticated");
158
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
159
+ throw new Error("Missing thread:read-only scope");
160
+ const e = this.nylasMailboxStore.state.threads.find((n) => n.id === t);
161
+ if (e)
162
+ return e;
163
+ this.nylasMailboxStore.state.state = "loading";
164
+ const s = `/v3/grants/me/threads/${t}`, a = await this.nylasAuth.nylasAPIRequest(s);
165
+ if (u(a))
166
+ throw new d(a.error);
167
+ const r = a.data;
168
+ return this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map((n) => n.id === r.id ? r : n), this.nylasMailboxStore.state.state = "ready", r;
169
+ }
170
+ async nextThreadPage(t = "overwrite", e = !0) {
171
+ if (!this.nylasMailboxStore.state.nextThreadPageToken)
172
+ throw new Error("No next page token");
173
+ this.nylasMailboxStore.state.previousThreadPageTokens = Array.from(/* @__PURE__ */ new Set([...this.nylasMailboxStore.state.previousThreadPageTokens, this.nylasMailboxStore.state.threadsQueryParams.page_token ?? null]));
174
+ const s = this.nylasMailboxStore.state.nextThreadPageToken;
175
+ return this.getThreads({
176
+ ...this.nylasMailboxStore.state.threadsQueryParams,
177
+ page_token: s
178
+ }, t, e);
179
+ }
180
+ async previousThreadPage(t = "overwrite", e = !0) {
181
+ if (!this.nylasMailboxStore.state.previousThreadPageTokens.length)
182
+ throw new Error("No previous page token");
183
+ const s = [...this.nylasMailboxStore.state.previousThreadPageTokens], a = s.pop();
184
+ return this.nylasMailboxStore.state.previousThreadPageTokens = s, this.getThreads({
185
+ ...this.nylasMailboxStore.state.threadsQueryParams,
186
+ page_token: a ?? void 0
187
+ }, t, e);
188
+ }
189
+ updateThreadQueryParams(t) {
190
+ this.nylasMailboxStore.state.threadsQueryParams = {
191
+ ...this.nylasMailboxStore.state.threadsQueryParams,
192
+ ...t
193
+ };
194
+ }
195
+ back() {
196
+ this.router.navigate("/", !0), this.nylasMailboxStore.state.selectedThread = null;
197
+ }
198
+ unSelectThread() {
199
+ this.nylasMailboxStore.state.selectedThread = null;
200
+ }
201
+ async selectThread(t) {
202
+ this.router.navigate(`/thread/${t.id}`, !0), this.nylasMailboxStore.state.selectedThread = t, t.unread && this.markThreadAsRead(t).catch((e) => {
203
+ o("Error marking thread as read", e);
204
+ });
205
+ }
206
+ async markThreadAsRead(t) {
207
+ return this.updateThread(t, { unread: !1 });
208
+ }
209
+ async updateThread(t, e) {
210
+ if (!this.nylasAuthStore.state.isAuthenticated)
211
+ throw new Error("Not authenticated");
212
+ if (!this.nylasAuth.hasScopeByType("email", "modify"))
213
+ throw new Error("Missing thread:modify scope");
214
+ const s = `/v3/grants/me/threads/${t.id}`, a = await this.nylasAuth.nylasAPIRequest(s, "PUT", e);
215
+ if (u(a))
216
+ throw new d(a.error);
217
+ const r = a.data;
218
+ return this.nylasMailboxStore.state.threads = this.nylasMailboxStore.state.threads.map((n) => n.id === r.id ? r : n), this.nylasMailboxStore.state.selectedThread = r, r;
219
+ }
220
+ }
221
+ class x {
222
+ constructor(t, e, s) {
223
+ this.nylasAuth = t, this.nylasAuthStore = e, this.nylasMailboxStore = s;
224
+ }
225
+ async getFolders() {
226
+ if (!this.nylasAuthStore.state.isAuthenticated)
227
+ throw new Error("Not authenticated");
228
+ if (!this.nylasAuth.hasScopeByType("email", ["read-only", "modify"]))
229
+ throw new Error("Missing thread:read-only scope");
230
+ this.nylasMailboxStore.state.state = "loading";
231
+ const t = "/v3/grants/me/folders", e = await this.nylasAuth.nylasAPIRequest(t);
232
+ if (u(e))
233
+ throw new d(e.error);
234
+ const s = e.data;
235
+ return this.nylasMailboxStore.state.folders = s, this.nylasMailboxStore.state.state = "ready", s;
236
+ }
237
+ async selectFolder(t) {
238
+ this.nylasMailboxStore.state.threadsQueryParams = {
239
+ in: t.id,
240
+ ...this.nylasMailboxStore.state.threadsQueryParams || {}
241
+ };
242
+ }
243
+ }
244
+ class m extends Event {
245
+ constructor(t, e) {
246
+ super(t, e), this.oldURL = e.oldURL, this.newURL = e.newURL;
247
+ }
248
+ }
249
+ class P {
250
+ constructor() {
251
+ this.routeChangeListeners = [], o("HashRouter constructor");
252
+ }
253
+ destroy() {
254
+ o("HashRouter destroy"), window.removeEventListener("hashchange", this.onRouteChange.bind(this));
255
+ }
256
+ init() {
257
+ if (o("HashRouter init"), window.addEventListener("hashchange", this.onRouteChange.bind(this)), typeof HashChangeEvent < "u") {
258
+ const t = new HashChangeEvent("hashchange", { oldURL: "", newURL: window.location.href });
259
+ this.onRouteChange(t);
260
+ } else {
261
+ const t = new m("hashchange", { oldURL: "", newURL: window.location.href });
262
+ this.onRouteChange(t);
263
+ }
264
+ }
265
+ addRouteChangeListener(t, e) {
266
+ o("HashRouter addRouteChangeListener"), this.routeChangeListeners.push([t, e]);
267
+ }
268
+ navigate(t, e) {
269
+ if (o("HashRouter navigate"), e)
270
+ return window.history.pushState(null, "", `#${t}`);
271
+ window.location.hash = t;
272
+ }
273
+ setRoute(t) {
274
+ o("HashRouter setRoute"), window.location.hash = t;
275
+ }
276
+ matchRoute(t, e) {
277
+ const s = t.split("/"), a = e.split("/");
278
+ if (o(`HashRouter matchRoute route=${t} path=${e}`, { routeParts: s, pathParts: a }), s[1] === "" && a[0] === "")
279
+ return !0;
280
+ if (s.length !== a.length)
281
+ return !1;
282
+ for (let r = 0; r < s.length; r++) {
283
+ const n = s[r], i = a[r];
284
+ if (!n.startsWith(":") && n !== i)
285
+ return !1;
286
+ }
287
+ return !0;
288
+ }
289
+ getRouteParams(t) {
290
+ o("HashRouter getRouteParams");
291
+ const e = {}, s = t.split("/"), a = window.location.hash.split("/");
292
+ return s.forEach((r, n) => {
293
+ if (r.startsWith(":")) {
294
+ const i = r.substring(1);
295
+ e[i] = a[n];
296
+ }
297
+ }), e;
298
+ }
299
+ getRouteWithParams(t, e) {
300
+ o("HashRouter getRouteWithParams");
301
+ let s = t;
302
+ return Object.keys(e).forEach((a) => {
303
+ s = s.replace(`:${a}`, e[a]);
304
+ }), s;
305
+ }
306
+ getRoute() {
307
+ return o("HashRouter getRoute"), window.location.hash;
308
+ }
309
+ onRouteChange(t) {
310
+ this.routeChangeListeners.forEach(async ([e, s]) => {
311
+ const a = t.newURL.indexOf("#") === -1 ? "" : t.newURL.substring(t.newURL.indexOf("#") + 1);
312
+ if (o(`HashRouter onRouteChange route=${e} path=${a}`, { event: t }), !this.matchRoute(e, a)) {
313
+ o(`HashRouter onRouteChange route=${e} path=${a} does not match`);
314
+ return;
315
+ }
316
+ const r = this.getRouteParams(e);
317
+ await s(e, a, r);
318
+ });
319
+ }
320
+ getBasePath() {
321
+ return o("HashRouter getBasePath"), "";
322
+ }
323
+ }
324
+ function b(h = {}) {
325
+ const t = {
326
+ isAuthenticated: !1,
327
+ tokenInfo: null,
328
+ state: "ready",
329
+ ...h
330
+ }, e = f(t);
331
+ return e.reset = () => {
332
+ for (const s in t) {
333
+ const a = t[s];
334
+ e.set(s, a);
335
+ }
336
+ }, e;
337
+ }
338
+ function M(h = {}) {
339
+ const t = {
340
+ state: "ready",
341
+ messages: [],
342
+ threads: [],
343
+ folders: [],
344
+ selectedThread: null,
345
+ nextThreadPageToken: null,
346
+ previousThreadPageTokens: [],
347
+ searchQuery: "",
348
+ hasNextThreadPage: !1,
349
+ hasPreviousThreadPage: !1,
350
+ selectedFolder: "inbox",
351
+ threadsQueryParams: {
352
+ in: "inbox"
353
+ },
354
+ messgeQueryParams: {
355
+ fields: "include_headers"
356
+ },
357
+ ...h
358
+ }, e = f({ ...t });
359
+ return e.onChange("nextThreadPageToken", (s) => {
360
+ e.set("hasNextThreadPage", s !== null);
361
+ }), e.onChange("previousThreadPageTokens", (s) => {
362
+ e.set("hasPreviousThreadPage", s.length > 0);
363
+ }), e.onChange("threadsQueryParams", (s) => {
364
+ e.set("selectedFolder", s.in || "inbox"), e.set("searchQuery", s.search_query_native || "");
365
+ }), e.reset = () => {
366
+ for (const s in t) {
367
+ const a = t[s];
368
+ e.set(s, a);
369
+ }
370
+ }, e;
371
+ }
372
+ export {
373
+ b as C,
374
+ P as H,
375
+ S as N,
376
+ M as a,
377
+ T as b,
378
+ A as c,
379
+ x as d
380
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-93c50de4.cjs"),c=require("./register-component-b9cfcbaf-d40e1f3c.cjs");require("react");require("react-dom");const y=':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)}',u=y;var f=function(a,i,n,s){var r=arguments.length,e=r<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,n):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(a,i,n,s);else for(var p=a.length-1;p>=0;p--)(l=a[p])&&(e=(r<3?l(e):r>3?l(i,n,e):l(i,n))||e);return r>3&&e&&Object.defineProperty(i,n,e),e},d=function(a,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(a,i)};const o=class{constructor(a){t.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){t.debug("nylas-additional-participants","elementNameChangedHandler",a),this.host.setAttribute("name",a)}connectedCallback(){t.debug("nylas-additional-participants","connectedCallback")}componentWillLoad(){t.debug("nylas-additional-participants","componentWillLoad"),this.host.setAttribute("name",this.name)}componentDidLoad(){t.debug("nylas-additional-participants","componentDidLoad"),this.internals.setFormValue(JSON.stringify(this.participants),"participants")}disconnectedCallback(){t.debug("nylas-additional-participants","disconnectedCallback")}onParticipantChange(a,i){t.debug("nylas-additional-participants","onParticipantChange"),this.participants[i].email=a.target.value,this.internals.setFormValue(JSON.stringify(this.participants),"participants")}addParticipant(){t.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){t.debug("nylas-additional-participants","addParticipant"),this.participants=this.participants.filter(i=>i.email!==a),this.internals.setFormValue(JSON.stringify(this.participants),"participants")}validate(a,i){t.debug("nylas-additional-participants","validate");const s=/^(([^<>()\[\]\\.,;:\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[i].is_valid=s,this.internals.setFormValue(JSON.stringify(this.participants),"participants")}render(){return t.h(t.Host,{key:"2cee2dd98939f98fdfc950f609fce3f6045ced9f"},t.h("nylas-form-card",{key:"e587c19e99fa1b40c9d876123fd50cde51e8882c"},t.h("h3",{key:"6c4a90291f5918e98d62e03b599619ff4f345391",slot:"header-title",class:"nylas-additional-participants__title",part:"nap__title"},"Additional participants"),t.h("p",{key:"ad4fac5ca4cdb1430f889c723215d9a1538a266f",slot:"header-subtitle",class:"nylas-additional-participants__subtitle",part:"nap__subtitle"},"Add anyone else who would be joining for this event."),t.h("div",{key:"80b29a9b1275363dac86274be18cc52210e59de7",slot:"content",class:"nylas-additional-participants__content"},t.h("div",{key:"5adf8a7d2be8c780dbc5859b8b634efc114536c2"},this.participants.map((a,i)=>t.h("div",{class:"nylas-additional-participants__input_group",part:"nap__input_group"},t.h("label",null,a.is_organizer?"Organizer":`Participant ${i}`),t.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"}`},t.h("div",{class:"nylas-additional-participants__input",part:"nap__input"},t.h("input",{type:"text",value:a.email,onInput:n=>{this.onParticipantChange(n,i)},readOnly:a.is_organizer,onBlur:()=>this.validate(a.email,i)})),!a.is_organizer&&t.h("button",{onClick:()=>this.removeParticipant(a.email),part:"nap__remove-participant"},t.h("close-icon",null)))))))))}static get formAssociated(){return!0}get host(){return t.getElement(this)}static get watchers(){return{name:["elementNameChangedHandler"]}}};f([c.RegisterComponent({name:"nylas-additional-participants",eventToProps:{},fireRegisterEvent:!0}),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],o.prototype,"render",null);o.style=u;exports.nylas_additional_participants=o;
@@ -0,0 +1,81 @@
1
+ import { r as y, d as n, h as i, H as f, g as _ } from "./index-f93f6948.js";
2
+ import { R as u } from "./register-component-b9cfcbaf-c0147194.js";
3
+ import "react";
4
+ import "react-dom";
5
+ const b = ':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 = b;
6
+ var h = function(a, t, e, r) {
7
+ var l = arguments.length, s = l < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, e) : r, p;
8
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
9
+ s = Reflect.decorate(a, t, e, r);
10
+ else
11
+ for (var o = a.length - 1; o >= 0; o--)
12
+ (p = a[o]) && (s = (l < 3 ? p(s) : l > 3 ? p(t, e, s) : p(t, e)) || s);
13
+ return l > 3 && s && Object.defineProperty(t, e, s), s;
14
+ }, d = function(a, t) {
15
+ if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
16
+ return Reflect.metadata(a, t);
17
+ };
18
+ const c = class {
19
+ constructor(a) {
20
+ 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;
21
+ }
22
+ elementNameChangedHandler(a) {
23
+ n("nylas-additional-participants", "elementNameChangedHandler", a), this.host.setAttribute("name", a);
24
+ }
25
+ connectedCallback() {
26
+ n("nylas-additional-participants", "connectedCallback");
27
+ }
28
+ componentWillLoad() {
29
+ n("nylas-additional-participants", "componentWillLoad"), this.host.setAttribute("name", this.name);
30
+ }
31
+ componentDidLoad() {
32
+ n("nylas-additional-participants", "componentDidLoad"), this.internals.setFormValue(JSON.stringify(this.participants), "participants");
33
+ }
34
+ disconnectedCallback() {
35
+ n("nylas-additional-participants", "disconnectedCallback");
36
+ }
37
+ onParticipantChange(a, t) {
38
+ n("nylas-additional-participants", "onParticipantChange"), this.participants[t].email = a.target.value, this.internals.setFormValue(JSON.stringify(this.participants), "participants");
39
+ }
40
+ addParticipant() {
41
+ 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");
42
+ }
43
+ removeParticipant(a) {
44
+ n("nylas-additional-participants", "addParticipant"), this.participants = this.participants.filter((t) => t.email !== a), this.internals.setFormValue(JSON.stringify(this.participants), "participants");
45
+ }
46
+ validate(a, t) {
47
+ n("nylas-additional-participants", "validate");
48
+ 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());
49
+ this.participants[t].is_valid = r, this.internals.setFormValue(JSON.stringify(this.participants), "participants");
50
+ }
51
+ render() {
52
+ return i(f, { key: "2cee2dd98939f98fdfc950f609fce3f6045ced9f" }, i("nylas-form-card", { key: "e587c19e99fa1b40c9d876123fd50cde51e8882c" }, i("h3", { key: "6c4a90291f5918e98d62e03b599619ff4f345391", slot: "header-title", class: "nylas-additional-participants__title", part: "nap__title" }, "Additional participants"), i("p", { key: "ad4fac5ca4cdb1430f889c723215d9a1538a266f", slot: "header-subtitle", class: "nylas-additional-participants__subtitle", part: "nap__subtitle" }, "Add anyone else who would be joining for this event."), i("div", { key: "80b29a9b1275363dac86274be18cc52210e59de7", slot: "content", class: "nylas-additional-participants__content" }, i("div", { key: "5adf8a7d2be8c780dbc5859b8b634efc114536c2" }, 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) => {
53
+ this.onParticipantChange(e, t);
54
+ }, 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)))))))));
55
+ }
56
+ static get formAssociated() {
57
+ return !0;
58
+ }
59
+ get host() {
60
+ return _(this);
61
+ }
62
+ static get watchers() {
63
+ return {
64
+ name: ["elementNameChangedHandler"]
65
+ };
66
+ }
67
+ };
68
+ h([
69
+ u({
70
+ name: "nylas-additional-participants",
71
+ eventToProps: {},
72
+ fireRegisterEvent: !0
73
+ }),
74
+ d("design:type", Function),
75
+ d("design:paramtypes", []),
76
+ d("design:returntype", void 0)
77
+ ], c.prototype, "render", null);
78
+ c.style = m;
79
+ export {
80
+ c as nylas_additional_participants
81
+ };