@nylas/web-elements 1.4.2 → 1.4.4

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 (147) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +56 -27
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4842 -4822
  3. package/dist/cjs/checkmark-icon_15.cjs.entry.js +3 -3
  4. package/dist/cjs/checkmark-icon_15.cjs.entry.js.map +1 -1
  5. package/dist/cjs/google-logo-icon_6.cjs.entry.js +4 -4
  6. package/dist/cjs/input-component.cjs.entry.js +13 -2
  7. package/dist/cjs/input-component.cjs.entry.js.map +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +40 -11
  10. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nylas-event-calendar_3.cjs.entry.js +53 -24
  12. package/dist/cjs/nylas-event-calendar_3.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nylas-provider.cjs.entry.js +1 -1
  14. package/dist/cjs/nylas-scheduling.cjs.entry.js +3 -3
  15. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  16. package/dist/cjs/{scheduler-store-d6f5cff3.js → scheduler-store-5dcefe7e.js} +2 -2
  17. package/dist/cjs/{scheduler-store-d6f5cff3.js.map → scheduler-store-5dcefe7e.js.map} +1 -1
  18. package/dist/collection/components/design-system/input-component/input-component.js +13 -2
  19. package/dist/collection/components/design-system/input-component/input-component.js.map +1 -1
  20. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +40 -6
  21. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js.map +1 -1
  22. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +8 -5
  23. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -1
  24. package/dist/collection/components/scheduler-editor/nylas-event-calendar/nylas-event-calendar.js +28 -17
  25. package/dist/collection/components/scheduler-editor/nylas-event-calendar/nylas-event-calendar.js.map +1 -1
  26. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.css +15 -0
  27. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.js +13 -2
  28. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.js.map +1 -1
  29. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.css +1 -1
  30. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.js +12 -4
  31. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.js.map +1 -1
  32. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js +3 -3
  33. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js.map +1 -1
  34. package/dist/components/index.es.js +1 -1
  35. package/dist/components/input-component2.js +13 -2
  36. package/dist/components/input-component2.js.map +1 -1
  37. package/dist/components/nylas-date-picker2.js +38 -8
  38. package/dist/components/nylas-date-picker2.js.map +1 -1
  39. package/dist/components/nylas-editor-tabs-group2.js +2 -2
  40. package/dist/components/nylas-editor-tabs2.js +2 -2
  41. package/dist/components/nylas-event-calendar2.js +29 -18
  42. package/dist/components/nylas-event-calendar2.js.map +1 -1
  43. package/dist/components/nylas-event-capacity2.js +14 -3
  44. package/dist/components/nylas-event-capacity2.js.map +1 -1
  45. package/dist/components/nylas-event-timeslot2.js +14 -6
  46. package/dist/components/nylas-event-timeslot2.js.map +1 -1
  47. package/dist/components/nylas-event-title2.js +3 -3
  48. package/dist/components/nylas-event-title2.js.map +1 -1
  49. package/dist/components/nylas-list-configurations2.js +1 -1
  50. package/dist/components/nylas-locale-switch2.js +1 -1
  51. package/dist/components/nylas-scheduler-editor.js +1 -1
  52. package/dist/components/nylas-scheduling.js +3 -3
  53. package/dist/components/nylas-timeslot-picker2.js +9 -6
  54. package/dist/components/nylas-timeslot-picker2.js.map +1 -1
  55. package/dist/components/scheduler-store.js +2 -2
  56. package/dist/components/utils.js +1 -1
  57. package/dist/esm/calendar-agenda-fill-icon_36.entry.js +2 -2
  58. package/dist/esm/checkmark-icon_15.entry.js +5 -5
  59. package/dist/esm/checkmark-icon_15.entry.js.map +1 -1
  60. package/dist/esm/{feedbackSync-aa8d23d1.js → feedbackSync-57bb471a.js} +2 -2
  61. package/dist/esm/{feedbackSync-aa8d23d1.js.map → feedbackSync-57bb471a.js.map} +1 -1
  62. package/dist/esm/globe-icon_2.entry.js +1 -1
  63. package/dist/esm/google-logo-icon_6.entry.js +7 -7
  64. package/dist/esm/{index.es-6d4b50d5.js → index.es-13ff6710.js} +2 -2
  65. package/dist/esm/{index.es-6d4b50d5.js.map → index.es-13ff6710.js.map} +1 -1
  66. package/dist/esm/index.js +2 -2
  67. package/dist/esm/input-component.entry.js +14 -3
  68. package/dist/esm/input-component.entry.js.map +1 -1
  69. package/dist/esm/input-dropdown_2.entry.js +1 -1
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/multi-select-dropdown_2.entry.js +1 -1
  72. package/dist/esm/{nylas-api-request-c5400df5.js → nylas-api-request-2e5f4c7f.js} +2 -2
  73. package/dist/esm/{nylas-api-request-c5400df5.js.map → nylas-api-request-2e5f4c7f.js.map} +1 -1
  74. package/dist/esm/nylas-booked-event-card_12.entry.js +42 -13
  75. package/dist/esm/nylas-booked-event-card_12.entry.js.map +1 -1
  76. package/dist/esm/nylas-event-calendar_3.entry.js +55 -26
  77. package/dist/esm/nylas-event-calendar_3.entry.js.map +1 -1
  78. package/dist/esm/nylas-form-card.entry.js +2 -2
  79. package/dist/esm/nylas-if-state.entry.js +2 -2
  80. package/dist/esm/nylas-login.entry.js +2 -2
  81. package/dist/esm/nylas-provider.entry.js +3 -3
  82. package/dist/esm/nylas-scheduler-editor.entry.js +3 -3
  83. package/dist/esm/nylas-scheduling.entry.js +6 -6
  84. package/dist/esm/nylas-web-elements.js +1 -1
  85. package/dist/esm/{register-component-238f28de.js → register-component-02a05665.js} +2 -2
  86. package/dist/esm/{register-component-238f28de.js.map → register-component-02a05665.js.map} +1 -1
  87. package/dist/esm/{scheduler-store-82bb212a.js → scheduler-store-fe9e85a4.js} +3 -3
  88. package/dist/esm/{scheduler-store-82bb212a.js.map → scheduler-store-fe9e85a4.js.map} +1 -1
  89. package/dist/esm/textarea-component.entry.js +1 -1
  90. package/dist/esm/{utils-7d962146.js → utils-e27d0e4b.js} +2 -2
  91. package/dist/esm/{utils-7d962146.js.map → utils-e27d0e4b.js.map} +1 -1
  92. package/dist/nylas-web-elements/index.esm.js +1 -1
  93. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  94. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  95. package/dist/nylas-web-elements/{p-12bf5148.js → p-189b24e6.js} +2 -2
  96. package/dist/nylas-web-elements/p-1cbe8a56.entry.js +2 -0
  97. package/dist/nylas-web-elements/{p-d132fbaa.entry.js.map → p-1cbe8a56.entry.js.map} +1 -1
  98. package/dist/nylas-web-elements/{p-fdc35ad8.entry.js → p-23971057.entry.js} +2 -2
  99. package/dist/nylas-web-elements/{p-ba831977.entry.js → p-2dd05606.entry.js} +2 -2
  100. package/dist/nylas-web-elements/{p-797578de.js → p-388c456c.js} +2 -2
  101. package/dist/nylas-web-elements/{p-cf650f4f.js → p-3ea1c7c9.js} +2 -2
  102. package/dist/nylas-web-elements/{p-de9d8218.entry.js → p-5f683e34.entry.js} +2 -2
  103. package/dist/nylas-web-elements/{p-c2b6e0ca.entry.js → p-68ab7563.entry.js} +2 -2
  104. package/dist/nylas-web-elements/p-68ab7563.entry.js.map +1 -0
  105. package/dist/nylas-web-elements/{p-ec2c12a9.js → p-6b7fb948.js} +2 -2
  106. package/dist/nylas-web-elements/{p-cfd42146.js → p-7477410d.js} +2 -2
  107. package/dist/nylas-web-elements/{p-b62ef1be.js → p-7d9cdd23.js} +2 -2
  108. package/dist/nylas-web-elements/{p-00577fba.entry.js → p-8a7a6947.entry.js} +2 -2
  109. package/dist/nylas-web-elements/p-97f87422.entry.js +2 -0
  110. package/dist/nylas-web-elements/p-97f87422.entry.js.map +1 -0
  111. package/dist/nylas-web-elements/{p-9999c233.entry.js → p-aaf12216.entry.js} +2 -2
  112. package/dist/nylas-web-elements/{p-a452d4ea.entry.js → p-b55a87fa.entry.js} +2 -2
  113. package/dist/nylas-web-elements/p-b55a87fa.entry.js.map +1 -0
  114. package/dist/nylas-web-elements/{p-888d0c66.entry.js → p-c5f86111.entry.js} +2 -2
  115. package/dist/nylas-web-elements/{p-dd98c443.entry.js → p-cc6dbd73.entry.js} +2 -2
  116. package/dist/nylas-web-elements/{p-b59288fd.entry.js → p-d5a2cec8.entry.js} +2 -2
  117. package/dist/nylas-web-elements/{p-83216795.entry.js → p-deb33dfb.entry.js} +2 -2
  118. package/dist/nylas-web-elements/{p-83216795.entry.js.map → p-deb33dfb.entry.js.map} +1 -1
  119. package/dist/nylas-web-elements/{p-2531d4fa.entry.js → p-e2dc32d9.entry.js} +2 -2
  120. package/dist/nylas-web-elements/{p-a263330c.entry.js → p-eedabd6a.entry.js} +2 -2
  121. package/dist/nylas-web-elements/{p-355b34cb.entry.js → p-f57e68b1.entry.js} +2 -2
  122. package/dist/types/components/scheduler/nylas-date-picker/nylas-date-picker.d.ts +4 -0
  123. package/dist/types/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.d.ts +1 -0
  124. package/package.json +4 -5
  125. package/CHANGELOG.md +0 -878
  126. package/dist/nylas-web-elements/p-203beca4.entry.js +0 -2
  127. package/dist/nylas-web-elements/p-203beca4.entry.js.map +0 -1
  128. package/dist/nylas-web-elements/p-a452d4ea.entry.js.map +0 -1
  129. package/dist/nylas-web-elements/p-c2b6e0ca.entry.js.map +0 -1
  130. package/dist/nylas-web-elements/p-d132fbaa.entry.js +0 -2
  131. /package/dist/nylas-web-elements/{p-12bf5148.js.map → p-189b24e6.js.map} +0 -0
  132. /package/dist/nylas-web-elements/{p-fdc35ad8.entry.js.map → p-23971057.entry.js.map} +0 -0
  133. /package/dist/nylas-web-elements/{p-ba831977.entry.js.map → p-2dd05606.entry.js.map} +0 -0
  134. /package/dist/nylas-web-elements/{p-797578de.js.map → p-388c456c.js.map} +0 -0
  135. /package/dist/nylas-web-elements/{p-cf650f4f.js.map → p-3ea1c7c9.js.map} +0 -0
  136. /package/dist/nylas-web-elements/{p-de9d8218.entry.js.map → p-5f683e34.entry.js.map} +0 -0
  137. /package/dist/nylas-web-elements/{p-ec2c12a9.js.map → p-6b7fb948.js.map} +0 -0
  138. /package/dist/nylas-web-elements/{p-cfd42146.js.map → p-7477410d.js.map} +0 -0
  139. /package/dist/nylas-web-elements/{p-b62ef1be.js.map → p-7d9cdd23.js.map} +0 -0
  140. /package/dist/nylas-web-elements/{p-00577fba.entry.js.map → p-8a7a6947.entry.js.map} +0 -0
  141. /package/dist/nylas-web-elements/{p-9999c233.entry.js.map → p-aaf12216.entry.js.map} +0 -0
  142. /package/dist/nylas-web-elements/{p-888d0c66.entry.js.map → p-c5f86111.entry.js.map} +0 -0
  143. /package/dist/nylas-web-elements/{p-dd98c443.entry.js.map → p-cc6dbd73.entry.js.map} +0 -0
  144. /package/dist/nylas-web-elements/{p-b59288fd.entry.js.map → p-d5a2cec8.entry.js.map} +0 -0
  145. /package/dist/nylas-web-elements/{p-2531d4fa.entry.js.map → p-e2dc32d9.entry.js.map} +0 -0
  146. /package/dist/nylas-web-elements/{p-a263330c.entry.js.map → p-eedabd6a.entry.js.map} +0 -0
  147. /package/dist/nylas-web-elements/{p-355b34cb.entry.js.map → p-f57e68b1.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{r as t,c as e,h as s,H as n,a as i}from"./p-6f5a3998.js";import{N as o,e as r}from"./p-12bf5148.js";import{a as h}from"./p-ec2c12a9.js";import{N as a,C as c}from"./p-b62ef1be.js";import{c as u}from"./p-fc5bc07b.js";import{C as d}from"./p-14894041.js";import"./p-c79dcb59.js";class l{constructor(t,e){this.nylasAuth=t;this.nylasAuthStore=e}async validateSession(){const t=await this.isAccessTokenValid();if(!t){this.logout()}else{let t=await this.nylasAuth.getTokenInfo();if(t){const e=5*60*1e3;const s=Math.floor(Date.now()/1e3);if(t.expires_in&&t.expires_in-s<e){h("[NylasAuthConnectorMixin] Refreshing access token");t=await this.nylasAuth.refreshAccessToken();if(!t){h("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out.");this.logout();return}}this.nylasAuthStore.state.tokenInfo=t}}this.nylasAuthStore.state.isAuthenticated=t}async isAuthenticated(){return this.nylasAuth.isAuthenticated()}async getTokenInfo(){return this.nylasAuth.getTokenInfo()}async isAccessTokenValid(){return this.nylasAuth.isAccessTokenValid()}async logout(){await this.nylasAuth.logout()}async getHostedAuthRedirectURL(t,e,s){return this.nylasAuth.getHostedAuthRedirectURL(t,e,s)}async manageHostedAuthCodeExchange(t){const e=new URL(t);const s=e.searchParams.get("code");if(s){const t=await this.nylasAuth.exchangeAuthCodeForTokenInfo(s);if(t){this.nylasAuthStore.state.tokenInfo=t;this.nylasAuthStore.state.isAuthenticated=true;return t}}return null}}class f{constructor(t,e,s,n,i,o="https://api.us.nylas.com"){this.router=t;this.schedulerAPIURL=o;this.nylasAuth=e;this.nylasAuthStore=s;this.nylasSchedulerStore=n;this.nylasSchedulerConfigStore=i}init(){h("NylasConnector init")}get authStore(){return this.nylasAuthStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){if(this._authConnector){return this._authConnector}this._authConnector=new l(this.nylasAuth,this.nylasAuthStore);return this._authConnector}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new a({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore});return this._schedulerAPIConnector}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset()}async logout(){await this.nylasAuth.logout();this.resetStores()}}class g extends Event{constructor(t,e){super(t,e);this.oldURL=e.oldURL;this.newURL=e.newURL}}class w{constructor(){this.routeChangeListeners=[];h("HashRouter constructor")}destroy(){h("HashRouter destroy");window.removeEventListener("hashchange",this.onRouteChange.bind(this))}init(){h("HashRouter init");window.addEventListener("hashchange",this.onRouteChange.bind(this));if(typeof HashChangeEvent!=="undefined"){const t=new HashChangeEvent("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}else{const t=new g("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}}addRouteChangeListener(t,e){h("HashRouter addRouteChangeListener");this.routeChangeListeners.push([t,e])}navigate(t,e){h("HashRouter navigate");if(e){return window.history.pushState(null,"",`#${t}`)}window.location.hash=t}setRoute(t){h("HashRouter setRoute");window.location.hash=t}matchRoute(t,e){const s=t.split("/");const n=e.split("/");h(`HashRouter matchRoute route=${t} path=${e}`,{routeParts:s,pathParts:n});if(s[1]===""&&n[0]===""){return true}if(s.length!==n.length){return false}for(let t=0;t<s.length;t++){const e=s[t];const i=n[t];if(e.startsWith(":")){continue}if(e!==i){return false}}return true}getRouteParams(t){h("HashRouter getRouteParams");const e={};const s=t.split("/");const n=window.location.hash.split("/");s.forEach(((t,s)=>{if(t.startsWith(":")){const i=t.substring(1);e[i]=n[s]}}));return e}getRouteWithParams(t,e){h("HashRouter getRouteWithParams");let s=t;Object.keys(e).forEach((t=>{s=s.replace(`:${t}`,e[t])}));return s}getRoute(){h("HashRouter getRoute");return window.location.hash}onRouteChange(t){this.routeChangeListeners.forEach((async([e,s])=>{const n=t.newURL.indexOf("#")===-1?"":t.newURL.substring(t.newURL.indexOf("#")+1);h(`HashRouter onRouteChange route=${e} path=${n}`,{event:t});if(!this.matchRoute(e,n)){h(`HashRouter onRouteChange route=${e} path=${n} does not match`);return}const i=this.getRouteParams(e);await s(e,n,i)}))}getBasePath(){h("HashRouter getBasePath");return""}}function p(t={}){const e={isAuthenticated:false,tokenInfo:null,state:"ready",...t};const s=u(e);s.reset=()=>{for(const t in e){const n=e[t];s.set(t,n)}};return s}const y=":host{display:contents}";const R=y;const m=class{constructor(s){t(this,s);this.init=e(this,"init",7);this.loggedIn=e(this,"loggedIn",7);this.loggedOut=e(this,"loggedOut",7);this.handleAuthChange=async t=>{if(t){this.loggedIn.emit(this.host)}else{this.loggedOut.emit(this.host)}};this.authConfig=undefined;this.eventOverrides={};this.automaticComponentRegistration=true}connectedCallback(){h("[nylas-provider] connectedCallback")}async componentWillLoad(){h("[nylas-provider] componentWillLoad");this.stores={auth:p(),scheduler:c(),schedulerConfig:d()};this.baseProvider=new o(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=new w;this.nylasAuth=r({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const e=this.baseProvider?.getStore("auth");if(!e){throw new Error("The auth store is not set")}const s=this.baseProvider?.getStore("scheduler");if(!s){throw new Error("The scheduler store is not set")}const n=this.baseProvider?.getStore("schedulerConfig");if(!n){throw new Error("The scheduler config store is not set")}this.nylasConnector=new f(t,this.nylasAuth,e,s,n);const i=this.init.emit(this.host);if(!i.defaultPrevented){await(this.nylasConnector?.auth.validateSession())}this.handleAuthChange(e.state.isAuthenticated);this.baseProvider?.componentWillLoad(this.nylasConnector)}componentDidLoad(){const t=this.baseProvider?.getStore("auth");t?.onChange("isAuthenticated",this.handleAuthChange);this.baseProvider?.componentDidLoad()}componentDisconnected(){this.baseProvider?.componentDisconnected()}async registerComponentHandler(t){this.baseProvider?.registerComponent(t.detail)}async unregisterComponentHandler(t){this.baseProvider?.unregisterComponent(t.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getAuthStore(){return this.baseProvider?.getStore("auth")}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConfigStore(){return this.baseProvider?.getStore("schedulerConfig")}render(){return s(n,{key:"76eef3db651be4914d776517c3b45b4f66ae0d6e"},s("slot",{key:"fa05da1325ee5c8872fd1f6f21842563d6b4b568"}))}get host(){return i(this)}};m.style=R;export{m as nylas_provider};
2
- //# sourceMappingURL=p-de9d8218.entry.js.map
1
+ import{r as t,c as s,h as e,H as n,a as i}from"./p-6f5a3998.js";import{N as o,e as r}from"./p-189b24e6.js";import{a as h}from"./p-6b7fb948.js";import{N as a,C as c}from"./p-7d9cdd23.js";import{c as u}from"./p-fc5bc07b.js";import{C as d}from"./p-14894041.js";import"./p-c79dcb59.js";class l{constructor(t,s){this.nylasAuth=t;this.nylasAuthStore=s}async validateSession(){const t=await this.isAccessTokenValid();if(!t){this.logout()}else{let t=await this.nylasAuth.getTokenInfo();if(t){const s=5*60*1e3;const e=Math.floor(Date.now()/1e3);if(t.expires_in&&t.expires_in-e<s){h("[NylasAuthConnectorMixin] Refreshing access token");t=await this.nylasAuth.refreshAccessToken();if(!t){h("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out.");this.logout();return}}this.nylasAuthStore.state.tokenInfo=t}}this.nylasAuthStore.state.isAuthenticated=t}async isAuthenticated(){return this.nylasAuth.isAuthenticated()}async getTokenInfo(){return this.nylasAuth.getTokenInfo()}async isAccessTokenValid(){return this.nylasAuth.isAccessTokenValid()}async logout(){await this.nylasAuth.logout()}async getHostedAuthRedirectURL(t,s,e){return this.nylasAuth.getHostedAuthRedirectURL(t,s,e)}async manageHostedAuthCodeExchange(t){const s=new URL(t);const e=s.searchParams.get("code");if(e){const t=await this.nylasAuth.exchangeAuthCodeForTokenInfo(e);if(t){this.nylasAuthStore.state.tokenInfo=t;this.nylasAuthStore.state.isAuthenticated=true;return t}}return null}}class f{constructor(t,s,e,n,i,o="https://api.us.nylas.com"){this.router=t;this.schedulerAPIURL=o;this.nylasAuth=s;this.nylasAuthStore=e;this.nylasSchedulerStore=n;this.nylasSchedulerConfigStore=i}init(){h("NylasConnector init")}get authStore(){return this.nylasAuthStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){if(this._authConnector){return this._authConnector}this._authConnector=new l(this.nylasAuth,this.nylasAuthStore);return this._authConnector}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new a({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore});return this._schedulerAPIConnector}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset()}async logout(){await this.nylasAuth.logout();this.resetStores()}}class g extends Event{constructor(t,s){super(t,s);this.oldURL=s.oldURL;this.newURL=s.newURL}}class w{constructor(){this.routeChangeListeners=[];h("HashRouter constructor")}destroy(){h("HashRouter destroy");window.removeEventListener("hashchange",this.onRouteChange.bind(this))}init(){h("HashRouter init");window.addEventListener("hashchange",this.onRouteChange.bind(this));if(typeof HashChangeEvent!=="undefined"){const t=new HashChangeEvent("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}else{const t=new g("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}}addRouteChangeListener(t,s){h("HashRouter addRouteChangeListener");this.routeChangeListeners.push([t,s])}navigate(t,s){h("HashRouter navigate");if(s){return window.history.pushState(null,"",`#${t}`)}window.location.hash=t}setRoute(t){h("HashRouter setRoute");window.location.hash=t}matchRoute(t,s){const e=t.split("/");const n=s.split("/");h(`HashRouter matchRoute route=${t} path=${s}`,{routeParts:e,pathParts:n});if(e[1]===""&&n[0]===""){return true}if(e.length!==n.length){return false}for(let t=0;t<e.length;t++){const s=e[t];const i=n[t];if(s.startsWith(":")){continue}if(s!==i){return false}}return true}getRouteParams(t){h("HashRouter getRouteParams");const s={};const e=t.split("/");const n=window.location.hash.split("/");e.forEach(((t,e)=>{if(t.startsWith(":")){const i=t.substring(1);s[i]=n[e]}}));return s}getRouteWithParams(t,s){h("HashRouter getRouteWithParams");let e=t;Object.keys(s).forEach((t=>{e=e.replace(`:${t}`,s[t])}));return e}getRoute(){h("HashRouter getRoute");return window.location.hash}onRouteChange(t){this.routeChangeListeners.forEach((async([s,e])=>{const n=t.newURL.indexOf("#")===-1?"":t.newURL.substring(t.newURL.indexOf("#")+1);h(`HashRouter onRouteChange route=${s} path=${n}`,{event:t});if(!this.matchRoute(s,n)){h(`HashRouter onRouteChange route=${s} path=${n} does not match`);return}const i=this.getRouteParams(s);await e(s,n,i)}))}getBasePath(){h("HashRouter getBasePath");return""}}function p(t={}){const s={isAuthenticated:false,tokenInfo:null,state:"ready",...t};const e=u(s);e.reset=()=>{for(const t in s){const n=s[t];e.set(t,n)}};return e}const y=":host{display:contents}";const R=y;const m=class{constructor(e){t(this,e);this.init=s(this,"init",7);this.loggedIn=s(this,"loggedIn",7);this.loggedOut=s(this,"loggedOut",7);this.handleAuthChange=async t=>{if(t){this.loggedIn.emit(this.host)}else{this.loggedOut.emit(this.host)}};this.authConfig=undefined;this.eventOverrides={};this.automaticComponentRegistration=true}connectedCallback(){h("[nylas-provider] connectedCallback")}async componentWillLoad(){h("[nylas-provider] componentWillLoad");this.stores={auth:p(),scheduler:c(),schedulerConfig:d()};this.baseProvider=new o(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=new w;this.nylasAuth=r({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const s=this.baseProvider?.getStore("auth");if(!s){throw new Error("The auth store is not set")}const e=this.baseProvider?.getStore("scheduler");if(!e){throw new Error("The scheduler store is not set")}const n=this.baseProvider?.getStore("schedulerConfig");if(!n){throw new Error("The scheduler config store is not set")}this.nylasConnector=new f(t,this.nylasAuth,s,e,n);const i=this.init.emit(this.host);if(!i.defaultPrevented){await(this.nylasConnector?.auth.validateSession())}this.handleAuthChange(s.state.isAuthenticated);this.baseProvider?.componentWillLoad(this.nylasConnector)}componentDidLoad(){const t=this.baseProvider?.getStore("auth");t?.onChange("isAuthenticated",this.handleAuthChange);this.baseProvider?.componentDidLoad()}componentDisconnected(){this.baseProvider?.componentDisconnected()}async registerComponentHandler(t){this.baseProvider?.registerComponent(t.detail)}async unregisterComponentHandler(t){this.baseProvider?.unregisterComponent(t.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getAuthStore(){return this.baseProvider?.getStore("auth")}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConfigStore(){return this.baseProvider?.getStore("schedulerConfig")}render(){return e(n,{key:"76eef3db651be4914d776517c3b45b4f66ae0d6e"},e("slot",{key:"fa05da1325ee5c8872fd1f6f21842563d6b4b568"}))}get host(){return i(this)}};m.style=R;export{m as nylas_provider};
2
+ //# sourceMappingURL=p-5f683e34.entry.js.map