@nylas/react 1.0.2-prealpha1 → 1.1.0-canary.3

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 (133) hide show
  1. package/dist/add-circle-icon_22.entry-8d0ac489.cjs +1 -0
  2. package/dist/add-circle-icon_22.entry-da31fa71.js +1733 -0
  3. package/dist/{archive-icon_7.entry-84d70dbf.cjs → archive-icon_7.entry-7aad8104.cjs} +1 -1
  4. package/dist/{archive-icon_7.entry-91aaa1aa.js → archive-icon_7.entry-bc2418f7.js} +20 -20
  5. package/dist/{arrow-icon.entry-400a08fa.cjs → arrow-icon.entry-6eba68a9.cjs} +1 -1
  6. package/dist/arrow-icon.entry-9a932082.js +15 -0
  7. package/dist/{bold-icon_3.entry-4b2798a8.js → bold-icon_3.entry-5f7e3755.js} +4 -4
  8. package/dist/{bold-icon_3.entry-9ad35153.cjs → bold-icon_3.entry-db17d481.cjs} +1 -1
  9. package/dist/{calendar-cancel-icon.entry-83ba884a.js → calendar-cancel-icon.entry-1ff7845a.js} +4 -4
  10. package/dist/{calendar-cancel-icon.entry-fcb66929.cjs → calendar-cancel-icon.entry-a5141f82.cjs} +1 -1
  11. package/dist/calendar-check-icon_2.entry-c3add652.cjs +1 -0
  12. package/dist/calendar-check-icon_2.entry-d7421059.js +25 -0
  13. package/dist/{calendar-icon.entry-8f38af4a.js → calendar-icon.entry-4458997f.js} +2 -2
  14. package/dist/{calendar-icon.entry-7bae38d7.cjs → calendar-icon.entry-445d624a.cjs} +1 -1
  15. package/dist/chevron-icon_3.entry-8961e6bb.cjs +1 -0
  16. package/dist/chevron-icon_3.entry-f7f3d487.js +117 -0
  17. package/dist/close-icon.entry-6dd5ff0a.js +15 -0
  18. package/dist/close-icon.entry-ebc527c5.cjs +1 -0
  19. package/dist/{nylas-booked-event-card_10.entry-7e66a648.js → constants-6ee60d6d-4cd16450.js} +1656 -2374
  20. package/dist/{nylas-booked-event-card_10.entry-ed515326.cjs → constants-6ee60d6d-6c0540db.cjs} +6 -6
  21. package/dist/document-refresh-icon.entry-298b2133.cjs +1 -0
  22. package/dist/document-refresh-icon.entry-bdc323b5.js +15 -0
  23. package/dist/elements/index.d.ts +31 -2
  24. package/dist/{forward-icon_6.entry-3345af84.cjs → forward-icon_6.entry-15208ea9.cjs} +3 -3
  25. package/dist/{forward-icon_6.entry-b60fcb35.js → forward-icon_6.entry-62759373.js} +127 -127
  26. package/dist/{globe-icon.entry-e3fd373f.js → globe-icon.entry-9e082178.js} +4 -4
  27. package/dist/{globe-icon.entry-8325e73e.cjs → globe-icon.entry-c8302bf5.cjs} +1 -1
  28. package/dist/google-logo-icon_3.entry-0c095209.js +258 -0
  29. package/dist/google-logo-icon_3.entry-f8433ff9.cjs +1 -0
  30. package/dist/index-0f3bd8df.js +1824 -0
  31. package/dist/index-7a55dc33.cjs +30 -0
  32. package/dist/index.d.ts +3 -1
  33. package/dist/index.es-2578c6a5-098d48d0.cjs +7 -0
  34. package/dist/{index-b30d446a-a90f84b2.js → index.es-2578c6a5-71441142.js} +833 -933
  35. package/dist/info-icon_2.entry-73106882.js +34 -0
  36. package/dist/info-icon_2.entry-ca224a3b.cjs +1 -0
  37. package/dist/{loading-icon.entry-27410cf8.js → loading-icon.entry-012644b7.js} +4 -4
  38. package/dist/{loading-icon.entry-b2096d2b.cjs → loading-icon.entry-f9f5e66f.cjs} +1 -1
  39. package/dist/mailbox-store-bb21512c-045c3ea0.cjs +1 -0
  40. package/dist/{mailbox-store-19f0c6c9-e3e8b4e5.js → mailbox-store-bb21512c-615660ef.js} +17 -16
  41. package/dist/nylas-additional-participants.entry-a50ef8e2.cjs +1 -0
  42. package/dist/nylas-additional-participants.entry-db85836a.js +83 -0
  43. package/dist/nylas-booked-event-card_10.entry-b49b2369.js +784 -0
  44. package/dist/nylas-booked-event-card_10.entry-fccb783c.cjs +1 -0
  45. package/dist/nylas-form-card.entry-090a4d3b.js +56 -0
  46. package/dist/nylas-form-card.entry-f5230005.cjs +1 -0
  47. package/dist/nylas-if-state.entry-7924dde0.js +96 -0
  48. package/dist/nylas-if-state.entry-ff9c9a85.cjs +1 -0
  49. package/dist/{nylas-list-folders.entry-a5437201.js → nylas-list-folders.entry-9dd96530.js} +9 -8
  50. package/dist/nylas-list-folders.entry-dbfc2cf8.cjs +1 -0
  51. package/dist/nylas-list-threads.entry-6bcc0328.cjs +1 -0
  52. package/dist/{nylas-list-threads.entry-fd6cda61.js → nylas-list-threads.entry-b435eaae.js} +5 -4
  53. package/dist/nylas-login.entry-1623d309.cjs +1 -0
  54. package/dist/nylas-login.entry-97350c76.js +75 -0
  55. package/dist/nylas-mailbox-pagination.entry-1776eb16.cjs +1 -0
  56. package/dist/{nylas-mailbox-pagination.entry-988214bc.js → nylas-mailbox-pagination.entry-ceef8be2.js} +4 -3
  57. package/dist/nylas-mailbox-toolbar-button.entry-7d3f79b9.cjs +1 -0
  58. package/dist/{nylas-mailbox-toolbar-button.entry-c720e22a.js → nylas-mailbox-toolbar-button.entry-e6b3d3a4.js} +11 -10
  59. package/dist/nylas-mailbox.entry-06d8014a.js +136 -0
  60. package/dist/nylas-mailbox.entry-ae8da6ff.cjs +1 -0
  61. package/dist/{nylas-provider.entry-70721009.js → nylas-provider.entry-8b9c2b69.js} +46 -33
  62. package/dist/nylas-provider.entry-97c9e272.cjs +1 -0
  63. package/dist/nylas-scheduler-editor.entry-c3791787.js +2181 -0
  64. package/dist/nylas-scheduler-editor.entry-f6cf1cd9.cjs +7 -0
  65. package/dist/nylas-scheduling.entry-08ae840a.cjs +1 -0
  66. package/dist/nylas-scheduling.entry-6380509a.js +237 -0
  67. package/dist/nylas-threads-refresh.entry-246e6d77.cjs +1 -0
  68. package/dist/{nylas-threads-refresh.entry-b7f9e93f.js → nylas-threads-refresh.entry-eaee86fb.js} +6 -5
  69. package/dist/nylas-threads-search.entry-42a2acb1.cjs +1 -0
  70. package/dist/{nylas-threads-search.entry-95afea9c.js → nylas-threads-search.entry-7e12758e.js} +15 -14
  71. package/dist/nylas-view-thread.entry-78e6927a.cjs +1 -0
  72. package/dist/{nylas-view-thread.entry-165173b1.js → nylas-view-thread.entry-b936e76a.js} +5 -4
  73. package/dist/people-icon.entry-5c8ee696.js +15 -0
  74. package/dist/people-icon.entry-bcf848c0.cjs +1 -0
  75. package/dist/play-icon_2.entry-356e63cc.js +25 -0
  76. package/dist/play-icon_2.entry-92e78f1b.cjs +1 -0
  77. package/dist/react.cjs +1 -1
  78. package/dist/react.js +92 -61
  79. package/dist/{refresh-icon.entry-e48a338f.js → refresh-icon.entry-77f0c377.js} +2 -2
  80. package/dist/{refresh-icon.entry-601cac89.cjs → refresh-icon.entry-bec053b6.cjs} +1 -1
  81. package/dist/{register-component-152c6ad2-a06f58c2.js → register-component-dc659dc3-0fdb18dc.js} +2 -2
  82. package/dist/{register-component-152c6ad2-0df7215b.cjs → register-component-dc659dc3-f58bf25b.cjs} +1 -1
  83. package/dist/scheduler-config-store-51ee4f42-ce3a9b0e.cjs +1 -0
  84. package/dist/scheduler-config-store-51ee4f42-e02895da.js +14 -0
  85. package/dist/{scheduler-store-7d48e682-0c0c3991.js → scheduler-store-72116723-3ba2480c.js} +100 -95
  86. package/dist/scheduler-store-72116723-db9d91f6.cjs +1 -0
  87. package/dist/time-period-selector.entry-decd251b.js +78 -0
  88. package/dist/time-period-selector.entry-f25fad77.cjs +1 -0
  89. package/dist/translate-icon.entry-cac02c46.js +15 -0
  90. package/dist/translate-icon.entry-dd5b707c.cjs +1 -0
  91. package/dist/utils-c00bdc3c-89ab163d.js +2111 -0
  92. package/dist/utils-c00bdc3c-94b9c3b6.cjs +8 -0
  93. package/dist/warning-icon.entry-370b9cf0.js +15 -0
  94. package/dist/warning-icon.entry-8af8a742.cjs +1 -0
  95. package/package.json +7 -4
  96. package/dist/add-circle-icon.entry-2ccb238b.cjs +0 -1
  97. package/dist/add-circle-icon.entry-35d6aa07.js +0 -15
  98. package/dist/arrow-icon.entry-8b2e96a6.js +0 -15
  99. package/dist/calendar-check-icon_3.entry-903e2d82.js +0 -35
  100. package/dist/calendar-check-icon_3.entry-a16ce05e.cjs +0 -1
  101. package/dist/chevron-icon.entry-58366662.cjs +0 -1
  102. package/dist/chevron-icon.entry-5e11cef5.js +0 -15
  103. package/dist/close-icon_2.entry-011d9cf4.js +0 -25
  104. package/dist/close-icon_2.entry-83088b9a.cjs +0 -1
  105. package/dist/document-refresh-icon.entry-071ffd66.cjs +0 -1
  106. package/dist/document-refresh-icon.entry-9083a2e9.js +0 -15
  107. package/dist/duration-bddc4a13-05d3e3e2.cjs +0 -1
  108. package/dist/duration-bddc4a13-179ce826.js +0 -41
  109. package/dist/index-3b6f5cd5.cjs +0 -30
  110. package/dist/index-630f4e87.js +0 -1498
  111. package/dist/index-b30d446a-cbbef925.cjs +0 -7
  112. package/dist/mailbox-store-19f0c6c9-a0cbfa97.cjs +0 -1
  113. package/dist/nylas-if-state_3.entry-504be976.cjs +0 -1
  114. package/dist/nylas-if-state_3.entry-e96d01f1.js +0 -291
  115. package/dist/nylas-list-folders.entry-866361cc.cjs +0 -1
  116. package/dist/nylas-list-threads.entry-04989295.cjs +0 -1
  117. package/dist/nylas-mailbox-pagination.entry-e0bd4aef.cjs +0 -1
  118. package/dist/nylas-mailbox-toolbar-button.entry-3d772b26.cjs +0 -1
  119. package/dist/nylas-open-hours-picker.entry-6bdc7c73.js +0 -186
  120. package/dist/nylas-open-hours-picker.entry-881b6db7.cjs +0 -1
  121. package/dist/nylas-provider.entry-8d9a844b.cjs +0 -1
  122. package/dist/nylas-scheduler.entry-7321e18f.js +0 -230
  123. package/dist/nylas-scheduler.entry-e82977fb.cjs +0 -1
  124. package/dist/nylas-threads-refresh.entry-477e68e4.cjs +0 -1
  125. package/dist/nylas-threads-search.entry-c5854641.cjs +0 -1
  126. package/dist/nylas-view-thread.entry-8b72cbdb.cjs +0 -1
  127. package/dist/play-icon_2.entry-ed5877e3.js +0 -25
  128. package/dist/play-icon_2.entry-f23ed6c1.cjs +0 -1
  129. package/dist/scheduler-store-7d48e682-674705ef.cjs +0 -1
  130. package/dist/search-icon_3.entry-292138c3.js +0 -101
  131. package/dist/search-icon_3.entry-8e555357.cjs +0 -1
  132. package/dist/utils-5074a070-ce33ee6b.js +0 -119
  133. package/dist/utils-5074a070-d5ba6add.cjs +0 -2
@@ -1,8 +1,9 @@
1
- import { r as f, h as l, H as b, g as m } from "./index-630f4e87.js";
2
- import { R as u } from "./register-component-152c6ad2-a06f58c2.js";
3
- import { d as c } from "./utils-5074a070-ce33ee6b.js";
1
+ import { r as y, h as l, H as m, g as f } from "./index-0f3bd8df.js";
2
+ import { R as u } from "./register-component-dc659dc3-0fdb18dc.js";
3
+ import { d as c } from "./utils-c00bdc3c-89ab163d.js";
4
4
  import "react";
5
5
  import "react-dom";
6
+ import "./_commonjsHelpers-57e89916-af061c86.js";
6
7
  const p = ":host{display:block}sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}sp-button:hover{background-color:var(--nylas-color-primary-500)}sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}", h = p;
7
8
  var g = function(t, o, e, n) {
8
9
  var r = arguments.length, a = r < 3 ? o : n === null ? n = Object.getOwnPropertyDescriptor(o, e) : n, i;
@@ -16,9 +17,9 @@ var g = function(t, o, e, n) {
16
17
  if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
17
18
  return Reflect.metadata(t, o);
18
19
  };
19
- const y = class {
20
+ const b = class {
20
21
  constructor(t) {
21
- f(this, t), this.onClick = async () => {
22
+ y(this, t), this.onClick = async () => {
22
23
  const o = this.method;
23
24
  if (c("[nylas-mailbox-toolbar-button] onClick", { method: o, mailboxConnector: this.mailboxConnector }), this.mailboxConnector && o) {
24
25
  const e = this.callMethod(this.mailboxConnector, o);
@@ -61,10 +62,10 @@ const y = class {
61
62
  t = this.dataState ? o.get(r) === "loading" : !1;
62
63
  }
63
64
  const e = t ? "state-loading" : "state-ready";
64
- return l(b, { key: "a54c99a0881643686516cecb59f8f945ba8e3ef1" }, l("sp-theme", { key: "075773f3a5e9c354bae00d01c70d3b458cc40961", scale: "medium", color: "dark" }, l("sp-button", { onClick: this.onClick, disabled: t, key: e, "icon-only": this.iconOnly, label: this.renderByState(t) }, this.hasSlot("icon") && l("div", { slot: "icon", class: "slot" }, l("slot", { name: "icon" })), !this.iconOnly && this.renderByState(t))));
65
+ return l(m, { key: "bc4a3e76b0b9ea32d5c640b6ef5944bc45edb2b1" }, l("sp-theme", { key: "c52ad12f24b96ca8ee1da8f026db2441ae87d40e", scale: "medium", color: "dark" }, l("sp-button", { onClick: this.onClick, disabled: t, key: e, "icon-only": this.iconOnly, label: this.renderByState(t) }, this.hasSlot("icon") && l("div", { slot: "icon", class: "slot" }, l("slot", { name: "icon" })), !this.iconOnly && this.renderByState(t))));
65
66
  }
66
67
  get host() {
67
- return m(this);
68
+ return f(this);
68
69
  }
69
70
  };
70
71
  g([
@@ -76,8 +77,8 @@ g([
76
77
  d("design:type", Function),
77
78
  d("design:paramtypes", []),
78
79
  d("design:returntype", void 0)
79
- ], y.prototype, "render", null);
80
- y.style = h;
80
+ ], b.prototype, "render", null);
81
+ b.style = h;
81
82
  export {
82
- y as nylas_mailbox_toolbar_button
83
+ b as nylas_mailbox_toolbar_button
83
84
  };
@@ -0,0 +1,136 @@
1
+ import { r as A, c as l, h as f, H as M, g as _ } from "./index-0f3bd8df.js";
2
+ import { N as v, e as w } from "./index.es-2578c6a5-71441142.js";
3
+ import { d as S } from "./utils-c00bdc3c-89ab163d.js";
4
+ import { C as P, a as N, H as I, N as E, b as L, c as O, d as R } from "./mailbox-store-bb21512c-615660ef.js";
5
+ import "react";
6
+ import "react-dom";
7
+ import "./_commonjsHelpers-57e89916-af061c86.js";
8
+ class T {
9
+ constructor(e, s, o, i) {
10
+ this.router = e, this.nylasAuth = s, this.nylasAuthStore = o, this.nylasMailboxStore = i;
11
+ }
12
+ init() {
13
+ S("NylasMailboxConnector init");
14
+ }
15
+ get mailboxStore() {
16
+ return this.nylasMailboxStore;
17
+ }
18
+ get authStore() {
19
+ return this.nylasAuthStore;
20
+ }
21
+ get auth() {
22
+ return this._authConnector ? this._authConnector : (this._authConnector = new E(this.nylasAuth, this.nylasAuthStore), this._authConnector);
23
+ }
24
+ get threads() {
25
+ return this._threadConnector ? this._threadConnector : (this._threadConnector = new L(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
26
+ }
27
+ get messages() {
28
+ return this._messageConnector ? this._messageConnector : (this._messageConnector = new O(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
29
+ }
30
+ get folders() {
31
+ return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new R(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
32
+ }
33
+ getAuth() {
34
+ return this.nylasAuth;
35
+ }
36
+ resetStores() {
37
+ this.nylasMailboxStore.reset(), this.nylasAuthStore.reset();
38
+ }
39
+ async logout() {
40
+ await this.nylasAuth.logout(), this.resetStores();
41
+ }
42
+ }
43
+ const H = ":host{display:contents}", k = H, D = class {
44
+ constructor(t) {
45
+ A(this, t), this.init = l(this, "init", 7), this.loggedIn = l(this, "loggedIn", 7), this.loggedOut = l(this, "loggedOut", 7), this.handleAuthChange = async (e) => {
46
+ var s;
47
+ e ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host).defaultPrevented || await ((s = this.nylasMailboxConnector) == null ? void 0 : s.logout());
48
+ }, this.automaticComponentRegistration = !0, this.eventOverrides = {}, this.authConfig = void 0, this.defaultAuthStoreState = void 0, this.defaultMailboxStoreState = void 0;
49
+ }
50
+ connectedCallback() {
51
+ S("[nylas-mailbox] connectedCallback");
52
+ }
53
+ async componentWillLoad() {
54
+ var o, i, d, u, c, y, g;
55
+ this.stores = {
56
+ auth: P(this.defaultAuthStoreState),
57
+ mailbox: N(this.defaultMailboxStoreState)
58
+ }, this.baseProvider = new v(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.router = new I(), this.nylasAuth = w({
59
+ apiUri: "https://api.us.nylas.com",
60
+ elementsApiUri: "https://elements.us.nylas.com",
61
+ storageType: "indexeddb",
62
+ clientId: "YOUR_CLIENT_ID",
63
+ defaultScopes: [],
64
+ redirectURI: "/",
65
+ ...this.authConfig
66
+ });
67
+ const t = (o = this.baseProvider) == null ? void 0 : o.getStore("auth");
68
+ if (!t)
69
+ throw new Error("Auth store is not defined");
70
+ const e = (i = this.baseProvider) == null ? void 0 : i.getStore("mailbox");
71
+ if (!e)
72
+ throw new Error("Mailbox store is not defined");
73
+ this.nylasMailboxConnector = new T(this.router, this.nylasAuth, t, e), this.init.emit(this.host).defaultPrevented || await ((d = this.nylasMailboxConnector) == null ? void 0 : d.auth.validateSession()), (u = this.router) == null || u.addRouteChangeListener("/thread/:threadId", async (x, p, b) => {
74
+ var a, r;
75
+ const h = b.threadId, n = await ((a = this.nylasMailboxConnector) == null ? void 0 : a.threads.getThread(h));
76
+ n && ((r = this.nylasMailboxConnector) == null || r.mailboxStore.set("selectedThread", n));
77
+ }), (c = this.router) == null || c.addRouteChangeListener("/", async (x, p, b) => {
78
+ var n, a, r, C;
79
+ if (!t.state.isAuthenticated)
80
+ return;
81
+ (n = this.nylasMailboxConnector) == null || n.threads.unSelectThread(), (a = this.nylasMailboxConnector) == null || a.folders.getFolders();
82
+ const h = window.location.hash.split("?")[1];
83
+ if (h) {
84
+ const m = new URLSearchParams(h).get("query");
85
+ m && await ((r = this.nylasMailboxConnector) == null ? void 0 : r.threads.getThreads({
86
+ search_query_native: m,
87
+ page_token: void 0
88
+ }));
89
+ } else
90
+ (C = this.nylasMailboxConnector) == null || C.threads.getThreads();
91
+ }), (y = this.router) == null || y.init(), this.handleAuthChange(t.state.isAuthenticated), (g = this.baseProvider) == null || g.componentWillLoad(this.nylasMailboxConnector);
92
+ }
93
+ async componentDidLoad() {
94
+ var e, s;
95
+ const t = (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
96
+ if (!t)
97
+ throw new Error("Auth store is not defined");
98
+ t.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
99
+ }
100
+ componentDisconnected() {
101
+ var t;
102
+ (t = this.baseProvider) == null || t.componentDisconnected();
103
+ }
104
+ async registerComponentHandler(t) {
105
+ var e;
106
+ (e = this.baseProvider) == null || e.registerComponent(t.detail);
107
+ }
108
+ async unregisterComponentHandler(t) {
109
+ var e;
110
+ (e = this.baseProvider) == null || e.unregisterComponent(t.detail);
111
+ }
112
+ async getMailboxStore() {
113
+ var t;
114
+ return (t = this.baseProvider) == null ? void 0 : t.getStore("mailbox");
115
+ }
116
+ async getAuthStore() {
117
+ var t;
118
+ return (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
119
+ }
120
+ async getNylasAuth() {
121
+ return this.nylasAuth;
122
+ }
123
+ async getNylasMailboxConnector() {
124
+ return this.nylasMailboxConnector;
125
+ }
126
+ render() {
127
+ return f(M, { key: "c60eb0c2f7929884b9ac702c50451ab6e09a2b6c" }, f("slot", { key: "7c5e0f6dfb81b7e3e4dd67a700b78e1143e2bf53" }));
128
+ }
129
+ get host() {
130
+ return _(this);
131
+ }
132
+ };
133
+ D.style = k;
134
+ export {
135
+ D as nylas_mailbox
136
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-7a55dc33.cjs"),f=require("./index.es-2578c6a5-098d48d0.cjs"),x=require("./utils-c00bdc3c-94b9c3b6.cjs"),n=require("./mailbox-store-bb21512c-045c3ea0.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class _{constructor(e,s,r,l){this.router=e,this.nylasAuth=s,this.nylasAuthStore=r,this.nylasMailboxStore=l}init(){x.debug("NylasMailboxConnector init")}get mailboxStore(){return this.nylasMailboxStore}get authStore(){return this.nylasAuthStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new n.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get threads(){return this._threadConnector?this._threadConnector:(this._threadConnector=new n.NylasThreadsConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore,this.router),this._threadConnector)}get messages(){return this._messageConnector?this._messageConnector:(this._messageConnector=new n.NylasMessagesConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._messageConnector)}get folders(){return this._foldersConnector?this._foldersConnector:(this._foldersConnector=new n.NylasFoldersConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._foldersConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasMailboxStore.reset(),this.nylasAuthStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const p=":host{display:contents}",w=p,A=class{constructor(t){o.registerInstance(this,t),this.init=o.createEvent(this,"init",7),this.loggedIn=o.createEvent(this,"loggedIn",7),this.loggedOut=o.createEvent(this,"loggedOut",7),this.handleAuthChange=async e=>{var s;e?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host).defaultPrevented||await((s=this.nylasMailboxConnector)==null?void 0:s.logout())},this.automaticComponentRegistration=!0,this.eventOverrides={},this.authConfig=void 0,this.defaultAuthStoreState=void 0,this.defaultMailboxStoreState=void 0}connectedCallback(){x.debug("[nylas-mailbox] connectedCallback")}async componentWillLoad(){var r,l,d,c,y,g,b;this.stores={auth:n.CreateNylasAuthStore(this.defaultAuthStoreState),mailbox:n.CreateNylasMailboxStore(this.defaultMailboxStoreState)},this.baseProvider=new f.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.router=new n.HashRouter,this.nylasAuth=f.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const t=(r=this.baseProvider)==null?void 0:r.getStore("auth");if(!t)throw new Error("Auth store is not defined");const e=(l=this.baseProvider)==null?void 0:l.getStore("mailbox");if(!e)throw new Error("Mailbox store is not defined");this.nylasMailboxConnector=new _(this.router,this.nylasAuth,t,e),this.init.emit(this.host).defaultPrevented||await((d=this.nylasMailboxConnector)==null?void 0:d.auth.validateSession()),(c=this.router)==null||c.addRouteChangeListener("/thread/:threadId",async(M,v,C)=>{var a,h;const u=C.threadId,i=await((a=this.nylasMailboxConnector)==null?void 0:a.threads.getThread(u));i&&((h=this.nylasMailboxConnector)==null||h.mailboxStore.set("selectedThread",i))}),(y=this.router)==null||y.addRouteChangeListener("/",async(M,v,C)=>{var i,a,h,S;if(!t.state.isAuthenticated)return;(i=this.nylasMailboxConnector)==null||i.threads.unSelectThread(),(a=this.nylasMailboxConnector)==null||a.folders.getFolders();const u=window.location.hash.split("?")[1];if(u){const m=new URLSearchParams(u).get("query");m&&await((h=this.nylasMailboxConnector)==null?void 0:h.threads.getThreads({search_query_native:m,page_token:void 0}))}else(S=this.nylasMailboxConnector)==null||S.threads.getThreads()}),(g=this.router)==null||g.init(),this.handleAuthChange(t.state.isAuthenticated),(b=this.baseProvider)==null||b.componentWillLoad(this.nylasMailboxConnector)}async componentDidLoad(){var e,s;const t=(e=this.baseProvider)==null?void 0:e.getStore("auth");if(!t)throw new Error("Auth store is not defined");t.onChange("isAuthenticated",this.handleAuthChange),(s=this.baseProvider)==null||s.componentDidLoad()}componentDisconnected(){var t;(t=this.baseProvider)==null||t.componentDisconnected()}async registerComponentHandler(t){var e;(e=this.baseProvider)==null||e.registerComponent(t.detail)}async unregisterComponentHandler(t){var e;(e=this.baseProvider)==null||e.unregisterComponent(t.detail)}async getMailboxStore(){var t;return(t=this.baseProvider)==null?void 0:t.getStore("mailbox")}async getAuthStore(){var t;return(t=this.baseProvider)==null?void 0:t.getStore("auth")}async getNylasAuth(){return this.nylasAuth}async getNylasMailboxConnector(){return this.nylasMailboxConnector}render(){return o.h(o.Host,{key:"c60eb0c2f7929884b9ac702c50451ab6e09a2b6c"},o.h("slot",{key:"7c5e0f6dfb81b7e3e4dd67a700b78e1143e2bf53"}))}get host(){return o.getElement(this)}};A.style=w;exports.nylas_mailbox=A;
@@ -1,16 +1,18 @@
1
- import { r as y, c as i, h as d, H as g, g as C } from "./index-630f4e87.js";
2
- import { N as m, e as S } from "./index-b30d446a-a90f84b2.js";
3
- import { d as a } from "./utils-5074a070-ce33ee6b.js";
4
- import { C as A, a as b, H as p, N as f, b as v, c as P, d as _ } from "./mailbox-store-19f0c6c9-e3e8b4e5.js";
5
- import { C as N, N as w } from "./scheduler-store-7d48e682-0c0c3991.js";
1
+ import { r as C, c as a, h as g, H as S, g as m } from "./index-0f3bd8df.js";
2
+ import { N as f, e as b } from "./index.es-2578c6a5-71441142.js";
3
+ import { d as h } from "./utils-c00bdc3c-89ab163d.js";
4
+ import { C as p, a as A, H as v, N as P, b as _, c as N, d as w } from "./mailbox-store-bb21512c-615660ef.js";
5
+ import { C as x, N as I } from "./scheduler-store-72116723-3ba2480c.js";
6
+ import { C as M } from "./scheduler-config-store-51ee4f42-e02895da.js";
6
7
  import "react";
7
8
  import "react-dom";
8
- class x {
9
- constructor(e, s, r, h, o, n = "https://scheduler.nylas.com") {
10
- this.router = e, this.schedulerAPIURL = n, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = h, this.nylasSchedulerStore = o;
9
+ import "./_commonjsHelpers-57e89916-af061c86.js";
10
+ class E {
11
+ constructor(e, s, r, o, l, n, i = "https://api.us.nylas.com") {
12
+ this.router = e, this.schedulerAPIURL = i, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = o, this.nylasSchedulerStore = l, this.nylasSchedulerConfigStore = n;
11
13
  }
12
14
  init() {
13
- a("NylasConnector init");
15
+ h("NylasConnector init");
14
16
  }
15
17
  get authStore() {
16
18
  return this.nylasAuthStore;
@@ -21,20 +23,23 @@ class x {
21
23
  get schedulerStore() {
22
24
  return this.nylasSchedulerStore;
23
25
  }
26
+ get schedulerConfigStore() {
27
+ return this.nylasSchedulerConfigStore;
28
+ }
24
29
  get auth() {
25
- return this._authConnector ? this._authConnector : (this._authConnector = new f(this.nylasAuth, this.nylasAuthStore), this._authConnector);
30
+ return this._authConnector ? this._authConnector : (this._authConnector = new P(this.nylasAuth, this.nylasAuthStore), this._authConnector);
26
31
  }
27
32
  get threads() {
28
- return this._threadConnector ? this._threadConnector : (this._threadConnector = new v(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
33
+ return this._threadConnector ? this._threadConnector : (this._threadConnector = new _(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
29
34
  }
30
35
  get messages() {
31
- return this._messageConnector ? this._messageConnector : (this._messageConnector = new P(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
36
+ return this._messageConnector ? this._messageConnector : (this._messageConnector = new N(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
32
37
  }
33
38
  get folders() {
34
- return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new _(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
39
+ return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new w(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
35
40
  }
36
41
  get scheduler() {
37
- return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new w({
42
+ return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new I({
38
43
  schedulerAPIURL: this.schedulerAPIURL,
39
44
  schedulerStore: this.schedulerStore
40
45
  }), this._schedulerAPIConnector);
@@ -49,24 +54,25 @@ class x {
49
54
  await this.nylasAuth.logout(), this.resetStores();
50
55
  }
51
56
  }
52
- const I = ":host{display:contents}", M = I, L = class {
57
+ const L = ":host{display:contents}", R = L, T = class {
53
58
  constructor(t) {
54
- y(this, t), this.init = i(this, "init", 7), this.loggedIn = i(this, "loggedIn", 7), this.loggedOut = i(this, "loggedOut", 7), this.handleAuthChange = async (e) => {
59
+ C(this, t), this.init = a(this, "init", 7), this.loggedIn = a(this, "loggedIn", 7), this.loggedOut = a(this, "loggedOut", 7), this.handleAuthChange = async (e) => {
55
60
  e ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host);
56
61
  }, this.authConfig = void 0, this.eventOverrides = {}, this.automaticComponentRegistration = !0;
57
62
  }
58
63
  connectedCallback() {
59
- a("[nylas-provider] connectedCallback");
64
+ h("[nylas-provider] connectedCallback");
60
65
  }
61
66
  async componentWillLoad() {
62
- var o, n, l, c, u;
63
- a("[nylas-provider] componentWillLoad"), this.stores = {
64
- auth: A(),
65
- mailbox: b(),
66
- scheduler: N()
67
- }, this.baseProvider = new m(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
68
- const t = new p();
69
- this.nylasAuth = S({
67
+ var n, i, c, u, d, y;
68
+ h("[nylas-provider] componentWillLoad"), this.stores = {
69
+ auth: p(),
70
+ mailbox: A(),
71
+ scheduler: x(),
72
+ schedulerConfig: M()
73
+ }, this.baseProvider = new f(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
74
+ const t = new v();
75
+ this.nylasAuth = b({
70
76
  apiUri: "https://api.us.nylas.com",
71
77
  elementsApiUri: "https://elements.us.nylas.com",
72
78
  storageType: "indexeddb",
@@ -75,16 +81,19 @@ const I = ":host{display:contents}", M = I, L = class {
75
81
  redirectURI: "/",
76
82
  ...this.authConfig
77
83
  });
78
- const e = (o = this.baseProvider) == null ? void 0 : o.getStore("mailbox");
84
+ const e = (n = this.baseProvider) == null ? void 0 : n.getStore("mailbox");
79
85
  if (!e)
80
86
  throw new Error("The mailbox store is not set");
81
- const s = (n = this.baseProvider) == null ? void 0 : n.getStore("auth");
87
+ const s = (i = this.baseProvider) == null ? void 0 : i.getStore("auth");
82
88
  if (!s)
83
89
  throw new Error("The auth store is not set");
84
- const r = (l = this.baseProvider) == null ? void 0 : l.getStore("scheduler");
90
+ const r = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler");
85
91
  if (!r)
86
92
  throw new Error("The scheduler store is not set");
87
- this.nylasConnector = new x(t, this.nylasAuth, s, e, r), this.init.emit(this.host).defaultPrevented || await ((c = this.nylasConnector) == null ? void 0 : c.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (u = this.baseProvider) == null || u.componentWillLoad(this.nylasConnector);
93
+ const o = (u = this.baseProvider) == null ? void 0 : u.getStore("schedulerConfig");
94
+ if (!o)
95
+ throw new Error("The scheduler config store is not set");
96
+ this.nylasConnector = new E(t, this.nylasAuth, s, e, r, o), this.init.emit(this.host).defaultPrevented || await ((d = this.nylasConnector) == null ? void 0 : d.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (y = this.baseProvider) == null || y.componentWillLoad(this.nylasConnector);
88
97
  }
89
98
  componentDidLoad() {
90
99
  var e, s;
@@ -121,14 +130,18 @@ const I = ":host{display:contents}", M = I, L = class {
121
130
  var t;
122
131
  return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
123
132
  }
133
+ async getNylasSchedulerConfigStore() {
134
+ var t;
135
+ return (t = this.baseProvider) == null ? void 0 : t.getStore("schedulerConfig");
136
+ }
124
137
  render() {
125
- return d(g, { key: "5428aca07aa5a047a2912685b1d4475a19ac7783" }, d("slot", { key: "6e15b9b39a557f02de8c1ea07973d27fdf0451f7" }));
138
+ return g(S, { key: "cf7646d512fe6614ad4a73ac63c3581f20af1ab2" }, g("slot", { key: "bf17dda1b22695e9862a549866fcd140b5d2e0db" }));
126
139
  }
127
140
  get host() {
128
- return C(this);
141
+ return m(this);
129
142
  }
130
143
  };
131
- L.style = M;
144
+ T.style = R;
132
145
  export {
133
- L as nylas_provider
146
+ T as nylas_provider
134
147
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-7a55dc33.cjs"),S=require("./index.es-2578c6a5-098d48d0.cjs"),l=require("./utils-c00bdc3c-94b9c3b6.cjs"),o=require("./mailbox-store-bb21512c-045c3ea0.cjs"),C=require("./scheduler-store-72116723-db9d91f6.cjs"),f=require("./scheduler-config-store-51ee4f42-ce3a9b0e.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class m{constructor(t,s,n,i,c,h,a="https://api.us.nylas.com"){this.router=t,this.schedulerAPIURL=a,this.nylasAuth=s,this.nylasAuthStore=n,this.nylasMailboxStore=i,this.nylasSchedulerStore=c,this.nylasSchedulerConfigStore=h}init(){l.debug("NylasConnector init")}get authStore(){return this.nylasAuthStore}get mailboxStore(){return this.nylasMailboxStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new o.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get threads(){return this._threadConnector?this._threadConnector:(this._threadConnector=new o.NylasThreadsConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore,this.router),this._threadConnector)}get messages(){return this._messageConnector?this._messageConnector:(this._messageConnector=new o.NylasMessagesConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._messageConnector)}get folders(){return this._foldersConnector?this._foldersConnector:(this._foldersConnector=new o.NylasFoldersConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._foldersConnector)}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new C.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore}),this._schedulerAPIConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset(),this.nylasMailboxStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const A=":host{display:contents}",v=A,b=class{constructor(e){r.registerInstance(this,e),this.init=r.createEvent(this,"init",7),this.loggedIn=r.createEvent(this,"loggedIn",7),this.loggedOut=r.createEvent(this,"loggedOut",7),this.handleAuthChange=async t=>{t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host)},this.authConfig=void 0,this.eventOverrides={},this.automaticComponentRegistration=!0}connectedCallback(){l.debug("[nylas-provider] connectedCallback")}async componentWillLoad(){var h,a,u,d,y,g;l.debug("[nylas-provider] componentWillLoad"),this.stores={auth:o.CreateNylasAuthStore(),mailbox:o.CreateNylasMailboxStore(),scheduler:C.CreateNylasSchedulerStore(),schedulerConfig:f.CreateNylasSchedulerConfigStore()},this.baseProvider=new S.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=new o.HashRouter;this.nylasAuth=S.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const t=(h=this.baseProvider)==null?void 0:h.getStore("mailbox");if(!t)throw new Error("The mailbox store is not set");const s=(a=this.baseProvider)==null?void 0:a.getStore("auth");if(!s)throw new Error("The auth store is not set");const n=(u=this.baseProvider)==null?void 0:u.getStore("scheduler");if(!n)throw new Error("The scheduler store is not set");const i=(d=this.baseProvider)==null?void 0:d.getStore("schedulerConfig");if(!i)throw new Error("The scheduler config store is not set");this.nylasConnector=new m(e,this.nylasAuth,s,t,n,i),this.init.emit(this.host).defaultPrevented||await((y=this.nylasConnector)==null?void 0:y.auth.validateSession()),this.handleAuthChange(s.state.isAuthenticated),(g=this.baseProvider)==null||g.componentWillLoad(this.nylasConnector)}componentDidLoad(){var t,s;const e=(t=this.baseProvider)==null?void 0:t.getStore("auth");e==null||e.onChange("isAuthenticated",this.handleAuthChange),(s=this.baseProvider)==null||s.componentDidLoad()}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}async registerComponentHandler(e){var t;(t=this.baseProvider)==null||t.registerComponent(e.detail)}async unregisterComponentHandler(e){var t;(t=this.baseProvider)==null||t.unregisterComponent(e.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getMailboxStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("mailbox")}async getAuthStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("auth")}async getNylasSchedulerStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("scheduler")}async getNylasSchedulerConfigStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("schedulerConfig")}render(){return r.h(r.Host,{key:"cf7646d512fe6614ad4a73ac63c3581f20af1ab2"},r.h("slot",{key:"bf17dda1b22695e9862a549866fcd140b5d2e0db"}))}get host(){return r.getElement(this)}};b.style=v;exports.nylas_provider=b;