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

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 (131) hide show
  1. package/dist/elements/index.js +92 -0
  2. package/dist/elements/index.js.map +1 -0
  3. package/dist/elements/react-component-lib/createComponent.js +65 -0
  4. package/dist/elements/react-component-lib/createComponent.js.map +1 -0
  5. package/dist/elements/react-component-lib/createOverlayComponent.js +98 -0
  6. package/dist/elements/react-component-lib/createOverlayComponent.js.map +1 -0
  7. package/dist/elements/react-component-lib/index.js +3 -0
  8. package/dist/elements/react-component-lib/index.js.map +1 -0
  9. package/dist/elements/react-component-lib/interfaces.js +2 -0
  10. package/dist/elements/react-component-lib/interfaces.js.map +1 -0
  11. package/dist/elements/react-component-lib/utils/attachProps.js +92 -0
  12. package/dist/elements/react-component-lib/utils/attachProps.js.map +1 -0
  13. package/dist/elements/react-component-lib/utils/case.js +7 -0
  14. package/dist/elements/react-component-lib/utils/case.js.map +1 -0
  15. package/dist/elements/react-component-lib/utils/dev.js +13 -0
  16. package/dist/elements/react-component-lib/utils/dev.js.map +1 -0
  17. package/dist/elements/react-component-lib/utils/index.js +31 -0
  18. package/dist/elements/react-component-lib/utils/index.js.map +1 -0
  19. package/dist/index.js +29 -0
  20. package/dist/index.js.map +1 -0
  21. package/package.json +8 -12
  22. package/dist/add-circle-icon_22.entry-080abc71.cjs +0 -1
  23. package/dist/add-circle-icon_22.entry-bda9be31.js +0 -1818
  24. package/dist/archive-icon_7.entry-ca20da59.cjs +0 -1
  25. package/dist/archive-icon_7.entry-e2954750.js +0 -75
  26. package/dist/arrow-icon.entry-03a85113.js +0 -15
  27. package/dist/arrow-icon.entry-548b027e.cjs +0 -1
  28. package/dist/bold-icon_3.entry-70ffa7f0.js +0 -35
  29. package/dist/bold-icon_3.entry-9a7b1869.cjs +0 -1
  30. package/dist/calendar-cancel-icon.entry-45388fdc.cjs +0 -1
  31. package/dist/calendar-cancel-icon.entry-6bbc119f.js +0 -15
  32. package/dist/calendar-check-icon_2.entry-6628456c.cjs +0 -1
  33. package/dist/calendar-check-icon_2.entry-f633f7a6.js +0 -25
  34. package/dist/calendar-icon.entry-379b1fa1.cjs +0 -1
  35. package/dist/calendar-icon.entry-62b82c27.js +0 -15
  36. package/dist/chevron-icon_3.entry-74425e1f.js +0 -117
  37. package/dist/chevron-icon_3.entry-7ff803ad.cjs +0 -1
  38. package/dist/close-icon.entry-18e140ed.cjs +0 -1
  39. package/dist/close-icon.entry-6a8ea4a7.js +0 -15
  40. package/dist/constants-f34b9c6e-95a17764.js +0 -3749
  41. package/dist/constants-f34b9c6e-e7137e51.cjs +0 -15
  42. package/dist/core-js-38e53e34.cjs +0 -4
  43. package/dist/core-js-a9d3b6e1.js +0 -3297
  44. package/dist/document-refresh-icon.entry-32c75418.js +0 -15
  45. package/dist/document-refresh-icon.entry-f15f795a.cjs +0 -1
  46. package/dist/dom-68f08be9.cjs +0 -15
  47. package/dist/dom-86e17616.js +0 -664
  48. package/dist/elements-dc5b338e-1f23530f.cjs +0 -16516
  49. package/dist/elements-dc5b338e-62fe1cf3.js +0 -28031
  50. package/dist/flow-40ff9cea-6f8c30e2.cjs +0 -9
  51. package/dist/flow-40ff9cea-ee70fdf5.js +0 -505
  52. package/dist/focus-visible-e8093c16-1f664070.js +0 -84
  53. package/dist/focus-visible-e8093c16-f0f05815.cjs +0 -1
  54. package/dist/forward-icon_6.entry-7fab04d7.js +0 -953
  55. package/dist/forward-icon_6.entry-ef5e2e0f.cjs +0 -3
  56. package/dist/globe-icon.entry-398a9826.cjs +0 -1
  57. package/dist/globe-icon.entry-b8e1efae.js +0 -15
  58. package/dist/google-logo-icon_4.entry-38d5c2f2.cjs +0 -1
  59. package/dist/google-logo-icon_4.entry-5eca9538.js +0 -381
  60. package/dist/index-93c50de4.cjs +0 -37
  61. package/dist/index-f93f6948.js +0 -4006
  62. package/dist/index.es-df564f87-b773d34f.js +0 -3137
  63. package/dist/index.es-df564f87-e4a4092a.cjs +0 -7
  64. package/dist/info-icon_2.entry-2eb70f49.cjs +0 -1
  65. package/dist/info-icon_2.entry-6bbfa6dc.js +0 -34
  66. package/dist/loading-icon.entry-b563b2e6.js +0 -15
  67. package/dist/loading-icon.entry-fb04b893.cjs +0 -1
  68. package/dist/mailbox-store-69c5c5f6-631eddb5.cjs +0 -1
  69. package/dist/mailbox-store-69c5c5f6-8ab4670b.js +0 -380
  70. package/dist/nylas-additional-participants.entry-33a45477.cjs +0 -1
  71. package/dist/nylas-additional-participants.entry-4b214308.js +0 -81
  72. package/dist/nylas-booked-event-card_10.entry-3e225025.cjs +0 -1
  73. package/dist/nylas-booked-event-card_10.entry-e93bc290.js +0 -782
  74. package/dist/nylas-form-card.entry-0748fdd5.js +0 -54
  75. package/dist/nylas-form-card.entry-eb3607bc.cjs +0 -1
  76. package/dist/nylas-if-state.entry-276d61ad.cjs +0 -1
  77. package/dist/nylas-if-state.entry-f8abd025.js +0 -94
  78. package/dist/nylas-list-folders.entry-78cc680e.js +0 -120
  79. package/dist/nylas-list-folders.entry-afe02f0e.cjs +0 -1
  80. package/dist/nylas-list-threads.entry-217088de.js +0 -70
  81. package/dist/nylas-list-threads.entry-6395c12f.cjs +0 -1
  82. package/dist/nylas-login.entry-e4d57589.js +0 -73
  83. package/dist/nylas-login.entry-ec81e21b.cjs +0 -1
  84. package/dist/nylas-mailbox-pagination.entry-069673aa.js +0 -101
  85. package/dist/nylas-mailbox-pagination.entry-d4d929f1.cjs +0 -1
  86. package/dist/nylas-mailbox-toolbar-button.entry-03c5f5c8.js +0 -82
  87. package/dist/nylas-mailbox-toolbar-button.entry-2b9e4431.cjs +0 -1
  88. package/dist/nylas-mailbox.entry-1342178d.cjs +0 -1
  89. package/dist/nylas-mailbox.entry-7e6b4791.js +0 -134
  90. package/dist/nylas-provider.entry-0ae8e70a.cjs +0 -1
  91. package/dist/nylas-provider.entry-498a7be9.js +0 -145
  92. package/dist/nylas-scheduler-editor.entry-4de2bb97.js +0 -2275
  93. package/dist/nylas-scheduler-editor.entry-72c91b7d.cjs +0 -7
  94. package/dist/nylas-scheduling.entry-1a004916.cjs +0 -1
  95. package/dist/nylas-scheduling.entry-4e18ab43.js +0 -235
  96. package/dist/nylas-threads-refresh.entry-d020c89e.cjs +0 -1
  97. package/dist/nylas-threads-refresh.entry-fc2d8028.js +0 -74
  98. package/dist/nylas-threads-search.entry-0abcbc10.cjs +0 -1
  99. package/dist/nylas-threads-search.entry-f92f7e30.js +0 -69
  100. package/dist/nylas-view-thread.entry-2f1474cf.js +0 -203
  101. package/dist/nylas-view-thread.entry-56080c89.cjs +0 -1
  102. package/dist/people-icon.entry-431e5044.cjs +0 -1
  103. package/dist/people-icon.entry-b4778e15.js +0 -15
  104. package/dist/play-icon_2.entry-24ffa01f.js +0 -25
  105. package/dist/play-icon_2.entry-f97db395.cjs +0 -1
  106. package/dist/react.cjs +0 -1
  107. package/dist/react.js +0 -98
  108. package/dist/refresh-icon.entry-8395104b.js +0 -15
  109. package/dist/refresh-icon.entry-cf4416b8.cjs +0 -1
  110. package/dist/register-component-b9cfcbaf-c0147194.js +0 -109
  111. package/dist/register-component-b9cfcbaf-d40e1f3c.cjs +0 -1
  112. package/dist/scheduler-config-store-07d98279-0610e42f.cjs +0 -1
  113. package/dist/scheduler-config-store-07d98279-3b70606c.js +0 -24
  114. package/dist/scheduler-store-24fd0e91-2dba20c2.cjs +0 -1
  115. package/dist/scheduler-store-24fd0e91-47098841.js +0 -302
  116. package/dist/time-period-selector.entry-1e849c2e.js +0 -76
  117. package/dist/time-period-selector.entry-d8f3462f.cjs +0 -1
  118. package/dist/translate-icon.entry-66533238.cjs +0 -1
  119. package/dist/translate-icon.entry-d847f706.js +0 -15
  120. package/dist/warning-icon.entry-1f0f00ed.cjs +0 -1
  121. package/dist/warning-icon.entry-b5db0151.js +0 -15
  122. /package/dist/{elements → types/elements}/index.d.ts +0 -0
  123. /package/dist/{elements → types/elements}/react-component-lib/createComponent.d.ts +0 -0
  124. /package/dist/{elements → types/elements}/react-component-lib/createOverlayComponent.d.ts +0 -0
  125. /package/dist/{elements → types/elements}/react-component-lib/index.d.ts +0 -0
  126. /package/dist/{elements → types/elements}/react-component-lib/interfaces.d.ts +0 -0
  127. /package/dist/{elements → types/elements}/react-component-lib/utils/attachProps.d.ts +0 -0
  128. /package/dist/{elements → types/elements}/react-component-lib/utils/case.d.ts +0 -0
  129. /package/dist/{elements → types/elements}/react-component-lib/utils/dev.d.ts +0 -0
  130. /package/dist/{elements → types/elements}/react-component-lib/utils/index.d.ts +0 -0
  131. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
@@ -1,82 +0,0 @@
1
- import { r as f, d as c, h as l, H as y, g as u } from "./index-f93f6948.js";
2
- import { R as m } from "./register-component-b9cfcbaf-c0147194.js";
3
- import "react";
4
- import "react-dom";
5
- const h = ":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}", p = h;
6
- var g = function(t, o, e, n) {
7
- var r = arguments.length, a = r < 3 ? o : n === null ? n = Object.getOwnPropertyDescriptor(o, e) : n, s;
8
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
9
- a = Reflect.decorate(t, o, e, n);
10
- else
11
- for (var i = t.length - 1; i >= 0; i--)
12
- (s = t[i]) && (a = (r < 3 ? s(a) : r > 3 ? s(o, e, a) : s(o, e)) || a);
13
- return r > 3 && a && Object.defineProperty(o, e, a), a;
14
- }, d = function(t, o) {
15
- if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
16
- return Reflect.metadata(t, o);
17
- };
18
- const b = class {
19
- constructor(t) {
20
- f(this, t), this.onClick = async () => {
21
- const o = this.method;
22
- if (c("[nylas-mailbox-toolbar-button] onClick", { method: o, mailboxConnector: this.mailboxConnector }), this.mailboxConnector && o) {
23
- const e = this.callMethod(this.mailboxConnector, o);
24
- e && await e();
25
- }
26
- }, this.method = void 0, this.dataState = void 0, this.iconOnly = !1, this.mailboxConnector = void 0;
27
- }
28
- connectedCallback() {
29
- }
30
- disconnectedCallback() {
31
- }
32
- async componentWillLoad() {
33
- c("[nylas-if-state] Component will load");
34
- }
35
- async componentDidLoad() {
36
- c("[nylas-if-state] Component did load");
37
- }
38
- callMethod(t, o) {
39
- const e = o.split(".");
40
- let n = t;
41
- for (const s of e.slice(0, -1))
42
- if (n = n[s], !n)
43
- return;
44
- const r = e[e.length - 1], a = n[r];
45
- if (typeof a == "function")
46
- return a.bind(n);
47
- }
48
- renderByState(t) {
49
- return t ? l("slot", { name: "loading" }, "Loading...") : l("slot", null, "Click");
50
- }
51
- hasSlot(t) {
52
- return !!this.host.querySelector(`[slot="${t}"]`);
53
- }
54
- render() {
55
- var n;
56
- let t = !1;
57
- const o = (n = this.mailboxConnector) == null ? void 0 : n.nylasMailboxStore;
58
- if (typeof o < "u") {
59
- const r = String(this.dataState);
60
- t = this.dataState ? o.get(r) === "loading" : !1;
61
- }
62
- const e = t ? "state-loading" : "state-ready";
63
- return l(y, { key: "2454ef2e4270d1642cabe57dacf53908fcdb34e6" }, l("sp-theme", { key: "97d71094fabc3466b87142dfdd1d0bb22659fd32", 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))));
64
- }
65
- get host() {
66
- return u(this);
67
- }
68
- };
69
- g([
70
- m({
71
- name: "nylas-mailbox-toolbar-button",
72
- connectorToProp: "mailboxConnector",
73
- fireRegisterEvent: !0
74
- }),
75
- d("design:type", Function),
76
- d("design:paramtypes", []),
77
- d("design:returntype", void 0)
78
- ], b.prototype, "render", null);
79
- b.style = p;
80
- export {
81
- b as nylas_mailbox_toolbar_button
82
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-93c50de4.cjs"),u=require("./register-component-b9cfcbaf-d40e1f3c.cjs");require("react");require("react-dom");const b=":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}",y=b;var f=function(t,o,e,n){var l=arguments.length,a=l<3?o:n===null?n=Object.getOwnPropertyDescriptor(o,e):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,o,e,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(l<3?i(a):l>3?i(o,e,a):i(o,e))||a);return l>3&&a&&Object.defineProperty(o,e,a),a},c=function(t,o){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,o)};const d=class{constructor(t){r.registerInstance(this,t),this.onClick=async()=>{const o=this.method;if(r.debug("[nylas-mailbox-toolbar-button] onClick",{method:o,mailboxConnector:this.mailboxConnector}),this.mailboxConnector&&o){const e=this.callMethod(this.mailboxConnector,o);e&&await e()}},this.method=void 0,this.dataState=void 0,this.iconOnly=!1,this.mailboxConnector=void 0}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){r.debug("[nylas-if-state] Component will load")}async componentDidLoad(){r.debug("[nylas-if-state] Component did load")}callMethod(t,o){const e=o.split(".");let n=t;for(const i of e.slice(0,-1))if(n=n[i],!n)return;const l=e[e.length-1],a=n[l];if(typeof a=="function")return a.bind(n)}renderByState(t){return t?r.h("slot",{name:"loading"},"Loading..."):r.h("slot",null,"Click")}hasSlot(t){return!!this.host.querySelector(`[slot="${t}"]`)}render(){var n;let t=!1;const o=(n=this.mailboxConnector)==null?void 0:n.nylasMailboxStore;if(typeof o<"u"){const l=String(this.dataState);t=this.dataState?o.get(l)==="loading":!1}const e=t?"state-loading":"state-ready";return r.h(r.Host,{key:"2454ef2e4270d1642cabe57dacf53908fcdb34e6"},r.h("sp-theme",{key:"97d71094fabc3466b87142dfdd1d0bb22659fd32",scale:"medium",color:"dark"},r.h("sp-button",{onClick:this.onClick,disabled:t,key:e,"icon-only":this.iconOnly,label:this.renderByState(t)},this.hasSlot("icon")&&r.h("div",{slot:"icon",class:"slot"},r.h("slot",{name:"icon"})),!this.iconOnly&&this.renderByState(t))))}get host(){return r.getElement(this)}};f([u.RegisterComponent({name:"nylas-mailbox-toolbar-button",connectorToProp:"mailboxConnector",fireRegisterEvent:!0}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],d.prototype,"render",null);d.style=y;exports.nylas_mailbox_toolbar_button=d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-93c50de4.cjs"),m=require("./index.es-df564f87-e4a4092a.cjs"),n=require("./mailbox-store-69c5c5f6-631eddb5.cjs");require("react");require("react-dom");class v{constructor(e,o,r,l){this.router=e,this.nylasAuth=o,this.nylasAuthStore=r,this.nylasMailboxStore=l}init(){s.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 _=":host{display:contents}",p=_,x=class{constructor(t){s.registerInstance(this,t),this.init=s.createEvent(this,"init",7),this.loggedIn=s.createEvent(this,"loggedIn",7),this.loggedOut=s.createEvent(this,"loggedOut",7),this.handleAuthChange=async e=>{var o;e?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host).defaultPrevented||await((o=this.nylasMailboxConnector)==null?void 0:o.logout())},this.automaticComponentRegistration=!0,this.eventOverrides={},this.authConfig=void 0,this.defaultAuthStoreState=void 0,this.defaultMailboxStoreState=void 0}connectedCallback(){s.debug("[nylas-mailbox] connectedCallback")}async componentWillLoad(){var r,l,u,c,y,g,b;this.stores={auth:n.CreateNylasAuthStore(this.defaultAuthStoreState),mailbox:n.CreateNylasMailboxStore(this.defaultMailboxStoreState)},this.baseProvider=new m.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.router=new n.HashRouter,this.nylasAuth=m.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 v(this.router,this.nylasAuth,t,e),this.init.emit(this.host).defaultPrevented||await((u=this.nylasMailboxConnector)==null?void 0:u.auth.validateSession()),(c=this.router)==null||c.addRouteChangeListener("/thread/:threadId",async(A,M,C)=>{var a,h;const d=C.threadId,i=await((a=this.nylasMailboxConnector)==null?void 0:a.threads.getThread(d));i&&((h=this.nylasMailboxConnector)==null||h.mailboxStore.set("selectedThread",i))}),(y=this.router)==null||y.addRouteChangeListener("/",async(A,M,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 d=window.location.hash.split("?")[1];if(d){const f=new URLSearchParams(d).get("query");f&&await((h=this.nylasMailboxConnector)==null?void 0:h.threads.getThreads({search_query_native:f,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,o;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),(o=this.baseProvider)==null||o.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 s.h(s.Host,{key:"662c4d3f763c5cf9db31c4d2ba26bcdf47ead164"},s.h("slot",{key:"5c2b75a569779dd2af6388648a4304721e82ba76"}))}get host(){return s.getElement(this)}};x.style=p;exports.nylas_mailbox=x;
@@ -1,134 +0,0 @@
1
- import { r as p, c as l, d as S, h as f, H as M, g as _ } from "./index-f93f6948.js";
2
- import { N as v, e as w } from "./index.es-df564f87-b773d34f.js";
3
- 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-69c5c5f6-8ab4670b.js";
4
- import "react";
5
- import "react-dom";
6
- class T {
7
- constructor(e, s, o, i) {
8
- this.router = e, this.nylasAuth = s, this.nylasAuthStore = o, this.nylasMailboxStore = i;
9
- }
10
- init() {
11
- S("NylasMailboxConnector init");
12
- }
13
- get mailboxStore() {
14
- return this.nylasMailboxStore;
15
- }
16
- get authStore() {
17
- return this.nylasAuthStore;
18
- }
19
- get auth() {
20
- return this._authConnector ? this._authConnector : (this._authConnector = new E(this.nylasAuth, this.nylasAuthStore), this._authConnector);
21
- }
22
- get threads() {
23
- return this._threadConnector ? this._threadConnector : (this._threadConnector = new L(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
24
- }
25
- get messages() {
26
- return this._messageConnector ? this._messageConnector : (this._messageConnector = new O(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
27
- }
28
- get folders() {
29
- return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new R(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
30
- }
31
- getAuth() {
32
- return this.nylasAuth;
33
- }
34
- resetStores() {
35
- this.nylasMailboxStore.reset(), this.nylasAuthStore.reset();
36
- }
37
- async logout() {
38
- await this.nylasAuth.logout(), this.resetStores();
39
- }
40
- }
41
- const H = ":host{display:contents}", k = H, D = class {
42
- constructor(t) {
43
- p(this, t), this.init = l(this, "init", 7), this.loggedIn = l(this, "loggedIn", 7), this.loggedOut = l(this, "loggedOut", 7), this.handleAuthChange = async (e) => {
44
- var s;
45
- e ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host).defaultPrevented || await ((s = this.nylasMailboxConnector) == null ? void 0 : s.logout());
46
- }, this.automaticComponentRegistration = !0, this.eventOverrides = {}, this.authConfig = void 0, this.defaultAuthStoreState = void 0, this.defaultMailboxStoreState = void 0;
47
- }
48
- connectedCallback() {
49
- S("[nylas-mailbox] connectedCallback");
50
- }
51
- async componentWillLoad() {
52
- var o, i, d, u, c, y, g;
53
- this.stores = {
54
- auth: P(this.defaultAuthStoreState),
55
- mailbox: N(this.defaultMailboxStoreState)
56
- }, this.baseProvider = new v(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.router = new I(), this.nylasAuth = w({
57
- apiUri: "https://api.us.nylas.com",
58
- elementsApiUri: "https://elements.us.nylas.com",
59
- storageType: "indexeddb",
60
- clientId: "YOUR_CLIENT_ID",
61
- defaultScopes: [],
62
- redirectURI: "/",
63
- ...this.authConfig
64
- });
65
- const t = (o = this.baseProvider) == null ? void 0 : o.getStore("auth");
66
- if (!t)
67
- throw new Error("Auth store is not defined");
68
- const e = (i = this.baseProvider) == null ? void 0 : i.getStore("mailbox");
69
- if (!e)
70
- throw new Error("Mailbox store is not defined");
71
- 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, A, b) => {
72
- var a, r;
73
- const h = b.threadId, n = await ((a = this.nylasMailboxConnector) == null ? void 0 : a.threads.getThread(h));
74
- n && ((r = this.nylasMailboxConnector) == null || r.mailboxStore.set("selectedThread", n));
75
- }), (c = this.router) == null || c.addRouteChangeListener("/", async (x, A, b) => {
76
- var n, a, r, C;
77
- if (!t.state.isAuthenticated)
78
- return;
79
- (n = this.nylasMailboxConnector) == null || n.threads.unSelectThread(), (a = this.nylasMailboxConnector) == null || a.folders.getFolders();
80
- const h = window.location.hash.split("?")[1];
81
- if (h) {
82
- const m = new URLSearchParams(h).get("query");
83
- m && await ((r = this.nylasMailboxConnector) == null ? void 0 : r.threads.getThreads({
84
- search_query_native: m,
85
- page_token: void 0
86
- }));
87
- } else
88
- (C = this.nylasMailboxConnector) == null || C.threads.getThreads();
89
- }), (y = this.router) == null || y.init(), this.handleAuthChange(t.state.isAuthenticated), (g = this.baseProvider) == null || g.componentWillLoad(this.nylasMailboxConnector);
90
- }
91
- async componentDidLoad() {
92
- var e, s;
93
- const t = (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
94
- if (!t)
95
- throw new Error("Auth store is not defined");
96
- t.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
97
- }
98
- componentDisconnected() {
99
- var t;
100
- (t = this.baseProvider) == null || t.componentDisconnected();
101
- }
102
- async registerComponentHandler(t) {
103
- var e;
104
- (e = this.baseProvider) == null || e.registerComponent(t.detail);
105
- }
106
- async unregisterComponentHandler(t) {
107
- var e;
108
- (e = this.baseProvider) == null || e.unregisterComponent(t.detail);
109
- }
110
- async getMailboxStore() {
111
- var t;
112
- return (t = this.baseProvider) == null ? void 0 : t.getStore("mailbox");
113
- }
114
- async getAuthStore() {
115
- var t;
116
- return (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
117
- }
118
- async getNylasAuth() {
119
- return this.nylasAuth;
120
- }
121
- async getNylasMailboxConnector() {
122
- return this.nylasMailboxConnector;
123
- }
124
- render() {
125
- return f(M, { key: "662c4d3f763c5cf9db31c4d2ba26bcdf47ead164" }, f("slot", { key: "5c2b75a569779dd2af6388648a4304721e82ba76" }));
126
- }
127
- get host() {
128
- return _(this);
129
- }
130
- };
131
- D.style = k;
132
- export {
133
- D as nylas_mailbox
134
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-93c50de4.cjs"),g=require("./index.es-df564f87-e4a4092a.cjs"),o=require("./mailbox-store-69c5c5f6-631eddb5.cjs"),S=require("./scheduler-store-24fd0e91-2dba20c2.cjs"),b=require("./scheduler-config-store-07d98279-0610e42f.cjs");require("react");require("react-dom");class f{constructor(t,r,n,i,l,h,a="https://api.us.nylas.com"){this.router=t,this.schedulerAPIURL=a,this.nylasAuth=r,this.nylasAuthStore=n,this.nylasMailboxStore=i,this.nylasSchedulerStore=l,this.nylasSchedulerConfigStore=h}init(){s.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 S.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 m=":host{display:contents}",A=m,C=class{constructor(e){s.registerInstance(this,e),this.init=s.createEvent(this,"init",7),this.loggedIn=s.createEvent(this,"loggedIn",7),this.loggedOut=s.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(){s.debug("[nylas-provider] connectedCallback")}async componentWillLoad(){var h,a,c,u,d,y;s.debug("[nylas-provider] componentWillLoad"),this.stores={auth:o.CreateNylasAuthStore(),mailbox:o.CreateNylasMailboxStore(),scheduler:S.CreateNylasSchedulerStore(),schedulerConfig:b.CreateNylasSchedulerConfigStore()},this.baseProvider=new g.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=new o.HashRouter;this.nylasAuth=g.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 r=(a=this.baseProvider)==null?void 0:a.getStore("auth");if(!r)throw new Error("The auth store is not set");const n=(c=this.baseProvider)==null?void 0:c.getStore("scheduler");if(!n)throw new Error("The scheduler store is not set");const i=(u=this.baseProvider)==null?void 0:u.getStore("schedulerConfig");if(!i)throw new Error("The scheduler config store is not set");this.nylasConnector=new f(e,this.nylasAuth,r,t,n,i),this.init.emit(this.host).defaultPrevented||await((d=this.nylasConnector)==null?void 0:d.auth.validateSession()),this.handleAuthChange(r.state.isAuthenticated),(y=this.baseProvider)==null||y.componentWillLoad(this.nylasConnector)}componentDidLoad(){var t,r;const e=(t=this.baseProvider)==null?void 0:t.getStore("auth");e==null||e.onChange("isAuthenticated",this.handleAuthChange),(r=this.baseProvider)==null||r.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 s.h(s.Host,{key:"782d47608825fb870d87153c8d43d778dc6c2b87"},s.h("slot",{key:"2b01537d9d4a0cf4c81ad0b77ce3e6d761f3e1db"}))}get host(){return s.getElement(this)}};C.style=A;exports.nylas_provider=C;
@@ -1,145 +0,0 @@
1
- import { r as C, c as h, d as a, h as g, H as S, g as m } from "./index-f93f6948.js";
2
- import { N as b, e as f } from "./index.es-df564f87-b773d34f.js";
3
- import { C as A, a as p, H as v, N as P, b as _, c as N, d as w } from "./mailbox-store-69c5c5f6-8ab4670b.js";
4
- import { C as x, N as I } from "./scheduler-store-24fd0e91-47098841.js";
5
- import { C as M } from "./scheduler-config-store-07d98279-3b70606c.js";
6
- import "react";
7
- import "react-dom";
8
- class E {
9
- constructor(e, s, r, o, l, n, i = "https://api.us.nylas.com") {
10
- this.router = e, this.schedulerAPIURL = i, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = o, this.nylasSchedulerStore = l, this.nylasSchedulerConfigStore = n;
11
- }
12
- init() {
13
- a("NylasConnector init");
14
- }
15
- get authStore() {
16
- return this.nylasAuthStore;
17
- }
18
- get mailboxStore() {
19
- return this.nylasMailboxStore;
20
- }
21
- get schedulerStore() {
22
- return this.nylasSchedulerStore;
23
- }
24
- get schedulerConfigStore() {
25
- return this.nylasSchedulerConfigStore;
26
- }
27
- get auth() {
28
- return this._authConnector ? this._authConnector : (this._authConnector = new P(this.nylasAuth, this.nylasAuthStore), this._authConnector);
29
- }
30
- get threads() {
31
- return this._threadConnector ? this._threadConnector : (this._threadConnector = new _(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
32
- }
33
- get messages() {
34
- return this._messageConnector ? this._messageConnector : (this._messageConnector = new N(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
35
- }
36
- get folders() {
37
- return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new w(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
38
- }
39
- get scheduler() {
40
- return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new I({
41
- schedulerAPIURL: this.schedulerAPIURL,
42
- schedulerStore: this.schedulerStore
43
- }), this._schedulerAPIConnector);
44
- }
45
- getAuth() {
46
- return this.nylasAuth;
47
- }
48
- resetStores() {
49
- this.nylasAuthStore.reset(), this.nylasMailboxStore.reset();
50
- }
51
- async logout() {
52
- await this.nylasAuth.logout(), this.resetStores();
53
- }
54
- }
55
- const L = ":host{display:contents}", R = L, T = class {
56
- constructor(t) {
57
- C(this, t), this.init = h(this, "init", 7), this.loggedIn = h(this, "loggedIn", 7), this.loggedOut = h(this, "loggedOut", 7), this.handleAuthChange = async (e) => {
58
- e ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host);
59
- }, this.authConfig = void 0, this.eventOverrides = {}, this.automaticComponentRegistration = !0;
60
- }
61
- connectedCallback() {
62
- a("[nylas-provider] connectedCallback");
63
- }
64
- async componentWillLoad() {
65
- var n, i, c, d, u, y;
66
- a("[nylas-provider] componentWillLoad"), this.stores = {
67
- auth: A(),
68
- mailbox: p(),
69
- scheduler: x(),
70
- schedulerConfig: M()
71
- }, this.baseProvider = new b(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
72
- const t = new v();
73
- this.nylasAuth = f({
74
- apiUri: "https://api.us.nylas.com",
75
- elementsApiUri: "https://elements.us.nylas.com",
76
- storageType: "indexeddb",
77
- clientId: "YOUR_CLIENT_ID",
78
- defaultScopes: [],
79
- redirectURI: "/",
80
- ...this.authConfig
81
- });
82
- const e = (n = this.baseProvider) == null ? void 0 : n.getStore("mailbox");
83
- if (!e)
84
- throw new Error("The mailbox store is not set");
85
- const s = (i = this.baseProvider) == null ? void 0 : i.getStore("auth");
86
- if (!s)
87
- throw new Error("The auth store is not set");
88
- const r = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler");
89
- if (!r)
90
- throw new Error("The scheduler store is not set");
91
- const o = (d = this.baseProvider) == null ? void 0 : d.getStore("schedulerConfig");
92
- if (!o)
93
- throw new Error("The scheduler config store is not set");
94
- this.nylasConnector = new E(t, this.nylasAuth, s, e, r, o), this.init.emit(this.host).defaultPrevented || await ((u = this.nylasConnector) == null ? void 0 : u.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (y = this.baseProvider) == null || y.componentWillLoad(this.nylasConnector);
95
- }
96
- componentDidLoad() {
97
- var e, s;
98
- const t = (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
99
- t == null || t.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
100
- }
101
- componentDisconnected() {
102
- var t;
103
- (t = this.baseProvider) == null || t.componentDisconnected();
104
- }
105
- async registerComponentHandler(t) {
106
- var e;
107
- (e = this.baseProvider) == null || e.registerComponent(t.detail);
108
- }
109
- async unregisterComponentHandler(t) {
110
- var e;
111
- (e = this.baseProvider) == null || e.unregisterComponent(t.detail);
112
- }
113
- async getNylasAuth() {
114
- return this.nylasAuth;
115
- }
116
- async getNylasConnector() {
117
- return this.nylasConnector;
118
- }
119
- async getMailboxStore() {
120
- var t;
121
- return (t = this.baseProvider) == null ? void 0 : t.getStore("mailbox");
122
- }
123
- async getAuthStore() {
124
- var t;
125
- return (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
126
- }
127
- async getNylasSchedulerStore() {
128
- var t;
129
- return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
130
- }
131
- async getNylasSchedulerConfigStore() {
132
- var t;
133
- return (t = this.baseProvider) == null ? void 0 : t.getStore("schedulerConfig");
134
- }
135
- render() {
136
- return g(S, { key: "782d47608825fb870d87153c8d43d778dc6c2b87" }, g("slot", { key: "2b01537d9d4a0cf4c81ad0b77ce3e6d761f3e1db" }));
137
- }
138
- get host() {
139
- return m(this);
140
- }
141
- };
142
- T.style = R;
143
- export {
144
- T as nylas_provider
145
- };